From 85c644496af3415bc9f5a694e1b5ae2cd9ef7427 Mon Sep 17 00:00:00 2001 From: DianeXD <64360468+DianeXD@users.noreply.github.com> Date: Fri, 1 Jul 2022 19:37:29 +0800 Subject: [PATCH] Fix infusion stabiliser (#17) * Update buildscript & spotlessApply * Fix infusion stabiliser --- README.md | 2 +- build.gradle | 395 +- dependencies.gradle | 12 +- repositories.gradle | 22 +- src/main/java/tb/api/ITobacco.java | 3 +- src/main/java/tb/api/RevolverUpgrade.java | 673 +- src/main/java/tb/client/RevolverEvents.java | 62 +- src/main/java/tb/client/gui/GuiRevolver.java | 94 +- .../java/tb/client/gui/GuiThaumicAnvil.java | 105 +- src/main/java/tb/client/gui/GuiVoidAnvil.java | 104 +- .../client/render/block/BrazierRenderer.java | 211 +- .../client/render/block/CampfireRenderer.java | 152 +- .../block/ThaumicRelocatorRenderer.java | 159 +- .../tb/client/render/entity/RenderBullet.java | 25 +- .../render/item/CastingBraceletRenderer.java | 379 +- .../render/item/HerobrinesScytheRenderer.java | 160 +- .../client/render/item/NodeFociRenderer.java | 59 +- .../render/item/NodeLinkerItemRenderer.java | 53 +- .../item/NodeManipulatorItemRenderer.java | 63 +- .../tb/client/render/item/RenderRevolver.java | 292 +- .../tile/RenderEntityDeconstructor.java | 158 +- .../client/render/tile/RenderNodeLinker.java | 36 +- .../render/tile/RenderNodeManipulator.java | 62 +- .../client/render/tile/RenderOverchanter.java | 65 +- .../block/BlockAdvAlchemicalFurnace.java | 262 +- .../java/tb/common/block/BlockAshroom.java | 69 +- .../tb/common/block/BlockAureliaLeaf.java | 46 +- .../tb/common/block/BlockAureliaPlant.java | 213 +- .../java/tb/common/block/BlockBrazier.java | 98 +- src/main/java/tb/common/block/BlockBriar.java | 273 +- .../java/tb/common/block/BlockCampfire.java | 154 +- .../tb/common/block/BlockCryingObelisk.java | 166 +- .../tb/common/block/BlockCrystalBlock.java | 91 +- .../tb/common/block/BlockCrystalSlab.java | 83 +- .../block/BlockEntityDeconstructor.java | 192 +- .../java/tb/common/block/BlockFlaxium.java | 65 +- .../java/tb/common/block/BlockHalfSlab.java | 101 +- src/main/java/tb/common/block/BlockKnose.java | 61 +- .../tb/common/block/BlockLucritePlant.java | 48 +- .../java/tb/common/block/BlockNodeLinker.java | 33 +- .../tb/common/block/BlockNodeManipulator.java | 120 +- .../tb/common/block/BlockOverchanter.java | 109 +- .../java/tb/common/block/BlockPyrofluid.java | 192 +- .../tb/common/block/BlockRainbowCactus.java | 66 +- .../java/tb/common/block/BlockRedlonStem.java | 203 +- .../java/tb/common/block/BlockRelocator.java | 278 +- src/main/java/tb/common/block/BlockSpike.java | 246 +- src/main/java/tb/common/block/BlockSweed.java | 79 +- .../java/tb/common/block/BlockTBLeaves.java | 649 +- src/main/java/tb/common/block/BlockTBLog.java | 120 +- .../java/tb/common/block/BlockTBPlant.java | 177 +- .../java/tb/common/block/BlockTBSapling.java | 149 +- .../tb/common/block/BlockThaumicAnvil.java | 61 +- src/main/java/tb/common/block/BlockVoid.java | 46 +- .../java/tb/common/block/BlockVoidAnvil.java | 106 +- src/main/java/tb/common/block/TBBlock.java | 67 +- .../java/tb/common/block/TBBlockDeco.java | 51 +- .../java/tb/common/block/TBSidedBlock.java | 26 +- .../EnchantmentElderKnowledge.java | 28 +- .../enchantment/EnchantmentEldritchBane.java | 31 +- .../enchantment/EnchantmentHandler.java | 372 +- .../enchantment/EnchantmentMagicTouch.java | 24 +- .../enchantment/EnchantmentTainted.java | 31 +- .../enchantment/EnchantmentVaporising.java | 25 +- .../common/entity/EntityAIAvoidCampfire.java | 111 +- .../common/entity/EntityRevolverBullet.java | 299 +- .../java/tb/common/event/TBEventHandler.java | 20 +- .../java/tb/common/event/WorldGenBigOak.java | 318 +- .../java/tb/common/event/WorldGenOak.java | 131 +- .../inventory/ContainerOverchanter.java | 84 +- .../common/inventory/ContainerRevolver.java | 341 +- .../inventory/ContainerThaumicAnvil.java | 386 +- .../common/inventory/ContainerVoidAnvil.java | 386 +- .../common/inventory/InventoryRevolver.java | 187 +- .../java/tb/common/item/ItemBloodyArmor.java | 142 +- .../tb/common/item/ItemCastingBracelet.java | 423 +- .../tb/common/item/ItemConcentratedTaint.java | 267 +- .../tb/common/item/ItemHerobrinesScythe.java | 331 +- .../tb/common/item/ItemKnoseFragment.java | 212 +- .../java/tb/common/item/ItemKnoseSeeds.java | 62 +- .../tb/common/item/ItemMortarAndPestle.java | 39 +- .../java/tb/common/item/ItemNodeFoci.java | 70 +- .../tb/common/item/ItemPyrofluidBucket.java | 37 +- .../java/tb/common/item/ItemRevolver.java | 557 +- .../java/tb/common/item/ItemRosehipSyrup.java | 164 +- .../java/tb/common/item/ItemSmokingPipe.java | 145 +- .../tb/common/item/ItemThauminiteArmor.java | 65 +- .../tb/common/item/ItemThauminiteAxe.java | 11 +- .../tb/common/item/ItemThauminiteHoe.java | 11 +- .../tb/common/item/ItemThauminitePickaxe.java | 11 +- .../tb/common/item/ItemThauminiteShears.java | 12 +- .../tb/common/item/ItemThauminiteShovel.java | 11 +- .../tb/common/item/ItemThauminiteSword.java | 11 +- .../tb/common/item/ItemVoidFlintAndSteel.java | 40 +- .../java/tb/common/item/ItemVoidShears.java | 39 +- src/main/java/tb/common/item/TBResource.java | 97 +- src/main/java/tb/common/item/TBTobacco.java | 348 +- .../tb/common/item/foci/FociActivation.java | 247 +- .../java/tb/common/item/foci/FociDrain.java | 325 +- .../tb/common/item/foci/FociExperience.java | 352 +- .../java/tb/common/item/foci/FociFlux.java | 367 +- .../tb/common/itemblock/ItemBlockCrystal.java | 28 +- .../common/itemblock/ItemBlockMetadata.java | 17 +- .../itemblock/ItemBlockModeManipulator.java | 11 +- .../common/itemblock/ItemBlockPyrofluid.java | 16 +- .../tb/common/itemblock/ItemBlockSlab_0.java | 23 +- .../tb/common/itemblock/ItemBlockSlab_1.java | 23 +- .../tb/common/itemblock/ItemBlockSpike.java | 35 +- .../common/itemblock/ItemBlockTBLeaves.java | 25 +- .../tb/common/itemblock/ItemBlockTBLogs.java | 25 +- .../common/itemblock/ItemBlockTBSapling.java | 30 +- .../common/tile/TileAdvAlchemicalFurnace.java | 118 +- src/main/java/tb/common/tile/TileBrazier.java | 160 +- .../java/tb/common/tile/TileCampfire.java | 280 +- .../common/tile/TileEntityDeconstructor.java | 299 +- .../java/tb/common/tile/TileNodeLinker.java | 694 +- .../tb/common/tile/TileNodeManipulator.java | 661 +- .../java/tb/common/tile/TileOverchanter.java | 549 +- .../java/tb/common/tile/TileRelocator.java | 315 +- src/main/java/tb/core/TBCore.java | 166 +- src/main/java/tb/init/FakeResearchItem.java | 53 +- src/main/java/tb/init/TBBlocks.java | 509 +- src/main/java/tb/init/TBEnchant.java | 112 +- src/main/java/tb/init/TBFociUpgrades.java | 59 +- src/main/java/tb/init/TBItems.java | 396 +- src/main/java/tb/init/TBRecipes.java | 295 +- src/main/java/tb/init/TBThaumonomicon.java | 6694 +++++++++++------ src/main/java/tb/init/TBTiles.java | 24 +- src/main/java/tb/network/proxy/PacketTB.java | 51 +- src/main/java/tb/network/proxy/TBClient.java | 170 +- .../tb/network/proxy/TBNetworkManager.java | 61 +- src/main/java/tb/network/proxy/TBServer.java | 112 +- .../java/tb/utils/RevolverInfusionRecipe.java | 170 +- src/main/java/tb/utils/TBConfig.java | 235 +- src/main/java/tb/utils/TBUtils.java | 84 +- 135 files changed, 14445 insertions(+), 13271 deletions(-) diff --git a/README.md b/README.md index 45ef634..26efeda 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # ThaumicBases -An addon for ThaumCraft 4(made by Azanor), which adds a lot of random things. +An addon for ThaumCraft 4(made by Azanor), which adds a lot of random things. ThaumicBases is redistributed under CreativeCommons 4.0 share-alike license(http://creativecommons.org/licenses/by-sa/4.0/) diff --git a/build.gradle b/build.gradle index be841eb..f7b86d0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1644349045 +//version: 1656003794 /* DO NOT CHANGE THIS FILE! @@ -9,26 +9,33 @@ Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.g 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,21 +44,28 @@ buildscript { } plugins { + id 'java-library' id 'idea' id 'eclipse' id 'scala' id 'maven-publish' - id('org.jetbrains.kotlin.jvm') version ('1.6.10') 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 '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) @@ -70,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 '*.md', '.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()) } @@ -96,6 +141,10 @@ 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/" @@ -167,8 +216,8 @@ configurations.all { try { 'git config core.fileMode false'.execute() } -catch (Exception e) { - logger.error("\u001B[31mgit isn't installed at all\u001B[0m") +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 @@ -177,19 +226,22 @@ String versionOverride = System.getenv("VERSION") ?: null try { identifiedVersion = versionOverride == null ? gitVersion() : versionOverride } -catch (Exception e) { - logger.error("\n\u001B[1;31mThis mod must be version controlled by Git AND the repository must provide at least one tag,\n" + - "or the VERSION override must be set! \u001B[32m(Don't download from GitHub using the ZIP option, instead\n" + - "clone the repository, see\u001B[33m https://gtnh.miraheze.org/wiki/Development \u001B[32mfor details.)\u001B[0m\n"); +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 -String modVersion = identifiedVersion +ext { + modVersion = identifiedVersion +} -if( identifiedVersion.equals(versionOverride) ) { - logger.error('\u001B[31m\u001B[7mWe hope you know what you\'re doing using\u001B[0m\u001B[1;34m ' + modVersion + '\u001B[0m\n'); - logger.error('\7\u001B[31mGoing to blindly try to use\u001B[1;34m ' + modVersion + '\u001B[0m\u001B[31m, this probably won\'t work the way you expect!!\u001B[0m\n'); +if(identifiedVersion == versionOverride) { + out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } group = modGroup @@ -200,22 +252,25 @@ else { archivesBaseName = modId } - def arguments = [] def jvmArguments = [] -if(usesMixins.toBoolean()) { +if (usesMixins.toBoolean()) { arguments += [ "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] - jvmArguments += [ - "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true" - ] + 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 @@ -248,8 +303,8 @@ minecraft { } } -if(file("addon.gradle").exists()) { - apply from: "addon.gradle" +if(file('addon.gradle').exists()) { + apply from: 'addon.gradle' } apply from: 'repositories.gradle' @@ -262,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": [] } - """ + } } } @@ -401,21 +461,20 @@ 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 - + // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, - "modVersion": modVersion, - "modId": modId, - "modName": modName + "modVersion": modVersion, + "modId": modId, + "modName": modName } if(usesMixins.toBoolean()) { @@ -430,7 +489,7 @@ processResources def getManifestAttributes() { def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } @@ -446,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') } @@ -508,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("\\.", "/") + '/**' } @@ -533,12 +592,15 @@ artifacts { } } -// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), +// 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) { @@ -547,7 +609,7 @@ publishing { artifact source: shadowJar, classifier: "" } if(!noPublishedSources) { - artifact source: sourcesJar, classifier: "src" + artifact source: sourcesJar, classifier: "sources" } artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" if (apiPackage) { @@ -558,17 +620,21 @@ 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 who knows where + + // remove extra garbage from minecraft and minecraftDeps configuration pom.withXml { - def badPomGroup = ['net.minecraft', 'com.google.code.findbugs', 'org.ow2.asm', 'com.typesafe.akka', 'com.typesafe', 'org.scala-lang', - 'org.scala-lang.plugins', 'net.sf.jopt-simple', 'lzma', 'com.mojang', 'org.apache.commons', 'org.apache.httpcomponents', - 'commons-logging', 'java3d', 'net.sf.trove4j', 'com.ibm.icu', 'com.paulscode', 'io.netty', 'com.google.guava', - 'commons-io', 'commons-codec', 'net.java.jinput', 'net.java.jutils', 'com.google.code.gson', 'org.apache.logging.log4j', - 'org.lwjgl.lwjgl', 'tv.twitch', ''] + 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() { - badPomGroup.contains(it.groupId.text()) + badArtifacts[it.groupId.text()].contains(it.artifactId.text()) }.each() { it.parent().remove(it) } @@ -600,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'") } } @@ -612,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 @@ -627,7 +693,6 @@ boolean isNewBuildScriptVersionAvailable(String projectDir) { String availableBuildScriptHash = getVersionHash(availableBuildScript) boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash - return !isUpToDate } static String getVersionHash(String buildScriptContent) { @@ -643,7 +708,103 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } -// Deobfuscation +// Parameter Deobfuscation + +task deobfParams { + doLast { + + String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" + String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + String paramsCSV = "$mcpDir/params.csv" + + download.run { + src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + dest mcpZIP + overwrite false + } + + if(!file(paramsCSV).exists()) { + println("Extracting MCP archive ...") + unzip(mcpZIP, mcpDir) + } + + println("Parsing params.csv ...") + Map params = new HashMap<>() + Files.lines(Paths.get(paramsCSV)).forEach{line -> + String[] cells = line.split(",") + if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { + params.put(cells[0], cells[1]) + } + } + + out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") + out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") + } +} + +static int replaceParams(File file, Map params) { + int fileCount = 0 + + if(file.isDirectory()) { + for(File f : file.listFiles()) { + fileCount += replaceParams(f, params) + } + return fileCount + } + println("Visiting ${file.getName()} ...") + try { + String content = new String(Files.readAllBytes(file.toPath())) + int hash = content.hashCode() + params.forEach{key, value -> + content = content.replaceAll(key, value) + } + if(hash != content.hashCode()) { + Files.write(file.toPath(), content.getBytes("UTF-8")) + return 1 + } + } catch(Exception e) { + e.printStackTrace() + } + return 0 +} + +// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) +static unzip(String zipFileName, String outputDir) { + byte[] buffer = new byte[16384] + ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) + ZipEntry zipEntry = zis.getNextEntry() + while (zipEntry != null) { + File newFile = new File(outputDir + File.separator, zipEntry.name) + if (zipEntry.isDirectory()) { + if (!newFile.isDirectory() && !newFile.mkdirs()) { + throw new IOException("Failed to create directory $newFile") + } + } else { + // fix for Windows-created archives + File parent = newFile.parentFile + if (!parent.isDirectory() && !parent.mkdirs()) { + throw new IOException("Failed to create directory $parent") + } + // write file content + FileOutputStream fos = new FileOutputStream(newFile) + int len = 0 + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len) + } + fos.close() + } + zipEntry = zis.getNextEntry() + } + zis.closeEntry() + zis.close() +} + +configure(deobfParams) { + group = 'forgegradle' + description = 'Rename all obfuscated parameter names inherited from Minecraft classes' +} + +// Dependency Deobfuscation def deobf(String sourceURL) { try { @@ -656,7 +817,7 @@ def deobf(String sourceURL) { fileName = fileName.substring(lastSlash + 1) } //get rid of extension: - if(fileName.endsWith(".jar")) { + if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")) } @@ -668,26 +829,40 @@ def deobf(String sourceURL) { Collections.reverse(parts) hostName = String.join(".", parts) - return deobf(sourceURL, hostName + "/" + fileName) + return deobf(sourceURL, "$hostName/$fileName") } catch(Exception e) { - return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") } } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String fileName) { - String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" - String bon2Dir = cacheDir + "forge_gradle/deobf" - String bon2File = bon2Dir + "/BON2-2.5.0.jar" - String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar" - String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar" - +def deobf(String sourceURL, String rawFileName) { + String bon2Version = "2.5.1" + String fileName = URLDecoder.decode(rawFileName, "UTF-8") + String cacheDir = "$project.gradle.gradleUserHomeDir/caches" + String bon2Dir = "$cacheDir/forge_gradle/deobf" + String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" + String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" + String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" + if(file(deobfFile).exists()) { return files(deobfFile) } + String mappingsVer + if(remoteMappings) { + String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" + String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" + + zipMappings(mappingsZIP, remoteMappings, bon2Dir) + + mappingsVer = "snapshot_$id" + } else { + mappingsVer = "${channel}_$mappingsVersion" + } + download.run { - src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' + src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" dest bon2File quiet true overwrite false @@ -701,22 +876,56 @@ def deobf(String sourceURL, String fileName) { } exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' workingDir bon2Dir - standardOutput = new ByteArrayOutputStream() + standardOutput = new FileOutputStream("${deobfFile}.log") } return files(deobfFile) } +def zipMappings(String zipPath, String url, String bon2Dir) { + File zipFile = new File(zipPath) + if(zipFile.exists()) { + return + } + + String fieldsCache = "$bon2Dir/data/fields.csv" + String methodsCache = "$bon2Dir/data/methods.csv" + + download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true + } + download.run { + src "${url}methods.csv" + dest methodsCache + quiet true + } + + zipFile.getParentFile().mkdirs() + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) + + zos.putNextEntry(new ZipEntry("fields.csv")) + Files.copy(Paths.get(fieldsCache), zos) + zos.closeEntry() + + zos.putNextEntry(new ZipEntry("methods.csv")) + Files.copy(Paths.get(methodsCache), zos) + zos.closeEntry() + + zos.close() +} + // Helper methods def checkPropertyExists(String propertyName) { - 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") } } def getFile(String relativePath) { return new File(projectDir, relativePath) -} +} \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle index e987507..1704931 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,11 +1,11 @@ // Add your dependencies here dependencies { - compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') - compile('curse.maven:dummycore-230103:2244260') - compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev') - runtime("com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev") + compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') + compile('curse.maven:dummycore-230103:2244260') + compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev') + runtime("com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev") - runtime('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') - runtime('com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev') // Required to allow dummycore to run in dev + runtime('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') + runtime('com.github.GTNewHorizons:CodeChickenCore:1.1.5:dev') // Required to allow dummycore to run in dev } diff --git a/repositories.gradle b/repositories.gradle index 89c5ce1..bbc7b3e 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,15 +1,15 @@ // Add any additional repositories for your dependencies here repositories { - maven { - name 'GTNH Maven' - url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' - allowInsecureProtocol - } - maven { - url 'https://cursemaven.com' - } - maven { - url 'https://jitpack.io' - } + maven { + name 'GTNH Maven' + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' + allowInsecureProtocol + } + maven { + url 'https://cursemaven.com' + } + maven { + url 'https://jitpack.io' + } } diff --git a/src/main/java/tb/api/ITobacco.java b/src/main/java/tb/api/ITobacco.java index 45c6371..d987119 100644 --- a/src/main/java/tb/api/ITobacco.java +++ b/src/main/java/tb/api/ITobacco.java @@ -3,7 +3,6 @@ package tb.api; import net.minecraft.entity.player.EntityPlayer; public interface ITobacco { - - public abstract void performTobaccoEffect(EntityPlayer smoker, int metadata, boolean isSilverwood); + public abstract void performTobaccoEffect(EntityPlayer smoker, int metadata, boolean isSilverwood); } diff --git a/src/main/java/tb/api/RevolverUpgrade.java b/src/main/java/tb/api/RevolverUpgrade.java index 7525de8..64370ee 100644 --- a/src/main/java/tb/api/RevolverUpgrade.java +++ b/src/main/java/tb/api/RevolverUpgrade.java @@ -1,15 +1,9 @@ package tb.api; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.Loader; import java.util.ArrayList; import java.util.Hashtable; - -import tb.utils.TBUtils; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.entities.IEldritchMob; -import thaumcraft.api.entities.ITaintedMob; -import thaumcraft.common.config.Config; -import thaumcraft.common.lib.research.ScanManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.boss.IBossDisplayData; @@ -22,349 +16,326 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.common.IExtendedEntityProperties; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.Loader; +import tb.utils.TBUtils; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.entities.IEldritchMob; +import thaumcraft.api.entities.ITaintedMob; +import thaumcraft.common.config.Config; +import thaumcraft.common.lib.research.ScanManager; public class RevolverUpgrade { - - public static RevolverUpgrade[] allUpgrades = new RevolverUpgrade[24]; - public static Hashtable textToIntMapping = new Hashtable(); - public static Hashtable intToTextMapping = new Hashtable(); - - public int maxLevel; - public final int id; - public final String text_id; - public int instability; - - public static final ResourceLocation eldritchTextures = new ResourceLocation("thaumicbases","textures/items/revolver/revolverDarkMetalEldritch.png"); - public static final ResourceLocation primalTextures = new ResourceLocation("thaumicbases","textures/items/revolver/revolverGunPrimalUV.png"); - public static final ResourceLocation taintedTextures = new ResourceLocation("thaumicbases","textures/items/revolver/revolverGunTaintedUV.png"); - public static final ResourceLocation voidTextures = new ResourceLocation("thaumicbases","textures/items/revolver/revolverHandleVoidUV.png"); - - public final ArrayList conflicts = new ArrayList(); - - public RevolverUpgrade(int id, String name) - { - text_id = name; - this.id = id; - - if(id < allUpgrades.length && allUpgrades[id] != null) - { - FMLLog.warning("[TB]Attempting to register revolver upgrade "+name+"["+id+"], but the ID is already occupied by "+allUpgrades[id].text_id+"["+allUpgrades[id].id+"], ignoring.", new Object[0]); - return; - } - - if (id >= allUpgrades.length) - { - RevolverUpgrade[] copied = new RevolverUpgrade[allUpgrades.length+1]; - System.arraycopy(allUpgrades, 0, copied, 0, allUpgrades.length); - allUpgrades = copied; - } - - allUpgrades[id] = this; - } - - public String getName() - { - return StatCollector.translateToLocal("revolverUpgrade."+text_id+".name"); - } - - public int getID() - { - return id; - } - - public String getTextID() - { - return text_id; - } - - public int getMaxLevel() - { - return maxLevel; - } - - public RevolverUpgrade setMaxLevel(int i) - { - maxLevel = i; - return this; - } - - public boolean conflictsWith(RevolverUpgrade upgrade) - { - return conflicts.contains(upgrade); - } - - public RevolverUpgrade addConflict(RevolverUpgrade... upgrade) - { - for(RevolverUpgrade rUpgr : upgrade) - { - if(!conflicts.contains(rUpgr)) - conflicts.add(rUpgr); - - if(!rUpgr.conflicts.contains(this)) - rUpgr.conflicts.add(this); - } - - return this; - } - - public int getInstabilityForLevel(int level) - { - return instability * level; - } - - public RevolverUpgrade setInstabilityPerLevel(int newValue) - { - instability = newValue; - return this; - } - - /** - * Modifies the revolver damage - pass 0 - * @param base - the entity to modify against. null means that the modification is not applied for the attack, and rather is applied for the information. - * @param revolver - the revolver - * @param currentModification - damage BEFORE the modification - * @param modLevel - the level of this modifier - * @return the new damage value - */ - public float modifyDamage_start(EntityLivingBase base, ItemStack revolver, float currentModification, int modLevel) - { - if(base != null) - { - if(this == power) - return (float) (currentModification*(Math.pow(1.1F, modLevel))); - - if(this == silver && (base.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD || isBMEntity(base) || (base instanceof EntityPlayer && isWerewolf(EntityPlayer.class.cast(base))))) - return (float) (currentModification*(Math.pow(1.2F, modLevel))); - - if(this == atropodsBane && base.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) - return (float) (currentModification*(Math.pow(1.2F, modLevel))); - - if(this == eldritchBane && (base instanceof IEldritchMob || base instanceof EntityEnderman)) - return (float) (currentModification*(Math.pow(1.2F, modLevel))); - - if(this == dueling && base instanceof EntityPlayer) - return (float) (currentModification*(Math.pow(1.2F, modLevel))); - - if(this == eldritch) - { - if(base instanceof IBossDisplayData) - return (float) (currentModification*(Math.pow(1.3F, modLevel))); - else - return currentModification / 1.2F; - } - - if(this == piercig) - return currentModification * 1.1F; - - if(this == tainted) - { - if(base instanceof ITaintedMob) - return currentModification / 1.6F; - else - return (float) (currentModification*(Math.pow(1.2F, modLevel))); - } - } - return currentModification; - } - - /** - * Modifies the revolver damage - pass 1 - * @param base - the entity to modify against. null means that the modification is not applied for the attack, and rather is applied for the information. - * @param revolver - the revolver - * @param currentModification - damage BEFORE the modification - * @param modLevel - the level of this modifier - * @return the new damage value - */ - public float modifyDamage_end(EntityLivingBase base, ItemStack revolver, float currentModification, int modLevel) - { - if(this == primal) - return currentModification * 2; - - return currentModification; - } - - /** - * Used to check if the bullet is destroyed. - * @param base the entity damaged - * @param user the shooter(can be null?) - * @param revolver the revolver - * @param damageDealt the damage dealt - * @param modLevel the level of this upgrade - * @return true to destroy bulled, false otherwise - */ - public boolean afterhit(EntityLivingBase base, EntityPlayer user,ItemStack revolver,final float damageDealt, int modLevel) - { - if(this == tainted) - if(base.worldObj.rand.nextDouble() <= 0.1D) - base.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID,200,1,true)); - - if(this == poisoned) - base.addPotionEffect(new PotionEffect(Potion.poison.id,200,1,true)); - - if(this == knowledge && base.getHealth() <= 0 && user != null) - { - if(user.worldObj.rand.nextInt(Math.max(1, 7-modLevel)) == 0) - { - AspectList aspectsCompound = ScanManager.generateEntityAspects(base); - if(aspectsCompound != null && aspectsCompound.size() > 0) - { - Aspect[] al = aspectsCompound.getAspects(); - for(int i = 0; i < al.length; ++i) - { - TBUtils.addAspectToKnowledgePool(user, al[i], (short) 1); - if(user.worldObj.rand.nextBoolean()) - break; - } - } - } - } - - - if(this == piercig) - return false; - - return true; - } - - /** - * Used to check if the bullet can travel through the ground or should get destroyed on contact - * @param user the player using the weapon(can be null?) - * @param revolver the revolver - * @param modLevel the level of this upgrade - * @return - */ - public boolean bulletNoclip(EntityPlayer user,ItemStack revolver, int modLevel) - { - if(this == primal) - return true; - - return false; - } - - /** - * Used to get the amount of shots 1 aspect point gives to the weapon - * @param user the player - * @param revolver the gun - * @param modLevel this level - * @param originalLevel 2 or the result of previous run of this - * @param hasPrimal if the primal upgrade is installed - * @return -1 for 2 consumption, anythingelse otherwise - */ - public int modifyShots(EntityPlayer user, ItemStack revolver, int modLevel, int originalLevel, boolean hasPrimal) - { - if(this == primal) - return -1; - - if(this == efficiency) - return hasPrimal ? modLevel == 5 ? 1 : -1 : originalLevel+modLevel; - - return originalLevel; - } - - /** - * Used to modify the bullet speed - * @param user the player - * @param revolver the gun - * @param origSpeed the original bullet speed - * @param modLevel the level of the modifier - * @return - */ - public double modifySpeed(EntityPlayer user, ItemStack revolver, float origSpeed, int modLevel) - { - if(this == speed) - return (float)origSpeed*Math.pow(1.09F, modLevel); - return origSpeed; - } - - /** - * Used for rendering to override the texture for a specific part of the weapon. If 2 or more upgrades override the same part texture the latest in the list will get rendered. - * @param revolver the revolver - * @param part The actual part.
0 = Handle
1 = Cylinder
2 = generic metal texture
3 = Barrel
4 = Trigger - * @param level The level of this upgrade - * @return null if the texture is not overriden, your texture otherwise. - */ - public ResourceLocation getOverridePartTexture(ItemStack revolver, int part, int level) - { - if(this == eldritch && part == 2) - return eldritchTextures; - - if(this == primal && part == 3) - return primalTextures; - - if(this == tainted && part == 3) - return taintedTextures; - - if(this == uvoid && part == 0) - return voidTextures; - - return null; - } - - public boolean isBMEntity(EntityLivingBase base) - { - if(Loader.isModLoaded("AWWayofTime")) - { - try - { - Class demonClass = Class.forName("WayofTime.alchemicalWizardry.common.IDemon"); - if(demonClass.isInstance(base)) - return true; - } - catch(Exception e) - { - return false; - } - } - return false; - } - - public boolean isWerewolf(EntityPlayer p) - { - if(Loader.isModLoaded("witchery")) - { - if(p.getExtendedProperties("WitcheryExtendedPlayer") != null) - { - IExtendedEntityProperties props = p.getExtendedProperties("WitcheryExtendedPlayer"); - NBTTagCompound tag = new NBTTagCompound(); - props.saveNBTData(tag); - return tag.getCompoundTag("WitcheryExtendedPlayer").getInteger("WerewolfLevel") > 0 || tag.getInteger("WerewolfLevel") > 0; - } - } - return false; - } - - public static void initConflictingMappings() - { - power.addConflict(silver,atropodsBane,eldritchBane,dueling,eldritch); - silver.addConflict(atropodsBane,eldritchBane,dueling,eldritch); - atropodsBane.addConflict(eldritchBane,dueling,eldritch); - eldritchBane.addConflict(dueling,eldritch); - dueling.addConflict(eldritch); - - accuracy.addConflict(speed,efficiency); - speed.addConflict(efficiency); - - poisoned.addConflict(primal,tainted,knowledge); - primal.addConflict(tainted,knowledge); - tainted.addConflict(knowledge); - } - - public static final RevolverUpgrade power = new RevolverUpgrade(0,"POWER").setMaxLevel(5).setInstabilityPerLevel(2); - public static final RevolverUpgrade accuracy = new RevolverUpgrade(1,"ACCURACY").setMaxLevel(3).setInstabilityPerLevel(1); - public static final RevolverUpgrade silver = new RevolverUpgrade(2,"SILVER").setMaxLevel(5).setInstabilityPerLevel(3); - public static final RevolverUpgrade poisoned = new RevolverUpgrade(3,"POISONED").setMaxLevel(3).setInstabilityPerLevel(1); - public static final RevolverUpgrade atropodsBane = new RevolverUpgrade(4,"BANE_OF_ATROPODS").setMaxLevel(5).setInstabilityPerLevel(3); - public static final RevolverUpgrade eldritchBane = new RevolverUpgrade(5,"BANE_OF_ELDRITCH").setMaxLevel(5).setInstabilityPerLevel(3); - public static final RevolverUpgrade piercig = new RevolverUpgrade(6,"PIERCING").setMaxLevel(1).setInstabilityPerLevel(12); - public static final RevolverUpgrade dueling = new RevolverUpgrade(7,"DUELING").setMaxLevel(5).setInstabilityPerLevel(3); - public static final RevolverUpgrade tainted = new RevolverUpgrade(8,"TAINTED").setMaxLevel(3).setInstabilityPerLevel(5); - public static final RevolverUpgrade primal = new RevolverUpgrade(9,"PRIMAL").setMaxLevel(1).setInstabilityPerLevel(12); - public static final RevolverUpgrade speed = new RevolverUpgrade(10,"SPEED").setMaxLevel(5).setInstabilityPerLevel(2); - public static final RevolverUpgrade efficiency = new RevolverUpgrade(11,"EFFICIENCY").setMaxLevel(5).setInstabilityPerLevel(4); - public static final RevolverUpgrade eldritch = new RevolverUpgrade(12,"ELDRITCH").setMaxLevel(2).setInstabilityPerLevel(7); - public static final RevolverUpgrade uvoid = new RevolverUpgrade(13,"VOID").setMaxLevel(3).setInstabilityPerLevel(4); - public static final RevolverUpgrade knowledge = new RevolverUpgrade(14,"KNOWLEDGE").setMaxLevel(5).setInstabilityPerLevel(1); - public static final RevolverUpgrade heavy = new RevolverUpgrade(15,"HEAVY").setMaxLevel(5).setInstabilityPerLevel(1); + + public static RevolverUpgrade[] allUpgrades = new RevolverUpgrade[24]; + public static Hashtable textToIntMapping = new Hashtable(); + public static Hashtable intToTextMapping = new Hashtable(); + + public int maxLevel; + public final int id; + public final String text_id; + public int instability; + + public static final ResourceLocation eldritchTextures = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverDarkMetalEldritch.png"); + public static final ResourceLocation primalTextures = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverGunPrimalUV.png"); + public static final ResourceLocation taintedTextures = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverGunTaintedUV.png"); + public static final ResourceLocation voidTextures = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverHandleVoidUV.png"); + + public final ArrayList conflicts = new ArrayList(); + + public RevolverUpgrade(int id, String name) { + text_id = name; + this.id = id; + + if (id < allUpgrades.length && allUpgrades[id] != null) { + FMLLog.warning( + "[TB]Attempting to register revolver upgrade " + name + "[" + id + + "], but the ID is already occupied by " + allUpgrades[id].text_id + "[" + + allUpgrades[id].id + "], ignoring.", + new Object[0]); + return; + } + + if (id >= allUpgrades.length) { + RevolverUpgrade[] copied = new RevolverUpgrade[allUpgrades.length + 1]; + System.arraycopy(allUpgrades, 0, copied, 0, allUpgrades.length); + allUpgrades = copied; + } + + allUpgrades[id] = this; + } + + public String getName() { + return StatCollector.translateToLocal("revolverUpgrade." + text_id + ".name"); + } + + public int getID() { + return id; + } + + public String getTextID() { + return text_id; + } + + public int getMaxLevel() { + return maxLevel; + } + + public RevolverUpgrade setMaxLevel(int i) { + maxLevel = i; + return this; + } + + public boolean conflictsWith(RevolverUpgrade upgrade) { + return conflicts.contains(upgrade); + } + + public RevolverUpgrade addConflict(RevolverUpgrade... upgrade) { + for (RevolverUpgrade rUpgr : upgrade) { + if (!conflicts.contains(rUpgr)) conflicts.add(rUpgr); + + if (!rUpgr.conflicts.contains(this)) rUpgr.conflicts.add(this); + } + + return this; + } + + public int getInstabilityForLevel(int level) { + return instability * level; + } + + public RevolverUpgrade setInstabilityPerLevel(int newValue) { + instability = newValue; + return this; + } + + /** + * Modifies the revolver damage - pass 0 + * @param base - the entity to modify against. null means that the modification is not applied for the attack, and rather is applied for the information. + * @param revolver - the revolver + * @param currentModification - damage BEFORE the modification + * @param modLevel - the level of this modifier + * @return the new damage value + */ + public float modifyDamage_start( + EntityLivingBase base, ItemStack revolver, float currentModification, int modLevel) { + if (base != null) { + if (this == power) return (float) (currentModification * (Math.pow(1.1F, modLevel))); + + if (this == silver + && (base.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD + || isBMEntity(base) + || (base instanceof EntityPlayer && isWerewolf(EntityPlayer.class.cast(base))))) + return (float) (currentModification * (Math.pow(1.2F, modLevel))); + + if (this == atropodsBane && base.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) + return (float) (currentModification * (Math.pow(1.2F, modLevel))); + + if (this == eldritchBane && (base instanceof IEldritchMob || base instanceof EntityEnderman)) + return (float) (currentModification * (Math.pow(1.2F, modLevel))); + + if (this == dueling && base instanceof EntityPlayer) + return (float) (currentModification * (Math.pow(1.2F, modLevel))); + + if (this == eldritch) { + if (base instanceof IBossDisplayData) return (float) (currentModification * (Math.pow(1.3F, modLevel))); + else return currentModification / 1.2F; + } + + if (this == piercig) return currentModification * 1.1F; + + if (this == tainted) { + if (base instanceof ITaintedMob) return currentModification / 1.6F; + else return (float) (currentModification * (Math.pow(1.2F, modLevel))); + } + } + return currentModification; + } + + /** + * Modifies the revolver damage - pass 1 + * @param base - the entity to modify against. null means that the modification is not applied for the attack, and rather is applied for the information. + * @param revolver - the revolver + * @param currentModification - damage BEFORE the modification + * @param modLevel - the level of this modifier + * @return the new damage value + */ + public float modifyDamage_end(EntityLivingBase base, ItemStack revolver, float currentModification, int modLevel) { + if (this == primal) return currentModification * 2; + + return currentModification; + } + + /** + * Used to check if the bullet is destroyed. + * @param base the entity damaged + * @param user the shooter(can be null?) + * @param revolver the revolver + * @param damageDealt the damage dealt + * @param modLevel the level of this upgrade + * @return true to destroy bulled, false otherwise + */ + public boolean afterhit( + EntityLivingBase base, EntityPlayer user, ItemStack revolver, final float damageDealt, int modLevel) { + if (this == tainted) + if (base.worldObj.rand.nextDouble() <= 0.1D) + base.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 200, 1, true)); + + if (this == poisoned) base.addPotionEffect(new PotionEffect(Potion.poison.id, 200, 1, true)); + + if (this == knowledge && base.getHealth() <= 0 && user != null) { + if (user.worldObj.rand.nextInt(Math.max(1, 7 - modLevel)) == 0) { + AspectList aspectsCompound = ScanManager.generateEntityAspects(base); + if (aspectsCompound != null && aspectsCompound.size() > 0) { + Aspect[] al = aspectsCompound.getAspects(); + for (int i = 0; i < al.length; ++i) { + TBUtils.addAspectToKnowledgePool(user, al[i], (short) 1); + if (user.worldObj.rand.nextBoolean()) break; + } + } + } + } + + if (this == piercig) return false; + + return true; + } + + /** + * Used to check if the bullet can travel through the ground or should get destroyed on contact + * @param user the player using the weapon(can be null?) + * @param revolver the revolver + * @param modLevel the level of this upgrade + * @return + */ + public boolean bulletNoclip(EntityPlayer user, ItemStack revolver, int modLevel) { + if (this == primal) return true; + + return false; + } + + /** + * Used to get the amount of shots 1 aspect point gives to the weapon + * @param user the player + * @param revolver the gun + * @param modLevel this level + * @param originalLevel 2 or the result of previous run of this + * @param hasPrimal if the primal upgrade is installed + * @return -1 for 2 consumption, anythingelse otherwise + */ + public int modifyShots(EntityPlayer user, ItemStack revolver, int modLevel, int originalLevel, boolean hasPrimal) { + if (this == primal) return -1; + + if (this == efficiency) return hasPrimal ? modLevel == 5 ? 1 : -1 : originalLevel + modLevel; + + return originalLevel; + } + + /** + * Used to modify the bullet speed + * @param user the player + * @param revolver the gun + * @param origSpeed the original bullet speed + * @param modLevel the level of the modifier + * @return + */ + public double modifySpeed(EntityPlayer user, ItemStack revolver, float origSpeed, int modLevel) { + if (this == speed) return (float) origSpeed * Math.pow(1.09F, modLevel); + return origSpeed; + } + + /** + * Used for rendering to override the texture for a specific part of the weapon. If 2 or more upgrades override the same part texture the latest in the list will get rendered. + * @param revolver the revolver + * @param part The actual part.
0 = Handle
1 = Cylinder
2 = generic metal texture
3 = Barrel
4 = Trigger + * @param level The level of this upgrade + * @return null if the texture is not overriden, your texture otherwise. + */ + public ResourceLocation getOverridePartTexture(ItemStack revolver, int part, int level) { + if (this == eldritch && part == 2) return eldritchTextures; + + if (this == primal && part == 3) return primalTextures; + + if (this == tainted && part == 3) return taintedTextures; + + if (this == uvoid && part == 0) return voidTextures; + + return null; + } + + public boolean isBMEntity(EntityLivingBase base) { + if (Loader.isModLoaded("AWWayofTime")) { + try { + Class demonClass = Class.forName("WayofTime.alchemicalWizardry.common.IDemon"); + if (demonClass.isInstance(base)) return true; + } catch (Exception e) { + return false; + } + } + return false; + } + + public boolean isWerewolf(EntityPlayer p) { + if (Loader.isModLoaded("witchery")) { + if (p.getExtendedProperties("WitcheryExtendedPlayer") != null) { + IExtendedEntityProperties props = p.getExtendedProperties("WitcheryExtendedPlayer"); + NBTTagCompound tag = new NBTTagCompound(); + props.saveNBTData(tag); + return tag.getCompoundTag("WitcheryExtendedPlayer").getInteger("WerewolfLevel") > 0 + || tag.getInteger("WerewolfLevel") > 0; + } + } + return false; + } + + public static void initConflictingMappings() { + power.addConflict(silver, atropodsBane, eldritchBane, dueling, eldritch); + silver.addConflict(atropodsBane, eldritchBane, dueling, eldritch); + atropodsBane.addConflict(eldritchBane, dueling, eldritch); + eldritchBane.addConflict(dueling, eldritch); + dueling.addConflict(eldritch); + + accuracy.addConflict(speed, efficiency); + speed.addConflict(efficiency); + + poisoned.addConflict(primal, tainted, knowledge); + primal.addConflict(tainted, knowledge); + tainted.addConflict(knowledge); + } + + public static final RevolverUpgrade power = + new RevolverUpgrade(0, "POWER").setMaxLevel(5).setInstabilityPerLevel(2); + public static final RevolverUpgrade accuracy = + new RevolverUpgrade(1, "ACCURACY").setMaxLevel(3).setInstabilityPerLevel(1); + public static final RevolverUpgrade silver = + new RevolverUpgrade(2, "SILVER").setMaxLevel(5).setInstabilityPerLevel(3); + public static final RevolverUpgrade poisoned = + new RevolverUpgrade(3, "POISONED").setMaxLevel(3).setInstabilityPerLevel(1); + public static final RevolverUpgrade atropodsBane = + new RevolverUpgrade(4, "BANE_OF_ATROPODS").setMaxLevel(5).setInstabilityPerLevel(3); + public static final RevolverUpgrade eldritchBane = + new RevolverUpgrade(5, "BANE_OF_ELDRITCH").setMaxLevel(5).setInstabilityPerLevel(3); + public static final RevolverUpgrade piercig = + new RevolverUpgrade(6, "PIERCING").setMaxLevel(1).setInstabilityPerLevel(12); + public static final RevolverUpgrade dueling = + new RevolverUpgrade(7, "DUELING").setMaxLevel(5).setInstabilityPerLevel(3); + public static final RevolverUpgrade tainted = + new RevolverUpgrade(8, "TAINTED").setMaxLevel(3).setInstabilityPerLevel(5); + public static final RevolverUpgrade primal = + new RevolverUpgrade(9, "PRIMAL").setMaxLevel(1).setInstabilityPerLevel(12); + public static final RevolverUpgrade speed = + new RevolverUpgrade(10, "SPEED").setMaxLevel(5).setInstabilityPerLevel(2); + public static final RevolverUpgrade efficiency = + new RevolverUpgrade(11, "EFFICIENCY").setMaxLevel(5).setInstabilityPerLevel(4); + public static final RevolverUpgrade eldritch = + new RevolverUpgrade(12, "ELDRITCH").setMaxLevel(2).setInstabilityPerLevel(7); + public static final RevolverUpgrade uvoid = + new RevolverUpgrade(13, "VOID").setMaxLevel(3).setInstabilityPerLevel(4); + public static final RevolverUpgrade knowledge = + new RevolverUpgrade(14, "KNOWLEDGE").setMaxLevel(5).setInstabilityPerLevel(1); + public static final RevolverUpgrade heavy = + new RevolverUpgrade(15, "HEAVY").setMaxLevel(5).setInstabilityPerLevel(1); } diff --git a/src/main/java/tb/client/RevolverEvents.java b/src/main/java/tb/client/RevolverEvents.java index ba12c09..940a0f0 100644 --- a/src/main/java/tb/client/RevolverEvents.java +++ b/src/main/java/tb/client/RevolverEvents.java @@ -1,36 +1,44 @@ package tb.client; -import tb.api.RevolverUpgrade; -import tb.common.item.ItemRevolver; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; +import tb.api.RevolverUpgrade; +import tb.common.item.ItemRevolver; -public class RevolverEvents -{ - @SubscribeEvent - public void renderCrossharEvent(RenderGameOverlayEvent event) - { - if(event.type == ElementType.CROSSHAIRS && Minecraft.getMinecraft().thePlayer.isSneaking()) - { - if(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != null && Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemRevolver) - { - event.setCanceled(true); - } - } - } - - @SubscribeEvent - public void renderZoomEvent(FOVUpdateEvent event) - { - if(Minecraft.getMinecraft().thePlayer.isSneaking()) - { - if(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != null && Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemRevolver) - { - event.newfov = 0.9F / (ItemRevolver.getUpgradeLevel(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem(), RevolverUpgrade.accuracy)+1); - } - } - } +public class RevolverEvents { + @SubscribeEvent + public void renderCrossharEvent(RenderGameOverlayEvent event) { + if (event.type == ElementType.CROSSHAIRS + && Minecraft.getMinecraft().thePlayer.isSneaking()) { + if (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != null + && Minecraft.getMinecraft() + .thePlayer + .getCurrentEquippedItem() + .getItem() + instanceof ItemRevolver) { + event.setCanceled(true); + } + } + } + + @SubscribeEvent + public void renderZoomEvent(FOVUpdateEvent event) { + if (Minecraft.getMinecraft().thePlayer.isSneaking()) { + if (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != null + && Minecraft.getMinecraft() + .thePlayer + .getCurrentEquippedItem() + .getItem() + instanceof ItemRevolver) { + event.newfov = 0.9F + / (ItemRevolver.getUpgradeLevel( + Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem(), + RevolverUpgrade.accuracy) + + 1); + } + } + } } diff --git a/src/main/java/tb/client/gui/GuiRevolver.java b/src/main/java/tb/client/gui/GuiRevolver.java index 0ebdfd0..35e7a19 100644 --- a/src/main/java/tb/client/gui/GuiRevolver.java +++ b/src/main/java/tb/client/gui/GuiRevolver.java @@ -1,61 +1,55 @@ package tb.client.gui; -import net.minecraft.entity.player.EntityPlayer; -import org.lwjgl.opengl.GL11; - -import tb.common.inventory.ContainerRevolver; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; +import tb.common.inventory.ContainerRevolver; -public class GuiRevolver extends GuiContainer -{ +public class GuiRevolver extends GuiContainer { - public static final ResourceLocation revolverTextures = new ResourceLocation("thaumicbases","textures/gui/revolver.png"); - public int blockedSlot; - - public GuiRevolver(InventoryPlayer inv, World w, int x, int y, int z) - { - super(new ContainerRevolver(inv,w,x,y,z)); - this.blockedSlot = inv.currentItem; - } - - //Draw a cross above the revolver - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseZ) - { - Minecraft.getMinecraft().renderEngine.bindTexture(revolverTextures); - float storedZLevel = this.zLevel; - - this.zLevel = 200; - - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - drawTexturedModalRect(8 + blockedSlot * 18, 142, 240, 0, 16, 16); - - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - - this.zLevel = storedZLevel; - } - - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseZ) - { - EntityPlayer p = Minecraft.getMinecraft().thePlayer; - if (p.inventory.mainInventory.length > this.blockedSlot && p.inventory.mainInventory[this.blockedSlot] == null) - p.closeScreen(); - - Minecraft.getMinecraft().renderEngine.bindTexture(revolverTextures); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - - drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - - } + public static final ResourceLocation revolverTextures = + new ResourceLocation("thaumicbases", "textures/gui/revolver.png"); + public int blockedSlot; + public GuiRevolver(InventoryPlayer inv, World w, int x, int y, int z) { + super(new ContainerRevolver(inv, w, x, y, z)); + this.blockedSlot = inv.currentItem; + } + + // Draw a cross above the revolver + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseZ) { + Minecraft.getMinecraft().renderEngine.bindTexture(revolverTextures); + float storedZLevel = this.zLevel; + + this.zLevel = 200; + + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + drawTexturedModalRect(8 + blockedSlot * 18, 142, 240, 0, 16, 16); + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + + this.zLevel = storedZLevel; + } + + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseZ) { + EntityPlayer p = Minecraft.getMinecraft().thePlayer; + if (p.inventory.mainInventory.length > this.blockedSlot && p.inventory.mainInventory[this.blockedSlot] == null) + p.closeScreen(); + + Minecraft.getMinecraft().renderEngine.bindTexture(revolverTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + + drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + } } diff --git a/src/main/java/tb/client/gui/GuiThaumicAnvil.java b/src/main/java/tb/client/gui/GuiThaumicAnvil.java index 366edf0..d52d2f1 100644 --- a/src/main/java/tb/client/gui/GuiThaumicAnvil.java +++ b/src/main/java/tb/client/gui/GuiThaumicAnvil.java @@ -2,9 +2,7 @@ package tb.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; @@ -17,33 +15,30 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; - import org.apache.commons.io.Charsets; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; - import tb.common.inventory.ContainerThaumicAnvil; @SideOnly(Side.CLIENT) -public class GuiThaumicAnvil extends GuiContainer implements ICrafting -{ +public class GuiThaumicAnvil extends GuiContainer implements ICrafting { private static final ResourceLocation field_147093_u = new ResourceLocation("textures/gui/container/anvil.png"); private ContainerThaumicAnvil field_147092_v; private GuiTextField field_147091_w; private InventoryPlayer field_147094_x; - public GuiThaumicAnvil(InventoryPlayer p_i1073_1_, World p_i1073_2_, int p_i1073_3_, int p_i1073_4_, int p_i1073_5_) - { - super(new ContainerThaumicAnvil(p_i1073_1_, p_i1073_2_, p_i1073_3_, p_i1073_4_, p_i1073_5_, Minecraft.getMinecraft().thePlayer)); + public GuiThaumicAnvil( + InventoryPlayer p_i1073_1_, World p_i1073_2_, int p_i1073_3_, int p_i1073_4_, int p_i1073_5_) { + super(new ContainerThaumicAnvil( + p_i1073_1_, p_i1073_2_, p_i1073_3_, p_i1073_4_, p_i1073_5_, Minecraft.getMinecraft().thePlayer)); this.field_147094_x = p_i1073_1_; - this.field_147092_v = (ContainerThaumicAnvil)this.inventorySlots; + this.field_147092_v = (ContainerThaumicAnvil) this.inventorySlots; } /** * Adds the buttons (and other controls) to the screen in question. */ - public void initGui() - { + public void initGui() { super.initGui(); Keyboard.enableRepeatEvents(true); int i = (this.width - this.xSize) / 2; @@ -60,8 +55,7 @@ public class GuiThaumicAnvil extends GuiContainer implements ICrafting /** * Called when the screen is unloaded. Used to disable keyboard repeat events */ - public void onGuiClosed() - { + public void onGuiClosed() { super.onGuiClosed(); Keyboard.enableRepeatEvents(false); this.inventorySlots.removeCraftingFromCrafters(this); @@ -70,45 +64,35 @@ public class GuiThaumicAnvil extends GuiContainer implements ICrafting /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) - { + protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); this.fontRendererObj.drawString(I18n.format("container.repair", new Object[0]), 60, 6, 4210752); - if (this.field_147092_v.maximumCost > 0) - { + if (this.field_147092_v.maximumCost > 0) { int k = 8453920; boolean flag = true; - String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(this.field_147092_v.maximumCost)}); + String s = I18n.format( + "container.repair.cost", new Object[] {Integer.valueOf(this.field_147092_v.maximumCost)}); - if (this.field_147092_v.maximumCost >= 40 && !this.mc.thePlayer.capabilities.isCreativeMode) - { + if (this.field_147092_v.maximumCost >= 40 && !this.mc.thePlayer.capabilities.isCreativeMode) { s = I18n.format("container.repair.expensive", new Object[0]); k = 16736352; - } - else if (!this.field_147092_v.getSlot(2).getHasStack()) - { + } else if (!this.field_147092_v.getSlot(2).getHasStack()) { flag = false; - } - else if (!this.field_147092_v.getSlot(2).canTakeStack(this.field_147094_x.player)) - { + } else if (!this.field_147092_v.getSlot(2).canTakeStack(this.field_147094_x.player)) { k = 16736352; } - if (flag) - { + if (flag) { int l = -16777216 | (k & 16579836) >> 2 | k & -16777216; int i1 = this.xSize - 8 - this.fontRendererObj.getStringWidth(s); byte b0 = 67; - if (this.fontRendererObj.getUnicodeFlag()) - { + if (this.fontRendererObj.getUnicodeFlag()) { drawRect(i1 - 3, b0 - 2, this.xSize - 7, b0 + 10, -16777216); drawRect(i1 - 2, b0 - 1, this.xSize - 8, b0 + 9, -12895429); - } - else - { + } else { this.fontRendererObj.drawString(s, i1, b0 + 1, l); this.fontRendererObj.drawString(s, i1 + 1, b0, l); this.fontRendererObj.drawString(s, i1 + 1, b0 + 1, l); @@ -124,37 +108,34 @@ public class GuiThaumicAnvil extends GuiContainer implements ICrafting /** * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */ - protected void keyTyped(char p_73869_1_, int p_73869_2_) - { - if (this.field_147091_w.textboxKeyTyped(p_73869_1_, p_73869_2_)) - { + protected void keyTyped(char p_73869_1_, int p_73869_2_) { + if (this.field_147091_w.textboxKeyTyped(p_73869_1_, p_73869_2_)) { this.func_147090_g(); - } - else - { + } else { super.keyTyped(p_73869_1_, p_73869_2_); } } - private void func_147090_g() - { + private void func_147090_g() { String s = this.field_147091_w.getText(); Slot slot = this.field_147092_v.getSlot(0); - if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName())) - { + if (slot != null + && slot.getHasStack() + && !slot.getStack().hasDisplayName() + && s.equals(slot.getStack().getDisplayName())) { s = ""; } this.field_147092_v.updateItemName(s); - this.mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", s.getBytes(Charsets.UTF_8))); + this.mc.thePlayer.sendQueue.addToSendQueue( + new C17PacketCustomPayload("MC|ItemName", s.getBytes(Charsets.UTF_8))); } /** * Called when the mouse is clicked. */ - protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) - { + protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) { super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); this.field_147091_w.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); } @@ -162,32 +143,31 @@ public class GuiThaumicAnvil extends GuiContainer implements ICrafting /** * Draws the screen and all the components in it. */ - public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) - { + public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) { super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); this.field_147091_w.drawTextBox(); } - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) - { + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(field_147093_u); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - this.drawTexturedModalRect(k + 59, l + 20, 0, this.ySize + (this.field_147092_v.getSlot(0).getHasStack() ? 0 : 16), 110, 16); + this.drawTexturedModalRect( + k + 59, l + 20, 0, this.ySize + (this.field_147092_v.getSlot(0).getHasStack() ? 0 : 16), 110, 16); - if ((this.field_147092_v.getSlot(0).getHasStack() || this.field_147092_v.getSlot(1).getHasStack()) && !this.field_147092_v.getSlot(2).getHasStack()) - { + if ((this.field_147092_v.getSlot(0).getHasStack() + || this.field_147092_v.getSlot(1).getHasStack()) + && !this.field_147092_v.getSlot(2).getHasStack()) { this.drawTexturedModalRect(k + 99, l + 45, this.xSize, 0, 28, 21); } } @SuppressWarnings("rawtypes") - public void sendContainerAndContentsToPlayer(Container p_71110_1_, List p_71110_2_) - { + public void sendContainerAndContentsToPlayer(Container p_71110_1_, List p_71110_2_) { this.sendSlotContents(p_71110_1_, 0, p_71110_1_.getSlot(0).getStack()); } @@ -195,15 +175,12 @@ public class GuiThaumicAnvil extends GuiContainer implements ICrafting * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual * contents of that slot. Args: Container, slot number, slot contents */ - public void sendSlotContents(Container p_71111_1_, int p_71111_2_, ItemStack p_71111_3_) - { - if (p_71111_2_ == 0) - { + public void sendSlotContents(Container p_71111_1_, int p_71111_2_, ItemStack p_71111_3_) { + if (p_71111_2_ == 0) { this.field_147091_w.setText(p_71111_3_ == null ? "" : p_71111_3_.getDisplayName()); this.field_147091_w.setEnabled(p_71111_3_ != null); - if (p_71111_3_ != null) - { + if (p_71111_3_ != null) { this.func_147090_g(); } } @@ -215,4 +192,4 @@ public class GuiThaumicAnvil extends GuiContainer implements ICrafting * value. Both are truncated to shorts in non-local SMP. */ public void sendProgressBarUpdate(Container p_71112_1_, int p_71112_2_, int p_71112_3_) {} -} \ No newline at end of file +} diff --git a/src/main/java/tb/client/gui/GuiVoidAnvil.java b/src/main/java/tb/client/gui/GuiVoidAnvil.java index b61f4a9..fb19ebf 100644 --- a/src/main/java/tb/client/gui/GuiVoidAnvil.java +++ b/src/main/java/tb/client/gui/GuiVoidAnvil.java @@ -2,9 +2,7 @@ package tb.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; @@ -17,33 +15,29 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; - import org.apache.commons.io.Charsets; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; - import tb.common.inventory.ContainerVoidAnvil; @SideOnly(Side.CLIENT) -public class GuiVoidAnvil extends GuiContainer implements ICrafting -{ +public class GuiVoidAnvil extends GuiContainer implements ICrafting { private static final ResourceLocation field_147093_u = new ResourceLocation("textures/gui/container/anvil.png"); private ContainerVoidAnvil field_147092_v; private GuiTextField field_147091_w; private InventoryPlayer field_147094_x; - public GuiVoidAnvil(InventoryPlayer p_i1073_1_, World p_i1073_2_, int p_i1073_3_, int p_i1073_4_, int p_i1073_5_) - { - super(new ContainerVoidAnvil(p_i1073_1_, p_i1073_2_, p_i1073_3_, p_i1073_4_, p_i1073_5_, Minecraft.getMinecraft().thePlayer)); + public GuiVoidAnvil(InventoryPlayer p_i1073_1_, World p_i1073_2_, int p_i1073_3_, int p_i1073_4_, int p_i1073_5_) { + super(new ContainerVoidAnvil( + p_i1073_1_, p_i1073_2_, p_i1073_3_, p_i1073_4_, p_i1073_5_, Minecraft.getMinecraft().thePlayer)); this.field_147094_x = p_i1073_1_; - this.field_147092_v = (ContainerVoidAnvil)this.inventorySlots; + this.field_147092_v = (ContainerVoidAnvil) this.inventorySlots; } /** * Adds the buttons (and other controls) to the screen in question. */ - public void initGui() - { + public void initGui() { super.initGui(); Keyboard.enableRepeatEvents(true); int i = (this.width - this.xSize) / 2; @@ -60,8 +54,7 @@ public class GuiVoidAnvil extends GuiContainer implements ICrafting /** * Called when the screen is unloaded. Used to disable keyboard repeat events */ - public void onGuiClosed() - { + public void onGuiClosed() { super.onGuiClosed(); Keyboard.enableRepeatEvents(false); this.inventorySlots.removeCraftingFromCrafters(this); @@ -70,45 +63,35 @@ public class GuiVoidAnvil extends GuiContainer implements ICrafting /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) - { + protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); this.fontRendererObj.drawString(I18n.format("container.repair", new Object[0]), 60, 6, 4210752); - if (this.field_147092_v.maximumCost > 0) - { + if (this.field_147092_v.maximumCost > 0) { int k = 8453920; boolean flag = true; - String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(this.field_147092_v.maximumCost)}); + String s = I18n.format( + "container.repair.cost", new Object[] {Integer.valueOf(this.field_147092_v.maximumCost)}); - if (this.field_147092_v.maximumCost >= 40 && !this.mc.thePlayer.capabilities.isCreativeMode) - { + if (this.field_147092_v.maximumCost >= 40 && !this.mc.thePlayer.capabilities.isCreativeMode) { s = I18n.format("container.repair.expensive", new Object[0]); k = 16736352; - } - else if (!this.field_147092_v.getSlot(2).getHasStack()) - { + } else if (!this.field_147092_v.getSlot(2).getHasStack()) { flag = false; - } - else if (!this.field_147092_v.getSlot(2).canTakeStack(this.field_147094_x.player)) - { + } else if (!this.field_147092_v.getSlot(2).canTakeStack(this.field_147094_x.player)) { k = 16736352; } - if (flag) - { + if (flag) { int l = -16777216 | (k & 16579836) >> 2 | k & -16777216; int i1 = this.xSize - 8 - this.fontRendererObj.getStringWidth(s); byte b0 = 67; - if (this.fontRendererObj.getUnicodeFlag()) - { + if (this.fontRendererObj.getUnicodeFlag()) { drawRect(i1 - 3, b0 - 2, this.xSize - 7, b0 + 10, -16777216); drawRect(i1 - 2, b0 - 1, this.xSize - 8, b0 + 9, -12895429); - } - else - { + } else { this.fontRendererObj.drawString(s, i1, b0 + 1, l); this.fontRendererObj.drawString(s, i1 + 1, b0, l); this.fontRendererObj.drawString(s, i1 + 1, b0 + 1, l); @@ -124,37 +107,34 @@ public class GuiVoidAnvil extends GuiContainer implements ICrafting /** * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */ - protected void keyTyped(char p_73869_1_, int p_73869_2_) - { - if (this.field_147091_w.textboxKeyTyped(p_73869_1_, p_73869_2_)) - { + protected void keyTyped(char p_73869_1_, int p_73869_2_) { + if (this.field_147091_w.textboxKeyTyped(p_73869_1_, p_73869_2_)) { this.func_147090_g(); - } - else - { + } else { super.keyTyped(p_73869_1_, p_73869_2_); } } - private void func_147090_g() - { + private void func_147090_g() { String s = this.field_147091_w.getText(); Slot slot = this.field_147092_v.getSlot(0); - if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName())) - { + if (slot != null + && slot.getHasStack() + && !slot.getStack().hasDisplayName() + && s.equals(slot.getStack().getDisplayName())) { s = ""; } this.field_147092_v.updateItemName(s); - this.mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", s.getBytes(Charsets.UTF_8))); + this.mc.thePlayer.sendQueue.addToSendQueue( + new C17PacketCustomPayload("MC|ItemName", s.getBytes(Charsets.UTF_8))); } /** * Called when the mouse is clicked. */ - protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) - { + protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) { super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); this.field_147091_w.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); } @@ -162,32 +142,31 @@ public class GuiVoidAnvil extends GuiContainer implements ICrafting /** * Draws the screen and all the components in it. */ - public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) - { + public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) { super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); this.field_147091_w.drawTextBox(); } - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) - { + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(field_147093_u); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - this.drawTexturedModalRect(k + 59, l + 20, 0, this.ySize + (this.field_147092_v.getSlot(0).getHasStack() ? 0 : 16), 110, 16); + this.drawTexturedModalRect( + k + 59, l + 20, 0, this.ySize + (this.field_147092_v.getSlot(0).getHasStack() ? 0 : 16), 110, 16); - if ((this.field_147092_v.getSlot(0).getHasStack() || this.field_147092_v.getSlot(1).getHasStack()) && !this.field_147092_v.getSlot(2).getHasStack()) - { + if ((this.field_147092_v.getSlot(0).getHasStack() + || this.field_147092_v.getSlot(1).getHasStack()) + && !this.field_147092_v.getSlot(2).getHasStack()) { this.drawTexturedModalRect(k + 99, l + 45, this.xSize, 0, 28, 21); } } @SuppressWarnings("rawtypes") - public void sendContainerAndContentsToPlayer(Container p_71110_1_, List p_71110_2_) - { + public void sendContainerAndContentsToPlayer(Container p_71110_1_, List p_71110_2_) { this.sendSlotContents(p_71110_1_, 0, p_71110_1_.getSlot(0).getStack()); } @@ -195,15 +174,12 @@ public class GuiVoidAnvil extends GuiContainer implements ICrafting * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual * contents of that slot. Args: Container, slot number, slot contents */ - public void sendSlotContents(Container p_71111_1_, int p_71111_2_, ItemStack p_71111_3_) - { - if (p_71111_2_ == 0) - { + public void sendSlotContents(Container p_71111_1_, int p_71111_2_, ItemStack p_71111_3_) { + if (p_71111_2_ == 0) { this.field_147091_w.setText(p_71111_3_ == null ? "" : p_71111_3_.getDisplayName()); this.field_147091_w.setEnabled(p_71111_3_ != null); - if (p_71111_3_ != null) - { + if (p_71111_3_ != null) { this.func_147090_g(); } } @@ -215,4 +191,4 @@ public class GuiVoidAnvil extends GuiContainer implements ICrafting * value. Both are truncated to shorts in non-local SMP. */ public void sendProgressBarUpdate(Container p_71112_1_, int p_71112_2_, int p_71112_3_) {} -} \ No newline at end of file +} diff --git a/src/main/java/tb/client/render/block/BrazierRenderer.java b/src/main/java/tb/client/render/block/BrazierRenderer.java index e99cf7f..554065c 100644 --- a/src/main/java/tb/client/render/block/BrazierRenderer.java +++ b/src/main/java/tb/client/render/block/BrazierRenderer.java @@ -1,11 +1,6 @@ package tb.client.render.block; -import org.lwjgl.opengl.GL11; - -import tb.common.tile.TileBrazier; -import thaumcraft.client.renderers.block.BlockRenderer; -import thaumcraft.common.config.ConfigBlocks; -import thaumcraft.common.blocks.BlockCosmeticSolid; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; @@ -13,114 +8,110 @@ import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import tb.common.tile.TileBrazier; +import thaumcraft.client.renderers.block.BlockRenderer; +import thaumcraft.common.config.ConfigBlocks; -public class BrazierRenderer extends BlockRenderer implements ISimpleBlockRenderingHandler{ +public class BrazierRenderer extends BlockRenderer implements ISimpleBlockRenderingHandler { - @Override - public void renderInventoryBlock(Block block, int metadata, int modelId,RenderBlocks renderer) - { - IIcon icon = ConfigBlocks.blockCosmeticSolid.getIcon(0, 6); - //base1 - block.setBlockBounds(W1, 0, W1, W15, W2, W15); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - //base2 - block.setBlockBounds(W2, W2, W2, W14, W4, W14); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - //pillar - block.setBlockBounds(W4, W4, W4, W12, W12, W12); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - //bowl base - block.setBlockBounds(W2, W12, W2, W14, W13, W14); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - //bowl 1 - block.setBlockBounds(W2, W13, W13, W14, 1, W14); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - //bowl 2 - block.setBlockBounds(W2, W13, W2, W14, 1, W3); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - //bowl 3 - block.setBlockBounds(W2, W13, W3, W3, 1, W13); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - //bowl 4 - block.setBlockBounds(W13, W13, W3, W14, 1, W13); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - - icon = Blocks.coal_block.getIcon(0, 0); - //coal - block.setBlockBounds(W3, W13, W3, W13, W14, W13); - renderer.setRenderBoundsFromBlock(block); - drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + IIcon icon = ConfigBlocks.blockCosmeticSolid.getIcon(0, 6); + // base1 + block.setBlockBounds(W1, 0, W1, W15, W2, W15); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + // base2 + block.setBlockBounds(W2, W2, W2, W14, W4, W14); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + // pillar + block.setBlockBounds(W4, W4, W4, W12, W12, W12); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + // bowl base + block.setBlockBounds(W2, W12, W2, W14, W13, W14); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + // bowl 1 + block.setBlockBounds(W2, W13, W13, W14, 1, W14); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + // bowl 2 + block.setBlockBounds(W2, W13, W2, W14, 1, W3); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + // bowl 3 + block.setBlockBounds(W2, W13, W3, W3, 1, W13); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + // bowl 4 + block.setBlockBounds(W13, W13, W3, W14, 1, W13); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,Block block, int modelId, RenderBlocks renderer) - { - renderer.renderAllFaces = true; - - renderer.setOverrideBlockTexture(ConfigBlocks.blockCosmeticSolid.getIcon(0, 6)); - //base1 - renderer.setRenderBounds(W1, 0, W1, W15, W2, W15); - renderer.renderStandardBlock(block, x, y, z); - //base2 - renderer.setRenderBounds(W2, W2, W2, W14, W4, W14); - renderer.renderStandardBlock(block, x, y, z); - //pillar - renderer.setRenderBounds(W4, W4, W4, W12, W12, W12); - renderer.renderStandardBlock(block, x, y, z); - //bowl base - renderer.setRenderBounds(W2, W12, W2, W14, W13, W14); - renderer.renderStandardBlock(block, x, y, z); - //bowl 1 (s) - renderer.setRenderBounds(W2, W13, W13, W14, 1, W14); - renderer.renderStandardBlock(block, x, y, z); - //bowl 2 (n) - renderer.setRenderBounds(W2, W13, W2, W14, 1, W3); - renderer.renderStandardBlock(block, x, y, z); - //bowl 3 (w) - renderer.setRenderBounds(W2, W13, W3, W3, 1, W13); - renderer.renderStandardBlock(block, x, y, z); - //bowl 4 (e) - renderer.setRenderBounds(W13, W13, W3, W14, 1, W13); - renderer.renderStandardBlock(block, x, y, z); - //coal fill - renderer.setOverrideBlockTexture(Blocks.coal_block.getIcon(0, 0)); - renderer.setRenderBounds(W3, W13, W3, W13, W14, W13); - renderer.renderStandardBlock(block, x, y, z); - - - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileBrazier && ((TileBrazier)tile).burning) - { - renderer.setOverrideBlockTexture(Blocks.fire.getIcon(2, 0)); - Tessellator.instance.setBrightness(247); - Tessellator.instance.setColorOpaque_I(0xffffff); - renderer.drawCrossedSquares(Blocks.fire.getIcon(2, 0), x, y+W14, z, 0.5F); - } - - renderer.renderAllFaces = false; - renderer.clearOverrideBlockTexture(); - return true; - } + icon = Blocks.coal_block.getIcon(0, 0); + // coal + block.setBlockBounds(W3, W13, W3, W13, W14, W13); + renderer.setRenderBoundsFromBlock(block); + drawFaces(renderer, block, icon, icon, icon, icon, icon, icon, true); + } - @Override - public boolean shouldRender3DInInventory(int modelId) - { - return true; - } + @Override + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + renderer.renderAllFaces = true; - @Override - public int getRenderId() - { - return 0x1242fd; - } + renderer.setOverrideBlockTexture(ConfigBlocks.blockCosmeticSolid.getIcon(0, 6)); + // base1 + renderer.setRenderBounds(W1, 0, W1, W15, W2, W15); + renderer.renderStandardBlock(block, x, y, z); + // base2 + renderer.setRenderBounds(W2, W2, W2, W14, W4, W14); + renderer.renderStandardBlock(block, x, y, z); + // pillar + renderer.setRenderBounds(W4, W4, W4, W12, W12, W12); + renderer.renderStandardBlock(block, x, y, z); + // bowl base + renderer.setRenderBounds(W2, W12, W2, W14, W13, W14); + renderer.renderStandardBlock(block, x, y, z); + // bowl 1 (s) + renderer.setRenderBounds(W2, W13, W13, W14, 1, W14); + renderer.renderStandardBlock(block, x, y, z); + // bowl 2 (n) + renderer.setRenderBounds(W2, W13, W2, W14, 1, W3); + renderer.renderStandardBlock(block, x, y, z); + // bowl 3 (w) + renderer.setRenderBounds(W2, W13, W3, W3, 1, W13); + renderer.renderStandardBlock(block, x, y, z); + // bowl 4 (e) + renderer.setRenderBounds(W13, W13, W3, W14, 1, W13); + renderer.renderStandardBlock(block, x, y, z); + // coal fill + renderer.setOverrideBlockTexture(Blocks.coal_block.getIcon(0, 0)); + renderer.setRenderBounds(W3, W13, W3, W13, W14, W13); + renderer.renderStandardBlock(block, x, y, z); + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileBrazier && ((TileBrazier) tile).burning) { + renderer.setOverrideBlockTexture(Blocks.fire.getIcon(2, 0)); + Tessellator.instance.setBrightness(247); + Tessellator.instance.setColorOpaque_I(0xffffff); + renderer.drawCrossedSquares(Blocks.fire.getIcon(2, 0), x, y + W14, z, 0.5F); + } + + renderer.renderAllFaces = false; + renderer.clearOverrideBlockTexture(); + return true; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return 0x1242fd; + } } diff --git a/src/main/java/tb/client/render/block/CampfireRenderer.java b/src/main/java/tb/client/render/block/CampfireRenderer.java index c558056..4238779 100644 --- a/src/main/java/tb/client/render/block/CampfireRenderer.java +++ b/src/main/java/tb/client/render/block/CampfireRenderer.java @@ -1,94 +1,86 @@ package tb.client.render.block; -import java.util.Random; - -import thaumcraft.client.renderers.block.BlockRenderer; -import thaumcraft.common.config.ConfigBlocks; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.init.Blocks; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import thaumcraft.client.renderers.block.BlockRenderer; +import thaumcraft.common.config.ConfigBlocks; -public class CampfireRenderer extends BlockRenderer implements ISimpleBlockRenderingHandler{ +public class CampfireRenderer extends BlockRenderer implements ISimpleBlockRenderingHandler { - @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { - - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {} - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,Block block, int modelId, RenderBlocks renderer) - { - renderer.renderAllFaces = true; - /* - * looks like shit - renderer.setOverrideBlockTexture(Blocks.cobblestone.getIcon(0, 0)); - - Random rand = new Random(x+y+z); - - for(int i = 0; i < 6+rand.nextInt(5); ++i) - { - double dx = rand.nextDouble(); - double dy = 0; - double dz = rand.nextDouble(); - - renderer.setRenderBounds(dx, dy, dz, dx+0.1D, dy+0.1D, dz+0.1D); - renderer.renderStandardBlock(Blocks.stone, x, y, z); - }*/ - - //gravel base - renderer.setOverrideBlockTexture(Blocks.gravel.getIcon(0, 0)); - renderer.setRenderBounds(W1, 0, W1, W15, W1, W15); - renderer.renderStandardBlock(block, x, y, z); - - //coal pit - renderer.setOverrideBlockTexture(Blocks.coal_block.getIcon(0, 0)); - renderer.setRenderBounds(0.25D, 0, 0.25D, 0.75D, W2-0.001, 0.75D); - renderer.renderStandardBlock(block, x, y, z); - - //logs - renderer.setOverrideBlockTexture(ConfigBlocks.blockMagicalLog.getIcon(2, 0)); - double yIndex = 0; - if(world.getBlockMetadata(x, y, z) > 0) - for(int i = 0; i < 2; ++i) - { - renderer.setRenderBounds(W3, 0+yIndex+(W2*i), W2, W5, W2+yIndex+(W2*i), W14); //layer 1,1 - renderer.renderStandardBlock(block, x, y, z); - renderer.setRenderBounds(W11, 0+yIndex+(W2*i), W2, W13, W2+yIndex+(W2*i), W14);//layer 1,2 - renderer.renderStandardBlock(block, x, y, z); - - renderer.setRenderBounds(W2, W2+yIndex+(W2*i), W3, W14, W4+yIndex+(W2*i), W5);//layer 2,1 - renderer.renderStandardBlock(block, x, y, z); - renderer.setRenderBounds(W2, W2+yIndex+(W2*i), W11, W14, W4+yIndex+(W2*i), W13);//layer 2,2 - renderer.renderStandardBlock(block, x, y, z); - yIndex += W2; - } - - - if(world.getBlockMetadata(x, y, z) > 1) - { - renderer.setOverrideBlockTexture(Blocks.fire.getIcon(2, 0)); - Tessellator.instance.setBrightness(247); - Tessellator.instance.setColorOpaque_I(0xffffff); - renderer.drawCrossedSquares(Blocks.fire.getIcon(2, 0), x, y, z, 0.75F); - } - - renderer.renderAllFaces = false; - renderer.clearOverrideBlockTexture(); - return true; - } + @Override + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + renderer.renderAllFaces = true; + /* + * looks like shit + renderer.setOverrideBlockTexture(Blocks.cobblestone.getIcon(0, 0)); - @Override - public boolean shouldRender3DInInventory(int modelId) { - return false; - } + Random rand = new Random(x+y+z); - @Override - public int getRenderId() - { - return 0x1242fe; - } + for(int i = 0; i < 6+rand.nextInt(5); ++i) + { + double dx = rand.nextDouble(); + double dy = 0; + double dz = rand.nextDouble(); + renderer.setRenderBounds(dx, dy, dz, dx+0.1D, dy+0.1D, dz+0.1D); + renderer.renderStandardBlock(Blocks.stone, x, y, z); + }*/ + + // gravel base + renderer.setOverrideBlockTexture(Blocks.gravel.getIcon(0, 0)); + renderer.setRenderBounds(W1, 0, W1, W15, W1, W15); + renderer.renderStandardBlock(block, x, y, z); + + // coal pit + renderer.setOverrideBlockTexture(Blocks.coal_block.getIcon(0, 0)); + renderer.setRenderBounds(0.25D, 0, 0.25D, 0.75D, W2 - 0.001, 0.75D); + renderer.renderStandardBlock(block, x, y, z); + + // logs + renderer.setOverrideBlockTexture(ConfigBlocks.blockMagicalLog.getIcon(2, 0)); + double yIndex = 0; + if (world.getBlockMetadata(x, y, z) > 0) + for (int i = 0; i < 2; ++i) { + renderer.setRenderBounds(W3, 0 + yIndex + (W2 * i), W2, W5, W2 + yIndex + (W2 * i), W14); // layer 1,1 + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(W11, 0 + yIndex + (W2 * i), W2, W13, W2 + yIndex + (W2 * i), W14); // layer 1,2 + renderer.renderStandardBlock(block, x, y, z); + + renderer.setRenderBounds(W2, W2 + yIndex + (W2 * i), W3, W14, W4 + yIndex + (W2 * i), W5); // layer 2,1 + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds( + W2, W2 + yIndex + (W2 * i), W11, W14, W4 + yIndex + (W2 * i), W13); // layer 2,2 + renderer.renderStandardBlock(block, x, y, z); + yIndex += W2; + } + + if (world.getBlockMetadata(x, y, z) > 1) { + renderer.setOverrideBlockTexture(Blocks.fire.getIcon(2, 0)); + Tessellator.instance.setBrightness(247); + Tessellator.instance.setColorOpaque_I(0xffffff); + renderer.drawCrossedSquares(Blocks.fire.getIcon(2, 0), x, y, z, 0.75F); + } + + renderer.renderAllFaces = false; + renderer.clearOverrideBlockTexture(); + return true; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return false; + } + + @Override + public int getRenderId() { + return 0x1242fe; + } } diff --git a/src/main/java/tb/client/render/block/ThaumicRelocatorRenderer.java b/src/main/java/tb/client/render/block/ThaumicRelocatorRenderer.java index 188fc96..05ef20b 100644 --- a/src/main/java/tb/client/render/block/ThaumicRelocatorRenderer.java +++ b/src/main/java/tb/client/render/block/ThaumicRelocatorRenderer.java @@ -1,155 +1,148 @@ package tb.client.render.block; -import org.lwjgl.opengl.GL11; - -import tb.common.block.BlockRelocator; -import tb.common.tile.TileRelocator; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.init.Blocks; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import org.lwjgl.opengl.GL11; +import tb.common.block.BlockRelocator; +import tb.common.tile.TileRelocator; -public class ThaumicRelocatorRenderer implements ISimpleBlockRenderingHandler{ +public class ThaumicRelocatorRenderer implements ISimpleBlockRenderingHandler { + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + BlockRelocator rl = (BlockRelocator) block; + + int color = metadata < 6 ? 0xffff77 : 0x0077ff; + + Tessellator tessellator = Tessellator.instance; + + GL11.glPushMatrix(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelId,RenderBlocks renderer) - { - BlockRelocator rl = (BlockRelocator) block; - - int color = metadata < 6 ? 0xffff77 : 0x0077ff; - - Tessellator tessellator = Tessellator.instance; - - GL11.glPushMatrix(); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[1]); tessellator.draw(); - - //Glow + + // Glow tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.setColorOpaque_I(color); tessellator.setBrightness(250); renderer.renderFaceYPos(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[3]); tessellator.draw(); - - //Top + + // Top tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[0]); tessellator.draw(); - - //Glow + + // Glow tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(color); tessellator.setBrightness(250); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[3]); tessellator.draw(); - - //Side + + // Side tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[2]); tessellator.draw(); - - //Glow + + // Glow tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(color); tessellator.setBrightness(250); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[3]); tessellator.draw(); - - //Side + + // Side tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[2]); tessellator.draw(); - - //Glow + + // Glow tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(color); tessellator.setBrightness(250); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[3]); tessellator.draw(); - - //Side + + // Side tessellator.startDrawingQuads(); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[2]); tessellator.draw(); - - //Glow + + // Glow tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(color); tessellator.setBrightness(250); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[3]); tessellator.draw(); - - //Side + + // Side tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(Blocks.glass, 0.0D, 0.0D, 0.0D, rl.icons[2]); tessellator.draw(); - + GL11.glTranslatef(0.5F, 0.5F, 0.5F); - - GL11.glPopMatrix(); - - } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,Block block, int modelId, RenderBlocks renderer) - { - int meta = world.getBlockMetadata(x, y, z); - - int color = meta < 6 ? 0xffff77 : 0x0077ff; + GL11.glPopMatrix(); + } - BlockRelocator rl = (BlockRelocator) block; - - TileRelocator tile = (TileRelocator) world.getTileEntity(x, y, z); - - if(tile.isBlockPowered()) - color = 0x333333; - - renderer.renderStandardBlock(block, x, y, z); - - Tessellator.instance.setColorOpaque_I(color); - - renderer.renderFaceYNeg(Blocks.glass, x, y + 0.01D, z, rl.icons[3]); - - renderer.renderFaceYPos(Blocks.glass, x, y - 0.01D, z, rl.icons[3]); - - renderer.renderFaceXNeg(Blocks.glass, x + 0.01D, y, z, rl.icons[3]); - - renderer.renderFaceXPos(Blocks.glass, x - 0.01D, y, z, rl.icons[3]); - - renderer.renderFaceZNeg(Blocks.glass, x, y, z + 0.01D, rl.icons[3]); - - renderer.renderFaceZPos(Blocks.glass, x, y, z - 0.01D, rl.icons[3]); - - return false; - } + @Override + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + int meta = world.getBlockMetadata(x, y, z); - @Override - public boolean shouldRender3DInInventory(int modelId) - { - return true; - } + int color = meta < 6 ? 0xffff77 : 0x0077ff; - @Override - public int getRenderId() - { - return 0x1242ff; - } + BlockRelocator rl = (BlockRelocator) block; + TileRelocator tile = (TileRelocator) world.getTileEntity(x, y, z); + + if (tile.isBlockPowered()) color = 0x333333; + + renderer.renderStandardBlock(block, x, y, z); + + Tessellator.instance.setColorOpaque_I(color); + + renderer.renderFaceYNeg(Blocks.glass, x, y + 0.01D, z, rl.icons[3]); + + renderer.renderFaceYPos(Blocks.glass, x, y - 0.01D, z, rl.icons[3]); + + renderer.renderFaceXNeg(Blocks.glass, x + 0.01D, y, z, rl.icons[3]); + + renderer.renderFaceXPos(Blocks.glass, x - 0.01D, y, z, rl.icons[3]); + + renderer.renderFaceZNeg(Blocks.glass, x, y, z + 0.01D, rl.icons[3]); + + renderer.renderFaceZPos(Blocks.glass, x, y, z - 0.01D, rl.icons[3]); + + return false; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return 0x1242ff; + } } diff --git a/src/main/java/tb/client/render/entity/RenderBullet.java b/src/main/java/tb/client/render/entity/RenderBullet.java index 3fd084b..fe191cb 100644 --- a/src/main/java/tb/client/render/entity/RenderBullet.java +++ b/src/main/java/tb/client/render/entity/RenderBullet.java @@ -4,18 +4,19 @@ import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderBullet extends Render{ +public class RenderBullet extends Render { - @Override - public void doRender(Entity p_76986_1_, double p_76986_2_, - double p_76986_4_, double p_76986_6_, float p_76986_8_, - float p_76986_9_) { - - } - - @Override - protected ResourceLocation getEntityTexture(Entity p_110775_1_) { - return null; - } + @Override + public void doRender( + Entity p_76986_1_, + double p_76986_2_, + double p_76986_4_, + double p_76986_6_, + float p_76986_8_, + float p_76986_9_) {} + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return null; + } } diff --git a/src/main/java/tb/client/render/item/CastingBraceletRenderer.java b/src/main/java/tb/client/render/item/CastingBraceletRenderer.java index 4d0b839..fe92e18 100644 --- a/src/main/java/tb/client/render/item/CastingBraceletRenderer.java +++ b/src/main/java/tb/client/render/item/CastingBraceletRenderer.java @@ -2,15 +2,6 @@ package tb.client.render.item; import java.awt.Color; import java.lang.reflect.Field; - -import org.lwjgl.opengl.GL11; - -import tb.common.item.ItemCastingBracelet; -import thaumcraft.client.lib.UtilsFX; -import thaumcraft.client.renderers.block.BlockRenderer; -import thaumcraft.client.renderers.models.gear.ModelWand; -import thaumcraft.common.Thaumcraft; -import thaumcraft.common.items.wands.ItemWandCasting; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.model.ModelRenderer; @@ -32,218 +23,204 @@ import net.minecraft.util.Timer; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; +import tb.common.item.ItemCastingBracelet; +import thaumcraft.client.lib.UtilsFX; +import thaumcraft.client.renderers.block.BlockRenderer; +import thaumcraft.client.renderers.models.gear.ModelWand; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.items.wands.ItemWandCasting; -public class CastingBraceletRenderer implements IItemRenderer{ +public class CastingBraceletRenderer implements IItemRenderer { - public static final IModelCustom bracelet = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/bracelet/bracelet.obj")); - public static final RenderBlocks renderBlocks = new RenderBlocks(); - public static final ModelWand wand = new ModelWand(); - - public static ModelRenderer getWandFociModel() - { - try - { - Class wandModelClass = ModelWand.class; - Field foci = wandModelClass.getDeclaredField("Focus");//<- If only that field had been declared as public... Oh well. - boolean accessible = foci.isAccessible(); - if(!accessible) - foci.setAccessible(true); - - ModelRenderer model = ModelRenderer.class.cast(foci.get(wand)); - - if(!accessible) - foci.setAccessible(false); - - return model; - } - catch(Exception e) - { - return null; - } - } - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - return true; - } + public static final IModelCustom bracelet = + AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases", "models/bracelet/bracelet.obj")); + public static final RenderBlocks renderBlocks = new RenderBlocks(); + public static final ModelWand wand = new ModelWand(); - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,ItemRendererHelper helper) - { - if (helper == IItemRenderer.ItemRendererHelper.BLOCK_3D) - return false; - return true; - } - - public static Timer getMCTimer() - { - try - { - Class mcClass = Minecraft.class; - Field timerField = mcClass.getDeclaredFields()[16]; - if(!timerField.isAccessible()) - timerField.setAccessible(true); - - return Timer.class.cast(timerField.get(Minecraft.getMinecraft())); - } - catch(Exception e) - { - return null; - } - } + public static ModelRenderer getWandFociModel() { + try { + Class wandModelClass = ModelWand.class; + Field foci = wandModelClass.getDeclaredField( + "Focus"); // <- If only that field had been declared as public... Oh well. + boolean accessible = foci.isAccessible(); + if (!accessible) foci.setAccessible(true); - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - EntityClientPlayerMP entityclientplayermp = Minecraft.getMinecraft().thePlayer; - - ItemWandCasting wand = (ItemWandCasting)item.getItem(); - ItemStack focusStack = wand.getFocusItem(item); - - //float renderPartialTicks = getMCTimer().renderPartialTicks; - - if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) - { + ModelRenderer model = ModelRenderer.class.cast(foci.get(wand)); + + if (!accessible) foci.setAccessible(false); + + return model; + } catch (Exception e) { + return null; + } + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + if (helper == IItemRenderer.ItemRendererHelper.BLOCK_3D) return false; + return true; + } + + public static Timer getMCTimer() { + try { + Class mcClass = Minecraft.class; + Field timerField = mcClass.getDeclaredFields()[16]; + if (!timerField.isAccessible()) timerField.setAccessible(true); + + return Timer.class.cast(timerField.get(Minecraft.getMinecraft())); + } catch (Exception e) { + return null; + } + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + EntityClientPlayerMP entityclientplayermp = Minecraft.getMinecraft().thePlayer; + + ItemWandCasting wand = (ItemWandCasting) item.getItem(); + ItemStack focusStack = wand.getFocusItem(item); + + // float renderPartialTicks = getMCTimer().renderPartialTicks; + + if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glPushMatrix(); Minecraft.getMinecraft().getTextureManager().bindTexture(entityclientplayermp.getLocationSkin()); - + GL11.glTranslated(0.5D, 1, 1); GL11.glRotated(90, 0, 0, 1); GL11.glRotated(220, 1, 0, 0); - - if(entityclientplayermp.isUsingItem()) - { - GL11.glTranslated(-0.5D, 0D, 0); - GL11.glRotated(-45, 0, 0, 1); - + + if (entityclientplayermp.isUsingItem()) { + GL11.glTranslated(-0.5D, 0D, 0); + GL11.glRotated(-45, 0, 0, 1); } - + Render render = RenderManager.instance.getEntityRenderObject(Minecraft.getMinecraft().thePlayer); - RenderPlayer renderplayer = (RenderPlayer)render; + RenderPlayer renderplayer = (RenderPlayer) render; float f10 = 3.0F; GL11.glScalef(f10, f10, f10); renderplayer.renderFirstPersonArm(Minecraft.getMinecraft().thePlayer); GL11.glPopMatrix(); - + GL11.glRotated(-45, 0, 1, 0); GL11.glTranslated(1.2D, 0.1D, -1); GL11.glScaled(0.6D, 0.6D, 0.6D); - if(entityclientplayermp.isUsingItem()) - { - GL11.glTranslated(0D, 1D, 0); - GL11.glRotated(35, 1, 0, 0); - GL11.glTranslated(0D, 0D, -0.7D); - GL11.glScaled(0.8D, 0.8D, 0.8D); + if (entityclientplayermp.isUsingItem()) { + GL11.glTranslated(0D, 1D, 0); + GL11.glRotated(35, 1, 0, 0); + GL11.glTranslated(0D, 0D, -0.7D); + GL11.glScaled(0.8D, 0.8D, 0.8D); } - } - - if(type == ItemRenderType.INVENTORY) - { - GL11.glScaled(0.5D, 0.5D, 0.5D); - } - - if(type == ItemRenderType.EQUIPPED) - { - GL11.glScaled(0.25D, 0.25D, 0.25D); - GL11.glRotated(-45, 0, 1, 0); - GL11.glTranslated(2.85D, 2.9D, 1.3D); - EntityLivingBase wielder = (EntityLivingBase) data[1]; - if(wielder.isInvisible()) - return; - } - - if(type == ItemRenderType.ENTITY) - GL11.glScaled(0.5D, 0.5D, 0.5D); - - double ds = 0.2D; - GL11.glScaled(ds, ds, ds); - Minecraft.getMinecraft().renderEngine.bindTexture(ItemCastingBracelet.braceletTextures[Math.min(ItemCastingBracelet.braceletTextures.length-1, item.getItemDamage())]); - GL11.glPushMatrix(); - if(wand.getRod(item) != null && wand.getRod(item).isGlowing()) - { - int j = (int)(200.0F + MathHelper.sin(entityclientplayermp.ticksExisted) * 5.0F + 5.0F); - int k = j % 65536; - int l = j / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F); - } - bracelet.renderAll(); - GL11.glPopMatrix(); - - if(focusStack != null) - { - if (wand.getFocus(item).getOrnament(focusStack) != null) - { - GL11.glPushMatrix(); - GL11.glScaled(5, 5, 5); - GL11.glTranslated(0, 0.7D, 0); - Tessellator tessellator = Tessellator.instance; - IIcon icon = wand.getFocus(item).getOrnament(focusStack); - float minU = icon.getMinU(); - float minV = icon.getMinV(); - float maxU = icon.getMaxU(); - float maxV = icon.getMaxV(); - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - GL11.glPushMatrix(); - GL11.glTranslatef(-0.25F, -0.1F, 0.0275F); - GL11.glScaled(0.5D, 0.5D, 0.5D); - ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.1F); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.25F, -0.1F, 0.0275F); - GL11.glScaled(0.5D, 0.5D, 0.5D); - ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.1F); - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } - - float alpha = 0.95F; - if (wand.getFocus(item).getFocusDepthLayerIcon(focusStack) != null) - { - GL11.glPushMatrix(); - GL11.glScaled(5, 5, 5); - GL11.glTranslated(0, 0.87D, 0); - GL11.glTranslatef(0.0F, -0.15F, 0.0F); - GL11.glScaled(0.165D, 0.1765D, 0.165D); //<- using the same numbers as Azanor, since the rendering should be identical to his. - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - renderBlocks.setRenderBoundsFromBlock(Blocks.glass); - BlockRenderer.drawFaces(renderBlocks, null, wand.getFocus(item).getFocusDepthLayerIcon(focusStack), false); - alpha = 0.6F; - GL11.glPopMatrix(); - } - - if (Thaumcraft.isHalloween) - UtilsFX.bindTexture("textures/models/spec_h.png"); - else - UtilsFX.bindTexture("textures/models/wand.png"); - - GL11.glPushMatrix(); - - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - GL11.glScaled(5, 5, 5); - GL11.glTranslated(0, 0.87D, 0); - GL11.glTranslatef(0.0F, -0.0475F, 0.0F); - GL11.glScaled(0.525D, 0.5525D, 0.525D); - Color c = new Color(wand.getFocus(item).getFocusColor(focusStack)); - GL11.glColor4f(c.getRed() / 255.0F, c.getGreen() / 255.0F, c.getBlue() / 255.0F, alpha); - int j = (int)(195.0F + MathHelper.sin(entityclientplayermp.ticksExisted / 3.0F) * 10.0F + 10.0F); - int k = j % 65536; - int l = j / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F); - getWandFociModel().render(0.0625F); - - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - - GL11.glPopMatrix(); - } - + } - } + if (type == ItemRenderType.INVENTORY) { + GL11.glScaled(0.5D, 0.5D, 0.5D); + } + if (type == ItemRenderType.EQUIPPED) { + GL11.glScaled(0.25D, 0.25D, 0.25D); + GL11.glRotated(-45, 0, 1, 0); + GL11.glTranslated(2.85D, 2.9D, 1.3D); + EntityLivingBase wielder = (EntityLivingBase) data[1]; + if (wielder.isInvisible()) return; + } + + if (type == ItemRenderType.ENTITY) GL11.glScaled(0.5D, 0.5D, 0.5D); + + double ds = 0.2D; + GL11.glScaled(ds, ds, ds); + Minecraft.getMinecraft() + .renderEngine + .bindTexture( + ItemCastingBracelet.braceletTextures[ + Math.min(ItemCastingBracelet.braceletTextures.length - 1, item.getItemDamage())]); + GL11.glPushMatrix(); + if (wand.getRod(item) != null && wand.getRod(item).isGlowing()) { + int j = (int) (200.0F + MathHelper.sin(entityclientplayermp.ticksExisted) * 5.0F + 5.0F); + int k = j % 65536; + int l = j / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F); + } + bracelet.renderAll(); + GL11.glPopMatrix(); + + if (focusStack != null) { + if (wand.getFocus(item).getOrnament(focusStack) != null) { + GL11.glPushMatrix(); + GL11.glScaled(5, 5, 5); + GL11.glTranslated(0, 0.7D, 0); + Tessellator tessellator = Tessellator.instance; + IIcon icon = wand.getFocus(item).getOrnament(focusStack); + float minU = icon.getMinU(); + float minV = icon.getMinV(); + float maxU = icon.getMaxU(); + float maxV = icon.getMaxV(); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + GL11.glPushMatrix(); + GL11.glTranslatef(-0.25F, -0.1F, 0.0275F); + GL11.glScaled(0.5D, 0.5D, 0.5D); + ItemRenderer.renderItemIn2D( + tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.1F); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.25F, -0.1F, 0.0275F); + GL11.glScaled(0.5D, 0.5D, 0.5D); + ItemRenderer.renderItemIn2D( + tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.1F); + GL11.glPopMatrix(); + GL11.glPopMatrix(); + } + + float alpha = 0.95F; + if (wand.getFocus(item).getFocusDepthLayerIcon(focusStack) != null) { + GL11.glPushMatrix(); + GL11.glScaled(5, 5, 5); + GL11.glTranslated(0, 0.87D, 0); + GL11.glTranslatef(0.0F, -0.15F, 0.0F); + GL11.glScaled( + 0.165D, 0.1765D, + 0.165D); // <- using the same numbers as Azanor, since the rendering should be identical to his. + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + renderBlocks.setRenderBoundsFromBlock(Blocks.glass); + BlockRenderer.drawFaces( + renderBlocks, null, wand.getFocus(item).getFocusDepthLayerIcon(focusStack), false); + alpha = 0.6F; + GL11.glPopMatrix(); + } + + if (Thaumcraft.isHalloween) UtilsFX.bindTexture("textures/models/spec_h.png"); + else UtilsFX.bindTexture("textures/models/wand.png"); + + GL11.glPushMatrix(); + + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + GL11.glScaled(5, 5, 5); + GL11.glTranslated(0, 0.87D, 0); + GL11.glTranslatef(0.0F, -0.0475F, 0.0F); + GL11.glScaled(0.525D, 0.5525D, 0.525D); + Color c = new Color(wand.getFocus(item).getFocusColor(focusStack)); + GL11.glColor4f(c.getRed() / 255.0F, c.getGreen() / 255.0F, c.getBlue() / 255.0F, alpha); + int j = (int) (195.0F + MathHelper.sin(entityclientplayermp.ticksExisted / 3.0F) * 10.0F + 10.0F); + int k = j % 65536; + int l = j / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F); + getWandFociModel().render(0.0625F); + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + + GL11.glPopMatrix(); + } + } } diff --git a/src/main/java/tb/client/render/item/HerobrinesScytheRenderer.java b/src/main/java/tb/client/render/item/HerobrinesScytheRenderer.java index 30065ac..31de51f 100644 --- a/src/main/java/tb/client/render/item/HerobrinesScytheRenderer.java +++ b/src/main/java/tb/client/render/item/HerobrinesScytheRenderer.java @@ -1,82 +1,106 @@ package tb.client.render.item; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; +import org.lwjgl.opengl.GL11; -public class HerobrinesScytheRenderer implements IItemRenderer{ +public class HerobrinesScytheRenderer implements IItemRenderer { - protected static RenderItem itemRender = new RenderItem(); - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + protected static RenderItem itemRender = new RenderItem(); - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, - ItemRendererHelper helper) { - return type != ItemRenderType.EQUIPPED_FIRST_PERSON && type != ItemRenderType.ENTITY; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - if(item != null) - { - GL11.glPushMatrix(); - - if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) - { - GL11.glScaled(3, 3, 3); - GL11.glTranslated(0, -0.4D, 0.3D); - GL11.glRotated(15, 0, 1, 0); - GL11.glRotated(15, 0, 0, 1); - IIcon icon = item.getIconIndex(); - ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.03125F); - } - - if(type == ItemRenderType.INVENTORY) - { - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - GL11.glTranslatef(0.7F, -0.9F, 1); - GL11.glScaled(2, 2, 2); - GL11.glRotated(60, 0, 1, 1); - IIcon icon = item.getIconIndex(); - ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - } - - if(type == ItemRenderType.ENTITY) - { - GL11.glScaled(4, 4, 4); - GL11.glRotated(90, 1, 0, 0); - GL11.glRotated(35, 0, 0, 1); - GL11.glTranslated(-0.5D, -0.5D, 0.05D); - IIcon icon = item.getIconIndex(); - ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - } - - if(type == ItemRenderType.EQUIPPED) - { - GL11.glScaled(6, 6, 6); - GL11.glRotated(135, 0, 1, 0); - GL11.glRotatef(-35, 0, 0, 1); - GL11.glTranslated(-0.7D, -0.4D, 0.01D); - IIcon icon = item.getIconIndex(); - ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0225F); - } - - GL11.glPopMatrix(); - } - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return type != ItemRenderType.EQUIPPED_FIRST_PERSON && type != ItemRenderType.ENTITY; + } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + if (item != null) { + GL11.glPushMatrix(); + + if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + GL11.glScaled(3, 3, 3); + GL11.glTranslated(0, -0.4D, 0.3D); + GL11.glRotated(15, 0, 1, 0); + GL11.glRotated(15, 0, 0, 1); + IIcon icon = item.getIconIndex(); + ItemRenderer.renderItemIn2D( + Tessellator.instance, + icon.getMinU(), + icon.getMinV(), + icon.getMaxU(), + icon.getMaxV(), + icon.getIconWidth(), + icon.getIconHeight(), + 0.03125F); + } + + if (type == ItemRenderType.INVENTORY) { + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + GL11.glTranslatef(0.7F, -0.9F, 1); + GL11.glScaled(2, 2, 2); + GL11.glRotated(60, 0, 1, 1); + IIcon icon = item.getIconIndex(); + ItemRenderer.renderItemIn2D( + Tessellator.instance, + icon.getMinU(), + icon.getMinV(), + icon.getMaxU(), + icon.getMaxV(), + icon.getIconWidth(), + icon.getIconHeight(), + 0.0625F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + if (type == ItemRenderType.ENTITY) { + GL11.glScaled(4, 4, 4); + GL11.glRotated(90, 1, 0, 0); + GL11.glRotated(35, 0, 0, 1); + GL11.glTranslated(-0.5D, -0.5D, 0.05D); + IIcon icon = item.getIconIndex(); + ItemRenderer.renderItemIn2D( + Tessellator.instance, + icon.getMinU(), + icon.getMinV(), + icon.getMaxU(), + icon.getMaxV(), + icon.getIconWidth(), + icon.getIconHeight(), + 0.0625F); + } + + if (type == ItemRenderType.EQUIPPED) { + GL11.glScaled(6, 6, 6); + GL11.glRotated(135, 0, 1, 0); + GL11.glRotatef(-35, 0, 0, 1); + GL11.glTranslated(-0.7D, -0.4D, 0.01D); + IIcon icon = item.getIconIndex(); + ItemRenderer.renderItemIn2D( + Tessellator.instance, + icon.getMinU(), + icon.getMinV(), + icon.getMaxU(), + icon.getMaxV(), + icon.getIconWidth(), + icon.getIconHeight(), + 0.0225F); + } + + GL11.glPopMatrix(); + } + } } diff --git a/src/main/java/tb/client/render/item/NodeFociRenderer.java b/src/main/java/tb/client/render/item/NodeFociRenderer.java index 7832d86..13069ed 100644 --- a/src/main/java/tb/client/render/item/NodeFociRenderer.java +++ b/src/main/java/tb/client/render/item/NodeFociRenderer.java @@ -1,44 +1,43 @@ package tb.client.render.item; -import org.lwjgl.opengl.GL11; - -import tb.common.item.ItemNodeFoci; import DummyCore.Utils.MiscUtils; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; +import tb.common.item.ItemNodeFoci; -public class NodeFociRenderer implements IItemRenderer{ +public class NodeFociRenderer implements IItemRenderer { - public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeManipulator/foci.obj")); - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + public static final IModelCustom model = + AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases", "models/nodeManipulator/foci.obj")); - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,ItemRendererHelper helper) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - - GL11.glPushMatrix(); - - GL11.glScalef(0.25F, 0.25F, 0.25F); - - if(type == ItemRenderType.INVENTORY) - GL11.glTranslated(0, -1, 0); - - MiscUtils.bindTexture("thaumicbases", "textures/blocks/nodeManipulator/foci_"+ItemNodeFoci.names[item.getItemDamage()]+".png"); - model.renderAll(); - - GL11.glPopMatrix(); - - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + + GL11.glPushMatrix(); + + GL11.glScalef(0.25F, 0.25F, 0.25F); + + if (type == ItemRenderType.INVENTORY) GL11.glTranslated(0, -1, 0); + + MiscUtils.bindTexture( + "thaumicbases", + "textures/blocks/nodeManipulator/foci_" + ItemNodeFoci.names[item.getItemDamage()] + ".png"); + model.renderAll(); + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/tb/client/render/item/NodeLinkerItemRenderer.java b/src/main/java/tb/client/render/item/NodeLinkerItemRenderer.java index 1dba907..3c2134b 100644 --- a/src/main/java/tb/client/render/item/NodeLinkerItemRenderer.java +++ b/src/main/java/tb/client/render/item/NodeLinkerItemRenderer.java @@ -1,41 +1,40 @@ package tb.client.render.item; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; -public class NodeLinkerItemRenderer implements IItemRenderer{ - - public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeLinker/nodeLinker.obj")); - public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeLinker/nodeLinkerUV.png"); +public class NodeLinkerItemRenderer implements IItemRenderer { - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + public static final IModelCustom model = + AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases", "models/nodeLinker/nodeLinker.obj")); + public static final ResourceLocation genIcon = + new ResourceLocation("thaumicbases", "textures/blocks/nodeLinker/nodeLinkerUV.png"); - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, - ItemRendererHelper helper) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - GL11.glPushMatrix(); - - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslated(0, -0.3D, 0); - - Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); - model.renderAll(); - - GL11.glPopMatrix(); - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + GL11.glPushMatrix(); + + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslated(0, -0.3D, 0); + + Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); + model.renderAll(); + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/tb/client/render/item/NodeManipulatorItemRenderer.java b/src/main/java/tb/client/render/item/NodeManipulatorItemRenderer.java index 5bb372c..897e351 100644 --- a/src/main/java/tb/client/render/item/NodeManipulatorItemRenderer.java +++ b/src/main/java/tb/client/render/item/NodeManipulatorItemRenderer.java @@ -1,46 +1,45 @@ package tb.client.render.item; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; -public class NodeManipulatorItemRenderer implements IItemRenderer{ - - public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeManipulator/nodeManipulator.obj")); - public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeManipulator/baseUVMap.png"); +public class NodeManipulatorItemRenderer implements IItemRenderer { - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + public static final IModelCustom model = AdvancedModelLoader.loadModel( + new ResourceLocation("thaumicbases", "models/nodeManipulator/nodeManipulator.obj")); + public static final ResourceLocation genIcon = + new ResourceLocation("thaumicbases", "textures/blocks/nodeManipulator/baseUVMap.png"); - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, - ItemRendererHelper helper) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - GL11.glPushMatrix(); - - GL11.glRotated(180, 1, 0, 0); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslated(0, -0.5D, 0); - - Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); - model.renderPart("base_Cube.001"); - model.renderPart("handle_0_Cube.002"); - model.renderPart("handle_1_Cube.002"); - model.renderPart("handle_2_Cube.002"); - model.renderPart("handle_3_Cube.002"); - - GL11.glPopMatrix(); - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + GL11.glPushMatrix(); + + GL11.glRotated(180, 1, 0, 0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslated(0, -0.5D, 0); + + Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); + model.renderPart("base_Cube.001"); + model.renderPart("handle_0_Cube.002"); + model.renderPart("handle_1_Cube.002"); + model.renderPart("handle_2_Cube.002"); + model.renderPart("handle_3_Cube.002"); + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/tb/client/render/item/RenderRevolver.java b/src/main/java/tb/client/render/item/RenderRevolver.java index 2eb495e..faafe6e 100644 --- a/src/main/java/tb/client/render/item/RenderRevolver.java +++ b/src/main/java/tb/client/render/item/RenderRevolver.java @@ -1,12 +1,7 @@ package tb.client.render.item; -import java.util.ArrayList; - -import org.lwjgl.opengl.GL11; - -import tb.api.RevolverUpgrade; -import tb.common.item.ItemRevolver; import DummyCore.Utils.Pair; +import java.util.ArrayList; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; @@ -14,148 +9,155 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; +import tb.api.RevolverUpgrade; +import tb.common.item.ItemRevolver; -public class RenderRevolver implements IItemRenderer -{ +public class RenderRevolver implements IItemRenderer { - public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/revolver/revolver.obj")); - public static final ResourceLocation handle = new ResourceLocation("thaumicbases","textures/items/revolver/revolverHandleUV.png"); - public static final ResourceLocation barrel = new ResourceLocation("thaumicbases","textures/items/revolver/revolverBarrelUV.png"); - public static final ResourceLocation metal = new ResourceLocation("thaumicbases","textures/items/revolver/revolverDarkMetal.png"); - public static final ResourceLocation gun = new ResourceLocation("thaumicbases","textures/items/revolver/revolverGunUV.png"); - public static final ResourceLocation press = new ResourceLocation("thaumicbases","textures/items/revolver/revolverPressUV.png"); - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + public static final IModelCustom model = + AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases", "models/revolver/revolver.obj")); + public static final ResourceLocation handle = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverHandleUV.png"); + public static final ResourceLocation barrel = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverBarrelUV.png"); + public static final ResourceLocation metal = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverDarkMetal.png"); + public static final ResourceLocation gun = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverGunUV.png"); + public static final ResourceLocation press = + new ResourceLocation("thaumicbases", "textures/items/revolver/revolverPressUV.png"); - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,ItemRendererHelper helper) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - - GL11.glPushMatrix(); - - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) - { - if(Minecraft.getMinecraft().thePlayer.isSneaking()) - { - GL11.glScaled(0.4D, 0.4D, 0.4D); - GL11.glRotated(-45, 0, 1, 0); - GL11.glTranslated(-1.73D, 0D, 4D); - }else - { - GL11.glScaled(0.4D, 0.4D, 0.4D); - GL11.glRotated(-45, 0, 1, 0); - GL11.glTranslated(4, -1, 1); - } - } - - if(type == ItemRenderType.INVENTORY) - { - GL11.glScaled(0.2D, 0.2D, 0.2D); - GL11.glTranslated(-5, -5, 0); - } - - if(type == ItemRenderType.EQUIPPED) - { - Entity e = (Entity) data[1]; - if(e.isSneaking()) - { - GL11.glScaled(0.2D, 0.2D, 0.2D); - GL11.glRotated(45, 0, 1, 0); - GL11.glRotated(25, 1, 0, 0); - GL11.glTranslated(0, 4, 6); - }else - { - GL11.glScaled(0.2D, 0.2D, 0.2D); - GL11.glRotated(45, 0, 1, 0); - GL11.glTranslated(0, 2, 6); - } - } - - if(type == ItemRenderType.ENTITY) - { - GL11.glScaled(0.2D, 0.2D, 0.2D); - GL11.glTranslated(0, 0, 5); - } - - ResourceLocation handle = RenderRevolver.handle; - ResourceLocation barrel = RenderRevolver.barrel; - ResourceLocation metal = RenderRevolver.metal; - ResourceLocation gun = RenderRevolver.gun; - ResourceLocation press = RenderRevolver.press; - - ArrayList> upgrades = ItemRevolver.getAllUpgradesFor(item); - for(Pair p : upgrades) - { - RevolverUpgrade ru = p.getFirst(); - handle = ru.getOverridePartTexture(item, 0, p.getSecond()) == null ? handle : ru.getOverridePartTexture(item, 0, p.getSecond()); - barrel = ru.getOverridePartTexture(item, 1, p.getSecond()) == null ? barrel : ru.getOverridePartTexture(item, 1, p.getSecond()); - metal = ru.getOverridePartTexture(item, 2, p.getSecond()) == null ? metal : ru.getOverridePartTexture(item, 2, p.getSecond()); - gun = ru.getOverridePartTexture(item, 3, p.getSecond()) == null ? gun : ru.getOverridePartTexture(item, 3, p.getSecond()); - press = ru.getOverridePartTexture(item, 4, p.getSecond()) == null ? press : ru.getOverridePartTexture(item, 4, p.getSecond()); - } - - Minecraft.getMinecraft().renderEngine.bindTexture(handle); - model.renderPart("Cylinder"); - model.renderPart("Plane"); - - double rotation = item.hasTagCompound() ? item.getTagCompound().getDouble("renderedRotation") : 0; - - GL11.glPushMatrix(); - GL11.glTranslated(0, 2.9D, 0); - GL11.glTranslated(0, -Math.cos(Math.toRadians(rotation))*2.8D, 0); - GL11.glTranslated(Math.sin(Math.toRadians(rotation))*2.8D, 0, 0); - GL11.glRotated(rotation, 0, 0, 1); - - - Minecraft.getMinecraft().renderEngine.bindTexture(barrel); - model.renderPart("rBarrel_Cube.001"); - GL11.glPopMatrix(); - //GL11.glRotated(-rotation, 0, 0, 1); - - Minecraft.getMinecraft().renderEngine.bindTexture(metal); - model.renderPart("Cube.003_Cube.004"); - model.renderPart("Cube.002_Cube.003"); - model.renderPart("Cube_Cube.001"); - Minecraft.getMinecraft().renderEngine.bindTexture(gun); - model.renderPart("Cylinder.002"); - model.renderPart("Plane.001"); - Minecraft.getMinecraft().renderEngine.bindTexture(press); - model.renderPart("Cube.001_Cube.005"); - - if(type == ItemRenderType.EQUIPPED_FIRST_PERSON && item.getTagCompound() != null && item.getTagCompound().getBoolean("hasJar")) - { - GL11.glPushMatrix(); - - GL11.glScaled(1.1, 1.1, 1.1); - GL11.glTranslated(-0.11D, -0.25D, 1); - - double tickIndex = (double)Minecraft.getMinecraft().thePlayer.ticksExisted % 40 / 20; - if(tickIndex > 1) - tickIndex = -tickIndex+2; - - GL11.glColor4d(1, 0, 0, tickIndex); - - Minecraft.getMinecraft().renderEngine.bindTexture(metal); - model.renderPart("Cube_Cube.001"); - - GL11.glPopMatrix(); - } - - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - - GL11.glPopMatrix(); - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + + GL11.glPushMatrix(); + + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + if (Minecraft.getMinecraft().thePlayer.isSneaking()) { + GL11.glScaled(0.4D, 0.4D, 0.4D); + GL11.glRotated(-45, 0, 1, 0); + GL11.glTranslated(-1.73D, 0D, 4D); + } else { + GL11.glScaled(0.4D, 0.4D, 0.4D); + GL11.glRotated(-45, 0, 1, 0); + GL11.glTranslated(4, -1, 1); + } + } + + if (type == ItemRenderType.INVENTORY) { + GL11.glScaled(0.2D, 0.2D, 0.2D); + GL11.glTranslated(-5, -5, 0); + } + + if (type == ItemRenderType.EQUIPPED) { + Entity e = (Entity) data[1]; + if (e.isSneaking()) { + GL11.glScaled(0.2D, 0.2D, 0.2D); + GL11.glRotated(45, 0, 1, 0); + GL11.glRotated(25, 1, 0, 0); + GL11.glTranslated(0, 4, 6); + } else { + GL11.glScaled(0.2D, 0.2D, 0.2D); + GL11.glRotated(45, 0, 1, 0); + GL11.glTranslated(0, 2, 6); + } + } + + if (type == ItemRenderType.ENTITY) { + GL11.glScaled(0.2D, 0.2D, 0.2D); + GL11.glTranslated(0, 0, 5); + } + + ResourceLocation handle = RenderRevolver.handle; + ResourceLocation barrel = RenderRevolver.barrel; + ResourceLocation metal = RenderRevolver.metal; + ResourceLocation gun = RenderRevolver.gun; + ResourceLocation press = RenderRevolver.press; + + ArrayList> upgrades = ItemRevolver.getAllUpgradesFor(item); + for (Pair p : upgrades) { + RevolverUpgrade ru = p.getFirst(); + handle = ru.getOverridePartTexture(item, 0, p.getSecond()) == null + ? handle + : ru.getOverridePartTexture(item, 0, p.getSecond()); + barrel = ru.getOverridePartTexture(item, 1, p.getSecond()) == null + ? barrel + : ru.getOverridePartTexture(item, 1, p.getSecond()); + metal = ru.getOverridePartTexture(item, 2, p.getSecond()) == null + ? metal + : ru.getOverridePartTexture(item, 2, p.getSecond()); + gun = ru.getOverridePartTexture(item, 3, p.getSecond()) == null + ? gun + : ru.getOverridePartTexture(item, 3, p.getSecond()); + press = ru.getOverridePartTexture(item, 4, p.getSecond()) == null + ? press + : ru.getOverridePartTexture(item, 4, p.getSecond()); + } + + Minecraft.getMinecraft().renderEngine.bindTexture(handle); + model.renderPart("Cylinder"); + model.renderPart("Plane"); + + double rotation = item.hasTagCompound() ? item.getTagCompound().getDouble("renderedRotation") : 0; + + GL11.glPushMatrix(); + GL11.glTranslated(0, 2.9D, 0); + GL11.glTranslated(0, -Math.cos(Math.toRadians(rotation)) * 2.8D, 0); + GL11.glTranslated(Math.sin(Math.toRadians(rotation)) * 2.8D, 0, 0); + GL11.glRotated(rotation, 0, 0, 1); + + Minecraft.getMinecraft().renderEngine.bindTexture(barrel); + model.renderPart("rBarrel_Cube.001"); + GL11.glPopMatrix(); + // GL11.glRotated(-rotation, 0, 0, 1); + + Minecraft.getMinecraft().renderEngine.bindTexture(metal); + model.renderPart("Cube.003_Cube.004"); + model.renderPart("Cube.002_Cube.003"); + model.renderPart("Cube_Cube.001"); + Minecraft.getMinecraft().renderEngine.bindTexture(gun); + model.renderPart("Cylinder.002"); + model.renderPart("Plane.001"); + Minecraft.getMinecraft().renderEngine.bindTexture(press); + model.renderPart("Cube.001_Cube.005"); + + if (type == ItemRenderType.EQUIPPED_FIRST_PERSON + && item.getTagCompound() != null + && item.getTagCompound().getBoolean("hasJar")) { + GL11.glPushMatrix(); + + GL11.glScaled(1.1, 1.1, 1.1); + GL11.glTranslated(-0.11D, -0.25D, 1); + + double tickIndex = (double) Minecraft.getMinecraft().thePlayer.ticksExisted % 40 / 20; + if (tickIndex > 1) tickIndex = -tickIndex + 2; + + GL11.glColor4d(1, 0, 0, tickIndex); + + Minecraft.getMinecraft().renderEngine.bindTexture(metal); + model.renderPart("Cube_Cube.001"); + + GL11.glPopMatrix(); + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/tb/client/render/tile/RenderEntityDeconstructor.java b/src/main/java/tb/client/render/tile/RenderEntityDeconstructor.java index f4d5324..44b5cd5 100644 --- a/src/main/java/tb/client/render/tile/RenderEntityDeconstructor.java +++ b/src/main/java/tb/client/render/tile/RenderEntityDeconstructor.java @@ -1,8 +1,5 @@ package tb.client.render.tile; -import org.lwjgl.opengl.GL11; - -import tb.common.tile.TileEntityDeconstructor; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -10,41 +7,51 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; +import tb.common.tile.TileEntityDeconstructor; -public class RenderEntityDeconstructor extends TileEntitySpecialRenderer{ +public class RenderEntityDeconstructor extends TileEntitySpecialRenderer { + + public static final IModelCustom model = AdvancedModelLoader.loadModel( + new ResourceLocation("thaumicbases", "models/entityDeconstructor/deconstructor.obj")); + public static final ResourceLocation frameIcon = + new ResourceLocation("thaumicbases", "textures/blocks/entityDeconstructor/goldbase.png"); + public static final ResourceLocation glassIcon = + new ResourceLocation("thaumicbases", "textures/blocks/entityDeconstructor/glass.png"); + + public static final ResourceLocation air = new ResourceLocation("thaumicbases", "textures/blocks/crystal/air.png"); + public static final ResourceLocation fire = + new ResourceLocation("thaumicbases", "textures/blocks/crystal/fire.png"); + public static final ResourceLocation water = + new ResourceLocation("thaumicbases", "textures/blocks/crystal/water.png"); + public static final ResourceLocation earth = + new ResourceLocation("thaumicbases", "textures/blocks/crystal/earth.png"); + public static final ResourceLocation ordo = + new ResourceLocation("thaumicbases", "textures/blocks/crystal/order.png"); + public static final ResourceLocation entropy = + new ResourceLocation("thaumicbases", "textures/blocks/crystal/entropy.png"); + + @Override + public void renderTileEntityAt( + TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) { + GL11.glPushMatrix(); + + TileEntityDeconstructor d = (TileEntityDeconstructor) tile; + + GL11.glTranslated(screenX + 0.5D, screenY, screenZ + 0.5D); + GL11.glScalef(0.3F, 0.4F, 0.3F); + Minecraft.getMinecraft().renderEngine.bindTexture(frameIcon); + model.renderPart("Cube_Cube.001"); + + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + Minecraft.getMinecraft().renderEngine.bindTexture(glassIcon); + model.renderPart("Plane"); + + GL11.glEnable(GL11.GL_ALPHA_TEST); - public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/entityDeconstructor/deconstructor.obj")); - public static final ResourceLocation frameIcon = new ResourceLocation("thaumicbases","textures/blocks/entityDeconstructor/goldbase.png"); - public static final ResourceLocation glassIcon = new ResourceLocation("thaumicbases","textures/blocks/entityDeconstructor/glass.png"); - - public static final ResourceLocation air = new ResourceLocation("thaumicbases","textures/blocks/crystal/air.png"); - public static final ResourceLocation fire = new ResourceLocation("thaumicbases","textures/blocks/crystal/fire.png"); - public static final ResourceLocation water = new ResourceLocation("thaumicbases","textures/blocks/crystal/water.png"); - public static final ResourceLocation earth = new ResourceLocation("thaumicbases","textures/blocks/crystal/earth.png"); - public static final ResourceLocation ordo = new ResourceLocation("thaumicbases","textures/blocks/crystal/order.png"); - public static final ResourceLocation entropy = new ResourceLocation("thaumicbases","textures/blocks/crystal/entropy.png"); - - @Override - public void renderTileEntityAt(TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) - { - GL11.glPushMatrix(); - - TileEntityDeconstructor d = (TileEntityDeconstructor) tile; - - GL11.glTranslated(screenX+0.5D, screenY, screenZ+0.5D); - GL11.glScalef(0.3F, 0.4F, 0.3F); - Minecraft.getMinecraft().renderEngine.bindTexture(frameIcon); - model.renderPart("Cube_Cube.001"); - - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - Minecraft.getMinecraft().renderEngine.bindTexture(glassIcon); - model.renderPart("Plane"); - - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -52,49 +59,42 @@ public class RenderEntityDeconstructor extends TileEntitySpecialRenderer{ char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - if(d.hasAir) - { - Minecraft.getMinecraft().renderEngine.bindTexture(air); - model.renderPart("Sphere"); - } - - if(d.hasFire) - { - Minecraft.getMinecraft().renderEngine.bindTexture(fire); - model.renderPart("Sphere.001"); - } - - if(d.hasWater) - { - Minecraft.getMinecraft().renderEngine.bindTexture(water); - model.renderPart("Sphere.002"); - } - - if(d.hasEarth) - { - Minecraft.getMinecraft().renderEngine.bindTexture(earth); - model.renderPart("Sphere.003"); - } - - if(d.hasOrdo) - { - Minecraft.getMinecraft().renderEngine.bindTexture(ordo); - model.renderPart("Sphere.004"); - } - - if(d.hasEntropy) - { - Minecraft.getMinecraft().renderEngine.bindTexture(entropy); - model.renderPart("Sphere.005"); - } - - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - - GL11.glPopMatrix(); - } + if (d.hasAir) { + Minecraft.getMinecraft().renderEngine.bindTexture(air); + model.renderPart("Sphere"); + } + + if (d.hasFire) { + Minecraft.getMinecraft().renderEngine.bindTexture(fire); + model.renderPart("Sphere.001"); + } + + if (d.hasWater) { + Minecraft.getMinecraft().renderEngine.bindTexture(water); + model.renderPart("Sphere.002"); + } + + if (d.hasEarth) { + Minecraft.getMinecraft().renderEngine.bindTexture(earth); + model.renderPart("Sphere.003"); + } + + if (d.hasOrdo) { + Minecraft.getMinecraft().renderEngine.bindTexture(ordo); + model.renderPart("Sphere.004"); + } + + if (d.hasEntropy) { + Minecraft.getMinecraft().renderEngine.bindTexture(entropy); + model.renderPart("Sphere.005"); + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/tb/client/render/tile/RenderNodeLinker.java b/src/main/java/tb/client/render/tile/RenderNodeLinker.java index 3e76df4..ca45dd1 100644 --- a/src/main/java/tb/client/render/tile/RenderNodeLinker.java +++ b/src/main/java/tb/client/render/tile/RenderNodeLinker.java @@ -1,30 +1,30 @@ package tb.client.render.tile; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; -public class RenderNodeLinker extends TileEntitySpecialRenderer{ +public class RenderNodeLinker extends TileEntitySpecialRenderer { - public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeLinker/nodeLinker.obj")); - public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeLinker/nodeLinkerUV.png"); - - @Override - public void renderTileEntityAt(TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) - { - GL11.glPushMatrix(); - GL11.glTranslated(screenX+0.5D, screenY, screenZ+0.5D); - GL11.glScaled(0.5D, 0.5D, 0.5D); - - Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); - model.renderAll(); - - GL11.glPopMatrix(); - } + public static final IModelCustom model = + AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases", "models/nodeLinker/nodeLinker.obj")); + public static final ResourceLocation genIcon = + new ResourceLocation("thaumicbases", "textures/blocks/nodeLinker/nodeLinkerUV.png"); + @Override + public void renderTileEntityAt( + TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) { + GL11.glPushMatrix(); + GL11.glTranslated(screenX + 0.5D, screenY, screenZ + 0.5D); + GL11.glScaled(0.5D, 0.5D, 0.5D); + + Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); + model.renderAll(); + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/tb/client/render/tile/RenderNodeManipulator.java b/src/main/java/tb/client/render/tile/RenderNodeManipulator.java index 0486513..b037d53 100644 --- a/src/main/java/tb/client/render/tile/RenderNodeManipulator.java +++ b/src/main/java/tb/client/render/tile/RenderNodeManipulator.java @@ -1,8 +1,5 @@ package tb.client.render.tile; -import org.lwjgl.opengl.GL11; - -import tb.common.item.ItemNodeFoci; import DummyCore.Utils.MiscUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -10,35 +7,38 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; +import tb.common.item.ItemNodeFoci; -public class RenderNodeManipulator extends TileEntitySpecialRenderer{ +public class RenderNodeManipulator extends TileEntitySpecialRenderer { - public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeManipulator/nodeManipulator.obj")); - public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeManipulator/baseUVMap.png"); - - @Override - public void renderTileEntityAt(TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) - { - GL11.glPushMatrix(); - GL11.glTranslated(screenX+0.5D, screenY+1, screenZ+0.5D); - GL11.glRotated(180, 1, 0, 0); - GL11.glScaled(0.5D, 0.5D, 0.5D); - - Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); - model.renderPart("base_Cube.001"); - model.renderPart("handle_0_Cube.002"); - model.renderPart("handle_1_Cube.002"); - model.renderPart("handle_2_Cube.002"); - model.renderPart("handle_3_Cube.002"); - - int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); - if(meta != 0) - { - MiscUtils.bindTexture("thaumicbases", "textures/blocks/nodeManipulator/foci_"+ItemNodeFoci.names[meta-1]+".png"); - model.renderPart("foci_Cube.003"); - } - - GL11.glPopMatrix(); - } + public static final IModelCustom model = AdvancedModelLoader.loadModel( + new ResourceLocation("thaumicbases", "models/nodeManipulator/nodeManipulator.obj")); + public static final ResourceLocation genIcon = + new ResourceLocation("thaumicbases", "textures/blocks/nodeManipulator/baseUVMap.png"); + @Override + public void renderTileEntityAt( + TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) { + GL11.glPushMatrix(); + GL11.glTranslated(screenX + 0.5D, screenY + 1, screenZ + 0.5D); + GL11.glRotated(180, 1, 0, 0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + + Minecraft.getMinecraft().renderEngine.bindTexture(genIcon); + model.renderPart("base_Cube.001"); + model.renderPart("handle_0_Cube.002"); + model.renderPart("handle_1_Cube.002"); + model.renderPart("handle_2_Cube.002"); + model.renderPart("handle_3_Cube.002"); + + int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); + if (meta != 0) { + MiscUtils.bindTexture( + "thaumicbases", "textures/blocks/nodeManipulator/foci_" + ItemNodeFoci.names[meta - 1] + ".png"); + model.renderPart("foci_Cube.003"); + } + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/tb/client/render/tile/RenderOverchanter.java b/src/main/java/tb/client/render/tile/RenderOverchanter.java index 565beb3..ee4fbb4 100644 --- a/src/main/java/tb/client/render/tile/RenderOverchanter.java +++ b/src/main/java/tb/client/render/tile/RenderOverchanter.java @@ -1,11 +1,6 @@ package tb.client.render.tile; import java.awt.Color; - -import org.lwjgl.opengl.GL11; - -import DummyCore.Utils.MiscUtils; -import tb.common.tile.TileOverchanter; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; @@ -14,24 +9,26 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; +import org.lwjgl.opengl.GL11; +import tb.common.tile.TileOverchanter; -public class RenderOverchanter extends TileEntitySpecialRenderer{ +public class RenderOverchanter extends TileEntitySpecialRenderer { - @Override - public void renderTileEntityAt(TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) - { - TileOverchanter overchanter = (TileOverchanter) tile; - - /*if(overchanter.inventory != null) - { - GL11.glPushMatrix(); - - MiscUtils.renderItemStack_Full(overchanter.inventory, 0, 0, 0, screenX, screenY, screenZ, tile.getWorldObj().getWorldTime()%360, 0, 1, 1, 1, 0.5F, 0.9F, 0.5F); - - GL11.glPopMatrix(); - }*/ - - GL11.glPushMatrix(); + @Override + public void renderTileEntityAt( + TileEntity tile, double screenX, double screenY, double screenZ, float partialTicks) { + TileOverchanter overchanter = (TileOverchanter) tile; + + /*if(overchanter.inventory != null) + { + GL11.glPushMatrix(); + + MiscUtils.renderItemStack_Full(overchanter.inventory, 0, 0, 0, screenX, screenY, screenZ, tile.getWorldObj().getWorldTime()%360, 0, 1, 1, 1, 0.5F, 0.9F, 0.5F); + + GL11.glPopMatrix(); + }*/ + + GL11.glPushMatrix(); GL11.glTranslated(screenX, screenY + 0.75, screenZ); ItemStack item = overchanter.inventory; @@ -55,24 +52,24 @@ public class RenderOverchanter extends TileEntitySpecialRenderer{ float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); - ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + ItemRenderer.renderItemIn2D( + Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); } renderPass++; } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage())); GL11.glPopMatrix(); } - + GL11.glPopMatrix(); - - /*if(overchanter.renderedLightning != null) - { - GL11.glPushMatrix(); - - overchanter.renderedLightning.render(screenX+0.5D, screenY+1D, screenZ+0.5D, partialTicks); - - GL11.glPopMatrix(); - }*/ - } - + + /*if(overchanter.renderedLightning != null) + { + GL11.glPushMatrix(); + + overchanter.renderedLightning.render(screenX+0.5D, screenY+1D, screenZ+0.5D, partialTicks); + + GL11.glPopMatrix(); + }*/ + } } diff --git a/src/main/java/tb/common/block/BlockAdvAlchemicalFurnace.java b/src/main/java/tb/common/block/BlockAdvAlchemicalFurnace.java index 79f5e0e..a2caca7 100644 --- a/src/main/java/tb/common/block/BlockAdvAlchemicalFurnace.java +++ b/src/main/java/tb/common/block/BlockAdvAlchemicalFurnace.java @@ -1,8 +1,9 @@ package tb.common.block; -import java.util.Random; - import DummyCore.Utils.MiscUtils; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -17,209 +18,176 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import tb.common.tile.TileAdvAlchemicalFurnace; import thaumcraft.common.Thaumcraft; import thaumcraft.common.tiles.TileAlchemyFurnace; -public class BlockAdvAlchemicalFurnace extends BlockContainer{ +public class BlockAdvAlchemicalFurnace extends BlockContainer { - public IIcon[] icons = new IIcon[6]; - - public BlockAdvAlchemicalFurnace() - { - super(Material.rock); - this.setHardness(2); - this.setResistance(3); - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister ir) - { - icons[0] = ir.registerIcon("thaumicbases:tFurnace/side"); - icons[1] = ir.registerIcon("thaumicbases:tFurnace/top"); - icons[2] = ir.registerIcon("thaumicbases:tFurnace/top_filled"); - icons[3] = ir.registerIcon("thaumicbases:tFurnace/front_off"); - icons[4] = ir.registerIcon("thaumicbases:tFurnace/front_on"); - icons[5] = ir.registerIcon("thaumicbases:tFurnace/bottom"); - } + public IIcon[] icons = new IIcon[6]; - @Override - public TileEntity createNewTileEntity(World w, int meta) { - return new TileAdvAlchemicalFurnace(); - } - - public IIcon getIcon(int side, int md) - { - return side == 0 || side == 1 ? icons[1] : side == 3 ? icons[3] : icons[0]; - } - - public IIcon getIcon(IBlockAccess w, int x, int y, int z, int side) - { - TileAdvAlchemicalFurnace tile = (TileAdvAlchemicalFurnace) w.getTileEntity(x, y, z); - if(side == w.getBlockMetadata(x, y, z)) - { - if(tile.isBurning()) - { - return icons[4]; - }else - { - return icons[3]; - } - } - - if(side == 0) { - return icons[5]; - } - - if(side == 1) - { - if(tile.vis > 0) - { - return icons[2]; - }else - { - return icons[1]; - } - } - return icons[0]; - } - - public int getLightValue(IBlockAccess w, int x, int y, int z) - { - TileAdvAlchemicalFurnace tile = (TileAdvAlchemicalFurnace) w.getTileEntity(x, y, z); - return tile.isBurning() ? 12 : 0; - } - - public boolean hasComparatorInputOverride() - { - return true; - } - - public int getComparatorInputOverride(World w, int x, int y, int z, int rs) - { - return Container.calcRedstoneFromInventory((IInventory)w.getTileEntity(x, y, z)); - } - - public void breakBlock(World w, int x, int y, int z, Block b, int meta) - { - MiscUtils.dropItemsOnBlockBreak(w, x, y, z, b, meta); - } - - public void onNeighborBlockChange(World w, int x, int y, int z, Block changed) - { - ((TileAdvAlchemicalFurnace) w.getTileEntity(x, y, z)).getBellows(); - } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) - { - if (w.isRemote) return true; - TileEntity tileEntity = w.getTileEntity(x, y, z); - - if(!player.isSneaking() && tileEntity instanceof TileAdvAlchemicalFurnace) - { - player.openGui(Thaumcraft.instance, 9, w, x, y, z); - return true; - } - - return false; - } - - public void onBlockAdded(World w, int x, int y, int z) - { + public BlockAdvAlchemicalFurnace() { + super(Material.rock); + this.setHardness(2); + this.setResistance(3); + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister ir) { + icons[0] = ir.registerIcon("thaumicbases:tFurnace/side"); + icons[1] = ir.registerIcon("thaumicbases:tFurnace/top"); + icons[2] = ir.registerIcon("thaumicbases:tFurnace/top_filled"); + icons[3] = ir.registerIcon("thaumicbases:tFurnace/front_off"); + icons[4] = ir.registerIcon("thaumicbases:tFurnace/front_on"); + icons[5] = ir.registerIcon("thaumicbases:tFurnace/bottom"); + } + + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileAdvAlchemicalFurnace(); + } + + public IIcon getIcon(int side, int md) { + return side == 0 || side == 1 ? icons[1] : side == 3 ? icons[3] : icons[0]; + } + + public IIcon getIcon(IBlockAccess w, int x, int y, int z, int side) { + TileAdvAlchemicalFurnace tile = (TileAdvAlchemicalFurnace) w.getTileEntity(x, y, z); + if (side == w.getBlockMetadata(x, y, z)) { + if (tile.isBurning()) { + return icons[4]; + } else { + return icons[3]; + } + } + + if (side == 0) { + return icons[5]; + } + + if (side == 1) { + if (tile.vis > 0) { + return icons[2]; + } else { + return icons[1]; + } + } + return icons[0]; + } + + public int getLightValue(IBlockAccess w, int x, int y, int z) { + TileAdvAlchemicalFurnace tile = (TileAdvAlchemicalFurnace) w.getTileEntity(x, y, z); + return tile.isBurning() ? 12 : 0; + } + + public boolean hasComparatorInputOverride() { + return true; + } + + public int getComparatorInputOverride(World w, int x, int y, int z, int rs) { + return Container.calcRedstoneFromInventory((IInventory) w.getTileEntity(x, y, z)); + } + + public void breakBlock(World w, int x, int y, int z, Block b, int meta) { + MiscUtils.dropItemsOnBlockBreak(w, x, y, z, b, meta); + } + + public void onNeighborBlockChange(World w, int x, int y, int z, Block changed) { + ((TileAdvAlchemicalFurnace) w.getTileEntity(x, y, z)).getBellows(); + } + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { + if (w.isRemote) return true; + TileEntity tileEntity = w.getTileEntity(x, y, z); + + if (!player.isSneaking() && tileEntity instanceof TileAdvAlchemicalFurnace) { + player.openGui(Thaumcraft.instance, 9, w, x, y, z); + return true; + } + + return false; + } + + public void onBlockAdded(World w, int x, int y, int z) { super.onBlockAdded(w, x, y, z); this.determineOrientation(w, x, y, z); } - - private void determineOrientation(World w, int x, int y, int z) - { - if (!w.isRemote) - { + + private void determineOrientation(World w, int x, int y, int z) { + if (!w.isRemote) { Block block = w.getBlock(x, y, z - 1); Block block1 = w.getBlock(x, y, z + 1); Block block2 = w.getBlock(x - 1, y, z); Block block3 = w.getBlock(x + 1, y, z); byte b0 = 3; - if (block.func_149730_j() && !block1.func_149730_j()) - { + if (block.func_149730_j() && !block1.func_149730_j()) { b0 = 3; } - if (block1.func_149730_j() && !block.func_149730_j()) - { + if (block1.func_149730_j() && !block.func_149730_j()) { b0 = 2; } - if (block2.func_149730_j() && !block3.func_149730_j()) - { + if (block2.func_149730_j() && !block3.func_149730_j()) { b0 = 5; } - if (block3.func_149730_j() && !block2.func_149730_j()) - { + if (block3.func_149730_j() && !block2.func_149730_j()) { b0 = 4; } w.setBlockMetadataWithNotify(x, y, z, b0, 2); } } - - public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) - { - int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - if (l == 0) - { + public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { + int l = MathHelper.floor_double((double) (p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + + if (l == 0) { w.setBlockMetadataWithNotify(x, y, z, 2, 2); } - if (l == 1) - { + if (l == 1) { w.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if (l == 2) - { + if (l == 2) { w.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if (l == 3) - { + if (l == 3) { w.setBlockMetadataWithNotify(x, y, z, 4, 2); } } - - + @SideOnly(Side.CLIENT) public void randomDisplayTick(final World w, final int x, final int y, final int z, final Random r) { final TileEntity te = w.getTileEntity(x, y, z); - if (te != null && te instanceof TileAlchemyFurnace && ((TileAlchemyFurnace)te).isBurning()) { + if (te != null && te instanceof TileAlchemyFurnace && ((TileAlchemyFurnace) te).isBurning()) { final float f = x + 0.5f; final float f2 = y + 0.2f + r.nextFloat() * 5.0f / 16.0f; final float f3 = z + 0.5f; final float f4 = 0.52f; final float f5 = r.nextFloat() * 0.5f - 0.25f; - - if (w.getBlockMetadata(x, y, z) == 4) { - w.spawnParticle("smoke", (double)(f - f4), (double)f2, (double)(f3 + f5), 0.0, 0.0, 0.0); - w.spawnParticle("flame", (double)(f - f4), (double)f2, (double)(f3 + f5), 0.0, 0.0, 0.0); + + if (w.getBlockMetadata(x, y, z) == 4) { + w.spawnParticle("smoke", (double) (f - f4), (double) f2, (double) (f3 + f5), 0.0, 0.0, 0.0); + w.spawnParticle("flame", (double) (f - f4), (double) f2, (double) (f3 + f5), 0.0, 0.0, 0.0); } if (w.getBlockMetadata(x, y, z) == 5) { - w.spawnParticle("smoke", (double)(f + f4), (double)f2, (double)(f3 + f5), 0.0, 0.0, 0.0); - w.spawnParticle("flame", (double)(f + f4), (double)f2, (double)(f3 + f5), 0.0, 0.0, 0.0); + w.spawnParticle("smoke", (double) (f + f4), (double) f2, (double) (f3 + f5), 0.0, 0.0, 0.0); + w.spawnParticle("flame", (double) (f + f4), (double) f2, (double) (f3 + f5), 0.0, 0.0, 0.0); } if (w.getBlockMetadata(x, y, z) == 2) { - w.spawnParticle("smoke", (double)(f + f5), (double)f2, (double)(f3 - f4), 0.0, 0.0, 0.0); - w.spawnParticle("flame", (double)(f + f5), (double)f2, (double)(f3 - f4), 0.0, 0.0, 0.0); + w.spawnParticle("smoke", (double) (f + f5), (double) f2, (double) (f3 - f4), 0.0, 0.0, 0.0); + w.spawnParticle("flame", (double) (f + f5), (double) f2, (double) (f3 - f4), 0.0, 0.0, 0.0); } if (w.getBlockMetadata(x, y, z) == 3) { - w.spawnParticle("smoke", (double)(f + f5), (double)f2, (double)(f3 + f4), 0.0, 0.0, 0.0); - w.spawnParticle("flame", (double)(f + f5), (double)f2, (double)(f3 + f4), 0.0, 0.0, 0.0); + w.spawnParticle("smoke", (double) (f + f5), (double) f2, (double) (f3 + f4), 0.0, 0.0, 0.0); + w.spawnParticle("flame", (double) (f + f5), (double) f2, (double) (f3 + f4), 0.0, 0.0, 0.0); } } } - - } diff --git a/src/main/java/tb/common/block/BlockAshroom.java b/src/main/java/tb/common/block/BlockAshroom.java index a4122fd..3426510 100644 --- a/src/main/java/tb/common/block/BlockAshroom.java +++ b/src/main/java/tb/common/block/BlockAshroom.java @@ -2,56 +2,53 @@ package tb.common.block; import java.util.ArrayList; import java.util.Random; - -import thaumcraft.api.aspects.Aspect; -import thaumcraft.common.entities.EntityAspectOrb; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.entities.EntityAspectOrb; public class BlockAshroom extends BlockTBPlant { - public BlockAshroom(int stages, int delay, boolean isCrop) { - super(stages, delay, isCrop); - } - - @Override - public void func_149853_b(World w, Random r,int x, int y, int z) - { - int meta = w.getBlockMetadata(x, y, z); - w.setBlockMetadataWithNotify(x, y, z, Math.min(growthStages,meta+1), 3); - } - - protected boolean func_150109_e(World p_150109_1_, int p_150109_2_, int p_150109_3_, int p_150109_4_) - { - if (!this.canPlaceBlockAt(p_150109_1_, p_150109_2_, p_150109_3_, p_150109_4_)) - { - if (p_150109_1_.getBlock(p_150109_2_, p_150109_3_, p_150109_4_) == this) - { - this.dropBlockAsItem(p_150109_1_, p_150109_2_, p_150109_3_, p_150109_4_, p_150109_1_.getBlockMetadata(p_150109_2_, p_150109_3_, p_150109_4_), 0); + public BlockAshroom(int stages, int delay, boolean isCrop) { + super(stages, delay, isCrop); + } + + @Override + public void func_149853_b(World w, Random r, int x, int y, int z) { + int meta = w.getBlockMetadata(x, y, z); + w.setBlockMetadataWithNotify(x, y, z, Math.min(growthStages, meta + 1), 3); + } + + protected boolean func_150109_e(World p_150109_1_, int p_150109_2_, int p_150109_3_, int p_150109_4_) { + if (!this.canPlaceBlockAt(p_150109_1_, p_150109_2_, p_150109_3_, p_150109_4_)) { + if (p_150109_1_.getBlock(p_150109_2_, p_150109_3_, p_150109_4_) == this) { + this.dropBlockAsItem( + p_150109_1_, + p_150109_2_, + p_150109_3_, + p_150109_4_, + p_150109_1_.getBlockMetadata(p_150109_2_, p_150109_3_, p_150109_4_), + 0); p_150109_1_.setBlockToAir(p_150109_2_, p_150109_3_, p_150109_4_); } return false; - } - else - { + } else { return true; } } @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - if(metadata >= this.growthStages - 1) - { - for(int i = 0; i < 8 + world.rand.nextInt(32); ++i) //Nerf for the shrooms - { - Aspect primal = Aspect.getPrimalAspects().get(world.rand.nextInt(Aspect.getPrimalAspects().size())); - EntityAspectOrb orb = new EntityAspectOrb(world, x, y, z, primal, 1); - if(!world.isRemote) - world.spawnEntityInWorld(orb); - } - } + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + if (metadata >= this.growthStages - 1) { + for (int i = 0; i < 8 + world.rand.nextInt(32); ++i) // Nerf for the shrooms + { + Aspect primal = Aspect.getPrimalAspects() + .get(world.rand.nextInt(Aspect.getPrimalAspects().size())); + EntityAspectOrb orb = new EntityAspectOrb(world, x, y, z, primal, 1); + if (!world.isRemote) world.spawnEntityInWorld(orb); + } + } return super.getDrops(world, x, y, z, metadata, fortune); } } diff --git a/src/main/java/tb/common/block/BlockAureliaLeaf.java b/src/main/java/tb/common/block/BlockAureliaLeaf.java index 17bb832..e9021c1 100644 --- a/src/main/java/tb/common/block/BlockAureliaLeaf.java +++ b/src/main/java/tb/common/block/BlockAureliaLeaf.java @@ -1,51 +1,43 @@ package tb.common.block; import java.util.Random; - -import tb.init.TBItems; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import tb.init.TBItems; -public class BlockAureliaLeaf extends Block{ +public class BlockAureliaLeaf extends Block { - public BlockAureliaLeaf() - { - super(Material.plants); - this.setBlockBounds(0.25F, 0, 0.25F, 0.75F, 0.25F, 0.75F); - this.setLightLevel(0.3F); - } - - public int damageDropped(int meta) - { - return 5; + public BlockAureliaLeaf() { + super(Material.plants); + this.setBlockBounds(0.25F, 0, 0.25F, 0.75F, 0.25F, 0.75F); + this.setLightLevel(0.3F); } - - public Item getItemDropped(int meta, Random rnd, int fort) - { - return TBItems.resource; + + public int damageDropped(int meta) { + return 5; } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { + + public Item getItemDropped(int meta, Random rnd, int fort) { + return TBItems.resource; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool( + World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - public int getRenderType() - { + public int getRenderType() { return 1; } - } diff --git a/src/main/java/tb/common/block/BlockAureliaPlant.java b/src/main/java/tb/common/block/BlockAureliaPlant.java index 10bd6c2..8f23f73 100644 --- a/src/main/java/tb/common/block/BlockAureliaPlant.java +++ b/src/main/java/tb/common/block/BlockAureliaPlant.java @@ -1,10 +1,8 @@ package tb.common.block; -import java.util.Random; - -import tb.init.TBBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; @@ -15,140 +13,121 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import tb.init.TBBlocks; -public class BlockAureliaPlant extends Block{ +public class BlockAureliaPlant extends Block { + + public BlockAureliaPlant() { + super(Material.plants); + this.setTickRandomly(true); + this.setBlockBounds(0.25F, 0, 0.25F, 0.75F, 0.85F, 0.75F); + this.setLightLevel(0.5F); + } + + public static IIcon[] icons = new IIcon[2]; - public BlockAureliaPlant() - { - super(Material.plants); - this.setTickRandomly(true); - this.setBlockBounds(0.25F, 0, 0.25F, 0.75F, 0.85F, 0.75F); - this.setLightLevel(0.5F); - } - - public static IIcon[] icons = new IIcon[2]; - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - icons[0] = reg.registerIcon(textureName+"closed"); - icons[1] = reg.registerIcon(textureName+"open"); + public void registerBlockIcons(IIconRegister reg) { + icons[0] = reg.registerIcon(textureName + "closed"); + icons[1] = reg.registerIcon(textureName + "open"); } - + @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return icons[meta]; + public IIcon getIcon(int side, int meta) { + return icons[meta]; } - - protected boolean canPlaceBlockOn(Block b) - { - return b != null && (b == Blocks.grass || b == Blocks.dirt || b instanceof BlockGrass || b instanceof BlockDirt); + + protected boolean canPlaceBlockOn(Block b) { + return b != null + && (b == Blocks.grass || b == Blocks.dirt || b instanceof BlockGrass || b instanceof BlockDirt); } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { - checkForMoonlight(w,x,y,z); - if(w.getBlockMetadata(x, y, z) == 1) - { - int rndX = x + rnd.nextInt(5) - rnd.nextInt(5); - int rndZ = z + rnd.nextInt(5) - rnd.nextInt(5); - //int rndY = findSutableGround(w,rndX,y+2,rndZ)+1; - //if(rndY > 2) - //w.setBlock(rndX, rndY, rndZ, TBBlocks.aureliaPetal,0,3); - - ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[2+w.rand.nextInt(4)]; - //int newX = x+dir.offsetX; - //int newZ = z+dir.offsetZ; - int newY = findSutableY(w,rndX,y,rndZ); - if(canPlaceBlockOn(w.getBlock(rndX, newY-1, rndZ)) && w.isAirBlock(rndX, newY, rndZ)) //fix for the Sweeds destroying blocks. Totally not copy-pasted code... - w.setBlock(rndX, newY, rndZ, TBBlocks.aureliaPetal, 0, 3); - } - } - - public int findSutableGround(World w, int x, int y, int z) - { - while(w.isAirBlock(x, y, z) && y > 0 && !w.isSideSolid(x, y, z, ForgeDirection.UP)) - --y; - - return y; - } - - public int findSutableY(World w, int x, int y, int z) - { - int bY = y; - y += 1; - while(!canPlaceBlockOn(w.getBlock(x, y, z)) && y > bY - 2) - --y; - - return y+1; + + public void updateTick(World w, int x, int y, int z, Random rnd) { + checkForMoonlight(w, x, y, z); + if (w.getBlockMetadata(x, y, z) == 1) { + int rndX = x + rnd.nextInt(5) - rnd.nextInt(5); + int rndZ = z + rnd.nextInt(5) - rnd.nextInt(5); + // int rndY = findSutableGround(w,rndX,y+2,rndZ)+1; + // if(rndY > 2) + // w.setBlock(rndX, rndY, rndZ, TBBlocks.aureliaPetal,0,3); + + ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[2 + w.rand.nextInt(4)]; + // int newX = x+dir.offsetX; + // int newZ = z+dir.offsetZ; + int newY = findSutableY(w, rndX, y, rndZ); + if (canPlaceBlockOn(w.getBlock(rndX, newY - 1, rndZ)) + && w.isAirBlock( + rndX, newY, rndZ)) // fix for the Sweeds destroying blocks. Totally not copy-pasted code... + w.setBlock(rndX, newY, rndZ, TBBlocks.aureliaPetal, 0, 3); + } } - - public int tickRate(World w) - { - return 10; + + public int findSutableGround(World w, int x, int y, int z) { + while (w.isAirBlock(x, y, z) && y > 0 && !w.isSideSolid(x, y, z, ForgeDirection.UP)) --y; + + return y; } - - public void onNeighborBlockChange(World w, int x, int y, int z, Block updated) - { - if(!canGrowOn(w,x,y-1,z)) - w.setBlockToAir(x, y, z); - else - checkForMoonlight(w,x,y,z); - - } - - public int damageDropped(int meta) - { - return 0; + + public int findSutableY(World w, int x, int y, int z) { + int bY = y; + y += 1; + while (!canPlaceBlockOn(w.getBlock(x, y, z)) && y > bY - 2) --y; + + return y + 1; } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { + + public int tickRate(World w) { + return 10; + } + + public void onNeighborBlockChange(World w, int x, int y, int z, Block updated) { + if (!canGrowOn(w, x, y - 1, z)) w.setBlockToAir(x, y, z); + else checkForMoonlight(w, x, y, z); + } + + public int damageDropped(int meta) { + return 0; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool( + World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - public int getRenderType() - { + public int getRenderType() { return 1; } - - public void checkForMoonlight(World w, int x, int y, int z) - { - boolean underSky = w.canBlockSeeTheSky(x, y+1, z); - boolean night = !w.isDaytime(); - boolean isFullMoon = w.provider.getMoonPhase(w.getWorldTime()) == 0; - boolean isOpen = w.getBlockMetadata(x, y, z) == 1; - - if(underSky && night && isFullMoon) - { - if(!isOpen) - { - w.setBlockMetadataWithNotify(x, y, z, 1, 3); - w.markBlockRangeForRenderUpdate(x-1, y-1, z-1, x+1, y+1, z+1); - } - }else - { - if(isOpen) - { - w.setBlockMetadataWithNotify(x, y, z, 0, 3); - w.markBlockRangeForRenderUpdate(x-1, y-1, z-1, x+1, y+1, z+1); - } - } - } - public static boolean canGrowOn(World w, int x, int y, int z) - { - return !w.isAirBlock(x, y, z) && (w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.grass) || w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.dirt)); - } + public void checkForMoonlight(World w, int x, int y, int z) { + boolean underSky = w.canBlockSeeTheSky(x, y + 1, z); + boolean night = !w.isDaytime(); + boolean isFullMoon = w.provider.getMoonPhase(w.getWorldTime()) == 0; + boolean isOpen = w.getBlockMetadata(x, y, z) == 1; + + if (underSky && night && isFullMoon) { + if (!isOpen) { + w.setBlockMetadataWithNotify(x, y, z, 1, 3); + w.markBlockRangeForRenderUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); + } + } else { + if (isOpen) { + w.setBlockMetadataWithNotify(x, y, z, 0, 3); + w.markBlockRangeForRenderUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); + } + } + } + + public static boolean canGrowOn(World w, int x, int y, int z) { + return !w.isAirBlock(x, y, z) + && (w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.grass) + || w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.dirt)); + } } diff --git a/src/main/java/tb/common/block/BlockBrazier.java b/src/main/java/tb/common/block/BlockBrazier.java index 84c8d46..d5ea744 100644 --- a/src/main/java/tb/common/block/BlockBrazier.java +++ b/src/main/java/tb/common/block/BlockBrazier.java @@ -1,10 +1,8 @@ package tb.common.block; +import DummyCore.Utils.MathUtils; import java.util.List; import java.util.Random; - -import tb.common.tile.TileBrazier; -import DummyCore.Utils.MathUtils; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -12,56 +10,70 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import tb.common.tile.TileBrazier; -public class BlockBrazier extends BlockContainer -{ +public class BlockBrazier extends BlockContainer { - public BlockBrazier() - { - super(Material.rock); - setHardness(1F); - setResistance(1F); - } + public BlockBrazier() { + super(Material.rock); + setHardness(1F); + setResistance(1F); + } - @Override - public TileEntity createNewTileEntity(World w, int meta) - { - return new TileBrazier(); - } - - public boolean isOpaqueCube() - { + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileBrazier(); + } + + public boolean isOpaqueCube() { return false; } - - public boolean renderAsNormalBlock() - { - return false; - } - - public int getRenderType() - { - return 0x1242fd; - } - public void randomDisplayTick(World w, int x, int y, int z, Random r) - { - TileEntity tile = w.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileBrazier && ((TileBrazier)tile).burning) - { - w.spawnParticle("flame", x+0.5D+MathUtils.randomDouble(r)/4, y+0.875D, z+0.5D+MathUtils.randomDouble(r)/4, 0, 0.04D, 0); - for(int i = 0; i < 10; ++i) - w.spawnParticle("smoke", x+0.5D+MathUtils.randomDouble(r)/4, y+1D, z+0.5D+MathUtils.randomDouble(r)/4, 0, r.nextDouble()/20, 0); - - w.playSound(x+0.5D, y+0.5D, z+0.5D, "thaumicbases:fire.loop", 0.1F, 0.1F, false); - } + public boolean renderAsNormalBlock() { + return false; } - - public void addCollisionBoxesToList(final World world, final int i, final int j, final int k, final AxisAlignedBB axisalignedbb, final List arraylist, final Entity par7Entity) { + + public int getRenderType() { + return 0x1242fd; + } + + public void randomDisplayTick(World w, int x, int y, int z, Random r) { + TileEntity tile = w.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileBrazier && ((TileBrazier) tile).burning) { + w.spawnParticle( + "flame", + x + 0.5D + MathUtils.randomDouble(r) / 4, + y + 0.875D, + z + 0.5D + MathUtils.randomDouble(r) / 4, + 0, + 0.04D, + 0); + for (int i = 0; i < 10; ++i) + w.spawnParticle( + "smoke", + x + 0.5D + MathUtils.randomDouble(r) / 4, + y + 1D, + z + 0.5D + MathUtils.randomDouble(r) / 4, + 0, + r.nextDouble() / 20, + 0); + + w.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "thaumicbases:fire.loop", 0.1F, 0.1F, false); + } + } + + public void addCollisionBoxesToList( + final World world, + final int i, + final int j, + final int k, + final AxisAlignedBB axisalignedbb, + final List arraylist, + final Entity par7Entity) { this.setBlockBounds(0.0625f, 0.0f, 0.0625f, 0.9375f, 1f, 0.9375f); super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); } - + public void setBlockBoundsBasedOnState(final IBlockAccess world, final int i, final int j, final int k) { this.setBlockBounds(0.0625f, 0.0f, 0.0625f, 0.9375f, 1f, 0.9375f); diff --git a/src/main/java/tb/common/block/BlockBriar.java b/src/main/java/tb/common/block/BlockBriar.java index c3ddeb3..27f9221 100644 --- a/src/main/java/tb/common/block/BlockBriar.java +++ b/src/main/java/tb/common/block/BlockBriar.java @@ -1,11 +1,9 @@ package tb.common.block; -import java.util.ArrayList; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import tb.init.TBItems; +import java.util.ArrayList; +import java.util.Random; import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; @@ -17,183 +15,152 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import tb.init.TBItems; -public class BlockBriar extends BlockBush implements IGrowable{ +public class BlockBriar extends BlockBush implements IGrowable { private IIcon[] doublePlantBottomIcons; private IIcon[] doublePlantTopIcons; public int growthStages; public int growthDelay; - - public BlockBriar(int stages, int g) - { + + public BlockBriar(int stages, int g) { super(Material.plants); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); growthStages = stages; growthDelay = g; } - - public int getRenderType() - { + + public int getRenderType() { return 6; } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { - super.updateTick(w, x, y, z, rnd); - - if(w.getBlock(x, y, z)==this) - { - int meta = w.getBlockMetadata(x, y, z); - if(isTopBlock(meta)) - { - if(meta-8 < growthStages-1 && w.rand.nextInt(growthDelay) == 0) - { - w.setBlockMetadataWithNotify(x, y, z, meta+1, 3); - w.setBlockMetadataWithNotify(x, y-1, z, meta-7, 3); - } - }else - { - if(meta < growthStages-1 && w.rand.nextInt(growthDelay) == 0) - { - w.setBlockMetadataWithNotify(x, y, z, meta+1, 3); - w.setBlockMetadataWithNotify(x, y+1, z, meta+9, 3); - } - } - } + + public void updateTick(World w, int x, int y, int z, Random rnd) { + super.updateTick(w, x, y, z, rnd); + + if (w.getBlock(x, y, z) == this) { + int meta = w.getBlockMetadata(x, y, z); + if (isTopBlock(meta)) { + if (meta - 8 < growthStages - 1 && w.rand.nextInt(growthDelay) == 0) { + w.setBlockMetadataWithNotify(x, y, z, meta + 1, 3); + w.setBlockMetadataWithNotify(x, y - 1, z, meta - 7, 3); + } + } else { + if (meta < growthStages - 1 && w.rand.nextInt(growthDelay) == 0) { + w.setBlockMetadataWithNotify(x, y, z, meta + 1, 3); + w.setBlockMetadataWithNotify(x, y + 1, z, meta + 9, 3); + } + } + } } - - public void setBlockBoundsBasedOnState(IBlockAccess w, int x, int y, int z) - { + + public void setBlockBoundsBasedOnState(IBlockAccess w, int x, int y, int z) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - - public boolean canPlaceBlockAt(World w, int x, int y, int z) - { + + public boolean canPlaceBlockAt(World w, int x, int y, int z) { return super.canPlaceBlockAt(w, x, y, z) && w.isAirBlock(x, y + 1, z); } - - protected void checkAndDropBlock(World w, int x, int y, int z) - { - int meta = w.getBlockMetadata(x, y, z); - if(isTopBlock(meta)) - { - if(w.getBlock(x, y-1, z) != this) - { - w.setBlockToAir(x, y, z); - this.dropBlockAsItem(w, x, y, z, meta, 0); - } - }else - { - if(w.getBlock(x, y+1, z) != this) - { - this.dropBlockAsItem(w, x, y, z, meta, 0); - w.setBlockToAir(x, y, z); - return; - } - if(!canBlockStay(w, x, y, z)) - { - this.dropBlockAsItem(w, x, y+1, z, meta, 0); - w.setBlockToAir(x, y+1, z); - this.dropBlockAsItem(w, x, y, z, meta, 0); - w.setBlockToAir(x, y, z); - } - } + + protected void checkAndDropBlock(World w, int x, int y, int z) { + int meta = w.getBlockMetadata(x, y, z); + if (isTopBlock(meta)) { + if (w.getBlock(x, y - 1, z) != this) { + w.setBlockToAir(x, y, z); + this.dropBlockAsItem(w, x, y, z, meta, 0); + } + } else { + if (w.getBlock(x, y + 1, z) != this) { + this.dropBlockAsItem(w, x, y, z, meta, 0); + w.setBlockToAir(x, y, z); + return; + } + if (!canBlockStay(w, x, y, z)) { + this.dropBlockAsItem(w, x, y + 1, z, meta, 0); + w.setBlockToAir(x, y + 1, z); + this.dropBlockAsItem(w, x, y, z, meta, 0); + w.setBlockToAir(x, y, z); + } + } } - + @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - ArrayList ret = new ArrayList(); - - if(!isTopBlock(metadata)) - { - ret.add(new ItemStack(this,1,0)); - return ret; - }else - { - metadata -= 8; - if(metadata >= this.growthStages - 1) - { - ret.add(new ItemStack(TBItems.resource,1+world.rand.nextInt(4),6)); - return ret; - }else - { - return ret; - } - } - + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList ret = new ArrayList(); + + if (!isTopBlock(metadata)) { + ret.add(new ItemStack(this, 1, 0)); + return ret; + } else { + metadata -= 8; + if (metadata >= this.growthStages - 1) { + ret.add(new ItemStack(TBItems.resource, 1 + world.rand.nextInt(4), 6)); + return ret; + } else { + return ret; + } + } } - - public boolean canBlockStay(World w, int x, int y, int z) - { - return !w.isAirBlock(x, y-1, z) && (w.getBlock(x, y-1, z).isReplaceableOreGen(w, x, y-1, z, Blocks.grass) || w.getBlock(x, y-1, z).isReplaceableOreGen(w, x, y, z, Blocks.dirt) || w.getBlock(x, y-1, z).canSustainPlant(w, x, y-1, z, ForgeDirection.UP, this)); + + public boolean canBlockStay(World w, int x, int y, int z) { + return !w.isAirBlock(x, y - 1, z) + && (w.getBlock(x, y - 1, z).isReplaceableOreGen(w, x, y - 1, z, Blocks.grass) + || w.getBlock(x, y - 1, z).isReplaceableOreGen(w, x, y, z, Blocks.dirt) + || w.getBlock(x, y - 1, z).canSustainPlant(w, x, y - 1, z, ForgeDirection.UP, this)); } - - public boolean isTopBlock(int meta) - { - return meta > 7; + + public boolean isTopBlock(int meta) { + return meta > 7; } - - public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase placer, ItemStack stack) - { - w.setBlock(x, y+1, z, this,8,3); + + public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase placer, ItemStack stack) { + w.setBlock(x, y + 1, z, this, 8, 3); } - + @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - doublePlantBottomIcons = new IIcon[growthStages]; - doublePlantTopIcons = new IIcon[growthStages]; - - for(int i = 0; i < growthStages; ++i) - { - doublePlantBottomIcons[i] = reg.registerIcon(textureName+"stage_"+i+"_bot"); - doublePlantTopIcons[i] = reg.registerIcon(textureName+"stage_"+i+"_top"); - } + public void registerBlockIcons(IIconRegister reg) { + doublePlantBottomIcons = new IIcon[growthStages]; + doublePlantTopIcons = new IIcon[growthStages]; + + for (int i = 0; i < growthStages; ++i) { + doublePlantBottomIcons[i] = reg.registerIcon(textureName + "stage_" + i + "_bot"); + doublePlantTopIcons[i] = reg.registerIcon(textureName + "stage_" + i + "_top"); + } } - + @Override - public IIcon getIcon(int side, int meta) - { - return isTopBlock(meta) ? doublePlantTopIcons[meta-8] : doublePlantBottomIcons[meta]; + public IIcon getIcon(int side, int meta) { + return isTopBlock(meta) ? doublePlantTopIcons[meta - 8] : doublePlantBottomIcons[meta]; } - - - //canApplyBonemeal - @Override - public boolean func_149851_a(World w, int x,int y, int z, boolean remote) { - return w.getBlockMetadata(x, y, z) % 8 < growthStages-1; - } - //canGrowPlant - @Override - public boolean func_149852_a(World w, Random r, int x, int y, int z) { - return w.getBlockLightValue(x, y + 1, z) >= 9; - } + // canApplyBonemeal + @Override + public boolean func_149851_a(World w, int x, int y, int z, boolean remote) { + return w.getBlockMetadata(x, y, z) % 8 < growthStages - 1; + } - //growPlant - @Override - public void func_149853_b(World w, Random r,int x, int y, int z) - { - if(w.getBlock(x, y, z)==this) - { - int meta = w.getBlockMetadata(x, y, z); - if(isTopBlock(meta)) - { - if(meta-8 < growthStages-1 && w.rand.nextInt(growthDelay) == 0) - { - w.setBlockMetadataWithNotify(x, y, z, meta+1, 3); - w.setBlockMetadataWithNotify(x, y-1, z, meta-7, 3); - } - }else - { - if(meta < growthStages-1 && w.rand.nextInt(growthDelay) == 0) - { - w.setBlockMetadataWithNotify(x, y, z, meta+1, 3); - w.setBlockMetadataWithNotify(x, y+1, z, meta+9, 3); - } - } - } - } + // canGrowPlant + @Override + public boolean func_149852_a(World w, Random r, int x, int y, int z) { + return w.getBlockLightValue(x, y + 1, z) >= 9; + } + + // growPlant + @Override + public void func_149853_b(World w, Random r, int x, int y, int z) { + if (w.getBlock(x, y, z) == this) { + int meta = w.getBlockMetadata(x, y, z); + if (isTopBlock(meta)) { + if (meta - 8 < growthStages - 1 && w.rand.nextInt(growthDelay) == 0) { + w.setBlockMetadataWithNotify(x, y, z, meta + 1, 3); + w.setBlockMetadataWithNotify(x, y - 1, z, meta - 7, 3); + } + } else { + if (meta < growthStages - 1 && w.rand.nextInt(growthDelay) == 0) { + w.setBlockMetadataWithNotify(x, y, z, meta + 1, 3); + w.setBlockMetadataWithNotify(x, y + 1, z, meta + 9, 3); + } + } + } + } } diff --git a/src/main/java/tb/common/block/BlockCampfire.java b/src/main/java/tb/common/block/BlockCampfire.java index d6df0b2..93910fc 100644 --- a/src/main/java/tb/common/block/BlockCampfire.java +++ b/src/main/java/tb/common/block/BlockCampfire.java @@ -1,10 +1,8 @@ package tb.common.block; +import DummyCore.Utils.MathUtils; import java.util.List; import java.util.Random; - -import tb.common.tile.TileCampfire; -import DummyCore.Utils.MathUtils; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -14,82 +12,92 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import tb.common.tile.TileCampfire; -public class BlockCampfire extends BlockContainer -{ +public class BlockCampfire extends BlockContainer { - public BlockCampfire() - { - super(Material.wood); - setHardness(1F); - setResistance(1F); - setStepSound(soundTypeWood); - } + public BlockCampfire() { + super(Material.wood); + setHardness(1F); + setResistance(1F); + setStepSound(soundTypeWood); + } - @Override - public TileEntity createNewTileEntity(World w, int meta) - { - return new TileCampfire(); - } - - public boolean isOpaqueCube() - { + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileCampfire(); + } + + public boolean isOpaqueCube() { return false; } - - public boolean renderAsNormalBlock() - { - return false; - } - - public int getRenderType() - { - return 0x1242fe; - } - public void randomDisplayTick(World w, int x, int y, int z, Random r) - { - if(w.getBlockMetadata(x, y, z) > 1) - { - w.spawnParticle("flame", x+0.5D+MathUtils.randomDouble(r)/4, y, z+0.5D+MathUtils.randomDouble(r)/4, 0, 0.04D, 0); - for(int i = 0; i < 10; ++i) - w.spawnParticle("smoke", x+0.5D+MathUtils.randomDouble(r)/4, y+0.1D, z+0.5D+MathUtils.randomDouble(r)/4, 0, r.nextDouble()/20, 0); - - w.playSound(x+0.5D, y+0.5D, z+0.5D, "thaumicbases:fire.loop", 0.1F, 0.1F, false); - } + public boolean renderAsNormalBlock() { + return false; } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) - { - if(w.isRemote) - return true; - - TileCampfire fire = (TileCampfire) w.getTileEntity(x, y, z); - ItemStack stk = p.getCurrentEquippedItem(); - boolean added = fire.addLog(stk); - if(!added) - added = fire.addFuel(stk); - - if(added) - { - p.inventory.decrStackSize(p.inventory.currentItem, 1); - if(p.openContainer != null) - p.openContainer.detectAndSendChanges(); - p.inventory.markDirty(); - return true; - } - - return false; + + public int getRenderType() { + return 0x1242fe; + } + + public void randomDisplayTick(World w, int x, int y, int z, Random r) { + if (w.getBlockMetadata(x, y, z) > 1) { + w.spawnParticle( + "flame", + x + 0.5D + MathUtils.randomDouble(r) / 4, + y, + z + 0.5D + MathUtils.randomDouble(r) / 4, + 0, + 0.04D, + 0); + for (int i = 0; i < 10; ++i) + w.spawnParticle( + "smoke", + x + 0.5D + MathUtils.randomDouble(r) / 4, + y + 0.1D, + z + 0.5D + MathUtils.randomDouble(r) / 4, + 0, + r.nextDouble() / 20, + 0); + + w.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "thaumicbases:fire.loop", 0.1F, 0.1F, false); + } + } + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { + if (w.isRemote) return true; + + TileCampfire fire = (TileCampfire) w.getTileEntity(x, y, z); + ItemStack stk = p.getCurrentEquippedItem(); + boolean added = fire.addLog(stk); + if (!added) added = fire.addFuel(stk); + + if (added) { + p.inventory.decrStackSize(p.inventory.currentItem, 1); + if (p.openContainer != null) p.openContainer.detectAndSendChanges(); + p.inventory.markDirty(); + return true; + } + + return false; + } + + public void addCollisionBoxesToList( + final World world, + final int i, + final int j, + final int k, + final AxisAlignedBB axisalignedbb, + final List arraylist, + final Entity par7Entity) { + this.setBlockBounds(0.0625f, 0.0f, 0.0625f, 0.9375f, 0.5f, 0.9375f); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + } + + public void setBlockBoundsBasedOnState(final IBlockAccess world, final int i, final int j, final int k) { + + this.setBlockBounds(0.0625f, 0.0f, 0.0625f, 0.9375f, 0.5f, 0.9375f); + super.setBlockBoundsBasedOnState(world, i, j, k); } - - public void addCollisionBoxesToList(final World world, final int i, final int j, final int k, final AxisAlignedBB axisalignedbb, final List arraylist, final Entity par7Entity) { - this.setBlockBounds(0.0625f, 0.0f, 0.0625f, 0.9375f, 0.5f, 0.9375f); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - } - - public void setBlockBoundsBasedOnState(final IBlockAccess world, final int i, final int j, final int k) { - - this.setBlockBounds(0.0625f, 0.0f, 0.0625f, 0.9375f, 0.5f, 0.9375f); - super.setBlockBoundsBasedOnState(world, i, j, k); - } } diff --git a/src/main/java/tb/common/block/BlockCryingObelisk.java b/src/main/java/tb/common/block/BlockCryingObelisk.java index 01ea054..eeedbbb 100644 --- a/src/main/java/tb/common/block/BlockCryingObelisk.java +++ b/src/main/java/tb/common/block/BlockCryingObelisk.java @@ -1,10 +1,9 @@ package tb.common.block; -import java.util.Random; - import DummyCore.Utils.MathUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockBed; import net.minecraft.block.material.Material; @@ -20,90 +19,101 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockCryingObelisk extends Block{ +public class BlockCryingObelisk extends Block { - public IIcon topbotIcon; - public IIcon genericIcon; - public IIcon topSide; - public IIcon botSide; - - public BlockCryingObelisk() - { - super(Material.rock); - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess w, int x, int y, int z, int side) - { - if(w.getBlock(x, y+1, z) == this && w.getBlock(x, y+2, z) != this && w.getBlock(x, y-1, z) != this) - return side == 0 || side == 1 ? topbotIcon : botSide; - - if(w.getBlock(x, y-1, z) == this && w.getBlock(x, y-2, z) != this && w.getBlock(x, y+1, z) != this) - return side == 0 || side == 1 ? topbotIcon : topSide; - - return genericIcon; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int metadata) - { - return genericIcon; + public IIcon topbotIcon; + public IIcon genericIcon; + public IIcon topSide; + public IIcon botSide; + + public BlockCryingObelisk() { + super(Material.rock); } @SideOnly(Side.CLIENT) - public void randomDisplayTick(World w, int x, int y, int z, Random rnd) - { - if((w.getBlock(x, y+1, z) == this && w.getBlock(x, y+2, z) != this && w.getBlock(x, y-1, z) != this) || (w.getBlock(x, y-1, z) == this && w.getBlock(x, y-2, z) != this && w.getBlock(x, y+1, z) != this)) - { - for(int i = 0; i < 10; ++i) - { - double rndY = rnd.nextDouble()*3; - w.spawnParticle("portal", x+0.5D+MathUtils.randomDouble(rnd), y-3+rndY, z+0.5D+MathUtils.randomDouble(rnd), 0, rndY, 0); - } - } + public IIcon getIcon(IBlockAccess w, int x, int y, int z, int side) { + if (w.getBlock(x, y + 1, z) == this && w.getBlock(x, y + 2, z) != this && w.getBlock(x, y - 1, z) != this) + return side == 0 || side == 1 ? topbotIcon : botSide; + + if (w.getBlock(x, y - 1, z) == this && w.getBlock(x, y - 2, z) != this && w.getBlock(x, y + 1, z) != this) + return side == 0 || side == 1 ? topbotIcon : topSide; + + return genericIcon; } - - public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) - { - return ((world.getBlock(x, y+1, z) == this && world.getBlock(x, y+2, z) != this && world.getBlock(x, y-1, z) != this) || (world.getBlock(x, y-1, z) == this && world.getBlock(x, y-2, z) != this && world.getBlock(x, y+1, z) != this)); + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + return genericIcon; } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) - { - if((w.getBlock(x, y+1, z) == this && w.getBlock(x, y+2, z) != this && w.getBlock(x, y-1, z) != this) || (w.getBlock(x, y-1, z) == this && w.getBlock(x, y-2, z) != this && w.getBlock(x, y+1, z) != this)) - { - w.playSound(x+0.5D, y+0.5D, z+0.5D, "portal.travel", 1, 2, false); - p.setSpawnChunk(new ChunkCoordinates(x,y,z), false,p.dimension); - if(p.worldObj.isRemote) - p.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.spawnSet")).setChatStyle(new ChatStyle().setItalic(true).setColor(EnumChatFormatting.AQUA))); - return true; - } - return false; + + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World w, int x, int y, int z, Random rnd) { + if ((w.getBlock(x, y + 1, z) == this && w.getBlock(x, y + 2, z) != this && w.getBlock(x, y - 1, z) != this) + || (w.getBlock(x, y - 1, z) == this + && w.getBlock(x, y - 2, z) != this + && w.getBlock(x, y + 1, z) != this)) { + for (int i = 0; i < 10; ++i) { + double rndY = rnd.nextDouble() * 3; + w.spawnParticle( + "portal", + x + 0.5D + MathUtils.randomDouble(rnd), + y - 3 + rndY, + z + 0.5D + MathUtils.randomDouble(rnd), + 0, + rndY, + 0); + } + } } - - public ChunkCoordinates getBedSpawnPosition(IBlockAccess world, int x, int y, int z, EntityPlayer player) - { - for(int dy = 0; dy > -3; --dy) - for(int dx = -2; dx <= 2; ++dx) - { - for(int dz = -2; dz <= 2; ++dz) - { - if (World.doesBlockHaveSolidTopSurface(world,x+dx, y+dy, z+dz) && !world.getBlock(x+dx, y+dy, z+dz).getMaterial().isOpaque() && !world.getBlock(x+dx, y+dy+1, z+dz).getMaterial().isOpaque()) - { - return new ChunkCoordinates(x+dx, y+dy+1,z+dz); + + public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) { + return ((world.getBlock(x, y + 1, z) == this + && world.getBlock(x, y + 2, z) != this + && world.getBlock(x, y - 1, z) != this) + || (world.getBlock(x, y - 1, z) == this + && world.getBlock(x, y - 2, z) != this + && world.getBlock(x, y + 1, z) != this)); + } + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { + if ((w.getBlock(x, y + 1, z) == this && w.getBlock(x, y + 2, z) != this && w.getBlock(x, y - 1, z) != this) + || (w.getBlock(x, y - 1, z) == this + && w.getBlock(x, y - 2, z) != this + && w.getBlock(x, y + 1, z) != this)) { + w.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "portal.travel", 1, 2, false); + p.setSpawnChunk(new ChunkCoordinates(x, y, z), false, p.dimension); + if (p.worldObj.isRemote) + p.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.spawnSet")) + .setChatStyle(new ChatStyle().setItalic(true).setColor(EnumChatFormatting.AQUA))); + return true; + } + return false; + } + + public ChunkCoordinates getBedSpawnPosition(IBlockAccess world, int x, int y, int z, EntityPlayer player) { + for (int dy = 0; dy > -3; --dy) + for (int dx = -2; dx <= 2; ++dx) { + for (int dz = -2; dz <= 2; ++dz) { + if (World.doesBlockHaveSolidTopSurface(world, x + dx, y + dy, z + dz) + && !world.getBlock(x + dx, y + dy, z + dz) + .getMaterial() + .isOpaque() + && !world.getBlock(x + dx, y + dy + 1, z + dz) + .getMaterial() + .isOpaque()) { + return new ChunkCoordinates(x + dx, y + dy + 1, z + dz); } - } - } - return BlockBed.func_149977_a((World) world, x, y, z, 0); - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - genericIcon = reg.registerIcon(this.getTextureName()+"cryingObsidian"); - topbotIcon = reg.registerIcon(this.getTextureName()+"cryingObelisk_TB"); - topSide = reg.registerIcon(this.getTextureName()+"cryingObelisk_sideT"); - botSide = reg.registerIcon(this.getTextureName()+"cryingObelisk_sideB"); + } + } + return BlockBed.func_149977_a((World) world, x, y, z, 0); } + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + genericIcon = reg.registerIcon(this.getTextureName() + "cryingObsidian"); + topbotIcon = reg.registerIcon(this.getTextureName() + "cryingObelisk_TB"); + topSide = reg.registerIcon(this.getTextureName() + "cryingObelisk_sideT"); + botSide = reg.registerIcon(this.getTextureName() + "cryingObelisk_sideB"); + } } diff --git a/src/main/java/tb/common/block/BlockCrystalBlock.java b/src/main/java/tb/common/block/BlockCrystalBlock.java index e935331..5ff4d11 100644 --- a/src/main/java/tb/common/block/BlockCrystalBlock.java +++ b/src/main/java/tb/common/block/BlockCrystalBlock.java @@ -1,11 +1,8 @@ package tb.common.block; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import thaumcraft.api.crafting.IInfusionStabiliser; -import thaumcraft.common.blocks.CustomStepSound; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -14,60 +11,44 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import thaumcraft.api.crafting.IInfusionStabiliser; +import thaumcraft.common.blocks.CustomStepSound; -public class BlockCrystalBlock extends Block implements IInfusionStabiliser{ - - public static IIcon[] icons = new IIcon[8]; - public static final String[] names = new String[]{ - "air", - "fire", - "water", - "earth", - "order", - "entropy", - "mixed", - "tainted" - }; - - public BlockCrystalBlock() - { - super(Material.glass); - setHardness(0.7F); - setResistance(1.0F); - setLightLevel(0.5F); - setStepSound(new CustomStepSound("crystal", 1.0F, 1.0F)); - } +public class BlockCrystalBlock extends Block implements IInfusionStabiliser { - @SuppressWarnings({ "unchecked", "rawtypes" }) - 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 registerBlockIcons(IIconRegister ir) - { - for(int i = 0; i < 8; ++i) - icons[i] = ir.registerIcon("thaumicbases:crystal/"+names[i]); - } - - public int damageDropped(int par1) - { - return par1; - } + public static IIcon[] icons = new IIcon[8]; + public static final String[] names = + new String[] {"air", "fire", "water", "earth", "order", "entropy", "mixed", "tainted"}; + + public BlockCrystalBlock() { + super(Material.glass); + setHardness(0.7F); + setResistance(1.0F); + setLightLevel(0.5F); + setStepSound(new CustomStepSound("crystal", 1.0F, 1.0F)); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + 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 registerBlockIcons(IIconRegister ir) { + for (int i = 0; i < 8; ++i) icons[i] = ir.registerIcon("thaumicbases:crystal/" + names[i]); + } + + public int damageDropped(int par1) { + return par1; + } + + @Override + public boolean canStabaliseInfusion(World world, int x, int y, int z) { + return true; + } - @Override - public boolean canStabaliseInfusion(World world, int x, int y, int z) - { - return true; - } - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - if(meta >= 8) - meta = 7; - return icons[meta]; + public IIcon getIcon(int side, int meta) { + if (meta >= 8) meta = 7; + return icons[meta]; } } diff --git a/src/main/java/tb/common/block/BlockCrystalSlab.java b/src/main/java/tb/common/block/BlockCrystalSlab.java index 29a8bc1..b92c815 100644 --- a/src/main/java/tb/common/block/BlockCrystalSlab.java +++ b/src/main/java/tb/common/block/BlockCrystalSlab.java @@ -1,13 +1,9 @@ package tb.common.block; -import java.util.List; -import java.util.Random; - -import tb.init.TBBlocks; -import thaumcraft.api.crafting.IInfusionStabiliser; -import thaumcraft.common.blocks.CustomStepSound; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -15,58 +11,53 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import tb.init.TBBlocks; +import thaumcraft.api.crafting.IInfusionStabiliser; +import thaumcraft.common.blocks.CustomStepSound; -public class BlockCrystalSlab extends BlockSlab implements IInfusionStabiliser{ +public class BlockCrystalSlab extends BlockSlab implements IInfusionStabiliser { - public BlockCrystalSlab(boolean fullBlock, Material material) - { - super(fullBlock, material); - setHardness(0.7F); - setResistance(1.0F); - setLightLevel(0.5F); - setStepSound(new CustomStepSound("crystal", 1.0F, 1.0F)); - } - - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { + public BlockCrystalSlab(boolean fullBlock, Material material) { + super(fullBlock, material); + setHardness(0.7F); + setResistance(1.0F); + setLightLevel(0.5F); + setStepSound(new CustomStepSound("crystal", 1.0F, 1.0F)); + } + + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(TBBlocks.crystalSlab); } - protected ItemStack createStackedBlock(int p_149644_1_) - { + protected ItemStack createStackedBlock(int p_149644_1_) { return new ItemStack(Item.getItemFromBlock(TBBlocks.crystalSlab), 2, p_149644_1_ & 7); } - + @SideOnly(Side.CLIENT) - public Item getItem(World w, int x, int y, int z) - { - return Item.getItemFromBlock(TBBlocks.crystalSlab); + public Item getItem(World w, int x, int y, int z) { + return Item.getItemFromBlock(TBBlocks.crystalSlab); + } + + @Override + public String func_150002_b(int meta) { + return super.getUnlocalizedName() + BlockCrystalBlock.names[meta & 7]; } - @Override - public String func_150002_b(int meta) { - return super.getUnlocalizedName()+BlockCrystalBlock.names[meta & 7]; - } - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return TBBlocks.crystalBlock.getIcon(side, meta & 7); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item itm, CreativeTabs tab, List lst) - { - for(int i = 0; i < 8; ++i) - { - lst.add(new ItemStack(itm,1,i)); - } + public IIcon getIcon(int side, int meta) { + return TBBlocks.crystalBlock.getIcon(side, meta & 7); } - @Override - public boolean canStabaliseInfusion(World world, int x, int y, int z) { - return true; - } + @SuppressWarnings({"unchecked", "rawtypes"}) + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item itm, CreativeTabs tab, List lst) { + for (int i = 0; i < 8; ++i) { + lst.add(new ItemStack(itm, 1, i)); + } + } + @Override + public boolean canStabaliseInfusion(World world, int x, int y, int z) { + return true; + } } diff --git a/src/main/java/tb/common/block/BlockEntityDeconstructor.java b/src/main/java/tb/common/block/BlockEntityDeconstructor.java index f14b7f6..06cfd1b 100644 --- a/src/main/java/tb/common/block/BlockEntityDeconstructor.java +++ b/src/main/java/tb/common/block/BlockEntityDeconstructor.java @@ -1,8 +1,5 @@ package tb.common.block; -import tb.common.itemblock.ItemBlockCrystal; -import tb.common.tile.TileEntityDeconstructor; -import thaumcraft.common.lib.research.ResearchManager; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -12,119 +9,100 @@ import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import tb.common.itemblock.ItemBlockCrystal; +import tb.common.tile.TileEntityDeconstructor; +import thaumcraft.common.lib.research.ResearchManager; -public class BlockEntityDeconstructor extends BlockContainer{ +public class BlockEntityDeconstructor extends BlockContainer { - public BlockEntityDeconstructor() - { - super(Material.rock); - float f = 0.1F; - this.setBlockBounds(0, 0, 0, 1, f, 1); - } + public BlockEntityDeconstructor() { + super(Material.rock); + float f = 0.1F; + this.setBlockBounds(0, 0, 0, 1, f, 1); + } - @Override - public TileEntity createNewTileEntity(World w, int meta) { - return new TileEntityDeconstructor(); - } - - public boolean isOpaqueCube() - { + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileEntityDeconstructor(); + } + + public boolean isOpaqueCube() { return false; } - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - - public int getRenderType() - { + + public int getRenderType() { return -1; } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) - { - if(p.getCurrentEquippedItem() != null) - { - if(p.getCurrentEquippedItem().getItem() instanceof ItemBlockCrystal) - { - if(ResearchManager.isResearchComplete(p.getCommandSenderName(), "TB.EntityDecAdv")) - if(p.getCurrentEquippedItem().getItemDamage() < 6) - { - TileEntityDeconstructor d = TileEntityDeconstructor.class.cast(w.getTileEntity(x, y, z)); - switch(p.getCurrentEquippedItem().getItemDamage()) - { - case 0: - { - if(!d.hasAir) - { - d.hasAir = true; - p.inventory.decrStackSize(p.inventory.currentItem, 1); - d.tickTime = 0; - } - break; - } - case 1: - { - if(!d.hasFire) - { - d.hasFire = true; - p.inventory.decrStackSize(p.inventory.currentItem, 1); - d.tickTime = 0; - } - break; - } - case 2: - { - if(!d.hasWater) - { - d.hasWater = true; - p.inventory.decrStackSize(p.inventory.currentItem, 1); - d.tickTime = 0; - } - break; - } - case 3: - { - if(!d.hasEarth) - { - d.hasEarth = true; - p.inventory.decrStackSize(p.inventory.currentItem, 1); - d.tickTime = 0; - } - break; - } - case 4: - { - if(!d.hasOrdo) - { - d.hasOrdo = true; - p.inventory.decrStackSize(p.inventory.currentItem, 1); - d.tickTime = 0; - } - break; - } - case 5: - { - if(!d.hasEntropy) - { - d.hasEntropy = true; - p.inventory.decrStackSize(p.inventory.currentItem, 1); - d.tickTime = 0; - } - break; - } - } - } - } - } - if(p.worldObj.isRemote) - p.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkEntDecon")).setChatStyle(new ChatStyle().setItalic(true).setColor(EnumChatFormatting.AQUA))); - - TileEntityDeconstructor.class.cast(w.getTileEntity(x, y, z)).placerName = p.getCommandSenderName(); - return true; - - - } + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { + if (p.getCurrentEquippedItem() != null) { + if (p.getCurrentEquippedItem().getItem() instanceof ItemBlockCrystal) { + if (ResearchManager.isResearchComplete(p.getCommandSenderName(), "TB.EntityDecAdv")) + if (p.getCurrentEquippedItem().getItemDamage() < 6) { + TileEntityDeconstructor d = TileEntityDeconstructor.class.cast(w.getTileEntity(x, y, z)); + switch (p.getCurrentEquippedItem().getItemDamage()) { + case 0: { + if (!d.hasAir) { + d.hasAir = true; + p.inventory.decrStackSize(p.inventory.currentItem, 1); + d.tickTime = 0; + } + break; + } + case 1: { + if (!d.hasFire) { + d.hasFire = true; + p.inventory.decrStackSize(p.inventory.currentItem, 1); + d.tickTime = 0; + } + break; + } + case 2: { + if (!d.hasWater) { + d.hasWater = true; + p.inventory.decrStackSize(p.inventory.currentItem, 1); + d.tickTime = 0; + } + break; + } + case 3: { + if (!d.hasEarth) { + d.hasEarth = true; + p.inventory.decrStackSize(p.inventory.currentItem, 1); + d.tickTime = 0; + } + break; + } + case 4: { + if (!d.hasOrdo) { + d.hasOrdo = true; + p.inventory.decrStackSize(p.inventory.currentItem, 1); + d.tickTime = 0; + } + break; + } + case 5: { + if (!d.hasEntropy) { + d.hasEntropy = true; + p.inventory.decrStackSize(p.inventory.currentItem, 1); + d.tickTime = 0; + } + break; + } + } + } + } + } + if (p.worldObj.isRemote) + p.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkEntDecon")) + .setChatStyle(new ChatStyle().setItalic(true).setColor(EnumChatFormatting.AQUA))); + + TileEntityDeconstructor.class.cast(w.getTileEntity(x, y, z)).placerName = p.getCommandSenderName(); + return true; + } } diff --git a/src/main/java/tb/common/block/BlockFlaxium.java b/src/main/java/tb/common/block/BlockFlaxium.java index 2a76232..9aba284 100644 --- a/src/main/java/tb/common/block/BlockFlaxium.java +++ b/src/main/java/tb/common/block/BlockFlaxium.java @@ -1,61 +1,52 @@ package tb.common.block; import java.util.Random; - -import thaumcraft.common.config.ConfigBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import thaumcraft.common.config.ConfigBlocks; -public class BlockFlaxium extends BlockBush{ +public class BlockFlaxium extends BlockBush { - public BlockFlaxium() { - super(Material.plants); - this.setTickRandomly(true); - this.setBlockBounds(0.25F, 0, 0.25F, 0.75F, 0.85F, 0.75F); - } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { - if(w.isAirBlock(x, y+1, z)) - w.setBlock(x, y+1, z, ConfigBlocks.blockFluxGas, 0, 3); - - if(!canGrowOn(w,x,y-1,z)) - w.setBlockToAir(x, y, z); - } - - public void onNeighborBlockChange(World w, int x, int y, int z, Block updated) - { - if(!canGrowOn(w,x,y-1,z)) - w.setBlockToAir(x, y, z); - } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { + public BlockFlaxium() { + super(Material.plants); + this.setTickRandomly(true); + this.setBlockBounds(0.25F, 0, 0.25F, 0.75F, 0.85F, 0.75F); + } + + public void updateTick(World w, int x, int y, int z, Random rnd) { + if (w.isAirBlock(x, y + 1, z)) w.setBlock(x, y + 1, z, ConfigBlocks.blockFluxGas, 0, 3); + + if (!canGrowOn(w, x, y - 1, z)) w.setBlockToAir(x, y, z); + } + + public void onNeighborBlockChange(World w, int x, int y, int z, Block updated) { + if (!canGrowOn(w, x, y - 1, z)) w.setBlockToAir(x, y, z); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool( + World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - public int getRenderType() - { + public int getRenderType() { return 1; } - - public static boolean canGrowOn(World w, int x, int y, int z) - { - return !w.isAirBlock(x, y, z) && (w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.grass) || w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.dirt)); - } + public static boolean canGrowOn(World w, int x, int y, int z) { + return !w.isAirBlock(x, y, z) + && (w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.grass) + || w.getBlock(x, y, z).isReplaceableOreGen(w, x, y, z, Blocks.dirt)); + } } diff --git a/src/main/java/tb/common/block/BlockHalfSlab.java b/src/main/java/tb/common/block/BlockHalfSlab.java index 090daa8..d8c0b07 100644 --- a/src/main/java/tb/common/block/BlockHalfSlab.java +++ b/src/main/java/tb/common/block/BlockHalfSlab.java @@ -1,12 +1,9 @@ package tb.common.block; -import java.util.List; -import java.util.Random; - -import tb.init.TBBlocks; -import thaumcraft.api.crafting.IInfusionStabiliser; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; @@ -15,65 +12,61 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import tb.init.TBBlocks; +import thaumcraft.api.crafting.IInfusionStabiliser; -public class BlockHalfSlab extends BlockSlab implements IInfusionStabiliser{ - - public static Block[] parents = new Block[]{ - TBBlocks.eldritchArk, - TBBlocks.oldBrick, - TBBlocks.oldCobble, - TBBlocks.oldCobbleMossy, - TBBlocks.oldDiamond, - TBBlocks.oldGold, - TBBlocks.oldIron, - TBBlocks.oldLapis - }; +public class BlockHalfSlab extends BlockSlab implements IInfusionStabiliser { - public BlockHalfSlab(boolean fullBlock, Material material) - { - super(fullBlock, material); - } - - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { + public static Block[] parents = new Block[] { + TBBlocks.eldritchArk, + TBBlocks.oldBrick, + TBBlocks.oldCobble, + TBBlocks.oldCobbleMossy, + TBBlocks.oldDiamond, + TBBlocks.oldGold, + TBBlocks.oldIron, + TBBlocks.oldLapis + }; + + public BlockHalfSlab(boolean fullBlock, Material material) { + super(fullBlock, material); + } + + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(TBBlocks.genericSlab); } - protected ItemStack createStackedBlock(int p_149644_1_) - { + protected ItemStack createStackedBlock(int p_149644_1_) { return new ItemStack(Item.getItemFromBlock(TBBlocks.genericSlab), 2, p_149644_1_ & 7); } - + @SideOnly(Side.CLIENT) - public Item getItem(World w, int x, int y, int z) - { - return Item.getItemFromBlock(TBBlocks.genericSlab); + public Item getItem(World w, int x, int y, int z) { + return Item.getItemFromBlock(TBBlocks.genericSlab); } - @Override - public String func_150002_b(int meta) { - return super.getUnlocalizedName()+parents[meta].getUnlocalizedName(); - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return parents[meta & 7].getIcon(side, 0); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item itm, CreativeTabs tab, List lst) - { - for(int i = 0; i < parents.length; ++i) - { - lst.add(new ItemStack(itm,1,i)); - } + @Override + public String func_150002_b(int meta) { + return super.getUnlocalizedName() + parents[meta].getUnlocalizedName(); } - @Override - public boolean canStabaliseInfusion(World world, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z) & 7; - return parents[meta] instanceof IInfusionStabiliser && ((IInfusionStabiliser) parents[meta]).canStabaliseInfusion(world, x, y, z); - } + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return parents[meta & 7].getIcon(side, 0); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item itm, CreativeTabs tab, List lst) { + for (int i = 0; i < parents.length; ++i) { + lst.add(new ItemStack(itm, 1, i)); + } + } + + @Override + public boolean canStabaliseInfusion(World world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z) & 7; + return parents[meta] instanceof IInfusionStabiliser + && ((IInfusionStabiliser) parents[meta]).canStabaliseInfusion(world, x, y, z); + } } diff --git a/src/main/java/tb/common/block/BlockKnose.java b/src/main/java/tb/common/block/BlockKnose.java index bcf4058..9478c7e 100644 --- a/src/main/java/tb/common/block/BlockKnose.java +++ b/src/main/java/tb/common/block/BlockKnose.java @@ -1,50 +1,41 @@ package tb.common.block; import java.util.ArrayList; - -import tb.init.TBBlocks; -import tb.init.TBItems; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import tb.init.TBBlocks; +import tb.init.TBItems; public class BlockKnose extends BlockTBPlant { - public BlockKnose(int stages, int delay, boolean isCrop) { - super(stages, delay, isCrop); - } - - public boolean canBlockStay(World w, int x, int y, int z) - { - return !w.isAirBlock(x, y-1, z) && canPlaceBlockOn(w.getBlock(x, y-1, z)); + public BlockKnose(int stages, int delay, boolean isCrop) { + super(stages, delay, isCrop); } - protected boolean canPlaceBlockOn(Block b) - { - return b == TBBlocks.crystalBlock; + public boolean canBlockStay(World w, int x, int y, int z) { + return !w.isAirBlock(x, y - 1, z) && canPlaceBlockOn(w.getBlock(x, y - 1, z)); } - + + protected boolean canPlaceBlockOn(Block b) { + return b == TBBlocks.crystalBlock; + } + @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - ArrayList ret = new ArrayList(); - - if (metadata >= growthStages-1) - { - if(dropSeed != null) - ret.add(dropSeed.copy()); - Block b = world.getBlock(x, y-1, z); - if(b == TBBlocks.crystalBlock) - { - int md = world.getBlockMetadata(x, y-1, z); - ret.add(new ItemStack(TBItems.knoseFragment,1,md)); - } - }else - { - if(dropSeed != null) - ret.add(dropSeed.copy()); - } - - return ret; + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList ret = new ArrayList(); + + if (metadata >= growthStages - 1) { + if (dropSeed != null) ret.add(dropSeed.copy()); + Block b = world.getBlock(x, y - 1, z); + if (b == TBBlocks.crystalBlock) { + int md = world.getBlockMetadata(x, y - 1, z); + ret.add(new ItemStack(TBItems.knoseFragment, 1, md)); + } + } else { + if (dropSeed != null) ret.add(dropSeed.copy()); + } + + return ret; } } diff --git a/src/main/java/tb/common/block/BlockLucritePlant.java b/src/main/java/tb/common/block/BlockLucritePlant.java index 50191fc..b60fda1 100644 --- a/src/main/java/tb/common/block/BlockLucritePlant.java +++ b/src/main/java/tb/common/block/BlockLucritePlant.java @@ -2,45 +2,39 @@ package tb.common.block; import java.util.ArrayList; import java.util.Random; - -import tb.init.TBBlocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import tb.init.TBBlocks; public class BlockLucritePlant extends BlockTBPlant { - public BlockLucritePlant(int stages, int delay, boolean isCrop) { - super(stages, delay, isCrop); - } - - //growPlant - @Override - public void func_149853_b(World w, Random r,int x, int y, int z) - { - int meta = w.getBlockMetadata(x, y, z); - w.setBlockMetadataWithNotify(x, y, z, Math.min(growthStages,meta+1), 3); - } - - @Override - public boolean canBlockStay(World w, int x, int y, int z) - { - return super.canBlockStay(w, x, y, z) && w.getBlock(x, y-2, z) == TBBlocks.dustBlock; + public BlockLucritePlant(int stages, int delay, boolean isCrop) { + super(stages, delay, isCrop); } - + + // growPlant @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { + public void func_149853_b(World w, Random r, int x, int y, int z) { + int meta = w.getBlockMetadata(x, y, z); + w.setBlockMetadataWithNotify(x, y, z, Math.min(growthStages, meta + 1), 3); + } + + @Override + public boolean canBlockStay(World w, int x, int y, int z) { + return super.canBlockStay(w, x, y, z) && w.getBlock(x, y - 2, z) == TBBlocks.dustBlock; + } + + @Override + 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 >= growthStages-1) - { - if (world.rand.nextInt(16) == 0) - { - ret.add(new ItemStack(Items.golden_carrot,1,0)); + if (metadata >= growthStages - 1) { + if (world.rand.nextInt(16) == 0) { + ret.add(new ItemStack(Items.golden_carrot, 1, 0)); } } - + return ret; } } diff --git a/src/main/java/tb/common/block/BlockNodeLinker.java b/src/main/java/tb/common/block/BlockNodeLinker.java index b9174d3..c6d3a1f 100644 --- a/src/main/java/tb/common/block/BlockNodeLinker.java +++ b/src/main/java/tb/common/block/BlockNodeLinker.java @@ -1,36 +1,31 @@ package tb.common.block; -import tb.common.tile.TileNodeLinker; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import tb.common.tile.TileNodeLinker; -public class BlockNodeLinker extends BlockContainer{ +public class BlockNodeLinker extends BlockContainer { - public BlockNodeLinker() - { - super(Material.rock); - } + public BlockNodeLinker() { + super(Material.rock); + } - @Override - public TileEntity createNewTileEntity(World w, int meta) { - return new TileNodeLinker(); - } - - public boolean isOpaqueCube() - { + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileNodeLinker(); + } + + public boolean isOpaqueCube() { return false; } - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - - public int getRenderType() - { + + public int getRenderType() { return 0x421922; } - } diff --git a/src/main/java/tb/common/block/BlockNodeManipulator.java b/src/main/java/tb/common/block/BlockNodeManipulator.java index c4c06c6..bbc75e8 100644 --- a/src/main/java/tb/common/block/BlockNodeManipulator.java +++ b/src/main/java/tb/common/block/BlockNodeManipulator.java @@ -1,8 +1,5 @@ package tb.common.block; -import tb.common.item.ItemNodeFoci; -import tb.common.tile.TileNodeManipulator; -import tb.init.TBItems; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -11,80 +8,69 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import tb.common.item.ItemNodeFoci; +import tb.common.tile.TileNodeManipulator; +import tb.init.TBItems; -public class BlockNodeManipulator extends BlockContainer{ +public class BlockNodeManipulator extends BlockContainer { - public BlockNodeManipulator() - { - super(Material.rock); - } + public BlockNodeManipulator() { + super(Material.rock); + } - @Override - public TileEntity createNewTileEntity(World w, int meta) { - return new TileNodeManipulator(); - } - - public boolean isOpaqueCube() - { + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileNodeManipulator(); + } + + public boolean isOpaqueCube() { return false; } - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - - public int getRenderType() - { + + public int getRenderType() { return 0x421922; } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) - { - if(p.getCurrentEquippedItem() != null) - { - ItemStack current = p.getCurrentEquippedItem(); - if(current.getItem() instanceof ItemNodeFoci) - { - if(w.getBlockMetadata(x, y, z) != 0) - { - int meta = w.getBlockMetadata(x, y, z); - ItemStack stk = new ItemStack(TBItems.nodeFoci,1,meta-1); - EntityItem itm = new EntityItem(w,x+0.5D,y,z+0.5D,stk); - if(!w.isRemote) - w.spawnEntityInWorld(itm); - } - w.setBlockMetadataWithNotify(x, y, z, current.getItemDamage()+1, 3); - p.destroyCurrentEquippedItem(); - - return true; - } - }else - { - if(w.getBlockMetadata(x, y, z) != 0) - { - int meta = w.getBlockMetadata(x, y, z); - ItemStack stk = new ItemStack(TBItems.nodeFoci,1,meta-1); - EntityItem itm = new EntityItem(w,x+0.5D,y,z+0.5D,stk); - if(!w.isRemote) - w.spawnEntityInWorld(itm); - } - w.setBlockMetadataWithNotify(x, y, z, 0, 3); - } - return true; - } - - @Override - public void breakBlock(World w, int x, int y, int z, Block b, int meta) - { - if(meta > 0) //Fix for the manipulator not dropping the foci. - { - ItemStack foci = new ItemStack(TBItems.nodeFoci,1,meta-1); - EntityItem itm = new EntityItem(w,x+0.5D,y+0.5D,z+0.5D,foci); - if(!w.isRemote) - w.spawnEntityInWorld(itm); - } - super.breakBlock(w, x, y, z, b, meta); + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { + if (p.getCurrentEquippedItem() != null) { + ItemStack current = p.getCurrentEquippedItem(); + if (current.getItem() instanceof ItemNodeFoci) { + if (w.getBlockMetadata(x, y, z) != 0) { + int meta = w.getBlockMetadata(x, y, z); + ItemStack stk = new ItemStack(TBItems.nodeFoci, 1, meta - 1); + EntityItem itm = new EntityItem(w, x + 0.5D, y, z + 0.5D, stk); + if (!w.isRemote) w.spawnEntityInWorld(itm); + } + w.setBlockMetadataWithNotify(x, y, z, current.getItemDamage() + 1, 3); + p.destroyCurrentEquippedItem(); + + return true; + } + } else { + if (w.getBlockMetadata(x, y, z) != 0) { + int meta = w.getBlockMetadata(x, y, z); + ItemStack stk = new ItemStack(TBItems.nodeFoci, 1, meta - 1); + EntityItem itm = new EntityItem(w, x + 0.5D, y, z + 0.5D, stk); + if (!w.isRemote) w.spawnEntityInWorld(itm); + } + w.setBlockMetadataWithNotify(x, y, z, 0, 3); + } + return true; } + @Override + public void breakBlock(World w, int x, int y, int z, Block b, int meta) { + if (meta > 0) // Fix for the manipulator not dropping the foci. + { + ItemStack foci = new ItemStack(TBItems.nodeFoci, 1, meta - 1); + EntityItem itm = new EntityItem(w, x + 0.5D, y + 0.5D, z + 0.5D, foci); + if (!w.isRemote) w.spawnEntityInWorld(itm); + } + super.breakBlock(w, x, y, z, b, meta); + } } diff --git a/src/main/java/tb/common/block/BlockOverchanter.java b/src/main/java/tb/common/block/BlockOverchanter.java index 868fe8d..1ac3e31 100644 --- a/src/main/java/tb/common/block/BlockOverchanter.java +++ b/src/main/java/tb/common/block/BlockOverchanter.java @@ -1,8 +1,6 @@ package tb.common.block; import DummyCore.Utils.MiscUtils; -import tb.common.tile.TileOverchanter; -import tb.core.TBCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -13,68 +11,61 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import tb.common.tile.TileOverchanter; +import tb.core.TBCore; -public class BlockOverchanter extends BlockContainer{ - - public IIcon topIcon; - public IIcon botIcon; - public IIcon sideIcon; +public class BlockOverchanter extends BlockContainer { - public BlockOverchanter() - { - super(Material.rock); - this.setHarvestLevel("pickaxe", 3); + public IIcon topIcon; + public IIcon botIcon; + public IIcon sideIcon; + + public BlockOverchanter() { + super(Material.rock); + this.setHarvestLevel("pickaxe", 3); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); this.setLightOpacity(0); - } - - public boolean renderAsNormalBlock() - { - return false; - } - - public boolean isOpaqueCube() - { - return false; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 0 ? botIcon : side == 1 ? topIcon : sideIcon; - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - topIcon = reg.registerIcon("thaumicbases:overchanter/top"); - botIcon = reg.registerIcon("thaumicbases:overchanter/bottom"); - sideIcon = reg.registerIcon("thaumicbases:overchanter/side"); } - @Override - public TileEntity createNewTileEntity(World w, int meta) { - return new TileOverchanter(); - } - - public void breakBlock(World w, int x, int y, int z, Block b, int meta) - { - MiscUtils.dropItemsOnBlockBreak(w, x, y, z, b, meta); - } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) - { - if(!p.isSneaking()) - { - if(!w.isRemote) - { - p.openGui(TBCore.instance, 0x421922, w, x, y, z); - return true; - }else - { - return true; - } - } - return false; + public boolean renderAsNormalBlock() { + return false; + } + + public boolean isOpaqueCube() { + return false; + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 0 ? botIcon : side == 1 ? topIcon : sideIcon; + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + topIcon = reg.registerIcon("thaumicbases:overchanter/top"); + botIcon = reg.registerIcon("thaumicbases:overchanter/bottom"); + sideIcon = reg.registerIcon("thaumicbases:overchanter/side"); + } + + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileOverchanter(); + } + + public void breakBlock(World w, int x, int y, int z, Block b, int meta) { + MiscUtils.dropItemsOnBlockBreak(w, x, y, z, b, meta); + } + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { + if (!p.isSneaking()) { + if (!w.isRemote) { + p.openGui(TBCore.instance, 0x421922, w, x, y, z); + return true; + } else { + return true; + } + } + return false; } } diff --git a/src/main/java/tb/common/block/BlockPyrofluid.java b/src/main/java/tb/common/block/BlockPyrofluid.java index 84adc81..c97ea93 100644 --- a/src/main/java/tb/common/block/BlockPyrofluid.java +++ b/src/main/java/tb/common/block/BlockPyrofluid.java @@ -1,12 +1,10 @@ package tb.common.block; +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 tb.utils.TBConfig; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,138 +16,140 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import tb.utils.TBConfig; -public class BlockPyrofluid extends Block{ - - public static IIcon fluidIcon; - public static IIcon staticIcon; +public class BlockPyrofluid extends Block { - public BlockPyrofluid() - { - super(Material.lava); + public static IIcon fluidIcon; + public static IIcon staticIcon; + + public BlockPyrofluid() { + super(Material.lava); float f = 0.0F; float f1 = 0.0F; this.setBlockBounds(0.0F + f1, 0.0F + f, 0.0F + f1, 1.0F + f1, 1.0F + f, 1.0F + f1); this.setTickRandomly(true); - } - - public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { - return false; } - public boolean renderAsNormalBlock() - { + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return false; } - public boolean isOpaqueCube() - { + public boolean renderAsNormalBlock() { return false; } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) - { + + public boolean isOpaqueCube() { + return false; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return null; } - public int getRenderType() - { + public int getRenderType() { return 4; } - - public int idDropped(int par1, Random par2Random, int par3) - { + + public int idDropped(int par1, Random par2Random, int par3) { return 0; } - public int quantityDropped(Random par1Random) - { + public int quantityDropped(Random par1Random) { return 0; } - - public int tickRate(World par1World) - { + + public int tickRate(World par1World) { return 5; } - - public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) - { + + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { double d5; double d6; double d7; - d5 = (double)((float)par2 + par5Random.nextFloat()); - d7 = (double)par3-0.5D + this.maxY; - d6 = (double)((float)par4 + par5Random.nextFloat()); - if (this.blockMaterial == Material.lava && par1World.getBlock(par2, par3 + 1, par4).getMaterial() == Material.air && !par1World.getBlock(par2, par3 + 1, par4).isOpaqueCube()) - { - if (par5Random.nextInt(100) == 0) - { - d5 = (double)((float)par2 + par5Random.nextFloat()); - d7 = (double)par3 + this.maxY; - d6 = (double)((float)par4 + par5Random.nextFloat()); + d5 = (double) ((float) par2 + par5Random.nextFloat()); + d7 = (double) par3 - 0.5D + this.maxY; + d6 = (double) ((float) par4 + par5Random.nextFloat()); + if (this.blockMaterial == Material.lava + && par1World.getBlock(par2, par3 + 1, par4).getMaterial() == Material.air + && !par1World.getBlock(par2, par3 + 1, par4).isOpaqueCube()) { + if (par5Random.nextInt(100) == 0) { + d5 = (double) ((float) par2 + par5Random.nextFloat()); + d7 = (double) par3 + this.maxY; + d6 = (double) ((float) par4 + par5Random.nextFloat()); par1World.spawnParticle("lava", d5, d7, d6, 0.0D, 0.0D, 0.0D); - par1World.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + par5Random.nextFloat() * 0.2F, 0.9F + par5Random.nextFloat() * 0.15F, false); + par1World.playSound( + d5, + d7, + d6, + "liquid.lavapop", + 0.2F + par5Random.nextFloat() * 0.2F, + 0.9F + par5Random.nextFloat() * 0.15F, + false); } - if (par5Random.nextInt(200) == 0) - { - par1World.playSound((double)par2, (double)par3, (double)par4, "liquid.lava", 0.2F + par5Random.nextFloat() * 0.2F, 0.9F + par5Random.nextFloat() * 0.15F, false); + if (par5Random.nextInt(200) == 0) { + par1World.playSound( + (double) par2, + (double) par3, + (double) par4, + "liquid.lava", + 0.2F + par5Random.nextFloat() * 0.2F, + 0.9F + par5Random.nextFloat() * 0.15F, + false); } } - if (par5Random.nextInt(10) == 0 && World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) && !par1World.getBlock(par2, par3 - 2, par4).getBlocksMovement(par1World, par2, par3, par4)) - { + if (par5Random.nextInt(10) == 0 + && World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) + && !par1World.getBlock(par2, par3 - 2, par4).getBlocksMovement(par1World, par2, par3, par4)) { par1World.spawnParticle("dripLava", d5, d7, d6, 0.0D, 0.0D, 0.0D); } } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { - int meta = w.getBlockMetadata(x, y, z) + 1; - if(meta > 15) - return; - - if(meta >= 8) - meta = 15; - - w.setBlockMetadataWithNotify(x, y, z, meta, 3); + + public void updateTick(World w, int x, int y, int z, Random rnd) { + int meta = w.getBlockMetadata(x, y, z) + 1; + if (meta > 15) return; + + if (meta >= 8) meta = 15; + + w.setBlockMetadataWithNotify(x, y, z, meta, 3); } - - public void registerBlockIcons(IIconRegister ir) - { - fluidIcon = ir.registerIcon("thaumicbases:blazingFluid/block"); - staticIcon = ir.registerIcon("thaumicbases:blazingFluid/leftovers"); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - /*for(int i = 0; i < 8; ++i) - par3List.add(new ItemStack(par1,1,i));*/ - - par3List.add(new ItemStack(par1,1,0)); - - //par3List.add(new ItemStack(par1,1,15)); - } - + + public void registerBlockIcons(IIconRegister ir) { + fluidIcon = ir.registerIcon("thaumicbases:blazingFluid/block"); + staticIcon = ir.registerIcon("thaumicbases:blazingFluid/leftovers"); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + /*for(int i = 0; i < 8; ++i) + par3List.add(new ItemStack(par1,1,i));*/ + + par3List.add(new ItemStack(par1, 1, 0)); + + // par3List.add(new ItemStack(par1,1,15)); + } + @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return meta == 15 ? staticIcon : fluidIcon; + public IIcon getIcon(int side, int meta) { + return meta == 15 ? staticIcon : fluidIcon; } - - public float getBlockHardness(World w, int x, int y, int z) - { - return w.getBlockMetadata(x, y, z) == 15 ? 5 : -1; + + public float getBlockHardness(World w, int x, int y, int z) { + return w.getBlockMetadata(x, y, z) == 15 ? 5 : -1; } - - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - ArrayList retLst = new ArrayList(); - - retLst.add(new ItemStack(Items.blaze_powder,TBConfig.minBlazePowderFromPyrofluid+world.rand.nextInt(TBConfig.maxBlazePowderFromPyrofluid-TBConfig.minBlazePowderFromPyrofluid),0)); - - return retLst; + + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList retLst = new ArrayList(); + + retLst.add(new ItemStack( + Items.blaze_powder, + TBConfig.minBlazePowderFromPyrofluid + + world.rand.nextInt( + TBConfig.maxBlazePowderFromPyrofluid - TBConfig.minBlazePowderFromPyrofluid), + 0)); + + return retLst; } } diff --git a/src/main/java/tb/common/block/BlockRainbowCactus.java b/src/main/java/tb/common/block/BlockRainbowCactus.java index 65f61b9..60075a2 100644 --- a/src/main/java/tb/common/block/BlockRainbowCactus.java +++ b/src/main/java/tb/common/block/BlockRainbowCactus.java @@ -1,9 +1,8 @@ package tb.common.block; -import java.util.ArrayList; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.block.BlockCactus; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,62 +19,55 @@ public class BlockRainbowCactus extends BlockCactus { @SideOnly(Side.CLIENT) private IIcon field_150041_a; + @SideOnly(Side.CLIENT) private IIcon field_150040_b; - - public BlockRainbowCactus() - { - super(); - } - - public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) - { - + + public BlockRainbowCactus() { + super(); } - + + public void onEntityCollidedWithBlock( + World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) {} + @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 = new ArrayList(); - - if(world.getBlock(x, y-1, z) != this) - { - ret.add(new ItemStack(this,1,0)); - return ret; + + if (world.getBlock(x, y - 1, z) != this) { + ret.add(new ItemStack(this, 1, 0)); + return ret; } - - for(int i = 0; i < 3+world.rand.nextInt(8); ++i) - ret.add(new ItemStack(Items.dye,1,allowedDyes[world.rand.nextInt(allowedDyes.length)])); - + + for (int i = 0; i < 3 + world.rand.nextInt(8); ++i) + ret.add(new ItemStack(Items.dye, 1, allowedDyes[world.rand.nextInt(allowedDyes.length)])); + return ret; } - - public static final int[] allowedDyes = new int[]{1,2,5,2,6,7,2,8,9,10,2,11,12,13,14,2}; - + + public static final int[] allowedDyes = new int[] {1, 2, 5, 2, 6, 7, 2, 8, 9, 10, 2, 11, 12, 13, 14, 2}; + @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { + public void registerBlockIcons(IIconRegister p_149651_1_) { this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "side"); this.field_150041_a = p_149651_1_.registerIcon(this.getTextureName() + "top"); this.field_150040_b = p_149651_1_.registerIcon(this.getTextureName() + "bottom"); } @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { + public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return p_149691_1_ == 1 ? this.field_150041_a : (p_149691_1_ == 0 ? this.field_150040_b : this.blockIcon); } - + @Override - public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) - { + public boolean canSustainPlant( + IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { Block plant = plantable.getPlant(world, x, y + 1, z); - - if (plant == this) - { + + if (plant == this) { return true; } - + return super.canSustainPlant(world, x, y, z, direction, plantable); } } diff --git a/src/main/java/tb/common/block/BlockRedlonStem.java b/src/main/java/tb/common/block/BlockRedlonStem.java index a42d240..239a808 100644 --- a/src/main/java/tb/common/block/BlockRedlonStem.java +++ b/src/main/java/tb/common/block/BlockRedlonStem.java @@ -2,160 +2,155 @@ package tb.common.block; import static net.minecraftforge.common.util.ForgeDirection.UP; -import java.util.ArrayList; -import java.util.Random; - -import tb.init.TBItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockStem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import tb.init.TBItems; -public class BlockRedlonStem extends BlockStem{ +public class BlockRedlonStem extends BlockStem { - private Block field_149877_a; - - public BlockRedlonStem(Block created) - { - super(created); - field_149877_a = created; - } - - public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) - { - this.checkAndDropBlock(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); + private Block field_149877_a; - if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9) - { + public BlockRedlonStem(Block created) { + super(created); + field_149877_a = created; + } + + public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { + this.checkAndDropBlock(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); + + if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9) { float f = this.func_149875_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); - if (p_149674_5_.nextInt((int)(25.0F / f) + 1) == 0) - { + if (p_149674_5_.nextInt((int) (25.0F / f) + 1) == 0) { int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_); - if (l < 7) - { + if (l < 7) { ++l; p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2); - } - else - { - if (p_149674_1_.getBlock(p_149674_2_ - 1, p_149674_3_, p_149674_4_) == this.field_149877_a) - { + } else { + if (p_149674_1_.getBlock(p_149674_2_ - 1, p_149674_3_, p_149674_4_) == this.field_149877_a) { return; } - if (p_149674_1_.getBlock(p_149674_2_ + 1, p_149674_3_, p_149674_4_) == this.field_149877_a) - { + if (p_149674_1_.getBlock(p_149674_2_ + 1, p_149674_3_, p_149674_4_) == this.field_149877_a) { return; } - if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_ - 1) == this.field_149877_a) - { + if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_ - 1) == this.field_149877_a) { return; } - if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_ + 1) == this.field_149877_a) - { + if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_ + 1) == this.field_149877_a) { return; } int i1 = p_149674_5_.nextInt(4); int j1 = p_149674_2_; int k1 = p_149674_4_; - - if(p_149674_5_.nextInt(4) != 0) - return; - if (i1 == 0) - { + if (p_149674_5_.nextInt(4) != 0) return; + + if (i1 == 0) { j1 = p_149674_2_ - 1; } - if (i1 == 1) - { + if (i1 == 1) { ++j1; } - if (i1 == 2) - { + if (i1 == 2) { k1 = p_149674_4_ - 1; } - if (i1 == 3) - { + if (i1 == 3) { ++k1; } - if (p_149674_1_.isAirBlock(j1, p_149674_3_, k1)) - { + if (p_149674_1_.isAirBlock(j1, p_149674_3_, k1)) { p_149674_1_.setBlock(j1, p_149674_3_, k1, this.field_149877_a); } } } } } - + @SideOnly(Side.CLIENT) - public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) - { + public void randomDisplayTick( + World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { this.func_150186_m(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_); } - private void func_150186_m(World p_150186_1_, int p_150186_2_, int p_150186_3_, int p_150186_4_) - { + private void func_150186_m(World p_150186_1_, int p_150186_2_, int p_150186_3_, int p_150186_4_) { Random random = p_150186_1_.rand; double d0 = 0.0625D; - for (int l = 0; l < 6; ++l) - { - double d1 = (double)((float)p_150186_2_ + random.nextFloat()); - double d2 = (double)((float)p_150186_3_ + random.nextFloat()); - double d3 = (double)((float)p_150186_4_ + random.nextFloat()); + for (int l = 0; l < 6; ++l) { + double d1 = (double) ((float) p_150186_2_ + random.nextFloat()); + double d2 = (double) ((float) p_150186_3_ + random.nextFloat()); + double d3 = (double) ((float) p_150186_4_ + random.nextFloat()); - if (l == 0 && !p_150186_1_.getBlock(p_150186_2_, p_150186_3_ + 1, p_150186_4_).isOpaqueCube()) - { - d2 = (double)(p_150186_3_ + 1) + d0; + if (l == 0 + && !p_150186_1_ + .getBlock(p_150186_2_, p_150186_3_ + 1, p_150186_4_) + .isOpaqueCube()) { + d2 = (double) (p_150186_3_ + 1) + d0; } - if (l == 1 && !p_150186_1_.getBlock(p_150186_2_, p_150186_3_ - 1, p_150186_4_).isOpaqueCube()) - { - d2 = (double)(p_150186_3_ + 0) - d0; + if (l == 1 + && !p_150186_1_ + .getBlock(p_150186_2_, p_150186_3_ - 1, p_150186_4_) + .isOpaqueCube()) { + d2 = (double) (p_150186_3_ + 0) - d0; } - if (l == 2 && !p_150186_1_.getBlock(p_150186_2_, p_150186_3_, p_150186_4_ + 1).isOpaqueCube()) - { - d3 = (double)(p_150186_4_ + 1) + d0; + if (l == 2 + && !p_150186_1_ + .getBlock(p_150186_2_, p_150186_3_, p_150186_4_ + 1) + .isOpaqueCube()) { + d3 = (double) (p_150186_4_ + 1) + d0; } - if (l == 3 && !p_150186_1_.getBlock(p_150186_2_, p_150186_3_, p_150186_4_ - 1).isOpaqueCube()) - { - d3 = (double)(p_150186_4_ + 0) - d0; + if (l == 3 + && !p_150186_1_ + .getBlock(p_150186_2_, p_150186_3_, p_150186_4_ - 1) + .isOpaqueCube()) { + d3 = (double) (p_150186_4_ + 0) - d0; } - if (l == 4 && !p_150186_1_.getBlock(p_150186_2_ + 1, p_150186_3_, p_150186_4_).isOpaqueCube()) - { - d1 = (double)(p_150186_2_ + 1) + d0; + if (l == 4 + && !p_150186_1_ + .getBlock(p_150186_2_ + 1, p_150186_3_, p_150186_4_) + .isOpaqueCube()) { + d1 = (double) (p_150186_2_ + 1) + d0; } - if (l == 5 && !p_150186_1_.getBlock(p_150186_2_ - 1, p_150186_3_, p_150186_4_).isOpaqueCube()) - { - d1 = (double)(p_150186_2_ + 0) - d0; + if (l == 5 + && !p_150186_1_ + .getBlock(p_150186_2_ - 1, p_150186_3_, p_150186_4_) + .isOpaqueCube()) { + d1 = (double) (p_150186_2_ + 0) - d0; } - if (d1 < (double)p_150186_2_ || d1 > (double)(p_150186_2_ + 1) || d2 < 0.0D || d2 > (double)(p_150186_3_ + 1) || d3 < (double)p_150186_4_ || d3 > (double)(p_150186_4_ + 1)) - { + if (d1 < (double) p_150186_2_ + || d1 > (double) (p_150186_2_ + 1) + || d2 < 0.0D + || d2 > (double) (p_150186_3_ + 1) + || d3 < (double) p_150186_4_ + || d3 > (double) (p_150186_4_ + 1)) { p_150186_1_.spawnParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D); } } } - - private float func_149875_n(World p_149875_1_, int p_149875_2_, int p_149875_3_, int p_149875_4_) - { + + private float func_149875_n(World p_149875_1_, int p_149875_2_, int p_149875_3_, int p_149875_4_) { float f = 1.0F; Block block = p_149875_1_.getBlock(p_149875_2_, p_149875_3_, p_149875_4_ - 1); Block block1 = p_149875_1_.getBlock(p_149875_2_, p_149875_3_, p_149875_4_ + 1); @@ -169,25 +164,20 @@ public class BlockRedlonStem extends BlockStem{ boolean flag1 = block == this || block1 == this; boolean flag2 = block4 == this || block5 == this || block6 == this || block7 == this; - for (int l = p_149875_2_ - 1; l <= p_149875_2_ + 1; ++l) - { - for (int i1 = p_149875_4_ - 1; i1 <= p_149875_4_ + 1; ++i1) - { + for (int l = p_149875_2_ - 1; l <= p_149875_2_ + 1; ++l) { + for (int i1 = p_149875_4_ - 1; i1 <= p_149875_4_ + 1; ++i1) { Block block8 = p_149875_1_.getBlock(l, p_149875_3_ - 1, i1); float f1 = 0.0F; - if (block8.canSustainPlant(p_149875_1_, l, p_149875_3_ - 1, i1, UP, this)) - { + if (block8.canSustainPlant(p_149875_1_, l, p_149875_3_ - 1, i1, UP, this)) { f1 = 1.0F; - if (block8.isFertile(p_149875_1_, l, p_149875_3_ - 1, i1)) - { + if (block8.isFertile(p_149875_1_, l, p_149875_3_ - 1, i1)) { f1 = 3.0F; } } - if (l != p_149875_2_ || i1 != p_149875_4_) - { + if (l != p_149875_2_ || i1 != p_149875_4_) { f1 /= 4.0F; } @@ -195,8 +185,7 @@ public class BlockRedlonStem extends BlockStem{ } } - if (flag2 || flag && flag1) - { + if (flag2 || flag && flag1) { f /= 2.0F; } @@ -204,37 +193,29 @@ public class BlockRedlonStem extends BlockStem{ } @Override - public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) - { + public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) { ArrayList ret = new ArrayList(); Item item = TBItems.redlonSeeds; - for (int i = 0; item != null && i < 3; i++) - { - if (world.rand.nextInt(15) <= meta) - ret.add(new ItemStack(item)); + for (int i = 0; item != null && i < 3; i++) { + if (world.rand.nextInt(15) <= meta) ret.add(new ItemStack(item)); } return ret; } - + @SideOnly(Side.CLIENT) - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) - { - return TBItems.redlonSeeds; + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { + return TBItems.redlonSeeds; } - + @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) - { - return 0xffffff; + public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { + return 0xffffff; } - + @SideOnly(Side.CLIENT) - public int getRenderColor(int p_149741_1_) - { - return 0xffffff; + public int getRenderColor(int p_149741_1_) { + return 0xffffff; } - - } diff --git a/src/main/java/tb/common/block/BlockRelocator.java b/src/main/java/tb/common/block/BlockRelocator.java index ff6164b..8535ba8 100644 --- a/src/main/java/tb/common/block/BlockRelocator.java +++ b/src/main/java/tb/common/block/BlockRelocator.java @@ -1,13 +1,10 @@ package tb.common.block; -import java.util.List; -import java.util.Random; - import DummyCore.Utils.MathUtils; -import tb.common.tile.TileRelocator; -import tb.core.TBCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,167 +18,146 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import tb.common.tile.TileRelocator; +import tb.core.TBCore; -public class BlockRelocator extends BlockContainer{ +public class BlockRelocator extends BlockContainer { - public IIcon[] icons = new IIcon[5]; - - public BlockRelocator() - { - super(Material.wood); - setHardness(2.5F); - setResistance(15.0F); - setStepSound(soundTypeWood); - } - - public IIcon getIcon(int side, int meta) - { - meta %= 6; - if(meta == 0) - return icons[side == 0 ? 0 : side == 1 ? 1 : 2]; - - if(meta == 1) - return icons[side == 1 ? 0 : side == 0 ? 1 : 2]; - - if(meta == 2) - return icons[side == 2 ? 0 : side == 3 ? 1 : side == 0 || side == 1 ? 2 : 4]; - - if(meta == 3) - return icons[side == 3 ? 0 : side == 2 ? 1 : side == 0 || side == 1 ? 2 : 4]; - - if(meta == 4) - return icons[side == 4 ? 0 : side == 5 ? 1 : 4]; - - if(meta == 5) - return icons[side == 5 ? 0 : side == 4 ? 1 : 4]; - - return icons[0]; + public IIcon[] icons = new IIcon[5]; + + public BlockRelocator() { + super(Material.wood); + setHardness(2.5F); + setResistance(15.0F); + setStepSound(soundTypeWood); } - - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister r) - { - icons[0] = r.registerIcon("thaumcraft:liftertop"); - icons[1] = r.registerIcon("thaumcraft:arcaneearbottom"); - icons[2]= r.registerIcon("thaumcraft:lifterside"); - icons[3] = r.registerIcon("thaumcraft:animatedglow"); - icons[4]= r.registerIcon("thaumicbases:relocator/rotatedside"); - } - - public boolean renderAsNormalBlock() - { - return false; - } - - public int getRenderType() - { - return 0x1242ff; - } - - public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) - { - return world.getBlockMetadata(x, y, z)%6 != side.ordinal(); - } - - @Override - public TileEntity createNewTileEntity(World w, int meta) - { - return new TileRelocator(); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) - { + public IIcon getIcon(int side, int meta) { + meta %= 6; + if (meta == 0) return icons[side == 0 ? 0 : side == 1 ? 1 : 2]; + + if (meta == 1) return icons[side == 1 ? 0 : side == 0 ? 1 : 2]; + + if (meta == 2) return icons[side == 2 ? 0 : side == 3 ? 1 : side == 0 || side == 1 ? 2 : 4]; + + if (meta == 3) return icons[side == 3 ? 0 : side == 2 ? 1 : side == 0 || side == 1 ? 2 : 4]; + + if (meta == 4) return icons[side == 4 ? 0 : side == 5 ? 1 : 4]; + + if (meta == 5) return icons[side == 5 ? 0 : side == 4 ? 1 : 4]; + + return icons[0]; + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister r) { + icons[0] = r.registerIcon("thaumcraft:liftertop"); + icons[1] = r.registerIcon("thaumcraft:arcaneearbottom"); + icons[2] = r.registerIcon("thaumcraft:lifterside"); + icons[3] = r.registerIcon("thaumcraft:animatedglow"); + icons[4] = r.registerIcon("thaumicbases:relocator/rotatedside"); + } + + public boolean renderAsNormalBlock() { + return false; + } + + public int getRenderType() { + return 0x1242ff; + } + + public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return world.getBlockMetadata(x, y, z) % 6 != side.ordinal(); + } + + @Override + public TileEntity createNewTileEntity(World w, int meta) { + return new TileRelocator(); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0)); p_149666_3_.add(new ItemStack(p_149666_1_, 1, 6)); } - - public int damageDropped(int meta) - { - return meta < 6 ? 0 : 6; - } - - public void randomDisplayTick(World w, int x, int y, int z, Random r) - { - TileRelocator tile = (TileRelocator) w.getTileEntity(x, y, z); - int meta = w.getBlockMetadata(x, y, z) % 6; - boolean doColor = w.getBlockMetadata(x, y, z) >= 6; - if(!tile.isBlockPowered()) - { - if(meta == 0) - { - - double dx = x+0.5D+MathUtils.randomDouble(r)/2; - double dy = y; - double dz = z+0.5D+MathUtils.randomDouble(r)/2; - TBCore.proxy.sparkle(w,dx,doColor ? dy-3 : dy,dz,dx,doColor ? dy : dy - 3,dz,doColor ? 2 : 1, 1F); - } - if(meta == 1) - { - double dx = x+0.5D+MathUtils.randomDouble(r)/2; - double dy = y+1; - double dz = z+0.5D+MathUtils.randomDouble(r)/2; - TBCore.proxy.sparkle(w,dx,doColor ? dy+3 : dy,dz,dx,doColor ? dy : dy+3,dz,doColor ? 2 : 1,1); - } - if(meta == 2) - { - double dx = x+0.5D+MathUtils.randomDouble(r)/2; - double dy = y+0.5D+MathUtils.randomDouble(r)/2; - double dz = z; - TBCore.proxy.sparkle(w,dx,dy,doColor ? dz-3 : dz,dx,dy,doColor ? dz : dz-3,doColor ? 2 : 1,1); - } - if(meta == 3) - { - double dx = x+0.5D+MathUtils.randomDouble(r)/2; - double dy = y+0.5D+MathUtils.randomDouble(r)/2; - double dz = z+1; - TBCore.proxy.sparkle(w,dx,dy,doColor ? dz+3 : dz,dx,dy,doColor ? dz : dz+3,doColor ? 2 : 1,1); - } - if(meta == 4) - { - double dx = x; - double dy = y+0.5D+MathUtils.randomDouble(r)/2; - double dz = z+0.5D+MathUtils.randomDouble(r)/2; - TBCore.proxy.sparkle(w,doColor ? dx-3 : dx,dy,dz,doColor ? dx : dx-3,dy,dz,doColor ? 2 : 1,1); - } - if(meta == 5) - { - double dx = x+1; - double dy = y+0.5D+MathUtils.randomDouble(r)/2; - double dz = z+0.5D+MathUtils.randomDouble(r)/2; - TBCore.proxy.sparkle(w,doColor ? dx+3 : dx,dy,dz,doColor ? dx : dx+3,dy,dz,doColor ? 2 : 1,1); - } - } - } - - public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) - { - int l = determineOrientation(w, x, y, z, p_149689_5_); - w.setBlockMetadataWithNotify(x, y, z, w.getBlockMetadata(x, y, z)+l, 3); - } - - public static int determineOrientation(World p_150071_0_, int p_150071_1_, int p_150071_2_, int p_150071_3_, EntityLivingBase p_150071_4_) - { - if (MathHelper.abs((float)p_150071_4_.posX - (float)p_150071_1_) < 2.0F && MathHelper.abs((float)p_150071_4_.posZ - (float)p_150071_3_) < 2.0F) - { - double d0 = p_150071_4_.posY + 1.82D - (double)p_150071_4_.yOffset; - if (d0 - (double)p_150071_2_ > 2.0D) - { + public int damageDropped(int meta) { + return meta < 6 ? 0 : 6; + } + + public void randomDisplayTick(World w, int x, int y, int z, Random r) { + TileRelocator tile = (TileRelocator) w.getTileEntity(x, y, z); + int meta = w.getBlockMetadata(x, y, z) % 6; + boolean doColor = w.getBlockMetadata(x, y, z) >= 6; + if (!tile.isBlockPowered()) { + if (meta == 0) { + + double dx = x + 0.5D + MathUtils.randomDouble(r) / 2; + double dy = y; + double dz = z + 0.5D + MathUtils.randomDouble(r) / 2; + TBCore.proxy.sparkle( + w, dx, doColor ? dy - 3 : dy, dz, dx, doColor ? dy : dy - 3, dz, doColor ? 2 : 1, 1F); + } + if (meta == 1) { + double dx = x + 0.5D + MathUtils.randomDouble(r) / 2; + double dy = y + 1; + double dz = z + 0.5D + MathUtils.randomDouble(r) / 2; + TBCore.proxy.sparkle( + w, dx, doColor ? dy + 3 : dy, dz, dx, doColor ? dy : dy + 3, dz, doColor ? 2 : 1, 1); + } + if (meta == 2) { + double dx = x + 0.5D + MathUtils.randomDouble(r) / 2; + double dy = y + 0.5D + MathUtils.randomDouble(r) / 2; + double dz = z; + TBCore.proxy.sparkle( + w, dx, dy, doColor ? dz - 3 : dz, dx, dy, doColor ? dz : dz - 3, doColor ? 2 : 1, 1); + } + if (meta == 3) { + double dx = x + 0.5D + MathUtils.randomDouble(r) / 2; + double dy = y + 0.5D + MathUtils.randomDouble(r) / 2; + double dz = z + 1; + TBCore.proxy.sparkle( + w, dx, dy, doColor ? dz + 3 : dz, dx, dy, doColor ? dz : dz + 3, doColor ? 2 : 1, 1); + } + if (meta == 4) { + double dx = x; + double dy = y + 0.5D + MathUtils.randomDouble(r) / 2; + double dz = z + 0.5D + MathUtils.randomDouble(r) / 2; + TBCore.proxy.sparkle( + w, doColor ? dx - 3 : dx, dy, dz, doColor ? dx : dx - 3, dy, dz, doColor ? 2 : 1, 1); + } + if (meta == 5) { + double dx = x + 1; + double dy = y + 0.5D + MathUtils.randomDouble(r) / 2; + double dz = z + 0.5D + MathUtils.randomDouble(r) / 2; + TBCore.proxy.sparkle( + w, doColor ? dx + 3 : dx, dy, dz, doColor ? dx : dx + 3, dy, dz, doColor ? 2 : 1, 1); + } + } + } + + public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { + int l = determineOrientation(w, x, y, z, p_149689_5_); + w.setBlockMetadataWithNotify(x, y, z, w.getBlockMetadata(x, y, z) + l, 3); + } + + public static int determineOrientation( + World p_150071_0_, int p_150071_1_, int p_150071_2_, int p_150071_3_, EntityLivingBase p_150071_4_) { + if (MathHelper.abs((float) p_150071_4_.posX - (float) p_150071_1_) < 2.0F + && MathHelper.abs((float) p_150071_4_.posZ - (float) p_150071_3_) < 2.0F) { + double d0 = p_150071_4_.posY + 1.82D - (double) p_150071_4_.yOffset; + + if (d0 - (double) p_150071_2_ > 2.0D) { return 1; } - if ((double)p_150071_2_ - d0 > 0.0D) - { + if ((double) p_150071_2_ - d0 > 0.0D) { return 0; } } - int l = MathHelper.floor_double((double)(p_150071_4_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int l = MathHelper.floor_double((double) (p_150071_4_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; return l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0))); } - } diff --git a/src/main/java/tb/common/block/BlockSpike.java b/src/main/java/tb/common/block/BlockSpike.java index 5adbfcb..ce7c694 100644 --- a/src/main/java/tb/common/block/BlockSpike.java +++ b/src/main/java/tb/common/block/BlockSpike.java @@ -1,16 +1,10 @@ package tb.common.block; -import java.util.List; -import java.util.UUID; - -import tb.init.TBItems; -import thaumcraft.common.config.ConfigItems; -import thaumcraft.common.items.armor.ItemVoidArmor; - import com.mojang.authlib.GameProfile; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.UUID; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -27,156 +21,124 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayer; +import tb.init.TBItems; +import thaumcraft.common.config.ConfigItems; +import thaumcraft.common.items.armor.ItemVoidArmor; -public class BlockSpike extends Block{ +public class BlockSpike extends Block { - public static final String[] spikeNames = new String[]{ - "iron", - "iron_bloody", - "thaumic", - "thaumic_bloody", - "void", - "void_bloody" - }; - - public static IIcon[] icons = new IIcon[spikeNames.length]; - - public BlockSpike() - { - super(Material.iron); - float f = 0.0625F; - this.setBlockBounds(0, 0, 0, 1, 1-f, 1); - } + public static final String[] spikeNames = + new String[] {"iron", "iron_bloody", "thaumic", "thaumic_bloody", "void", "void_bloody"}; - public boolean isOpaqueCube() - { + public static IIcon[] icons = new IIcon[spikeNames.length]; + + public BlockSpike() { + super(Material.iron); + float f = 0.0625F; + this.setBlockBounds(0, 0, 0, 1, 1 - f, 1); + } + + public boolean isOpaqueCube() { return false; } - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - public int getRenderType() - { + public int getRenderType() { return 1; } - - public void onNeighborBlockChange(World w, int x, int y, int z, Block changed) - { - if(w.isAirBlock(x, y-1, z)) - { - this.dropBlockAsItem(w, x, y, z, w.getBlockMetadata(x, y, z), 0); - w.setBlockToAir(x, y, z); - } + + public void onNeighborBlockChange(World w, int x, int y, int z, Block changed) { + if (w.isAirBlock(x, y - 1, z)) { + this.dropBlockAsItem(w, x, y, z, w.getBlockMetadata(x, y, z), 0); + w.setBlockToAir(x, y, z); + } } - + @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return icons[meta]; + public IIcon getIcon(int side, int meta) { + return icons[meta]; } - + @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - for(int i = 0; i < icons.length; ++i) - icons[i] = reg.registerIcon("thaumicbases:spike/"+spikeNames[i]); + public void registerBlockIcons(IIconRegister reg) { + for (int i = 0; i < icons.length; ++i) icons[i] = reg.registerIcon("thaumicbases:spike/" + spikeNames[i]); } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - par3List.add(new ItemStack(par1,1,0)); - par3List.add(new ItemStack(par1,1,2)); - par3List.add(new ItemStack(par1,1,4)); - } - - public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity collider) - { - int meta = w.getBlockMetadata(x, y, z); - if(meta == 0 || meta == 1) - { - collider.attackEntityFrom(DamageSource.cactus, 8); - - if(meta == 0 && collider instanceof EntityLivingBase && ((EntityLivingBase) collider).getHealth() <= 0) - { - w.setBlockMetadataWithNotify(x, y, z, 1, 3); - } - } - if(meta == 2 || meta == 3) - { - if(w.isBlockIndirectlyGettingPowered(x, y, z)) - return; - - if(!(collider instanceof EntityItem)) - collider.attackEntityFrom(DamageSource.cactus, 14); - - if(meta == 2 && collider instanceof EntityLivingBase && ((EntityLivingBase) collider).getHealth() <= 0) - { - w.setBlockMetadataWithNotify(x, y, z, 3, 3); - } - } - if(meta == 4 || meta == 5) - { - if(w.isBlockIndirectlyGettingPowered(x, y, z)) - return; - - if(collider instanceof EntityPlayer) - { - ItemStack boots = ((EntityPlayer) collider).inventory.armorInventory[0]; - if(boots != null && boots.getItem() instanceof ItemVoidArmor) - return; - } - - if(!(collider instanceof EntityItem) && !(collider instanceof EntityXPOrb)) - { - if(!w.isRemote) - { - FakePlayer fake = new FakePlayer((WorldServer) w, fakeSpikeProfile); - collider.attackEntityFrom(DamageSource.causePlayerDamage(fake), 20); - fake.setDead(); - fake = null; - } - } - - if(meta == 4 && collider instanceof EntityLivingBase && ((EntityLivingBase) collider).getHealth() <= 0) - { - w.setBlockMetadataWithNotify(x, y, z, 5, 3); - } - } - } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer player, int side, float vecX, float vecY, float vecZ) - { - int meta = w.getBlockMetadata(x, y, z); - if(meta != 1 && meta != 3 && meta != 5) - return false; - - ItemStack cI = player.getCurrentEquippedItem(); - if(cI == null) - return false; - - if(cI.getItem() != ConfigItems.itemResource) - return false; - - if(cI.getItemDamage() != 7) - return false; - - player.inventory.decrStackSize(player.inventory.currentItem, 1); - if(!player.inventory.addItemStackToInventory(new ItemStack(TBItems.resource,1,8))) - player.dropPlayerItemWithRandomChoice(new ItemStack(TBItems.resource,1,8), false); - - w.setBlockMetadataWithNotify(x, y, z, meta-1, 3); - + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 4)); + } + + public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity collider) { + int meta = w.getBlockMetadata(x, y, z); + if (meta == 0 || meta == 1) { + collider.attackEntityFrom(DamageSource.cactus, 8); + + if (meta == 0 && collider instanceof EntityLivingBase && ((EntityLivingBase) collider).getHealth() <= 0) { + w.setBlockMetadataWithNotify(x, y, z, 1, 3); + } + } + if (meta == 2 || meta == 3) { + if (w.isBlockIndirectlyGettingPowered(x, y, z)) return; + + if (!(collider instanceof EntityItem)) collider.attackEntityFrom(DamageSource.cactus, 14); + + if (meta == 2 && collider instanceof EntityLivingBase && ((EntityLivingBase) collider).getHealth() <= 0) { + w.setBlockMetadataWithNotify(x, y, z, 3, 3); + } + } + if (meta == 4 || meta == 5) { + if (w.isBlockIndirectlyGettingPowered(x, y, z)) return; + + if (collider instanceof EntityPlayer) { + ItemStack boots = ((EntityPlayer) collider).inventory.armorInventory[0]; + if (boots != null && boots.getItem() instanceof ItemVoidArmor) return; + } + + if (!(collider instanceof EntityItem) && !(collider instanceof EntityXPOrb)) { + if (!w.isRemote) { + FakePlayer fake = new FakePlayer((WorldServer) w, fakeSpikeProfile); + collider.attackEntityFrom(DamageSource.causePlayerDamage(fake), 20); + fake.setDead(); + fake = null; + } + } + + if (meta == 4 && collider instanceof EntityLivingBase && ((EntityLivingBase) collider).getHealth() <= 0) { + w.setBlockMetadataWithNotify(x, y, z, 5, 3); + } + } + } + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer player, int side, float vecX, float vecY, float vecZ) { + int meta = w.getBlockMetadata(x, y, z); + if (meta != 1 && meta != 3 && meta != 5) return false; + + ItemStack cI = player.getCurrentEquippedItem(); + if (cI == null) return false; + + if (cI.getItem() != ConfigItems.itemResource) return false; + + if (cI.getItemDamage() != 7) return false; + + player.inventory.decrStackSize(player.inventory.currentItem, 1); + if (!player.inventory.addItemStackToInventory(new ItemStack(TBItems.resource, 1, 8))) + player.dropPlayerItemWithRandomChoice(new ItemStack(TBItems.resource, 1, 8), false); + + w.setBlockMetadataWithNotify(x, y, z, meta - 1, 3); + return true; } - - public int damageDropped(int par1) - { - return par1 == 1 ? 0 : par1 == 3 ? 2 : par1 == 5 ? 4 : par1; - } - - public static final GameProfile fakeSpikeProfile = new GameProfile(UUID.randomUUID(),"[TB]Spikes"); + + public int damageDropped(int par1) { + return par1 == 1 ? 0 : par1 == 3 ? 2 : par1 == 5 ? 4 : par1; + } + + public static final GameProfile fakeSpikeProfile = new GameProfile(UUID.randomUUID(), "[TB]Spikes"); } diff --git a/src/main/java/tb/common/block/BlockSweed.java b/src/main/java/tb/common/block/BlockSweed.java index b741591..b2dc79a 100644 --- a/src/main/java/tb/common/block/BlockSweed.java +++ b/src/main/java/tb/common/block/BlockSweed.java @@ -2,7 +2,6 @@ package tb.common.block; import java.util.ArrayList; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; @@ -14,60 +13,48 @@ import net.minecraftforge.common.util.ForgeDirection; public class BlockSweed extends BlockTBPlant { - public BlockSweed(int stages, int delay, boolean isCrop) { - super(stages, delay, isCrop); - } - - protected boolean canPlaceBlockOn(Block b) - { - return b != null && (b == Blocks.grass || b == Blocks.dirt || b instanceof BlockGrass || b instanceof BlockDirt); + public BlockSweed(int stages, int delay, boolean isCrop) { + super(stages, delay, isCrop); } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { + + protected boolean canPlaceBlockOn(Block b) { + return b != null + && (b == Blocks.grass || b == Blocks.dirt || b instanceof BlockGrass || b instanceof BlockDirt); + } + + public void updateTick(World w, int x, int y, int z, Random rnd) { super.updateTick(w, x, y, z, rnd); - if(w.getBlockMetadata(x, y, z) == growthStages-1 && !w.isRemote) - { - ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[2+w.rand.nextInt(4)]; - int newX = x+dir.offsetX; - int newZ = z+dir.offsetZ; - int newY = findSutableY(w,newX,y,newZ); - if(canPlaceBlockOn(w.getBlock(newX, newY-1, newZ)) && w.isAirBlock(newX, newY, newZ)) //fix for the Sweeds destroying blocks - w.setBlock(newX, newY, newZ, this, 0, 3); + if (w.getBlockMetadata(x, y, z) == growthStages - 1 && !w.isRemote) { + ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[2 + w.rand.nextInt(4)]; + int newX = x + dir.offsetX; + int newZ = z + dir.offsetZ; + int newY = findSutableY(w, newX, y, newZ); + if (canPlaceBlockOn(w.getBlock(newX, newY - 1, newZ)) + && w.isAirBlock(newX, newY, newZ)) // fix for the Sweeds destroying blocks + w.setBlock(newX, newY, newZ, this, 0, 3); } } - - public int findSutableY(World w, int x, int y, int z) - { - int bY = y; - y += 1; - while(!canPlaceBlockOn(w.getBlock(x, y, z)) && y > bY - 2) - --y; - - return y+1; + + public int findSutableY(World w, int x, int y, int z) { + int bY = y; + y += 1; + while (!canPlaceBlockOn(w.getBlock(x, y, z)) && y > bY - 2) --y; + + return y + 1; } - + @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 = new ArrayList(); - if (metadata >= growthStages-1) - { - if (world.rand.nextInt(growthStages) <= metadata) - if (dropSeed != null) - ret.add(dropSeed.copy()); - - for (int i = 0; i < 3 + fortune; ++i) - if (world.rand.nextBoolean()) - ret.add(new ItemStack(Items.sugar)); + if (metadata >= growthStages - 1) { + if (world.rand.nextInt(growthStages) <= metadata) if (dropSeed != null) ret.add(dropSeed.copy()); - if (world.rand.nextBoolean()) - ret.add(new ItemStack(Items.reeds)); - - }else - if(dropSeed != null) - ret.add(dropSeed.copy()); + for (int i = 0; i < 3 + fortune; ++i) if (world.rand.nextBoolean()) ret.add(new ItemStack(Items.sugar)); + + if (world.rand.nextBoolean()) ret.add(new ItemStack(Items.reeds)); + + } else if (dropSeed != null) ret.add(dropSeed.copy()); return ret; } diff --git a/src/main/java/tb/common/block/BlockTBLeaves.java b/src/main/java/tb/common/block/BlockTBLeaves.java index 55efbb4..f5d3511 100644 --- a/src/main/java/tb/common/block/BlockTBLeaves.java +++ b/src/main/java/tb/common/block/BlockTBLeaves.java @@ -1,15 +1,12 @@ package tb.common.block; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import DummyCore.Utils.MathUtils; -import tb.core.TBCore; -import tb.init.TBBlocks; import cpw.mods.fml.common.FMLLog; 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 net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; @@ -37,385 +34,339 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; +import tb.core.TBCore; +import tb.init.TBBlocks; -public class BlockTBLeaves extends BlockOldLeaf{ - - public static final String[] names = new String[]{ - "goldenOakLeaves", - "peacefullTreeLeaves", - "netherTreeLeaves", - "enderTreeLeaves" - }; - - public static final String[] textures = new String[]{ - "goldenOak/leaves", - "peacefullTree/leaves", - "netherTree/leaves", - "enderTree/leaves" - }; - - public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) - { - if(world.getBlockMetadata(x, y, z)%8==3) - if(entity instanceof EntityDragon) - return false; - - return super.canEntityDestroy(world, x, y, z, entity); +public class BlockTBLeaves extends BlockOldLeaf { + + public static final String[] names = + new String[] {"goldenOakLeaves", "peacefullTreeLeaves", "netherTreeLeaves", "enderTreeLeaves"}; + + public static final String[] textures = + new String[] {"goldenOak/leaves", "peacefullTree/leaves", "netherTree/leaves", "enderTree/leaves"}; + + public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) { + if (world.getBlockMetadata(x, y, z) % 8 == 3) if (entity instanceof EntityDragon) return false; + + return super.canEntityDestroy(world, x, y, z, entity); } - - public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) - { - if(world.getBlockMetadata(x, y, z)%8==2) - return true; - - return super.isFlammable(world, x, y, z, face); + + public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + if (world.getBlockMetadata(x, y, z) % 8 == 2) return true; + + return super.isFlammable(world, x, y, z, face); } - - public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) - { - if(world.getBlockMetadata(x, y, z)%8==2) - return 0; - - return super.getFlammability(world, x, y, z, face); + + public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + if (world.getBlockMetadata(x, y, z) % 8 == 2) return 0; + + return super.getFlammability(world, x, y, z, face); } - - public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) - { - if(world.getBlockMetadata(x, y, z)%8==2) - return 0; - - return super.getFlammability(world, x, y, z, face); + + public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + if (world.getBlockMetadata(x, y, z) % 8 == 2) return 0; + + return super.getFlammability(world, x, y, z, face); } - - public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) - { - if(world.getBlockMetadata(x, y, z)%8==2) - return true; - - return super.isFireSource(world, x, y, z, side); + + public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) { + if (world.getBlockMetadata(x, y, z) % 8 == 2) return true; + + return super.isFireSource(world, x, y, z, side); } - - public static IIcon[] icons = new IIcon[names.length]; + + public static IIcon[] icons = new IIcon[names.length]; @SideOnly(Side.CLIENT) - public int getBlockColor() - { - return 0xffffff; + public int getBlockColor() { + return 0xffffff; } - + @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - if(world.getBlockMetadata(x, y, z)%8 != 3) - return super.getLightValue(world, x, y, z); - else - return 11; + public int getLightValue(IBlockAccess world, int x, int y, int z) { + if (world.getBlockMetadata(x, y, z) % 8 != 3) return super.getLightValue(world, x, y, z); + else return 11; } - + @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess w, int x, int y, int z, int meta) - { + public boolean shouldSideBeRendered(IBlockAccess w, int x, int y, int z, int meta) { return true; } - + @SideOnly(Side.CLIENT) - public void randomDisplayTick(World w, int x, int y, int z, Random rnd) - { - super.randomDisplayTick(w, x, y, z, rnd); - - if(w.getBlockMetadata(x, y, z)%8 == 0) - w.spawnParticle("reddust", x+rnd.nextDouble(), y+rnd.nextDouble(), z+rnd.nextDouble(), 1, 1, 0); - - if(w.getBlockMetadata(x, y, z)%8 == 1 && rnd.nextFloat() <= 0.01F) - w.spawnParticle("heart", x+rnd.nextDouble(), y+rnd.nextDouble(), z+rnd.nextDouble(), 0, 10, 0); - - if(w.getBlockMetadata(x, y, z)%8 == 2) - { - if(w.isAirBlock(x, y-1, z)) - w.spawnParticle("dripLava", x+rnd.nextDouble(), y, z+rnd.nextDouble(), 0, 0, 0); - } - - if(w.getBlockMetadata(x, y, z)%8 == 3) - w.spawnParticle("portal", x+rnd.nextDouble(), y+rnd.nextDouble(), z+rnd.nextDouble(), MathUtils.randomDouble(rnd), MathUtils.randomDouble(rnd), MathUtils.randomDouble(rnd)); + public void randomDisplayTick(World w, int x, int y, int z, Random rnd) { + super.randomDisplayTick(w, x, y, z, rnd); + + if (w.getBlockMetadata(x, y, z) % 8 == 0) + w.spawnParticle("reddust", x + rnd.nextDouble(), y + rnd.nextDouble(), z + rnd.nextDouble(), 1, 1, 0); + + if (w.getBlockMetadata(x, y, z) % 8 == 1 && rnd.nextFloat() <= 0.01F) + w.spawnParticle("heart", x + rnd.nextDouble(), y + rnd.nextDouble(), z + rnd.nextDouble(), 0, 10, 0); + + if (w.getBlockMetadata(x, y, z) % 8 == 2) { + if (w.isAirBlock(x, y - 1, z)) + w.spawnParticle("dripLava", x + rnd.nextDouble(), y, z + rnd.nextDouble(), 0, 0, 0); + } + + if (w.getBlockMetadata(x, y, z) % 8 == 3) + w.spawnParticle( + "portal", + x + rnd.nextDouble(), + y + rnd.nextDouble(), + z + rnd.nextDouble(), + MathUtils.randomDouble(rnd), + MathUtils.randomDouble(rnd), + MathUtils.randomDouble(rnd)); } - - public Item getItemDropped(int meta, Random rnd, int fortune) - { + + public Item getItemDropped(int meta, Random rnd, int fortune) { return Item.getItemFromBlock(TBBlocks.sapling); } - + @SideOnly(Side.CLIENT) - public int getRenderColor(int p_149741_1_) - { - return 0xffffff; + public int getRenderColor(int p_149741_1_) { + return 0xffffff; } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { - super.updateTick(w, x, y, z, rnd); - if(w.getBlockMetadata(x, y, z)%8 == 1) - { - if(rnd.nextDouble() > 0.03D) - return; - - int dy = y; - BiomeGenBase base = w.getBiomeGenForCoords(x, z); - if(base != null) - { - @SuppressWarnings("unchecked") - List l = base.getSpawnableList(EnumCreatureType.creature); - if(l != null && !l.isEmpty()) - { - SpawnListEntry entry = l.get(rnd.nextInt(l.size())); - if(entry != null && entry.entityClass != null) - { - Class c = entry.entityClass; - if(EntityLiving.class.isAssignableFrom(c)) - { - try - { - EntityLiving el = EntityLiving.class.cast(c.getConstructor(World.class).newInstance(w)); - while(--y >= dy-6) - { - el.setPositionAndRotation(x+0.5D, y, z+0.5D, 0, 0); - if(el.getCanSpawnHere()) - { - w.spawnEntityInWorld(el); - break; - }else - continue; - } - }catch(Exception e) - { - FMLLog.warning("[TB]Tried to create an entity of class "+c+" but failed! The exception is listed below:",new Object[0]); - e.printStackTrace(); - } - } - } - } - } - } - if(w.getBlockMetadata(x, y, z)%8 == 2) - { - int dy = y; - while(--y >= dy-8) - { - Block b = w.getBlock(x, y, z); - if(!b.isAir(w, x, y, z)) - { - boolean netheric = b instanceof BlockNetherrack || b instanceof BlockSoulSand || b == Blocks.quartz_ore; - if(netheric && rnd.nextDouble() <= 0.05D) - { - BiomeGenBase hellBiome = BiomeGenBase.hell; - @SuppressWarnings("unchecked") - List l = rnd.nextBoolean() ? hellBiome.getSpawnableList(EnumCreatureType.creature) : hellBiome.getSpawnableList(EnumCreatureType.monster); - if(l != null && !l.isEmpty()) - { - SpawnListEntry entry = l.get(rnd.nextInt(l.size())); - if(entry != null && entry.entityClass != null) - { - Class c = entry.entityClass; - if(EntityLiving.class.isAssignableFrom(c)) - { - try - { - EntityLiving el = EntityLiving.class.cast(c.getConstructor(World.class).newInstance(w)); - - el.setPositionAndRotation(x+0.5D, y+1, z+0.5D, 0, 0); - el.onSpawnWithEgg(null); - - if(el.getCanSpawnHere()) - { - w.spawnEntityInWorld(el); - break; - } - - }catch(Exception e) - { - FMLLog.warning("[TB]Tried to create an entity of class "+c+" but failed! The exception is listed below:",new Object[0]); - e.printStackTrace(); - } - } - } - } - - break; - } - else - { - boolean flag = b instanceof BlockDirt || b instanceof BlockGrass || b instanceof BlockGravel || b instanceof BlockSand || b instanceof BlockStone; - if(!flag) - { - ItemStack stk = new ItemStack(b,1,w.getBlockMetadata(x, y, z)); - if(OreDictionary.getOreIDs(stk) != null && OreDictionary.getOreIDs(stk).length > 0) - { - OreDict:for(int i = 0; i < OreDictionary.getOreIDs(stk).length; ++i) - { - int id = OreDictionary.getOreIDs(stk)[i]; - if(id != -1) - { - String ore = OreDictionary.getOreName(id); - if(ore != null && ! ore.isEmpty()) - { - flag = ore.contains("dirt") || ore.contains("grass") || ore.contains("sand") || ore.contains("gravel") || ore.contains("stone"); - if(flag) - break OreDict; - } - } - } - } - } - if(flag) - { - double random = rnd.nextDouble(); - Block setTo = random <= 0.6D ? Blocks.netherrack : random <= 0.9D ? Blocks.soul_sand : Blocks.quartz_ore; - w.setBlock(x, y, z, setTo, 0, 3); - break; - } - } - } - } - } - if(w.getBlockMetadata(x, y, z)%8 == 3) - { - int dy = y; - while(--y >= dy-11) - { - Block b = w.getBlock(x, y, z); - if(!b.isAir(w, x, y, z)) - { - boolean end = b == Blocks.end_stone || b instanceof BlockObsidian; - if(end && rnd.nextDouble() <= 0.02D) - { - BiomeGenBase hellBiome = BiomeGenBase.sky; - @SuppressWarnings("unchecked") - List l = rnd.nextBoolean() ? hellBiome.getSpawnableList(EnumCreatureType.creature) : hellBiome.getSpawnableList(EnumCreatureType.monster); - if(l != null && !l.isEmpty()) - { - SpawnListEntry entry = l.get(rnd.nextInt(l.size())); - if(entry != null && entry.entityClass != null) - { - Class c = entry.entityClass; - if(EntityLiving.class.isAssignableFrom(c)) - { - try - { - EntityLiving el = EntityLiving.class.cast(c.getConstructor(World.class).newInstance(w)); - - el.setPositionAndRotation(x+0.5D, y+1, z+0.5D, 0, 0); - el.onSpawnWithEgg(null); - - if(w.isAirBlock(x, y+1, z)) - { - w.spawnEntityInWorld(el); - break; - } - - }catch(Exception e) - { - FMLLog.warning("[TB]Tried to create an entity of class "+c+" but failed! The exception is listed below:",new Object[0]); - e.printStackTrace(); - } - } - } - } - - break; - } - else - { - boolean flag = b instanceof BlockDirt || b instanceof BlockGrass || b instanceof BlockGravel || b instanceof BlockSand || b instanceof BlockStone && !(b instanceof BlockObsidian) && !(b == Blocks.end_stone); - if(!flag) - { - ItemStack stk = new ItemStack(b,1,w.getBlockMetadata(x, y, z)); - if(OreDictionary.getOreIDs(stk) != null && OreDictionary.getOreIDs(stk).length > 0) - { - OreDict:for(int i = 0; i < OreDictionary.getOreIDs(stk).length; ++i) - { - int id = OreDictionary.getOreIDs(stk)[i]; - if(id != -1) - { - String ore = OreDictionary.getOreName(id); - if(ore != null && ! ore.isEmpty()) - { - flag = ore.contains("dirt") || ore.contains("grass") || ore.contains("sand") || ore.contains("gravel") || ore.contains("stone"); - if(flag) - break OreDict; - } - } - } - } - } - if(flag) - { - double random = rnd.nextDouble(); - Block setTo = random <= 0.9D ? Blocks.end_stone : Blocks.obsidian; - w.setBlock(x, y, z, setTo, 0, 3); - break; - } - } - } - } - } + + public void updateTick(World w, int x, int y, int z, Random rnd) { + super.updateTick(w, x, y, z, rnd); + if (w.getBlockMetadata(x, y, z) % 8 == 1) { + if (rnd.nextDouble() > 0.03D) return; + + int dy = y; + BiomeGenBase base = w.getBiomeGenForCoords(x, z); + if (base != null) { + @SuppressWarnings("unchecked") + List l = base.getSpawnableList(EnumCreatureType.creature); + if (l != null && !l.isEmpty()) { + SpawnListEntry entry = l.get(rnd.nextInt(l.size())); + if (entry != null && entry.entityClass != null) { + Class c = entry.entityClass; + if (EntityLiving.class.isAssignableFrom(c)) { + try { + EntityLiving el = EntityLiving.class.cast( + c.getConstructor(World.class).newInstance(w)); + while (--y >= dy - 6) { + el.setPositionAndRotation(x + 0.5D, y, z + 0.5D, 0, 0); + if (el.getCanSpawnHere()) { + w.spawnEntityInWorld(el); + break; + } else continue; + } + } catch (Exception e) { + FMLLog.warning( + "[TB]Tried to create an entity of class " + c + + " but failed! The exception is listed below:", + new Object[0]); + e.printStackTrace(); + } + } + } + } + } + } + if (w.getBlockMetadata(x, y, z) % 8 == 2) { + int dy = y; + while (--y >= dy - 8) { + Block b = w.getBlock(x, y, z); + if (!b.isAir(w, x, y, z)) { + boolean netheric = + b instanceof BlockNetherrack || b instanceof BlockSoulSand || b == Blocks.quartz_ore; + if (netheric && rnd.nextDouble() <= 0.05D) { + BiomeGenBase hellBiome = BiomeGenBase.hell; + @SuppressWarnings("unchecked") + List l = rnd.nextBoolean() + ? hellBiome.getSpawnableList(EnumCreatureType.creature) + : hellBiome.getSpawnableList(EnumCreatureType.monster); + if (l != null && !l.isEmpty()) { + SpawnListEntry entry = l.get(rnd.nextInt(l.size())); + if (entry != null && entry.entityClass != null) { + Class c = entry.entityClass; + if (EntityLiving.class.isAssignableFrom(c)) { + try { + EntityLiving el = EntityLiving.class.cast( + c.getConstructor(World.class).newInstance(w)); + + el.setPositionAndRotation(x + 0.5D, y + 1, z + 0.5D, 0, 0); + el.onSpawnWithEgg(null); + + if (el.getCanSpawnHere()) { + w.spawnEntityInWorld(el); + break; + } + + } catch (Exception e) { + FMLLog.warning( + "[TB]Tried to create an entity of class " + c + + " but failed! The exception is listed below:", + new Object[0]); + e.printStackTrace(); + } + } + } + } + + break; + } else { + boolean flag = b instanceof BlockDirt + || b instanceof BlockGrass + || b instanceof BlockGravel + || b instanceof BlockSand + || b instanceof BlockStone; + if (!flag) { + ItemStack stk = new ItemStack(b, 1, w.getBlockMetadata(x, y, z)); + if (OreDictionary.getOreIDs(stk) != null && OreDictionary.getOreIDs(stk).length > 0) { + OreDict: + for (int i = 0; i < OreDictionary.getOreIDs(stk).length; ++i) { + int id = OreDictionary.getOreIDs(stk)[i]; + if (id != -1) { + String ore = OreDictionary.getOreName(id); + if (ore != null && !ore.isEmpty()) { + flag = ore.contains("dirt") + || ore.contains("grass") + || ore.contains("sand") + || ore.contains("gravel") + || ore.contains("stone"); + if (flag) break OreDict; + } + } + } + } + } + if (flag) { + double random = rnd.nextDouble(); + Block setTo = random <= 0.6D + ? Blocks.netherrack + : random <= 0.9D ? Blocks.soul_sand : Blocks.quartz_ore; + w.setBlock(x, y, z, setTo, 0, 3); + break; + } + } + } + } + } + if (w.getBlockMetadata(x, y, z) % 8 == 3) { + int dy = y; + while (--y >= dy - 11) { + Block b = w.getBlock(x, y, z); + if (!b.isAir(w, x, y, z)) { + boolean end = b == Blocks.end_stone || b instanceof BlockObsidian; + if (end && rnd.nextDouble() <= 0.02D) { + BiomeGenBase hellBiome = BiomeGenBase.sky; + @SuppressWarnings("unchecked") + List l = rnd.nextBoolean() + ? hellBiome.getSpawnableList(EnumCreatureType.creature) + : hellBiome.getSpawnableList(EnumCreatureType.monster); + if (l != null && !l.isEmpty()) { + SpawnListEntry entry = l.get(rnd.nextInt(l.size())); + if (entry != null && entry.entityClass != null) { + Class c = entry.entityClass; + if (EntityLiving.class.isAssignableFrom(c)) { + try { + EntityLiving el = EntityLiving.class.cast( + c.getConstructor(World.class).newInstance(w)); + + el.setPositionAndRotation(x + 0.5D, y + 1, z + 0.5D, 0, 0); + el.onSpawnWithEgg(null); + + if (w.isAirBlock(x, y + 1, z)) { + w.spawnEntityInWorld(el); + break; + } + + } catch (Exception e) { + FMLLog.warning( + "[TB]Tried to create an entity of class " + c + + " but failed! The exception is listed below:", + new Object[0]); + e.printStackTrace(); + } + } + } + } + + break; + } else { + boolean flag = b instanceof BlockDirt + || b instanceof BlockGrass + || b instanceof BlockGravel + || b instanceof BlockSand + || b instanceof BlockStone && !(b instanceof BlockObsidian) && !(b == Blocks.end_stone); + if (!flag) { + ItemStack stk = new ItemStack(b, 1, w.getBlockMetadata(x, y, z)); + if (OreDictionary.getOreIDs(stk) != null && OreDictionary.getOreIDs(stk).length > 0) { + OreDict: + for (int i = 0; i < OreDictionary.getOreIDs(stk).length; ++i) { + int id = OreDictionary.getOreIDs(stk)[i]; + if (id != -1) { + String ore = OreDictionary.getOreName(id); + if (ore != null && !ore.isEmpty()) { + flag = ore.contains("dirt") + || ore.contains("grass") + || ore.contains("sand") + || ore.contains("gravel") + || ore.contains("stone"); + if (flag) break OreDict; + } + } + } + } + } + if (flag) { + double random = rnd.nextDouble(); + Block setTo = random <= 0.9D ? Blocks.end_stone : Blocks.obsidian; + w.setBlock(x, y, z, setTo, 0, 3); + break; + } + } + } + } + } } - + @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) - { - return 0xffffff; + public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { + return 0xffffff; } - - //getSaplingDropRate - protected int func_150123_b(int meta) - { + + // getSaplingDropRate + protected int func_150123_b(int meta) { return meta == 0 ? 50 : 30; } - - //dropRareItem - protected void func_150124_c(World w, int x, int y, int z, int meta, int chance) - { - if (meta == 0 && w.rand.nextInt(chance) == 0) - { + + // dropRareItem + protected void func_150124_c(World w, int x, int y, int z, int meta, int chance) { + if (meta == 0 && w.rand.nextInt(chance) == 0) { this.dropBlockAsItem(w, x, y, z, new ItemStack(Items.golden_apple, 1, 0)); } } - + @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return icons[meta % 8]; + public IIcon getIcon(int side, int meta) { + return icons[meta % 8]; } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item i, CreativeTabs p_149666_2_, List p_149666_3_) - { - for(int f = 0; f < names.length; ++f) - p_149666_3_.add(new ItemStack(i,1,f)); - } - + + @SuppressWarnings({"unchecked", "rawtypes"}) @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - for(int i = 0; i < icons.length; ++i) - icons[i] = reg.registerIcon(TBCore.modid+":"+textures[i]); - - blockIcon = reg.registerIcon(getTextureName()); + public void getSubBlocks(Item i, CreativeTabs p_149666_2_, List p_149666_3_) { + for (int f = 0; f < names.length; ++f) p_149666_3_.add(new ItemStack(i, 1, f)); } - + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + for (int i = 0; i < icons.length; ++i) icons[i] = reg.registerIcon(TBCore.modid + ":" + textures[i]); + + blockIcon = reg.registerIcon(getTextureName()); + } + @Override - public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) - { - if(world.getBlockMetadata(x, y, z)%8 == 1) - return new ArrayList(); - else - return super.onSheared(item, world, x, y, z, fortune); + public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) { + if (world.getBlockMetadata(x, y, z) % 8 == 1) return new ArrayList(); + else return super.onSheared(item, world, x, y, z, fortune); } - } diff --git a/src/main/java/tb/common/block/BlockTBLog.java b/src/main/java/tb/common/block/BlockTBLog.java index 9b6e0bf..a89680f 100644 --- a/src/main/java/tb/common/block/BlockTBLog.java +++ b/src/main/java/tb/common/block/BlockTBLog.java @@ -1,10 +1,8 @@ package tb.common.block; -import java.util.List; - -import tb.core.TBCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.BlockOldLog; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -16,87 +14,63 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import tb.core.TBCore; -public class BlockTBLog extends BlockOldLog{ - - public static final String[] names = new String[]{ - "peacefullTreeLog", - "netherTreeLog", - "enderTreeLog" - }; - - public static final String[] textures = new String[]{ - "peacefullTree/log", - "netherTree/log", - "enderTree/log" - }; - - public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) - { - if(world.getBlockMetadata(x, y, z)%4==2) - if(entity instanceof EntityDragon) - return false; - - return super.canEntityDestroy(world, x, y, z, entity); +public class BlockTBLog extends BlockOldLog { + + public static final String[] names = new String[] {"peacefullTreeLog", "netherTreeLog", "enderTreeLog"}; + + public static final String[] textures = new String[] {"peacefullTree/log", "netherTree/log", "enderTree/log"}; + + public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) { + if (world.getBlockMetadata(x, y, z) % 4 == 2) if (entity instanceof EntityDragon) return false; + + return super.canEntityDestroy(world, x, y, z, entity); } - - public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) - { - if(world.getBlockMetadata(x, y, z)%4==1) - return true; - - return super.isFlammable(world, x, y, z, face); + + public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + if (world.getBlockMetadata(x, y, z) % 4 == 1) return true; + + return super.isFlammable(world, x, y, z, face); } - - public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) - { - if(world.getBlockMetadata(x, y, z)%4==1) - return 0; - - return super.getFlammability(world, x, y, z, face); + + public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + if (world.getBlockMetadata(x, y, z) % 4 == 1) return 0; + + return super.getFlammability(world, x, y, z, face); } - - public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) - { - if(world.getBlockMetadata(x, y, z)%4==1) - return 0; - - return super.getFlammability(world, x, y, z, face); + + public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + if (world.getBlockMetadata(x, y, z) % 4 == 1) return 0; + + return super.getFlammability(world, x, y, z, face); } - - public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) - { - if(world.getBlockMetadata(x, y, z)%4==1) - return true; - - return super.isFireSource(world, x, y, z, side); + + public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) { + if (world.getBlockMetadata(x, y, z) % 4 == 1) return true; + + return super.isFireSource(world, x, y, z, side); } - - public BlockTBLog() - { - super(); - this.setHarvestLevel("axe", 0); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item itm, CreativeTabs tab, List lst) - { - for(int i = 0; i < names.length; ++i) - lst.add(new ItemStack(itm,1,i)); + + public BlockTBLog() { + super(); + this.setHarvestLevel("axe", 0); } - + + @SuppressWarnings({"rawtypes", "unchecked"}) @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { + public void getSubBlocks(Item itm, CreativeTabs tab, List lst) { + for (int i = 0; i < names.length; ++i) lst.add(new ItemStack(itm, 1, i)); + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { this.field_150167_a = new IIcon[textures.length]; this.field_150166_b = new IIcon[textures.length]; - for (int i = 0; i < textures.length; ++i) - { - this.field_150167_a[i] = reg.registerIcon(TBCore.modid+":"+textures[i]); - this.field_150166_b[i] = reg.registerIcon(TBCore.modid+":"+textures[i] + "_top"); + for (int i = 0; i < textures.length; ++i) { + this.field_150167_a[i] = reg.registerIcon(TBCore.modid + ":" + textures[i]); + this.field_150166_b[i] = reg.registerIcon(TBCore.modid + ":" + textures[i] + "_top"); } } - } diff --git a/src/main/java/tb/common/block/BlockTBPlant.java b/src/main/java/tb/common/block/BlockTBPlant.java index 20df636..35479e6 100644 --- a/src/main/java/tb/common/block/BlockTBPlant.java +++ b/src/main/java/tb/common/block/BlockTBPlant.java @@ -1,17 +1,15 @@ package tb.common.block; -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 net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; @@ -19,74 +17,62 @@ import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.util.ForgeDirection; -public class BlockTBPlant extends BlockBush implements IGrowable -{ - - public int growthStages; - public int growthDelay; - public boolean requiresFarmland; - public IIcon[] growthIcons; - public ItemStack dropItem; - public ItemStack dropSeed; +public class BlockTBPlant extends BlockBush implements IGrowable { - public BlockTBPlant(int stages, int delay, boolean isCrop) - { - super(); - growthStages = stages; - growthDelay = delay; - requiresFarmland = isCrop; + public int growthStages; + public int growthDelay; + public boolean requiresFarmland; + public IIcon[] growthIcons; + public ItemStack dropItem; + public ItemStack dropSeed; + + public BlockTBPlant(int stages, int delay, boolean isCrop) { + super(); + growthStages = stages; + growthDelay = delay; + requiresFarmland = isCrop; this.setTickRandomly(true); float f = 0.5F; - if(isCrop) - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); - else - this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.75F, 0.75F); - + if (isCrop) this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); + else this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.75F, 0.75F); + this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.disableStats(); - } - + } + @SideOnly(Side.CLIENT) - public Item getItem(World w, int x, int y, int z) - { + public Item getItem(World w, int x, int y, int z) { return dropSeed != null ? dropSeed.getItem() : Item.getItemFromBlock(this); } - - protected boolean canPlaceBlockOn(Block b) - { + + protected boolean canPlaceBlockOn(Block b) { return requiresFarmland ? b == Blocks.farmland : true; } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { + + public void updateTick(World w, int x, int y, int z, Random rnd) { super.updateTick(w, x, y, z, rnd); - if (w.getBlockLightValue(x, y + 1, z) >= 9) - { + if (w.getBlockLightValue(x, y + 1, z) >= 9) { int l = w.getBlockMetadata(x, y, z); - if (l < growthStages) - { + if (l < growthStages) { float f = this.calculateGrowth(w, x, y, z); - if (rnd.nextInt((int)((float)growthDelay / f) + 1) == 0) - { + if (rnd.nextInt((int) ((float) growthDelay / f) + 1) == 0) { ++l; w.setBlockMetadataWithNotify(x, y, z, l, 2); } } } } - + @Override - public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) - { - return this.requiresFarmland ? EnumPlantType.Crop : EnumPlantType.Plains; + public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) { + return this.requiresFarmland ? EnumPlantType.Crop : EnumPlantType.Plains; } - - private float calculateGrowth(World w, int x, int y, int z) - { + + private float calculateGrowth(World w, int x, int y, int z) { float f = 1.0F; Block block = w.getBlock(x, y, z - 1); Block block1 = w.getBlock(x, y, z + 1); @@ -100,24 +86,19 @@ public class BlockTBPlant extends BlockBush implements IGrowable boolean flag1 = block == this || block1 == this; boolean flag2 = block4 == this || block5 == this || block6 == this || block7 == this; - for (int l = x - 1; l <= x + 1; ++l) - { - for (int i1 = z - 1; i1 <= z + 1; ++i1) - { + for (int l = x - 1; l <= x + 1; ++l) { + for (int i1 = z - 1; i1 <= z + 1; ++i1) { float f1 = 0.0F; - if (w.getBlock(l, y - 1, i1).canSustainPlant(w, l, y - 1, i1, ForgeDirection.UP, this)) - { + if (w.getBlock(l, y - 1, i1).canSustainPlant(w, l, y - 1, i1, ForgeDirection.UP, this)) { f1 = 1.0F; - if (w.getBlock(l, y - 1, i1).isFertile(w, l, y - 1, i1)) - { + if (w.getBlock(l, y - 1, i1).isFertile(w, l, y - 1, i1)) { f1 = 3.0F; } } - if (l != x || i1 != z) - { + if (l != x || i1 != z) { f1 /= 4.0F; } @@ -125,73 +106,61 @@ public class BlockTBPlant extends BlockBush implements IGrowable } } - if (flag2 || flag && flag1) - { + if (flag2 || flag && flag1) { f /= 2.0F; } return f; } - - //canApplyBonemeal - @Override - public boolean func_149851_a(World w, int x,int y, int z, boolean remote) { - return w.getBlockMetadata(x, y, z) < growthStages-1; - } - //canGrowPlant - @Override - public boolean func_149852_a(World w, Random r, int x, int y, int z) { - return w.getBlockLightValue(x, y + 1, z) >= 9; - } + // canApplyBonemeal + @Override + public boolean func_149851_a(World w, int x, int y, int z, boolean remote) { + return w.getBlockMetadata(x, y, z) < growthStages - 1; + } - //growPlant - @Override - public void func_149853_b(World w, Random r,int x, int y, int z) - { - w.setBlockMetadataWithNotify(x, y, z, Math.min(growthStages-1, w.getBlockMetadata(x, y, z)+r.nextInt(3)+1), 3); - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - growthIcons = new IIcon[growthStages]; - for(int i = 0; i < growthStages; ++i) - growthIcons[i] = reg.registerIcon(textureName+"stage_"+i); + // canGrowPlant + @Override + public boolean func_149852_a(World w, Random r, int x, int y, int z) { + return w.getBlockLightValue(x, y + 1, z) >= 9; } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return growthIcons[meta >= growthIcons.length ? growthIcons.length-1 : meta]; + + // growPlant + @Override + public void func_149853_b(World w, Random r, int x, int y, int z) { + w.setBlockMetadataWithNotify( + x, y, z, Math.min(growthStages - 1, w.getBlockMetadata(x, y, z) + r.nextInt(3) + 1), 3); } - - public int getRenderType() - { + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + growthIcons = new IIcon[growthStages]; + for (int i = 0; i < growthStages; ++i) growthIcons[i] = reg.registerIcon(textureName + "stage_" + i); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return growthIcons[meta >= growthIcons.length ? growthIcons.length - 1 : meta]; + } + + public int getRenderType() { return requiresFarmland ? 6 : 1; } @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 = new ArrayList(); - if (metadata >= growthStages-1) - { - for (int i = 0; i < 1 + world.rand.nextInt(fortune+1); ++i) //Change for the resource drop + if (metadata >= growthStages - 1) { + for (int i = 0; i < 1 + world.rand.nextInt(fortune + 1); ++i) // Change for the resource drop { - if (world.rand.nextInt(growthStages) <= metadata) - { - if(dropItem != null) - ret.add(dropItem.copy()); + if (world.rand.nextInt(growthStages) <= metadata) { + if (dropItem != null) ret.add(dropItem.copy()); } } } - if(dropSeed != null) - ret.add(dropSeed.copy()); + if (dropSeed != null) ret.add(dropSeed.copy()); return ret; } - - } diff --git a/src/main/java/tb/common/block/BlockTBSapling.java b/src/main/java/tb/common/block/BlockTBSapling.java index 65b041e..4cc7e05 100644 --- a/src/main/java/tb/common/block/BlockTBSapling.java +++ b/src/main/java/tb/common/block/BlockTBSapling.java @@ -1,13 +1,9 @@ package tb.common.block; -import java.util.List; -import java.util.Random; - -import tb.common.event.WorldGenBigOak; -import tb.common.event.WorldGenOak; -import tb.init.TBBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.BlockSapling; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -16,92 +12,73 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import tb.common.event.WorldGenBigOak; +import tb.common.event.WorldGenOak; +import tb.init.TBBlocks; -public class BlockTBSapling extends BlockSapling{ +public class BlockTBSapling extends BlockSapling { + + public IIcon[] icons = new IIcon[8]; + public static final String[] names = + new String[] {"goldenOakSapling", "peacefullTreeSapling", "netherTreeSapling", "enderTreeSapling"}; + + public static final String[] textures = new String[] { + "thaumicbases:goldenOak/sapling", + "thaumicbases:peacefullTree/sapling", + "thaumicbases:netherTree/sapling", + "thaumicbases:enderTree/sapling" + }; - public IIcon[] icons = new IIcon[8]; - public static final String[] names = new String[]{ - "goldenOakSapling", - "peacefullTreeSapling", - "netherTreeSapling", - "enderTreeSapling" - }; - - public static final String[] textures = new String[]{ - "thaumicbases:goldenOak/sapling", - "thaumicbases:peacefullTree/sapling", - "thaumicbases:netherTree/sapling", - "thaumicbases:enderTree/sapling" - }; - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return icons[meta%8]; + public IIcon getIcon(int side, int meta) { + return icons[meta % 8]; } - - //doGrowTree - public void func_149878_d(World w, int x, int y, int z, Random rnd) - { - int meta = w.getBlockMetadata(x, y, z)%8; - if(w.getBlockMetadata(x, y, z)%8 == 0) - { - if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(w, rnd, x, y, z)) - return; - - w.setBlockToAir(x, y, z); - - new WorldGenOak(true, 5, 0, 0, false, Blocks.log, TBBlocks.genLeaves).generate(w, rnd, x, y, z); - } - if(w.getBlockMetadata(x, y, z)%8 == 1) - { - if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(w, rnd, x, y, z)) - return; - - w.setBlockToAir(x, y, z); - - new WorldGenOak(true, 6, 0, 1, false, TBBlocks.genLogs, TBBlocks.genLeaves).generate(w, rnd, x, y, z); - } - if(w.getBlockMetadata(x, y, z)%8 == 2) - { - WorldGenBigOak tree = new WorldGenBigOak(true,6,1,2,1,TBBlocks.genLogs,TBBlocks.genLeaves); - - w.setBlockToAir(x, y, z); - - if(!tree.generate(w, rnd, x, y, z)) - w.setBlock(x, y, z, this, meta, 4); - } - if(w.getBlockMetadata(x, y, z)%8 == 3) - { - WorldGenBigOak tree = new WorldGenBigOak(true,4,2,3,3,TBBlocks.genLogs,TBBlocks.genLeaves); - - w.setBlockToAir(x, y, z); - - if(!tree.generate(w, rnd, x, y, z)) - w.setBlock(x, y, z, this, meta, 4); - } + + // doGrowTree + public void func_149878_d(World w, int x, int y, int z, Random rnd) { + int meta = w.getBlockMetadata(x, y, z) % 8; + if (w.getBlockMetadata(x, y, z) % 8 == 0) { + if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(w, rnd, x, y, z)) return; + + w.setBlockToAir(x, y, z); + + new WorldGenOak(true, 5, 0, 0, false, Blocks.log, TBBlocks.genLeaves).generate(w, rnd, x, y, z); + } + if (w.getBlockMetadata(x, y, z) % 8 == 1) { + if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(w, rnd, x, y, z)) return; + + w.setBlockToAir(x, y, z); + + new WorldGenOak(true, 6, 0, 1, false, TBBlocks.genLogs, TBBlocks.genLeaves).generate(w, rnd, x, y, z); + } + if (w.getBlockMetadata(x, y, z) % 8 == 2) { + WorldGenBigOak tree = new WorldGenBigOak(true, 6, 1, 2, 1, TBBlocks.genLogs, TBBlocks.genLeaves); + + w.setBlockToAir(x, y, z); + + if (!tree.generate(w, rnd, x, y, z)) w.setBlock(x, y, z, this, meta, 4); + } + if (w.getBlockMetadata(x, y, z) % 8 == 3) { + WorldGenBigOak tree = new WorldGenBigOak(true, 4, 2, 3, 3, TBBlocks.genLogs, TBBlocks.genLeaves); + + w.setBlockToAir(x, y, z); + + if (!tree.generate(w, rnd, x, y, z)) w.setBlock(x, y, z, this, meta, 4); + } } - - public int damageDropped(int meta) - { - return meta%8; + + public int damageDropped(int meta) { + return meta % 8; } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) - { - for(int i = 0; i < names.length; ++i) - p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); - } - + + @SuppressWarnings({"unchecked", "rawtypes"}) @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - for(int i = 0; i < names.length; ++i) - icons[i] = reg.registerIcon(textures[i]); + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { + for (int i = 0; i < names.length; ++i) p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + for (int i = 0; i < names.length; ++i) icons[i] = reg.registerIcon(textures[i]); } - - - } diff --git a/src/main/java/tb/common/block/BlockThaumicAnvil.java b/src/main/java/tb/common/block/BlockThaumicAnvil.java index 589da3a..4ebfd0f 100644 --- a/src/main/java/tb/common/block/BlockThaumicAnvil.java +++ b/src/main/java/tb/common/block/BlockThaumicAnvil.java @@ -1,7 +1,5 @@ package tb.common.block; -import tb.core.TBCore; -import thaumcraft.api.crafting.IInfusionStabiliser; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockAnvil; @@ -9,55 +7,48 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import tb.core.TBCore; +import thaumcraft.api.crafting.IInfusionStabiliser; + +public class BlockThaumicAnvil extends BlockAnvil implements IInfusionStabiliser { -public class BlockThaumicAnvil extends BlockAnvil implements IInfusionStabiliser -{ - public static final String[] anvilDamageNames = new String[] {"intact", "slightlyDamaged", "veryDamaged"}; private static final String[] anvilIconNames = new String[] {"top_damaged_0", "top_damaged_1", "top_damaged_2"}; + @SideOnly(Side.CLIENT) private IIcon[] anvilIcons; @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - if (this.anvilRenderSide == 3 && p_149691_1_ == 1) - { + public IIcon getIcon(int p_149691_1_, int p_149691_2_) { + if (this.anvilRenderSide == 3 && p_149691_1_ == 1) { int k = (p_149691_2_ >> 2) % this.anvilIcons.length; return this.anvilIcons[k]; - } - else - { + } else { return this.blockIcon; } } - + @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(this.getTextureName()+"base"); + public void registerBlockIcons(IIconRegister p_149651_1_) { + this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "base"); this.anvilIcons = new IIcon[anvilIconNames.length]; - for (int i = 0; i < this.anvilIcons.length; ++i) - { - this.anvilIcons[i] = p_149651_1_.registerIcon(this.getTextureName()+anvilIconNames[i]); + for (int i = 0; i < this.anvilIcons.length; ++i) { + this.anvilIcons[i] = p_149651_1_.registerIcon(this.getTextureName() + anvilIconNames[i]); } } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) - { - if(w.isRemote) - return true; - - p.openGui(TBCore.instance, 0x421921, w, x, y, z); - - return true; + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { + if (w.isRemote) return true; + + p.openGui(TBCore.instance, 0x421921, w, x, y, z); + + return true; + } + + @Override + public boolean canStabaliseInfusion(World w, int x, int y, int z) { + return true; } - - @Override - public boolean canStabaliseInfusion(World w, int x,int y, int z) - { - return true; - } - } diff --git a/src/main/java/tb/common/block/BlockVoid.java b/src/main/java/tb/common/block/BlockVoid.java index 61b29d1..1b6af81 100644 --- a/src/main/java/tb/common/block/BlockVoid.java +++ b/src/main/java/tb/common/block/BlockVoid.java @@ -1,39 +1,31 @@ package tb.common.block; import java.util.Random; - -import thaumcraft.api.crafting.IInfusionStabiliser; -import thaumcraft.common.Thaumcraft; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; +import thaumcraft.api.crafting.IInfusionStabiliser; +import thaumcraft.common.Thaumcraft; -public class BlockVoid extends Block implements IInfusionStabiliser{ +public class BlockVoid extends Block implements IInfusionStabiliser { - public BlockVoid() - { - super(Material.iron); - this.setTickRandomly(true); - this.setHardness(5); - this.setResistance(Float.MAX_VALUE); - this.setHarvestLevel("pickaxe", 3); - this.setBlockTextureName("thaumicbases:voidblock"); - } - - public void randomDisplayTick(World w, int x, int y, int z, Random r) - { - Thaumcraft.proxy.sparkle(x+r.nextFloat(), y+r.nextFloat(), z+r.nextFloat(), 2, 5, -0.1F); - } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { - + public BlockVoid() { + super(Material.iron); + this.setTickRandomly(true); + this.setHardness(5); + this.setResistance(Float.MAX_VALUE); + this.setHarvestLevel("pickaxe", 3); + this.setBlockTextureName("thaumicbases:voidblock"); } - @Override - public boolean canStabaliseInfusion(World w, int x,int y, int z) - { - return true; - } + public void randomDisplayTick(World w, int x, int y, int z, Random r) { + Thaumcraft.proxy.sparkle(x + r.nextFloat(), y + r.nextFloat(), z + r.nextFloat(), 2, 5, -0.1F); + } + public void updateTick(World w, int x, int y, int z, Random rnd) {} + + @Override + public boolean canStabaliseInfusion(World w, int x, int y, int z) { + return true; + } } diff --git a/src/main/java/tb/common/block/BlockVoidAnvil.java b/src/main/java/tb/common/block/BlockVoidAnvil.java index 5bb7324..465f5f6 100644 --- a/src/main/java/tb/common/block/BlockVoidAnvil.java +++ b/src/main/java/tb/common/block/BlockVoidAnvil.java @@ -1,92 +1,78 @@ package tb.common.block; -import java.util.Random; - -import tb.core.TBCore; -import thaumcraft.api.crafting.IInfusionStabiliser; -import thaumcraft.common.Thaumcraft; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockAnvil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import tb.core.TBCore; +import thaumcraft.api.crafting.IInfusionStabiliser; +import thaumcraft.common.Thaumcraft; + +public class BlockVoidAnvil extends BlockAnvil implements IInfusionStabiliser { -public class BlockVoidAnvil extends BlockAnvil implements IInfusionStabiliser -{ - public static final String[] anvilDamageNames = new String[] {"intact", "slightlyDamaged", "veryDamaged"}; private static final String[] anvilIconNames = new String[] {"top_damaged_0", "top_damaged_1", "top_damaged_2"}; + @SideOnly(Side.CLIENT) private IIcon[] anvilIcons; - public BlockVoidAnvil() - { - super(); - this.setHardness(12); - this.setResistance(Float.MAX_VALUE); - this.setTickRandomly(true); - this.setStepSound(Block.soundTypeAnvil); - this.setHarvestLevel("pickaxe", 3); + public BlockVoidAnvil() { + super(); + this.setHardness(12); + this.setResistance(Float.MAX_VALUE); + this.setTickRandomly(true); + this.setStepSound(Block.soundTypeAnvil); + this.setHarvestLevel("pickaxe", 3); } - - public void updateTick(World w, int x, int y, int z, Random rnd) - { - super.updateTick(w, x, y, z, rnd); - int meta = w.getBlockMetadata(x, y, z); - if(meta / 4 > 0) - { - w.setBlockMetadataWithNotify(x, y, z, w.getBlockMetadata(x, y, z)-4, 3); - } + + public void updateTick(World w, int x, int y, int z, Random rnd) { + super.updateTick(w, x, y, z, rnd); + int meta = w.getBlockMetadata(x, y, z); + if (meta / 4 > 0) { + w.setBlockMetadataWithNotify(x, y, z, w.getBlockMetadata(x, y, z) - 4, 3); + } } - - public void randomDisplayTick(World w, int x, int y, int z, Random r) - { - Thaumcraft.proxy.sparkle(x+r.nextFloat(), y+r.nextFloat(), z+r.nextFloat(), 2, 5, -0.1F); + + public void randomDisplayTick(World w, int x, int y, int z, Random r) { + Thaumcraft.proxy.sparkle(x + r.nextFloat(), y + r.nextFloat(), z + r.nextFloat(), 2, 5, -0.1F); } - + @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - if (this.anvilRenderSide == 3 && p_149691_1_ == 1) - { + public IIcon getIcon(int p_149691_1_, int p_149691_2_) { + if (this.anvilRenderSide == 3 && p_149691_1_ == 1) { int k = (p_149691_2_ >> 2) % this.anvilIcons.length; return this.anvilIcons[k]; - } - else - { + } else { return this.blockIcon; } } - + @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(this.getTextureName()+"base"); + public void registerBlockIcons(IIconRegister p_149651_1_) { + this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "base"); this.anvilIcons = new IIcon[anvilIconNames.length]; - for (int i = 0; i < this.anvilIcons.length; ++i) - { - this.anvilIcons[i] = p_149651_1_.registerIcon(this.getTextureName()+anvilIconNames[i]); + for (int i = 0; i < this.anvilIcons.length; ++i) { + this.anvilIcons[i] = p_149651_1_.registerIcon(this.getTextureName() + anvilIconNames[i]); } } - - public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) - { - if(w.isRemote) - return true; - - p.openGui(TBCore.instance, 0x421920, w, x, y, z); - - return true; + + public boolean onBlockActivated( + World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { + if (w.isRemote) return true; + + p.openGui(TBCore.instance, 0x421920, w, x, y, z); + + return true; + } + + @Override + public boolean canStabaliseInfusion(World w, int x, int y, int z) { + return true; } - - @Override - public boolean canStabaliseInfusion(World w, int x,int y, int z) - { - return true; - } - } diff --git a/src/main/java/tb/common/block/TBBlock.java b/src/main/java/tb/common/block/TBBlock.java index 92ed21d..50e4ba3 100644 --- a/src/main/java/tb/common/block/TBBlock.java +++ b/src/main/java/tb/common/block/TBBlock.java @@ -1,7 +1,5 @@ package tb.common.block; -import tb.init.TBBlocks; -import thaumcraft.api.crafting.IInfusionStabiliser; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -10,50 +8,45 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import tb.init.TBBlocks; +import thaumcraft.api.crafting.IInfusionStabiliser; -public class TBBlock extends Block implements IInfusionStabiliser{ - - boolean isGlass; - boolean stabilise; - - public TBBlock(Material m,boolean b) - { - super(m); - isGlass = b; - } - - public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) - { - if(entity instanceof EntityDragon) - return this != TBBlocks.enderPlanks; - - return super.canEntityDestroy(world, x, y, z, entity); +public class TBBlock extends Block implements IInfusionStabiliser { + + boolean isGlass; + boolean stabilise; + + public TBBlock(Material m, boolean b) { + super(m); + isGlass = b; } - public Block stabilise() - { - stabilise = true; - return this; - } - - public boolean isOpaqueCube() - { + public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) { + if (entity instanceof EntityDragon) return this != TBBlocks.enderPlanks; + + return super.canEntityDestroy(world, x, y, z, entity); + } + + public Block stabilise() { + stabilise = true; + return this; + } + + public boolean isOpaqueCube() { return !isGlass; } - - public int getLightOpacity() - { + + public int getLightOpacity() { return isGlass ? 7 : 15; } - + @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return isGlass ? 1 : 0; } - @Override - public boolean canStabaliseInfusion(World world, int x, int y, int z) { - return stabilise; - } + @Override + public boolean canStabaliseInfusion(World world, int x, int y, int z) { + return stabilise; + } } diff --git a/src/main/java/tb/common/block/TBBlockDeco.java b/src/main/java/tb/common/block/TBBlockDeco.java index 0fdb98f..f32c9a4 100644 --- a/src/main/java/tb/common/block/TBBlockDeco.java +++ b/src/main/java/tb/common/block/TBBlockDeco.java @@ -1,7 +1,5 @@ package tb.common.block; -import tb.init.TBBlocks; -import thaumcraft.api.crafting.IInfusionStabiliser; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -10,40 +8,39 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import tb.init.TBBlocks; +import thaumcraft.api.crafting.IInfusionStabiliser; -public class TBBlockDeco extends Block { - - boolean isGlass; - - public TBBlockDeco(Material m,boolean b) - { - super(m); - isGlass = b; - } - - public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) - { - if(entity instanceof EntityDragon) - return this != TBBlocks.enderPlanks; - - return super.canEntityDestroy(world, x, y, z, entity); +public class TBBlockDeco extends Block implements IInfusionStabiliser { + + boolean isGlass; + + public TBBlockDeco(Material m, boolean b) { + super(m); + isGlass = b; } - - public boolean isOpaqueCube() - { + public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) { + if (entity instanceof EntityDragon) return this != TBBlocks.enderPlanks; + + return super.canEntityDestroy(world, x, y, z, entity); + } + + public boolean isOpaqueCube() { return !isGlass; } - - public int getLightOpacity() - { + + public int getLightOpacity() { return isGlass ? 7 : 15; } - + @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return isGlass ? 1 : 0; } + @Override + public boolean canStabaliseInfusion(World var1, int var2, int var3, int var4) { + return true; + } } diff --git a/src/main/java/tb/common/block/TBSidedBlock.java b/src/main/java/tb/common/block/TBSidedBlock.java index a754a90..f7427a7 100644 --- a/src/main/java/tb/common/block/TBSidedBlock.java +++ b/src/main/java/tb/common/block/TBSidedBlock.java @@ -8,22 +8,20 @@ import net.minecraft.util.IIcon; public class TBSidedBlock extends TBBlock { - public IIcon sideIcon; - - public TBSidedBlock(Material m, boolean b) { - super(m, b); - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 0 || side == 1 ? super.getIcon(side, meta) : sideIcon; + public IIcon sideIcon; + + public TBSidedBlock(Material m, boolean b) { + super(m, b); } @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - super.registerBlockIcons(reg); - sideIcon = reg.registerIcon(getTextureName()+"_side"); + public IIcon getIcon(int side, int meta) { + return side == 0 || side == 1 ? super.getIcon(side, meta) : sideIcon; + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + super.registerBlockIcons(reg); + sideIcon = reg.registerIcon(getTextureName() + "_side"); } } diff --git a/src/main/java/tb/common/enchantment/EnchantmentElderKnowledge.java b/src/main/java/tb/common/enchantment/EnchantmentElderKnowledge.java index ac6c9c1..6115e00 100644 --- a/src/main/java/tb/common/enchantment/EnchantmentElderKnowledge.java +++ b/src/main/java/tb/common/enchantment/EnchantmentElderKnowledge.java @@ -3,26 +3,24 @@ package tb.common.enchantment; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; -public class EnchantmentElderKnowledge extends Enchantment{ +public class EnchantmentElderKnowledge extends Enchantment { - public EnchantmentElderKnowledge(int id, int weight, EnumEnchantmentType type) - { - super(id, weight, type); - } + public EnchantmentElderKnowledge(int id, int weight, EnumEnchantmentType type) { + super(id, weight, type); + } - public int getMinEnchantability(int lvl) - { + public int getMinEnchantability(int lvl) { return 1 + lvl * 5; } - - public int getMaxLevel() - { + + public int getMaxLevel() { return 5; } - - public boolean canApplyTogether(Enchantment ench) - { - return !(ench instanceof EnchantmentElderKnowledge) && !(ench instanceof EnchantmentMagicTouch) && !(ench instanceof EnchantmentTainted) && !(ench instanceof EnchantmentVaporising); - } + public boolean canApplyTogether(Enchantment ench) { + return !(ench instanceof EnchantmentElderKnowledge) + && !(ench instanceof EnchantmentMagicTouch) + && !(ench instanceof EnchantmentTainted) + && !(ench instanceof EnchantmentVaporising); + } } diff --git a/src/main/java/tb/common/enchantment/EnchantmentEldritchBane.java b/src/main/java/tb/common/enchantment/EnchantmentEldritchBane.java index 6f20f5a..0f7b19d 100644 --- a/src/main/java/tb/common/enchantment/EnchantmentEldritchBane.java +++ b/src/main/java/tb/common/enchantment/EnchantmentEldritchBane.java @@ -4,26 +4,25 @@ import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentDamage; import net.minecraft.enchantment.EnumEnchantmentType; -public class EnchantmentEldritchBane extends Enchantment{ +public class EnchantmentEldritchBane extends Enchantment { - public EnchantmentEldritchBane(int id, int weight, EnumEnchantmentType type) - { - super(id, weight, type); - } - - public int getMaxLevel() - { + public EnchantmentEldritchBane(int id, int weight, EnumEnchantmentType type) { + super(id, weight, type); + } + + public int getMaxLevel() { return 5; } - - public int getMinEnchantability(int lvl) - { + + public int getMinEnchantability(int lvl) { return 1 + lvl * 5; } - - public boolean canApplyTogether(Enchantment ench) - { - return this != ench && ench != Enchantment.smite && ench != Enchantment.baneOfArthropods && ench != Enchantment.sharpness && !(ench instanceof EnchantmentDamage); - } + public boolean canApplyTogether(Enchantment ench) { + return this != ench + && ench != Enchantment.smite + && ench != Enchantment.baneOfArthropods + && ench != Enchantment.sharpness + && !(ench instanceof EnchantmentDamage); + } } diff --git a/src/main/java/tb/common/enchantment/EnchantmentHandler.java b/src/main/java/tb/common/enchantment/EnchantmentHandler.java index e179a03..d417834 100644 --- a/src/main/java/tb/common/enchantment/EnchantmentHandler.java +++ b/src/main/java/tb/common/enchantment/EnchantmentHandler.java @@ -1,8 +1,24 @@ package tb.common.enchantment; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import java.util.Iterator; import java.util.LinkedHashMap; - +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.item.ItemExpireEvent; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; import tb.init.TBEnchant; import tb.utils.TBUtils; import thaumcraft.api.ThaumcraftApi; @@ -21,199 +37,169 @@ import thaumcraft.common.items.ItemCrystalEssence; import thaumcraft.common.lib.research.ResearchManager; import thaumcraft.common.lib.research.ScanManager; import thaumcraft.common.tiles.TileNode; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.potion.PotionEffect; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.item.ItemExpireEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.living.LivingHurtEvent; public class EnchantmentHandler { - - @SuppressWarnings("unchecked") - @SubscribeEvent - public void itemExpire(ItemExpireEvent event) - { - if(event.entityItem != null && event.entityItem.getEntityItem() != null && !event.entityItem.worldObj.isRemote) - { - int x = MathHelper.floor_double(event.entityItem.posX); - int y = MathHelper.floor_double(event.entityItem.posY); - int z = MathHelper.floor_double(event.entityItem.posZ); - World w = event.entityItem.worldObj; - ItemStack is = event.entityItem.getEntityItem(); - Block b = w.getBlock(x, y, z); - if(b != null && b instanceof BlockAiry) - { - TileEntity t = w.getTileEntity(x, y, z); - if(t != null && t instanceof TileNode) - { - if(TileNode.class.cast(t).getNodeType() == NodeType.TAINTED) - { - if(is.getItem() instanceof ItemSword) - { - if(EnchantmentHelper.getEnchantmentLevel(TBEnchant.tainted.effectId, is) <= 0) - { - LinkedHashMap lhm = (LinkedHashMap)EnchantmentHelper.getEnchantments(is); - boolean canApply = true; - if(!lhm.isEmpty()) - { - Iterator $i = lhm.keySet().iterator(); - while($i.hasNext()) - { - int i = $i.next(); - if(i < Enchantment.enchantmentsList.length && Enchantment.enchantmentsList[i] != null) - { - Enchantment ench = Enchantment.enchantmentsList[i]; - if(!ench.canApplyTogether(TBEnchant.tainted)) - { - canApply = false; - break; - } - } - } - } - if(canApply) - { - is.addEnchantment(TBEnchant.tainted, 1+w.rand.nextInt(3)); - event.extraLife = 1000; - event.setCanceled(true); - } - } - } - } - } - } - } - } - - @SubscribeEvent - public void onMobDeath(LivingDeathEvent event) - { - if(event.entityLiving != null && !event.entityLiving.worldObj.isRemote && event.source != null && event.source.getSourceOfDamage() != null && event.source.getSourceOfDamage() instanceof EntityPlayer) - { - EntityPlayer player = EntityPlayer.class.cast(event.source.getSourceOfDamage()); - EntityLivingBase dyingMob = event.entityLiving; - ItemStack currentItem = player.getCurrentEquippedItem(); - if(currentItem != null) - { - if(EnchantmentHelper.getEnchantmentLevel(TBEnchant.elderKnowledge.effectId, currentItem) > 0) - { - int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.elderKnowledge.effectId, currentItem); - if(player.worldObj.rand.nextInt(Math.max(1, 7-enchLevel)) == 0) - { - EntityTags eTags = null; - for(int i = 0; i < ThaumcraftApi.scanEntities.size(); ++i) - { - EntityTags tags = ThaumcraftApi.scanEntities.get(i); - if(tags != null && EntityList.getEntityString(dyingMob) != null && EntityList.getEntityString(dyingMob).equalsIgnoreCase(tags.entityName)) - { - eTags = tags; - break; - } - } - if(eTags != null) - { - AspectList al = eTags.aspects; - for(int i = 0; i < al.size(); ++i) - { - TBUtils.addAspectToKnowledgePool(player, al.getAspects()[i], (short) 1); - if(player.worldObj.rand.nextBoolean()) - break; - } - } - } - } - if(EnchantmentHelper.getEnchantmentLevel(TBEnchant.magicTouch.effectId, currentItem) > 0) - { - int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.magicTouch.effectId, currentItem); - AspectList aspectsCompound = ScanManager.generateEntityAspects(dyingMob); - if ((aspectsCompound != null) && (aspectsCompound.size() > 0)) - { - AspectList aspects = ResearchManager.reduceToPrimals(aspectsCompound); - for(int i = 0; i < enchLevel; ++i) - { - for (Aspect aspect : aspects.getAspects()) - if (event.entityLiving.worldObj.rand.nextBoolean()) - { - EntityAspectOrb orb = new EntityAspectOrb(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, aspect, 1 + event.entityLiving.worldObj.rand.nextInt(aspects.getAmount(aspect))); - event.entityLiving.worldObj.spawnEntityInWorld(orb); - } - - if(player.worldObj.rand.nextBoolean()) - break; - } - } - } - if(EnchantmentHelper.getEnchantmentLevel(TBEnchant.vaporising.effectId, currentItem) > 0) - { - int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.vaporising.effectId, currentItem); - if(event.entity.worldObj.rand.nextInt(Math.max(1, 5 - enchLevel)) == 0) - { - AspectList aspects = ScanManager.generateEntityAspects(event.entityLiving); - if ((aspects != null) && (aspects.size() > 0)) - for (Aspect aspect : aspects.getAspects()) - { - if (!event.entity.worldObj.rand.nextBoolean()) - { - int size = 1 + event.entity.worldObj.rand.nextInt(aspects.getAmount(aspect)); - size = Math.max(1, size / 2); - ItemStack stack = new ItemStack(ConfigItems.itemCrystalEssence, size, 0); - ((ItemCrystalEssence)stack.getItem()).setAspects(stack, new AspectList().add(aspect, 1)); - EntityItem cEs = new EntityItem(event.entity.worldObj, event.entityLiving.posX, event.entityLiving.posY + event.entityLiving.getEyeHeight(), event.entityLiving.posZ, stack); - event.entity.worldObj.spawnEntityInWorld(cEs); - } - if(event.entity.worldObj.rand.nextInt(2+enchLevel) == 0) - break; - } - } - } - } - } - } - - @SubscribeEvent - public void onMobDamage(LivingHurtEvent event) - { - if(event.entityLiving != null && !event.entityLiving.worldObj.isRemote && event.source != null && event.source.getSourceOfDamage() != null && event.source.getSourceOfDamage() instanceof EntityPlayer) - { - EntityPlayer player = EntityPlayer.class.cast(event.source.getSourceOfDamage()); - EntityLivingBase mob = event.entityLiving; - ItemStack currentItem = player.getCurrentEquippedItem(); - if(currentItem != null) - { - if(mob instanceof EntityEnderman || mob instanceof IEldritchMob) - { - if(EnchantmentHelper.getEnchantmentLevel(TBEnchant.eldritchBane.effectId, currentItem) > 0) - { - int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.eldritchBane.effectId, currentItem); - event.ammount += enchLevel*5F; - } - } - if(EnchantmentHelper.getEnchantmentLevel(TBEnchant.tainted.effectId, currentItem) > 0) - { - int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.tainted.effectId, currentItem); - if(!(mob instanceof ITaintedMob)) - { - event.ammount += enchLevel*3F; - if(player.worldObj.rand.nextInt(Math.max(1,4-enchLevel)) == 0) - { - mob.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID,200,enchLevel-1,true)); - } - } - } - } - } - } + @SuppressWarnings("unchecked") + @SubscribeEvent + public void itemExpire(ItemExpireEvent event) { + if (event.entityItem != null + && event.entityItem.getEntityItem() != null + && !event.entityItem.worldObj.isRemote) { + int x = MathHelper.floor_double(event.entityItem.posX); + int y = MathHelper.floor_double(event.entityItem.posY); + int z = MathHelper.floor_double(event.entityItem.posZ); + World w = event.entityItem.worldObj; + ItemStack is = event.entityItem.getEntityItem(); + Block b = w.getBlock(x, y, z); + if (b != null && b instanceof BlockAiry) { + TileEntity t = w.getTileEntity(x, y, z); + if (t != null && t instanceof TileNode) { + if (TileNode.class.cast(t).getNodeType() == NodeType.TAINTED) { + if (is.getItem() instanceof ItemSword) { + if (EnchantmentHelper.getEnchantmentLevel(TBEnchant.tainted.effectId, is) <= 0) { + LinkedHashMap lhm = + (LinkedHashMap) EnchantmentHelper.getEnchantments(is); + boolean canApply = true; + if (!lhm.isEmpty()) { + Iterator $i = lhm.keySet().iterator(); + while ($i.hasNext()) { + int i = $i.next(); + if (i < Enchantment.enchantmentsList.length + && Enchantment.enchantmentsList[i] != null) { + Enchantment ench = Enchantment.enchantmentsList[i]; + if (!ench.canApplyTogether(TBEnchant.tainted)) { + canApply = false; + break; + } + } + } + } + if (canApply) { + is.addEnchantment(TBEnchant.tainted, 1 + w.rand.nextInt(3)); + event.extraLife = 1000; + event.setCanceled(true); + } + } + } + } + } + } + } + } + + @SubscribeEvent + public void onMobDeath(LivingDeathEvent event) { + if (event.entityLiving != null + && !event.entityLiving.worldObj.isRemote + && event.source != null + && event.source.getSourceOfDamage() != null + && event.source.getSourceOfDamage() instanceof EntityPlayer) { + EntityPlayer player = EntityPlayer.class.cast(event.source.getSourceOfDamage()); + EntityLivingBase dyingMob = event.entityLiving; + ItemStack currentItem = player.getCurrentEquippedItem(); + if (currentItem != null) { + if (EnchantmentHelper.getEnchantmentLevel(TBEnchant.elderKnowledge.effectId, currentItem) > 0) { + int enchLevel = + EnchantmentHelper.getEnchantmentLevel(TBEnchant.elderKnowledge.effectId, currentItem); + if (player.worldObj.rand.nextInt(Math.max(1, 7 - enchLevel)) == 0) { + EntityTags eTags = null; + for (int i = 0; i < ThaumcraftApi.scanEntities.size(); ++i) { + EntityTags tags = ThaumcraftApi.scanEntities.get(i); + if (tags != null + && EntityList.getEntityString(dyingMob) != null + && EntityList.getEntityString(dyingMob).equalsIgnoreCase(tags.entityName)) { + eTags = tags; + break; + } + } + if (eTags != null) { + AspectList al = eTags.aspects; + for (int i = 0; i < al.size(); ++i) { + TBUtils.addAspectToKnowledgePool(player, al.getAspects()[i], (short) 1); + if (player.worldObj.rand.nextBoolean()) break; + } + } + } + } + if (EnchantmentHelper.getEnchantmentLevel(TBEnchant.magicTouch.effectId, currentItem) > 0) { + int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.magicTouch.effectId, currentItem); + AspectList aspectsCompound = ScanManager.generateEntityAspects(dyingMob); + if ((aspectsCompound != null) && (aspectsCompound.size() > 0)) { + AspectList aspects = ResearchManager.reduceToPrimals(aspectsCompound); + for (int i = 0; i < enchLevel; ++i) { + for (Aspect aspect : aspects.getAspects()) + if (event.entityLiving.worldObj.rand.nextBoolean()) { + EntityAspectOrb orb = new EntityAspectOrb( + event.entityLiving.worldObj, + event.entityLiving.posX, + event.entityLiving.posY, + event.entityLiving.posZ, + aspect, + 1 + event.entityLiving.worldObj.rand.nextInt(aspects.getAmount(aspect))); + event.entityLiving.worldObj.spawnEntityInWorld(orb); + } + + if (player.worldObj.rand.nextBoolean()) break; + } + } + } + if (EnchantmentHelper.getEnchantmentLevel(TBEnchant.vaporising.effectId, currentItem) > 0) { + int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.vaporising.effectId, currentItem); + if (event.entity.worldObj.rand.nextInt(Math.max(1, 5 - enchLevel)) == 0) { + AspectList aspects = ScanManager.generateEntityAspects(event.entityLiving); + if ((aspects != null) && (aspects.size() > 0)) + for (Aspect aspect : aspects.getAspects()) { + if (!event.entity.worldObj.rand.nextBoolean()) { + int size = 1 + event.entity.worldObj.rand.nextInt(aspects.getAmount(aspect)); + size = Math.max(1, size / 2); + ItemStack stack = new ItemStack(ConfigItems.itemCrystalEssence, size, 0); + ((ItemCrystalEssence) stack.getItem()) + .setAspects(stack, new AspectList().add(aspect, 1)); + EntityItem cEs = new EntityItem( + event.entity.worldObj, + event.entityLiving.posX, + event.entityLiving.posY + event.entityLiving.getEyeHeight(), + event.entityLiving.posZ, + stack); + event.entity.worldObj.spawnEntityInWorld(cEs); + } + if (event.entity.worldObj.rand.nextInt(2 + enchLevel) == 0) break; + } + } + } + } + } + } + + @SubscribeEvent + public void onMobDamage(LivingHurtEvent event) { + if (event.entityLiving != null + && !event.entityLiving.worldObj.isRemote + && event.source != null + && event.source.getSourceOfDamage() != null + && event.source.getSourceOfDamage() instanceof EntityPlayer) { + EntityPlayer player = EntityPlayer.class.cast(event.source.getSourceOfDamage()); + EntityLivingBase mob = event.entityLiving; + ItemStack currentItem = player.getCurrentEquippedItem(); + if (currentItem != null) { + if (mob instanceof EntityEnderman || mob instanceof IEldritchMob) { + if (EnchantmentHelper.getEnchantmentLevel(TBEnchant.eldritchBane.effectId, currentItem) > 0) { + int enchLevel = + EnchantmentHelper.getEnchantmentLevel(TBEnchant.eldritchBane.effectId, currentItem); + event.ammount += enchLevel * 5F; + } + } + if (EnchantmentHelper.getEnchantmentLevel(TBEnchant.tainted.effectId, currentItem) > 0) { + int enchLevel = EnchantmentHelper.getEnchantmentLevel(TBEnchant.tainted.effectId, currentItem); + if (!(mob instanceof ITaintedMob)) { + event.ammount += enchLevel * 3F; + if (player.worldObj.rand.nextInt(Math.max(1, 4 - enchLevel)) == 0) { + mob.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 200, enchLevel - 1, true)); + } + } + } + } + } + } } diff --git a/src/main/java/tb/common/enchantment/EnchantmentMagicTouch.java b/src/main/java/tb/common/enchantment/EnchantmentMagicTouch.java index d15667a..1580e6b 100644 --- a/src/main/java/tb/common/enchantment/EnchantmentMagicTouch.java +++ b/src/main/java/tb/common/enchantment/EnchantmentMagicTouch.java @@ -3,20 +3,20 @@ package tb.common.enchantment; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; -public class EnchantmentMagicTouch extends Enchantment{ +public class EnchantmentMagicTouch extends Enchantment { - public EnchantmentMagicTouch(int id, int weight, EnumEnchantmentType type) - { - super(id, weight, type); - } - - public int getMaxLevel() - { + public EnchantmentMagicTouch(int id, int weight, EnumEnchantmentType type) { + super(id, weight, type); + } + + public int getMaxLevel() { return 3; } - - public boolean canApplyTogether(Enchantment ench) - { - return !(ench instanceof EnchantmentElderKnowledge) && !(ench instanceof EnchantmentMagicTouch) && !(ench instanceof EnchantmentTainted) && !(ench instanceof EnchantmentVaporising); + + public boolean canApplyTogether(Enchantment ench) { + return !(ench instanceof EnchantmentElderKnowledge) + && !(ench instanceof EnchantmentMagicTouch) + && !(ench instanceof EnchantmentTainted) + && !(ench instanceof EnchantmentVaporising); } } diff --git a/src/main/java/tb/common/enchantment/EnchantmentTainted.java b/src/main/java/tb/common/enchantment/EnchantmentTainted.java index a697ef6..46993d2 100644 --- a/src/main/java/tb/common/enchantment/EnchantmentTainted.java +++ b/src/main/java/tb/common/enchantment/EnchantmentTainted.java @@ -4,27 +4,26 @@ import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; -public class EnchantmentTainted extends Enchantment{ +public class EnchantmentTainted extends Enchantment { - public EnchantmentTainted(int id, int weight, EnumEnchantmentType type) - { - super(id, weight, type); - } + public EnchantmentTainted(int id, int weight, EnumEnchantmentType type) { + super(id, weight, type); + } - public int getMaxLevel() - { + public int getMaxLevel() { return 3; } - - public boolean canApplyTogether(Enchantment ench) - { - return !(ench instanceof EnchantmentElderKnowledge) && !(ench instanceof EnchantmentMagicTouch) && !(ench instanceof EnchantmentTainted) && !(ench instanceof EnchantmentVaporising); + + public boolean canApplyTogether(Enchantment ench) { + return !(ench instanceof EnchantmentElderKnowledge) + && !(ench instanceof EnchantmentMagicTouch) + && !(ench instanceof EnchantmentTainted) + && !(ench instanceof EnchantmentVaporising); } - //do I even want to know why this is here? - - public boolean canApply(ItemStack itemStack) - { - return false; + // do I even want to know why this is here? + + public boolean canApply(ItemStack itemStack) { + return false; } } diff --git a/src/main/java/tb/common/enchantment/EnchantmentVaporising.java b/src/main/java/tb/common/enchantment/EnchantmentVaporising.java index 1f61972..81bb48b 100644 --- a/src/main/java/tb/common/enchantment/EnchantmentVaporising.java +++ b/src/main/java/tb/common/enchantment/EnchantmentVaporising.java @@ -3,21 +3,20 @@ package tb.common.enchantment; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; -public class EnchantmentVaporising extends Enchantment{ +public class EnchantmentVaporising extends Enchantment { - public EnchantmentVaporising(int id, int weight, EnumEnchantmentType type) - { - super(id, weight, type); - } - - public int getMaxLevel() - { + public EnchantmentVaporising(int id, int weight, EnumEnchantmentType type) { + super(id, weight, type); + } + + public int getMaxLevel() { return 3; } - - public boolean canApplyTogether(Enchantment ench) - { - return !(ench instanceof EnchantmentElderKnowledge) && !(ench instanceof EnchantmentMagicTouch) && !(ench instanceof EnchantmentTainted) && !(ench instanceof EnchantmentVaporising); - } + public boolean canApplyTogether(Enchantment ench) { + return !(ench instanceof EnchantmentElderKnowledge) + && !(ench instanceof EnchantmentMagicTouch) + && !(ench instanceof EnchantmentTainted) + && !(ench instanceof EnchantmentVaporising); + } } diff --git a/src/main/java/tb/common/entity/EntityAIAvoidCampfire.java b/src/main/java/tb/common/entity/EntityAIAvoidCampfire.java index d0f19ee..b0ac9e8 100644 --- a/src/main/java/tb/common/entity/EntityAIAvoidCampfire.java +++ b/src/main/java/tb/common/entity/EntityAIAvoidCampfire.java @@ -8,82 +8,69 @@ import net.minecraft.pathfinding.PathNavigate; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class EntityAIAvoidCampfire extends EntityAIBase -{ - public boolean isScared; - public int scareTimer; - public int campfireX; - public int campfireY; - public int campfireZ; - public World worldObj; - public EntityCreature entityObj; +public class EntityAIAvoidCampfire extends EntityAIBase { + public boolean isScared; + public int scareTimer; + public int campfireX; + public int campfireY; + public int campfireZ; + public World worldObj; + public EntityCreature entityObj; /** The PathEntity of our entity */ private PathEntity entityPathEntity; /** The PathNavigate of our entity */ private PathNavigate entityPathNavigate; + private double farSpeed; private double nearSpeed; - public EntityAIAvoidCampfire(EntityCreature creature) - { - scareTimer = 100; - worldObj = creature.worldObj; - entityObj = creature; - this.setMutexBits(1); - this.entityPathNavigate = creature.getNavigator(); - nearSpeed = 2; - farSpeed = nearSpeed*2; - } - - @Override - public boolean shouldExecute() - { - if(isScared) - { - Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom(this.entityObj, 16, 10, Vec3.createVectorHelper(campfireX+0.5D, campfireY, campfireZ+0.5D)); - - if(vec3 == null) - return false; - + public EntityAIAvoidCampfire(EntityCreature creature) { + scareTimer = 100; + worldObj = creature.worldObj; + entityObj = creature; + this.setMutexBits(1); + this.entityPathNavigate = creature.getNavigator(); + nearSpeed = 2; + farSpeed = nearSpeed * 2; + } + + @Override + public boolean shouldExecute() { + if (isScared) { + Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom( + this.entityObj, 16, 10, Vec3.createVectorHelper(campfireX + 0.5D, campfireY, campfireZ + 0.5D)); + + if (vec3 == null) return false; + this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord); return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(vec3); - } - return false; - } - - public boolean continueExecuting() - { + } + return false; + } + + public boolean continueExecuting() { return !this.entityObj.getNavigator().noPath() && scareTimer > 0; } - - public void resetTask() - { - } - - public void updateTask() - { - if(entityPathNavigate != null && (entityPathNavigate.getPath() == null || entityPathNavigate.getPath() != entityPathEntity)) - { - this.entityPathNavigate.setPath(this.entityPathEntity, nearSpeed); - } - - --scareTimer; - if(scareTimer <= 0) - isScared = false; - - if (this.entityObj.getDistanceSq(campfireX+0.5D,campfireY,campfireZ+0.5D) < 49.0D) - { - this.entityObj.getNavigator().setSpeed(this.nearSpeed); + + public void resetTask() {} + + public void updateTask() { + if (entityPathNavigate != null + && (entityPathNavigate.getPath() == null || entityPathNavigate.getPath() != entityPathEntity)) { + this.entityPathNavigate.setPath(this.entityPathEntity, nearSpeed); } - else - { + + --scareTimer; + if (scareTimer <= 0) isScared = false; + + if (this.entityObj.getDistanceSq(campfireX + 0.5D, campfireY, campfireZ + 0.5D) < 49.0D) { + this.entityObj.getNavigator().setSpeed(this.nearSpeed); + } else { this.entityObj.getNavigator().setSpeed(this.farSpeed); } } - - public void startExecuting() - { - this.entityPathNavigate.setPath(this.entityPathEntity, nearSpeed); - } + public void startExecuting() { + this.entityPathNavigate.setPath(this.entityPathEntity, nearSpeed); + } } diff --git a/src/main/java/tb/common/entity/EntityRevolverBullet.java b/src/main/java/tb/common/entity/EntityRevolverBullet.java index 4b0db69..04b0635 100644 --- a/src/main/java/tb/common/entity/EntityRevolverBullet.java +++ b/src/main/java/tb/common/entity/EntityRevolverBullet.java @@ -1,11 +1,7 @@ package tb.common.entity; -import java.util.ArrayList; - import DummyCore.Utils.Pair; -import tb.api.RevolverUpgrade; -import tb.common.item.ItemRevolver; -import thaumcraft.common.Thaumcraft; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,163 +13,156 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.world.World; +import tb.api.RevolverUpgrade; +import tb.common.item.ItemRevolver; +import thaumcraft.common.Thaumcraft; -public class EntityRevolverBullet extends EntityThrowable -{ - public Entity shooter; - public ItemStack revolver; - ArrayList> upgrades; - boolean isPrimal; - - public EntityRevolverBullet(World w) - { - super(w); - } - - public EntityRevolverBullet(World w, EntityLivingBase shooter) - { - super(w, shooter); - revolver = shooter.getHeldItem(); - this.shooter = shooter; - if(revolver != null && revolver.getItem() instanceof ItemRevolver) - { - upgrades = ItemRevolver.getAllUpgradesFor(revolver); - boolean allowNoclip = false; - float speedIndex = 1; - for(Pair p : upgrades) - { - if(!allowNoclip) - allowNoclip = p.getFirst().bulletNoclip((EntityPlayer) shooter, revolver, p.getSecond()); - - speedIndex = (float) p.getFirst().modifySpeed((EntityPlayer) shooter, revolver, speedIndex, p.getSecond()); - - if(p.getFirst() == RevolverUpgrade.primal) - isPrimal = true; - } - if(allowNoclip) - noClip = true; - - this.motionX *=3; - this.motionY *=3; - this.motionZ *=3; - - this.motionX *= speedIndex; - this.motionY *= speedIndex; - this.motionZ *= speedIndex; - } - } - - public void onUpdate() - { - if(this.worldObj.isRemote) - Thaumcraft.proxy.sparkle((float)posX, (float)posY, (float)posZ, 4); - - if(this.worldObj.isRemote) - Thaumcraft.proxy.sparkle((float)(posX-motionX/20), (float)(posY-motionY/20), (float)(posZ-motionZ/20), 4); - - if(this.ticksExisted >= 200) //<- loop exit for primal - this.setDead(); - - super.onUpdate(); - - if(isPrimal && !isDead) - { - ++ticksExisted; - onUpdate(); //<- loop to turn into a hit-scan - } +public class EntityRevolverBullet extends EntityThrowable { + public Entity shooter; + public ItemStack revolver; + ArrayList> upgrades; + boolean isPrimal; + + public EntityRevolverBullet(World w) { + super(w); } - - protected float getGravityVelocity() - { + + public EntityRevolverBullet(World w, EntityLivingBase shooter) { + super(w, shooter); + revolver = shooter.getHeldItem(); + this.shooter = shooter; + if (revolver != null && revolver.getItem() instanceof ItemRevolver) { + upgrades = ItemRevolver.getAllUpgradesFor(revolver); + boolean allowNoclip = false; + float speedIndex = 1; + for (Pair p : upgrades) { + if (!allowNoclip) + allowNoclip = p.getFirst().bulletNoclip((EntityPlayer) shooter, revolver, p.getSecond()); + + speedIndex = + (float) p.getFirst().modifySpeed((EntityPlayer) shooter, revolver, speedIndex, p.getSecond()); + + if (p.getFirst() == RevolverUpgrade.primal) isPrimal = true; + } + if (allowNoclip) noClip = true; + + this.motionX *= 3; + this.motionY *= 3; + this.motionZ *= 3; + + this.motionX *= speedIndex; + this.motionY *= speedIndex; + this.motionZ *= speedIndex; + } + } + + public void onUpdate() { + if (this.worldObj.isRemote) Thaumcraft.proxy.sparkle((float) posX, (float) posY, (float) posZ, 4); + + if (this.worldObj.isRemote) + Thaumcraft.proxy.sparkle( + (float) (posX - motionX / 20), (float) (posY - motionY / 20), (float) (posZ - motionZ / 20), 4); + + if (this.ticksExisted >= 200) // <- loop exit for primal + this.setDead(); + + super.onUpdate(); + + if (isPrimal && !isDead) { + ++ticksExisted; + onUpdate(); // <- loop to turn into a hit-scan + } + } + + protected float getGravityVelocity() { return isPrimal ? 0 : 0.01F; } - @Override - protected void onImpact(MovingObjectPosition object) - { - if(this.isDead) - return; - - if(!this.worldObj.isRemote && object.typeOfHit == MovingObjectType.BLOCK) - { - if(noClip) - return; - if(this.worldObj.isBlockNormalCubeDefault(object.blockX, object.blockY, object.blockZ, true)) - this.setDead(); - else - { - Block b = this.worldObj.getBlock(object.blockX, object.blockY, object.blockZ); - int meta = this.worldObj.getBlockMetadata(object.blockX, object.blockY, object.blockZ); - - for(int i = 0; i < 100; ++i) - this.worldObj.spawnParticle("blockcrack_"+Block.getIdFromBlock(b)+"_"+meta, object.blockX+worldObj.rand.nextDouble(), object.blockY+worldObj.rand.nextDouble(), object.blockZ+worldObj.rand.nextDouble(), 0, 0, 0); - - worldObj.playSound(object.blockX+0.5D, object.blockY+0.5D, object.blockZ+0.5D, b.stepSound.getBreakSound(), 1, 1, false); - } - } - if(object.typeOfHit == MovingObjectType.ENTITY) - { - Entity e = object.entityHit; - if(e instanceof EntityLivingBase && e != this.shooter && !(e instanceof EntityRevolverBullet)) - { - EntityLivingBase elb = (EntityLivingBase) e; - float initialDamage = 14; - for(Pair p : upgrades) - initialDamage = p.getFirst().modifyDamage_start(elb, revolver, initialDamage, p.getSecond()); - - for(Pair p : upgrades) - initialDamage = p.getFirst().modifyDamage_end(elb, revolver, initialDamage, p.getSecond()); - - elb.attackEntityFrom(new RevolverDamage("revolver"), initialDamage); - - boolean destroy = true; - - for(Pair p : upgrades) - { - if(destroy) - destroy = p.getFirst().afterhit(elb, (EntityPlayer) shooter, revolver, initialDamage, p.getSecond()); - else - p.getFirst().afterhit(elb, (EntityPlayer) shooter, revolver, initialDamage, p.getSecond()); - } - - if(destroy) - this.setDead(); - } - } - } - - public static class RevolverDamage extends DamageSource - { + @Override + protected void onImpact(MovingObjectPosition object) { + if (this.isDead) return; - public RevolverDamage(String damage) { - super(damage); - } - - } + if (!this.worldObj.isRemote && object.typeOfHit == MovingObjectType.BLOCK) { + if (noClip) return; + if (this.worldObj.isBlockNormalCubeDefault(object.blockX, object.blockY, object.blockZ, true)) + this.setDead(); + else { + Block b = this.worldObj.getBlock(object.blockX, object.blockY, object.blockZ); + int meta = this.worldObj.getBlockMetadata(object.blockX, object.blockY, object.blockZ); - public void writeEntityToNBT(NBTTagCompound tag) - { - super.writeEntityToNBT(tag); - if(revolver != null) - { - NBTTagCompound revolverTag = new NBTTagCompound(); - revolver.writeToNBT(revolverTag); - tag.setTag("revolverTag", revolverTag); - } - tag.setBoolean("noclip", noClip); - tag.setBoolean("primal", isPrimal); + for (int i = 0; i < 100; ++i) + this.worldObj.spawnParticle( + "blockcrack_" + Block.getIdFromBlock(b) + "_" + meta, + object.blockX + worldObj.rand.nextDouble(), + object.blockY + worldObj.rand.nextDouble(), + object.blockZ + worldObj.rand.nextDouble(), + 0, + 0, + 0); + + worldObj.playSound( + object.blockX + 0.5D, + object.blockY + 0.5D, + object.blockZ + 0.5D, + b.stepSound.getBreakSound(), + 1, + 1, + false); + } + } + if (object.typeOfHit == MovingObjectType.ENTITY) { + Entity e = object.entityHit; + if (e instanceof EntityLivingBase && e != this.shooter && !(e instanceof EntityRevolverBullet)) { + EntityLivingBase elb = (EntityLivingBase) e; + float initialDamage = 14; + for (Pair p : upgrades) + initialDamage = p.getFirst().modifyDamage_start(elb, revolver, initialDamage, p.getSecond()); + + for (Pair p : upgrades) + initialDamage = p.getFirst().modifyDamage_end(elb, revolver, initialDamage, p.getSecond()); + + elb.attackEntityFrom(new RevolverDamage("revolver"), initialDamage); + + boolean destroy = true; + + for (Pair p : upgrades) { + if (destroy) + destroy = p.getFirst() + .afterhit(elb, (EntityPlayer) shooter, revolver, initialDamage, p.getSecond()); + else p.getFirst().afterhit(elb, (EntityPlayer) shooter, revolver, initialDamage, p.getSecond()); + } + + if (destroy) this.setDead(); + } + } } - - public void readEntityFromNBT(NBTTagCompound tag) - { - super.readEntityFromNBT(tag); - - if(tag.hasKey("revolverTag")) - { - revolver = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("revolverTag")); - upgrades = ItemRevolver.getAllUpgradesFor(revolver); - } - noClip = tag.getBoolean("noclip"); - isPrimal = tag.getBoolean("primal"); + + public static class RevolverDamage extends DamageSource { + + public RevolverDamage(String damage) { + super(damage); + } + } + + public void writeEntityToNBT(NBTTagCompound tag) { + super.writeEntityToNBT(tag); + if (revolver != null) { + NBTTagCompound revolverTag = new NBTTagCompound(); + revolver.writeToNBT(revolverTag); + tag.setTag("revolverTag", revolverTag); + } + tag.setBoolean("noclip", noClip); + tag.setBoolean("primal", isPrimal); + } + + public void readEntityFromNBT(NBTTagCompound tag) { + super.readEntityFromNBT(tag); + + if (tag.hasKey("revolverTag")) { + revolver = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("revolverTag")); + upgrades = ItemRevolver.getAllUpgradesFor(revolver); + } + noClip = tag.getBoolean("noclip"); + isPrimal = tag.getBoolean("primal"); } } diff --git a/src/main/java/tb/common/event/TBEventHandler.java b/src/main/java/tb/common/event/TBEventHandler.java index 375b7ea..6d92535 100644 --- a/src/main/java/tb/common/event/TBEventHandler.java +++ b/src/main/java/tb/common/event/TBEventHandler.java @@ -1,16 +1,12 @@ package tb.common.event; -import tb.common.item.ItemHerobrinesScythe; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.event.entity.player.PlayerEvent.NameFormat; - public class TBEventHandler { - /* - @SubscribeEvent - public void nameFormatEvent(NameFormat event) - { - if(event.entityPlayer != null && event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemHerobrinesScythe) - event.displayname = "Herobrine"; - } - */ + /* + @SubscribeEvent + public void nameFormatEvent(NameFormat event) + { + if(event.entityPlayer != null && event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemHerobrinesScythe) + event.displayname = "Herobrine"; + } + */ } diff --git a/src/main/java/tb/common/event/WorldGenBigOak.java b/src/main/java/tb/common/event/WorldGenBigOak.java index 4fae770..36710e9 100644 --- a/src/main/java/tb/common/event/WorldGenBigOak.java +++ b/src/main/java/tb/common/event/WorldGenBigOak.java @@ -1,18 +1,16 @@ package tb.common.event; import java.util.Random; - -import tb.init.TBBlocks; import net.minecraft.block.Block; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; +import tb.init.TBBlocks; -public class WorldGenBigOak extends WorldGenAbstractTree -{ - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; +public class WorldGenBigOak extends WorldGenAbstractTree { + 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}; @@ -27,37 +25,40 @@ public class WorldGenBigOak extends WorldGenAbstractTree int heightLimitLimit = 12; int leafDistanceLimit = 4; int[][] leafNodes; - public Block leavesBlock; - public Block trunkBlock; - public int leavesMeta; - public int trunkMeta; + public Block leavesBlock; + public Block trunkBlock; + public int leavesMeta; + public int trunkMeta; - public WorldGenBigOak(boolean doBlockNotify, int minHeight,int metaWood, int metaLeaves, int treeSize, Block tree, Block leaves) - { + public WorldGenBigOak( + boolean doBlockNotify, + int minHeight, + int metaWood, + int metaLeaves, + int treeSize, + Block tree, + Block leaves) { super(doBlockNotify); - trunkMeta = metaWood; - leavesMeta = metaLeaves; - leavesBlock = leaves; - trunkBlock = tree; - height = minHeight; + trunkMeta = metaWood; + leavesMeta = metaLeaves; + leavesBlock = leaves; + trunkBlock = tree; + height = minHeight; } /** * Generates a list of leaf nodes for the tree, to be populated by generateLeaves. */ - void generateLeafNodeList() - { - this.height = (int)((double)this.heightLimit * this.heightAttenuation); + void generateLeafNodeList() { + this.height = (int) ((double) this.heightLimit * this.heightAttenuation); - if (this.height >= this.heightLimit) - { + 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) - { + if (i < 1) { i = 1; } @@ -72,44 +73,35 @@ public class WorldGenBigOak extends WorldGenAbstractTree aint[0][3] = l; --j; - while (i1 >= 0) - { + while (i1 >= 0) { int j1 = 0; float f = this.layerSize(i1); - if (f < 0.0F) - { + if (f < 0.0F) { --j; --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); + } 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); int[] aint1 = new int[] {k1, j, l1}; int[] aint2 = new int[] {k1, j + this.leafDistanceLimit, l1}; - if (this.checkBlockLine(aint1, aint2) == -1) - { + 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); + } else { + aint3[1] = (int) ((double) aint1[1] - d4); } - if (this.checkBlockLine(aint3, aint1) == -1) - { + if (this.checkBlockLine(aint3, aint1) == -1) { aint[k][0] = k1; aint[k][1] = j; aint[k][2] = l1; @@ -128,9 +120,9 @@ public class WorldGenBigOak extends WorldGenAbstractTree 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 p_150529_6_) - { - 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 p_150529_6_) { + 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_}; @@ -138,31 +130,25 @@ public class WorldGenBigOak extends WorldGenAbstractTree int i1 = -l; int j1 = -l; - for (aint1[p_150529_5_] = aint[p_150529_5_]; i1 <= l; ++i1) - { + for (aint1[p_150529_5_] = aint[p_150529_5_]; i1 <= l; ++i1) { aint1[b1] = aint[b1] + i1; 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); + 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); - if (d0 > (double)(p_150529_4_ * p_150529_4_)) - { + if (d0 > (double) (p_150529_4_ * p_150529_4_)) { ++j1; - } - else - { + } 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], p_150529_6_, this.leavesMeta); + } else { + this.setBlockAndNotifyAdequately( + this.worldObj, aint1[0], aint1[1], aint1[2], p_150529_6_, this.leavesMeta); ++j1; } } @@ -173,29 +159,20 @@ public class WorldGenBigOak extends WorldGenAbstractTree /** * Gets the rough size of a layer of the tree. */ - float layerSize(int p_76490_1_) - { - if ((double)p_76490_1_ < (double)((float)this.heightLimit) * 0.3D) - { + float layerSize(int p_76490_1_) { + if ((double) p_76490_1_ < (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)p_76490_1_; + } else { + float f = (float) this.heightLimit / 2.0F; + float f1 = (float) this.heightLimit / 2.0F - (float) p_76490_1_; 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; @@ -203,79 +180,66 @@ public class WorldGenBigOak extends WorldGenAbstractTree } } - float leafSize(int p_76495_1_) - { - return p_76495_1_ >= 0 && p_76495_1_ < this.leafDistanceLimit ? (p_76495_1_ != 0 && p_76495_1_ != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; + float leafSize(int p_76495_1_) { + return p_76495_1_ >= 0 && p_76495_1_ < this.leafDistanceLimit + ? (p_76495_1_ != 0 && p_76495_1_ != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) + : -1.0F; } /** * Generates the leaves surrounding an individual entry in the leafNodes list. */ - void generateLeafNode(int p_76491_1_, int p_76491_2_, int p_76491_3_) - { + void generateLeafNode(int p_76491_1_, int p_76491_2_, int p_76491_3_) { int l = p_76491_2_; - for (int i1 = p_76491_2_ + this.leafDistanceLimit; l < i1; ++l) - { + for (int i1 = p_76491_2_ + this.leafDistanceLimit; l < i1; ++l) { float f = this.leafSize(l - p_76491_2_); - this.func_150529_a(p_76491_1_, l, p_76491_3_, f, (byte)1, this.leavesBlock); + this.func_150529_a(p_76491_1_, l, p_76491_3_, f, (byte) 1, this.leavesBlock); } } - void func_150530_a(int[] p_150530_1_, int[] p_150530_2_, Block p_150530_3_) - { + void func_150530_a(int[] p_150530_1_, int[] p_150530_2_, Block p_150530_3_) { int[] aint2 = new int[] {0, 0, 0}; byte b0 = 0; byte b1; - for (b1 = 0; b0 < 3; ++b0) - { + for (b1 = 0; b0 < 3; ++b0) { aint2[b0] = p_150530_2_[b0] - p_150530_1_[b0]; - if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) - { + if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) { b1 = b0; } } - if (aint2[b1] != 0) - { + if (aint2[b1] != 0) { byte b2 = otherCoordPairs[b1]; byte b3 = otherCoordPairs[b1 + 3]; byte b4; - if (aint2[b1] > 0) - { + if (aint2[b1] > 0) { b4 = 1; - } - else - { + } else { 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); + 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); byte b5 = (byte) this.trunkMeta; int k = Math.abs(aint3[0] - p_150530_1_[0]); int l = Math.abs(aint3[2] - p_150530_1_[2]); int i1 = Math.max(k, l); - if (i1 > 0) - { - if (k == i1) - { + if (i1 > 0) { + if (k == i1) { b5 += 4; - } - else if (l == i1) - { + } else if (l == i1) { b5 += 8; } } @@ -288,12 +252,10 @@ public class WorldGenBigOak extends WorldGenAbstractTree /** * Generates the leaf portion of the tree as specified by the leafNodes list. */ - void generateLeaves() - { + void generateLeaves() { int i = 0; - for (int j = this.leafNodes.length; i < j; ++i) - { + for (int j = this.leafNodes.length; i < j; ++i) { int k = this.leafNodes[i][0]; int l = this.leafNodes[i][1]; int i1 = this.leafNodes[i][2]; @@ -304,17 +266,15 @@ public class WorldGenBigOak extends WorldGenAbstractTree /** * Indicates whether or not a leaf node requires additional wood to be added to preserve integrity. */ - boolean leafNodeNeedsBase(int p_76493_1_) - { - return (double)p_76493_1_ >= (double)this.heightLimit * 0.2D; + boolean leafNodeNeedsBase(int p_76493_1_) { + return (double) p_76493_1_ >= (double) this.heightLimit * 0.2D; } /** * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a * field that is always 1 to 2. */ - void generateTrunk() - { + void generateTrunk() { int i = this.basePos[0]; int j = this.basePos[1]; int k = this.basePos[1] + this.height; @@ -323,8 +283,7 @@ public class WorldGenBigOak extends WorldGenAbstractTree int[] aint1 = new int[] {i, k, l}; this.func_150530_a(aint, aint1, this.trunkBlock); - if (this.trunkSize == 2) - { + if (this.trunkSize == 2) { ++aint[0]; ++aint1[0]; this.func_150530_a(aint, aint1, this.trunkBlock); @@ -340,20 +299,17 @@ public class WorldGenBigOak extends WorldGenAbstractTree /** * Generates additional wood blocks to fill out the bases of different leaf nodes that would otherwise degrade. */ - void generateLeafNodeBases() - { + void generateLeafNodeBases() { int i = 0; int j = this.leafNodes.length; - for (int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; i < j; ++i) - { + for (int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; i < j; ++i) { int[] aint1 = this.leafNodes[i]; int[] aint2 = new int[] {aint1[0], aint1[1], aint1[2]}; aint[1] = aint1[3]; int k = aint[1] - this.basePos[1]; - if (this.leafNodeNeedsBase(k)) - { + if (this.leafNodeNeedsBase(k)) { this.func_150530_a(aint, aint2, this.trunkBlock); } } @@ -363,54 +319,43 @@ public class WorldGenBigOak extends WorldGenAbstractTree * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. */ - int checkBlockLine(int[] p_76496_1_, int[] p_76496_2_) - { + int checkBlockLine(int[] p_76496_1_, int[] p_76496_2_) { int[] aint2 = new int[] {0, 0, 0}; byte b0 = 0; byte b1; - for (b1 = 0; b0 < 3; ++b0) - { + for (b1 = 0; b0 < 3; ++b0) { aint2[b0] = p_76496_2_[b0] - p_76496_1_[b0]; - if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) - { + if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) { b1 = b0; } } - if (aint2[b1] == 0) - { + if (aint2[b1] == 0) { return -1; - } - else - { + } else { byte b2 = otherCoordPairs[b1]; byte b3 = otherCoordPairs[b1 + 3]; byte b4; - if (aint2[b1] > 0) - { + if (aint2[b1] > 0) { b4 = 1; - } - else - { + } else { 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) - { + for (j = aint2[b1] + b4; i != j; i += b4) { aint3[b1] = p_76496_1_[b1] + i; - aint3[b2] = MathHelper.floor_double((double)p_76496_1_[b2] + (double)i * d0); - aint3[b3] = MathHelper.floor_double((double)p_76496_1_[b3] + (double)i * d1); - if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) - { + aint3[b2] = MathHelper.floor_double((double) p_76496_1_[b2] + (double) i * d0); + aint3[b3] = MathHelper.floor_double((double) p_76496_1_[b3] + (double) i * d1); + if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) { break; } } @@ -423,31 +368,23 @@ public class WorldGenBigOak extends WorldGenAbstractTree * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height * limit, is valid. */ - boolean validTreeLocation() - { + boolean validTreeLocation() { int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; 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, (IPlantable) TBBlocks.sapling); - if (!isSoil) - { + boolean isSoil = block.canSustainPlant( + worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (IPlantable) TBBlocks.sapling); + if (!isSoil) { return false; - } - else - { + } else { int i = this.checkBlockLine(aint, aint1); - if (i == -1) - { + if (i == -1) { return true; - } - else if (i < 6) - { + } else if (i < 6) { return false; - } - else - { + } else { this.heightLimit = i; return true; } @@ -457,12 +394,10 @@ public class WorldGenBigOak extends WorldGenAbstractTree /** * Rescales the generator settings, only used in WorldGenBigTree */ - public void setScale(double p_76487_1_, double p_76487_3_, double p_76487_5_) - { - this.heightLimitLimit = (int)(p_76487_1_ * 12.0D); + public void setScale(double p_76487_1_, double p_76487_3_, double p_76487_5_) { + this.heightLimitLimit = (int) (p_76487_1_ * 12.0D); - if (p_76487_1_ > 0.5D) - { + if (p_76487_1_ > 0.5D) { this.leafDistanceLimit = 5; } @@ -470,8 +405,7 @@ public class WorldGenBigOak extends WorldGenAbstractTree this.leafDensity = p_76487_5_; } - public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) - { + public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { this.worldObj = p_76484_1_; long l = p_76484_2_.nextLong(); this.rand.setSeed(l); @@ -479,24 +413,20 @@ public class WorldGenBigOak extends WorldGenAbstractTree this.basePos[1] = p_76484_4_; this.basePos[2] = p_76484_5_; - if (this.heightLimit == 0) - { + if (this.heightLimit == 0) { this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit); } - if (!this.validTreeLocation()) - { - this.worldObj = null; //Fix vanilla Mem leak, holds latest world + if (!this.validTreeLocation()) { + this.worldObj = null; // Fix vanilla Mem leak, holds latest world return false; - } - else - { + } else { this.generateLeafNodeList(); this.generateLeaves(); this.generateTrunk(); this.generateLeafNodeBases(); - this.worldObj = null; //Fix vanilla Mem leak, holds latest world + this.worldObj = null; // Fix vanilla Mem leak, holds latest world return true; } } -} \ No newline at end of file +} diff --git a/src/main/java/tb/common/event/WorldGenOak.java b/src/main/java/tb/common/event/WorldGenOak.java index 06a22b6..edaf072 100644 --- a/src/main/java/tb/common/event/WorldGenOak.java +++ b/src/main/java/tb/common/event/WorldGenOak.java @@ -1,7 +1,6 @@ package tb.common.event; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraft.init.Blocks; @@ -9,81 +8,72 @@ import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraftforge.common.util.ForgeDirection; -public class WorldGenOak extends WorldGenTrees{ - - public Block leavesBlock; - public Block trunkBlock; - public int leavesMeta; - public int trunkMeta; - public int minTreeHeight; +public class WorldGenOak extends WorldGenTrees { - public WorldGenOak(boolean doBlockNotify, int minHeight,int metaWood, int metaLeaves, boolean doVines, Block tree, Block leaves) { - super(doBlockNotify, minHeight, metaWood, metaLeaves, doVines); - trunkMeta = metaWood; - leavesMeta = metaLeaves; - leavesBlock = leaves; - trunkBlock = tree; - minTreeHeight = minHeight; - } - - public boolean generate(World w, Random rnd, int x, int y, int z) - { - int height = rnd.nextInt(3) + this.minTreeHeight; - boolean flag = true; - - if (y >= 1 && y + height + 1 <= 256) - { + public Block leavesBlock; + public Block trunkBlock; + public int leavesMeta; + public int trunkMeta; + public int minTreeHeight; + + public WorldGenOak( + boolean doBlockNotify, + int minHeight, + int metaWood, + int metaLeaves, + boolean doVines, + Block tree, + Block leaves) { + super(doBlockNotify, minHeight, metaWood, metaLeaves, doVines); + trunkMeta = metaWood; + leavesMeta = metaLeaves; + leavesBlock = leaves; + trunkBlock = tree; + minTreeHeight = minHeight; + } + + public boolean generate(World w, Random rnd, int x, int y, int z) { + int height = rnd.nextInt(3) + this.minTreeHeight; + boolean flag = true; + + if (y >= 1 && y + height + 1 <= 256) { byte b0; int k1; Block block; - - for (int i1 = y; i1 <= y + 1 + height; ++i1) - { + + for (int i1 = y; i1 <= y + 1 + height; ++i1) { b0 = 1; - if (i1 == y) - { + if (i1 == y) { b0 = 0; } - if (i1 >= y + 1 + height - 2) - { + if (i1 >= y + 1 + height - 2) { b0 = 2; } - for (int j1 = x - b0; j1 <= x + b0 && flag; ++j1) - { - for (k1 = z - b0; k1 <= z + b0 && flag; ++k1) - { - if (i1 >= 0 && i1 < 256) - { + for (int j1 = x - b0; j1 <= x + b0 && flag; ++j1) { + for (k1 = z - b0; k1 <= z + b0 && flag; ++k1) { + if (i1 >= 0 && i1 < 256) { block = w.getBlock(j1, i1, k1); - - if (!this.isReplaceable(w, j1, i1, k1)) - { + + if (!this.isReplaceable(w, j1, i1, k1)) { flag = false; } - } - else - { + } else { flag = false; } } } - - - - if (!flag) - { + + if (!flag) { return false; - } - else - { + } else { Block block2 = w.getBlock(x, y - 1, z); - boolean isSoil = block2.canSustainPlant(w, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling); - if (isSoil && y < 256 - height - 1) - { + boolean isSoil = + block2.canSustainPlant(w, x, y - 1, z, ForgeDirection.UP, (BlockSapling) Blocks.sapling); + if (isSoil && y < 256 - height - 1) { block2.onPlantGrow(w, x, y - 1, z, x, y, z); b0 = 3; byte b1 = 0; @@ -92,51 +82,42 @@ public class WorldGenOak extends WorldGenTrees{ int j2; int i3; - for (k1 = y - b0 + height; k1 <= y + height; ++k1) - { + for (k1 = y - b0 + height; k1 <= y + height; ++k1) { i3 = k1 - (y + height); l1 = b1 + 1 - i3 / 2; - for (i2 = x - l1; i2 <= x + l1; ++i2) - { + for (i2 = x - l1; i2 <= x + l1; ++i2) { j2 = i2 - x; - for (int k2 = z - l1; k2 <= z + l1; ++k2) - { + for (int k2 = z - l1; k2 <= z + l1; ++k2) { int l2 = k2 - z; - if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || rnd.nextInt(2) != 0 && i3 != 0) - { + if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || rnd.nextInt(2) != 0 && i3 != 0) { Block block1 = w.getBlock(i2, k1, k2); - if (block1.isAir(w, i2, k1, k2) || block1.isLeaves(w, i2, k1, k2)) - { - this.setBlockAndNotifyAdequately(w, i2, k1, k2, this.leavesBlock, this.leavesMeta); + if (block1.isAir(w, i2, k1, k2) || block1.isLeaves(w, i2, k1, k2)) { + this.setBlockAndNotifyAdequately( + w, i2, k1, k2, this.leavesBlock, this.leavesMeta); } } } } } - for (k1 = 0; k1 < height; ++k1) - { + for (k1 = 0; k1 < height; ++k1) { block = w.getBlock(x, y + k1, z); - if (block.isAir(w, x, y + k1, z) || block.isLeaves(w, x, y + k1, z)) - { + if (block.isAir(w, x, y + k1, z) || block.isLeaves(w, x, y + k1, z)) { this.setBlockAndNotifyAdequately(w, x, y + k1, z, this.trunkBlock, this.trunkMeta); } } - } - else - { + } else { return false; } } } } - - return false; - } + return false; + } } diff --git a/src/main/java/tb/common/inventory/ContainerOverchanter.java b/src/main/java/tb/common/inventory/ContainerOverchanter.java index 1e46a32..9e90066 100644 --- a/src/main/java/tb/common/inventory/ContainerOverchanter.java +++ b/src/main/java/tb/common/inventory/ContainerOverchanter.java @@ -2,71 +2,61 @@ package tb.common.inventory; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -public class ContainerOverchanter extends Container{ +public class ContainerOverchanter extends Container { - public ContainerOverchanter(InventoryPlayer playerInv, TileEntity blockInv) - { - this.addSlotToContainer(new Slot((IInventory) blockInv,0,80,20)); + public ContainerOverchanter(InventoryPlayer playerInv, TileEntity blockInv) { + this.addSlotToContainer(new Slot((IInventory) blockInv, 0, 80, 20)); 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(playerInv, 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(playerInv, i, 8 + i * 18, 142)); } - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return true; - } - - /* + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return true; + } + + /* public ItemStack transferStackInSlot(EntityPlayer p, int slot) { return null; } - - */ - - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) - { - ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(par2); - if ((slot != null) && (slot.getHasStack())) - { - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - if (par2 < 1) - { - if (!mergeItemStack(itemstack1, 1, this.inventorySlots.size(), true)) { - return null; - } - } - else if (!mergeItemStack(itemstack1, 0, 1, false)) { - return null; - } - if (itemstack1.stackSize == 0) { - slot.putStack((ItemStack)null); - } else { - slot.onSlotChanged(); - } - } - return itemstack; - } + */ + + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { + ItemStack itemstack = null; + Slot slot = (Slot) this.inventorySlots.get(par2); + if ((slot != null) && (slot.getHasStack())) { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + if (par2 < 1) { + if (!mergeItemStack(itemstack1, 1, this.inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(itemstack1, 0, 1, false)) { + return null; + } + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return itemstack; + } } diff --git a/src/main/java/tb/common/inventory/ContainerRevolver.java b/src/main/java/tb/common/inventory/ContainerRevolver.java index ea685ec..b437b66 100644 --- a/src/main/java/tb/common/inventory/ContainerRevolver.java +++ b/src/main/java/tb/common/inventory/ContainerRevolver.java @@ -9,210 +9,171 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public class ContainerRevolver extends Container -{ - public World worldObj; - public int x; - public int y; - public int z; - public IInventory input = new InventoryRevolver(this); - public ItemStack stack = null; - public EntityPlayer player = null; - - public int blockedSlot; +public class ContainerRevolver extends Container { + public World worldObj; + public int x; + public int y; + public int z; + public IInventory input = new InventoryRevolver(this); + public ItemStack stack = null; + public EntityPlayer player = null; - public ContainerRevolver(InventoryPlayer inv, World w, int ix, int iy, int iz) - { - this.worldObj = w; - this.x = ix; - this.y = iy; - this.z = iz; - this.player = inv.player; - this.stack = inv.getCurrentItem(); - this.blockedSlot = inv.currentItem + 28; + public int blockedSlot; - addSlotToContainer(new Slot(this.input, 0, 80, 32)); - - for (int i = 0; i < 3; i++) - for (int j = 0; j < 9; j++) - addSlotToContainer(new Slot(inv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - - for (int i = 0; i < 9; i++) - addSlotToContainer(new Slot(inv, i, 8 + i * 18, 142)); - - if (!w.isRemote) - { - try - { - ItemStack jar = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("jar")); - this.input.setInventorySlotContents(0, jar); - } - catch (Exception e) - { - //... - } - } - - onCraftMatrixChanged(this.input); - } + public ContainerRevolver(InventoryPlayer inv, World w, int ix, int iy, int iz) { + this.worldObj = w; + this.x = ix; + this.y = iy; + this.z = iz; + this.player = inv.player; + this.stack = inv.getCurrentItem(); + this.blockedSlot = inv.currentItem + 28; - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slot) - { - if (slot == this.blockedSlot) - return null; - - ItemStack stack = null; - Slot slotObject = (Slot)this.inventorySlots.get(slot); + addSlotToContainer(new Slot(this.input, 0, 80, 32)); - if (slotObject != null && slotObject.getHasStack()) - { - ItemStack stackInSlot = slotObject.getStack(); - stack = stackInSlot.copy(); + for (int i = 0; i < 3; i++) + for (int j = 0; j < 9; j++) addSlotToContainer(new Slot(inv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - if (slot == 0) - { - if (!this.input.isItemValidForSlot(slot, stackInSlot) || !mergeItemStack(stackInSlot, 1, this.inventorySlots.size(), true, 64)) - return null; - } - else if (!this.input.isItemValidForSlot(slot, stackInSlot) || !mergeItemStack(stackInSlot, 0, 1, false, 1)) - return null; - - if (stackInSlot.stackSize == 0) - slotObject.putStack(null); - else - slotObject.onSlotChanged(); - } - - return stack; - } + for (int i = 0; i < 9; i++) addSlotToContainer(new Slot(inv, i, 8 + i * 18, 142)); - public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) - { - if (par1 == this.blockedSlot) - return null; - - InventoryPlayer inventoryplayer = par4EntityPlayer.inventory; - if (par1 != 0 || this.input.isItemValidForSlot(par1, inventoryplayer.getItemStack()) || (par1 == 0 && inventoryplayer.getItemStack() == null)) - return super.slotClick(par1, par2, par3, par4EntityPlayer); - - return null; - } + if (!w.isRemote) { + try { + ItemStack jar = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("jar")); + this.input.setInventorySlotContents(0, jar); + } catch (Exception e) { + // ... + } + } - public boolean canInteractWith(EntityPlayer p) - { - return true; - } + onCraftMatrixChanged(this.input); + } - public void putStackInSlot(int slot, ItemStack stk) - { - if (this.input.isItemValidForSlot(slot, stk)) - super.putStackInSlot(slot, stk); - } + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slot) { + if (slot == this.blockedSlot) return null; - public void onContainerClosed(EntityPlayer p) - { - if (!this.worldObj.isRemote) - { - ItemStack var3 = this.input.getStackInSlotOnClosing(0); - if (var3 != null) - { - NBTTagCompound var4 = new NBTTagCompound(); - var3.writeToNBT(var4); - this.stack.setTagInfo("jar", var4); - this.stack.getTagCompound().setBoolean("hasJar", true); - } - else - { - this.stack.setTagInfo("jar", new NBTTagCompound()); - this.stack.getTagCompound().setBoolean("hasJar", false); - } - - if (this.player == null) - return; - - if (this.player.getHeldItem() != null && this.player.getHeldItem().isItemEqual(this.stack)) - this.player.setCurrentItemOrArmor(0, this.stack); - - this.player.inventory.markDirty(); - } - } + ItemStack stack = null; + Slot slotObject = (Slot) this.inventorySlots.get(slot); - protected boolean mergeItemStack(ItemStack par1ItemStack, int par2, int par3, boolean par4, int limit) - { - boolean var5 = false; - int var6 = par2; - - if (par4) - { - var6 = par3 - 1; - } + if (slotObject != null && slotObject.getHasStack()) { + ItemStack stackInSlot = slotObject.getStack(); + stack = stackInSlot.copy(); - if (par1ItemStack.isStackable()) - { - while (par1ItemStack.stackSize > 0 && ((!par4 && var6 < par3) || (par4 && var6 >= par2))) - { - Slot var7 = (Slot)this.inventorySlots.get(var6); - ItemStack var8 = var7.getStack(); + if (slot == 0) { + if (!this.input.isItemValidForSlot(slot, stackInSlot) + || !mergeItemStack(stackInSlot, 1, this.inventorySlots.size(), true, 64)) return null; + } else if (!this.input.isItemValidForSlot(slot, stackInSlot) + || !mergeItemStack(stackInSlot, 0, 1, false, 1)) return null; - if (var8 != null && var8.getItem() == par1ItemStack.getItem() && (!par1ItemStack.getHasSubtypes() || par1ItemStack.getItemDamage() == var8.getItemDamage()) && ItemStack.areItemStackTagsEqual(par1ItemStack, var8)) - { - int var9 = var8.stackSize + par1ItemStack.stackSize; + if (stackInSlot.stackSize == 0) slotObject.putStack(null); + else slotObject.onSlotChanged(); + } - if (var9 <= Math.min(par1ItemStack.getMaxStackSize(), limit)) - { - par1ItemStack.stackSize = 0; - var8.stackSize = var9; - var7.onSlotChanged(); - var5 = true; - } - else if (var8.stackSize < Math.min(par1ItemStack.getMaxStackSize(), limit)) - { - par1ItemStack.stackSize -= Math.min(par1ItemStack.getMaxStackSize(), limit) - var8.stackSize; - var8.stackSize = Math.min(par1ItemStack.getMaxStackSize(), limit); - var7.onSlotChanged(); - var5 = true; - } - } - if (par4) - { - var6--; - } - else - { - var6++; - } - } - } + return stack; + } - if (par1ItemStack.stackSize > 0) - { - if (par4) - var6 = par3 - 1; - else - var6 = par2; + public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) { + if (par1 == this.blockedSlot) return null; - while ((!par4 && var6 < par3) || (par4 && var6 >= par2)) - { - Slot var7 = (Slot)this.inventorySlots.get(var6); - ItemStack var8 = var7.getStack(); + InventoryPlayer inventoryplayer = par4EntityPlayer.inventory; + if (par1 != 0 + || this.input.isItemValidForSlot(par1, inventoryplayer.getItemStack()) + || (par1 == 0 && inventoryplayer.getItemStack() == null)) + return super.slotClick(par1, par2, par3, par4EntityPlayer); - if (var8 == null) - { - ItemStack res = par1ItemStack.copy(); - res.stackSize = Math.min(res.stackSize, limit); - var7.putStack(res); - var7.onSlotChanged(); - par1ItemStack.stackSize -= res.stackSize; - var5 = true; - break; - } + return null; + } - if (par4) - var6--; - else - var6++; - } - } - return var5; - } -} \ No newline at end of file + public boolean canInteractWith(EntityPlayer p) { + return true; + } + + public void putStackInSlot(int slot, ItemStack stk) { + if (this.input.isItemValidForSlot(slot, stk)) super.putStackInSlot(slot, stk); + } + + public void onContainerClosed(EntityPlayer p) { + if (!this.worldObj.isRemote) { + ItemStack var3 = this.input.getStackInSlotOnClosing(0); + if (var3 != null) { + NBTTagCompound var4 = new NBTTagCompound(); + var3.writeToNBT(var4); + this.stack.setTagInfo("jar", var4); + this.stack.getTagCompound().setBoolean("hasJar", true); + } else { + this.stack.setTagInfo("jar", new NBTTagCompound()); + this.stack.getTagCompound().setBoolean("hasJar", false); + } + + if (this.player == null) return; + + if (this.player.getHeldItem() != null && this.player.getHeldItem().isItemEqual(this.stack)) + this.player.setCurrentItemOrArmor(0, this.stack); + + this.player.inventory.markDirty(); + } + } + + protected boolean mergeItemStack(ItemStack par1ItemStack, int par2, int par3, boolean par4, int limit) { + boolean var5 = false; + int var6 = par2; + + if (par4) { + var6 = par3 - 1; + } + + if (par1ItemStack.isStackable()) { + while (par1ItemStack.stackSize > 0 && ((!par4 && var6 < par3) || (par4 && var6 >= par2))) { + Slot var7 = (Slot) this.inventorySlots.get(var6); + ItemStack var8 = var7.getStack(); + + if (var8 != null + && var8.getItem() == par1ItemStack.getItem() + && (!par1ItemStack.getHasSubtypes() || par1ItemStack.getItemDamage() == var8.getItemDamage()) + && ItemStack.areItemStackTagsEqual(par1ItemStack, var8)) { + int var9 = var8.stackSize + par1ItemStack.stackSize; + + if (var9 <= Math.min(par1ItemStack.getMaxStackSize(), limit)) { + par1ItemStack.stackSize = 0; + var8.stackSize = var9; + var7.onSlotChanged(); + var5 = true; + } else if (var8.stackSize < Math.min(par1ItemStack.getMaxStackSize(), limit)) { + par1ItemStack.stackSize -= Math.min(par1ItemStack.getMaxStackSize(), limit) - var8.stackSize; + var8.stackSize = Math.min(par1ItemStack.getMaxStackSize(), limit); + var7.onSlotChanged(); + var5 = true; + } + } + if (par4) { + var6--; + } else { + var6++; + } + } + } + + if (par1ItemStack.stackSize > 0) { + if (par4) var6 = par3 - 1; + else var6 = par2; + + while ((!par4 && var6 < par3) || (par4 && var6 >= par2)) { + Slot var7 = (Slot) this.inventorySlots.get(var6); + ItemStack var8 = var7.getStack(); + + if (var8 == null) { + ItemStack res = par1ItemStack.copy(); + res.stackSize = Math.min(res.stackSize, limit); + var7.putStack(res); + var7.onSlotChanged(); + par1ItemStack.stackSize -= res.stackSize; + var5 = true; + break; + } + + if (par4) var6--; + else var6++; + } + } + return var5; + } +} diff --git a/src/main/java/tb/common/inventory/ContainerThaumicAnvil.java b/src/main/java/tb/common/inventory/ContainerThaumicAnvil.java index e7c1ffb..ac63a30 100644 --- a/src/main/java/tb/common/inventory/ContainerThaumicAnvil.java +++ b/src/main/java/tb/common/inventory/ContainerThaumicAnvil.java @@ -1,13 +1,9 @@ package tb.common.inventory; -import java.util.Iterator; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import tb.init.TBBlocks; +import java.util.Iterator; +import java.util.Map; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; @@ -22,14 +18,14 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import org.apache.commons.lang3.StringUtils; +import tb.init.TBBlocks; -public class ContainerThaumicAnvil extends ContainerRepair{ +public class ContainerThaumicAnvil extends ContainerRepair { - private IInventory outputSlot = new InventoryCraftResult(); - private IInventory inputSlots = new InventoryBasic("Repair", true, 2) - { - public void markDirty() - { + private IInventory outputSlot = new InventoryCraftResult(); + private IInventory inputSlots = new InventoryBasic("Repair", true, 2) { + public void markDirty() { super.markDirty(); ContainerThaumicAnvil.this.onCraftMatrixChanged(this); } @@ -40,138 +36,124 @@ public class ContainerThaumicAnvil extends ContainerRepair{ private int x; private int y; private int z; - - public ContainerThaumicAnvil(InventoryPlayer inv, World w,int x, int y, int z,EntityPlayer p) - { - super(inv, w, x, y, z, p); - thePlayer = p; - - this.crafters.clear(); - this.inventoryItemStacks.clear(); - this.inventorySlots.clear(); - - this.w = w; - this.x = x; - this.y = y; - this.z = z; - - final World fw = w; - final int fx = x; - final int fy = y; - final int fz = z; - + + public ContainerThaumicAnvil(InventoryPlayer inv, World w, int x, int y, int z, EntityPlayer p) { + super(inv, w, x, y, z, p); + thePlayer = p; + + this.crafters.clear(); + this.inventoryItemStacks.clear(); + this.inventorySlots.clear(); + + this.w = w; + this.x = x; + this.y = y; + this.z = z; + + final World fw = w; + final int fx = x; + final int fy = y; + final int fz = z; + this.addSlotToContainer(new Slot(this.inputSlots, 0, 27, 47)); this.addSlotToContainer(new Slot(this.inputSlots, 1, 76, 47)); - this.addSlotToContainer(new Slot(this.outputSlot, 2, 134, 47) - { - public boolean isItemValid(ItemStack stk) - { + this.addSlotToContainer(new Slot(this.outputSlot, 2, 134, 47) { + public boolean isItemValid(ItemStack stk) { return false; } - - public boolean canTakeStack(EntityPlayer p_82869_1_) - { - return (p_82869_1_.capabilities.isCreativeMode || p_82869_1_.experienceLevel >= ContainerThaumicAnvil.this.maximumCost) && ContainerThaumicAnvil.this.maximumCost > 0 && this.getHasStack(); + + public boolean canTakeStack(EntityPlayer p_82869_1_) { + return (p_82869_1_.capabilities.isCreativeMode + || p_82869_1_.experienceLevel >= ContainerThaumicAnvil.this.maximumCost) + && ContainerThaumicAnvil.this.maximumCost > 0 + && this.getHasStack(); } - public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) - { - if (!p_82870_1_.capabilities.isCreativeMode) - { + + public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { + if (!p_82870_1_.capabilities.isCreativeMode) { p_82870_1_.addExperienceLevel(-ContainerThaumicAnvil.this.maximumCost); } - float breakChance = ForgeHooks.onAnvilRepair(p_82870_1_, p_82870_2_, ContainerThaumicAnvil.this.inputSlots.getStackInSlot(0), ContainerThaumicAnvil.this.inputSlots.getStackInSlot(1))/3; + float breakChance = ForgeHooks.onAnvilRepair( + p_82870_1_, + p_82870_2_, + ContainerThaumicAnvil.this.inputSlots.getStackInSlot(0), + ContainerThaumicAnvil.this.inputSlots.getStackInSlot(1)) + / 3; - ContainerThaumicAnvil.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); + ContainerThaumicAnvil.this.inputSlots.setInventorySlotContents(0, (ItemStack) null); - if (ContainerThaumicAnvil.this.stackSizeToBeUsedInRepair > 0) - { + if (ContainerThaumicAnvil.this.stackSizeToBeUsedInRepair > 0) { ItemStack itemstack1 = ContainerThaumicAnvil.this.inputSlots.getStackInSlot(1); - if (itemstack1 != null && itemstack1.stackSize > ContainerThaumicAnvil.this.stackSizeToBeUsedInRepair) - { + if (itemstack1 != null + && itemstack1.stackSize > ContainerThaumicAnvil.this.stackSizeToBeUsedInRepair) { itemstack1.stackSize -= ContainerThaumicAnvil.this.stackSizeToBeUsedInRepair; ContainerThaumicAnvil.this.inputSlots.setInventorySlotContents(1, itemstack1); + } else { + ContainerThaumicAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack) null); } - else - { - ContainerThaumicAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack)null); - } - } - else - { - ContainerThaumicAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack)null); + } else { + ContainerThaumicAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack) null); } ContainerThaumicAnvil.this.maximumCost = 0; - if (!p_82870_1_.capabilities.isCreativeMode && !fw.isRemote && fw.getBlock(fx, fy, fz) == TBBlocks.thaumicAnvil && p_82870_1_.getRNG().nextFloat() < breakChance) - { + if (!p_82870_1_.capabilities.isCreativeMode + && !fw.isRemote + && fw.getBlock(fx, fy, fz) == TBBlocks.thaumicAnvil + && p_82870_1_.getRNG().nextFloat() < breakChance) { int i1 = fw.getBlockMetadata(fx, fy, fz); int k = i1 & 3; int l = i1 >> 2; ++l; - if (l > 2) - { + if (l > 2) { fw.setBlockToAir(fx, fy, fz); fw.playAuxSFX(1020, fx, fy, fz, 0); - } - else - { + } else { fw.setBlockMetadataWithNotify(fx, fy, fz, k | l << 2, 2); fw.playAuxSFX(1021, fx, fy, fz, 0); } - } - else if (!fw.isRemote) - { + } else if (!fw.isRemote) { fw.playAuxSFX(1021, fx, fy, fz, 0); } } }); - + 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(inv, 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(inv, i, 8 + i * 18, 142)); } - } - - public void onCraftMatrixChanged(IInventory p_75130_1_) - { + } + + public void onCraftMatrixChanged(IInventory p_75130_1_) { super.onCraftMatrixChanged(p_75130_1_); - if (p_75130_1_ == this.inputSlots) - { + if (p_75130_1_ == this.inputSlots) { this.updateRepairOutput(); } } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void updateRepairOutput() - { + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void updateRepairOutput() { ItemStack itemstack = this.inputSlots.getStackInSlot(0); this.maximumCost = 0; int i = 0; byte b0 = 0; int j = 0; - if (itemstack == null) - { - this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + if (itemstack == null) { + this.outputSlot.setInventorySlotContents(0, (ItemStack) null); this.maximumCost = 0; - } - else - { + } else { ItemStack itemstack1 = itemstack.copy(); ItemStack itemstack2 = this.inputSlots.getStackInSlot(1); Map map = EnchantmentHelper.getEnchantments(itemstack1); @@ -186,24 +168,21 @@ public class ContainerThaumicAnvil extends ContainerRepair{ Iterator iterator1; Enchantment enchantment; - if (itemstack2 != null) - { + if (itemstack2 != null) { if (!ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, k2)) return; - flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.func_92110_g(itemstack2).tagCount() > 0; + flag = itemstack2.getItem() == Items.enchanted_book + && Items.enchanted_book.func_92110_g(itemstack2).tagCount() > 0; - if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) - { + if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) { k = Math.min(itemstack1.getItemDamageForDisplay(), itemstack1.getMaxDamage() / 4); - if (k <= 0) - { - this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + if (k <= 0) { + this.outputSlot.setInventorySlotContents(0, (ItemStack) null); this.maximumCost = 0; return; } - for (l = 0; k > 0 && l < itemstack2.stackSize; ++l) - { + for (l = 0; k > 0 && l < itemstack2.stackSize; ++l) { i1 = itemstack1.getItemDamageForDisplay() - k; itemstack1.setItemDamage(i1); i += Math.max(1, k / 100) + map.size(); @@ -211,31 +190,26 @@ public class ContainerThaumicAnvil extends ContainerRepair{ } this.stackSizeToBeUsedInRepair = l; - } - else - { - if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.isItemStackDamageable())) - { - this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + } else { + if (!flag + && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.isItemStackDamageable())) { + this.outputSlot.setInventorySlotContents(0, (ItemStack) null); this.maximumCost = 0; return; } - if (itemstack1.isItemStackDamageable() && !flag) - { + if (itemstack1.isItemStackDamageable() && !flag) { k = itemstack.getMaxDamage() - itemstack.getItemDamageForDisplay(); l = itemstack2.getMaxDamage() - itemstack2.getItemDamageForDisplay(); i1 = l + itemstack1.getMaxDamage() * 12 / 100; int j1 = k + i1; k1 = itemstack1.getMaxDamage() - j1; - if (k1 < 0) - { + if (k1 < 0) { k1 = 0; } - if (k1 < itemstack1.getItemDamage()) - { + if (k1 < itemstack1.getItemDamage()) { itemstack1.setItemDamage(k1); i += Math.max(1, i1 / 100); } @@ -244,21 +218,19 @@ public class ContainerThaumicAnvil extends ContainerRepair{ Map map1 = EnchantmentHelper.getEnchantments(itemstack2); iterator1 = map1.keySet().iterator(); - while (iterator1.hasNext()) - { - i1 = ((Integer)iterator1.next()).intValue(); + while (iterator1.hasNext()) { + i1 = ((Integer) iterator1.next()).intValue(); enchantment = Enchantment.enchantmentsList[i1]; - k1 = map.containsKey(Integer.valueOf(i1)) ? ((Integer)map.get(Integer.valueOf(i1))).intValue() : 0; - l1 = ((Integer)map1.get(Integer.valueOf(i1))).intValue(); + k1 = map.containsKey(Integer.valueOf(i1)) + ? ((Integer) map.get(Integer.valueOf(i1))).intValue() + : 0; + l1 = ((Integer) map1.get(Integer.valueOf(i1))).intValue(); int i3; - if (k1 == l1) - { + if (k1 == l1) { ++l1; i3 = l1; - } - else - { + } else { i3 = Math.max(l1, k1); } @@ -266,37 +238,36 @@ public class ContainerThaumicAnvil extends ContainerRepair{ int i2 = l1 - k1; boolean flag1 = enchantment.canApply(itemstack); - if (this.thePlayer.capabilities.isCreativeMode || itemstack.getItem() == Items.enchanted_book) - { + if (this.thePlayer.capabilities.isCreativeMode || itemstack.getItem() == Items.enchanted_book) { flag1 = true; } Iterator iterator = map.keySet().iterator(); - while (iterator.hasNext()) - { - int j2 = ((Integer)iterator.next()).intValue(); + while (iterator.hasNext()) { + int j2 = ((Integer) iterator.next()).intValue(); Enchantment e2 = Enchantment.enchantmentsList[j2]; - if (j2 != i1 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + if (j2 != i1 + && !(enchantment.canApplyTogether(e2) + && e2.canApplyTogether( + enchantment))) // Forge BugFix: Let Both enchantments veto being + // together { flag1 = false; i += i2; } } - if (flag1) - { - if (l1 > enchantment.getMaxLevel()) - { + if (flag1) { + if (l1 > enchantment.getMaxLevel()) { l1 = enchantment.getMaxLevel(); } map.put(Integer.valueOf(i1), Integer.valueOf(l1)); int l2 = 0; - switch (enchantment.getWeight()) - { + switch (enchantment.getWeight()) { case 1: l2 = 8; break; @@ -317,8 +288,7 @@ public class ContainerThaumicAnvil extends ContainerRepair{ l2 = 1; } - if (flag) - { + if (flag) { l2 = Math.max(1, l2 / 2); } @@ -328,22 +298,17 @@ public class ContainerThaumicAnvil extends ContainerRepair{ } } - if (StringUtils.isBlank(this.repairedItemName)) - { - if (itemstack.hasDisplayName()) - { + if (StringUtils.isBlank(this.repairedItemName)) { + if (itemstack.hasDisplayName()) { j = itemstack.isItemStackDamageable() ? 7 : itemstack.stackSize * 5; i += j; itemstack1.func_135074_t(); } - } - else if (!this.repairedItemName.equals(itemstack.getDisplayName())) - { + } else if (!this.repairedItemName.equals(itemstack.getDisplayName())) { j = itemstack.isItemStackDamageable() ? 7 : itemstack.stackSize * 5; i += j; - if (itemstack.hasDisplayName()) - { + if (itemstack.hasDisplayName()) { k2 += j / 2; } @@ -352,16 +317,14 @@ public class ContainerThaumicAnvil extends ContainerRepair{ k = 0; - for (iterator1 = map.keySet().iterator(); iterator1.hasNext(); k2 += k + k1 * l1) - { - i1 = ((Integer)iterator1.next()).intValue(); + for (iterator1 = map.keySet().iterator(); iterator1.hasNext(); k2 += k + k1 * l1) { + i1 = ((Integer) iterator1.next()).intValue(); enchantment = Enchantment.enchantmentsList[i1]; - k1 = ((Integer)map.get(Integer.valueOf(i1))).intValue(); + k1 = ((Integer) map.get(Integer.valueOf(i1))).intValue(); l1 = 0; ++k; - switch (enchantment.getWeight()) - { + switch (enchantment.getWeight()) { case 1: l1 = 8; break; @@ -382,14 +345,12 @@ public class ContainerThaumicAnvil extends ContainerRepair{ l1 = 1; } - if (flag) - { + if (flag) { l1 = Math.max(1, l1 / 2); } } - if (flag) - { + if (flag) { k2 = Math.max(1, k2 / 2); } @@ -397,42 +358,35 @@ public class ContainerThaumicAnvil extends ContainerRepair{ this.maximumCost = k2 + i; - if (i <= 0) - { + if (i <= 0) { itemstack1 = null; } - if (j == i && j > 0 && this.maximumCost >= 60) - { + if (j == i && j > 0 && this.maximumCost >= 60) { this.maximumCost = 59; } - if (this.maximumCost >= 60 && !this.thePlayer.capabilities.isCreativeMode) - { + if (this.maximumCost >= 60 && !this.thePlayer.capabilities.isCreativeMode) { itemstack1 = null; } - if (itemstack1 != null) - { + if (itemstack1 != null) { l = itemstack1.getRepairCost(); - if (itemstack2 != null && l < itemstack2.getRepairCost()) - { + if (itemstack2 != null && l < itemstack2.getRepairCost()) { l = itemstack2.getRepairCost(); } - if (itemstack1.hasDisplayName()) - { + if (itemstack1.hasDisplayName()) { l -= 9; } - if (l < 0) - { + if (l < 0) { l = 0; } l += 2; - + EnchantmentHelper.setEnchantments(map, itemstack1); } @@ -440,87 +394,69 @@ public class ContainerThaumicAnvil extends ContainerRepair{ this.detectAndSendChanges(); } } - - public void addCraftingToCrafters(ICrafting p_75132_1_) - { + + public void addCraftingToCrafters(ICrafting p_75132_1_) { super.addCraftingToCrafters(p_75132_1_); p_75132_1_.sendProgressBarUpdate(this, 0, this.maximumCost); } - + @SideOnly(Side.CLIENT) - public void updateProgressBar(int p_75137_1_, int p_75137_2_) - { - if (p_75137_1_ == 0) - { + public void updateProgressBar(int p_75137_1_, int p_75137_2_) { + if (p_75137_1_ == 0) { this.maximumCost = p_75137_2_; } } - - public void onContainerClosed(EntityPlayer p_75134_1_) - { + + public void onContainerClosed(EntityPlayer p_75134_1_) { super.onContainerClosed(p_75134_1_); - if (!this.w.isRemote) - { - for (int i = 0; i < this.inputSlots.getSizeInventory(); ++i) - { + if (!this.w.isRemote) { + for (int i = 0; i < this.inputSlots.getSizeInventory(); ++i) { ItemStack itemstack = this.inputSlots.getStackInSlotOnClosing(i); - if (itemstack != null) - { + if (itemstack != null) { p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); } } } } - - public boolean canInteractWith(EntityPlayer p_75145_1_) - { - return this.w.getBlock(this.x, this.y, this.z) != TBBlocks.thaumicAnvil ? false : p_75145_1_.getDistanceSq((double)this.x + 0.5D, (double)this.y + 0.5D, (double)this.z + 0.5D) <= 64.0D; + + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return this.w.getBlock(this.x, this.y, this.z) != TBBlocks.thaumicAnvil + ? false + : p_75145_1_.getDistanceSq((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) + <= 64.0D; } - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) - { + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(p_82846_2_); + Slot slot = (Slot) this.inventorySlots.get(p_82846_2_); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (p_82846_2_ == 2) - { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) - { + if (p_82846_2_ == 2) { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (p_82846_2_ != 0 && p_82846_2_ != 1) - { - if (p_82846_2_ >= 3 && p_82846_2_ < 39 && !this.mergeItemStack(itemstack1, 0, 2, false)) - { + } else if (p_82846_2_ != 0 && p_82846_2_ != 1) { + if (p_82846_2_ >= 3 && p_82846_2_ < 39 && !this.mergeItemStack(itemstack1, 0, 2, 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) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } @@ -529,26 +465,20 @@ public class ContainerThaumicAnvil extends ContainerRepair{ return itemstack; } - - public void updateItemName(String p_82850_1_) - { + + public void updateItemName(String p_82850_1_) { this.repairedItemName = p_82850_1_; - if (this.getSlot(2).getHasStack()) - { + if (this.getSlot(2).getHasStack()) { ItemStack itemstack = this.getSlot(2).getStack(); - if (StringUtils.isBlank(p_82850_1_)) - { + if (StringUtils.isBlank(p_82850_1_)) { itemstack.func_135074_t(); - } - else - { + } else { itemstack.setStackDisplayName(this.repairedItemName); } } this.updateRepairOutput(); } - } diff --git a/src/main/java/tb/common/inventory/ContainerVoidAnvil.java b/src/main/java/tb/common/inventory/ContainerVoidAnvil.java index b35b0cc..5252bd1 100644 --- a/src/main/java/tb/common/inventory/ContainerVoidAnvil.java +++ b/src/main/java/tb/common/inventory/ContainerVoidAnvil.java @@ -1,13 +1,9 @@ package tb.common.inventory; -import java.util.Iterator; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import tb.init.TBBlocks; +import java.util.Iterator; +import java.util.Map; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; @@ -22,14 +18,14 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import org.apache.commons.lang3.StringUtils; +import tb.init.TBBlocks; -public class ContainerVoidAnvil extends ContainerRepair{ +public class ContainerVoidAnvil extends ContainerRepair { - private IInventory outputSlot = new InventoryCraftResult(); - private IInventory inputSlots = new InventoryBasic("Repair", true, 2) - { - public void markDirty() - { + private IInventory outputSlot = new InventoryCraftResult(); + private IInventory inputSlots = new InventoryBasic("Repair", true, 2) { + public void markDirty() { super.markDirty(); ContainerVoidAnvil.this.onCraftMatrixChanged(this); } @@ -40,138 +36,123 @@ public class ContainerVoidAnvil extends ContainerRepair{ private int x; private int y; private int z; - - public ContainerVoidAnvil(InventoryPlayer inv, World w,int x, int y, int z,EntityPlayer p) - { - super(inv, w, x, y, z, p); - thePlayer = p; - - this.crafters.clear(); - this.inventoryItemStacks.clear(); - this.inventorySlots.clear(); - - this.w = w; - this.x = x; - this.y = y; - this.z = z; - - final World wrld = w; - final int ax = x; - final int ay = y; - final int az = z; - + + public ContainerVoidAnvil(InventoryPlayer inv, World w, int x, int y, int z, EntityPlayer p) { + super(inv, w, x, y, z, p); + thePlayer = p; + + this.crafters.clear(); + this.inventoryItemStacks.clear(); + this.inventorySlots.clear(); + + this.w = w; + this.x = x; + this.y = y; + this.z = z; + + final World wrld = w; + final int ax = x; + final int ay = y; + final int az = z; + this.addSlotToContainer(new Slot(this.inputSlots, 0, 27, 47)); this.addSlotToContainer(new Slot(this.inputSlots, 1, 76, 47)); - this.addSlotToContainer(new Slot(this.outputSlot, 2, 134, 47) - { - public boolean isItemValid(ItemStack stk) - { + this.addSlotToContainer(new Slot(this.outputSlot, 2, 134, 47) { + public boolean isItemValid(ItemStack stk) { return false; } - - public boolean canTakeStack(EntityPlayer p_82869_1_) - { - return (p_82869_1_.capabilities.isCreativeMode || p_82869_1_.experienceLevel >= ContainerVoidAnvil.this.maximumCost) && ContainerVoidAnvil.this.maximumCost > 0 && this.getHasStack(); + + public boolean canTakeStack(EntityPlayer p_82869_1_) { + return (p_82869_1_.capabilities.isCreativeMode + || p_82869_1_.experienceLevel >= ContainerVoidAnvil.this.maximumCost) + && ContainerVoidAnvil.this.maximumCost > 0 + && this.getHasStack(); } - public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) - { - if (!p_82870_1_.capabilities.isCreativeMode) - { + + public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { + if (!p_82870_1_.capabilities.isCreativeMode) { p_82870_1_.addExperienceLevel(-ContainerVoidAnvil.this.maximumCost); } - float breakChance = ForgeHooks.onAnvilRepair(p_82870_1_, p_82870_2_, ContainerVoidAnvil.this.inputSlots.getStackInSlot(0), ContainerVoidAnvil.this.inputSlots.getStackInSlot(1)); + float breakChance = ForgeHooks.onAnvilRepair( + p_82870_1_, + p_82870_2_, + ContainerVoidAnvil.this.inputSlots.getStackInSlot(0), + ContainerVoidAnvil.this.inputSlots.getStackInSlot(1)); - ContainerVoidAnvil.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); + ContainerVoidAnvil.this.inputSlots.setInventorySlotContents(0, (ItemStack) null); - if (ContainerVoidAnvil.this.stackSizeToBeUsedInRepair > 0) - { + if (ContainerVoidAnvil.this.stackSizeToBeUsedInRepair > 0) { ItemStack itemstack1 = ContainerVoidAnvil.this.inputSlots.getStackInSlot(1); - if (itemstack1 != null && itemstack1.stackSize > ContainerVoidAnvil.this.stackSizeToBeUsedInRepair) - { + if (itemstack1 != null + && itemstack1.stackSize > ContainerVoidAnvil.this.stackSizeToBeUsedInRepair) { itemstack1.stackSize -= ContainerVoidAnvil.this.stackSizeToBeUsedInRepair; ContainerVoidAnvil.this.inputSlots.setInventorySlotContents(1, itemstack1); + } else { + ContainerVoidAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack) null); } - else - { - ContainerVoidAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack)null); - } - } - else - { - ContainerVoidAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack)null); + } else { + ContainerVoidAnvil.this.inputSlots.setInventorySlotContents(1, (ItemStack) null); } ContainerVoidAnvil.this.maximumCost = 0; - if (!p_82870_1_.capabilities.isCreativeMode && !wrld.isRemote && wrld.getBlock(ax, ay, az) == TBBlocks.thaumicAnvil && p_82870_1_.getRNG().nextFloat() < breakChance) - { + if (!p_82870_1_.capabilities.isCreativeMode + && !wrld.isRemote + && wrld.getBlock(ax, ay, az) == TBBlocks.thaumicAnvil + && p_82870_1_.getRNG().nextFloat() < breakChance) { int i1 = wrld.getBlockMetadata(ax, ay, az); int k = i1 & 3; int l = i1 >> 2; ++l; - if (l > 2) - { - wrld.setBlockToAir(ax, ay, az); - wrld.playAuxSFX(1020, ax, ay, az, 0); + if (l > 2) { + wrld.setBlockToAir(ax, ay, az); + wrld.playAuxSFX(1020, ax, ay, az, 0); + } else { + wrld.setBlockMetadataWithNotify(ax, ay, az, k | l << 2, 2); + wrld.playAuxSFX(1021, ax, ay, az, 0); } - else - { - wrld.setBlockMetadataWithNotify(ax, ay, az, k | l << 2, 2); - wrld.playAuxSFX(1021, ax, ay, az, 0); - } - } - else if (!wrld.isRemote) - { - wrld.playAuxSFX(1021, ax, ay, az, 0); + } else if (!wrld.isRemote) { + wrld.playAuxSFX(1021, ax, ay, az, 0); } } }); - + 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(inv, 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(inv, i, 8 + i * 18, 142)); } - } - - public void onCraftMatrixChanged(IInventory p_75130_1_) - { + } + + public void onCraftMatrixChanged(IInventory p_75130_1_) { super.onCraftMatrixChanged(p_75130_1_); - if (p_75130_1_ == this.inputSlots) - { + if (p_75130_1_ == this.inputSlots) { this.updateRepairOutput(); } } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void updateRepairOutput() - { + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void updateRepairOutput() { ItemStack itemstack = this.inputSlots.getStackInSlot(0); this.maximumCost = 0; int i = 0; byte b0 = 0; int j = 0; - if (itemstack == null) - { - this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + if (itemstack == null) { + this.outputSlot.setInventorySlotContents(0, (ItemStack) null); this.maximumCost = 0; - } - else - { + } else { ItemStack itemstack1 = itemstack.copy(); ItemStack itemstack2 = this.inputSlots.getStackInSlot(1); Map map = EnchantmentHelper.getEnchantments(itemstack1); @@ -186,24 +167,21 @@ public class ContainerVoidAnvil extends ContainerRepair{ Iterator iterator1; Enchantment enchantment; - if (itemstack2 != null) - { + if (itemstack2 != null) { if (!ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, k2)) return; - flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.func_92110_g(itemstack2).tagCount() > 0; + flag = itemstack2.getItem() == Items.enchanted_book + && Items.enchanted_book.func_92110_g(itemstack2).tagCount() > 0; - if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) - { + if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) { k = Math.min(itemstack1.getItemDamageForDisplay(), itemstack1.getMaxDamage() / 4); - if (k <= 0) - { - this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + if (k <= 0) { + this.outputSlot.setInventorySlotContents(0, (ItemStack) null); this.maximumCost = 0; return; } - for (l = 0; k > 0 && l < itemstack2.stackSize; ++l) - { + for (l = 0; k > 0 && l < itemstack2.stackSize; ++l) { i1 = itemstack1.getItemDamageForDisplay() - k; itemstack1.setItemDamage(i1); i += Math.max(1, k / 100) + map.size(); @@ -211,31 +189,26 @@ public class ContainerVoidAnvil extends ContainerRepair{ } this.stackSizeToBeUsedInRepair = l; - } - else - { - if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.isItemStackDamageable())) - { - this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + } else { + if (!flag + && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.isItemStackDamageable())) { + this.outputSlot.setInventorySlotContents(0, (ItemStack) null); this.maximumCost = 0; return; } - if (itemstack1.isItemStackDamageable() && !flag) - { + if (itemstack1.isItemStackDamageable() && !flag) { k = itemstack.getMaxDamage() - itemstack.getItemDamageForDisplay(); l = itemstack2.getMaxDamage() - itemstack2.getItemDamageForDisplay(); i1 = l + itemstack1.getMaxDamage() * 12 / 100; int j1 = k + i1; k1 = itemstack1.getMaxDamage() - j1; - if (k1 < 0) - { + if (k1 < 0) { k1 = 0; } - if (k1 < itemstack1.getItemDamage()) - { + if (k1 < itemstack1.getItemDamage()) { itemstack1.setItemDamage(k1); i += Math.max(1, i1 / 100); } @@ -244,21 +217,19 @@ public class ContainerVoidAnvil extends ContainerRepair{ Map map1 = EnchantmentHelper.getEnchantments(itemstack2); iterator1 = map1.keySet().iterator(); - while (iterator1.hasNext()) - { - i1 = ((Integer)iterator1.next()).intValue(); + while (iterator1.hasNext()) { + i1 = ((Integer) iterator1.next()).intValue(); enchantment = Enchantment.enchantmentsList[i1]; - k1 = map.containsKey(Integer.valueOf(i1)) ? ((Integer)map.get(Integer.valueOf(i1))).intValue() : 0; - l1 = ((Integer)map1.get(Integer.valueOf(i1))).intValue(); + k1 = map.containsKey(Integer.valueOf(i1)) + ? ((Integer) map.get(Integer.valueOf(i1))).intValue() + : 0; + l1 = ((Integer) map1.get(Integer.valueOf(i1))).intValue(); int i3; - if (k1 == l1) - { + if (k1 == l1) { ++l1; i3 = l1; - } - else - { + } else { i3 = Math.max(l1, k1); } @@ -266,37 +237,36 @@ public class ContainerVoidAnvil extends ContainerRepair{ int i2 = l1 - k1; boolean flag1 = enchantment.canApply(itemstack); - if (this.thePlayer.capabilities.isCreativeMode || itemstack.getItem() == Items.enchanted_book) - { + if (this.thePlayer.capabilities.isCreativeMode || itemstack.getItem() == Items.enchanted_book) { flag1 = true; } Iterator iterator = map.keySet().iterator(); - while (iterator.hasNext()) - { - int j2 = ((Integer)iterator.next()).intValue(); + while (iterator.hasNext()) { + int j2 = ((Integer) iterator.next()).intValue(); Enchantment e2 = Enchantment.enchantmentsList[j2]; - if (j2 != i1 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + if (j2 != i1 + && !(enchantment.canApplyTogether(e2) + && e2.canApplyTogether( + enchantment))) // Forge BugFix: Let Both enchantments veto being + // together { flag1 = false; i += i2; } } - if (flag1) - { - if (l1 > enchantment.getMaxLevel()) - { + if (flag1) { + if (l1 > enchantment.getMaxLevel()) { l1 = enchantment.getMaxLevel(); } map.put(Integer.valueOf(i1), Integer.valueOf(l1)); int l2 = 0; - switch (enchantment.getWeight()) - { + switch (enchantment.getWeight()) { case 1: l2 = 8; break; @@ -317,8 +287,7 @@ public class ContainerVoidAnvil extends ContainerRepair{ l2 = 1; } - if (flag) - { + if (flag) { l2 = Math.max(1, l2 / 2); } @@ -328,22 +297,17 @@ public class ContainerVoidAnvil extends ContainerRepair{ } } - if (StringUtils.isBlank(this.repairedItemName)) - { - if (itemstack.hasDisplayName()) - { + if (StringUtils.isBlank(this.repairedItemName)) { + if (itemstack.hasDisplayName()) { j = itemstack.isItemStackDamageable() ? 7 : itemstack.stackSize * 5; i += j; itemstack1.func_135074_t(); } - } - else if (!this.repairedItemName.equals(itemstack.getDisplayName())) - { + } else if (!this.repairedItemName.equals(itemstack.getDisplayName())) { j = itemstack.isItemStackDamageable() ? 7 : itemstack.stackSize * 5; i += j; - if (itemstack.hasDisplayName()) - { + if (itemstack.hasDisplayName()) { k2 += j / 2; } @@ -352,16 +316,14 @@ public class ContainerVoidAnvil extends ContainerRepair{ k = 0; - for (iterator1 = map.keySet().iterator(); iterator1.hasNext(); k2 += k + k1 * l1) - { - i1 = ((Integer)iterator1.next()).intValue(); + for (iterator1 = map.keySet().iterator(); iterator1.hasNext(); k2 += k + k1 * l1) { + i1 = ((Integer) iterator1.next()).intValue(); enchantment = Enchantment.enchantmentsList[i1]; - k1 = ((Integer)map.get(Integer.valueOf(i1))).intValue(); + k1 = ((Integer) map.get(Integer.valueOf(i1))).intValue(); l1 = 0; ++k; - switch (enchantment.getWeight()) - { + switch (enchantment.getWeight()) { case 1: l1 = 8; break; @@ -382,14 +344,12 @@ public class ContainerVoidAnvil extends ContainerRepair{ l1 = 1; } - if (flag) - { + if (flag) { l1 = Math.max(1, l1 / 2); } } - if (flag) - { + if (flag) { k2 = Math.max(1, k2 / 2); } @@ -397,27 +357,23 @@ public class ContainerVoidAnvil extends ContainerRepair{ this.maximumCost = 3; - if (i <= 0) - { + if (i <= 0) { itemstack1 = null; } - if (itemstack1 != null) - { + if (itemstack1 != null) { l = 3; - if (itemstack1.hasDisplayName()) - { + if (itemstack1.hasDisplayName()) { l -= 9; } - if (l < 0) - { + if (l < 0) { l = 0; } l += 2; - + EnchantmentHelper.setEnchantments(map, itemstack1); } @@ -425,87 +381,69 @@ public class ContainerVoidAnvil extends ContainerRepair{ this.detectAndSendChanges(); } } - - public void addCraftingToCrafters(ICrafting p_75132_1_) - { + + public void addCraftingToCrafters(ICrafting p_75132_1_) { super.addCraftingToCrafters(p_75132_1_); p_75132_1_.sendProgressBarUpdate(this, 0, this.maximumCost); } - + @SideOnly(Side.CLIENT) - public void updateProgressBar(int p_75137_1_, int p_75137_2_) - { - if (p_75137_1_ == 0) - { + public void updateProgressBar(int p_75137_1_, int p_75137_2_) { + if (p_75137_1_ == 0) { this.maximumCost = p_75137_2_; } } - - public void onContainerClosed(EntityPlayer p_75134_1_) - { + + public void onContainerClosed(EntityPlayer p_75134_1_) { super.onContainerClosed(p_75134_1_); - if (!this.w.isRemote) - { - for (int i = 0; i < this.inputSlots.getSizeInventory(); ++i) - { + if (!this.w.isRemote) { + for (int i = 0; i < this.inputSlots.getSizeInventory(); ++i) { ItemStack itemstack = this.inputSlots.getStackInSlotOnClosing(i); - if (itemstack != null) - { + if (itemstack != null) { p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); } } } } - - public boolean canInteractWith(EntityPlayer p_75145_1_) - { - return this.w.getBlock(this.x, this.y, this.z) != TBBlocks.voidAnvil ? false : p_75145_1_.getDistanceSq((double)this.x + 0.5D, (double)this.y + 0.5D, (double)this.z + 0.5D) <= 64.0D; + + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return this.w.getBlock(this.x, this.y, this.z) != TBBlocks.voidAnvil + ? false + : p_75145_1_.getDistanceSq((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) + <= 64.0D; } - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) - { + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(p_82846_2_); + Slot slot = (Slot) this.inventorySlots.get(p_82846_2_); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (p_82846_2_ == 2) - { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) - { + if (p_82846_2_ == 2) { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (p_82846_2_ != 0 && p_82846_2_ != 1) - { - if (p_82846_2_ >= 3 && p_82846_2_ < 39 && !this.mergeItemStack(itemstack1, 0, 2, false)) - { + } else if (p_82846_2_ != 0 && p_82846_2_ != 1) { + if (p_82846_2_ >= 3 && p_82846_2_ < 39 && !this.mergeItemStack(itemstack1, 0, 2, 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) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } @@ -514,26 +452,20 @@ public class ContainerVoidAnvil extends ContainerRepair{ return itemstack; } - - public void updateItemName(String p_82850_1_) - { + + public void updateItemName(String p_82850_1_) { this.repairedItemName = p_82850_1_; - if (this.getSlot(2).getHasStack()) - { + if (this.getSlot(2).getHasStack()) { ItemStack itemstack = this.getSlot(2).getStack(); - if (StringUtils.isBlank(p_82850_1_)) - { + if (StringUtils.isBlank(p_82850_1_)) { itemstack.func_135074_t(); - } - else - { + } else { itemstack.setStackDisplayName(this.repairedItemName); } } this.updateRepairOutput(); } - } diff --git a/src/main/java/tb/common/inventory/InventoryRevolver.java b/src/main/java/tb/common/inventory/InventoryRevolver.java index d268c9e..694c99a 100644 --- a/src/main/java/tb/common/inventory/InventoryRevolver.java +++ b/src/main/java/tb/common/inventory/InventoryRevolver.java @@ -1,112 +1,93 @@ package tb.common.inventory; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.common.blocks.ItemJarFilled; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.blocks.ItemJarFilled; -public class InventoryRevolver implements IInventory -{ - public ItemStack[] inventory; - public Container revolverContainer; - - public InventoryRevolver(Container revolver) - { - this.inventory = new ItemStack[1]; - this.revolverContainer = revolver; - } - - public int getSizeInventory() - { - return 1; - } - - public ItemStack getStackInSlot(int slot) - { - return inventory[0]; - } - - public ItemStack getStackInSlotOnClosing(int slot) - { - if (this.inventory[0] != null) - { - ItemStack stk = this.inventory[0]; - this.inventory[0] = null; - return stk; - } - return null; - } - - public ItemStack decrStackSize(int slot, int amount) - { - if (inventory[0] != null) - { - if (inventory[0].stackSize <= amount) - { - ItemStack stk = inventory[0]; - inventory[0] = null; - revolverContainer.onCraftMatrixChanged(this); - return stk; - } - - ItemStack var3 = this.inventory[0].splitStack(amount); - - if (inventory[0].stackSize == 0) - { - inventory[0] = null; - } - - revolverContainer.onCraftMatrixChanged(this); - return var3; - } - return null; - } - - public void setInventorySlotContents(int slot, ItemStack stack) - { - inventory[0] = stack; - revolverContainer.onCraftMatrixChanged(this); - } - - public int getInventoryStackLimit() - { - return 1; - } - - public boolean isUseableByPlayer(EntityPlayer player) - { - return true; - } - - public boolean isItemValidForSlot(int slot, ItemStack jar) - { - if (jar != null && jar.getItem() instanceof ItemJarFilled && jar.hasTagCompound()) - { - AspectList aspects = ((ItemJarFilled)jar.getItem()).getAspects(jar); - if (aspects != null && aspects.size() > 0 && aspects.getAmount(Aspect.WEAPON) > 0) - return true; - } - return false; - } - - public String getInventoryName() - { - return "container.revolver"; - } - - public boolean hasCustomInventoryName() - { - return false; - } - - public void openInventory(){} - - public void closeInventory(){} +public class InventoryRevolver implements IInventory { + public ItemStack[] inventory; + public Container revolverContainer; - @Override - public void markDirty(){} - + public InventoryRevolver(Container revolver) { + this.inventory = new ItemStack[1]; + this.revolverContainer = revolver; + } + + public int getSizeInventory() { + return 1; + } + + public ItemStack getStackInSlot(int slot) { + return inventory[0]; + } + + public ItemStack getStackInSlotOnClosing(int slot) { + if (this.inventory[0] != null) { + ItemStack stk = this.inventory[0]; + this.inventory[0] = null; + return stk; + } + return null; + } + + public ItemStack decrStackSize(int slot, int amount) { + if (inventory[0] != null) { + if (inventory[0].stackSize <= amount) { + ItemStack stk = inventory[0]; + inventory[0] = null; + revolverContainer.onCraftMatrixChanged(this); + return stk; + } + + ItemStack var3 = this.inventory[0].splitStack(amount); + + if (inventory[0].stackSize == 0) { + inventory[0] = null; + } + + revolverContainer.onCraftMatrixChanged(this); + return var3; + } + return null; + } + + public void setInventorySlotContents(int slot, ItemStack stack) { + inventory[0] = stack; + revolverContainer.onCraftMatrixChanged(this); + } + + public int getInventoryStackLimit() { + return 1; + } + + public boolean isUseableByPlayer(EntityPlayer player) { + return true; + } + + public boolean isItemValidForSlot(int slot, ItemStack jar) { + if (jar != null && jar.getItem() instanceof ItemJarFilled && jar.hasTagCompound()) { + AspectList aspects = ((ItemJarFilled) jar.getItem()).getAspects(jar); + if (aspects != null && aspects.size() > 0 && aspects.getAmount(Aspect.WEAPON) > 0) return true; + } + return false; + } + + public String getInventoryName() { + return "container.revolver"; + } + + public boolean hasCustomInventoryName() { + return false; + } + + public void openInventory() {} + + public void closeInventory() {} + + @Override + public void markDirty() {} } diff --git a/src/main/java/tb/common/item/ItemBloodyArmor.java b/src/main/java/tb/common/item/ItemBloodyArmor.java index 2ac5abc..7d18268 100644 --- a/src/main/java/tb/common/item/ItemBloodyArmor.java +++ b/src/main/java/tb/common/item/ItemBloodyArmor.java @@ -1,15 +1,9 @@ package tb.common.item; -import java.util.List; -import java.util.UUID; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - -import thaumcraft.api.IRepairable; -import thaumcraft.api.IRunicArmor; -import thaumcraft.api.IVisDiscountGear; -import thaumcraft.api.aspects.Aspect; +import java.util.List; +import java.util.UUID; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -19,72 +13,78 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import thaumcraft.api.IRepairable; +import thaumcraft.api.IRunicArmor; +import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.aspects.Aspect; -public class ItemBloodyArmor extends ItemArmor implements IRepairable, IVisDiscountGear, IRunicArmor{ +public class ItemBloodyArmor extends ItemArmor implements IRepairable, IVisDiscountGear, IRunicArmor { - int aType; - - public ItemBloodyArmor(ArmorMaterial mat,int aType) { - super(mat, 0, aType); - this.aType = aType; - } - - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - return slot == 2 ? "thaumicbases:textures/items/armor/bloody/bloody_2.png" : "thaumicbases:textures/items/armor/bloody/bloody_1.png"; + int aType; + + public ItemBloodyArmor(ArmorMaterial mat, int aType) { + super(mat, 0, aType); + this.aType = aType; } - @Override - public int getVisDiscount(ItemStack stack, EntityPlayer player, - Aspect aspect) { - return discount[aType]; - } - - static final int[] discount = new int[]{5,4,3,2}; - - @Override - public int getRunicCharge(ItemStack itemstack) { - return 0; - } - - @Override - public EnumRarity getRarity(ItemStack itemstack) - { - return EnumRarity.uncommon; // - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) - { - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + getVisDiscount(stack, player, null) + "%"); - super.addInformation(stack, player, list, par4); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public Multimap getAttributeModifiers(ItemStack stack) - { - HashMultimap map = HashMultimap.create(); - - switch(aType) - { - case 1: - { - map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(UUID.fromString("96042c45-dfe3-4366-b93b-84663c4d828d"), "maxHealth", 0.2F, 2)); - break; - } - case 2: - { - map.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(UUID.fromString("e4e1d8b2-87f2-44f5-8f24-e1876060a04c"), "knockback", 0.5F, 2)); - break; - } - case 3: - { - map.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(UUID.fromString("f6d1384c-74c3-4cce-9a80-11b91dbd4ff4"), "moveSpeed", 0.1F, 2)); - break; - } - } - - return map; + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return slot == 2 + ? "thaumicbases:textures/items/armor/bloody/bloody_2.png" + : "thaumicbases:textures/items/armor/bloody/bloody_1.png"; + } + + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return discount[aType]; + } + + static final int[] discount = new int[] {5, 4, 3, 2}; + + @Override + public int getRunicCharge(ItemStack itemstack) { + return 0; + } + + @Override + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.uncommon; // + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + + getVisDiscount(stack, player, null) + "%"); + super.addInformation(stack, player, list, par4); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + public Multimap getAttributeModifiers(ItemStack stack) { + HashMultimap map = HashMultimap.create(); + + switch (aType) { + case 1: { + map.put( + SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), + new AttributeModifier( + UUID.fromString("96042c45-dfe3-4366-b93b-84663c4d828d"), "maxHealth", 0.2F, 2)); + break; + } + case 2: { + map.put( + SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + new AttributeModifier( + UUID.fromString("e4e1d8b2-87f2-44f5-8f24-e1876060a04c"), "knockback", 0.5F, 2)); + break; + } + case 3: { + map.put( + SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), + new AttributeModifier( + UUID.fromString("f6d1384c-74c3-4cce-9a80-11b91dbd4ff4"), "moveSpeed", 0.1F, 2)); + break; + } + } + + return map; } - } diff --git a/src/main/java/tb/common/item/ItemCastingBracelet.java b/src/main/java/tb/common/item/ItemCastingBracelet.java index 97a4201..d85e2c4 100644 --- a/src/main/java/tb/common/item/ItemCastingBracelet.java +++ b/src/main/java/tb/common/item/ItemCastingBracelet.java @@ -2,7 +2,6 @@ package tb.common.item; import java.lang.reflect.Method; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -24,246 +23,208 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.wands.ItemWandCasting; import thaumcraft.common.items.wands.WandManager; -public class ItemCastingBracelet extends ItemWandCasting //<- I hope no one will tell things like "OMG, You've stolen Azanor's code!!!, since that is not true. It is very similar in some places, since I need this item to do exactly the same his does. +public class ItemCastingBracelet + extends ItemWandCasting // <- I hope no one will tell things like "OMG, You've stolen Azanor's code!!!, since +// that is not true. It is very similar in some places, since I need this item to do +// exactly the same his does. { - public static String[] names = new String[]{ - "iron", - "gold", - "greatwood", - "thaumium", - "silverwood", - "reed", - "bone", - "obsidian", - "blaze", - "ice", - "quartz", - "void", - "primal" - }; - - public static ResourceLocation[] braceletTextures = new ResourceLocation[]{ - loc("thaumcraft","textures/blocks/metalbase.png"), - loc("thaumcraft","textures/blocks/goldbase.png"), - loc("thaumcraft","textures/blocks/planks_greatwood.png"), - loc("thaumcraft","textures/blocks/thaumiumblock.png"), - loc("thaumcraft","textures/blocks/planks_silverwood.png"), - loc("thaumicbases","textures/blocks/sugarcaneblock.png"), - loc("thaumicbases","textures/blocks/boneblock.png"), - loc("minecraft","textures/blocks/obsidian.png"), - loc("thaumicbases","textures/blocks/blazeblock.png"), - loc("minecraft","textures/blocks/ice_packed.png"), - loc("minecraft","textures/blocks/quartz_block_bottom.png"), - loc("thaumicbases","textures/blocks/voidblock.png"), - loc("thaumcraft","textures/blocks/deco_3.png") - }; - - public static WandCap[] caps = new WandCap[]{ - ConfigItems.WAND_CAP_IRON, - ConfigItems.WAND_CAP_GOLD, - ConfigItems.WAND_CAP_GOLD, - TBItems.WAND_CAP_THAUMINITE, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_THAUMIUM, - ConfigItems.WAND_CAP_VOID - }; - - public static WandRod[] rods = new WandRod[]{ - ConfigItems.WAND_ROD_WOOD, - ConfigItems.WAND_ROD_WOOD, - ConfigItems.WAND_ROD_GREATWOOD, - TBItems.WAND_ROD_THAUMIUM, - ConfigItems.WAND_ROD_SILVERWOOD, - ConfigItems.WAND_ROD_REED, - ConfigItems.WAND_ROD_BONE, - ConfigItems.WAND_ROD_OBSIDIAN, - ConfigItems.WAND_ROD_BLAZE, - ConfigItems.WAND_ROD_ICE, - ConfigItems.WAND_ROD_QUARTZ, - TBItems.WAND_ROD_VOID, - ConfigItems.STAFF_ROD_PRIMAL - }; - - public static int[] capacity = new int[]{ - 10, - 15, - 17, - 20, - 23, - 23, - 25, - 25, - 25, - 25, - 25, - 27, - 30 - }; - - public ItemCastingBracelet() - { - super(); - this.setHasSubtypes(true); - } - - public int getMaxVis(ItemStack stack) { - return capacity[Math.min(names.length-1,stack.getItemDamage())]*100; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void getSubItems(Item item, CreativeTabs tab, List lst) - { - for(int i = 0; i < names.length; ++i) - lst.add(new ItemStack(item,1,i)); - } - - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) - { - MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(world, player, true); - if (movingobjectposition != null) - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - int x = movingobjectposition.blockX; - int y = movingobjectposition.blockY; - int z = movingobjectposition.blockZ; - Block b = world.getBlock(x, y, z); - - if (b instanceof IWandable) - { - ItemStack is = ((IWandable)b).onWandRightClick(world, itemstack, player); - if (is != null) - return is; - } - - TileEntity tile = world.getTileEntity(x, y, z); - if (tile != null && tile instanceof IWandable) - { - ItemStack is = ((IWandable)tile).onWandRightClick(world, itemstack, player); - if (is != null) - return is; - } - } - - ItemFocusBasic focus = getFocus(itemstack); - if (focus != null && !isOnCooldown(player)) - { - WandManager.setCooldown(player, focus.getActivationCooldown(getFocusItem(itemstack))/2); - ItemStack ret = focus.onFocusRightClick(itemstack, world, player, movingobjectposition); - if (ret != null) - return ret; - } - - return itemstack; - } - - public boolean isOnCooldown(EntityLivingBase base) - { - try - { - Class manager = WandManager.class; - Method method = manager.getDeclaredMethod("isOnCooldown", EntityLivingBase.class); - boolean access = method.isAccessible(); - if(!access) - method.setAccessible(true); - - boolean ret = Boolean.class.cast(method.invoke(null, base)); - - if(!access) - method.setAccessible(false); - - return ret; - } - catch(Exception e) - { - return true; - } - } - - @Override - public String getItemStackDisplayName(ItemStack stk) - { - return StatCollector.translateToLocal(getUnlocalizedName(stk)); - } - - public String getUnlocalizedName(ItemStack stk) - { - return super.getUnlocalizedName(stk) + "." + names[Math.min(names.length-1,stk.getItemDamage())]; + public static String[] names = new String[] { + "iron", + "gold", + "greatwood", + "thaumium", + "silverwood", + "reed", + "bone", + "obsidian", + "blaze", + "ice", + "quartz", + "void", + "primal" + }; + + public static ResourceLocation[] braceletTextures = new ResourceLocation[] { + loc("thaumcraft", "textures/blocks/metalbase.png"), + loc("thaumcraft", "textures/blocks/goldbase.png"), + loc("thaumcraft", "textures/blocks/planks_greatwood.png"), + loc("thaumcraft", "textures/blocks/thaumiumblock.png"), + loc("thaumcraft", "textures/blocks/planks_silverwood.png"), + loc("thaumicbases", "textures/blocks/sugarcaneblock.png"), + loc("thaumicbases", "textures/blocks/boneblock.png"), + loc("minecraft", "textures/blocks/obsidian.png"), + loc("thaumicbases", "textures/blocks/blazeblock.png"), + loc("minecraft", "textures/blocks/ice_packed.png"), + loc("minecraft", "textures/blocks/quartz_block_bottom.png"), + loc("thaumicbases", "textures/blocks/voidblock.png"), + loc("thaumcraft", "textures/blocks/deco_3.png") + }; + + public static WandCap[] caps = new WandCap[] { + ConfigItems.WAND_CAP_IRON, + ConfigItems.WAND_CAP_GOLD, + ConfigItems.WAND_CAP_GOLD, + TBItems.WAND_CAP_THAUMINITE, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_THAUMIUM, + ConfigItems.WAND_CAP_VOID + }; + + public static WandRod[] rods = new WandRod[] { + ConfigItems.WAND_ROD_WOOD, + ConfigItems.WAND_ROD_WOOD, + ConfigItems.WAND_ROD_GREATWOOD, + TBItems.WAND_ROD_THAUMIUM, + ConfigItems.WAND_ROD_SILVERWOOD, + ConfigItems.WAND_ROD_REED, + ConfigItems.WAND_ROD_BONE, + ConfigItems.WAND_ROD_OBSIDIAN, + ConfigItems.WAND_ROD_BLAZE, + ConfigItems.WAND_ROD_ICE, + ConfigItems.WAND_ROD_QUARTZ, + TBItems.WAND_ROD_VOID, + ConfigItems.STAFF_ROD_PRIMAL + }; + + public static int[] capacity = new int[] {10, 15, 17, 20, 23, 23, 25, 25, 25, 25, 25, 27, 30}; + + public ItemCastingBracelet() { + super(); + this.setHasSubtypes(true); } - + + public int getMaxVis(ItemStack stack) { + return capacity[Math.min(names.length - 1, stack.getItemDamage())] * 100; + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + public void getSubItems(Item item, CreativeTabs tab, List lst) { + for (int i = 0; i < names.length; ++i) lst.add(new ItemStack(item, 1, i)); + } + @Override - public float getConsumptionModifier(ItemStack is, EntityPlayer player, Aspect aspect, boolean crafting) - { - float consumptionModifier = 0.5F; - - if ((getCap(is).getSpecialCostModifierAspects() != null) && (getCap(is).getSpecialCostModifierAspects().contains(aspect))) - consumptionModifier = getCap(is).getSpecialCostModifier()/1.5F; - else - consumptionModifier = getCap(is).getBaseCostModifier()/1.5F; - - if (player != null) - consumptionModifier -= WandManager.getTotalVisDiscount(player, aspect); - - if (getFocus(is) != null && !crafting) - consumptionModifier -= getFocusFrugal(is) / 11.0F; - - return Math.max(consumptionModifier, 0.1F); + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { + MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(world, player, true); + if (movingobjectposition != null) + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int x = movingobjectposition.blockX; + int y = movingobjectposition.blockY; + int z = movingobjectposition.blockZ; + Block b = world.getBlock(x, y, z); + + if (b instanceof IWandable) { + ItemStack is = ((IWandable) b).onWandRightClick(world, itemstack, player); + if (is != null) return is; + } + + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof IWandable) { + ItemStack is = ((IWandable) tile).onWandRightClick(world, itemstack, player); + if (is != null) return is; + } + } + + ItemFocusBasic focus = getFocus(itemstack); + if (focus != null && !isOnCooldown(player)) { + WandManager.setCooldown(player, focus.getActivationCooldown(getFocusItem(itemstack)) / 2); + ItemStack ret = focus.onFocusRightClick(itemstack, world, player, movingobjectposition); + if (ret != null) return ret; + } + + return itemstack; } - + + public boolean isOnCooldown(EntityLivingBase base) { + try { + Class manager = WandManager.class; + Method method = manager.getDeclaredMethod("isOnCooldown", EntityLivingBase.class); + boolean access = method.isAccessible(); + if (!access) method.setAccessible(true); + + boolean ret = Boolean.class.cast(method.invoke(null, base)); + + if (!access) method.setAccessible(false); + + return ret; + } catch (Exception e) { + return true; + } + } + @Override - public WandRod getRod(ItemStack stack) - { - return stack.getItemDamage() == 3 ? TBItems.WAND_ROD_THAUMIUM : stack.getItemDamage() == 11 ? TBItems.WAND_ROD_VOID : rods[Math.min(rods.length-1, stack.getItemDamage())]; + public String getItemStackDisplayName(ItemStack stk) { + return StatCollector.translateToLocal(getUnlocalizedName(stk)); } - + + public String getUnlocalizedName(ItemStack stk) { + return super.getUnlocalizedName(stk) + "." + names[Math.min(names.length - 1, stk.getItemDamage())]; + } + @Override - public WandCap getCap(ItemStack stack) - { - return stack.getItemDamage() == 3 ? TBItems.WAND_CAP_THAUMINITE : caps[Math.min(caps.length-1, stack.getItemDamage())]; + public float getConsumptionModifier(ItemStack is, EntityPlayer player, Aspect aspect, boolean crafting) { + float consumptionModifier = 0.5F; + + if ((getCap(is).getSpecialCostModifierAspects() != null) + && (getCap(is).getSpecialCostModifierAspects().contains(aspect))) + consumptionModifier = getCap(is).getSpecialCostModifier() / 1.5F; + else consumptionModifier = getCap(is).getBaseCostModifier() / 1.5F; + + if (player != null) consumptionModifier -= WandManager.getTotalVisDiscount(player, aspect); + + if (getFocus(is) != null && !crafting) consumptionModifier -= getFocusFrugal(is) / 11.0F; + + return Math.max(consumptionModifier, 0.1F); } - - public boolean isStaff(ItemStack stack) - { - return true; + + @Override + public WandRod getRod(ItemStack stack) { + return stack.getItemDamage() == 3 + ? TBItems.WAND_ROD_THAUMIUM + : stack.getItemDamage() == 11 + ? TBItems.WAND_ROD_VOID + : rods[Math.min(rods.length - 1, stack.getItemDamage())]; } - - public boolean isSceptre(ItemStack stack) - { - return false; + + @Override + public WandCap getCap(ItemStack stack) { + return stack.getItemDamage() == 3 + ? TBItems.WAND_CAP_THAUMINITE + : caps[Math.min(caps.length - 1, stack.getItemDamage())]; } - - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) - { - IWandable wandable = getObjectInUse(stack, player.worldObj); - if (wandable != null) - { - this.animation = ItemFocusBasic.WandFocusAnimation.WAVE; - wandable.onUsingWandTick(stack, player, count); - ++count; - wandable.onUsingWandTick(stack, player, count); - } - else - { - ItemFocusBasic focus = getFocus(stack); - if (focus != null && !isOnCooldown(player)) - { - WandManager.setCooldown(player, focus.getActivationCooldown(getFocusItem(stack))/2); - focus.onUsingFocusTick(stack, player, count); - ++count; - focus.onUsingFocusTick(stack, player, count); - } - } + + public boolean isStaff(ItemStack stack) { + return true; } - - public static final ResourceLocation loc(String mod, String path) - { - return new ResourceLocation(mod,path); + + public boolean isSceptre(ItemStack stack) { + return false; + } + + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { + IWandable wandable = getObjectInUse(stack, player.worldObj); + if (wandable != null) { + this.animation = ItemFocusBasic.WandFocusAnimation.WAVE; + wandable.onUsingWandTick(stack, player, count); + ++count; + wandable.onUsingWandTick(stack, player, count); + } else { + ItemFocusBasic focus = getFocus(stack); + if (focus != null && !isOnCooldown(player)) { + WandManager.setCooldown(player, focus.getActivationCooldown(getFocusItem(stack)) / 2); + focus.onUsingFocusTick(stack, player, count); + ++count; + focus.onUsingFocusTick(stack, player, count); + } + } + } + + public static final ResourceLocation loc(String mod, String path) { + return new ResourceLocation(mod, path); } - } diff --git a/src/main/java/tb/common/item/ItemConcentratedTaint.java b/src/main/java/tb/common/item/ItemConcentratedTaint.java index 8b694ea..1c79300 100644 --- a/src/main/java/tb/common/item/ItemConcentratedTaint.java +++ b/src/main/java/tb/common/item/ItemConcentratedTaint.java @@ -2,20 +2,6 @@ package tb.common.item; import DummyCore.Utils.MathUtils; import DummyCore.Utils.MiscUtils; -import tb.utils.TBUtils; -import thaumcraft.api.damagesource.DamageSourceThaumcraft; -import thaumcraft.api.entities.ITaintedMob; -import thaumcraft.api.nodes.INode; -import thaumcraft.api.nodes.NodeType; -import thaumcraft.codechicken.lib.math.MathHelper; -import thaumcraft.common.Thaumcraft; -import thaumcraft.common.config.Config; -import thaumcraft.common.config.ConfigBlocks; -import thaumcraft.common.config.ConfigItems; -import thaumcraft.common.lib.network.PacketHandler; -import thaumcraft.common.lib.network.playerdata.PacketResearchComplete; -import thaumcraft.common.lib.research.ResearchManager; -import thaumcraft.common.lib.world.ThaumcraftWorldGenerator; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -32,142 +18,153 @@ import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import tb.utils.TBUtils; +import thaumcraft.api.damagesource.DamageSourceThaumcraft; +import thaumcraft.api.entities.ITaintedMob; +import thaumcraft.api.nodes.INode; +import thaumcraft.api.nodes.NodeType; +import thaumcraft.codechicken.lib.math.MathHelper; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.config.Config; +import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.config.ConfigItems; +import thaumcraft.common.lib.network.PacketHandler; +import thaumcraft.common.lib.network.playerdata.PacketResearchComplete; +import thaumcraft.common.lib.research.ResearchManager; +import thaumcraft.common.lib.world.ThaumcraftWorldGenerator; -public class ItemConcentratedTaint extends Item{ +public class ItemConcentratedTaint extends Item { - public boolean onItemUse(ItemStack stk, EntityPlayer user, World w, int x, int y, int z, int side, float vecX, float vecY, float vecZ) - { - --stk.stackSize; - w.playSound(x, y, z, "break.glass", 1, 1, false); - - Block b = w.getBlock(x, y, z); - if(b == ConfigBlocks.blockAiry) - { - TileEntity tile = w.getTileEntity(x, y, z); - if(tile instanceof INode) - { - INode.class.cast(tile).setNodeType(NodeType.TAINTED); - return true; - } - } - - for(int i = 0; i < 100; ++i) - { - int dX = x + MathHelper.floor_double(MathUtils.randomDouble(w.rand)*16); - int dZ = z + MathHelper.floor_double(MathUtils.randomDouble(w.rand)*16); - int dY = y + w.rand.nextInt(2) - w.rand.nextInt(2); - MiscUtils.changeBiome(w, ThaumcraftWorldGenerator.biomeTaint, dX, dZ); - if (w.isBlockNormalCubeDefault(dX, dY - 1, dZ, false) && w.getBlock(dX, dY, dZ).isReplaceable(w, dX, dY, dZ)) - { - w.setBlock(dX, dY, dZ, ConfigBlocks.blockTaintFibres, 0, 3); - } - Thaumcraft.proxy.bottleTaintBreak(w, dX, dY, dZ); - } - - return true; + public boolean onItemUse( + ItemStack stk, + EntityPlayer user, + World w, + int x, + int y, + int z, + int side, + float vecX, + float vecY, + float vecZ) { + --stk.stackSize; + w.playSound(x, y, z, "break.glass", 1, 1, false); + + Block b = w.getBlock(x, y, z); + if (b == ConfigBlocks.blockAiry) { + TileEntity tile = w.getTileEntity(x, y, z); + if (tile instanceof INode) { + INode.class.cast(tile).setNodeType(NodeType.TAINTED); + return true; + } + } + + for (int i = 0; i < 100; ++i) { + int dX = x + MathHelper.floor_double(MathUtils.randomDouble(w.rand) * 16); + int dZ = z + MathHelper.floor_double(MathUtils.randomDouble(w.rand) * 16); + int dY = y + w.rand.nextInt(2) - w.rand.nextInt(2); + MiscUtils.changeBiome(w, ThaumcraftWorldGenerator.biomeTaint, dX, dZ); + if (w.isBlockNormalCubeDefault(dX, dY - 1, dZ, false) + && w.getBlock(dX, dY, dZ).isReplaceable(w, dX, dY, dZ)) { + w.setBlock(dX, dY, dZ, ConfigBlocks.blockTaintFibres, 0, 3); + } + Thaumcraft.proxy.bottleTaintBreak(w, dX, dY, dZ); + } + + return true; } - - public boolean itemInteractionForEntity(ItemStack stk, EntityPlayer user, EntityLivingBase usedOn) - { - if(!(usedOn instanceof ITaintedMob)) - { - --stk.stackSize; - user.swingItem(); - - usedOn.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID,200,1,true)); - - if(usedOn instanceof EntityPlayer) - { - EntityPlayer victum = (EntityPlayer) usedOn; - for(int i = 0; i < victum.inventory.armorInventory.length; ++i) - { - ItemStack armor = victum.inventory.armorInventory[i]; - if(armor != null) - { - ItemStack newArmor = armor.copy(); - EntityItem actualArmor = new EntityItem(victum.worldObj,victum.posX,victum.posY,victum.posZ,newArmor); - actualArmor.delayBeforeCanPickup = 1200; - if(!victum.worldObj.isRemote) - victum.worldObj.spawnEntityInWorld(actualArmor); - - armor = null; - victum.inventory.armorInventory[i] = null; - } - } - victum.addPotionEffect(new PotionEffect(Potion.blindness.id,200,0,true)); - victum.addPotionEffect(new PotionEffect(Potion.nightVision.id,200,0,true)); - } - - return true; - } - return false; + + public boolean itemInteractionForEntity(ItemStack stk, EntityPlayer user, EntityLivingBase usedOn) { + if (!(usedOn instanceof ITaintedMob)) { + --stk.stackSize; + user.swingItem(); + + usedOn.addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 200, 1, true)); + + if (usedOn instanceof EntityPlayer) { + EntityPlayer victum = (EntityPlayer) usedOn; + for (int i = 0; i < victum.inventory.armorInventory.length; ++i) { + ItemStack armor = victum.inventory.armorInventory[i]; + if (armor != null) { + ItemStack newArmor = armor.copy(); + EntityItem actualArmor = + new EntityItem(victum.worldObj, victum.posX, victum.posY, victum.posZ, newArmor); + actualArmor.delayBeforeCanPickup = 1200; + if (!victum.worldObj.isRemote) victum.worldObj.spawnEntityInWorld(actualArmor); + + armor = null; + victum.inventory.armorInventory[i] = null; + } + } + victum.addPotionEffect(new PotionEffect(Potion.blindness.id, 200, 0, true)); + victum.addPotionEffect(new PotionEffect(Potion.nightVision.id, 200, 0, true)); + } + + return true; + } + return false; } - - public ItemStack onItemRightClick(ItemStack stack, World w, EntityPlayer player) - { - if(ResearchManager.isResearchComplete(player.getCommandSenderName(), "TB.TaintMinor")) - player.setItemInUse(stack, getMaxItemUseDuration(stack)); + + public ItemStack onItemRightClick(ItemStack stack, World w, EntityPlayer player) { + if (ResearchManager.isResearchComplete(player.getCommandSenderName(), "TB.TaintMinor")) + player.setItemInUse(stack, getMaxItemUseDuration(stack)); return stack; } - - public EnumAction getItemUseAction(ItemStack stack) - { + + public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.drink; } - public int getMaxItemUseDuration(ItemStack stack) - { + public int getMaxItemUseDuration(ItemStack stack) { return 32; } - - public ItemStack onEaten(ItemStack stack, World w, EntityPlayer player) - { - if (!player.capabilities.isCreativeMode) - { + + public ItemStack onEaten(ItemStack stack, World w, EntityPlayer player) { + if (!player.capabilities.isCreativeMode) { --stack.stackSize; - if(stack.stackSize > 0) - { - if(!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence,1,0))) - player.dropPlayerItemWithRandomChoice(new ItemStack(ConfigItems.itemEssence,1,0), false); + if (stack.stackSize > 0) { + if (!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence, 1, 0))) + player.dropPlayerItemWithRandomChoice(new ItemStack(ConfigItems.itemEssence, 1, 0), false); } } - - if(player.getHealth() < player.getMaxHealth()) - { - for(int i = 0; i < 99; ++i) - player.attackEntityFrom(DamageSourceThaumcraft.taint, Integer.MAX_VALUE); - }else - { - player.setHealth(1); - player.addPotionEffect(new PotionEffect(Potion.blindness.getId(),600,0,true)); - player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(),600,0,true)); - player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(),600,4,true)); - player.addPotionEffect(new PotionEffect(Potion.weakness.getId(),600,4,true)); - player.addPotionEffect(new PotionEffect(Potion.confusion.getId(),100,0,true)); - - if(player.posY > 6) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.howlBelow")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_PURPLE).setItalic(true))); - TBUtils.addWarpToPlayer(player, 6, 0); - }else - { - if(player.worldObj.provider != null && player.worldObj.provider.dimensionId == -1) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.taintDevelop")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_PURPLE).setItalic(true))); - TBUtils.addWarpToPlayer(player, 18, 0); - TBUtils.addWarpToPlayer(player, 6, 1); - TBUtils.addWarpToPlayer(player, 1, 2); - if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), "TB.TaintProgress")) - PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("@TB.TaintProgress"), (EntityPlayerMP)player); - }else - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.howlDeeper")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_PURPLE).setItalic(true))); - TBUtils.addWarpToPlayer(player, 12, 0); - } - } + + if (player.getHealth() < player.getMaxHealth()) { + for (int i = 0; i < 99; ++i) player.attackEntityFrom(DamageSourceThaumcraft.taint, Integer.MAX_VALUE); + } else { + player.setHealth(1); + player.addPotionEffect(new PotionEffect(Potion.blindness.getId(), 600, 0, true)); + player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 600, 0, true)); + player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 600, 4, true)); + player.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 600, 4, true)); + player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 100, 0, true)); + + if (player.posY > 6) { + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.howlBelow")) + .setChatStyle(new ChatStyle() + .setColor(EnumChatFormatting.DARK_PURPLE) + .setItalic(true))); + TBUtils.addWarpToPlayer(player, 6, 0); + } else { + if (player.worldObj.provider != null && player.worldObj.provider.dimensionId == -1) { + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.taintDevelop")) + .setChatStyle(new ChatStyle() + .setColor(EnumChatFormatting.DARK_PURPLE) + .setItalic(true))); + TBUtils.addWarpToPlayer(player, 18, 0); + TBUtils.addWarpToPlayer(player, 6, 1); + TBUtils.addWarpToPlayer(player, 1, 2); + if (!ResearchManager.isResearchComplete(player.getCommandSenderName(), "TB.TaintProgress")) + PacketHandler.INSTANCE.sendTo( + new PacketResearchComplete("@TB.TaintProgress"), (EntityPlayerMP) player); + } else { + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.howlDeeper")) + .setChatStyle(new ChatStyle() + .setColor(EnumChatFormatting.DARK_PURPLE) + .setItalic(true))); + TBUtils.addWarpToPlayer(player, 12, 0); + } + } } - return stack.stackSize <= 0 ? new ItemStack(ConfigItems.itemEssence,1,0) : stack; + return stack.stackSize <= 0 ? new ItemStack(ConfigItems.itemEssence, 1, 0) : stack; } - } diff --git a/src/main/java/tb/common/item/ItemHerobrinesScythe.java b/src/main/java/tb/common/item/ItemHerobrinesScythe.java index adcf4f3..b5b1214 100644 --- a/src/main/java/tb/common/item/ItemHerobrinesScythe.java +++ b/src/main/java/tb/common/item/ItemHerobrinesScythe.java @@ -1,19 +1,13 @@ package tb.common.item; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +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 java.util.UUID; - -import tb.core.TBCore; -import thaumcraft.api.IRepairable; -import thaumcraft.api.IWarpingGear; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -36,120 +30,135 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.AttackEntityEvent; +import tb.core.TBCore; +import thaumcraft.api.IRepairable; +import thaumcraft.api.IWarpingGear; -public class ItemHerobrinesScythe extends ItemSword implements IRepairable,IWarpingGear{ +public class ItemHerobrinesScythe extends ItemSword implements IRepairable, IWarpingGear { - public ItemHerobrinesScythe() - { - super(ToolMaterial.EMERALD); - } - - public EnumRarity getRarity(ItemStack itemstack) - { - return EnumRarity.uncommon; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List lst, boolean held) - { - lst.add(EnumChatFormatting.ITALIC+"Well, they're nothing..."); //Do not translate this line, it is a reference to TheAtlanticCraft's song - The Herobrine + public ItemHerobrinesScythe() { + super(ToolMaterial.EMERALD); } - - public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) - { - super.onUpdate(stk, w, entity, slot, held); - if ((stk.isItemDamaged()) && (entity != null) && (entity.ticksExisted % 20 == 0) && ((entity instanceof EntityLivingBase))) - stk.damageItem(-1, (EntityLivingBase)entity); - } - - @SuppressWarnings("unchecked") - public static void attack(EntityPlayer attacker, List doNotAttack, EntityLivingBase attacked) - { - AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(attacked.posX-1, attacked.posY-1, attacked.posZ-1, attacked.posX+1, attacked.posY+1, attacked.posZ+1).expand(6, 6, 6); - - List mobs = attacked.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, aabb); - - Random rnd = attacker.worldObj.rand; - - mobs.removeAll(doNotAttack); - - if(!mobs.isEmpty()) - { - while(!mobs.isEmpty()) - { - int index = rnd.nextInt(mobs.size()); - if(mobs.get(index) != null && mobs.get(index).isEntityAlive() && mobs.get(index) instanceof IMob && !(mobs.get(index) instanceof EntityPlayer)) - { - performPlayerAttackAt(attacker,mobs.get(index)); - - TBCore.proxy.lightning(attacker.worldObj, attacked.posX, attacked.posY+rnd.nextDouble()*attacked.getEyeHeight(), attacked.posZ, mobs.get(index).posX, mobs.get(index).posY+rnd.nextDouble()*mobs.get(index).getEyeHeight(), mobs.get(index).posZ, 20, 2F, 10, 0); - attacker.worldObj.playSoundAtEntity(mobs.get(index), "thaumcraft:zap", 1F, 0.8F); - - doNotAttack.add(mobs.get(index)); - - attack(attacker,doNotAttack,mobs.get(index)); - - break; - - }else - { - mobs.remove(index); - continue; - } - } - } - - } - - @Override - public boolean onLeftClickEntity(ItemStack stk, EntityPlayer attacker, Entity attacked) - { - if(attacked.isEntityAlive() && attacked instanceof IMob) - { - attack(attacker,new ArrayList(),(EntityLivingBase) attacked); - } - return super.onLeftClickEntity(stk, attacker, attacked); - } - - - /** - * Copied from {@link EntityPlayer#attackTargetEntityWithCurrentItem(Entity)} to not call the {@link #onLeftClickEntity(ItemStack, EntityPlayer, Entity)} - * @param p the player - * @param p_71059_1_ attacked entity - */ - public static void performPlayerAttackAt(EntityPlayer p, Entity p_71059_1_) - { - if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(p, p_71059_1_))) - { + + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.uncommon; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List lst, boolean held) { + lst.add(EnumChatFormatting.ITALIC + + "Well, they're nothing..."); // Do not translate this line, it is a reference to TheAtlanticCraft's + // song - The Herobrine + } + + public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) { + super.onUpdate(stk, w, entity, slot, held); + if ((stk.isItemDamaged()) + && (entity != null) + && (entity.ticksExisted % 20 == 0) + && ((entity instanceof EntityLivingBase))) stk.damageItem(-1, (EntityLivingBase) entity); + } + + @SuppressWarnings("unchecked") + public static void attack(EntityPlayer attacker, List doNotAttack, EntityLivingBase attacked) { + AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox( + attacked.posX - 1, + attacked.posY - 1, + attacked.posZ - 1, + attacked.posX + 1, + attacked.posY + 1, + attacked.posZ + 1) + .expand(6, 6, 6); + + List mobs = attacked.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, aabb); + + Random rnd = attacker.worldObj.rand; + + mobs.removeAll(doNotAttack); + + if (!mobs.isEmpty()) { + while (!mobs.isEmpty()) { + int index = rnd.nextInt(mobs.size()); + if (mobs.get(index) != null + && mobs.get(index).isEntityAlive() + && mobs.get(index) instanceof IMob + && !(mobs.get(index) instanceof EntityPlayer)) { + performPlayerAttackAt(attacker, mobs.get(index)); + + TBCore.proxy.lightning( + attacker.worldObj, + attacked.posX, + attacked.posY + rnd.nextDouble() * attacked.getEyeHeight(), + attacked.posZ, + mobs.get(index).posX, + mobs.get(index).posY + + rnd.nextDouble() * mobs.get(index).getEyeHeight(), + mobs.get(index).posZ, + 20, + 2F, + 10, + 0); + attacker.worldObj.playSoundAtEntity(mobs.get(index), "thaumcraft:zap", 1F, 0.8F); + + doNotAttack.add(mobs.get(index)); + + attack(attacker, doNotAttack, mobs.get(index)); + + break; + + } else { + mobs.remove(index); + continue; + } + } + } + } + + @Override + public boolean onLeftClickEntity(ItemStack stk, EntityPlayer attacker, Entity attacked) { + if (attacked.isEntityAlive() && attacked instanceof IMob) { + attack(attacker, new ArrayList(), (EntityLivingBase) attacked); + } + return super.onLeftClickEntity(stk, attacker, attacked); + } + + /** + * Copied from {@link EntityPlayer#attackTargetEntityWithCurrentItem(Entity)} to not call the {@link #onLeftClickEntity(ItemStack, EntityPlayer, Entity)} + * @param p the player + * @param p_71059_1_ attacked entity + */ + public static void performPlayerAttackAt(EntityPlayer p, Entity p_71059_1_) { + if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(p, p_71059_1_))) { return; } - - if (p_71059_1_.canAttackWithItem()) - { - if (!p_71059_1_.hitByEntity(p)) - { - float f = (float)p.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + + if (p_71059_1_.canAttackWithItem()) { + if (!p_71059_1_.hitByEntity(p)) { + float f = (float) p.getEntityAttribute(SharedMonsterAttributes.attackDamage) + .getAttributeValue(); int i = 0; float f1 = 0.0F; - if (p_71059_1_ instanceof EntityLivingBase) - { - f1 = EnchantmentHelper.getEnchantmentModifierLiving(p, (EntityLivingBase)p_71059_1_); - i += EnchantmentHelper.getKnockbackModifier(p, (EntityLivingBase)p_71059_1_); + if (p_71059_1_ instanceof EntityLivingBase) { + f1 = EnchantmentHelper.getEnchantmentModifierLiving(p, (EntityLivingBase) p_71059_1_); + i += EnchantmentHelper.getKnockbackModifier(p, (EntityLivingBase) p_71059_1_); } - if (p.isSprinting()) - { + if (p.isSprinting()) { ++i; } - if (f > 0.0F || f1 > 0.0F) - { - boolean flag = p.fallDistance > 0.0F && !p.onGround && !p.isOnLadder() && !p.isInWater() && !p.isPotionActive(Potion.blindness) && p.ridingEntity == null && p_71059_1_ instanceof EntityLivingBase; + if (f > 0.0F || f1 > 0.0F) { + boolean flag = p.fallDistance > 0.0F + && !p.onGround + && !p.isOnLadder() + && !p.isInWater() + && !p.isPotionActive(Potion.blindness) + && p.ridingEntity == null + && p_71059_1_ instanceof EntityLivingBase; - if (flag && f > 0.0F) - { + if (flag && f > 0.0F) { f *= 1.5F; } @@ -157,110 +166,104 @@ public class ItemHerobrinesScythe extends ItemSword implements IRepairable,IWarp boolean flag1 = false; int j = EnchantmentHelper.getFireAspectModifier(p); - if (p_71059_1_ instanceof EntityLivingBase && j > 0 && !p_71059_1_.isBurning()) - { + if (p_71059_1_ instanceof EntityLivingBase && j > 0 && !p_71059_1_.isBurning()) { flag1 = true; p_71059_1_.setFire(1); } boolean flag2 = p_71059_1_.attackEntityFrom(DamageSource.causePlayerDamage(p), f); - if (flag2) - { - if (i > 0) - { - p_71059_1_.addVelocity((double)(-MathHelper.sin(p.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(p.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F)); + if (flag2) { + if (i > 0) { + p_71059_1_.addVelocity( + (double) (-MathHelper.sin(p.rotationYaw * (float) Math.PI / 180.0F) + * (float) i + * 0.5F), + 0.1D, + (double) (MathHelper.cos(p.rotationYaw * (float) Math.PI / 180.0F) + * (float) i + * 0.5F)); p.motionX *= 0.6D; p.motionZ *= 0.6D; p.setSprinting(false); } - if (flag) - { + if (flag) { p.onCriticalHit(p_71059_1_); } - if (f1 > 0.0F) - { + if (f1 > 0.0F) { p.onEnchantmentCritical(p_71059_1_); } - if (f >= 18.0F) - { + if (f >= 18.0F) { p.triggerAchievement(AchievementList.overkill); } p.setLastAttacker(p_71059_1_); - if (p_71059_1_ instanceof EntityLivingBase) - { - EnchantmentHelper.func_151384_a((EntityLivingBase)p_71059_1_, p); + if (p_71059_1_ instanceof EntityLivingBase) { + EnchantmentHelper.func_151384_a((EntityLivingBase) p_71059_1_, p); } EnchantmentHelper.func_151385_b(p, p_71059_1_); ItemStack itemstack = p.getCurrentEquippedItem(); Object object = p_71059_1_; - if (p_71059_1_ instanceof EntityDragonPart) - { - IEntityMultiPart ientitymultipart = ((EntityDragonPart)p_71059_1_).entityDragonObj; + if (p_71059_1_ instanceof EntityDragonPart) { + IEntityMultiPart ientitymultipart = ((EntityDragonPart) p_71059_1_).entityDragonObj; - if (ientitymultipart != null && ientitymultipart instanceof EntityLivingBase) - { - object = (EntityLivingBase)ientitymultipart; + if (ientitymultipart != null && ientitymultipart instanceof EntityLivingBase) { + object = (EntityLivingBase) ientitymultipart; } } - if (itemstack != null && object instanceof EntityLivingBase) - { - itemstack.hitEntity((EntityLivingBase)object, p); + if (itemstack != null && object instanceof EntityLivingBase) { + itemstack.hitEntity((EntityLivingBase) object, p); - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { p.destroyCurrentEquippedItem(); } } - if (p_71059_1_ instanceof EntityLivingBase) - { + if (p_71059_1_ instanceof EntityLivingBase) { p.addStat(StatList.damageDealtStat, Math.round(f * 10.0F)); - if (j > 0) - { + if (j > 0) { p_71059_1_.setFire(j * 4); } } p.addExhaustion(0.3F); - } - else if (flag1) - { + } else if (flag1) { p_71059_1_.extinguish(); } } } } } - - public int getWarp(ItemStack itemstack, EntityPlayer player) - { - return 3; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public Multimap getAttributeModifiers(ItemStack stack) - { - Multimap attribs = HashMultimap.create(); - - attribs.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"), "Weapon modifier", 14.5F, 0)); - attribs.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CE"), "Speed modifier", 0.5F, 2)); - - return attribs; - } - - public boolean isItemTool(ItemStack stk) - { - return true; + + public int getWarp(ItemStack itemstack, EntityPlayer player) { + return 3; } + @SuppressWarnings({"rawtypes", "unchecked"}) + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap attribs = HashMultimap.create(); + + attribs.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier( + UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"), "Weapon modifier", 14.5F, 0)); + attribs.put( + SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), + new AttributeModifier( + UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CE"), "Speed modifier", 0.5F, 2)); + + return attribs; + } + + public boolean isItemTool(ItemStack stk) { + return true; + } } diff --git a/src/main/java/tb/common/item/ItemKnoseFragment.java b/src/main/java/tb/common/item/ItemKnoseFragment.java index e894861..159552b 100644 --- a/src/main/java/tb/common/item/ItemKnoseFragment.java +++ b/src/main/java/tb/common/item/ItemKnoseFragment.java @@ -1,12 +1,8 @@ package tb.common.item; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import tb.utils.TBUtils; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -16,130 +12,106 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import tb.utils.TBUtils; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; -public class ItemKnoseFragment extends Item -{ - - public static final String names[] = new String[]{ - "air", - "fire", - "aqua", - "terra", - "order", - "entropy", - "mixed", - "tainted" - }; - - public static final AspectList[] addedAspects = new AspectList[]{ - lst(8,Aspect.AIR), - lst(8,Aspect.FIRE), - lst(8,Aspect.WATER), - lst(8,Aspect.EARTH), - lst(8,Aspect.ORDER), - lst(8,Aspect.ENTROPY), - lst(2,Aspect.FIRE,Aspect.WATER,Aspect.EARTH,Aspect.AIR,Aspect.ORDER,Aspect.ENTROPY) - }; - - public static IIcon[] icons = new IIcon[names.length]; +public class ItemKnoseFragment extends Item { + + public static final String names[] = + new String[] {"air", "fire", "aqua", "terra", "order", "entropy", "mixed", "tainted"}; + + public static final AspectList[] addedAspects = new AspectList[] { + lst(8, Aspect.AIR), + lst(8, Aspect.FIRE), + lst(8, Aspect.WATER), + lst(8, Aspect.EARTH), + lst(8, Aspect.ORDER), + lst(8, Aspect.ENTROPY), + lst(2, Aspect.FIRE, Aspect.WATER, Aspect.EARTH, Aspect.AIR, Aspect.ORDER, Aspect.ENTROPY) + }; + + public static IIcon[] icons = new IIcon[names.length]; + + public ItemKnoseFragment() { + this.setHasSubtypes(true); + } + + public static final AspectList lst(int num, Aspect... aspect) { + AspectList aLst = new AspectList(); + + for (int i = 0; i < aspect.length; ++i) aLst.add(aspect[i], num); + + return aLst; + } - public ItemKnoseFragment() - { - this.setHasSubtypes(true); - } - - public static final AspectList lst(int num,Aspect... aspect) - { - AspectList aLst = new AspectList(); - - for(int i = 0; i < aspect.length; ++i) - aLst.add(aspect[i], num); - - return aLst; - } - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return icons[meta]; + public IIcon getIconFromDamage(int meta) { + return icons[meta]; } - - public int getMetadata(int meta) - { - return meta; + + public int getMetadata(int meta) { + return meta; } - - public String getUnlocalizedName(ItemStack is) - { - return super.getUnlocalizedName(is)+names[is.getItemDamage()].replace('/', '.'); + + public String getUnlocalizedName(ItemStack is) { + return super.getUnlocalizedName(is) + names[is.getItemDamage()].replace('/', '.'); } - + @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - for(int i = 0; i < names.length; ++i) - icons[i] = reg.registerIcon(iconString+names[i]+"Fragment"); + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < names.length; ++i) icons[i] = reg.registerIcon(iconString + names[i] + "Fragment"); } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubItems(Item itm, CreativeTabs tab, List lst) - { - for(int i = 0; i < names.length; ++i) - lst.add(new ItemStack(itm,1,i)); + + @SuppressWarnings({"rawtypes", "unchecked"}) + @SideOnly(Side.CLIENT) + public void getSubItems(Item itm, CreativeTabs tab, List lst) { + for (int i = 0; i < names.length; ++i) lst.add(new ItemStack(itm, 1, i)); } - - public ItemStack onItemRightClick(ItemStack stk, World w, EntityPlayer player) - { - int meta = stk.getItemDamage(); - if(!player.worldObj.isRemote) - if(meta < 7) - { - for(int i = 0; i < addedAspects[meta].size(); ++i) - TBUtils.addAspectToKnowledgePool(player, addedAspects[meta].getAspects()[i], (short) addedAspects[meta].getAmount(addedAspects[meta].getAspects()[i])); - }else - { - //if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), "TB.TaintMinor")) - // PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("@TB.TaintMinor"), (EntityPlayerMP)player); - int overhaulAddedAspects = 0; - for(int i = 0; i < Aspect.getCompoundAspects().size(); ++i) - { - Aspect a = Aspect.getCompoundAspects().get(i); - if(a == Aspect.TAINT) - { - TBUtils.addAspectToKnowledgePool(player, a, (short) 8); - TBUtils.addWarpToPlayer(player, 2, 0); - ++overhaulAddedAspects; - }else - { - if(player.worldObj.rand.nextBoolean()) - { - TBUtils.addAspectToKnowledgePool(player, a, (short) 1); - ++overhaulAddedAspects; - } - if(player.worldObj.rand.nextInt(24) == 0) - break; - } - } - - for(int i = 0; i < overhaulAddedAspects; ++i) - if(w.rand.nextFloat() <= 0.1F) - TBUtils.addWarpToPlayer(player, 1, w.rand.nextFloat() <= 0.15F ? 0 : 1); - } - //player.inventory.decrStackSize(player.inventory.currentItem, 1); - - //1.7 old - //return stk.stackSize <= 0 ? null : stk; - - //1.8 change - --stk.stackSize; - return stk; + + public ItemStack onItemRightClick(ItemStack stk, World w, EntityPlayer player) { + int meta = stk.getItemDamage(); + if (!player.worldObj.isRemote) + if (meta < 7) { + for (int i = 0; i < addedAspects[meta].size(); ++i) + TBUtils.addAspectToKnowledgePool(player, addedAspects[meta].getAspects()[i], (short) + addedAspects[meta].getAmount(addedAspects[meta].getAspects()[i])); + } else { + // if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), "TB.TaintMinor")) + // PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("@TB.TaintMinor"), (EntityPlayerMP)player); + int overhaulAddedAspects = 0; + for (int i = 0; i < Aspect.getCompoundAspects().size(); ++i) { + Aspect a = Aspect.getCompoundAspects().get(i); + if (a == Aspect.TAINT) { + TBUtils.addAspectToKnowledgePool(player, a, (short) 8); + TBUtils.addWarpToPlayer(player, 2, 0); + ++overhaulAddedAspects; + } else { + if (player.worldObj.rand.nextBoolean()) { + TBUtils.addAspectToKnowledgePool(player, a, (short) 1); + ++overhaulAddedAspects; + } + if (player.worldObj.rand.nextInt(24) == 0) break; + } + } + + for (int i = 0; i < overhaulAddedAspects; ++i) + if (w.rand.nextFloat() <= 0.1F) + TBUtils.addWarpToPlayer(player, 1, w.rand.nextFloat() <= 0.15F ? 0 : 1); + } + // player.inventory.decrStackSize(player.inventory.currentItem, 1); + + // 1.7 old + // return stk.stackSize <= 0 ? null : stk; + + // 1.8 change + --stk.stackSize; + return stk; } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List lst, boolean held) - { - lst.add(EnumChatFormatting.AQUA+StatCollector.translateToLocal("tb.txt.knoseFragment")); + + @SuppressWarnings({"unchecked", "rawtypes"}) + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List lst, boolean held) { + lst.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tb.txt.knoseFragment")); } } diff --git a/src/main/java/tb/common/item/ItemKnoseSeeds.java b/src/main/java/tb/common/item/ItemKnoseSeeds.java index bcb2194..b4982b3 100644 --- a/src/main/java/tb/common/item/ItemKnoseSeeds.java +++ b/src/main/java/tb/common/item/ItemKnoseSeeds.java @@ -2,43 +2,49 @@ package tb.common.item; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class ItemKnoseSeeds extends ItemSeeds{ +public class ItemKnoseSeeds extends ItemSeeds { private Block cropBlock; private Block soilBlockID; - - public ItemKnoseSeeds(Block crop, Block soil) { - super(crop, soil); + + public ItemKnoseSeeds(Block crop, Block soil) { + super(crop, soil); this.cropBlock = crop; this.soilBlockID = soil; - } - - public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float fx, float fy, float fz) - { - if (side != 1) { - return false; - } - else if (player.canPlayerEdit(x, y, z, side, itemStack) && player.canPlayerEdit(x, y + 1, z, side, itemStack)) { - if (world.getBlock(x, y, z) == soilBlockID) { - if (world.isAirBlock(x, y+1, z)) { /*world.getBlock(x, y + 1, z) == Blocks.air*/ - world.setBlock(x, y + 1, z, this.cropBlock); - --itemStack.stackSize; - return true; - } - } - else { - return false; - } - } - else { - return false; - } - return false; } + public boolean onItemUse( + ItemStack itemStack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float fx, + float fy, + float fz) { + if (side != 1) { + return false; + } else if (player.canPlayerEdit(x, y, z, side, itemStack) + && player.canPlayerEdit(x, y + 1, z, side, itemStack)) { + if (world.getBlock(x, y, z) == soilBlockID) { + if (world.isAirBlock(x, y + 1, z)) { + /*world.getBlock(x, y + 1, z) == Blocks.air*/ + world.setBlock(x, y + 1, z, this.cropBlock); + --itemStack.stackSize; + return true; + } + } else { + return false; + } + } else { + return false; + } + return false; + } } diff --git a/src/main/java/tb/common/item/ItemMortarAndPestle.java b/src/main/java/tb/common/item/ItemMortarAndPestle.java index 1fdefa0..390cddb 100644 --- a/src/main/java/tb/common/item/ItemMortarAndPestle.java +++ b/src/main/java/tb/common/item/ItemMortarAndPestle.java @@ -3,27 +3,24 @@ package tb.common.item; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class ItemMortarAndPestle extends Item{ - - public ItemMortarAndPestle() - { - this.setMaxDamage(256); - this.setMaxStackSize(1); - } - - public boolean hasContainerItem(ItemStack stack) - { - return !(stack.getItemDamage() >= stack.getMaxDamage()); - } - - public ItemStack getContainerItem(ItemStack itemStack) - { - return itemStack.getItemDamage() >= itemStack.getMaxDamage() ? null : new ItemStack(itemStack.getItem(),1,itemStack.getItemDamage()+1); - } - - public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) - { - return false; +public class ItemMortarAndPestle extends Item { + + public ItemMortarAndPestle() { + this.setMaxDamage(256); + this.setMaxStackSize(1); } + public boolean hasContainerItem(ItemStack stack) { + return !(stack.getItemDamage() >= stack.getMaxDamage()); + } + + public ItemStack getContainerItem(ItemStack itemStack) { + return itemStack.getItemDamage() >= itemStack.getMaxDamage() + ? null + : new ItemStack(itemStack.getItem(), 1, itemStack.getItemDamage() + 1); + } + + public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) { + return false; + } } diff --git a/src/main/java/tb/common/item/ItemNodeFoci.java b/src/main/java/tb/common/item/ItemNodeFoci.java index d68639d..0b9d4f2 100644 --- a/src/main/java/tb/common/item/ItemNodeFoci.java +++ b/src/main/java/tb/common/item/ItemNodeFoci.java @@ -1,51 +1,45 @@ package tb.common.item; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class ItemNodeFoci extends Item{ +public class ItemNodeFoci extends Item { - public static final String names[] = new String[]{ - "brightness", - "destruction", - "efficiency", - "hunger", - "instability", - "purity", - "sinister", - "speed", - "stability", - "taint" - }; - - public ItemNodeFoci() - { - super(); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setMaxStackSize(1); - } - - public int getMetadata(int meta) - { - return meta; + public static final String names[] = new String[] { + "brightness", + "destruction", + "efficiency", + "hunger", + "instability", + "purity", + "sinister", + "speed", + "stability", + "taint" + }; + + public ItemNodeFoci() { + super(); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setMaxStackSize(1); } - - public String getUnlocalizedName(ItemStack is) - { - return super.getUnlocalizedName(is)+names[is.getItemDamage()].replace('/', '.'); + + public int getMetadata(int meta) { + return meta; } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubItems(Item itm, CreativeTabs tab, List lst) - { - for(int i = 0; i < names.length; ++i) - lst.add(new ItemStack(itm,1,i)); + + public String getUnlocalizedName(ItemStack is) { + return super.getUnlocalizedName(is) + names[is.getItemDamage()].replace('/', '.'); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + @SideOnly(Side.CLIENT) + public void getSubItems(Item itm, CreativeTabs tab, List lst) { + for (int i = 0; i < names.length; ++i) lst.add(new ItemStack(itm, 1, i)); } } diff --git a/src/main/java/tb/common/item/ItemPyrofluidBucket.java b/src/main/java/tb/common/item/ItemPyrofluidBucket.java index b5c3a36..60a1a72 100644 --- a/src/main/java/tb/common/item/ItemPyrofluidBucket.java +++ b/src/main/java/tb/common/item/ItemPyrofluidBucket.java @@ -1,27 +1,34 @@ package tb.common.item; -import tb.init.TBBlocks; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import tb.init.TBBlocks; -public class ItemPyrofluidBucket extends Item{ +public class ItemPyrofluidBucket extends Item { - public ItemPyrofluidBucket() - { - super(); - this.setMaxStackSize(1); - } - - public boolean onItemUse(ItemStack stk, EntityPlayer player, World w, int x, int y, int z, int side, float vecX, float vecY, float vecZ) - { - ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[side]; - w.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, TBBlocks.pyrofluid, 0, 3); - player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.bucket,1,0)); - return true; + public ItemPyrofluidBucket() { + super(); + this.setMaxStackSize(1); + } + + public boolean onItemUse( + ItemStack stk, + EntityPlayer player, + World w, + int x, + int y, + int z, + int side, + float vecX, + float vecY, + float vecZ) { + ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[side]; + w.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, TBBlocks.pyrofluid, 0, 3); + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.bucket, 1, 0)); + return true; } - } diff --git a/src/main/java/tb/common/item/ItemRevolver.java b/src/main/java/tb/common/item/ItemRevolver.java index a1878ea..590f850 100644 --- a/src/main/java/tb/common/item/ItemRevolver.java +++ b/src/main/java/tb/common/item/ItemRevolver.java @@ -1,24 +1,10 @@ package tb.common.item; -import java.util.ArrayList; -import java.util.List; - +import DummyCore.Utils.Pair; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - -import DummyCore.Utils.Pair; -import tb.api.RevolverUpgrade; -import tb.common.entity.EntityRevolverBullet; -import tb.core.TBCore; -import tb.network.proxy.TBNetworkManager; -import thaumcraft.api.IRepairable; -import thaumcraft.api.IWarpingGear; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.codechicken.lib.math.MathHelper; -import thaumcraft.common.Thaumcraft; -import thaumcraft.common.blocks.ItemJarFilled; -import thaumcraft.common.config.ConfigBlocks; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; @@ -32,294 +18,271 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import tb.api.RevolverUpgrade; +import tb.common.entity.EntityRevolverBullet; +import tb.core.TBCore; +import tb.network.proxy.TBNetworkManager; +import thaumcraft.api.IRepairable; +import thaumcraft.api.IWarpingGear; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.codechicken.lib.math.MathHelper; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.blocks.ItemJarFilled; +import thaumcraft.common.config.ConfigBlocks; -public class ItemRevolver extends Item implements IRepairable,IWarpingGear -{ - public static void addUpgrade(ItemStack stk, RevolverUpgrade upgrade, int level) - { - if(stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) - { - NBTTagList upgrades = stk.getTagCompound().getTagList("tb.upgrades",10); - for(int i = 0; i < upgrades.tagCount(); ++i) - { - NBTTagCompound tag = upgrades.getCompoundTagAt(i); - int id = tag.getInteger("id"); - int llevel = tag.getInteger("level"); - if(upgrade.id == id) - { - llevel = level; - tag.setInteger("level", llevel); - return; - } - } - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("id", upgrade.id); - tag.setInteger("level", level); - upgrades.appendTag(tag); - - }else - { - if(!stk.hasTagCompound()) - stk.setTagCompound(new NBTTagCompound()); - - if(!stk.getTagCompound().hasKey("tb.upgrades")) - stk.getTagCompound().setTag("tb.upgrades", new NBTTagList()); - - addUpgrade(stk,upgrade,level); - } - } - - public static int getUpgradeLevel(ItemStack stk, RevolverUpgrade upgrade) - { - if(stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) - { - NBTTagList upgrades = stk.getTagCompound().getTagList("tb.upgrades",10); - for(int i = 0; i < upgrades.tagCount(); ++i) - { - NBTTagCompound tag = upgrades.getCompoundTagAt(i); - int id = tag.getInteger("id"); - int level = tag.getInteger("level"); - if(id < RevolverUpgrade.allUpgrades.length && RevolverUpgrade.allUpgrades[id] != null && RevolverUpgrade.allUpgrades[id].equals(upgrade)) - return level; - } - } - - return 0; - } - - public static ArrayList> getAllUpgradesFor(ItemStack stk) - { - ArrayList> retLst = new ArrayList>(); - - if(stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) - { - NBTTagList upgrades = stk.getTagCompound().getTagList("tb.upgrades",10); - for(int i = 0; i < upgrades.tagCount(); ++i) - { - NBTTagCompound tag = upgrades.getCompoundTagAt(i); - int id = tag.getInteger("id"); - int level = tag.getInteger("level"); - if(id < RevolverUpgrade.allUpgrades.length && RevolverUpgrade.allUpgrades[id] != null) - retLst.add(new Pair(RevolverUpgrade.allUpgrades[id],level)); - } - } - - return retLst; - } - - public boolean hitEntity(ItemStack stk, EntityLivingBase attacker, EntityLivingBase attacked) - { - stk.damageItem(2, attacked); +public class ItemRevolver extends Item implements IRepairable, IWarpingGear { + public static void addUpgrade(ItemStack stk, RevolverUpgrade upgrade, int level) { + if (stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) { + NBTTagList upgrades = stk.getTagCompound().getTagList("tb.upgrades", 10); + for (int i = 0; i < upgrades.tagCount(); ++i) { + NBTTagCompound tag = upgrades.getCompoundTagAt(i); + int id = tag.getInteger("id"); + int llevel = tag.getInteger("level"); + if (upgrade.id == id) { + llevel = level; + tag.setInteger("level", llevel); + return; + } + } + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("id", upgrade.id); + tag.setInteger("level", level); + upgrades.appendTag(tag); + + } else { + if (!stk.hasTagCompound()) stk.setTagCompound(new NBTTagCompound()); + + if (!stk.getTagCompound().hasKey("tb.upgrades")) + stk.getTagCompound().setTag("tb.upgrades", new NBTTagList()); + + addUpgrade(stk, upgrade, level); + } + } + + public static int getUpgradeLevel(ItemStack stk, RevolverUpgrade upgrade) { + if (stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) { + NBTTagList upgrades = stk.getTagCompound().getTagList("tb.upgrades", 10); + for (int i = 0; i < upgrades.tagCount(); ++i) { + NBTTagCompound tag = upgrades.getCompoundTagAt(i); + int id = tag.getInteger("id"); + int level = tag.getInteger("level"); + if (id < RevolverUpgrade.allUpgrades.length + && RevolverUpgrade.allUpgrades[id] != null + && RevolverUpgrade.allUpgrades[id].equals(upgrade)) return level; + } + } + + return 0; + } + + public static ArrayList> getAllUpgradesFor(ItemStack stk) { + ArrayList> retLst = new ArrayList>(); + + if (stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) { + NBTTagList upgrades = stk.getTagCompound().getTagList("tb.upgrades", 10); + for (int i = 0; i < upgrades.tagCount(); ++i) { + NBTTagCompound tag = upgrades.getCompoundTagAt(i); + int id = tag.getInteger("id"); + int level = tag.getInteger("level"); + if (id < RevolverUpgrade.allUpgrades.length && RevolverUpgrade.allUpgrades[id] != null) + retLst.add(new Pair(RevolverUpgrade.allUpgrades[id], level)); + } + } + + return retLst; + } + + public boolean hitEntity(ItemStack stk, EntityLivingBase attacker, EntityLivingBase attacked) { + stk.damageItem(2, attacked); return true; } - - public ItemStack onItemRightClick(ItemStack stk, World w, EntityPlayer user) - { - if(w.isRemote) - return stk; - - if(!stk.hasTagCompound()) - stk.setTagCompound(new NBTTagCompound()); - - if(stk.getTagCompound().getInteger("shots") > 0) - { - EntityRevolverBullet b = new EntityRevolverBullet(w,user); - if(!w.isRemote) - w.spawnEntityInWorld(b); - - stk.damageItem(1, user); - if(stk == null || stk.getItemDamage() > stk.getMaxDamage()) - return null; - - TBNetworkManager.playSoundOnServer(w, "thaumicbases:revolver.shot", user.posX, user.posY, user.posZ, 3, 1F); - - stk.getTagCompound().setDouble("barrelRotation", stk.getTagCompound().getDouble("barrelRotation")+45); - - stk.getTagCompound().setInteger("shots", stk.getTagCompound().getInteger("shots")-1); - } - else - { - if (stk.hasTagCompound() && stk.getTagCompound().hasKey("jar")) - { - ItemStack jar = ItemStack.loadItemStackFromNBT(stk.stackTagCompound.getCompoundTag("jar")); - - if(jar == null) - { - TBNetworkManager.playSoundOnServer(w, "thaumicbases:revolver.click", user.posX, user.posY, user.posZ, 3, 2F); - stk.getTagCompound().setDouble("barrelRotation", stk.getTagCompound().getDouble("barrelRotation")+45); - - return super.onItemRightClick(stk, w, user); - } - - ArrayList> upgrades = getAllUpgradesFor(stk); - boolean hasPrimal = false; - for(Pair p : upgrades) - { - if(p.getFirst() == RevolverUpgrade.primal) - hasPrimal = true; - - if(hasPrimal) - break; - } - - int addedShots = hasPrimal ? 1 : 2; - for(Pair p : upgrades) - { - addedShots = p.getFirst().modifyShots(user, stk, p.getSecond(), addedShots, hasPrimal); - } - - boolean addShots = false; - - if(!(jar.getItem() instanceof ItemJarFilled)) - return super.onItemRightClick(stk, w, user); - - AspectList aspects = ((ItemJarFilled)jar.getItem()).getAspects(jar); - if (aspects != null && aspects.size() > 0) - { - for (Aspect tag : aspects.getAspectsSorted()) - { - if(tag == Aspect.WEAPON) - { - int required = addedShots < 0 ? 2 : 1; - if(aspects.getAmount(tag) >= required) - { - aspects.reduce(tag, required); - addShots = true; - break; - } - } - } - } - - if(addShots) - { - stk.getTagCompound().setInteger("shots", addedShots < 0 ? 1 : addedShots); - TBNetworkManager.playSoundOnServer(w, "thaumicbases:revolver.reload", user.posX, user.posY, user.posZ, 3, 2F); - } - - if(aspects.visSize() > 0) - { - ((ItemJarFilled)jar.getItem()).setAspects(jar, aspects); - NBTTagCompound tag = new NBTTagCompound(); - jar.writeToNBT(tag); - stk.setTagInfo("jar", tag); - }else - { - ItemStack emptyJar = new ItemStack(ConfigBlocks.blockJar,1,0); - NBTTagCompound tag = new NBTTagCompound(); - emptyJar.writeToNBT(tag); - stk.setTagInfo("jar", tag); - } - }else - { - TBNetworkManager.playSoundOnServer(w, "thaumicbases:revolver.click", user.posX, user.posY, user.posZ, 3, 2F); - } - } - return super.onItemRightClick(stk, w, user); - } - - public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) - { - if(!entityLiving.worldObj.isRemote) - { - if(entityLiving instanceof EntityPlayer) - { - if(EntityPlayer.class.cast(entityLiving).openContainer instanceof ContainerPlayer && entityLiving.isSneaking()) - { - EntityPlayer.class.cast(entityLiving).openGui(TBCore.instance, 0x421919, entityLiving.worldObj, MathHelper.floor_double(entityLiving.posX), MathHelper.floor_double(entityLiving.posY), MathHelper.floor_double(entityLiving.posZ)); - } - } - } + + public ItemStack onItemRightClick(ItemStack stk, World w, EntityPlayer user) { + if (w.isRemote) return stk; + + if (!stk.hasTagCompound()) stk.setTagCompound(new NBTTagCompound()); + + if (stk.getTagCompound().getInteger("shots") > 0) { + EntityRevolverBullet b = new EntityRevolverBullet(w, user); + if (!w.isRemote) w.spawnEntityInWorld(b); + + stk.damageItem(1, user); + if (stk == null || stk.getItemDamage() > stk.getMaxDamage()) return null; + + TBNetworkManager.playSoundOnServer(w, "thaumicbases:revolver.shot", user.posX, user.posY, user.posZ, 3, 1F); + + stk.getTagCompound() + .setDouble("barrelRotation", stk.getTagCompound().getDouble("barrelRotation") + 45); + + stk.getTagCompound().setInteger("shots", stk.getTagCompound().getInteger("shots") - 1); + } else { + if (stk.hasTagCompound() && stk.getTagCompound().hasKey("jar")) { + ItemStack jar = ItemStack.loadItemStackFromNBT(stk.stackTagCompound.getCompoundTag("jar")); + + if (jar == null) { + TBNetworkManager.playSoundOnServer( + w, "thaumicbases:revolver.click", user.posX, user.posY, user.posZ, 3, 2F); + stk.getTagCompound() + .setDouble("barrelRotation", stk.getTagCompound().getDouble("barrelRotation") + 45); + + return super.onItemRightClick(stk, w, user); + } + + ArrayList> upgrades = getAllUpgradesFor(stk); + boolean hasPrimal = false; + for (Pair p : upgrades) { + if (p.getFirst() == RevolverUpgrade.primal) hasPrimal = true; + + if (hasPrimal) break; + } + + int addedShots = hasPrimal ? 1 : 2; + for (Pair p : upgrades) { + addedShots = p.getFirst().modifyShots(user, stk, p.getSecond(), addedShots, hasPrimal); + } + + boolean addShots = false; + + if (!(jar.getItem() instanceof ItemJarFilled)) return super.onItemRightClick(stk, w, user); + + AspectList aspects = ((ItemJarFilled) jar.getItem()).getAspects(jar); + if (aspects != null && aspects.size() > 0) { + for (Aspect tag : aspects.getAspectsSorted()) { + if (tag == Aspect.WEAPON) { + int required = addedShots < 0 ? 2 : 1; + if (aspects.getAmount(tag) >= required) { + aspects.reduce(tag, required); + addShots = true; + break; + } + } + } + } + + if (addShots) { + stk.getTagCompound().setInteger("shots", addedShots < 0 ? 1 : addedShots); + TBNetworkManager.playSoundOnServer( + w, "thaumicbases:revolver.reload", user.posX, user.posY, user.posZ, 3, 2F); + } + + if (aspects.visSize() > 0) { + ((ItemJarFilled) jar.getItem()).setAspects(jar, aspects); + NBTTagCompound tag = new NBTTagCompound(); + jar.writeToNBT(tag); + stk.setTagInfo("jar", tag); + } else { + ItemStack emptyJar = new ItemStack(ConfigBlocks.blockJar, 1, 0); + NBTTagCompound tag = new NBTTagCompound(); + emptyJar.writeToNBT(tag); + stk.setTagInfo("jar", tag); + } + } else { + TBNetworkManager.playSoundOnServer( + w, "thaumicbases:revolver.click", user.posX, user.posY, user.posZ, 3, 2F); + } + } + return super.onItemRightClick(stk, w, user); + } + + public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { + if (!entityLiving.worldObj.isRemote) { + if (entityLiving instanceof EntityPlayer) { + if (EntityPlayer.class.cast(entityLiving).openContainer instanceof ContainerPlayer + && entityLiving.isSneaking()) { + EntityPlayer.class + .cast(entityLiving) + .openGui( + TBCore.instance, + 0x421919, + entityLiving.worldObj, + MathHelper.floor_double(entityLiving.posX), + MathHelper.floor_double(entityLiving.posY), + MathHelper.floor_double(entityLiving.posZ)); + } + } + } return false; } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void addInformation(ItemStack stk, EntityPlayer p, List lst, boolean isCurrentItem) - { - super.addInformation(stk, p, lst, isCurrentItem); - iLabel:if (stk.hasTagCompound() && stk.getTagCompound().hasKey("jar")) - { - ItemStack jar = ItemStack.loadItemStackFromNBT(stk.stackTagCompound.getCompoundTag("jar")); - - try - { - if(!(jar.getItem() instanceof ItemJarFilled)) - break iLabel; - - AspectList aspects = ((ItemJarFilled)jar.getItem()).getAspects(jar); - - if (aspects != null && aspects.size() > 0) - for (Aspect tag : aspects.getAspectsSorted()) - if (Thaumcraft.proxy.playerKnowledge.hasDiscoveredAspect(p.getCommandSenderName(), tag)) - lst.add(tag.getName() + " x " + aspects.getAmount(tag)); - else - lst.add(StatCollector.translateToLocal("tc.aspect.unknown")); - } - catch (Exception e) - { - //... - } - } - if(stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) - { - ArrayList> upgrades = getAllUpgradesFor(stk); - for(Pair pr : upgrades) - { - lst.add(pr.getFirst().getName()+" "+StatCollector.translateToLocal("enchantment.level."+pr.getSecond())); - } - } - } - - public EnumRarity getRarity(ItemStack stk) - { + + @SuppressWarnings({"rawtypes", "unchecked"}) + public void addInformation(ItemStack stk, EntityPlayer p, List lst, boolean isCurrentItem) { + super.addInformation(stk, p, lst, isCurrentItem); + iLabel: + if (stk.hasTagCompound() && stk.getTagCompound().hasKey("jar")) { + ItemStack jar = ItemStack.loadItemStackFromNBT(stk.stackTagCompound.getCompoundTag("jar")); + + try { + if (!(jar.getItem() instanceof ItemJarFilled)) break iLabel; + + AspectList aspects = ((ItemJarFilled) jar.getItem()).getAspects(jar); + + if (aspects != null && aspects.size() > 0) + for (Aspect tag : aspects.getAspectsSorted()) + if (Thaumcraft.proxy.playerKnowledge.hasDiscoveredAspect(p.getCommandSenderName(), tag)) + lst.add(tag.getName() + " x " + aspects.getAmount(tag)); + else lst.add(StatCollector.translateToLocal("tc.aspect.unknown")); + } catch (Exception e) { + // ... + } + } + if (stk.hasTagCompound() && stk.getTagCompound().hasKey("tb.upgrades")) { + ArrayList> upgrades = getAllUpgradesFor(stk); + for (Pair pr : upgrades) { + lst.add(pr.getFirst().getName() + " " + + StatCollector.translateToLocal("enchantment.level." + pr.getSecond())); + } + } + } + + public EnumRarity getRarity(ItemStack stk) { return EnumRarity.rare; } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public Multimap getAttributeModifiers(ItemStack stack) - { - HashMultimap retMap = HashMultimap.create(); - - retMap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 5.0F+(getUpgradeLevel(stack, RevolverUpgrade.heavy)*2), 0)); - - return retMap; + + @SuppressWarnings({"rawtypes", "unchecked"}) + @Override + public Multimap getAttributeModifiers(ItemStack stack) { + HashMultimap retMap = HashMultimap.create(); + + retMap.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier( + field_111210_e, + "Weapon modifier", + 5.0F + (getUpgradeLevel(stack, RevolverUpgrade.heavy) * 2), + 0)); + + return retMap; } - public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) - { - super.onUpdate(stk, w, entity, slot, held); - int u = getUpgradeLevel(stk, RevolverUpgrade.uvoid); - if(u > 0) - if ((stk.isItemDamaged()) && (entity != null) && (entity.ticksExisted % 100/u == 0) && ((entity instanceof EntityLivingBase))) - stk.damageItem(-1, (EntityLivingBase)entity); - - if(stk.getTagCompound() != null) - { - double rotation = stk.getTagCompound().getDouble("barrelRotation"); - double renderedRotation = stk.getTagCompound().getDouble("renderedRotation"); - - if(rotation >= 3600000) - rotation -= 3600000; - - if(renderedRotation >= 3600000) - renderedRotation -= 3600000; - - if(renderedRotation < rotation) - renderedRotation += 10; - - renderedRotation = Math.min(rotation, renderedRotation); - - stk.getTagCompound().setDouble("barrelRotation", rotation); - stk.getTagCompound().setDouble("renderedRotation", renderedRotation); - - } - } - - @Override - public int getWarp(ItemStack stk, EntityPlayer player) - { - return getUpgradeLevel(stk, RevolverUpgrade.uvoid); - } + public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) { + super.onUpdate(stk, w, entity, slot, held); + int u = getUpgradeLevel(stk, RevolverUpgrade.uvoid); + if (u > 0) + if ((stk.isItemDamaged()) + && (entity != null) + && (entity.ticksExisted % 100 / u == 0) + && ((entity instanceof EntityLivingBase))) stk.damageItem(-1, (EntityLivingBase) entity); + if (stk.getTagCompound() != null) { + double rotation = stk.getTagCompound().getDouble("barrelRotation"); + double renderedRotation = stk.getTagCompound().getDouble("renderedRotation"); + + if (rotation >= 3600000) rotation -= 3600000; + + if (renderedRotation >= 3600000) renderedRotation -= 3600000; + + if (renderedRotation < rotation) renderedRotation += 10; + + renderedRotation = Math.min(rotation, renderedRotation); + + stk.getTagCompound().setDouble("barrelRotation", rotation); + stk.getTagCompound().setDouble("renderedRotation", renderedRotation); + } + } + + @Override + public int getWarp(ItemStack stk, EntityPlayer player) { + return getUpgradeLevel(stk, RevolverUpgrade.uvoid); + } } diff --git a/src/main/java/tb/common/item/ItemRosehipSyrup.java b/src/main/java/tb/common/item/ItemRosehipSyrup.java index 816ed5b..ecad94e 100644 --- a/src/main/java/tb/common/item/ItemRosehipSyrup.java +++ b/src/main/java/tb/common/item/ItemRosehipSyrup.java @@ -3,9 +3,6 @@ package tb.common.item; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; - -import thaumcraft.common.config.Config; -import thaumcraft.common.config.ConfigItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; @@ -13,107 +10,104 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; +import thaumcraft.common.config.Config; +import thaumcraft.common.config.ConfigItems; -public class ItemRosehipSyrup extends Item{ +public class ItemRosehipSyrup extends Item { - public ItemStack onItemRightClick(ItemStack stack, World w, EntityPlayer player) - { - player.setItemInUse(stack, getMaxItemUseDuration(stack)); + public ItemStack onItemRightClick(ItemStack stack, World w, EntityPlayer player) { + player.setItemInUse(stack, getMaxItemUseDuration(stack)); return stack; } - - public EnumAction getItemUseAction(ItemStack stack) - { + + public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.drink; } - public int getMaxItemUseDuration(ItemStack stack) - { + public int getMaxItemUseDuration(ItemStack stack) { return 32; } - + @SuppressWarnings("unchecked") - public ItemStack onEaten(ItemStack stack, World w, EntityPlayer player) - { - if (!player.capabilities.isCreativeMode) - { + public ItemStack onEaten(ItemStack stack, World w, EntityPlayer player) { + if (!player.capabilities.isCreativeMode) { --stack.stackSize; - if(stack.stackSize > 0) - { - if(!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence,1,0))) - player.dropPlayerItemWithRandomChoice(new ItemStack(ConfigItems.itemEssence,1,0), false); + if (stack.stackSize > 0) { + if (!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence, 1, 0))) + player.dropPlayerItemWithRandomChoice(new ItemStack(ConfigItems.itemEssence, 1, 0), false); } } - if (!w.isRemote) - { - Collection c = player.getActivePotionEffects(); - Iterator $i = c.iterator(); - ArrayList removeEffects = new ArrayList(); - while($i.hasNext()) - { - PotionEffect effect = $i.next(); - int i = processPotion(player,effect); - if(i != -1) - removeEffects.add(i); - } - - for(int i = 0; i < removeEffects.size(); ++i) - { - int j = removeEffects.get(i); - if(j != -1 && j < Potion.potionTypes.length && Potion.potionTypes[j] != null) - { - if(player.getActivePotionEffect(Potion.potionTypes[j]) != null) - { - player.removePotionEffect(j); - } - } - } + if (!w.isRemote) { + Collection c = player.getActivePotionEffects(); + Iterator $i = c.iterator(); + ArrayList removeEffects = new ArrayList(); + while ($i.hasNext()) { + PotionEffect effect = $i.next(); + int i = processPotion(player, effect); + if (i != -1) removeEffects.add(i); + } + + for (int i = 0; i < removeEffects.size(); ++i) { + int j = removeEffects.get(i); + if (j != -1 && j < Potion.potionTypes.length && Potion.potionTypes[j] != null) { + if (player.getActivePotionEffect(Potion.potionTypes[j]) != null) { + player.removePotionEffect(j); + } + } + } } - return stack.stackSize <= 0 ? new ItemStack(ConfigItems.itemEssence,1,0) : stack; + return stack.stackSize <= 0 ? new ItemStack(ConfigItems.itemEssence, 1, 0) : stack; } - - public static int processPotion(EntityPlayer p, PotionEffect effect) - { - if(effect != null && effect.getPotionID() < Potion.potionTypes.length && Potion.potionTypes[effect.getPotionID()] != null) - { - if(isBadEffect(Potion.potionTypes[effect.getPotionID()])) - return effect.getPotionID(); - - if(canDecreaseLevel(Potion.potionTypes[effect.getPotionID()])) - { - if(effect.getAmplifier() == 0) - return effect.getPotionID(); - else - { - reflectPotionEffect(p,effect); - return -1; - } - } - } - - return -1; + + public static int processPotion(EntityPlayer p, PotionEffect effect) { + if (effect != null + && effect.getPotionID() < Potion.potionTypes.length + && Potion.potionTypes[effect.getPotionID()] != null) { + if (isBadEffect(Potion.potionTypes[effect.getPotionID()])) return effect.getPotionID(); + + if (canDecreaseLevel(Potion.potionTypes[effect.getPotionID()])) { + if (effect.getAmplifier() == 0) return effect.getPotionID(); + else { + reflectPotionEffect(p, effect); + return -1; + } + } + } + + return -1; } - - public static boolean isBadEffect(Potion p) - { - return p != null && (p == Potion.blindness || p == Potion.confusion || p == Potion.digSlowdown || p == Potion.hunger || p == Potion.moveSlowdown || p == Potion.poison || p == Potion.weakness || p == Potion.wither); + + public static boolean isBadEffect(Potion p) { + return p != null + && (p == Potion.blindness + || p == Potion.confusion + || p == Potion.digSlowdown + || p == Potion.hunger + || p == Potion.moveSlowdown + || p == Potion.poison + || p == Potion.weakness + || p == Potion.wither); } - - public static boolean canDecreaseLevel(Potion p) - { - int id = p.getId(); - return p != null && (id == Config.potionBlurredID || id == Config.potionInfVisExhaustID || id == Config.potionTaintPoisonID || id == Config.potionThaumarhiaID || id == Config.potionUnHungerID || id == Config.potionVisExhaustID); + + public static boolean canDecreaseLevel(Potion p) { + int id = p.getId(); + return p != null + && (id == Config.potionBlurredID + || id == Config.potionInfVisExhaustID + || id == Config.potionTaintPoisonID + || id == Config.potionThaumarhiaID + || id == Config.potionUnHungerID + || id == Config.potionVisExhaustID); } - - public static void reflectPotionEffect(EntityPlayer p, PotionEffect effect) - { - int amp = effect.getAmplifier()-1; - int id = effect.getPotionID(); - int dur = effect.getDuration(); - boolean transparent = effect.getIsAmbient(); - p.removePotionEffect(effect.getPotionID()); - p.addPotionEffect(new PotionEffect(id,dur,amp,transparent)); + + public static void reflectPotionEffect(EntityPlayer p, PotionEffect effect) { + int amp = effect.getAmplifier() - 1; + int id = effect.getPotionID(); + int dur = effect.getDuration(); + boolean transparent = effect.getIsAmbient(); + p.removePotionEffect(effect.getPotionID()); + p.addPotionEffect(new PotionEffect(id, dur, amp, transparent)); } } diff --git a/src/main/java/tb/common/item/ItemSmokingPipe.java b/src/main/java/tb/common/item/ItemSmokingPipe.java index 30a2047..7b4eff6 100644 --- a/src/main/java/tb/common/item/ItemSmokingPipe.java +++ b/src/main/java/tb/common/item/ItemSmokingPipe.java @@ -1,93 +1,78 @@ package tb.common.item; -import tb.api.ITobacco; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import tb.api.ITobacco; -public class ItemSmokingPipe extends Item -{ - public boolean isSilverwood; - - public ItemSmokingPipe(boolean silverwood) - { - super(); - isSilverwood = silverwood; - this.setFull3D(); - this.setMaxStackSize(1); - } - - public ItemStack getTobacco(EntityPlayer p) - { - for(int i = 0; i < p.inventory.getSizeInventory(); ++i) - { - ItemStack stk = p.inventory.getStackInSlot(i); - if(stk != null && stk.getItem() != null && stk.getItem() instanceof ITobacco) - return stk; - } - return null; - } - - public ItemStack onItemRightClick(ItemStack stack, World w, EntityPlayer player) - { - if(this.getTobacco(player) != null) - player.setItemInUse(stack, getMaxItemUseDuration(stack)); - return stack; - } - - public EnumAction getItemUseAction(ItemStack stack) - { - return EnumAction.bow; - } +public class ItemSmokingPipe extends Item { + public boolean isSilverwood; - public int getMaxItemUseDuration(ItemStack stack) - { - return 64; - } - - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) - { - Vec3 look = player.getLookVec(); - double x = player.posX+look.xCoord/5; - double y = player.posY+player.getEyeHeight()+look.yCoord/5; - double z = player.posZ+look.zCoord/5; - if(count < 32) - player.worldObj.spawnParticle(isSilverwood ? "explode" : "smoke", x, y, z, look.xCoord/10, look.yCoord/10, look.zCoord/10); + public ItemSmokingPipe(boolean silverwood) { + super(); + isSilverwood = silverwood; + this.setFull3D(); + this.setMaxStackSize(1); } - - public ItemStack onEaten(ItemStack stack, World w, EntityPlayer player) - { - ItemStack tobacco = getTobacco(player); - //1.8 NPE patch - if(tobacco == null) - return stack; - - ITobacco t = ITobacco.class.cast(tobacco.getItem()); - t.performTobaccoEffect(player, tobacco.getItemDamage(), isSilverwood); - for(int i = 0; i < player.inventory.getSizeInventory(); ++i) - { - ItemStack stk = player.inventory.getStackInSlot(i); - if(stk != null && stk.getItem() != null && stk.getItem() instanceof ITobacco) - { - player.inventory.decrStackSize(i, 1); - break; - } - } - Vec3 look = player.getLookVec(); - for(int i = 0; i < 100; ++i) - { - double x = player.posX+look.xCoord/5; - double y = player.posY+player.getEyeHeight()+look.yCoord/5; - double z = player.posZ+look.zCoord/5; - - player.worldObj.spawnParticle(isSilverwood ? "explode" : "smoke", x, y, z, look.xCoord/10, look.yCoord/10, look.zCoord/10); - } - - return stack; - } - + public ItemStack getTobacco(EntityPlayer p) { + for (int i = 0; i < p.inventory.getSizeInventory(); ++i) { + ItemStack stk = p.inventory.getStackInSlot(i); + if (stk != null && stk.getItem() != null && stk.getItem() instanceof ITobacco) return stk; + } + return null; + } + + public ItemStack onItemRightClick(ItemStack stack, World w, EntityPlayer player) { + if (this.getTobacco(player) != null) player.setItemInUse(stack, getMaxItemUseDuration(stack)); + return stack; + } + + public EnumAction getItemUseAction(ItemStack stack) { + return EnumAction.bow; + } + + public int getMaxItemUseDuration(ItemStack stack) { + return 64; + } + + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { + Vec3 look = player.getLookVec(); + double x = player.posX + look.xCoord / 5; + double y = player.posY + player.getEyeHeight() + look.yCoord / 5; + double z = player.posZ + look.zCoord / 5; + if (count < 32) + player.worldObj.spawnParticle( + isSilverwood ? "explode" : "smoke", x, y, z, look.xCoord / 10, look.yCoord / 10, look.zCoord / 10); + } + + public ItemStack onEaten(ItemStack stack, World w, EntityPlayer player) { + ItemStack tobacco = getTobacco(player); + // 1.8 NPE patch + if (tobacco == null) return stack; + + ITobacco t = ITobacco.class.cast(tobacco.getItem()); + t.performTobaccoEffect(player, tobacco.getItemDamage(), isSilverwood); + for (int i = 0; i < player.inventory.getSizeInventory(); ++i) { + ItemStack stk = player.inventory.getStackInSlot(i); + if (stk != null && stk.getItem() != null && stk.getItem() instanceof ITobacco) { + player.inventory.decrStackSize(i, 1); + break; + } + } + Vec3 look = player.getLookVec(); + for (int i = 0; i < 100; ++i) { + double x = player.posX + look.xCoord / 5; + double y = player.posY + player.getEyeHeight() + look.yCoord / 5; + double z = player.posZ + look.zCoord / 5; + + player.worldObj.spawnParticle( + isSilverwood ? "explode" : "smoke", x, y, z, look.xCoord / 10, look.yCoord / 10, look.zCoord / 10); + } + + return stack; + } } diff --git a/src/main/java/tb/common/item/ItemThauminiteArmor.java b/src/main/java/tb/common/item/ItemThauminiteArmor.java index 094e1e0..ee14fab 100644 --- a/src/main/java/tb/common/item/ItemThauminiteArmor.java +++ b/src/main/java/tb/common/item/ItemThauminiteArmor.java @@ -1,49 +1,48 @@ package tb.common.item; import java.util.List; - -import thaumcraft.api.IRepairable; -import thaumcraft.api.IRunicArmor; -import thaumcraft.api.IVisDiscountGear; -import thaumcraft.api.aspects.Aspect; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import thaumcraft.api.IRepairable; +import thaumcraft.api.IRunicArmor; +import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.aspects.Aspect; -public class ItemThauminiteArmor extends ItemArmor implements IRepairable, IVisDiscountGear, IRunicArmor{ +public class ItemThauminiteArmor extends ItemArmor implements IRepairable, IVisDiscountGear, IRunicArmor { - int aType; - - public ItemThauminiteArmor(ArmorMaterial mat,int aType) { - super(mat, 0, aType); - this.aType = aType; - } - - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - return slot == 2 ? "thaumicbases:textures/items/armor/thauminite/thauminite_2.png" : "thaumicbases:textures/items/armor/thauminite/thauminite_1.png"; + int aType; + + public ItemThauminiteArmor(ArmorMaterial mat, int aType) { + super(mat, 0, aType); + this.aType = aType; } - @Override - public int getVisDiscount(ItemStack stack, EntityPlayer player, - Aspect aspect) { - return discount[aType]; - } - - static final int[] discount = new int[]{5,2,3,1}; + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return slot == 2 + ? "thaumicbases:textures/items/armor/thauminite/thauminite_2.png" + : "thaumicbases:textures/items/armor/thauminite/thauminite_1.png"; + } - @Override - public int getRunicCharge(ItemStack itemstack) { - return 0; - } + @Override + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + return discount[aType]; + } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) - { - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + getVisDiscount(stack, player, null) + "%"); - super.addInformation(stack, player, list, par4); - } + static final int[] discount = new int[] {5, 2, 3, 1}; + + @Override + public int getRunicCharge(ItemStack itemstack) { + return 0; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + + getVisDiscount(stack, player, null) + "%"); + super.addInformation(stack, player, list, par4); + } } diff --git a/src/main/java/tb/common/item/ItemThauminiteAxe.java b/src/main/java/tb/common/item/ItemThauminiteAxe.java index e0c11c2..900ff74 100644 --- a/src/main/java/tb/common/item/ItemThauminiteAxe.java +++ b/src/main/java/tb/common/item/ItemThauminiteAxe.java @@ -1,12 +1,11 @@ package tb.common.item; -import thaumcraft.api.IRepairable; import net.minecraft.item.ItemAxe; +import thaumcraft.api.IRepairable; -public class ItemThauminiteAxe extends ItemAxe implements IRepairable{ - - public ItemThauminiteAxe(ToolMaterial mat) { - super(mat); - } +public class ItemThauminiteAxe extends ItemAxe implements IRepairable { + public ItemThauminiteAxe(ToolMaterial mat) { + super(mat); + } } diff --git a/src/main/java/tb/common/item/ItemThauminiteHoe.java b/src/main/java/tb/common/item/ItemThauminiteHoe.java index 55f2961..061068d 100644 --- a/src/main/java/tb/common/item/ItemThauminiteHoe.java +++ b/src/main/java/tb/common/item/ItemThauminiteHoe.java @@ -1,12 +1,11 @@ package tb.common.item; -import thaumcraft.api.IRepairable; import net.minecraft.item.ItemHoe; +import thaumcraft.api.IRepairable; -public class ItemThauminiteHoe extends ItemHoe implements IRepairable{ - - public ItemThauminiteHoe(ToolMaterial mat) { - super(mat); - } +public class ItemThauminiteHoe extends ItemHoe implements IRepairable { + public ItemThauminiteHoe(ToolMaterial mat) { + super(mat); + } } diff --git a/src/main/java/tb/common/item/ItemThauminitePickaxe.java b/src/main/java/tb/common/item/ItemThauminitePickaxe.java index 5377b27..25fbf63 100644 --- a/src/main/java/tb/common/item/ItemThauminitePickaxe.java +++ b/src/main/java/tb/common/item/ItemThauminitePickaxe.java @@ -1,12 +1,11 @@ package tb.common.item; -import thaumcraft.api.IRepairable; import net.minecraft.item.ItemPickaxe; +import thaumcraft.api.IRepairable; -public class ItemThauminitePickaxe extends ItemPickaxe implements IRepairable{ - - public ItemThauminitePickaxe(ToolMaterial mat) { - super(mat); - } +public class ItemThauminitePickaxe extends ItemPickaxe implements IRepairable { + public ItemThauminitePickaxe(ToolMaterial mat) { + super(mat); + } } diff --git a/src/main/java/tb/common/item/ItemThauminiteShears.java b/src/main/java/tb/common/item/ItemThauminiteShears.java index 4347162..f5c759c 100644 --- a/src/main/java/tb/common/item/ItemThauminiteShears.java +++ b/src/main/java/tb/common/item/ItemThauminiteShears.java @@ -1,13 +1,11 @@ package tb.common.item; -import thaumcraft.api.IRepairable; import net.minecraft.item.ItemShears; +import thaumcraft.api.IRepairable; -public class ItemThauminiteShears extends ItemShears implements IRepairable -{ - - public ItemThauminiteShears() { - super(); - } +public class ItemThauminiteShears extends ItemShears implements IRepairable { + public ItemThauminiteShears() { + super(); + } } diff --git a/src/main/java/tb/common/item/ItemThauminiteShovel.java b/src/main/java/tb/common/item/ItemThauminiteShovel.java index 9987047..9eaa206 100644 --- a/src/main/java/tb/common/item/ItemThauminiteShovel.java +++ b/src/main/java/tb/common/item/ItemThauminiteShovel.java @@ -1,12 +1,11 @@ package tb.common.item; -import thaumcraft.api.IRepairable; import net.minecraft.item.ItemSpade; +import thaumcraft.api.IRepairable; -public class ItemThauminiteShovel extends ItemSpade implements IRepairable{ - - public ItemThauminiteShovel(ToolMaterial mat) { - super(mat); - } +public class ItemThauminiteShovel extends ItemSpade implements IRepairable { + public ItemThauminiteShovel(ToolMaterial mat) { + super(mat); + } } diff --git a/src/main/java/tb/common/item/ItemThauminiteSword.java b/src/main/java/tb/common/item/ItemThauminiteSword.java index d71985d..1e2848a 100644 --- a/src/main/java/tb/common/item/ItemThauminiteSword.java +++ b/src/main/java/tb/common/item/ItemThauminiteSword.java @@ -1,12 +1,11 @@ package tb.common.item; -import thaumcraft.api.IRepairable; import net.minecraft.item.ItemSword; +import thaumcraft.api.IRepairable; -public class ItemThauminiteSword extends ItemSword implements IRepairable{ - - public ItemThauminiteSword(ToolMaterial mat) { - super(mat); - } +public class ItemThauminiteSword extends ItemSword implements IRepairable { + public ItemThauminiteSword(ToolMaterial mat) { + super(mat); + } } diff --git a/src/main/java/tb/common/item/ItemVoidFlintAndSteel.java b/src/main/java/tb/common/item/ItemVoidFlintAndSteel.java index fa43c5e..13a4966 100644 --- a/src/main/java/tb/common/item/ItemVoidFlintAndSteel.java +++ b/src/main/java/tb/common/item/ItemVoidFlintAndSteel.java @@ -1,7 +1,5 @@ package tb.common.item; -import thaumcraft.api.IRepairable; -import thaumcraft.api.IWarpingGear; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -9,24 +7,24 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import thaumcraft.api.IRepairable; +import thaumcraft.api.IWarpingGear; -public class ItemVoidFlintAndSteel extends ItemFlintAndSteel implements IRepairable,IWarpingGear -{ - - public EnumRarity getRarity(ItemStack itemstack) - { - return EnumRarity.uncommon; - } - - public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) - { - super.onUpdate(stk, w, entity, slot, held); - if ((stk.isItemDamaged()) && (entity != null) && (entity.ticksExisted % 20 == 0) && ((entity instanceof EntityLivingBase))) - stk.damageItem(-1, (EntityLivingBase)entity); - } - - public int getWarp(ItemStack itemstack, EntityPlayer player) - { - return 1; - } +public class ItemVoidFlintAndSteel extends ItemFlintAndSteel implements IRepairable, IWarpingGear { + + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.uncommon; + } + + public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) { + super.onUpdate(stk, w, entity, slot, held); + if ((stk.isItemDamaged()) + && (entity != null) + && (entity.ticksExisted % 20 == 0) + && ((entity instanceof EntityLivingBase))) stk.damageItem(-1, (EntityLivingBase) entity); + } + + public int getWarp(ItemStack itemstack, EntityPlayer player) { + return 1; + } } diff --git a/src/main/java/tb/common/item/ItemVoidShears.java b/src/main/java/tb/common/item/ItemVoidShears.java index 636ae26..e657e4b 100644 --- a/src/main/java/tb/common/item/ItemVoidShears.java +++ b/src/main/java/tb/common/item/ItemVoidShears.java @@ -1,7 +1,5 @@ package tb.common.item; -import thaumcraft.api.IRepairable; -import thaumcraft.api.IWarpingGear; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -9,23 +7,24 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemShears; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import thaumcraft.api.IRepairable; +import thaumcraft.api.IWarpingGear; -public class ItemVoidShears extends ItemShears implements IRepairable,IWarpingGear{ - - public EnumRarity getRarity(ItemStack itemstack) - { - return EnumRarity.uncommon; - } - - public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) - { - super.onUpdate(stk, w, entity, slot, held); - if ((stk.isItemDamaged()) && (entity != null) && (entity.ticksExisted % 20 == 0) && ((entity instanceof EntityLivingBase))) - stk.damageItem(-1, (EntityLivingBase)entity); - } - - public int getWarp(ItemStack itemstack, EntityPlayer player) - { - return 1; - } +public class ItemVoidShears extends ItemShears implements IRepairable, IWarpingGear { + + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.uncommon; + } + + public void onUpdate(ItemStack stk, World w, Entity entity, int slot, boolean held) { + super.onUpdate(stk, w, entity, slot, held); + if ((stk.isItemDamaged()) + && (entity != null) + && (entity.ticksExisted % 20 == 0) + && ((entity instanceof EntityLivingBase))) stk.damageItem(-1, (EntityLivingBase) entity); + } + + public int getWarp(ItemStack itemstack, EntityPlayer player) { + return 1; + } } diff --git a/src/main/java/tb/common/item/TBResource.java b/src/main/java/tb/common/item/TBResource.java index dbff6c6..1198e2b 100644 --- a/src/main/java/tb/common/item/TBResource.java +++ b/src/main/java/tb/common/item/TBResource.java @@ -1,67 +1,56 @@ package tb.common.item; -import java.util.List; - -import tb.core.TBCore; -import tb.utils.TBConfig; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import tb.core.TBCore; -public class TBResource extends Item{ - - public TBResource() - { - this.setHasSubtypes(true); - } - - public static final String names[] = new String[]{ - "nuggetthauminite", - "thauminite/thauminite_ingot", - "thauminite/wand_cap_thauminite", - "thaumium_wand_core", - "void_wand_core", - "aurelia_petal", - "briar_seedbag", - "tobacco_leaves", - "bloodycloth" - }; - - public static IIcon[] icons = new IIcon[names.length]; - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return icons[meta]; - } - - public int getMetadata(int meta) - { - return meta; - } - - public String getUnlocalizedName(ItemStack is) - { - return super.getUnlocalizedName(is)+names[is.getItemDamage()].replace('/', '.'); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - for(int i = 0; i < names.length; ++i) - icons[i] = reg.registerIcon(TBCore.modid+":"+names[i]); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubItems(Item itm, CreativeTabs tab, List lst) - { - for(int i = 0; i < names.length; ++i) - lst.add(new ItemStack(itm,1,i)); +public class TBResource extends Item { + + public TBResource() { + this.setHasSubtypes(true); } + public static final String names[] = new String[] { + "nuggetthauminite", + "thauminite/thauminite_ingot", + "thauminite/wand_cap_thauminite", + "thaumium_wand_core", + "void_wand_core", + "aurelia_petal", + "briar_seedbag", + "tobacco_leaves", + "bloodycloth" + }; + + public static IIcon[] icons = new IIcon[names.length]; + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return icons[meta]; + } + + public int getMetadata(int meta) { + return meta; + } + + public String getUnlocalizedName(ItemStack is) { + return super.getUnlocalizedName(is) + names[is.getItemDamage()].replace('/', '.'); + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < names.length; ++i) icons[i] = reg.registerIcon(TBCore.modid + ":" + names[i]); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + @SideOnly(Side.CLIENT) + public void getSubItems(Item itm, CreativeTabs tab, List lst) { + for (int i = 0; i < names.length; ++i) lst.add(new ItemStack(itm, 1, i)); + } } diff --git a/src/main/java/tb/common/item/TBTobacco.java b/src/main/java/tb/common/item/TBTobacco.java index 97cd42e..f45cf14 100644 --- a/src/main/java/tb/common/item/TBTobacco.java +++ b/src/main/java/tb/common/item/TBTobacco.java @@ -1,17 +1,10 @@ package tb.common.item; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.Collection; import java.util.List; - -import tb.api.ITobacco; -import tb.core.TBCore; -import tb.utils.TBUtils; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.common.config.Config; -import thaumcraft.common.entities.monster.EntityWisp; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -20,193 +13,158 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; +import tb.api.ITobacco; +import tb.core.TBCore; +import tb.utils.TBUtils; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.config.Config; +import thaumcraft.common.entities.monster.EntityWisp; -public class TBTobacco extends Item implements ITobacco{ - - public TBTobacco() - { - this.setHasSubtypes(true); - } - - public static final String names[] = new String[]{ - "tobacco_pile", - "tobacco_eldritch", - "tobacco_fighting", - "tobacco_hunger", - "tobacco_knowledge", - "tobacco_mining", - "tobacco_sanity", - "tobacco_tainted", - "tobacco_wispy" - }; - - - public void performTobaccoEffect(EntityPlayer smoker, int metadata, boolean isSilverwood) - { - switch(metadata) - { - case 0: - { - if(isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.3F) - TBUtils.addWarpToPlayer(smoker, -1, 0); - - if(!isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.1F) - TBUtils.addWarpToPlayer(smoker, -1, 0); - - break; - } - case 1: - { - if(!smoker.worldObj.isRemote) - { - smoker.addPotionEffect(new PotionEffect(Config.potionDeathGazeID,2000,0,true)); - if(!isSilverwood) - TBUtils.addWarpToPlayer(smoker, 3, 0); - } - - break; - } - case 2: - { - if(!smoker.worldObj.isRemote) - { - smoker.addPotionEffect(new PotionEffect(Potion.damageBoost.id,8000,1,true)); - if(isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.1F) - smoker.addPotionEffect(new PotionEffect(Potion.resistance.id,8000,0,true)); - } - break; - } - case 3: - { - if(!smoker.worldObj.isRemote) - { - smoker.getFoodStats().addStats(3, 3); - if(!isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.4F) - smoker.addPotionEffect(new PotionEffect(Potion.confusion.id,200,0,true)); - } - break; - } - case 4: - { - if(!smoker.worldObj.isRemote) - { - ArrayList aspects = new ArrayList(); - Collection pa = Aspect.aspects.values(); - for (Aspect aspect:pa) - { - aspects.add(aspect); - } - - for(int i = 0; i < (isSilverwood ? 20 : 10); ++i) - { - Aspect a = aspects.get(smoker.worldObj.rand.nextInt(aspects.size())); - TBUtils.addAspectToKnowledgePool(smoker, a, (short) (isSilverwood ? 2 : 1)); - if(a == Aspect.TAINT && !isSilverwood) - TBUtils.addWarpToPlayer(smoker, 1, 0); - } - } - break; - } - case 5: - { - if(!smoker.worldObj.isRemote) - { - smoker.addPotionEffect(new PotionEffect(Potion.digSpeed.id,8000,1,true)); - if(isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.3F) - smoker.addPotionEffect(new PotionEffect(Potion.nightVision.id,8000,0,true)); - } - break; - } - case 6: - { - if(!smoker.worldObj.isRemote) - { - if(smoker.worldObj.rand.nextFloat() <= (isSilverwood ? 0.6F : 0.4F)) - { - TBUtils.addWarpToPlayer(smoker, -1, 0); - } - if(isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.1F) - TBUtils.addWarpToPlayer(smoker, -1, 1); - } - break; - } - case 7: - { - if(!smoker.worldObj.isRemote) - { - if(!isSilverwood) - { - TBUtils.addWarpToPlayer(smoker, 1+smoker.worldObj.rand.nextInt(3), 0); - if(smoker.worldObj.rand.nextFloat() <= 0.4F) - TBUtils.addWarpToPlayer(smoker, 1, 1); - }else - { - ItemStack stk = smoker.getCurrentEquippedItem(); - if(stk != null) - { - smoker.renderBrokenItemStack(stk); - smoker.inventory.setInventorySlotContents(smoker.inventory.currentItem, null); - } - return; - } - } - break; - } - case 8: - { - ArrayList aspects = new ArrayList(); - Collection pa = Aspect.aspects.values(); - for (Aspect aspect:pa) - { - aspects.add(aspect); - } - - if(isSilverwood) - aspects.remove(Aspect.TAINT); - - EntityWisp wisp = new EntityWisp(smoker.worldObj); - wisp.setPositionAndRotation(smoker.posX, smoker.posY, smoker.posZ, 0, 0); - if(!smoker.worldObj.isRemote) - { - wisp.setType(aspects.get(smoker.worldObj.rand.nextInt(aspects.size())).getTag()); - smoker.worldObj.spawnEntityInWorld(wisp); - } - break; - } - } - } - - public static IIcon[] icons = new IIcon[names.length]; - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return icons[meta]; - } - - public int getMetadata(int meta) - { - return meta; - } - - public String getUnlocalizedName(ItemStack is) - { - return super.getUnlocalizedName(is)+"."+names[is.getItemDamage()].replace('/', '.'); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - for(int i = 0; i < names.length; ++i) - icons[i] = reg.registerIcon(TBCore.modid+":"+names[i]); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubItems(Item itm, CreativeTabs tab, List lst) - { - for(int i = 0; i < names.length; ++i) - lst.add(new ItemStack(itm,1,i)); +public class TBTobacco extends Item implements ITobacco { + + public TBTobacco() { + this.setHasSubtypes(true); } + public static final String names[] = new String[] { + "tobacco_pile", + "tobacco_eldritch", + "tobacco_fighting", + "tobacco_hunger", + "tobacco_knowledge", + "tobacco_mining", + "tobacco_sanity", + "tobacco_tainted", + "tobacco_wispy" + }; + + public void performTobaccoEffect(EntityPlayer smoker, int metadata, boolean isSilverwood) { + switch (metadata) { + case 0: { + if (isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.3F) TBUtils.addWarpToPlayer(smoker, -1, 0); + + if (!isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.1F) TBUtils.addWarpToPlayer(smoker, -1, 0); + + break; + } + case 1: { + if (!smoker.worldObj.isRemote) { + smoker.addPotionEffect(new PotionEffect(Config.potionDeathGazeID, 2000, 0, true)); + if (!isSilverwood) TBUtils.addWarpToPlayer(smoker, 3, 0); + } + + break; + } + case 2: { + if (!smoker.worldObj.isRemote) { + smoker.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 8000, 1, true)); + if (isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.1F) + smoker.addPotionEffect(new PotionEffect(Potion.resistance.id, 8000, 0, true)); + } + break; + } + case 3: { + if (!smoker.worldObj.isRemote) { + smoker.getFoodStats().addStats(3, 3); + if (!isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.4F) + smoker.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0, true)); + } + break; + } + case 4: { + if (!smoker.worldObj.isRemote) { + ArrayList aspects = new ArrayList(); + Collection pa = Aspect.aspects.values(); + for (Aspect aspect : pa) { + aspects.add(aspect); + } + + for (int i = 0; i < (isSilverwood ? 20 : 10); ++i) { + Aspect a = aspects.get(smoker.worldObj.rand.nextInt(aspects.size())); + TBUtils.addAspectToKnowledgePool(smoker, a, (short) (isSilverwood ? 2 : 1)); + if (a == Aspect.TAINT && !isSilverwood) TBUtils.addWarpToPlayer(smoker, 1, 0); + } + } + break; + } + case 5: { + if (!smoker.worldObj.isRemote) { + smoker.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 8000, 1, true)); + if (isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.3F) + smoker.addPotionEffect(new PotionEffect(Potion.nightVision.id, 8000, 0, true)); + } + break; + } + case 6: { + if (!smoker.worldObj.isRemote) { + if (smoker.worldObj.rand.nextFloat() <= (isSilverwood ? 0.6F : 0.4F)) { + TBUtils.addWarpToPlayer(smoker, -1, 0); + } + if (isSilverwood && smoker.worldObj.rand.nextFloat() <= 0.1F) + TBUtils.addWarpToPlayer(smoker, -1, 1); + } + break; + } + case 7: { + if (!smoker.worldObj.isRemote) { + if (!isSilverwood) { + TBUtils.addWarpToPlayer(smoker, 1 + smoker.worldObj.rand.nextInt(3), 0); + if (smoker.worldObj.rand.nextFloat() <= 0.4F) TBUtils.addWarpToPlayer(smoker, 1, 1); + } else { + ItemStack stk = smoker.getCurrentEquippedItem(); + if (stk != null) { + smoker.renderBrokenItemStack(stk); + smoker.inventory.setInventorySlotContents(smoker.inventory.currentItem, null); + } + return; + } + } + break; + } + case 8: { + ArrayList aspects = new ArrayList(); + Collection pa = Aspect.aspects.values(); + for (Aspect aspect : pa) { + aspects.add(aspect); + } + + if (isSilverwood) aspects.remove(Aspect.TAINT); + + EntityWisp wisp = new EntityWisp(smoker.worldObj); + wisp.setPositionAndRotation(smoker.posX, smoker.posY, smoker.posZ, 0, 0); + if (!smoker.worldObj.isRemote) { + wisp.setType(aspects.get(smoker.worldObj.rand.nextInt(aspects.size())) + .getTag()); + smoker.worldObj.spawnEntityInWorld(wisp); + } + break; + } + } + } + + public static IIcon[] icons = new IIcon[names.length]; + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return icons[meta]; + } + + public int getMetadata(int meta) { + return meta; + } + + public String getUnlocalizedName(ItemStack is) { + return super.getUnlocalizedName(is) + "." + names[is.getItemDamage()].replace('/', '.'); + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < names.length; ++i) icons[i] = reg.registerIcon(TBCore.modid + ":" + names[i]); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + @SideOnly(Side.CLIENT) + public void getSubItems(Item itm, CreativeTabs tab, List lst) { + for (int i = 0; i < names.length; ++i) lst.add(new ItemStack(itm, 1, i)); + } } diff --git a/src/main/java/tb/common/item/foci/FociActivation.java b/src/main/java/tb/common/item/foci/FociActivation.java index 3634a04..4dda18d 100644 --- a/src/main/java/tb/common/item/foci/FociActivation.java +++ b/src/main/java/tb/common/item/foci/FociActivation.java @@ -1,10 +1,9 @@ package tb.common.item.foci; -import java.util.List; - import DummyCore.Utils.MiscUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -12,8 +11,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; @@ -22,131 +21,123 @@ import thaumcraft.api.wands.FocusUpgradeType; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.WandManager; -public class FociActivation extends ItemFocusBasic -{ +public class FociActivation extends ItemFocusBasic { - public int getFocusColor(ItemStack focusstack) { - return 0xaaaaaa; - } - - public String getSortingHelper(ItemStack focusstack) { - String out="AC"; - for (short id:this.getAppliedUpgrades(focusstack)) { - out = out + id; - } - return out; - } - - public AspectList getVisCost(ItemStack focusstack) { - return new AspectList().add(Aspect.ORDER, 5).add(Aspect.EARTH, 10); - - } - - public int getActivationCooldown(ItemStack focusstack) { - return 0; - } - - public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { - return new FocusUpgradeType[]{FocusUpgradeType.frugal,FocusUpgradeType.potency}; - } - - public ItemStack onFocusRightClick(ItemStack wandstack, World world,EntityPlayer player, MovingObjectPosition movingobjectposition) { - - if(wandstack == null) - return wandstack; - - if(player == null) - return wandstack; - - if(player.isSneaking()) - { - if(movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectType.BLOCK) - { - NBTTagCompound fociTag = MiscUtils.getStackTag(wandstack).getCompoundTag("focus").getCompoundTag("tag"); - fociTag.setInteger("blockX", movingobjectposition.blockX); - fociTag.setInteger("blockY", movingobjectposition.blockY); - fociTag.setInteger("blockZ", movingobjectposition.blockZ); - fociTag.setInteger("dim", player.dimension); - ((NBTTagCompound)(MiscUtils.getStackTag(wandstack).getTag("focus"))).setTag("tag", fociTag); - player.swingItem(); - WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.ORDER, 100)); - } - }else - { - NBTTagCompound fociTag = MiscUtils.getStackTag(wandstack).getCompoundTag("focus").getCompoundTag("tag"); - if(fociTag.hasKey("blockX")) - { - int x = fociTag.getInteger("blockX"); - int y = fociTag.getInteger("blockY"); - int z = fociTag.getInteger("blockZ"); - - ItemStack foci = ItemStack.loadItemStackFromNBT(MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); - - int potencyLevel = this.getUpgradeLevel(foci, FocusUpgradeType.potency); - - int maxRange = 32 * (potencyLevel+1); - - double range = player.getDistance(x, y, z); - - int aspectCost = 10; - - if(!WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.EARTH, aspectCost).add(Aspect.ORDER, aspectCost/2))) - return wandstack; - - if(range > maxRange) - { - if(player.worldObj.isRemote) - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.tooFar"))); - return wandstack; - } - - int dim = fociTag.getInteger("dim"); - - if(dim != player.dimension) - { - if(player.worldObj.isRemote) - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.wrongDimension"))); - return wandstack; - }else - { - if(world.checkChunksExist(x-1, y-1, z-1, x+1, y+1, z+1)) - { - if(world.blockExists(x, y, z)) - { - Block b = world.getBlock(x, y, z); - Vec3 vec = player.getLookVec(); - b.onBlockActivated(world, x, y, z, player, 0, (float)vec.xCoord, (float)vec.yCoord, (float)vec.zCoord); - } - } - } - - foci = null; - } - } - return wandstack; - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - super.registerIcons(reg); - this.icon = reg.registerIcon(getIconString()); + public int getFocusColor(ItemStack focusstack) { + return 0xaaaaaa; + } + + public String getSortingHelper(ItemStack focusstack) { + String out = "AC"; + for (short id : this.getAppliedUpgrades(focusstack)) { + out = out + id; + } + return out; + } + + public AspectList getVisCost(ItemStack focusstack) { + return new AspectList().add(Aspect.ORDER, 5).add(Aspect.EARTH, 10); + } + + public int getActivationCooldown(ItemStack focusstack) { + return 0; + } + + public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { + return new FocusUpgradeType[] {FocusUpgradeType.frugal, FocusUpgradeType.potency}; + } + + public ItemStack onFocusRightClick( + ItemStack wandstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + + if (wandstack == null) return wandstack; + + if (player == null) return wandstack; + + if (player.isSneaking()) { + if (movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { + NBTTagCompound fociTag = + MiscUtils.getStackTag(wandstack).getCompoundTag("focus").getCompoundTag("tag"); + fociTag.setInteger("blockX", movingobjectposition.blockX); + fociTag.setInteger("blockY", movingobjectposition.blockY); + fociTag.setInteger("blockZ", movingobjectposition.blockZ); + fociTag.setInteger("dim", player.dimension); + ((NBTTagCompound) (MiscUtils.getStackTag(wandstack).getTag("focus"))).setTag("tag", fociTag); + player.swingItem(); + WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.ORDER, 100)); + } + } else { + NBTTagCompound fociTag = + MiscUtils.getStackTag(wandstack).getCompoundTag("focus").getCompoundTag("tag"); + if (fociTag.hasKey("blockX")) { + int x = fociTag.getInteger("blockX"); + int y = fociTag.getInteger("blockY"); + int z = fociTag.getInteger("blockZ"); + + ItemStack foci = ItemStack.loadItemStackFromNBT( + MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); + + int potencyLevel = this.getUpgradeLevel(foci, FocusUpgradeType.potency); + + int maxRange = 32 * (potencyLevel + 1); + + double range = player.getDistance(x, y, z); + + int aspectCost = 10; + + if (!WandManager.consumeVisFromInventory( + player, new AspectList().add(Aspect.EARTH, aspectCost).add(Aspect.ORDER, aspectCost / 2))) + return wandstack; + + if (range > maxRange) { + if (player.worldObj.isRemote) + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.tooFar"))); + return wandstack; + } + + int dim = fociTag.getInteger("dim"); + + if (dim != player.dimension) { + if (player.worldObj.isRemote) + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("tb.txt.wrongDimension"))); + return wandstack; + } else { + if (world.checkChunksExist(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1)) { + if (world.blockExists(x, y, z)) { + Block b = world.getBlock(x, y, z); + Vec3 vec = player.getLookVec(); + b.onBlockActivated( + world, x, y, z, player, 0, (float) vec.xCoord, (float) vec.yCoord, (float) + vec.zCoord); + } + } + } + + foci = null; + } + } + return wandstack; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + this.icon = reg.registerIcon(getIconString()); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + super.addInformation(stack, player, list, par4); + + NBTTagCompound tag = MiscUtils.getStackTag(stack); + + if (tag.hasKey("blockX")) { + list.add("X: " + tag.getInteger("blockX")); + list.add("Y: " + tag.getInteger("blockY")); + list.add("Z: " + tag.getInteger("blockZ")); + list.add("Dim: " + tag.getInteger("dim")); + } } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(ItemStack stack,EntityPlayer player, List list, boolean par4) { - super.addInformation(stack, player, list, par4); - - NBTTagCompound tag = MiscUtils.getStackTag(stack); - - if(tag.hasKey("blockX")) - { - list.add("X: "+tag.getInteger("blockX")); - list.add("Y: "+tag.getInteger("blockY")); - list.add("Z: "+tag.getInteger("blockZ")); - list.add("Dim: "+tag.getInteger("dim")); - } - } - } diff --git a/src/main/java/tb/common/item/foci/FociDrain.java b/src/main/java/tb/common/item/foci/FociDrain.java index 864c9b3..8f2d0df 100644 --- a/src/main/java/tb/common/item/foci/FociDrain.java +++ b/src/main/java/tb/common/item/foci/FociDrain.java @@ -12,8 +12,8 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import tb.init.TBFociUpgrades; import thaumcraft.api.aspects.Aspect; @@ -25,149 +25,210 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemCrystalEssence; import thaumcraft.common.items.wands.WandManager; -public class FociDrain extends ItemFocusBasic -{ +public class FociDrain extends ItemFocusBasic { + + Object beam = null; + + public int getFocusColor(ItemStack focusstack) { + return 0x191770; + } + + public String getSortingHelper(ItemStack focusstack) { + String out = "DR"; + for (short id : this.getAppliedUpgrades(focusstack)) { + out = out + id; + } + return out; + } + + public boolean isVisCostPerTick(ItemStack focusstack) { + return true; + } + + public AspectList getVisCost(ItemStack focusstack) { + return new AspectList().add(Aspect.WATER, 5); + } + + public WandFocusAnimation getAnimation(ItemStack focusstack) { + return WandFocusAnimation.CHARGE; + } + + public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { + + switch (rank) { + case 3: { + return new FocusUpgradeType[] {FocusUpgradeType.frugal, TBFociUpgrades.aquatic, TBFociUpgrades.netheric + }; + } + default: { + return new FocusUpgradeType[] {FocusUpgradeType.frugal}; + } + } + } + + public ItemStack onFocusRightClick( + ItemStack wandstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + player.setItemInUse(wandstack, 2147483647); + return wandstack; + } + + public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player, int count) { + + ItemStack foci = + ItemStack.loadItemStackFromNBT(MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); + + if (!WandManager.consumeVisFromInventory(player, this.getVisCost(foci))) { + player.stopUsingItem(); + return; + } - Object beam = null; - - public int getFocusColor(ItemStack focusstack) { - return 0x191770; - } - - public String getSortingHelper(ItemStack focusstack) { - String out="DR"; - for (short id:this.getAppliedUpgrades(focusstack)) { - out = out + id; - } - return out; - } - - public boolean isVisCostPerTick(ItemStack focusstack) { - return true; - } - - public AspectList getVisCost(ItemStack focusstack) { - return new AspectList().add(Aspect.WATER, 5); - - } - - public WandFocusAnimation getAnimation(ItemStack focusstack) { - return WandFocusAnimation.CHARGE; - } - - public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { - - switch(rank) - { - case 3: - { - return new FocusUpgradeType[]{FocusUpgradeType.frugal,TBFociUpgrades.aquatic,TBFociUpgrades.netheric}; - } - default: - { - return new FocusUpgradeType[]{FocusUpgradeType.frugal}; - } - } - } - - public ItemStack onFocusRightClick(ItemStack wandstack, World world,EntityPlayer player, MovingObjectPosition movingobjectposition) { - player.setItemInUse(wandstack, 2147483647); - return wandstack; - } - - - public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player,int count) { - - ItemStack foci = ItemStack.loadItemStackFromNBT(MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); - - if(!WandManager.consumeVisFromInventory(player, this.getVisCost(foci))) - { - player.stopUsingItem(); - return; - } - float f = 1.0F; float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; - double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f; - double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + (double)(player.worldObj.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight()); - double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f; + double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; + double d1 = player.prevPosY + + (player.posY - player.prevPosY) * (double) f + + (double) + (player.worldObj.isRemote + ? player.getEyeHeight() - player.getDefaultEyeHeight() + : player.getEyeHeight()); + double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); - float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); - float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); float f6 = MathHelper.sin(-f1 * 0.017453292F); float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; - if (player instanceof EntityPlayerMP) - { - d3 = ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance(); + if (player instanceof EntityPlayerMP) { + d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); } - Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); - MovingObjectPosition pos = player.worldObj.func_147447_a(vec3, vec31, true, false, true); - - if(pos != null && pos.typeOfHit == MovingObjectType.BLOCK) - { - Block b = player.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ); - int meta = player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ); - if(b != null) - { - if(b == Blocks.water) - { - if(player.worldObj.isRemote) - beam = Thaumcraft.proxy.beamCont(player.worldObj, player, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 1, 0x5555ff, true, 2, beam, 2); - - if(this.getUpgradeLevel(foci, TBFociUpgrades.aquatic) > 0 || player.ticksExisted % 5 == 0) - { - b.onBlockDestroyedByPlayer(player.worldObj, pos.blockX, pos.blockY, pos.blockZ, player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ)); - player.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ,Blocks.air,0,2); - player.worldObj.playSound(pos.blockX+0.5D, pos.blockY+0.5D, pos.blockZ+0.5D, b.stepSound.getBreakSound(), 1, 1, false); - for(int i = 0; i < 100; ++i) - player.worldObj.spawnParticle("blockcrack_"+Block.getIdFromBlock(b)+"_"+meta, pos.blockX+player.worldObj.rand.nextDouble(), pos.blockY+player.worldObj.rand.nextDouble(), pos.blockZ+player.worldObj.rand.nextDouble(), 0, 0, 0); - - if(this.getUpgradeLevel(foci, TBFociUpgrades.aquatic) > 0 && player.worldObj.rand.nextDouble() < 0.4D) - { - ItemStack waterCrystal = new ItemStack(ConfigItems.itemCrystalEssence,1,0); - ItemCrystalEssence cEssence = (ItemCrystalEssence) waterCrystal.getItem(); - cEssence.setAspects(waterCrystal, new AspectList().add((player.worldObj.rand.nextDouble() < 0.1D ? Aspect.POISON : Aspect.WATER),1)); - EntityItem crystal = new EntityItem(player.worldObj, pos.blockX+0.5D, pos.blockY+0.5D, pos.blockZ+0.5D, waterCrystal); - if(!player.worldObj.isRemote) - player.worldObj.spawnEntityInWorld(crystal); - } - } - } - - if(b == Blocks.lava && this.getUpgradeLevel(foci, TBFociUpgrades.netheric) > 0) - { - if(player.worldObj.isRemote) - beam = Thaumcraft.proxy.beamCont(player.worldObj, player, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 1, 0xff5555, true, 2, beam, 2); - - if(player.ticksExisted % 5 == 0 && WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.FIRE, 3))) - { - b.onBlockDestroyedByPlayer(player.worldObj, pos.blockX, pos.blockY, pos.blockZ, player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ)); - player.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ,Blocks.air,0,2); - player.worldObj.playSound(pos.blockX+0.5D, pos.blockY+0.5D, pos.blockZ+0.5D, b.stepSound.getBreakSound(), 1, 1, false); - for(int i = 0; i < 100; ++i) - player.worldObj.spawnParticle("blockcrack_"+Block.getIdFromBlock(b)+"_"+meta, pos.blockX+player.worldObj.rand.nextDouble(), pos.blockY+player.worldObj.rand.nextDouble(), pos.blockZ+player.worldObj.rand.nextDouble(), 0, 0, 0); - } - } - } + Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + MovingObjectPosition pos = player.worldObj.func_147447_a(vec3, vec31, true, false, true); + + if (pos != null && pos.typeOfHit == MovingObjectType.BLOCK) { + Block b = player.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ); + int meta = player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ); + if (b != null) { + if (b == Blocks.water) { + if (player.worldObj.isRemote) + beam = Thaumcraft.proxy.beamCont( + player.worldObj, + player, + pos.hitVec.xCoord, + pos.hitVec.yCoord, + pos.hitVec.zCoord, + 1, + 0x5555ff, + true, + 2, + beam, + 2); + + if (this.getUpgradeLevel(foci, TBFociUpgrades.aquatic) > 0 || player.ticksExisted % 5 == 0) { + b.onBlockDestroyedByPlayer( + player.worldObj, + pos.blockX, + pos.blockY, + pos.blockZ, + player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ)); + player.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.air, 0, 2); + player.worldObj.playSound( + pos.blockX + 0.5D, + pos.blockY + 0.5D, + pos.blockZ + 0.5D, + b.stepSound.getBreakSound(), + 1, + 1, + false); + for (int i = 0; i < 100; ++i) + player.worldObj.spawnParticle( + "blockcrack_" + Block.getIdFromBlock(b) + "_" + meta, + pos.blockX + player.worldObj.rand.nextDouble(), + pos.blockY + player.worldObj.rand.nextDouble(), + pos.blockZ + player.worldObj.rand.nextDouble(), + 0, + 0, + 0); + + if (this.getUpgradeLevel(foci, TBFociUpgrades.aquatic) > 0 + && player.worldObj.rand.nextDouble() < 0.4D) { + ItemStack waterCrystal = new ItemStack(ConfigItems.itemCrystalEssence, 1, 0); + ItemCrystalEssence cEssence = (ItemCrystalEssence) waterCrystal.getItem(); + cEssence.setAspects( + waterCrystal, + new AspectList() + .add( + (player.worldObj.rand.nextDouble() < 0.1D + ? Aspect.POISON + : Aspect.WATER), + 1)); + EntityItem crystal = new EntityItem( + player.worldObj, + pos.blockX + 0.5D, + pos.blockY + 0.5D, + pos.blockZ + 0.5D, + waterCrystal); + if (!player.worldObj.isRemote) player.worldObj.spawnEntityInWorld(crystal); + } + } + } + + if (b == Blocks.lava && this.getUpgradeLevel(foci, TBFociUpgrades.netheric) > 0) { + if (player.worldObj.isRemote) + beam = Thaumcraft.proxy.beamCont( + player.worldObj, + player, + pos.hitVec.xCoord, + pos.hitVec.yCoord, + pos.hitVec.zCoord, + 1, + 0xff5555, + true, + 2, + beam, + 2); + + if (player.ticksExisted % 5 == 0 + && WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.FIRE, 3))) { + b.onBlockDestroyedByPlayer( + player.worldObj, + pos.blockX, + pos.blockY, + pos.blockZ, + player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ)); + player.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.air, 0, 2); + player.worldObj.playSound( + pos.blockX + 0.5D, + pos.blockY + 0.5D, + pos.blockZ + 0.5D, + b.stepSound.getBreakSound(), + 1, + 1, + false); + for (int i = 0; i < 100; ++i) + player.worldObj.spawnParticle( + "blockcrack_" + Block.getIdFromBlock(b) + "_" + meta, + pos.blockX + player.worldObj.rand.nextDouble(), + pos.blockY + player.worldObj.rand.nextDouble(), + pos.blockZ + player.worldObj.rand.nextDouble(), + 0, + 0, + 0); + } + } + } } - - } - - public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer p, int count) - { - beam = null; - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - super.registerIcons(reg); - this.icon = reg.registerIcon(getIconString()); } - + public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer p, int count) { + beam = null; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + this.icon = reg.registerIcon(getIconString()); + } } diff --git a/src/main/java/tb/common/item/foci/FociExperience.java b/src/main/java/tb/common/item/foci/FociExperience.java index 8c49136..5a1ffff 100644 --- a/src/main/java/tb/common/item/foci/FociExperience.java +++ b/src/main/java/tb/common/item/foci/FociExperience.java @@ -1,10 +1,9 @@ package tb.common.item.foci; -import java.util.ArrayList; - import DummyCore.Utils.MiscUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -19,8 +18,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import tb.init.TBFociUpgrades; import tb.init.TBThaumonomicon; @@ -35,170 +34,191 @@ import thaumcraft.common.items.ItemCrystalEssence; import thaumcraft.common.items.wands.WandManager; import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; -public class FociExperience extends ItemFocusBasic -{ +public class FociExperience extends ItemFocusBasic { - public int getFocusColor(ItemStack focusstack) { - return 0xf8ffdc; - } - - public String getSortingHelper(ItemStack focusstack) { - String out="XP"; - for (short id:this.getAppliedUpgrades(focusstack)) { - out = out + id; - } - return out; - } - - public boolean isVisCostPerTick(ItemStack focusstack) { - return true; - } - - public AspectList getVisCost(ItemStack focusstack) { - return new AspectList().add(Aspect.ORDER, 500).add(Aspect.ENTROPY, 500); - - } - - public WandFocusAnimation getAnimation(ItemStack focusstack) { - return WandFocusAnimation.CHARGE; - } - - public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { - - switch(rank) - { - case 3: - { - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.vaporizing,TBFociUpgrades.decomposing}; - } - case 5: - { - if(this.getUpgradeLevel(focusstack, TBFociUpgrades.decomposing) > 0) - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.decomposing}; - else if(this.getUpgradeLevel(focusstack, TBFociUpgrades.vaporizing) > 0) - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.vaporizing}; - else - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.vaporizing,TBFociUpgrades.decomposing}; - } - default: - { - return new FocusUpgradeType[]{FocusUpgradeType.frugal,FocusUpgradeType.potency}; - } - } - } - - @SuppressWarnings("unchecked") - public ItemStack onFocusRightClick(ItemStack wandstack, World world,EntityPlayer player, MovingObjectPosition movingobjectposition) { - - ItemStack foci = ItemStack.loadItemStackFromNBT(MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); - - int vaporisingLevel = this.getUpgradeLevel(foci, TBFociUpgrades.vaporizing); - int decomposingLevel = this.getUpgradeLevel(foci, TBFociUpgrades.decomposing); - - if(decomposingLevel > 0) - { - - Vec3 vec = player.getLookVec(); - ArrayList mobs = (ArrayList) world.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(player.posX+vec.xCoord-0.3D, player.posY+player.getEyeHeight()+vec.yCoord-0.3D, player.posZ+vec.zCoord-0.3D, player.posX+vec.xCoord+0.3D, player.posY+player.getEyeHeight()+vec.yCoord+0.3D, player.posZ+vec.zCoord+0.3D)); - - if(mobs != null && !mobs.isEmpty()) - { - Entity e = mobs.get(world.rand.nextInt(mobs.size())); - if(e instanceof EntityLivingBase) - { - EntityLivingBase eaten = (EntityLivingBase) e; - if(e instanceof EntityPlayer) - return wandstack; - - if(e instanceof IBossDisplayData) - return wandstack; - - double hp = eaten.getHealth(); - - if(WandManager.consumeVisFromInventory(player, TBThaumonomicon.primals(MathHelper.floor_double(hp*100/decomposingLevel)))) - { - eaten.attackEntityFrom(DamageSource.outOfWorld, Integer.MAX_VALUE); - int xp = MathHelper.floor_double(hp*3); - - EntityXPOrb orb = new EntityXPOrb(world, eaten.posX, eaten.posY, eaten.posZ, xp); - if(!world.isRemote) - world.spawnEntityInWorld(orb); - - return wandstack; - } - } - } - } - - if(movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectType.BLOCK) - { - Block b = world.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - int meta = world.getBlockMetadata(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - int xp = b.getExpDrop(world, meta, this.getUpgradeLevel(foci, FocusUpgradeType.potency)); - if(xp <= 0) - xp = this.getUpgradeLevel(foci, FocusUpgradeType.potency)+1; - - MovingObjectPosition pos = movingobjectposition; - - if(b.getBlockHardness(world, pos.blockX, pos.blockY, pos.blockZ) <= 0) - return wandstack; - - if(!WandManager.consumeVisFromInventory(player, TBThaumonomicon.primals(MathHelper.floor_double(b.getBlockHardness(world, pos.blockX, pos.blockY, pos.blockZ)*100)))) - return wandstack; - - if(vaporisingLevel > 0) - { - boolean doWork = vaporisingLevel == 1 ? world.rand.nextBoolean() : true; - if(doWork) - { - if(ThaumcraftApi.exists(Item.getItemFromBlock(b), meta)) - { - AspectList aspects = ThaumcraftCraftingManager.getObjectTags(new ItemStack(Item.getItemFromBlock(b),1, meta)); - if(aspects != null && aspects.size() > 0) - { - for(int i = 0; i < aspects.getAspects().length; ++i) - { - Aspect a = aspects.getAspects()[i]; - int amount = aspects.getAmount(a); - - ItemStack crystalStack = new ItemStack(ConfigItems.itemCrystalEssence,1,0); - ItemCrystalEssence cEssence = (ItemCrystalEssence) crystalStack.getItem(); - cEssence.setAspects(crystalStack, new AspectList().add(a,amount)); - - EntityItem crystal = new EntityItem(player.worldObj, pos.blockX+0.5D, pos.blockY+0.5D, pos.blockZ+0.5D, crystalStack); - if(!player.worldObj.isRemote) - player.worldObj.spawnEntityInWorld(crystal); - } - } - } - } - } - - b.onBlockDestroyedByPlayer(player.worldObj, pos.blockX, pos.blockY, pos.blockZ, player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ)); - player.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ,Blocks.air,0,3); - player.worldObj.playSound(pos.blockX+0.5D, pos.blockY+0.5D, pos.blockZ+0.5D, b.stepSound.getBreakSound(), 1, 1, false); - for(int i = 0; i < 100; ++i) - player.worldObj.spawnParticle("blockcrack_"+Block.getIdFromBlock(b)+"_"+meta, pos.blockX+player.worldObj.rand.nextDouble(), pos.blockY+player.worldObj.rand.nextDouble(), pos.blockZ+player.worldObj.rand.nextDouble(), 0, 0, 0); - - xp *= 2; - - EntityXPOrb orb = new EntityXPOrb(world, pos.blockX+0.5D, pos.blockY+0.5D, pos.blockZ+0.5D, xp); - if(!world.isRemote) - world.spawnEntityInWorld(orb); - - player.swingItem(); - } - - return wandstack; - } - - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - super.registerIcons(reg); - this.icon = reg.registerIcon(getIconString()); + public int getFocusColor(ItemStack focusstack) { + return 0xf8ffdc; } - + public String getSortingHelper(ItemStack focusstack) { + String out = "XP"; + for (short id : this.getAppliedUpgrades(focusstack)) { + out = out + id; + } + return out; + } + + public boolean isVisCostPerTick(ItemStack focusstack) { + return true; + } + + public AspectList getVisCost(ItemStack focusstack) { + return new AspectList().add(Aspect.ORDER, 500).add(Aspect.ENTROPY, 500); + } + + public WandFocusAnimation getAnimation(ItemStack focusstack) { + return WandFocusAnimation.CHARGE; + } + + public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { + + switch (rank) { + case 3: { + return new FocusUpgradeType[] { + FocusUpgradeType.potency, + FocusUpgradeType.frugal, + TBFociUpgrades.vaporizing, + TBFociUpgrades.decomposing + }; + } + case 5: { + if (this.getUpgradeLevel(focusstack, TBFociUpgrades.decomposing) > 0) + return new FocusUpgradeType[] { + FocusUpgradeType.potency, FocusUpgradeType.frugal, TBFociUpgrades.decomposing + }; + else if (this.getUpgradeLevel(focusstack, TBFociUpgrades.vaporizing) > 0) + return new FocusUpgradeType[] { + FocusUpgradeType.potency, FocusUpgradeType.frugal, TBFociUpgrades.vaporizing + }; + else + return new FocusUpgradeType[] { + FocusUpgradeType.potency, + FocusUpgradeType.frugal, + TBFociUpgrades.vaporizing, + TBFociUpgrades.decomposing + }; + } + default: { + return new FocusUpgradeType[] {FocusUpgradeType.frugal, FocusUpgradeType.potency}; + } + } + } + + @SuppressWarnings("unchecked") + public ItemStack onFocusRightClick( + ItemStack wandstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + + ItemStack foci = + ItemStack.loadItemStackFromNBT(MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); + + int vaporisingLevel = this.getUpgradeLevel(foci, TBFociUpgrades.vaporizing); + int decomposingLevel = this.getUpgradeLevel(foci, TBFociUpgrades.decomposing); + + if (decomposingLevel > 0) { + + Vec3 vec = player.getLookVec(); + ArrayList mobs = (ArrayList) world.getEntitiesWithinAABBExcludingEntity( + player, + AxisAlignedBB.getBoundingBox( + player.posX + vec.xCoord - 0.3D, + player.posY + player.getEyeHeight() + vec.yCoord - 0.3D, + player.posZ + vec.zCoord - 0.3D, + player.posX + vec.xCoord + 0.3D, + player.posY + player.getEyeHeight() + vec.yCoord + 0.3D, + player.posZ + vec.zCoord + 0.3D)); + + if (mobs != null && !mobs.isEmpty()) { + Entity e = mobs.get(world.rand.nextInt(mobs.size())); + if (e instanceof EntityLivingBase) { + EntityLivingBase eaten = (EntityLivingBase) e; + if (e instanceof EntityPlayer) return wandstack; + + if (e instanceof IBossDisplayData) return wandstack; + + double hp = eaten.getHealth(); + + if (WandManager.consumeVisFromInventory( + player, TBThaumonomicon.primals(MathHelper.floor_double(hp * 100 / decomposingLevel)))) { + eaten.attackEntityFrom(DamageSource.outOfWorld, Integer.MAX_VALUE); + int xp = MathHelper.floor_double(hp * 3); + + EntityXPOrb orb = new EntityXPOrb(world, eaten.posX, eaten.posY, eaten.posZ, xp); + if (!world.isRemote) world.spawnEntityInWorld(orb); + + return wandstack; + } + } + } + } + + if (movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { + Block b = world.getBlock( + movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + int meta = world.getBlockMetadata( + movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + int xp = b.getExpDrop(world, meta, this.getUpgradeLevel(foci, FocusUpgradeType.potency)); + if (xp <= 0) xp = this.getUpgradeLevel(foci, FocusUpgradeType.potency) + 1; + + MovingObjectPosition pos = movingobjectposition; + + if (b.getBlockHardness(world, pos.blockX, pos.blockY, pos.blockZ) <= 0) return wandstack; + + if (!WandManager.consumeVisFromInventory( + player, + TBThaumonomicon.primals(MathHelper.floor_double( + b.getBlockHardness(world, pos.blockX, pos.blockY, pos.blockZ) * 100)))) return wandstack; + + if (vaporisingLevel > 0) { + boolean doWork = vaporisingLevel == 1 ? world.rand.nextBoolean() : true; + if (doWork) { + if (ThaumcraftApi.exists(Item.getItemFromBlock(b), meta)) { + AspectList aspects = ThaumcraftCraftingManager.getObjectTags( + new ItemStack(Item.getItemFromBlock(b), 1, meta)); + if (aspects != null && aspects.size() > 0) { + for (int i = 0; i < aspects.getAspects().length; ++i) { + Aspect a = aspects.getAspects()[i]; + int amount = aspects.getAmount(a); + + ItemStack crystalStack = new ItemStack(ConfigItems.itemCrystalEssence, 1, 0); + ItemCrystalEssence cEssence = (ItemCrystalEssence) crystalStack.getItem(); + cEssence.setAspects(crystalStack, new AspectList().add(a, amount)); + + EntityItem crystal = new EntityItem( + player.worldObj, + pos.blockX + 0.5D, + pos.blockY + 0.5D, + pos.blockZ + 0.5D, + crystalStack); + if (!player.worldObj.isRemote) player.worldObj.spawnEntityInWorld(crystal); + } + } + } + } + } + + b.onBlockDestroyedByPlayer( + player.worldObj, + pos.blockX, + pos.blockY, + pos.blockZ, + player.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ)); + player.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.air, 0, 3); + player.worldObj.playSound( + pos.blockX + 0.5D, pos.blockY + 0.5D, pos.blockZ + 0.5D, b.stepSound.getBreakSound(), 1, 1, false); + for (int i = 0; i < 100; ++i) + player.worldObj.spawnParticle( + "blockcrack_" + Block.getIdFromBlock(b) + "_" + meta, + pos.blockX + player.worldObj.rand.nextDouble(), + pos.blockY + player.worldObj.rand.nextDouble(), + pos.blockZ + player.worldObj.rand.nextDouble(), + 0, + 0, + 0); + + xp *= 2; + + EntityXPOrb orb = new EntityXPOrb(world, pos.blockX + 0.5D, pos.blockY + 0.5D, pos.blockZ + 0.5D, xp); + if (!world.isRemote) world.spawnEntityInWorld(orb); + + player.swingItem(); + } + + return wandstack; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + this.icon = reg.registerIcon(getIconString()); + } } diff --git a/src/main/java/tb/common/item/foci/FociFlux.java b/src/main/java/tb/common/item/foci/FociFlux.java index 8012b96..1394ecb 100644 --- a/src/main/java/tb/common/item/foci/FociFlux.java +++ b/src/main/java/tb/common/item/foci/FociFlux.java @@ -1,10 +1,9 @@ package tb.common.item.foci; -import java.util.ArrayList; - import DummyCore.Utils.MiscUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; @@ -28,179 +27,199 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemCrystalEssence; import thaumcraft.common.items.wands.WandManager; -public class FociFlux extends ItemFocusBasic -{ - - Object beam = null; +public class FociFlux extends ItemFocusBasic { - public int getFocusColor(ItemStack focusstack) { - return 0x64379d; - } - - public String getSortingHelper(ItemStack focusstack) { - String out="FX"; - for (short id:this.getAppliedUpgrades(focusstack)) { - out = out + id; - } - return out; - } - - public boolean isVisCostPerTick(ItemStack focusstack) { - return true; - } - - public AspectList getVisCost(ItemStack focusstack) { - return new AspectList().add(Aspect.ORDER, 5); - - } - - public WandFocusAnimation getAnimation(ItemStack focusstack) { - return WandFocusAnimation.CHARGE; - } - - public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { - - switch(rank) - { - case 3: - { - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.warping,TBFociUpgrades.crystalization}; - } - case 5: - { - if(this.getUpgradeLevel(focusstack, TBFociUpgrades.warping) > 0) - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.calming}; - else if(this.getUpgradeLevel(focusstack, TBFociUpgrades.crystalization) > 0) - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.crystalization}; - else - return new FocusUpgradeType[]{FocusUpgradeType.potency,FocusUpgradeType.frugal,TBFociUpgrades.warping,TBFociUpgrades.crystalization}; - } - default: - { - return new FocusUpgradeType[]{FocusUpgradeType.frugal,FocusUpgradeType.potency}; - } - } - } - - public ItemStack onFocusRightClick(ItemStack wandstack, World world,EntityPlayer player, MovingObjectPosition movingobjectposition) { - player.setItemInUse(wandstack, 2147483647); - return wandstack; - } - - - public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player,int count) { - - ItemStack foci = ItemStack.loadItemStackFromNBT(MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); - - int potencyLevel = this.getUpgradeLevel(foci, FocusUpgradeType.potency); - - if(!WandManager.consumeVisFromInventory(player, this.getVisCost(foci))) - { - player.stopUsingItem(); - return; - } - - float f = 1.0F; - double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f; - double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + (double)(player.worldObj.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight()); - double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f; - Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); - - double d3 = 5.0D; - if (player instanceof EntityPlayerMP) - { - d3 = ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance(); - } - - Vec3 lookVec = player.getLookVec(); - - if(player.worldObj.isRemote) - beam = Thaumcraft.proxy.beamCont(player.worldObj, player, player.posX+lookVec.xCoord*2, player.posY+player.getEyeHeight()+lookVec.yCoord*2, player.posZ+lookVec.zCoord*2, 6, 0xff00ff, true, 2, beam, 2); - - if(potencyLevel == 5 || player.ticksExisted % 10-potencyLevel*2 == 0) - for(int i = 0; i < d3; ++i) - { - Vec3 addedVec = vec3.addVector(lookVec.xCoord*i, lookVec.yCoord*i, lookVec.zCoord*i); - - - int x = MathHelper.floor_double(addedVec.xCoord); - int y = MathHelper.floor_double(addedVec.yCoord); - int z = MathHelper.floor_double(addedVec.zCoord); - - Block b = player.worldObj.getBlock(x, y, z); - - if(b != null && !b.isAir(player.worldObj, x, y, z)) - { - if(b == ConfigBlocks.blockFluxGoo || b == ConfigBlocks.blockFluxGas) - { - b.onBlockDestroyedByPlayer(player.worldObj, x, y, z, player.worldObj.getBlockMetadata(x, y, z)); - player.worldObj.setBlock(x, y, z,Blocks.air,0,2); - player.worldObj.playSound(x+0.5D, y+0.5D, z+0.5D, b.stepSound.getBreakSound(), 1, 1, false); - for(int j = 0; j < 100; ++j) - player.worldObj.spawnParticle("blockcrack_"+Block.getIdFromBlock(b)+"_"+player.worldObj.getBlockMetadata(x, y, z), x+player.worldObj.rand.nextDouble(), y+player.worldObj.rand.nextDouble(), z+player.worldObj.rand.nextDouble(), 0, 0, 0); - - if(!player.worldObj.isRemote) - { - if(this.getUpgradeLevel(foci, TBFociUpgrades.calming) > 0) - { - TBUtils.addWarpToPlayer(player, -1, 0); - if(player.worldObj.rand.nextDouble() <= 0.4D) - TBUtils.addWarpToPlayer(player, -1, 1); - }else - { - if(this.getUpgradeLevel(foci, TBFociUpgrades.warping) > 0) - { - TBUtils.addWarpToPlayer(player, 1, 0); - if(player.worldObj.rand.nextDouble() <= 0.1D) - TBUtils.addWarpToPlayer(player, 1, 1); - } - } - } - - int crystalizingLevel = this.getUpgradeLevel(foci, TBFociUpgrades.crystalization); - - if(crystalizingLevel == 1) - { - ItemStack potentiaCrystal = new ItemStack(ConfigItems.itemCrystalEssence,1,0); - ItemCrystalEssence cEssence = (ItemCrystalEssence) potentiaCrystal.getItem(); - cEssence.setAspects(potentiaCrystal, new AspectList().add(Aspect.ENERGY,1)); - EntityItem crystal = new EntityItem(player.worldObj, x+0.5D, y+0.5D, z+0.5D, potentiaCrystal); - if(!player.worldObj.isRemote) - player.worldObj.spawnEntityInWorld(crystal); - } - - if(crystalizingLevel == 2) - { - ArrayList allAspects = new ArrayList(); - - allAspects.addAll(Aspect.getPrimalAspects()); - allAspects.addAll(Aspect.getCompoundAspects()); - - ItemStack potentiaCrystal = new ItemStack(ConfigItems.itemCrystalEssence,1,0); - ItemCrystalEssence cEssence = (ItemCrystalEssence) potentiaCrystal.getItem(); - cEssence.setAspects(potentiaCrystal, new AspectList().add(allAspects.get(player.worldObj.rand.nextInt(allAspects.size())),1)); - EntityItem crystal = new EntityItem(player.worldObj, x+0.5D, y+0.5D, z+0.5D, potentiaCrystal); - if(!player.worldObj.isRemote) - player.worldObj.spawnEntityInWorld(crystal); - } - - return; - } - } - } - - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - super.registerIcons(reg); - this.icon = reg.registerIcon(getIconString()); + Object beam = null; + + public int getFocusColor(ItemStack focusstack) { + return 0x64379d; } - public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer p, int count) - { - beam = null; - } - + public String getSortingHelper(ItemStack focusstack) { + String out = "FX"; + for (short id : this.getAppliedUpgrades(focusstack)) { + out = out + id; + } + return out; + } + + public boolean isVisCostPerTick(ItemStack focusstack) { + return true; + } + + public AspectList getVisCost(ItemStack focusstack) { + return new AspectList().add(Aspect.ORDER, 5); + } + + public WandFocusAnimation getAnimation(ItemStack focusstack) { + return WandFocusAnimation.CHARGE; + } + + public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) { + + switch (rank) { + case 3: { + return new FocusUpgradeType[] { + FocusUpgradeType.potency, + FocusUpgradeType.frugal, + TBFociUpgrades.warping, + TBFociUpgrades.crystalization + }; + } + case 5: { + if (this.getUpgradeLevel(focusstack, TBFociUpgrades.warping) > 0) + return new FocusUpgradeType[] { + FocusUpgradeType.potency, FocusUpgradeType.frugal, TBFociUpgrades.calming + }; + else if (this.getUpgradeLevel(focusstack, TBFociUpgrades.crystalization) > 0) + return new FocusUpgradeType[] { + FocusUpgradeType.potency, FocusUpgradeType.frugal, TBFociUpgrades.crystalization + }; + else + return new FocusUpgradeType[] { + FocusUpgradeType.potency, + FocusUpgradeType.frugal, + TBFociUpgrades.warping, + TBFociUpgrades.crystalization + }; + } + default: { + return new FocusUpgradeType[] {FocusUpgradeType.frugal, FocusUpgradeType.potency}; + } + } + } + + public ItemStack onFocusRightClick( + ItemStack wandstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) { + player.setItemInUse(wandstack, 2147483647); + return wandstack; + } + + public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player, int count) { + + ItemStack foci = + ItemStack.loadItemStackFromNBT(MiscUtils.getStackTag(wandstack).getCompoundTag("focus")); + + int potencyLevel = this.getUpgradeLevel(foci, FocusUpgradeType.potency); + + if (!WandManager.consumeVisFromInventory(player, this.getVisCost(foci))) { + player.stopUsingItem(); + return; + } + + float f = 1.0F; + double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; + double d1 = player.prevPosY + + (player.posY - player.prevPosY) * (double) f + + (double) + (player.worldObj.isRemote + ? player.getEyeHeight() - player.getDefaultEyeHeight() + : player.getEyeHeight()); + double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); + + double d3 = 5.0D; + if (player instanceof EntityPlayerMP) { + d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); + } + + Vec3 lookVec = player.getLookVec(); + + if (player.worldObj.isRemote) + beam = Thaumcraft.proxy.beamCont( + player.worldObj, + player, + player.posX + lookVec.xCoord * 2, + player.posY + player.getEyeHeight() + lookVec.yCoord * 2, + player.posZ + lookVec.zCoord * 2, + 6, + 0xff00ff, + true, + 2, + beam, + 2); + + if (potencyLevel == 5 || player.ticksExisted % 10 - potencyLevel * 2 == 0) + for (int i = 0; i < d3; ++i) { + Vec3 addedVec = vec3.addVector(lookVec.xCoord * i, lookVec.yCoord * i, lookVec.zCoord * i); + + int x = MathHelper.floor_double(addedVec.xCoord); + int y = MathHelper.floor_double(addedVec.yCoord); + int z = MathHelper.floor_double(addedVec.zCoord); + + Block b = player.worldObj.getBlock(x, y, z); + + if (b != null && !b.isAir(player.worldObj, x, y, z)) { + if (b == ConfigBlocks.blockFluxGoo || b == ConfigBlocks.blockFluxGas) { + b.onBlockDestroyedByPlayer(player.worldObj, x, y, z, player.worldObj.getBlockMetadata(x, y, z)); + player.worldObj.setBlock(x, y, z, Blocks.air, 0, 2); + player.worldObj.playSound( + x + 0.5D, y + 0.5D, z + 0.5D, b.stepSound.getBreakSound(), 1, 1, false); + for (int j = 0; j < 100; ++j) + player.worldObj.spawnParticle( + "blockcrack_" + Block.getIdFromBlock(b) + "_" + + player.worldObj.getBlockMetadata(x, y, z), + x + player.worldObj.rand.nextDouble(), + y + player.worldObj.rand.nextDouble(), + z + player.worldObj.rand.nextDouble(), + 0, + 0, + 0); + + if (!player.worldObj.isRemote) { + if (this.getUpgradeLevel(foci, TBFociUpgrades.calming) > 0) { + TBUtils.addWarpToPlayer(player, -1, 0); + if (player.worldObj.rand.nextDouble() <= 0.4D) TBUtils.addWarpToPlayer(player, -1, 1); + } else { + if (this.getUpgradeLevel(foci, TBFociUpgrades.warping) > 0) { + TBUtils.addWarpToPlayer(player, 1, 0); + if (player.worldObj.rand.nextDouble() <= 0.1D) + TBUtils.addWarpToPlayer(player, 1, 1); + } + } + } + + int crystalizingLevel = this.getUpgradeLevel(foci, TBFociUpgrades.crystalization); + + if (crystalizingLevel == 1) { + ItemStack potentiaCrystal = new ItemStack(ConfigItems.itemCrystalEssence, 1, 0); + ItemCrystalEssence cEssence = (ItemCrystalEssence) potentiaCrystal.getItem(); + cEssence.setAspects(potentiaCrystal, new AspectList().add(Aspect.ENERGY, 1)); + EntityItem crystal = + new EntityItem(player.worldObj, x + 0.5D, y + 0.5D, z + 0.5D, potentiaCrystal); + if (!player.worldObj.isRemote) player.worldObj.spawnEntityInWorld(crystal); + } + + if (crystalizingLevel == 2) { + ArrayList allAspects = new ArrayList(); + + allAspects.addAll(Aspect.getPrimalAspects()); + allAspects.addAll(Aspect.getCompoundAspects()); + + ItemStack potentiaCrystal = new ItemStack(ConfigItems.itemCrystalEssence, 1, 0); + ItemCrystalEssence cEssence = (ItemCrystalEssence) potentiaCrystal.getItem(); + cEssence.setAspects( + potentiaCrystal, + new AspectList() + .add(allAspects.get(player.worldObj.rand.nextInt(allAspects.size())), 1)); + EntityItem crystal = + new EntityItem(player.worldObj, x + 0.5D, y + 0.5D, z + 0.5D, potentiaCrystal); + if (!player.worldObj.isRemote) player.worldObj.spawnEntityInWorld(crystal); + } + + return; + } + } + } + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + this.icon = reg.registerIcon(getIconString()); + } + + public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer p, int count) { + beam = null; + } } diff --git a/src/main/java/tb/common/itemblock/ItemBlockCrystal.java b/src/main/java/tb/common/itemblock/ItemBlockCrystal.java index 3b2e444..d875da5 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockCrystal.java +++ b/src/main/java/tb/common/itemblock/ItemBlockCrystal.java @@ -1,25 +1,25 @@ package tb.common.itemblock; -import tb.common.block.BlockCrystalBlock; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import tb.common.block.BlockCrystalBlock; -public class ItemBlockCrystal extends ItemBlock{ +public class ItemBlockCrystal extends ItemBlock { - public ItemBlockCrystal(Block b) { - super(b); - this.setHasSubtypes(true); - } - - public String getUnlocalizedName(ItemStack stk) - { - return super.getUnlocalizedName(stk)+ (stk.getItemDamage() >= 8 ? BlockCrystalBlock.names[7] : BlockCrystalBlock.names[stk.getItemDamage()]); + public ItemBlockCrystal(Block b) { + super(b); + this.setHasSubtypes(true); } - - public int getMetadata(int meta) - { + + public String getUnlocalizedName(ItemStack stk) { + return super.getUnlocalizedName(stk) + + (stk.getItemDamage() >= 8 + ? BlockCrystalBlock.names[7] + : BlockCrystalBlock.names[stk.getItemDamage()]); + } + + public int getMetadata(int meta) { return meta; } - } diff --git a/src/main/java/tb/common/itemblock/ItemBlockMetadata.java b/src/main/java/tb/common/itemblock/ItemBlockMetadata.java index be523e3..cd526c9 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockMetadata.java +++ b/src/main/java/tb/common/itemblock/ItemBlockMetadata.java @@ -3,17 +3,14 @@ package tb.common.itemblock; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -public class ItemBlockMetadata extends ItemBlock -{ +public class ItemBlockMetadata extends ItemBlock { - public ItemBlockMetadata(Block p_i45328_1_) { - super(p_i45328_1_); - this.setHasSubtypes(true); - } - - public int getMetadata(int meta) - { + public ItemBlockMetadata(Block p_i45328_1_) { + super(p_i45328_1_); + this.setHasSubtypes(true); + } + + public int getMetadata(int meta) { return meta; } - } diff --git a/src/main/java/tb/common/itemblock/ItemBlockModeManipulator.java b/src/main/java/tb/common/itemblock/ItemBlockModeManipulator.java index e0b14cc..f48b85b 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockModeManipulator.java +++ b/src/main/java/tb/common/itemblock/ItemBlockModeManipulator.java @@ -3,11 +3,10 @@ package tb.common.itemblock; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -public class ItemBlockModeManipulator extends ItemBlock{ - - public ItemBlockModeManipulator(Block p_i45328_1_) { - super(p_i45328_1_); - // TODO Auto-generated constructor stub - } +public class ItemBlockModeManipulator extends ItemBlock { + public ItemBlockModeManipulator(Block p_i45328_1_) { + super(p_i45328_1_); + // TODO Auto-generated constructor stub + } } diff --git a/src/main/java/tb/common/itemblock/ItemBlockPyrofluid.java b/src/main/java/tb/common/itemblock/ItemBlockPyrofluid.java index 19682d0..14445c0 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockPyrofluid.java +++ b/src/main/java/tb/common/itemblock/ItemBlockPyrofluid.java @@ -3,16 +3,14 @@ package tb.common.itemblock; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -public class ItemBlockPyrofluid extends ItemBlock{ +public class ItemBlockPyrofluid extends ItemBlock { - public ItemBlockPyrofluid(Block b) { - super(b); - this.setHasSubtypes(true); - } - - public int getMetadata(int meta) - { - return meta; + public ItemBlockPyrofluid(Block b) { + super(b); + this.setHasSubtypes(true); } + public int getMetadata(int meta) { + return meta; + } } diff --git a/src/main/java/tb/common/itemblock/ItemBlockSlab_0.java b/src/main/java/tb/common/itemblock/ItemBlockSlab_0.java index dd6958a..42f90d3 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockSlab_0.java +++ b/src/main/java/tb/common/itemblock/ItemBlockSlab_0.java @@ -1,20 +1,21 @@ package tb.common.itemblock; -import tb.init.TBBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.item.ItemSlab; +import tb.init.TBBlocks; -public class ItemBlockSlab_0 extends ItemSlab{ - - public ItemBlockSlab_0(Block b) - { - this(b,(BlockSlab)TBBlocks.genericSlab,(BlockSlab)TBBlocks.genericSlab_full,b == TBBlocks.genericSlab_full); - } +public class ItemBlockSlab_0 extends ItemSlab { - public ItemBlockSlab_0(Block block, BlockSlab slab,BlockSlab doubleSlab, boolean isFullSlab) - { - super(block, slab, doubleSlab, isFullSlab); - } + public ItemBlockSlab_0(Block b) { + this( + b, + (BlockSlab) TBBlocks.genericSlab, + (BlockSlab) TBBlocks.genericSlab_full, + b == TBBlocks.genericSlab_full); + } + public ItemBlockSlab_0(Block block, BlockSlab slab, BlockSlab doubleSlab, boolean isFullSlab) { + super(block, slab, doubleSlab, isFullSlab); + } } diff --git a/src/main/java/tb/common/itemblock/ItemBlockSlab_1.java b/src/main/java/tb/common/itemblock/ItemBlockSlab_1.java index 0c1976a..b6f6620 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockSlab_1.java +++ b/src/main/java/tb/common/itemblock/ItemBlockSlab_1.java @@ -1,20 +1,21 @@ package tb.common.itemblock; -import tb.init.TBBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.item.ItemSlab; +import tb.init.TBBlocks; -public class ItemBlockSlab_1 extends ItemSlab{ - - public ItemBlockSlab_1(Block b) - { - this(b,(BlockSlab)TBBlocks.crystalSlab,(BlockSlab)TBBlocks.crystalSlab_full,b == TBBlocks.crystalSlab_full); - } +public class ItemBlockSlab_1 extends ItemSlab { - public ItemBlockSlab_1(Block block, BlockSlab slab,BlockSlab doubleSlab, boolean isFullSlab) - { - super(block, slab, doubleSlab, isFullSlab); - } + public ItemBlockSlab_1(Block b) { + this( + b, + (BlockSlab) TBBlocks.crystalSlab, + (BlockSlab) TBBlocks.crystalSlab_full, + b == TBBlocks.crystalSlab_full); + } + public ItemBlockSlab_1(Block block, BlockSlab slab, BlockSlab doubleSlab, boolean isFullSlab) { + super(block, slab, doubleSlab, isFullSlab); + } } diff --git a/src/main/java/tb/common/itemblock/ItemBlockSpike.java b/src/main/java/tb/common/itemblock/ItemBlockSpike.java index 84b60ea..aa838d7 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockSpike.java +++ b/src/main/java/tb/common/itemblock/ItemBlockSpike.java @@ -2,33 +2,30 @@ package tb.common.itemblock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import tb.common.block.BlockSpike; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import tb.common.block.BlockSpike; -public class ItemBlockSpike extends ItemBlock{ +public class ItemBlockSpike extends ItemBlock { - public ItemBlockSpike(Block b) { - super(b); - this.setHasSubtypes(true); - } - - public String getUnlocalizedName(ItemStack stk) - { - return super.getUnlocalizedName(stk)+ (stk.getItemDamage() >= 6 ? BlockSpike.spikeNames[5] : BlockSpike.spikeNames[stk.getItemDamage()]); + public ItemBlockSpike(Block b) { + super(b); + this.setHasSubtypes(true); } - - public int getMetadata(int meta) - { + + public String getUnlocalizedName(ItemStack stk) { + return super.getUnlocalizedName(stk) + + (stk.getItemDamage() >= 6 ? BlockSpike.spikeNames[5] : BlockSpike.spikeNames[stk.getItemDamage()]); + } + + public int getMetadata(int meta) { return meta; } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return this.field_150939_a.getIcon(2, meta); - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return this.field_150939_a.getIcon(2, meta); + } } diff --git a/src/main/java/tb/common/itemblock/ItemBlockTBLeaves.java b/src/main/java/tb/common/itemblock/ItemBlockTBLeaves.java index b91d0ce..75b04f2 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockTBLeaves.java +++ b/src/main/java/tb/common/itemblock/ItemBlockTBLeaves.java @@ -1,25 +1,22 @@ package tb.common.itemblock; -import tb.common.block.BlockTBLeaves; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import tb.common.block.BlockTBLeaves; -public class ItemBlockTBLeaves extends ItemBlock{ +public class ItemBlockTBLeaves extends ItemBlock { - public ItemBlockTBLeaves(Block b) { - super(b); - this.setHasSubtypes(true); - } - - public String getUnlocalizedName(ItemStack stk) - { - return "tile."+BlockTBLeaves.names[Math.min(BlockTBLeaves.names.length-1,stk.getItemDamage()%8)]; + public ItemBlockTBLeaves(Block b) { + super(b); + this.setHasSubtypes(true); } - - public int getMetadata(int meta) - { + + public String getUnlocalizedName(ItemStack stk) { + return "tile." + BlockTBLeaves.names[Math.min(BlockTBLeaves.names.length - 1, stk.getItemDamage() % 8)]; + } + + public int getMetadata(int meta) { return meta; } - } diff --git a/src/main/java/tb/common/itemblock/ItemBlockTBLogs.java b/src/main/java/tb/common/itemblock/ItemBlockTBLogs.java index 36c1055..8aad281 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockTBLogs.java +++ b/src/main/java/tb/common/itemblock/ItemBlockTBLogs.java @@ -1,25 +1,22 @@ package tb.common.itemblock; -import tb.common.block.BlockTBLog; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import tb.common.block.BlockTBLog; -public class ItemBlockTBLogs extends ItemBlock{ +public class ItemBlockTBLogs extends ItemBlock { - public ItemBlockTBLogs(Block b) { - super(b); - this.setHasSubtypes(true); - } - - public String getUnlocalizedName(ItemStack stk) - { - return "tile."+BlockTBLog.names[Math.min(BlockTBLog.names.length-1,stk.getItemDamage()%4)]; + public ItemBlockTBLogs(Block b) { + super(b); + this.setHasSubtypes(true); } - - public int getMetadata(int meta) - { + + public String getUnlocalizedName(ItemStack stk) { + return "tile." + BlockTBLog.names[Math.min(BlockTBLog.names.length - 1, stk.getItemDamage() % 4)]; + } + + public int getMetadata(int meta) { return meta; } - } diff --git a/src/main/java/tb/common/itemblock/ItemBlockTBSapling.java b/src/main/java/tb/common/itemblock/ItemBlockTBSapling.java index 8d5a75e..2dfc12d 100644 --- a/src/main/java/tb/common/itemblock/ItemBlockTBSapling.java +++ b/src/main/java/tb/common/itemblock/ItemBlockTBSapling.java @@ -2,33 +2,29 @@ package tb.common.itemblock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import tb.common.block.BlockTBSapling; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import tb.common.block.BlockTBSapling; -public class ItemBlockTBSapling extends ItemBlock{ +public class ItemBlockTBSapling extends ItemBlock { - public ItemBlockTBSapling(Block b) { - super(b); - this.setHasSubtypes(true); - } - - public String getUnlocalizedName(ItemStack stk) - { - return "tile."+BlockTBSapling.names[Math.min(BlockTBSapling.names.length-1,stk.getItemDamage()%8)]; + public ItemBlockTBSapling(Block b) { + super(b); + this.setHasSubtypes(true); } - - public int getMetadata(int meta) - { + + public String getUnlocalizedName(ItemStack stk) { + return "tile." + BlockTBSapling.names[Math.min(BlockTBSapling.names.length - 1, stk.getItemDamage() % 8)]; + } + + public int getMetadata(int meta) { return meta; } - + @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { + public IIcon getIconFromDamage(int meta) { return this.field_150939_a.getIcon(2, meta); } - } diff --git a/src/main/java/tb/common/tile/TileAdvAlchemicalFurnace.java b/src/main/java/tb/common/tile/TileAdvAlchemicalFurnace.java index d1a2708..aa0af63 100644 --- a/src/main/java/tb/common/tile/TileAdvAlchemicalFurnace.java +++ b/src/main/java/tb/common/tile/TileAdvAlchemicalFurnace.java @@ -1,73 +1,65 @@ package tb.common.tile; import java.lang.reflect.Field; - import net.minecraft.nbt.NBTTagCompound; import tb.utils.TBConfig; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.tiles.TileAlchemyFurnace; -public class TileAdvAlchemicalFurnace extends TileAlchemyFurnace{ - private static Field fieldCount; - public boolean isFuelAlumentum; - - static - { - Field field; - try - { - field = TileAlchemyFurnace.class.getDeclaredField("count"); - field.setAccessible(true); - } - catch (Exception e) - { - e.printStackTrace(); - field = null; - } - fieldCount = field; - } - - public void readFromNBT(NBTTagCompound tag) - { - super.readFromNBT(tag); - isFuelAlumentum = tag.getBoolean("isAlumentium"); - } - - public void writeToNBT(NBTTagCompound tag) - { - super.writeToNBT(tag); - tag.setBoolean("isAlumentium", isFuelAlumentum); - } - - public void updateEntity() - { - if(this.furnaceBurnTime == 0) - { - isFuelAlumentum = this.getStackInSlot(1) != null && this.getStackInSlot(1).getItem() == ConfigItems.itemResource && this.getStackInSlot(1).getItemDamage() == 0; - } - try - { - if(fieldCount != null && (this.isFuelAlumentum || !TBConfig.makeRequireAlumentum)) - { - int furnaceUpdateStep = 20; //hardcoded in thaum to be 20 (when boosted) or 40, but let's assume 20 for simplicity - int currentCount = fieldCount.getInt(this); - //max meaningful bonus happens when (currentStep + 1 + bonus) % furnaceUpdateStep == 0, propagating us directly to next update count - //simple checks: - // if count=0, then we can add 19, thaum adds 1 and updates - // if count=19, then we add 0, the thaum will arrive to update at max speed without our help - // making sure to take remainders only from positives since java believes in negative remainders for negative dividends - int maxMeaningfulBonus = (furnaceUpdateStep - (currentCount + 1) % furnaceUpdateStep)%furnaceUpdateStep; - int bonusCount = TBConfig.speedMultiplierForFurnace-1; - int nextCount = currentCount + Math.min(bonusCount, maxMeaningfulBonus); +public class TileAdvAlchemicalFurnace extends TileAlchemyFurnace { + private static Field fieldCount; + public boolean isFuelAlumentum; - fieldCount.setInt(this, nextCount); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - super.updateEntity(); - } - + static { + Field field; + try { + field = TileAlchemyFurnace.class.getDeclaredField("count"); + field.setAccessible(true); + } catch (Exception e) { + e.printStackTrace(); + field = null; + } + fieldCount = field; + } + + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + isFuelAlumentum = tag.getBoolean("isAlumentium"); + } + + public void writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + tag.setBoolean("isAlumentium", isFuelAlumentum); + } + + public void updateEntity() { + if (this.furnaceBurnTime == 0) { + isFuelAlumentum = this.getStackInSlot(1) != null + && this.getStackInSlot(1).getItem() == ConfigItems.itemResource + && this.getStackInSlot(1).getItemDamage() == 0; + } + try { + if (fieldCount != null && (this.isFuelAlumentum || !TBConfig.makeRequireAlumentum)) { + int furnaceUpdateStep = + 20; // hardcoded in thaum to be 20 (when boosted) or 40, but let's assume 20 for simplicity + int currentCount = fieldCount.getInt(this); + // max meaningful bonus happens when (currentStep + 1 + bonus) % furnaceUpdateStep == 0, propagating us + // directly to next update count + // simple checks: + // if count=0, then we can add 19, thaum adds 1 and updates + // if count=19, then we add 0, the thaum will arrive to update at max speed without our help + // making sure to take remainders only from positives since java believes in negative remainders for + // negative dividends + int maxMeaningfulBonus = + (furnaceUpdateStep - (currentCount + 1) % furnaceUpdateStep) % furnaceUpdateStep; + int bonusCount = TBConfig.speedMultiplierForFurnace - 1; + int nextCount = currentCount + Math.min(bonusCount, maxMeaningfulBonus); + + fieldCount.setInt(this, nextCount); + } + } catch (Exception e) { + e.printStackTrace(); + } + super.updateEntity(); + } } diff --git a/src/main/java/tb/common/tile/TileBrazier.java b/src/main/java/tb/common/tile/TileBrazier.java index 46ba4c4..1360288 100644 --- a/src/main/java/tb/common/tile/TileBrazier.java +++ b/src/main/java/tb/common/tile/TileBrazier.java @@ -2,10 +2,6 @@ package tb.common.tile; import java.util.ArrayList; import java.util.List; - -import tb.common.entity.EntityAIAvoidCampfire; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.common.lib.events.EssentiaHandler; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.ai.EntityAITasks; import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry; @@ -14,97 +10,85 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; +import tb.common.entity.EntityAIAvoidCampfire; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.lib.events.EssentiaHandler; -public class TileBrazier extends TileEntity -{ - public int burnTime; - public int uptime; - public boolean burning; - - - public TileBrazier() { - this.burning = false; - } - - public void readFromNBT(NBTTagCompound tag) - { +public class TileBrazier extends TileEntity { + public int burnTime; + public int uptime; + public boolean burning; + + public TileBrazier() { + this.burning = false; + } + + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); burnTime = tag.getInteger("burnTime"); } - - public void writeToNBT(NBTTagCompound tag) - { + + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setInteger("burnTime", burnTime); } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void updateEntity() - { - ++uptime; - - if(burnTime >= 0) - { - --burnTime; - }else - { - if(EssentiaHandler.drainEssentia(this, Aspect.FIRE, ForgeDirection.UNKNOWN, 6, false)) - { - burnTime = 1600; - this.burning = true; - this.markDirty(); - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - } - } - - if(burnTime == -1) - { - this.burning = false; - this.markDirty(); - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - return; - } - - - //System.out.println("burn" + burnTime); - - if(!this.worldObj.isRemote) - { - List creatures = this.worldObj.getEntitiesWithinAABB(EntityCreature.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1).expand(12, 6, 12)); - - for(EntityCreature c : creatures) - { - if(!(c instanceof IMob)) - continue; + @SuppressWarnings({"unchecked", "rawtypes"}) + public void updateEntity() { + ++uptime; - ArrayList entries = (ArrayList) c.tasks.taskEntries; - - EntityAIAvoidCampfire campfireAviodable = null; - - boolean hasTask = false; - for (int i = 0; i < entries.size(); ++i) - { - EntityAITasks.EntityAITaskEntry task = (EntityAITaskEntry) entries.get(i); - if ((task.action instanceof EntityAIAvoidCampfire)) - { - campfireAviodable = (EntityAIAvoidCampfire) task.action; - hasTask = true; - break; - } - } - if(campfireAviodable == null) - campfireAviodable = new EntityAIAvoidCampfire(c); - - campfireAviodable.isScared = true; - campfireAviodable.scareTimer = 100; - campfireAviodable.campfireX = xCoord; - campfireAviodable.campfireY = yCoord; - campfireAviodable.campfireZ = zCoord; - - if(!hasTask) - c.tasks.addTask(1, campfireAviodable); - } - } - } + if (burnTime >= 0) { + --burnTime; + } else { + if (EssentiaHandler.drainEssentia(this, Aspect.FIRE, ForgeDirection.UNKNOWN, 6, false)) { + burnTime = 1600; + this.burning = true; + this.markDirty(); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + + if (burnTime == -1) { + this.burning = false; + this.markDirty(); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + return; + } + + // System.out.println("burn" + burnTime); + + if (!this.worldObj.isRemote) { + List creatures = this.worldObj.getEntitiesWithinAABB( + EntityCreature.class, + AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1) + .expand(12, 6, 12)); + + for (EntityCreature c : creatures) { + if (!(c instanceof IMob)) continue; + + ArrayList entries = (ArrayList) c.tasks.taskEntries; + + EntityAIAvoidCampfire campfireAviodable = null; + + boolean hasTask = false; + for (int i = 0; i < entries.size(); ++i) { + EntityAITasks.EntityAITaskEntry task = (EntityAITaskEntry) entries.get(i); + if ((task.action instanceof EntityAIAvoidCampfire)) { + campfireAviodable = (EntityAIAvoidCampfire) task.action; + hasTask = true; + break; + } + } + if (campfireAviodable == null) campfireAviodable = new EntityAIAvoidCampfire(c); + + campfireAviodable.isScared = true; + campfireAviodable.scareTimer = 100; + campfireAviodable.campfireX = xCoord; + campfireAviodable.campfireY = yCoord; + campfireAviodable.campfireZ = zCoord; + + if (!hasTask) c.tasks.addTask(1, campfireAviodable); + } + } + } } diff --git a/src/main/java/tb/common/tile/TileCampfire.java b/src/main/java/tb/common/tile/TileCampfire.java index 20a19f5..4e65229 100644 --- a/src/main/java/tb/common/tile/TileCampfire.java +++ b/src/main/java/tb/common/tile/TileCampfire.java @@ -2,9 +2,6 @@ package tb.common.tile; import java.util.ArrayList; import java.util.List; - -import tb.common.entity.EntityAIAvoidCampfire; -import thaumcraft.common.config.ConfigBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; import net.minecraft.entity.EntityCreature; @@ -18,168 +15,139 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.oredict.OreDictionary; +import tb.common.entity.EntityAIAvoidCampfire; +import thaumcraft.common.config.ConfigBlocks; -public class TileCampfire extends TileEntity -{ - public int burnTime; - public int logTime; - public int uptime; - - public void readFromNBT(NBTTagCompound tag) - { +public class TileCampfire extends TileEntity { + public int burnTime; + public int logTime; + public int uptime; + + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); burnTime = tag.getInteger("burnTime"); logTime = tag.getInteger("logTime"); } - - public void writeToNBT(NBTTagCompound tag) - { + + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setInteger("burnTime", burnTime); tag.setInteger("logTime", logTime); } - - public boolean addLog(ItemStack log) - { - if(log == null) - return false; - - if(logTime > 0) - return false; - - if(log.getItem() == Item.getItemFromBlock(ConfigBlocks.blockMagicalLog)) - { - if(log.getItemDamage()%3==0) - { - logTime = 1600*4; - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); - return true; - } - } - - if(Block.getBlockFromItem(log.getItem()) instanceof BlockLog) - { - logTime = 1600; - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); - return true; - } - - if(OreDictionary.getOreIDs(log).length > 0) - { - int[] ints = OreDictionary.getOreIDs(log); - boolean isLog = false; - for(int i = 0; i < ints.length; ++i) - { - String str = OreDictionary.getOreName(ints[i]); - if(str.equals("logWood")) - { - isLog = true; - break; - } - } - if(isLog) - { - logTime = 1600; - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); - return true; - } - } - - return false; - } - - public boolean addFuel(ItemStack item) - { - if(item == null) - return false; - - if(logTime <= 0) - return false; - - if(burnTime > 0) - return false; - - int burnTime = TileEntityFurnace.getItemBurnTime(item); - - if(burnTime <= 0) - return false; - - this.burnTime = burnTime; - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 2, 3); - - return true; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void updateEntity() - { - ++uptime; - - if(burnTime > 0) - { - --burnTime; - - if(logTime > 0) - --logTime; - } - - if(!this.worldObj.isRemote) - { - if(burnTime <= 0) - { - int metadata = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - if(metadata == 2) - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); - - return; - } - if(logTime <= 0) - { - int metadata = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - if(metadata > 0) - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 3); - - return; - } - } - - if(!this.worldObj.isRemote) - { - List creatures = this.worldObj.getEntitiesWithinAABB(EntityCreature.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1).expand(12, 6, 12)); - - for(EntityCreature c : creatures) - { - if(!(c instanceof IMob)) - continue; + public boolean addLog(ItemStack log) { + if (log == null) return false; - ArrayList entries = (ArrayList) c.tasks.taskEntries; - - EntityAIAvoidCampfire campfireAviodable = null; - - boolean hasTask = false; - for (int i = 0; i < entries.size(); ++i) - { - EntityAITasks.EntityAITaskEntry task = (EntityAITaskEntry) entries.get(i); - if ((task.action instanceof EntityAIAvoidCampfire)) - { - campfireAviodable = (EntityAIAvoidCampfire) task.action; - hasTask = true; - break; - } - } - if(campfireAviodable == null) - campfireAviodable = new EntityAIAvoidCampfire(c); - - campfireAviodable.isScared = true; - campfireAviodable.scareTimer = 100; - campfireAviodable.campfireX = xCoord; - campfireAviodable.campfireY = yCoord; - campfireAviodable.campfireZ = zCoord; - - if(!hasTask) - c.tasks.addTask(1, campfireAviodable); - } - } - } + if (logTime > 0) return false; + + if (log.getItem() == Item.getItemFromBlock(ConfigBlocks.blockMagicalLog)) { + if (log.getItemDamage() % 3 == 0) { + logTime = 1600 * 4; + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); + return true; + } + } + + if (Block.getBlockFromItem(log.getItem()) instanceof BlockLog) { + logTime = 1600; + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); + return true; + } + + if (OreDictionary.getOreIDs(log).length > 0) { + int[] ints = OreDictionary.getOreIDs(log); + boolean isLog = false; + for (int i = 0; i < ints.length; ++i) { + String str = OreDictionary.getOreName(ints[i]); + if (str.equals("logWood")) { + isLog = true; + break; + } + } + if (isLog) { + logTime = 1600; + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); + return true; + } + } + + return false; + } + + public boolean addFuel(ItemStack item) { + if (item == null) return false; + + if (logTime <= 0) return false; + + if (burnTime > 0) return false; + + int burnTime = TileEntityFurnace.getItemBurnTime(item); + + if (burnTime <= 0) return false; + + this.burnTime = burnTime; + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 2, 3); + + return true; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void updateEntity() { + ++uptime; + + if (burnTime > 0) { + --burnTime; + + if (logTime > 0) --logTime; + } + + if (!this.worldObj.isRemote) { + if (burnTime <= 0) { + int metadata = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if (metadata == 2) this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3); + + return; + } + if (logTime <= 0) { + int metadata = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if (metadata > 0) this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 3); + + return; + } + } + + if (!this.worldObj.isRemote) { + List creatures = this.worldObj.getEntitiesWithinAABB( + EntityCreature.class, + AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1) + .expand(12, 6, 12)); + + for (EntityCreature c : creatures) { + if (!(c instanceof IMob)) continue; + + ArrayList entries = (ArrayList) c.tasks.taskEntries; + + EntityAIAvoidCampfire campfireAviodable = null; + + boolean hasTask = false; + for (int i = 0; i < entries.size(); ++i) { + EntityAITasks.EntityAITaskEntry task = (EntityAITaskEntry) entries.get(i); + if ((task.action instanceof EntityAIAvoidCampfire)) { + campfireAviodable = (EntityAIAvoidCampfire) task.action; + hasTask = true; + break; + } + } + if (campfireAviodable == null) campfireAviodable = new EntityAIAvoidCampfire(c); + + campfireAviodable.isScared = true; + campfireAviodable.scareTimer = 100; + campfireAviodable.campfireX = xCoord; + campfireAviodable.campfireY = yCoord; + campfireAviodable.campfireZ = zCoord; + + if (!hasTask) c.tasks.addTask(1, campfireAviodable); + } + } + } } diff --git a/src/main/java/tb/common/tile/TileEntityDeconstructor.java b/src/main/java/tb/common/tile/TileEntityDeconstructor.java index ec8b1be..868a75e 100644 --- a/src/main/java/tb/common/tile/TileEntityDeconstructor.java +++ b/src/main/java/tb/common/tile/TileEntityDeconstructor.java @@ -1,17 +1,8 @@ package tb.common.tile; -import java.util.List; - import DummyCore.Utils.MathUtils; import DummyCore.Utils.MiscUtils; -import tb.utils.TBUtils; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.codechicken.lib.math.MathHelper; -import thaumcraft.common.Thaumcraft; -import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; -import thaumcraft.common.lib.research.ResearchManager; -import thaumcraft.common.lib.research.ScanManager; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayerMP; @@ -25,18 +16,25 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; +import tb.utils.TBUtils; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.codechicken.lib.math.MathHelper; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; +import thaumcraft.common.lib.research.ResearchManager; +import thaumcraft.common.lib.research.ScanManager; -public class TileEntityDeconstructor extends TileEntity{ - - public int tickTime; - public String placerName = "no placer"; - - public boolean hasAir, hasFire, hasWater, hasEarth, hasOrdo, hasEntropy; +public class TileEntityDeconstructor extends TileEntity { - public void readFromNBT(NBTTagCompound tag) - { + public int tickTime; + public String placerName = "no placer"; + + public boolean hasAir, hasFire, hasWater, hasEarth, hasOrdo, hasEntropy; + + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); - + hasAir = tag.getBoolean("b0"); hasFire = tag.getBoolean("b1"); hasWater = tag.getBoolean("b2"); @@ -45,11 +43,10 @@ public class TileEntityDeconstructor extends TileEntity{ hasEntropy = tag.getBoolean("b5"); placerName = tag.getString("placer"); } - - public void writeToNBT(NBTTagCompound tag) - { + + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); - + tag.setBoolean("b0", hasAir); tag.setBoolean("b1", hasFire); tag.setBoolean("b2", hasWater); @@ -58,140 +55,136 @@ public class TileEntityDeconstructor extends TileEntity{ tag.setBoolean("b5", hasEntropy); tag.setString("placer", placerName); } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) - { - if(net.getNetHandler() instanceof INetHandlerPlayClient) - if(pkt.func_148853_f() == -10) - this.readFromNBT(pkt.func_148857_g()); + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + if (net.getNetHandler() instanceof INetHandlerPlayClient) + if (pkt.func_148853_f() == -10) this.readFromNBT(pkt.func_148857_g()); } - - @Override - public Packet getDescriptionPacket() - { + + @Override + public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -10, nbttagcompound); } - - @SuppressWarnings("unchecked") - public void updateEntity() - { - if(!this.worldObj.isRemote && tickTime == 0) - MiscUtils.sendPacketToAllAround(worldObj, getDescriptionPacket(), xCoord, yCoord, zCoord, worldObj.provider.dimensionId, 16); - - int additionalStability = 0; - - if(hasAir) - ++additionalStability; - if(hasWater) - ++additionalStability; - if(hasFire) - ++additionalStability; - if(hasEarth) - ++additionalStability; - if(hasOrdo) - ++additionalStability; - if(hasEntropy) - ++additionalStability; - - if(placerName == null || placerName.isEmpty() || placerName.contains("no placer")) - return; - - List entities = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1)); - if(!entities.isEmpty()) - { - Entity e = entities.get(0); - if(e != null && !e.isDead) - { - if(e instanceof EntityItem) - { - if(additionalStability >= 6) - { - EntityItem itm = (EntityItem) e; - ItemStack stk = itm.getEntityItem(); - if(stk != null) - { - AspectList aspectsCompound = ThaumcraftCraftingManager.getObjectTags(stk); - aspectsCompound = ThaumcraftCraftingManager.getBonusTags(stk, aspectsCompound); - if(aspectsCompound != null && aspectsCompound.size() > 0) - { - ++tickTime; - if(tickTime == 40) - { - tickTime = 0; - - --stk.stackSize; - if(stk.stackSize <= 0) - itm.setDead(); - - AspectList primals = ResearchManager.reduceToPrimals(aspectsCompound); - Aspect a = null; - if (this.worldObj.rand.nextInt(40) < primals.visSize()) - a = primals.getAspects()[this.worldObj.rand.nextInt(primals.getAspects().length)]; - - if(!this.worldObj.isRemote && a != null) - { - EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(placerName); - if(player != null) - { - double distance = player.getDistance(xCoord+0.5D, yCoord, zCoord+0.5D); - if(distance < 32+(additionalStability*8)) { - TBUtils.addAspectToKnowledgePool(player, a, (short) 1); - } - } - } - } - } - Thaumcraft.proxy.blockRunes(worldObj, xCoord, yCoord+MathUtils.randomDouble(this.worldObj.rand)*0.5D, zCoord, 1, 0.5F, 0.5F, 8, 0); - return; - } - } - }else - { - AspectList aspectsCompound = ScanManager.generateEntityAspects(e); - if(aspectsCompound != null && aspectsCompound.size() > 0) - { - ++tickTime; - - tickTime += MathHelper.floor_double(additionalStability/2); - - if(tickTime == 40) - { - tickTime = 0; - e.attackEntityFrom(DamageSource.magic, 2); - - if(e instanceof EntityPlayerMP) - { - TBUtils.addWarpToPlayer(EntityPlayerMP.class.cast(e), 1, 0); - } - - Aspect a = aspectsCompound.getAspects()[this.worldObj.rand.nextInt(aspectsCompound.size())]; - - if(!this.worldObj.isRemote) - { - EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(placerName); - if(player != null) - { - double distance = player.getDistance(xCoord+0.5D, yCoord, zCoord+0.5D); - - if(distance < 32+(additionalStability*8)) { - TBUtils.addAspectToKnowledgePool(player, a, (short) 1); - } - - } - } - } - Thaumcraft.proxy.blockRunes(worldObj, xCoord, yCoord+MathUtils.randomDouble(this.worldObj.rand)*0.5D, zCoord, 1, 0.5F, 0.5F, 8, 0); - return; - } - } - } - } - - tickTime = 0; - } - + @SuppressWarnings("unchecked") + public void updateEntity() { + if (!this.worldObj.isRemote && tickTime == 0) + MiscUtils.sendPacketToAllAround( + worldObj, getDescriptionPacket(), xCoord, yCoord, zCoord, worldObj.provider.dimensionId, 16); + + int additionalStability = 0; + + if (hasAir) ++additionalStability; + if (hasWater) ++additionalStability; + if (hasFire) ++additionalStability; + if (hasEarth) ++additionalStability; + if (hasOrdo) ++additionalStability; + if (hasEntropy) ++additionalStability; + + if (placerName == null || placerName.isEmpty() || placerName.contains("no placer")) return; + + List entities = this.worldObj.getEntitiesWithinAABB( + Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); + if (!entities.isEmpty()) { + Entity e = entities.get(0); + if (e != null && !e.isDead) { + if (e instanceof EntityItem) { + if (additionalStability >= 6) { + EntityItem itm = (EntityItem) e; + ItemStack stk = itm.getEntityItem(); + if (stk != null) { + AspectList aspectsCompound = ThaumcraftCraftingManager.getObjectTags(stk); + aspectsCompound = ThaumcraftCraftingManager.getBonusTags(stk, aspectsCompound); + if (aspectsCompound != null && aspectsCompound.size() > 0) { + ++tickTime; + if (tickTime == 40) { + tickTime = 0; + + --stk.stackSize; + if (stk.stackSize <= 0) itm.setDead(); + + AspectList primals = ResearchManager.reduceToPrimals(aspectsCompound); + Aspect a = null; + if (this.worldObj.rand.nextInt(40) < primals.visSize()) + a = primals.getAspects()[ + this.worldObj.rand.nextInt(primals.getAspects().length)]; + + if (!this.worldObj.isRemote && a != null) { + EntityPlayerMP player = MinecraftServer.getServer() + .getConfigurationManager() + .func_152612_a(placerName); + if (player != null) { + double distance = player.getDistance(xCoord + 0.5D, yCoord, zCoord + 0.5D); + + if (distance < 32 + (additionalStability * 8)) { + TBUtils.addAspectToKnowledgePool(player, a, (short) 1); + } + } + } + } + } + Thaumcraft.proxy.blockRunes( + worldObj, + xCoord, + yCoord + MathUtils.randomDouble(this.worldObj.rand) * 0.5D, + zCoord, + 1, + 0.5F, + 0.5F, + 8, + 0); + return; + } + } + } else { + AspectList aspectsCompound = ScanManager.generateEntityAspects(e); + if (aspectsCompound != null && aspectsCompound.size() > 0) { + ++tickTime; + + tickTime += MathHelper.floor_double(additionalStability / 2); + + if (tickTime == 40) { + tickTime = 0; + e.attackEntityFrom(DamageSource.magic, 2); + + if (e instanceof EntityPlayerMP) { + TBUtils.addWarpToPlayer(EntityPlayerMP.class.cast(e), 1, 0); + } + + Aspect a = aspectsCompound.getAspects()[this.worldObj.rand.nextInt(aspectsCompound.size())]; + + if (!this.worldObj.isRemote) { + EntityPlayerMP player = MinecraftServer.getServer() + .getConfigurationManager() + .func_152612_a(placerName); + if (player != null) { + double distance = player.getDistance(xCoord + 0.5D, yCoord, zCoord + 0.5D); + + if (distance < 32 + (additionalStability * 8)) { + TBUtils.addAspectToKnowledgePool(player, a, (short) 1); + } + } + } + } + Thaumcraft.proxy.blockRunes( + worldObj, + xCoord, + yCoord + MathUtils.randomDouble(this.worldObj.rand) * 0.5D, + zCoord, + 1, + 0.5F, + 0.5F, + 8, + 0); + return; + } + } + } + } + + tickTime = 0; + } } diff --git a/src/main/java/tb/common/tile/TileNodeLinker.java b/src/main/java/tb/common/tile/TileNodeLinker.java index f24caed..527d0d3 100644 --- a/src/main/java/tb/common/tile/TileNodeLinker.java +++ b/src/main/java/tb/common/tile/TileNodeLinker.java @@ -1,23 +1,11 @@ package tb.common.tile; +import DummyCore.Utils.Coord3D; +import DummyCore.Utils.MiscUtils; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import java.util.ArrayList; import java.util.Collection; import java.util.List; - -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.nodes.INode; -import thaumcraft.api.wands.IWandable; -import thaumcraft.codechicken.lib.math.MathHelper; -import thaumcraft.common.Thaumcraft; -import thaumcraft.common.config.ConfigBlocks; -import thaumcraft.common.entities.monster.EntityWisp; -import thaumcraft.common.lib.network.PacketHandler; -import thaumcraft.common.lib.network.fx.PacketFXBlockZap; -import thaumcraft.common.tiles.TileNode; -import DummyCore.Utils.Coord3D; -import DummyCore.Utils.MiscUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -31,349 +19,361 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.nodes.INode; +import thaumcraft.api.wands.IWandable; +import thaumcraft.codechicken.lib.math.MathHelper; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.entities.monster.EntityWisp; +import thaumcraft.common.lib.network.PacketHandler; +import thaumcraft.common.lib.network.fx.PacketFXBlockZap; +import thaumcraft.common.tiles.TileNode; -public class TileNodeLinker extends TileEntity implements IWandable -{ - public Coord3D linkCoord; - public int syncTimer; - public int instability; - - public void updateEntity() - { - if (!worldObj.isRemote) { - if (syncTimer <= 0) - { - syncTimer = 100; - NBTTagCompound tg = new NBTTagCompound(); - if (linkCoord != null) - { - tg.setFloat("coordsX", linkCoord.x); - tg.setFloat("coordsY", linkCoord.y); - tg.setFloat("coordsZ", linkCoord.z); - } - tg.setInteger("x", xCoord); - tg.setInteger("y", yCoord); - tg.setInteger("z", zCoord); - MiscUtils.syncTileEntity(tg, 0); - } else - --syncTimer; - } - - if(linkCoord != null) - { - int x = MathHelper.floor_double(linkCoord.x); - int y = MathHelper.floor_double(linkCoord.y); - int z = MathHelper.floor_double(linkCoord.z); - - if(this.worldObj.getTileEntity(x, y, z) instanceof TileNodeLinker && TileNodeLinker.class.cast(this.worldObj.getTileEntity(x, y, z)).linkCoord == null) - { - if(this.worldObj.getBlock(xCoord, yCoord-1, zCoord) == ConfigBlocks.blockAiry && this.worldObj.getBlock(x, y-1, z) == ConfigBlocks.blockAiry) - { - if(this.worldObj.getTileEntity(xCoord, yCoord-1, zCoord) instanceof INode && this.worldObj.getTileEntity(x, y-1, z) instanceof INode) - { - if(this.worldObj.getBlockMetadata(xCoord, yCoord-1, zCoord) == 0 && this.worldObj.getBlockMetadata(x, y-1, z) == 0) - { - double sX = linkCoord.x+0.5D; - double sY = linkCoord.y+0.825D; - double sZ = linkCoord.z+0.5D; - - double eX = xCoord+0.5D; - double eY = yCoord+0.825D; - double eZ = zCoord+0.5D; - - if(this.worldObj.isRemote) - Thaumcraft.proxy.beam(worldObj, sX, sY, sZ, eX, eY, eZ, 1, 0xffffff, false, 1, 1); - - if(this.worldObj.isRemote) - Thaumcraft.proxy.nodeBolt(worldObj, (float)sX, (float)(sY-1.3F), (float)sZ, (float)sX, (float)sY-0.6F, (float)sZ); - - if(this.worldObj.isRemote) - Thaumcraft.proxy.nodeBolt(worldObj, (float)eX, (float)eY-0.6F, (float)eZ, (float)eX, (float)eY-1.3F, (float)eZ); - - if(syncTimer % 10 == 0 && !this.worldObj.isRemote) - { - TileNode reciever = (TileNode) this.worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - TileNode transmitter = (TileNode) this.worldObj.getTileEntity(x, y-1, z); - boolean isPushPerm = this.worldObj.rand.nextDouble() < 0.3D ? true : transmitter.getAspects().visSize() > 0 ? false : true; - AspectList pullFrom = isPushPerm ? transmitter.getAspectsBase() : transmitter.getAspects(); - AspectList pushTo = isPushPerm ? reciever.getAspectsBase() : reciever.getAspects(); - if(pullFrom.visSize() <= 0) - { - this.worldObj.setBlockToAir(x, y-1, z); - return; - }else - { - Aspect randomAspect = pullFrom.getAspects()[this.worldObj.rand.nextInt(pullFrom.getAspects().length)]; - if(isPushPerm) - { - if(this.worldObj.rand.nextDouble() <= 0.7D) - { - if(instabilityCheck()) - { - pushTo.add(randomAspect, 1); - reciever.getAspects().add(randomAspect, 1); - } - pullFrom.reduce(randomAspect, 1); - }else - { - pullFrom.reduce(randomAspect, 1); - } - ++instability; - }else - { - if(pushTo.getAmount(randomAspect) > 0 && pushTo.getAmount(randomAspect) <= reciever.getAspectsBase().getAmount(randomAspect)) - { - if(instabilityCheck()) - pushTo.add(randomAspect, 1); - - pullFrom.reduce(randomAspect, 1); - }else - { - pullFrom.reduce(randomAspect, 1); - } - if(this.worldObj.rand.nextDouble() <= 0.33D) - ++instability; - } - - transmitter.markDirty(); - reciever.markDirty(); - this.worldObj.markBlockForUpdate(x, y-1, z); - this.worldObj.markBlockForUpdate(xCoord, yCoord-1, zCoord); - } - } - } - } - } - - }else - linkCoord = null; - }else - instability = 0; - } - - public boolean instabilityCheck() - { - if(this.worldObj.rand.nextInt(50) <= this.instability) - { - int rnd = this.worldObj.rand.nextInt(this.instability); - if(rnd == 49) - { - //if a block of Ichorium is above dont explode or harm node - if (!OreDictionary.doesOreNameExist("blockIchorium") || (OreDictionary.getOres("blockIchorium")!=null && !(OreDictionary.getOres("blockIchorium").contains(new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord +1, this.zCoord)))))) - instability -= explodeTransmitter(); - }else - { - if(rnd >= 45) - { - //if a block of Ichorium is above dont explode or harm node - if (!OreDictionary.doesOreNameExist("blockIchorium") || (OreDictionary.getOres("blockIchorium")!=null && !(OreDictionary.getOres("blockIchorium").contains(new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord +1, this.zCoord)))))) - instability -= harmTransmitter(); - }else - { - if(rnd >= 31) - { - instability -= wisp(); - }else - { - if(rnd >= 20) - { - instability -= zap(); - }else - { - if(rnd >= 10) - { - instability -= fluxNode(); - }else - { - instability -= fluxTransmission(); - } - } - } - } - } - return false; - } - return true; - } - - public int harmTransmitter() - { - int x = MathHelper.floor_double(linkCoord.x); - int y = MathHelper.floor_double(linkCoord.y); - int z = MathHelper.floor_double(linkCoord.z); - boolean reducePerm = this.worldObj.rand.nextBoolean(); - TileNode transmitter = (TileNode) this.worldObj.getTileEntity(x, y-1, z); - AspectList reduced = reducePerm ? transmitter.getAspectsBase() : transmitter.getAspects(); - - if(reduced.visSize() <= 0 || reduced.size() <= 0) - return 0; - - Aspect rnd = reduced.getAspects()[this.worldObj.rand.nextInt(reduced.size())]; - int reduceBy = Math.min(4 + this.worldObj.rand.nextInt(16),reduced.getAmount(rnd)); - - reduced.reduce(rnd, reduceBy); - transmitter.markDirty(); - this.worldObj.markBlockForUpdate(x, y-1, z); - - return reducePerm ? 25 : 6; - } - - @SuppressWarnings("unchecked") - public int zap() - { - boolean side = this.worldObj.rand.nextBoolean(); - int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; - int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; - int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; - List players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x-5, y-6, z-5, x+5, y+4, z+5)); - if(!players.isEmpty()) - { - EntityPlayer target = players.get(worldObj.rand.nextInt(players.size())); - PacketHandler.INSTANCE.sendToAllAround(new PacketFXBlockZap(x + 0.5F, y - 0.5F, z + 0.5F, (float)target.posX, (float)target.posY + target.height / 2.0F, (float)target.posZ), new TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32.0D)); - target.attackEntityFrom(DamageSource.magic, 4 + this.worldObj.rand.nextInt(4)); - return 5; - } - return 0; - } - - public int wisp() - { - boolean side = this.worldObj.rand.nextBoolean(); - int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; - int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; - int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; - ArrayList aspects = new ArrayList(); - Collection pa = Aspect.aspects.values(); - for (Aspect aspect:pa) - { - aspects.add(aspect); - } - - EntityWisp wisp = new EntityWisp(worldObj); - wisp.setPositionAndRotation(x+0.5D, y-0.5D, z+0.5D, 0, 0); - wisp.setType(aspects.get(worldObj.rand.nextInt(aspects.size())).getTag()); - worldObj.spawnEntityInWorld(wisp); - - return 9; - } - - public int fluxNode() - { - boolean side = this.worldObj.rand.nextBoolean(); - int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; - int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; - int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; - int fluxMeta = this.worldObj.rand.nextInt(8); - int pos = 2 + this.worldObj.rand.nextInt(4); - ForgeDirection off = ForgeDirection.VALID_DIRECTIONS[pos]; - this.worldObj.setBlock(x+off.offsetX, y-1, z+off.offsetZ, ConfigBlocks.blockFluxGoo, fluxMeta, 3); - return 5; - } - - public int fluxTransmission() - { - boolean side = this.worldObj.rand.nextBoolean(); - int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; - int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; - int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; - int fluxMeta = this.worldObj.rand.nextInt(8); - this.worldObj.setBlock(x, y+2, z, ConfigBlocks.blockFluxGas, fluxMeta, 3); - return 3; - } - - public int explodeTransmitter() - { - int x = MathHelper.floor_double(linkCoord.x); - int y = MathHelper.floor_double(linkCoord.y); - int z = MathHelper.floor_double(linkCoord.z); - this.worldObj.setBlockToAir(x, y-1, z); - this.worldObj.createExplosion(null, x+0.5D, y-0.5D, z+0.5D, 2, true); - return instability; - } - - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) - { - if(pkt.func_148857_g().hasKey("coordsX")) - { - linkCoord = new Coord3D(pkt.func_148857_g().getFloat("coordsX"),pkt.func_148857_g().getFloat("coordsY"),pkt.func_148857_g().getFloat("coordsZ")); - }else - linkCoord = null; +public class TileNodeLinker extends TileEntity implements IWandable { + public Coord3D linkCoord; + public int syncTimer; + public int instability; + + public void updateEntity() { + if (!worldObj.isRemote) { + if (syncTimer <= 0) { + syncTimer = 100; + NBTTagCompound tg = new NBTTagCompound(); + if (linkCoord != null) { + tg.setFloat("coordsX", linkCoord.x); + tg.setFloat("coordsY", linkCoord.y); + tg.setFloat("coordsZ", linkCoord.z); + } + tg.setInteger("x", xCoord); + tg.setInteger("y", yCoord); + tg.setInteger("z", zCoord); + MiscUtils.syncTileEntity(tg, 0); + } else --syncTimer; + } + + if (linkCoord != null) { + int x = MathHelper.floor_double(linkCoord.x); + int y = MathHelper.floor_double(linkCoord.y); + int z = MathHelper.floor_double(linkCoord.z); + + if (this.worldObj.getTileEntity(x, y, z) instanceof TileNodeLinker + && TileNodeLinker.class.cast(this.worldObj.getTileEntity(x, y, z)).linkCoord == null) { + if (this.worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ConfigBlocks.blockAiry + && this.worldObj.getBlock(x, y - 1, z) == ConfigBlocks.blockAiry) { + if (this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) instanceof INode + && this.worldObj.getTileEntity(x, y - 1, z) instanceof INode) { + if (this.worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord) == 0 + && this.worldObj.getBlockMetadata(x, y - 1, z) == 0) { + double sX = linkCoord.x + 0.5D; + double sY = linkCoord.y + 0.825D; + double sZ = linkCoord.z + 0.5D; + + double eX = xCoord + 0.5D; + double eY = yCoord + 0.825D; + double eZ = zCoord + 0.5D; + + if (this.worldObj.isRemote) + Thaumcraft.proxy.beam(worldObj, sX, sY, sZ, eX, eY, eZ, 1, 0xffffff, false, 1, 1); + + if (this.worldObj.isRemote) + Thaumcraft.proxy.nodeBolt( + worldObj, + (float) sX, + (float) (sY - 1.3F), + (float) sZ, + (float) sX, + (float) sY - 0.6F, + (float) sZ); + + if (this.worldObj.isRemote) + Thaumcraft.proxy.nodeBolt( + worldObj, + (float) eX, + (float) eY - 0.6F, + (float) eZ, + (float) eX, + (float) eY - 1.3F, + (float) eZ); + + if (syncTimer % 10 == 0 && !this.worldObj.isRemote) { + TileNode reciever = (TileNode) this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + TileNode transmitter = (TileNode) this.worldObj.getTileEntity(x, y - 1, z); + boolean isPushPerm = this.worldObj.rand.nextDouble() < 0.3D + ? true + : transmitter.getAspects().visSize() > 0 ? false : true; + AspectList pullFrom = + isPushPerm ? transmitter.getAspectsBase() : transmitter.getAspects(); + AspectList pushTo = isPushPerm ? reciever.getAspectsBase() : reciever.getAspects(); + if (pullFrom.visSize() <= 0) { + this.worldObj.setBlockToAir(x, y - 1, z); + return; + } else { + Aspect randomAspect = pullFrom.getAspects()[ + this.worldObj.rand.nextInt(pullFrom.getAspects().length)]; + if (isPushPerm) { + if (this.worldObj.rand.nextDouble() <= 0.7D) { + if (instabilityCheck()) { + pushTo.add(randomAspect, 1); + reciever.getAspects().add(randomAspect, 1); + } + pullFrom.reduce(randomAspect, 1); + } else { + pullFrom.reduce(randomAspect, 1); + } + ++instability; + } else { + if (pushTo.getAmount(randomAspect) > 0 + && pushTo.getAmount(randomAspect) + <= reciever.getAspectsBase() + .getAmount(randomAspect)) { + if (instabilityCheck()) pushTo.add(randomAspect, 1); + + pullFrom.reduce(randomAspect, 1); + } else { + pullFrom.reduce(randomAspect, 1); + } + if (this.worldObj.rand.nextDouble() <= 0.33D) ++instability; + } + + transmitter.markDirty(); + reciever.markDirty(); + this.worldObj.markBlockForUpdate(x, y - 1, z); + this.worldObj.markBlockForUpdate(xCoord, yCoord - 1, zCoord); + } + } + } + } + } + + } else linkCoord = null; + } else instability = 0; } - - public void readFromNBT(NBTTagCompound tag) - { + + public boolean instabilityCheck() { + if (this.worldObj.rand.nextInt(50) <= this.instability) { + int rnd = this.worldObj.rand.nextInt(this.instability); + if (rnd == 49) { + // if a block of Ichorium is above dont explode or harm node + if (!OreDictionary.doesOreNameExist("blockIchorium") + || (OreDictionary.getOres("blockIchorium") != null + && !(OreDictionary.getOres("blockIchorium") + .contains(new ItemStack( + this.worldObj.getBlock(this.xCoord, this.yCoord + 1, this.zCoord)))))) + instability -= explodeTransmitter(); + } else { + if (rnd >= 45) { + // if a block of Ichorium is above dont explode or harm node + if (!OreDictionary.doesOreNameExist("blockIchorium") + || (OreDictionary.getOres("blockIchorium") != null + && !(OreDictionary.getOres("blockIchorium") + .contains(new ItemStack(this.worldObj.getBlock( + this.xCoord, this.yCoord + 1, this.zCoord)))))) + instability -= harmTransmitter(); + } else { + if (rnd >= 31) { + instability -= wisp(); + } else { + if (rnd >= 20) { + instability -= zap(); + } else { + if (rnd >= 10) { + instability -= fluxNode(); + } else { + instability -= fluxTransmission(); + } + } + } + } + } + return false; + } + return true; + } + + public int harmTransmitter() { + int x = MathHelper.floor_double(linkCoord.x); + int y = MathHelper.floor_double(linkCoord.y); + int z = MathHelper.floor_double(linkCoord.z); + boolean reducePerm = this.worldObj.rand.nextBoolean(); + TileNode transmitter = (TileNode) this.worldObj.getTileEntity(x, y - 1, z); + AspectList reduced = reducePerm ? transmitter.getAspectsBase() : transmitter.getAspects(); + + if (reduced.visSize() <= 0 || reduced.size() <= 0) return 0; + + Aspect rnd = reduced.getAspects()[this.worldObj.rand.nextInt(reduced.size())]; + int reduceBy = Math.min(4 + this.worldObj.rand.nextInt(16), reduced.getAmount(rnd)); + + reduced.reduce(rnd, reduceBy); + transmitter.markDirty(); + this.worldObj.markBlockForUpdate(x, y - 1, z); + + return reducePerm ? 25 : 6; + } + + @SuppressWarnings("unchecked") + public int zap() { + boolean side = this.worldObj.rand.nextBoolean(); + int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; + int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; + int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; + List players = this.worldObj.getEntitiesWithinAABB( + EntityPlayer.class, AxisAlignedBB.getBoundingBox(x - 5, y - 6, z - 5, x + 5, y + 4, z + 5)); + if (!players.isEmpty()) { + EntityPlayer target = players.get(worldObj.rand.nextInt(players.size())); + PacketHandler.INSTANCE.sendToAllAround( + new PacketFXBlockZap( + x + 0.5F, + y - 0.5F, + z + 0.5F, + (float) target.posX, + (float) target.posY + target.height / 2.0F, + (float) target.posZ), + new TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32.0D)); + target.attackEntityFrom(DamageSource.magic, 4 + this.worldObj.rand.nextInt(4)); + return 5; + } + return 0; + } + + public int wisp() { + boolean side = this.worldObj.rand.nextBoolean(); + int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; + int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; + int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; + ArrayList aspects = new ArrayList(); + Collection pa = Aspect.aspects.values(); + for (Aspect aspect : pa) { + aspects.add(aspect); + } + + EntityWisp wisp = new EntityWisp(worldObj); + wisp.setPositionAndRotation(x + 0.5D, y - 0.5D, z + 0.5D, 0, 0); + wisp.setType(aspects.get(worldObj.rand.nextInt(aspects.size())).getTag()); + worldObj.spawnEntityInWorld(wisp); + + return 9; + } + + public int fluxNode() { + boolean side = this.worldObj.rand.nextBoolean(); + int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; + int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; + int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; + int fluxMeta = this.worldObj.rand.nextInt(8); + int pos = 2 + this.worldObj.rand.nextInt(4); + ForgeDirection off = ForgeDirection.VALID_DIRECTIONS[pos]; + this.worldObj.setBlock(x + off.offsetX, y - 1, z + off.offsetZ, ConfigBlocks.blockFluxGoo, fluxMeta, 3); + return 5; + } + + public int fluxTransmission() { + boolean side = this.worldObj.rand.nextBoolean(); + int x = side ? MathHelper.floor_double(linkCoord.x) : xCoord; + int y = side ? MathHelper.floor_double(linkCoord.y) : yCoord; + int z = side ? MathHelper.floor_double(linkCoord.z) : zCoord; + int fluxMeta = this.worldObj.rand.nextInt(8); + this.worldObj.setBlock(x, y + 2, z, ConfigBlocks.blockFluxGas, fluxMeta, 3); + return 3; + } + + public int explodeTransmitter() { + int x = MathHelper.floor_double(linkCoord.x); + int y = MathHelper.floor_double(linkCoord.y); + int z = MathHelper.floor_double(linkCoord.z); + this.worldObj.setBlockToAir(x, y - 1, z); + this.worldObj.createExplosion(null, x + 0.5D, y - 0.5D, z + 0.5D, 2, true); + return instability; + } + + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + if (pkt.func_148857_g().hasKey("coordsX")) { + linkCoord = new Coord3D( + pkt.func_148857_g().getFloat("coordsX"), + pkt.func_148857_g().getFloat("coordsY"), + pkt.func_148857_g().getFloat("coordsZ")); + } else linkCoord = null; + } + + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); - if(tag.hasKey("coordsX")) - { - linkCoord = new Coord3D(tag.getFloat("coordsX"),tag.getFloat("coordsY"),tag.getFloat("coordsZ")); - } - instability = tag.getInteger("instability"); + if (tag.hasKey("coordsX")) { + linkCoord = new Coord3D(tag.getFloat("coordsX"), tag.getFloat("coordsY"), tag.getFloat("coordsZ")); + } + instability = tag.getInteger("instability"); } - - public void writeToNBT(NBTTagCompound tag) - { + + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); - if(linkCoord != null) - { - tag.setFloat("coordsX", linkCoord.x); - tag.setFloat("coordsY", linkCoord.y); - tag.setFloat("coordsZ", linkCoord.z); - } - tag.setInteger("instability", instability); + if (linkCoord != null) { + tag.setFloat("coordsX", linkCoord.x); + tag.setFloat("coordsY", linkCoord.y); + tag.setFloat("coordsZ", linkCoord.z); + } + tag.setInteger("instability", instability); } - @Override - public int onWandRightClick(World paramWorld, ItemStack paramItemStack, - EntityPlayer paramEntityPlayer, int paramInt1, int paramInt2, - int paramInt3, int paramInt4, int paramInt5) { - // TODO Auto-generated method stub - return 0; - } + @Override + public int onWandRightClick( + World paramWorld, + ItemStack paramItemStack, + EntityPlayer paramEntityPlayer, + int paramInt1, + int paramInt2, + int paramInt3, + int paramInt4, + int paramInt5) { + // TODO Auto-generated method stub + return 0; + } - @Override - public ItemStack onWandRightClick(World paramWorld, ItemStack paramItemStack, EntityPlayer paramEntityPlayer) - { - paramEntityPlayer.swingItem(); - if(!paramItemStack.hasTagCompound()) - paramItemStack.setTagCompound(new NBTTagCompound()); + @Override + public ItemStack onWandRightClick(World paramWorld, ItemStack paramItemStack, EntityPlayer paramEntityPlayer) { + paramEntityPlayer.swingItem(); + if (!paramItemStack.hasTagCompound()) paramItemStack.setTagCompound(new NBTTagCompound()); - if(paramItemStack.getTagCompound().hasKey("linkCoordX")) { - float x = paramItemStack.getTagCompound().getFloat("linkCoordX"); - float y = paramItemStack.getTagCompound().getFloat("linkCoordY"); - float z = paramItemStack.getTagCompound().getFloat("linkCoordZ"); - if (this.worldObj.getTileEntity(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)) instanceof TileNodeLinker) { - TileNodeLinker tile = (TileNodeLinker) this.worldObj.getTileEntity(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)); - tile.linkCoord = new Coord3D(xCoord, yCoord, zCoord); - paramItemStack.getTagCompound().removeTag("linkCoordX"); - paramItemStack.getTagCompound().removeTag("linkCoordY"); - paramItemStack.getTagCompound().removeTag("linkCoordZ"); - if (paramWorld.isRemote) - paramEntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkEstabilished"))); + if (paramItemStack.getTagCompound().hasKey("linkCoordX")) { + float x = paramItemStack.getTagCompound().getFloat("linkCoordX"); + float y = paramItemStack.getTagCompound().getFloat("linkCoordY"); + float z = paramItemStack.getTagCompound().getFloat("linkCoordZ"); + if (this.worldObj.getTileEntity( + MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)) + instanceof TileNodeLinker) { + TileNodeLinker tile = (TileNodeLinker) this.worldObj.getTileEntity( + MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)); + tile.linkCoord = new Coord3D(xCoord, yCoord, zCoord); + paramItemStack.getTagCompound().removeTag("linkCoordX"); + paramItemStack.getTagCompound().removeTag("linkCoordY"); + paramItemStack.getTagCompound().removeTag("linkCoordZ"); + if (paramWorld.isRemote) + paramEntityPlayer.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkEstabilished"))); - return paramItemStack; - } - } + return paramItemStack; + } + } - paramItemStack.getTagCompound().setFloat("linkCoordX", xCoord); - paramItemStack.getTagCompound().setFloat("linkCoordY", yCoord); - paramItemStack.getTagCompound().setFloat("linkCoordZ", zCoord); - if(paramWorld.isRemote) - paramEntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkStarted"))); - - return paramItemStack; - } + paramItemStack.getTagCompound().setFloat("linkCoordX", xCoord); + paramItemStack.getTagCompound().setFloat("linkCoordY", yCoord); + paramItemStack.getTagCompound().setFloat("linkCoordZ", zCoord); + if (paramWorld.isRemote) + paramEntityPlayer.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkStarted"))); - @Override - public void onUsingWandTick(ItemStack paramItemStack, - EntityPlayer paramEntityPlayer, int paramInt) { - // TODO Auto-generated method stub - - } + return paramItemStack; + } - @Override - public void onWandStoppedUsing(ItemStack paramItemStack, World paramWorld, - EntityPlayer paramEntityPlayer, int paramInt) { - // TODO Auto-generated method stub - - } + @Override + public void onUsingWandTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) { + // TODO Auto-generated method stub + + } + + @Override + public void onWandStoppedUsing( + ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/tb/common/tile/TileNodeManipulator.java b/src/main/java/tb/common/tile/TileNodeManipulator.java index dad7f59..72a057c 100644 --- a/src/main/java/tb/common/tile/TileNodeManipulator.java +++ b/src/main/java/tb/common/tile/TileNodeManipulator.java @@ -1,8 +1,12 @@ package tb.common.tile; -import java.util.Hashtable; - import DummyCore.Utils.MiscUtils; +import java.util.Hashtable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.nodes.INode; import thaumcraft.api.nodes.NodeModifier; @@ -10,360 +14,323 @@ import thaumcraft.api.nodes.NodeType; import thaumcraft.api.wands.IWandable; import thaumcraft.common.Thaumcraft; import thaumcraft.common.entities.EntityAspectOrb; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -public class TileNodeManipulator extends TileEntity implements IWandable -{ - public int workTime = 0; - public Hashtable nodeAspects = new Hashtable(); - public Hashtable newNodeAspects = new Hashtable(); - public boolean firstTick = true; - - public void updateEntity() - { - INode node = getNode(); - - if(node == null) - return; - - newNodeAspects.clear(); - for(int i = 0; i < node.getAspects().size(); ++i) - { - newNodeAspects.put(node.getAspects().getAspects()[i].getTag(), node.getAspects().getAmount(node.getAspects().getAspects()[i])); - } - - if(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0 || getNode() == null) - workTime = 0; - - if(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != 0 && getNode() != null) - { - int color = 0xffffff; - int effect = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord)-1; - - switch(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord)-1) - { - case 0: - { - color = 0xffffff; - break; - } - case 1: - { - color = 0x4e4756; - break; - } - case 2: - { - color = 0xd2d200; - break; - } - case 3: - { - color = 0xaf7c23; - break; - } - case 4: - { - color = 0x0b4d42; - break; - } - case 5: - { - color = 0xccc8f7; - break; - } - case 6: - { - color = 0x643c5b; - break; - } - case 7: - { - color = 0xeaeaea; - break; - } - case 8: - { - color = 0xd0e0f8; - break; - } - case 9: - { - color = 0x713496; - break; - } - } - if(!firstTick && this.worldObj.isRemote) - Thaumcraft.proxy.beam(this.worldObj, xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, xCoord+0.5D, yCoord-0.5D, zCoord+0.5D, 2, color, false, 0.5F, 2); - - if(!firstTick) - { - if(effect == 7) - { - if(!this.worldObj.isRemote) - { - boolean isNodeChanged = false; - for(int i = 0; i < node.getAspects().size(); ++i) - { - Aspect a = node.getAspects().getAspects()[i]; - int max = node.getNodeVisBase(a); - int current = node.getAspects().getAmount(a); - - if(current < max && this.worldObj.rand.nextFloat() < 0.01F) - { - node.getAspects().add(a, 1); - isNodeChanged = true; - } - } - if(isNodeChanged) - { - MiscUtils.sendPacketToAllAround(worldObj, this.worldObj.getTileEntity(xCoord, yCoord-1, zCoord).getDescriptionPacket(), xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId, 6); - } - } - } - if(effect == 1) - { - int maxTimeRequired = node.getNodeModifier() == NodeModifier.BRIGHT ? 1*60*20 : node.getNodeModifier() == NodeModifier.PALE ? 3*60*20 : node.getNodeModifier() == NodeModifier.FADING ? 6*60*20 : 2*60*20; - if(workTime >= maxTimeRequired) - { - workTime = 0; - if(node.getNodeModifier() == NodeModifier.FADING) - { - this.worldObj.setBlockToAir(xCoord, yCoord, zCoord); - return; - } - node.setNodeModifier(node.getNodeModifier() == NodeModifier.BRIGHT ? null : node.getNodeModifier() == NodeModifier.PALE ? NodeModifier.FADING : node.getNodeModifier() == NodeModifier.FADING ? NodeModifier.FADING : NodeModifier.PALE); - - }else - { - ++workTime; - if(this.worldObj.getWorldTime() % 10 == 0) - { - Aspect a = node.getAspects().getAspects()[this.worldObj.rand.nextInt(node.getAspects().getAspects().length)]; - EntityAspectOrb aspect = new EntityAspectOrb(worldObj, xCoord+0.5D, yCoord-0.5D, zCoord+0.5D, a, 1); - if(!this.worldObj.isRemote) - { - this.worldObj.spawnEntityInWorld(aspect); - } - } - } - } - if(effect == 2) - { - for(int i = 0; i < node.getAspects().size(); ++i) - { - Aspect a = node.getAspects().getAspects()[i]; - int current = node.getAspects().getAmount(a); - if(nodeAspects.containsKey(a.getTag())) - { - int prev = nodeAspects.get(a.getTag()); - - if(current < prev && this.worldObj.rand.nextFloat() < 0.5F) - { - node.getAspects().add(a, 1); - } - } - } - } - if(effect == 3) - { - if(node.getNodeType() == NodeType.NORMAL) - { - if(workTime > 5*60*20) - { - workTime = 0; - node.setNodeType(NodeType.HUNGRY); - }else - { - ++workTime; - } - } - } - if(effect == 4) - { - if(node.getNodeType() == NodeType.NORMAL) - { - if(workTime > 7*60*20) - { - workTime = 0; - node.setNodeType(NodeType.UNSTABLE); - }else - { - ++workTime; - } - } - } - if(effect == 5) - { - if(node.getNodeType() == NodeType.NORMAL) { - if(workTime > 3*60*20){ - workTime = 0; - node.setNodeType(NodeType.PURE); - } - else ++workTime; - } - else if(node.getNodeType() == NodeType.TAINTED) { - if(workTime > 33*60*20){ - workTime = 0; - node.setNodeType(NodeType.PURE); - } - else ++workTime; - } - } - if(effect == 6) - { - if(node.getNodeType() == NodeType.NORMAL) - { - if(workTime > 6*60*20) - { - workTime = 0; - node.setNodeType(NodeType.DARK); - }else - { - ++workTime; - } - } - } - if(effect == 8) - { - int maxTimeRequired = 0; - - if(node.getNodeModifier() == NodeModifier.FADING) - { - maxTimeRequired = 5*60*20; - } - - if(node.getNodeModifier() == NodeModifier.PALE) - { - maxTimeRequired = 10*60*20; - } - - if(node.getNodeType() == NodeType.DARK) - { - maxTimeRequired = 2*60*20; - } - - if(node.getNodeType() == NodeType.HUNGRY) - { - maxTimeRequired = 30*20; - } - - if(node.getNodeType() == NodeType.UNSTABLE) - { - maxTimeRequired = 7*60*20; - } - - if(node.getNodeType() == NodeType.TAINTED || node.getNodeType() == NodeType.PURE) - { - maxTimeRequired = 30*60*20; - } - - if(workTime >= maxTimeRequired) - { - workTime = 0; - if(node.getNodeModifier() == NodeModifier.FADING) - { - node.setNodeModifier(NodeModifier.PALE); - return; - } - - if(node.getNodeModifier() == NodeModifier.PALE) - { - node.setNodeModifier(null); - return; - } - - if(node.getNodeType() == NodeType.DARK || node.getNodeType() == NodeType.HUNGRY || node.getNodeType() == NodeType.UNSTABLE || node.getNodeType() == NodeType.TAINTED || node.getNodeType() == NodeType.PURE) - { - node.setNodeType(NodeType.NORMAL); - return; - } - - }else - { - ++workTime; - } - } - if(effect == 0) - { - if(node.getNodeModifier() == null) - { - if(workTime > 20*60*20) - { - workTime = 0; - node.setNodeModifier(NodeModifier.BRIGHT); - }else - { - ++workTime; - } - } - } - if(effect == 9) - { - if(node.getNodeType() == NodeType.NORMAL) - { - if(workTime > 6*60*20) - { - workTime = 0; - node.setNodeType(NodeType.TAINTED); - }else - { - ++workTime; - } - } - } - } - } - - firstTick = false; - - nodeAspects.clear(); - for(int i = 0; i < node.getAspects().size(); ++i) - { - nodeAspects.put(node.getAspects().getAspects()[i].getTag(), node.getAspects().getAmount(node.getAspects().getAspects()[i])); - } - } - - public INode getNode() - { - if(this.worldObj.getTileEntity(xCoord, yCoord-1, zCoord) instanceof INode) - return INode.class.cast(worldObj.getTileEntity(xCoord, yCoord-1, zCoord)); - - return null; - } - - public void readFromNBT(NBTTagCompound tag) - { +public class TileNodeManipulator extends TileEntity implements IWandable { + public int workTime = 0; + public Hashtable nodeAspects = new Hashtable(); + public Hashtable newNodeAspects = new Hashtable(); + public boolean firstTick = true; + + public void updateEntity() { + INode node = getNode(); + + if (node == null) return; + + newNodeAspects.clear(); + for (int i = 0; i < node.getAspects().size(); ++i) { + newNodeAspects.put( + node.getAspects().getAspects()[i].getTag(), + node.getAspects().getAmount(node.getAspects().getAspects()[i])); + } + + if (this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0 || getNode() == null) workTime = 0; + + if (this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != 0 && getNode() != null) { + int color = 0xffffff; + int effect = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) - 1; + + switch (this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) - 1) { + case 0: { + color = 0xffffff; + break; + } + case 1: { + color = 0x4e4756; + break; + } + case 2: { + color = 0xd2d200; + break; + } + case 3: { + color = 0xaf7c23; + break; + } + case 4: { + color = 0x0b4d42; + break; + } + case 5: { + color = 0xccc8f7; + break; + } + case 6: { + color = 0x643c5b; + break; + } + case 7: { + color = 0xeaeaea; + break; + } + case 8: { + color = 0xd0e0f8; + break; + } + case 9: { + color = 0x713496; + break; + } + } + if (!firstTick && this.worldObj.isRemote) + Thaumcraft.proxy.beam( + this.worldObj, + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + xCoord + 0.5D, + yCoord - 0.5D, + zCoord + 0.5D, + 2, + color, + false, + 0.5F, + 2); + + if (!firstTick) { + if (effect == 7) { + if (!this.worldObj.isRemote) { + boolean isNodeChanged = false; + for (int i = 0; i < node.getAspects().size(); ++i) { + Aspect a = node.getAspects().getAspects()[i]; + int max = node.getNodeVisBase(a); + int current = node.getAspects().getAmount(a); + + if (current < max && this.worldObj.rand.nextFloat() < 0.01F) { + node.getAspects().add(a, 1); + isNodeChanged = true; + } + } + if (isNodeChanged) { + MiscUtils.sendPacketToAllAround( + worldObj, + this.worldObj + .getTileEntity(xCoord, yCoord - 1, zCoord) + .getDescriptionPacket(), + xCoord, + yCoord, + zCoord, + this.worldObj.provider.dimensionId, + 6); + } + } + } + if (effect == 1) { + int maxTimeRequired = node.getNodeModifier() == NodeModifier.BRIGHT + ? 1 * 60 * 20 + : node.getNodeModifier() == NodeModifier.PALE + ? 3 * 60 * 20 + : node.getNodeModifier() == NodeModifier.FADING ? 6 * 60 * 20 : 2 * 60 * 20; + if (workTime >= maxTimeRequired) { + workTime = 0; + if (node.getNodeModifier() == NodeModifier.FADING) { + this.worldObj.setBlockToAir(xCoord, yCoord, zCoord); + return; + } + node.setNodeModifier( + node.getNodeModifier() == NodeModifier.BRIGHT + ? null + : node.getNodeModifier() == NodeModifier.PALE + ? NodeModifier.FADING + : node.getNodeModifier() == NodeModifier.FADING + ? NodeModifier.FADING + : NodeModifier.PALE); + + } else { + ++workTime; + if (this.worldObj.getWorldTime() % 10 == 0) { + Aspect a = node.getAspects() + .getAspects()[ + this.worldObj.rand.nextInt(node.getAspects().getAspects().length)]; + EntityAspectOrb aspect = + new EntityAspectOrb(worldObj, xCoord + 0.5D, yCoord - 0.5D, zCoord + 0.5D, a, 1); + if (!this.worldObj.isRemote) { + this.worldObj.spawnEntityInWorld(aspect); + } + } + } + } + if (effect == 2) { + for (int i = 0; i < node.getAspects().size(); ++i) { + Aspect a = node.getAspects().getAspects()[i]; + int current = node.getAspects().getAmount(a); + if (nodeAspects.containsKey(a.getTag())) { + int prev = nodeAspects.get(a.getTag()); + + if (current < prev && this.worldObj.rand.nextFloat() < 0.5F) { + node.getAspects().add(a, 1); + } + } + } + } + if (effect == 3) { + if (node.getNodeType() == NodeType.NORMAL) { + if (workTime > 5 * 60 * 20) { + workTime = 0; + node.setNodeType(NodeType.HUNGRY); + } else { + ++workTime; + } + } + } + if (effect == 4) { + if (node.getNodeType() == NodeType.NORMAL) { + if (workTime > 7 * 60 * 20) { + workTime = 0; + node.setNodeType(NodeType.UNSTABLE); + } else { + ++workTime; + } + } + } + if (effect == 5) { + if (node.getNodeType() == NodeType.NORMAL) { + if (workTime > 3 * 60 * 20) { + workTime = 0; + node.setNodeType(NodeType.PURE); + } else ++workTime; + } else if (node.getNodeType() == NodeType.TAINTED) { + if (workTime > 33 * 60 * 20) { + workTime = 0; + node.setNodeType(NodeType.PURE); + } else ++workTime; + } + } + if (effect == 6) { + if (node.getNodeType() == NodeType.NORMAL) { + if (workTime > 6 * 60 * 20) { + workTime = 0; + node.setNodeType(NodeType.DARK); + } else { + ++workTime; + } + } + } + if (effect == 8) { + int maxTimeRequired = 0; + + if (node.getNodeModifier() == NodeModifier.FADING) { + maxTimeRequired = 5 * 60 * 20; + } + + if (node.getNodeModifier() == NodeModifier.PALE) { + maxTimeRequired = 10 * 60 * 20; + } + + if (node.getNodeType() == NodeType.DARK) { + maxTimeRequired = 2 * 60 * 20; + } + + if (node.getNodeType() == NodeType.HUNGRY) { + maxTimeRequired = 30 * 20; + } + + if (node.getNodeType() == NodeType.UNSTABLE) { + maxTimeRequired = 7 * 60 * 20; + } + + if (node.getNodeType() == NodeType.TAINTED || node.getNodeType() == NodeType.PURE) { + maxTimeRequired = 30 * 60 * 20; + } + + if (workTime >= maxTimeRequired) { + workTime = 0; + if (node.getNodeModifier() == NodeModifier.FADING) { + node.setNodeModifier(NodeModifier.PALE); + return; + } + + if (node.getNodeModifier() == NodeModifier.PALE) { + node.setNodeModifier(null); + return; + } + + if (node.getNodeType() == NodeType.DARK + || node.getNodeType() == NodeType.HUNGRY + || node.getNodeType() == NodeType.UNSTABLE + || node.getNodeType() == NodeType.TAINTED + || node.getNodeType() == NodeType.PURE) { + node.setNodeType(NodeType.NORMAL); + return; + } + + } else { + ++workTime; + } + } + if (effect == 0) { + if (node.getNodeModifier() == null) { + if (workTime > 20 * 60 * 20) { + workTime = 0; + node.setNodeModifier(NodeModifier.BRIGHT); + } else { + ++workTime; + } + } + } + if (effect == 9) { + if (node.getNodeType() == NodeType.NORMAL) { + if (workTime > 6 * 60 * 20) { + workTime = 0; + node.setNodeType(NodeType.TAINTED); + } else { + ++workTime; + } + } + } + } + } + + firstTick = false; + + nodeAspects.clear(); + for (int i = 0; i < node.getAspects().size(); ++i) { + nodeAspects.put( + node.getAspects().getAspects()[i].getTag(), + node.getAspects().getAmount(node.getAspects().getAspects()[i])); + } + } + + public INode getNode() { + if (this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) instanceof INode) + return INode.class.cast(worldObj.getTileEntity(xCoord, yCoord - 1, zCoord)); + + return null; + } + + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); workTime = tag.getInteger("workTime"); } - - public void writeToNBT(NBTTagCompound tag) - { + + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setInteger("workTime", workTime); } - @Override - public int onWandRightClick(World world, ItemStack wandstack,EntityPlayer player, int x, int y, int z, int side, int md) { - return 0; - } + @Override + public int onWandRightClick( + World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) { + return 0; + } - @Override - public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player) { - return wandstack; - } + @Override + public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player) { + return wandstack; + } - @Override - public void onUsingWandTick(ItemStack wandstack, EntityPlayer player,int count) { - } - - @Override - public void onWandStoppedUsing(ItemStack wandstack, World world,EntityPlayer player, int count) { - } + @Override + public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) {} + @Override + public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) {} } diff --git a/src/main/java/tb/common/tile/TileOverchanter.java b/src/main/java/tb/common/tile/TileOverchanter.java index bc8e53e..84e7fe2 100644 --- a/src/main/java/tb/common/tile/TileOverchanter.java +++ b/src/main/java/tb/common/tile/TileOverchanter.java @@ -1,17 +1,11 @@ package tb.common.tile; +import DummyCore.Utils.MathUtils; +import DummyCore.Utils.MiscUtils; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Set; - -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.wands.IWandable; -import thaumcraft.common.lib.events.EssentiaHandler; -import DummyCore.Utils.Coord3D; -import DummyCore.Utils.Lightning; -import DummyCore.Utils.MathUtils; -import DummyCore.Utils.MiscUtils; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -25,176 +19,159 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.wands.IWandable; +import thaumcraft.common.lib.events.EssentiaHandler; -public class TileOverchanter extends TileEntity implements IInventory, IWandable{ +public class TileOverchanter extends TileEntity implements IInventory, IWandable { - public ItemStack inventory; - - public int enchantingTime; - public boolean xpAbsorbed; - public boolean isEnchantingStarted; - public int syncTimer; - - //public Lightning renderedLightning; - - @Override - public int getSizeInventory() { - return 1; - } - - @Override - @SuppressWarnings("unchecked") - public void updateEntity() - { - if (!worldObj.isRemote) - { - if (syncTimer <= 0) - { - syncTimer = 100; - NBTTagCompound tg = new NBTTagCompound(); - tg.setInteger("0", enchantingTime); - tg.setBoolean("1", xpAbsorbed); - tg.setBoolean("2", isEnchantingStarted); - tg.setInteger("x", xCoord); - tg.setInteger("y", yCoord); - tg.setInteger("z", zCoord); - MiscUtils.syncTileEntity(tg, 0); - } else - --syncTimer; - } - - if(this.inventory == null) - { - isEnchantingStarted = false; - xpAbsorbed = false; - enchantingTime = 0; - //renderedLightning = null; - }else - { - if(this.isEnchantingStarted) - { - if(this.worldObj.getWorldTime() % 20 == 0) - { - //renderedLightning = new Lightning(this.worldObj.rand, new Coord3D(0,0,0), new Coord3D(MathUtils.randomDouble(this.worldObj.rand)/50,MathUtils.randomDouble(this.worldObj.rand)/50,MathUtils.randomDouble(this.worldObj.rand)/50), 0.3F, 1,0,1); - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "thaumcraft:infuserstart", 1F, 1.0F); - if(EssentiaHandler.drainEssentia(this, Aspect.MAGIC, ForgeDirection.UNKNOWN, 8, false)) - { - ++enchantingTime; - if(enchantingTime >= 16 && !this.xpAbsorbed) - { - List players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1).expand(6, 3, 6)); - if(!players.isEmpty()) - { - for(int i = 0; i < players.size(); ++i) - { - EntityPlayer p = players.get(i); - if(p.experienceLevel >= 30) - { - p.attackEntityFrom(DamageSource.magic, 8); - this.worldObj.playSoundEffect(p.posX,p.posY,p.posZ, "thaumcraft:zap", 1F, 1.0F); - p.experienceLevel -= 30; - xpAbsorbed = true; - break; - } - } - } - } - - if(xpAbsorbed && enchantingTime >= 32) - { - int enchId = this.findEnchantment(inventory); - NBTTagList nbttaglist = this.inventory.getEnchantmentTagList(); - for(int i = 0; i < nbttaglist.tagCount(); ++i) - { - NBTTagCompound tag = nbttaglist.getCompoundTagAt(i); - if(tag != null && Integer.valueOf(tag.getShort("id"))==enchId) - { - tag.setShort("lvl", (short) (Integer.valueOf(tag.getShort("lvl"))+1)); - NBTTagCompound stackTag = MiscUtils.getStackTag(inventory); - if(!stackTag.hasKey("overchants")) - { - stackTag.setIntArray("overchants", new int[]{enchId}); - }else - { - int[] arrayInt = stackTag.getIntArray("overchants"); - int[] newArrayInt = new int[arrayInt.length+1]; - for(int j = 0; j < arrayInt.length; ++j) - { - newArrayInt[j] = arrayInt[j]; - } - newArrayInt[newArrayInt.length-1]=enchId; - - stackTag.setIntArray("overchants", newArrayInt); - } - break; - } - } - isEnchantingStarted = false; - xpAbsorbed = false; - enchantingTime = 0; - //renderedLightning = null; - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "thaumcraft:wand", 1F, 1F); - } - - }else - { - --enchantingTime; - } - } - } - } - } - - public boolean canStartEnchanting() - { - if(!this.isEnchantingStarted) - if(this.inventory != null) - { - if(this.inventory.getEnchantmentTagList() != null && this.inventory.getEnchantmentTagList().tagCount() > 0) - { - if(findEnchantment(inventory) != -1) - { - return true; - } - } - } - return false; - } - - @SuppressWarnings("unchecked") - public int findEnchantment(ItemStack enchanted) - { - NBTTagCompound stackTag = MiscUtils.getStackTag(inventory); - LinkedHashMap ench = (LinkedHashMap) EnchantmentHelper.getEnchantments(enchanted); - Set keys = ench.keySet(); - Iterator $i = keys.iterator(); - - while($i.hasNext()) - { - int i = $i.next(); - if(!stackTag.hasKey("overchants")) - { - return i; - }else - { - int[] overchants = stackTag.getIntArray("overchants"); - if(MathUtils.arrayContains(overchants, i)) - continue; - - return i; - } - } - - return -1; - } - - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) - { - enchantingTime = pkt.func_148857_g().getInteger("0"); - xpAbsorbed = pkt.func_148857_g().getBoolean("1"); - isEnchantingStarted = pkt.func_148857_g().getBoolean("2"); + public ItemStack inventory; + + public int enchantingTime; + public boolean xpAbsorbed; + public boolean isEnchantingStarted; + public int syncTimer; + + // public Lightning renderedLightning; + + @Override + public int getSizeInventory() { + return 1; } - + + @Override + @SuppressWarnings("unchecked") + public void updateEntity() { + if (!worldObj.isRemote) { + if (syncTimer <= 0) { + syncTimer = 100; + NBTTagCompound tg = new NBTTagCompound(); + tg.setInteger("0", enchantingTime); + tg.setBoolean("1", xpAbsorbed); + tg.setBoolean("2", isEnchantingStarted); + tg.setInteger("x", xCoord); + tg.setInteger("y", yCoord); + tg.setInteger("z", zCoord); + MiscUtils.syncTileEntity(tg, 0); + } else --syncTimer; + } + + if (this.inventory == null) { + isEnchantingStarted = false; + xpAbsorbed = false; + enchantingTime = 0; + // renderedLightning = null; + } else { + if (this.isEnchantingStarted) { + if (this.worldObj.getWorldTime() % 20 == 0) { + // renderedLightning = new Lightning(this.worldObj.rand, new Coord3D(0,0,0), new + // Coord3D(MathUtils.randomDouble(this.worldObj.rand)/50,MathUtils.randomDouble(this.worldObj.rand)/50,MathUtils.randomDouble(this.worldObj.rand)/50), 0.3F, 1,0,1); + this.worldObj.playSoundEffect( + this.xCoord, this.yCoord, this.zCoord, "thaumcraft:infuserstart", 1F, 1.0F); + if (EssentiaHandler.drainEssentia(this, Aspect.MAGIC, ForgeDirection.UNKNOWN, 8, false)) { + ++enchantingTime; + if (enchantingTime >= 16 && !this.xpAbsorbed) { + List players = this.worldObj.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox( + xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1) + .expand(6, 3, 6)); + if (!players.isEmpty()) { + for (int i = 0; i < players.size(); ++i) { + EntityPlayer p = players.get(i); + if (p.experienceLevel >= 30) { + p.attackEntityFrom(DamageSource.magic, 8); + this.worldObj.playSoundEffect( + p.posX, p.posY, p.posZ, "thaumcraft:zap", 1F, 1.0F); + p.experienceLevel -= 30; + xpAbsorbed = true; + break; + } + } + } + } + + if (xpAbsorbed && enchantingTime >= 32) { + int enchId = this.findEnchantment(inventory); + NBTTagList nbttaglist = this.inventory.getEnchantmentTagList(); + for (int i = 0; i < nbttaglist.tagCount(); ++i) { + NBTTagCompound tag = nbttaglist.getCompoundTagAt(i); + if (tag != null && Integer.valueOf(tag.getShort("id")) == enchId) { + tag.setShort("lvl", (short) (Integer.valueOf(tag.getShort("lvl")) + 1)); + NBTTagCompound stackTag = MiscUtils.getStackTag(inventory); + if (!stackTag.hasKey("overchants")) { + stackTag.setIntArray("overchants", new int[] {enchId}); + } else { + int[] arrayInt = stackTag.getIntArray("overchants"); + int[] newArrayInt = new int[arrayInt.length + 1]; + for (int j = 0; j < arrayInt.length; ++j) { + newArrayInt[j] = arrayInt[j]; + } + newArrayInt[newArrayInt.length - 1] = enchId; + + stackTag.setIntArray("overchants", newArrayInt); + } + break; + } + } + isEnchantingStarted = false; + xpAbsorbed = false; + enchantingTime = 0; + // renderedLightning = null; + this.worldObj.playSoundEffect( + this.xCoord, this.yCoord, this.zCoord, "thaumcraft:wand", 1F, 1F); + } + + } else { + --enchantingTime; + } + } + } + } + } + + public boolean canStartEnchanting() { + if (!this.isEnchantingStarted) + if (this.inventory != null) { + if (this.inventory.getEnchantmentTagList() != null + && this.inventory.getEnchantmentTagList().tagCount() > 0) { + if (findEnchantment(inventory) != -1) { + return true; + } + } + } + return false; + } + + @SuppressWarnings("unchecked") + public int findEnchantment(ItemStack enchanted) { + NBTTagCompound stackTag = MiscUtils.getStackTag(inventory); + LinkedHashMap ench = + (LinkedHashMap) EnchantmentHelper.getEnchantments(enchanted); + Set keys = ench.keySet(); + Iterator $i = keys.iterator(); + + while ($i.hasNext()) { + int i = $i.next(); + if (!stackTag.hasKey("overchants")) { + return i; + } else { + int[] overchants = stackTag.getIntArray("overchants"); + if (MathUtils.arrayContains(overchants, i)) continue; + + return i; + } + } + + return -1; + } + + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + enchantingTime = pkt.func_148857_g().getInteger("0"); + xpAbsorbed = pkt.func_148857_g().getBoolean("1"); + isEnchantingStarted = pkt.func_148857_g().getBoolean("2"); + } + @Override public void markDirty() { super.markDirty(); @@ -203,173 +180,147 @@ public class TileOverchanter extends TileEntity implements IInventory, IWandable worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } - - - @Override - public ItemStack getStackInSlot(int slot) { - return inventory; - } + @Override + public ItemStack getStackInSlot(int slot) { + return inventory; + } - @Override - public ItemStack decrStackSize(int slot, int num) { - if (this.inventory != null) - { + @Override + public ItemStack decrStackSize(int slot, int num) { + if (this.inventory != null) { ItemStack itemstack; - if (this.inventory.stackSize <= num) - { + if (this.inventory.stackSize <= num) { itemstack = this.inventory; this.inventory = null; this.markDirty(); return itemstack; - } - else - { + } else { itemstack = this.inventory.splitStack(num); - if (this.inventory.stackSize == 0) - { + if (this.inventory.stackSize == 0) { this.inventory = null; } this.markDirty(); return itemstack; } - } - else - { + } else { return null; } - } - /* - @Override - public ItemStack decrStackSize(int i, int j) { - if (inventory != null) { - ItemStack stackAt; + } + /* + @Override + public ItemStack decrStackSize(int i, int j) { + if (inventory != null) { + ItemStack stackAt; - if (inventory.stackSize <= j) { - stackAt = inventory; - inventory = null; - return stackAt; - } else { - stackAt = inventory.splitStack(j); + if (inventory.stackSize <= j) { + stackAt = inventory; + inventory = null; + return stackAt; + } else { + stackAt = inventory.splitStack(j); - if (inventory.stackSize == 0) - inventory = null; + if (inventory.stackSize == 0) + inventory = null; - return stackAt; - } - } + return stackAt; + } + } - return null; - }*/ + return null; + }*/ - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return inventory; - } + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inventory; + } - @Override - public void setInventorySlotContents(int slot, ItemStack stk) { - inventory = stk; - } + @Override + public void setInventorySlotContents(int slot, ItemStack stk) { + inventory = stk; + } - @Override - public String getInventoryName() { - return "tb.overchanter"; - } + @Override + public String getInventoryName() { + return "tb.overchanter"; + } - @Override - public boolean hasCustomInventoryName() { - return false; - } + @Override + public boolean hasCustomInventoryName() { + return false; + } - @Override - public int getInventoryStackLimit() { - return 1; - } + @Override + public int getInventoryStackLimit() { + return 1; + } - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return player.dimension == this.worldObj.provider.dimensionId && this.worldObj.blockExists(xCoord, yCoord, zCoord); - } + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + return player.dimension == this.worldObj.provider.dimensionId + && this.worldObj.blockExists(xCoord, yCoord, zCoord); + } - @Override - public void openInventory() { - } + @Override + public void openInventory() {} - @Override - public void closeInventory() { - - } + @Override + public void closeInventory() {} - @Override - public boolean isItemValidForSlot(int slot, ItemStack stk) { - //return stk.hasTagCompound() && stk.getEnchantmentTagList() != null; - return false; - } - - public void readFromNBT(NBTTagCompound tag) - { + @Override + public boolean isItemValidForSlot(int slot, ItemStack stk) { + // return stk.hasTagCompound() && stk.getEnchantmentTagList() != null; + return false; + } + + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); - + enchantingTime = tag.getInteger("enchTime"); xpAbsorbed = tag.getBoolean("xpAbsorbed"); isEnchantingStarted = tag.getBoolean("enchStarted"); - - if(tag.hasKey("itm")) - inventory = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("itm")); + + if (tag.hasKey("itm")) inventory = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("itm")); } - - public void writeToNBT(NBTTagCompound tag) - { + + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); - + tag.setInteger("enchTime", enchantingTime); - tag.setBoolean("xpAbsorbed",xpAbsorbed); + tag.setBoolean("xpAbsorbed", xpAbsorbed); tag.setBoolean("enchStarted", isEnchantingStarted); - - if(inventory != null) - { - NBTTagCompound t = new NBTTagCompound(); - inventory.writeToNBT(t); - tag.setTag("itm", t); + + if (inventory != null) { + NBTTagCompound t = new NBTTagCompound(); + inventory.writeToNBT(t); + tag.setTag("itm", t); } } - - @Override - public int onWandRightClick(World world, ItemStack wandstack,EntityPlayer player, int x, int y, int z, int side, int md) - { - if(canStartEnchanting()) - { - isEnchantingStarted = true; - player.swingItem(); - syncTimer = 0; - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "thaumcraft:craftstart", 0.5F, 1.0F); - return 1; - } - return -1; - } + @Override + public int onWandRightClick( + World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) { + if (canStartEnchanting()) { + isEnchantingStarted = true; + player.swingItem(); + syncTimer = 0; + this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "thaumcraft:craftstart", 0.5F, 1.0F); + return 1; + } + return -1; + } - @Override - public ItemStack onWandRightClick(World world, ItemStack wandstack,EntityPlayer player) - { - return wandstack; - } - - @Override - public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) { - - } - - @Override - public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) { - - } - - + @Override + public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player) { + return wandstack; + } + @Override + public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) {} + @Override + public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) {} } diff --git a/src/main/java/tb/common/tile/TileRelocator.java b/src/main/java/tb/common/tile/TileRelocator.java index 5462782..a490ea5 100644 --- a/src/main/java/tb/common/tile/TileRelocator.java +++ b/src/main/java/tb/common/tile/TileRelocator.java @@ -1,7 +1,6 @@ package tb.common.tile; import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -12,165 +11,167 @@ import net.minecraftforge.common.util.ForgeDirection; import tb.common.block.BlockRelocator; import thaumcraft.api.wands.IWandable; -public class TileRelocator extends TileEntity implements IWandable{ +public class TileRelocator extends TileEntity implements IWandable { - public boolean firstTick = true; - public int checkCount = 0; - public int power; - - @SuppressWarnings("unchecked") - public void updateEntity() - { - ForgeDirection orientation = ForgeDirection.values()[this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord)%6]; - ForgeDirection opposite = orientation.getOpposite(); - - if(firstTick || checkCount % 100 == 0) - { - power = 0; - firstTick = false; - int cont = 0; - while(worldObj.getBlock(xCoord+opposite.offsetX*cont, yCoord+opposite.offsetY*cont, zCoord+opposite.offsetZ*cont) instanceof BlockRelocator) - { - ++cont; - } - - int cnt = 1; - - while(cnt <= cont*10 && (worldObj.isAirBlock(xCoord+orientation.offsetX*cnt, yCoord+orientation.offsetY*cnt, zCoord+orientation.offsetZ*cnt) || !worldObj.getBlock(xCoord+orientation.offsetX*cnt, yCoord+orientation.offsetY*cnt, zCoord+orientation.offsetZ*cnt).isNormalCube(worldObj, xCoord+orientation.offsetX*cnt, yCoord+orientation.offsetY*cnt, zCoord+orientation.offsetZ*cnt))) - { - - ++power; - ++cnt; - } - - - } - - if(!isBlockPowered()) - { - if(!this.worldObj.getBlock(xCoord+orientation.offsetX, yCoord+orientation.offsetY, zCoord+orientation.offsetZ).isSideSolid(worldObj, xCoord, yCoord, zCoord, opposite)) - { - int meta = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord)%6; - boolean attract = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) > 5; - AxisAlignedBB aabb = null; - if(meta == 0) - aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord-power, zCoord, xCoord+1, yCoord+1, zCoord+1); - if(meta == 1) - aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1+power, zCoord+1); - if(meta == 2) - aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord-power, xCoord+1, yCoord+1, zCoord+1); - if(meta == 3) - aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1+power); - if(meta == 4) - aabb = AxisAlignedBB.getBoundingBox(xCoord-power, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1); - if(meta == 5) - aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1+power, yCoord+1, zCoord+1); - - List affected = this.worldObj.getEntitiesWithinAABB(Entity.class, aabb); - - for(Entity base : affected) - { - boolean invert = attract ? !base.isSneaking() : base.isSneaking(); - if(invert) - { - if(meta == 0) - { - base.motionY += 0.1D; - } - if(meta == 1) - { - base.motionY -= 0.1D; - base.fallDistance = 0; - } - if(meta == 2) - { - base.motionZ += 0.1D; - } - if(meta == 3) - { - base.motionZ -= 0.1D; - } - if(meta == 4) - { - base.motionX += 0.1D; - } - if(meta == 5) - { - base.motionX -= 0.1D; - } - }else - { - if(meta == 0) - { - base.motionY -= 0.1D; - base.fallDistance = 0; - } - if(meta == 1) - { - base.motionY += 0.1D; - } - if(meta == 2) - { - base.motionZ -= 0.1D; - } - if(meta == 3) - { - base.motionZ += 0.1D; - } - if(meta == 4) - { - base.motionX -= 0.1D; - } - if(meta == 5) - { - base.motionX += 0.1D; - } - } - } - } - } - - ++checkCount; - } - - @Override - public int onWandRightClick(World paramWorld, ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt1, int paramInt2,int paramInt3, int paramInt4, int paramInt5) - { - paramEntityPlayer.swingItem(); - paramWorld.playSound(xCoord, yCoord, zCoord, "thaumcraft:cameraticks", 1, 1, false); - if(!paramEntityPlayer.isSneaking()) - { - int meta = paramWorld.getBlockMetadata(xCoord, yCoord, zCoord) > 5 ? 6 : 0; - paramWorld.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta+paramInt4, 3); - }else - { - int meta = paramWorld.getBlockMetadata(xCoord, yCoord, zCoord) > 5 ? 6 : 0; - paramWorld.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta+ForgeDirection.OPPOSITES[paramInt4], 3); - } - return 0; - } + public boolean firstTick = true; + public int checkCount = 0; + public int power; - @Override - public ItemStack onWandRightClick(World paramWorld, ItemStack paramItemStack, EntityPlayer paramEntityPlayer) - { - return paramItemStack; - } + @SuppressWarnings("unchecked") + public void updateEntity() { + ForgeDirection orientation = + ForgeDirection.values()[this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) % 6]; + ForgeDirection opposite = orientation.getOpposite(); - @Override - public void onUsingWandTick(ItemStack paramItemStack,EntityPlayer paramEntityPlayer, int paramInt) - { - - } + if (firstTick || checkCount % 100 == 0) { + power = 0; + firstTick = false; + int cont = 0; + while (worldObj.getBlock( + xCoord + opposite.offsetX * cont, + yCoord + opposite.offsetY * cont, + zCoord + opposite.offsetZ * cont) + instanceof BlockRelocator) { + ++cont; + } - @Override - public void onWandStoppedUsing(ItemStack paramItemStack, World paramWorld,EntityPlayer paramEntityPlayer, int paramInt) - { - - } - - public boolean isBlockPowered() - { - return this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) || this.worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0; - } + int cnt = 1; + while (cnt <= cont * 10 + && (worldObj.isAirBlock( + xCoord + orientation.offsetX * cnt, + yCoord + orientation.offsetY * cnt, + zCoord + orientation.offsetZ * cnt) + || !worldObj.getBlock( + xCoord + orientation.offsetX * cnt, + yCoord + orientation.offsetY * cnt, + zCoord + orientation.offsetZ * cnt) + .isNormalCube( + worldObj, + xCoord + orientation.offsetX * cnt, + yCoord + orientation.offsetY * cnt, + zCoord + orientation.offsetZ * cnt))) { + + ++power; + ++cnt; + } + } + + if (!isBlockPowered()) { + if (!this.worldObj + .getBlock(xCoord + orientation.offsetX, yCoord + orientation.offsetY, zCoord + orientation.offsetZ) + .isSideSolid(worldObj, xCoord, yCoord, zCoord, opposite)) { + int meta = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) % 6; + boolean attract = this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord) > 5; + AxisAlignedBB aabb = null; + if (meta == 0) + aabb = AxisAlignedBB.getBoundingBox( + xCoord, yCoord - power, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + if (meta == 1) + aabb = AxisAlignedBB.getBoundingBox( + xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1 + power, zCoord + 1); + if (meta == 2) + aabb = AxisAlignedBB.getBoundingBox( + xCoord, yCoord, zCoord - power, xCoord + 1, yCoord + 1, zCoord + 1); + if (meta == 3) + aabb = AxisAlignedBB.getBoundingBox( + xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1 + power); + if (meta == 4) + aabb = AxisAlignedBB.getBoundingBox( + xCoord - power, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + if (meta == 5) + aabb = AxisAlignedBB.getBoundingBox( + xCoord, yCoord, zCoord, xCoord + 1 + power, yCoord + 1, zCoord + 1); + + List affected = this.worldObj.getEntitiesWithinAABB(Entity.class, aabb); + + for (Entity base : affected) { + boolean invert = attract ? !base.isSneaking() : base.isSneaking(); + if (invert) { + if (meta == 0) { + base.motionY += 0.1D; + } + if (meta == 1) { + base.motionY -= 0.1D; + base.fallDistance = 0; + } + if (meta == 2) { + base.motionZ += 0.1D; + } + if (meta == 3) { + base.motionZ -= 0.1D; + } + if (meta == 4) { + base.motionX += 0.1D; + } + if (meta == 5) { + base.motionX -= 0.1D; + } + } else { + if (meta == 0) { + base.motionY -= 0.1D; + base.fallDistance = 0; + } + if (meta == 1) { + base.motionY += 0.1D; + } + if (meta == 2) { + base.motionZ -= 0.1D; + } + if (meta == 3) { + base.motionZ += 0.1D; + } + if (meta == 4) { + base.motionX -= 0.1D; + } + if (meta == 5) { + base.motionX += 0.1D; + } + } + } + } + } + + ++checkCount; + } + + @Override + public int onWandRightClick( + World paramWorld, + ItemStack paramItemStack, + EntityPlayer paramEntityPlayer, + int paramInt1, + int paramInt2, + int paramInt3, + int paramInt4, + int paramInt5) { + paramEntityPlayer.swingItem(); + paramWorld.playSound(xCoord, yCoord, zCoord, "thaumcraft:cameraticks", 1, 1, false); + if (!paramEntityPlayer.isSneaking()) { + int meta = paramWorld.getBlockMetadata(xCoord, yCoord, zCoord) > 5 ? 6 : 0; + paramWorld.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta + paramInt4, 3); + } else { + int meta = paramWorld.getBlockMetadata(xCoord, yCoord, zCoord) > 5 ? 6 : 0; + paramWorld.setBlockMetadataWithNotify( + xCoord, yCoord, zCoord, meta + ForgeDirection.OPPOSITES[paramInt4], 3); + } + return 0; + } + + @Override + public ItemStack onWandRightClick(World paramWorld, ItemStack paramItemStack, EntityPlayer paramEntityPlayer) { + return paramItemStack; + } + + @Override + public void onUsingWandTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) {} + + @Override + public void onWandStoppedUsing( + ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt) {} + + public boolean isBlockPowered() { + return this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) + || this.worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0; + } } diff --git a/src/main/java/tb/core/TBCore.java b/src/main/java/tb/core/TBCore.java index 0ccecd9..838638e 100644 --- a/src/main/java/tb/core/TBCore.java +++ b/src/main/java/tb/core/TBCore.java @@ -1,10 +1,22 @@ package tb.core; +import static tb.core.TBCore.*; + +import DummyCore.Core.Core; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.ModMetadata; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.relauncher.Side; import java.io.IOException; import java.util.ArrayList; - import net.minecraftforge.common.MinecraftForge; -import DummyCore.Core.Core; import tb.api.RevolverUpgrade; import tb.common.enchantment.EnchantmentHandler; import tb.common.entity.EntityRevolverBullet; @@ -19,89 +31,75 @@ import tb.network.proxy.PacketTB; import tb.network.proxy.TBNetworkManager; import tb.network.proxy.TBServer; import tb.utils.TBConfig; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.ModMetadata; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.relauncher.Side; -import static tb.core.TBCore.*; -@Mod(modid = modid, version = version, name = name,dependencies=dependencies) +@Mod(modid = modid, version = version, name = name, dependencies = dependencies) public class TBCore { - public static final String modid = "thaumicbases"; - public static final String version = "GRADLETOKEN_VERSION"; - public static final String name = "Thaumic Bases"; - public static final String serverProxy = "tb.network.proxy.TBServer"; - public static final String clientProxy = "tb.network.proxy.TBClient"; - public static final String dependencies = "required-after:Thaumcraft@[4.2.3.5,);required-after:Baubles@[1.0.1.10,);required-after:DummyCore@[1.6,);"; - - public static final TBConfig cfg = new TBConfig(); - - @SidedProxy(serverSide = serverProxy,clientSide = clientProxy) - public static TBServer proxy; - public static SimpleNetworkWrapper network; - - public static TBCore instance; - - @EventHandler - public void preInit(FMLPreInitializationEvent event) - { - instance = this; - try { - Core.registerModAbsolute(getClass(), name, event.getModConfigurationDirectory().getAbsolutePath(), cfg); - } catch (IOException e) { - e.printStackTrace(); - } - setupModInfo(event.getModMetadata()); - TBBlocks.setup(); - TBItems.setup(); - TBEnchant.setup(); - TBTiles.setup(); - } - - @EventHandler - public void init(FMLInitializationEvent event) - { - MinecraftForge.EVENT_BUS.register(new EnchantmentHandler()); - NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); - - EntityRegistry.registerModEntity(EntityRevolverBullet.class, "revolverBullet", 0, this, 32, 1, true); - - TBFociUpgrades.init(); - proxy.registerRenderInformation(); - RevolverUpgrade.initConflictingMappings(); - - network = NetworkRegistry.INSTANCE.newSimpleChannel("thaumbases"); - network.registerMessage(TBNetworkManager.class, PacketTB.class, 0, Side.SERVER); - network.registerMessage(TBNetworkManager.class, PacketTB.class, 0, Side.CLIENT); - } - - @EventHandler - public void postInit(FMLPostInitializationEvent event) - { - TBRecipes.setup(); - TBThaumonomicon.setup(); - } - - public void setupModInfo(ModMetadata meta) - { - meta.autogenerated = false; - meta.modId = modid; - meta.name = name; - meta.version = version; - meta.description = "A Thaumcraft addon, that adds more earlygame and midgame content"; - ArrayList authors = new ArrayList(); - authors.add("Modbder"); - authors.add("KryptonCaptain"); - authors.add("bartimaeusnek"); - meta.authorList = authors; - } + public static final String modid = "thaumicbases"; + public static final String version = "GRADLETOKEN_VERSION"; + public static final String name = "Thaumic Bases"; + public static final String serverProxy = "tb.network.proxy.TBServer"; + public static final String clientProxy = "tb.network.proxy.TBClient"; + public static final String dependencies = + "required-after:Thaumcraft@[4.2.3.5,);required-after:Baubles@[1.0.1.10,);required-after:DummyCore@[1.6,);"; + + public static final TBConfig cfg = new TBConfig(); + + @SidedProxy(serverSide = serverProxy, clientSide = clientProxy) + public static TBServer proxy; + + public static SimpleNetworkWrapper network; + + public static TBCore instance; + + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + instance = this; + try { + Core.registerModAbsolute( + getClass(), name, event.getModConfigurationDirectory().getAbsolutePath(), cfg); + } catch (IOException e) { + e.printStackTrace(); + } + setupModInfo(event.getModMetadata()); + TBBlocks.setup(); + TBItems.setup(); + TBEnchant.setup(); + TBTiles.setup(); + } + + @EventHandler + public void init(FMLInitializationEvent event) { + MinecraftForge.EVENT_BUS.register(new EnchantmentHandler()); + NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); + + EntityRegistry.registerModEntity(EntityRevolverBullet.class, "revolverBullet", 0, this, 32, 1, true); + + TBFociUpgrades.init(); + proxy.registerRenderInformation(); + RevolverUpgrade.initConflictingMappings(); + + network = NetworkRegistry.INSTANCE.newSimpleChannel("thaumbases"); + network.registerMessage(TBNetworkManager.class, PacketTB.class, 0, Side.SERVER); + network.registerMessage(TBNetworkManager.class, PacketTB.class, 0, Side.CLIENT); + } + + @EventHandler + public void postInit(FMLPostInitializationEvent event) { + TBRecipes.setup(); + TBThaumonomicon.setup(); + } + + public void setupModInfo(ModMetadata meta) { + meta.autogenerated = false; + meta.modId = modid; + meta.name = name; + meta.version = version; + meta.description = "A Thaumcraft addon, that adds more earlygame and midgame content"; + ArrayList authors = new ArrayList(); + authors.add("Modbder"); + authors.add("KryptonCaptain"); + authors.add("bartimaeusnek"); + meta.authorList = authors; + } } diff --git a/src/main/java/tb/init/FakeResearchItem.java b/src/main/java/tb/init/FakeResearchItem.java index 9a687d0..156ae52 100644 --- a/src/main/java/tb/init/FakeResearchItem.java +++ b/src/main/java/tb/init/FakeResearchItem.java @@ -1,39 +1,52 @@ package tb.init; -import thaumcraft.api.research.ResearchPage; import java.util.Arrays; import net.minecraft.item.ItemStack; -import thaumcraft.api.research.ResearchCategories; -import thaumcraft.api.aspects.AspectList; import net.minecraft.util.ResourceLocation; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.research.ResearchCategories; import thaumcraft.api.research.ResearchItem; +import thaumcraft.api.research.ResearchPage; -public class FakeResearchItem extends ResearchItem -{ +public class FakeResearchItem extends ResearchItem { public ResearchItem origResearch; - - public FakeResearchItem(final String name, final String cat, final String origin, final String originCategory, final int x, final int y, final ResourceLocation icon) { + + public FakeResearchItem( + final String name, + final String cat, + final String origin, + final String originCategory, + final int x, + final int y, + final ResourceLocation icon) { super(name, cat, new AspectList(), x, y, 1, icon); this.origResearch = ResearchCategories.getResearch(origin); this.addSiblingToOriginal(); this.setStub(); this.setHidden(); } - - public FakeResearchItem(final String name, final String cat, final String origin, final String originCategory, final int x, final int y, final ItemStack icon) { + + public FakeResearchItem( + final String name, + final String cat, + final String origin, + final String originCategory, + final int x, + final int y, + final ItemStack icon) { super(name, cat, new AspectList(), x, y, 1, icon); this.origResearch = ResearchCategories.getResearch(origin); this.addSiblingToOriginal(); this.setStub(); this.setHidden(); } - + protected void addSiblingToOriginal() { if (this.origResearch.siblings == null) { - this.origResearch.setSiblings(new String[] { this.key }); - } - else { - final String[] newSiblings = Arrays.copyOf(this.origResearch.siblings, this.origResearch.siblings.length + 1); + this.origResearch.setSiblings(new String[] {this.key}); + } else { + final String[] newSiblings = + Arrays.copyOf(this.origResearch.siblings, this.origResearch.siblings.length + 1); newSiblings[this.origResearch.siblings.length] = this.key; this.origResearch.setSiblings(newSiblings); } @@ -41,27 +54,27 @@ public class FakeResearchItem extends ResearchItem this.setSecondary(); } } - + public ResearchPage[] getPages() { return this.origResearch.getPages(); } - + public String getName() { return this.origResearch.getName(); } - + public String getText() { return this.origResearch.getText(); } - + public boolean isStub() { return true; } - + public boolean isHidden() { return true; } - + public int getComplexity() { return 1; } diff --git a/src/main/java/tb/init/TBBlocks.java b/src/main/java/tb/init/TBBlocks.java index 439379f..30d2e61 100644 --- a/src/main/java/tb/init/TBBlocks.java +++ b/src/main/java/tb/init/TBBlocks.java @@ -1,6 +1,14 @@ package tb.init; import DummyCore.Blocks.BlocksRegistry; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemAnvilBlock; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; import tb.common.block.BlockAdvAlchemicalFurnace; import tb.common.block.BlockAshroom; import tb.common.block.BlockAureliaLeaf; @@ -47,211 +55,316 @@ import tb.common.itemblock.ItemBlockTBLogs; import tb.common.itemblock.ItemBlockTBSapling; import tb.core.TBCore; import tb.utils.TBConfig; -import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemAnvilBlock; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; public class TBBlocks { - public static final Class core = TBCore.class; - - public static Block quicksilverBlock = new TBBlock(Material.iron,false).stabilise().setBlockName("quicksilverBlock").setBlockTextureName("thaumicbases:quicksilverBlock").setHardness(1F); - public static Block quicksilverBrick = new TBBlock(Material.rock,true).stabilise().setBlockName("quicksilverBrick").setBlockTextureName("thaumicbases:quicksilverBrick").setHardness(1F); - public static Block crystalBlock = new BlockCrystalBlock().setBlockName("crystalBlock").setBlockTextureName("thaumicbases:crystal/mixed"); - public static Block dustBlock = new TBBlock(Material.sand,false).stabilise().setStepSound(Block.soundTypeSand).setBlockName("salisMundusBlock").setBlockTextureName("thaumicbases:dust_block").setHardness(1F); - public static Block pyrofluid = new BlockPyrofluid().setBlockName("pyrofluid").setLightLevel(1); - public static Block thauminiteBlock = new TBBlock(Material.iron,false).stabilise().setBlockName("thauminiteBlock").setBlockTextureName("thaumicbases:thauminiteblock").setHardness(2F); - public static Block eldritchArk = new TBBlockDeco(Material.rock,false).setBlockName("eldritchArk").setBlockTextureName("thaumicbases:eldritchArk").setHardness(3F); - public static Block ironGreatwood = new TBBlockDeco(Material.wood,false).setBlockName("ironGreatwood").setBlockTextureName("thaumicbases:ironGreatwood").setHardness(1F).setStepSound(Block.soundTypeWood); - - public static Block plax = new BlockTBPlant(8,4,true).setBlockName("plax").setBlockTextureName("thaumicbases:plax/"); - public static Block aureliaPetal = new BlockAureliaLeaf().setBlockName("aureliaPetal").setBlockTextureName("thaumicbases:aurelia/petal").setHardness(0).setStepSound(Block.soundTypeGrass); - public static Block aurelia = new BlockAureliaPlant().setBlockName("aurelia").setBlockTextureName("thaumicbases:aurelia/").setHardness(0).setStepSound(Block.soundTypeGrass); - public static Block metalleat = new BlockTBPlant(8,8,true).setBlockName("metalleat").setBlockTextureName("thaumicbases:metalleat/"); - public static Block lucrite = new BlockLucritePlant(8,16,true).setBlockName("lucrite").setBlockTextureName("thaumicbases:lucrite/"); - public static Block knose = new BlockKnose(4,16,false).setBlockName("knose").setBlockTextureName("thaumicbases:knoze/"); - public static Block sweed = new BlockSweed(4,4,false).setBlockName("sweed").setBlockTextureName("thaumicbases:sweed/"); - public static Block lazullia = new BlockTBPlant(8,16,true).setBlockName("lazullia").setBlockTextureName("thaumicbases:lazullia/"); - public static Block rainbowCactus = new BlockRainbowCactus().setBlockName("rainbowCactus").setBlockTextureName("thaumicbases:rainbowCacti/").setStepSound(Block.soundTypeCloth).setHardness(0.5F); - public static Block redlonStem = new BlockRedlonStem(Blocks.redstone_block).setBlockName("redlonStem").setBlockTextureName("thaumicbases:redlon/redlon").setStepSound(Block.soundTypeGrass); - public static Block ashroom = new BlockAshroom(4,8,false).setBlockName("ashroom").setBlockTextureName("thaumicbases:aspectshroom/"); - public static Block flaxium = new BlockFlaxium().setBlockName("flaxium").setBlockTextureName("thaumicbases:flaxium").setStepSound(Block.soundTypeGrass); - public static Block glieonia = new BlockTBPlant(4,12,false).setBlockName("glieonia").setBlockTextureName("thaumicbases:glieonia/"); - public static Block briar = new BlockBriar(8,4).setBlockName("briar").setBlockTextureName("thaumicbases:briar/").setStepSound(Block.soundTypeGrass); - public static Block tobacco = new BlockTBPlant(8,16,true).setBlockName("tobacco").setBlockTextureName("thaumicbases:tobacco/"); - public static Block voidPlant = new BlockTBPlant(4,32,true).setBlockName("voidPlant").setBlockTextureName("thaumicbases:voidPlant/"); - - public static Block spike = new BlockSpike().setBlockName("spike").setHardness(3).setResistance(3).setStepSound(Block.soundTypeMetal); - public static Block overchanter = new BlockOverchanter().setBlockName("overchanter").setHardness(5).setResistance(5); - public static Block sapling = new BlockTBSapling(); - public static Block genLeaves = new BlockTBLeaves(); - public static Block cryingObsidian = new BlockCryingObelisk().setBlockName("cryingObsidian").setBlockTextureName("thaumicbases:cryingObelisk/").setHardness(10).setResistance(10); - public static Block oldCobble = new TBBlockDeco(Material.rock,false).setBlockName("TBoldCobblestone").setBlockTextureName("thaumicbases:cobblestone").setHardness(1).setResistance(1); - public static Block oldCobbleMossy = new TBBlockDeco(Material.rock,false).setBlockName("TBoldCobblestoneMossy").setBlockTextureName("thaumicbases:cobblestone_mossy").setHardness(1).setResistance(1); - public static Block oldGravel = new BlockFalling(Material.sand).setBlockName("TBoldGravel").setBlockTextureName("thaumicbases:gravel").setHardness(0.6F).setResistance(0).setStepSound(Block.soundTypeGravel); - public static Block advAlchFurnace = new BlockAdvAlchemicalFurnace().setBlockName("advAlchFurnace"); - public static Block entityDeconstructor = new BlockEntityDeconstructor().setBlockName("entityDeconstructor").setBlockTextureName("thaumicbases:entityDeconstructor/block").setHardness(1); - public static Block oldBrick = new TBBlockDeco(Material.rock,false).setBlockName("TBoldBricks").setBlockTextureName("thaumicbases:brick").setHardness(1).setResistance(1); - public static Block oldLapis = new TBBlockDeco(Material.rock,false).setBlockName("TBoldLapis").setBlockTextureName("thaumicbases:lapis_block").setHardness(1).setResistance(1); - public static Block oldIron = new TBSidedBlock(Material.rock,false).setBlockName("TBoldIron").setBlockTextureName("thaumicbases:iron_block").setHardness(1).setResistance(1); - public static Block oldGold = new TBSidedBlock(Material.rock,false).setBlockName("TBoldGold").setBlockTextureName("thaumicbases:gold_block").setHardness(1).setResistance(1); - public static Block oldDiamond = new TBSidedBlock(Material.rock,false).setBlockName("TBoldDiamond").setBlockTextureName("thaumicbases:diamond_block").setHardness(1).setResistance(1); - public static Block genLogs = new BlockTBLog(); - public static Block nodeManipulator = new BlockNodeManipulator().setBlockName("nodeManipulator").setHardness(1); - public static Block genericSlab = new BlockHalfSlab(false,Material.rock).setHardness(1).setResistance(10).setBlockName("tb.slab."); - public static Block genericSlab_full = new BlockHalfSlab(true,Material.rock).setHardness(1).setResistance(10).setBlockName("tb.slab."); - public static Block crystalSlab = new BlockCrystalSlab(false,Material.glass).setBlockName("tb.crystalslab."); - public static Block crystalSlab_full = new BlockCrystalSlab(true,Material.glass).setBlockName("tb.crystalslab."); - public static Block relocator = new BlockRelocator().setBlockName("thaumicRelocator"); - public static Block voidBlock = new BlockVoid().setBlockName("tb.voidblock"); - public static Block thaumicAnvil = new BlockThaumicAnvil().setBlockName("thaumicAnvil").setBlockTextureName("thaumicbases:thaumiumAnvil/").setHardness(6).setResistance(16).setStepSound(Block.soundTypeAnvil); - public static Block voidAnvil = new BlockVoidAnvil().setBlockName("voidAnvil").setBlockTextureName("thaumicbases:voidAnvil/"); - public static Block enderPlanks = new TBBlockDeco(Material.wood, false).setBlockName("enderPlanks").setBlockTextureName("thaumicbases:enderTree/planks").setHardness(2).setResistance(45).setStepSound(Block.soundTypeWood); - public static Block nodeLinker = new BlockNodeLinker().setBlockName("nodeLinker").setHardness(1); - public static Block campfire = new BlockCampfire().setBlockName("tb.campfire").setBlockTextureName("thaumicbases:campfire").setLightLevel(1); - public static Block braizer = new BlockBrazier().setBlockName("tb.brazier").setBlockTextureName("cobblestone").setLightLevel(1); - - - public static void setup() - { - //storage blocks - BlocksRegistry.registerBlock(quicksilverBlock, "quicksilverBlock",core,ItemBlock.class); - OreDictionary.registerOre("blockQuicksilver", quicksilverBlock); - BlocksRegistry.registerBlock(quicksilverBrick, "quicksilverBrick",core,ItemBlock.class); - OreDictionary.registerOre("blockQuicksilver", quicksilverBrick); - BlocksRegistry.registerBlock(crystalBlock,"crystalBlock",core, ItemBlockCrystal.class); - OreDictionary.registerOre("blockCrystalCluster", new ItemStack(crystalBlock,1,OreDictionary.WILDCARD_VALUE)); - BlocksRegistry.registerBlock(dustBlock, "blockSalisMundus",core,ItemBlock.class); - OreDictionary.registerOre("blockSalisMundus", dustBlock); - BlocksRegistry.registerBlock(thauminiteBlock, "thauminiteBlock",core,ItemBlock.class); - OreDictionary.registerOre("blockThauminite", thauminiteBlock); - - BlocksRegistry.registerBlock(voidBlock, "voidBlock",core,ItemBlock.class); - OreDictionary.registerOre("blockVoidMetal", voidBlock); - OreDictionary.registerOre("blockVoidmetal", voidBlock); - OreDictionary.registerOre("blockVoid", voidBlock); - OreDictionary.registerOre("voidBlock", voidBlock); - + public static final Class core = TBCore.class; - BlocksRegistry.registerBlock(pyrofluid,"pyrofluid",core, ItemBlockPyrofluid.class); - - BlocksRegistry.registerBlock(overchanter, "overchanter",core,ItemBlock.class); - - BlocksRegistry.registerBlock(cryingObsidian, "cryingObsidian",core,ItemBlock.class); - cryingObsidian.setHarvestLevel("pickaxe", 3); + public static Block quicksilverBlock = new TBBlock(Material.iron, false) + .stabilise() + .setBlockName("quicksilverBlock") + .setBlockTextureName("thaumicbases:quicksilverBlock") + .setHardness(1F); + public static Block quicksilverBrick = new TBBlock(Material.rock, true) + .stabilise() + .setBlockName("quicksilverBrick") + .setBlockTextureName("thaumicbases:quicksilverBrick") + .setHardness(1F); + public static Block crystalBlock = + new BlockCrystalBlock().setBlockName("crystalBlock").setBlockTextureName("thaumicbases:crystal/mixed"); + public static Block dustBlock = new TBBlock(Material.sand, false) + .stabilise() + .setStepSound(Block.soundTypeSand) + .setBlockName("salisMundusBlock") + .setBlockTextureName("thaumicbases:dust_block") + .setHardness(1F); + public static Block pyrofluid = + new BlockPyrofluid().setBlockName("pyrofluid").setLightLevel(1); + public static Block thauminiteBlock = new TBBlock(Material.iron, false) + .stabilise() + .setBlockName("thauminiteBlock") + .setBlockTextureName("thaumicbases:thauminiteblock") + .setHardness(2F); + public static Block eldritchArk = new TBBlockDeco(Material.rock, false) + .setBlockName("eldritchArk") + .setBlockTextureName("thaumicbases:eldritchArk") + .setHardness(3F); + public static Block ironGreatwood = new TBBlockDeco(Material.wood, false) + .setBlockName("ironGreatwood") + .setBlockTextureName("thaumicbases:ironGreatwood") + .setHardness(1F) + .setStepSound(Block.soundTypeWood); - BlocksRegistry.registerBlock(advAlchFurnace, "advAlchFurnace",core,ItemBlock.class); - - - //levitator - BlocksRegistry.registerBlock(relocator, "relocator",core,ItemBlockMetadata.class); + public static Block plax = + new BlockTBPlant(8, 4, true).setBlockName("plax").setBlockTextureName("thaumicbases:plax/"); + public static Block aureliaPetal = new BlockAureliaLeaf() + .setBlockName("aureliaPetal") + .setBlockTextureName("thaumicbases:aurelia/petal") + .setHardness(0) + .setStepSound(Block.soundTypeGrass); + public static Block aurelia = new BlockAureliaPlant() + .setBlockName("aurelia") + .setBlockTextureName("thaumicbases:aurelia/") + .setHardness(0) + .setStepSound(Block.soundTypeGrass); + public static Block metalleat = + new BlockTBPlant(8, 8, true).setBlockName("metalleat").setBlockTextureName("thaumicbases:metalleat/"); + public static Block lucrite = + new BlockLucritePlant(8, 16, true).setBlockName("lucrite").setBlockTextureName("thaumicbases:lucrite/"); + public static Block knose = + new BlockKnose(4, 16, false).setBlockName("knose").setBlockTextureName("thaumicbases:knoze/"); + public static Block sweed = + new BlockSweed(4, 4, false).setBlockName("sweed").setBlockTextureName("thaumicbases:sweed/"); + public static Block lazullia = + new BlockTBPlant(8, 16, true).setBlockName("lazullia").setBlockTextureName("thaumicbases:lazullia/"); + public static Block rainbowCactus = new BlockRainbowCactus() + .setBlockName("rainbowCactus") + .setBlockTextureName("thaumicbases:rainbowCacti/") + .setStepSound(Block.soundTypeCloth) + .setHardness(0.5F); + public static Block redlonStem = new BlockRedlonStem(Blocks.redstone_block) + .setBlockName("redlonStem") + .setBlockTextureName("thaumicbases:redlon/redlon") + .setStepSound(Block.soundTypeGrass); + public static Block ashroom = + new BlockAshroom(4, 8, false).setBlockName("ashroom").setBlockTextureName("thaumicbases:aspectshroom/"); + public static Block flaxium = new BlockFlaxium() + .setBlockName("flaxium") + .setBlockTextureName("thaumicbases:flaxium") + .setStepSound(Block.soundTypeGrass); + public static Block glieonia = + new BlockTBPlant(4, 12, false).setBlockName("glieonia").setBlockTextureName("thaumicbases:glieonia/"); + public static Block briar = new BlockBriar(8, 4) + .setBlockName("briar") + .setBlockTextureName("thaumicbases:briar/") + .setStepSound(Block.soundTypeGrass); + public static Block tobacco = + new BlockTBPlant(8, 16, true).setBlockName("tobacco").setBlockTextureName("thaumicbases:tobacco/"); + public static Block voidPlant = + new BlockTBPlant(4, 32, true).setBlockName("voidPlant").setBlockTextureName("thaumicbases:voidPlant/"); - BlocksRegistry.registerBlock(thaumicAnvil, "thaumicAnvil",core,ItemAnvilBlock.class); - BlocksRegistry.registerBlock(voidAnvil, "voidAnvil",core,ItemAnvilBlock.class); + public static Block spike = new BlockSpike() + .setBlockName("spike") + .setHardness(3) + .setResistance(3) + .setStepSound(Block.soundTypeMetal); + public static Block overchanter = + new BlockOverchanter().setBlockName("overchanter").setHardness(5).setResistance(5); + public static Block sapling = new BlockTBSapling(); + public static Block genLeaves = new BlockTBLeaves(); + public static Block cryingObsidian = new BlockCryingObelisk() + .setBlockName("cryingObsidian") + .setBlockTextureName("thaumicbases:cryingObelisk/") + .setHardness(10) + .setResistance(10); + public static Block oldCobble = new TBBlockDeco(Material.rock, false) + .setBlockName("TBoldCobblestone") + .setBlockTextureName("thaumicbases:cobblestone") + .setHardness(1) + .setResistance(1); + public static Block oldCobbleMossy = new TBBlockDeco(Material.rock, false) + .setBlockName("TBoldCobblestoneMossy") + .setBlockTextureName("thaumicbases:cobblestone_mossy") + .setHardness(1) + .setResistance(1); + public static Block oldGravel = new BlockFalling(Material.sand) + .setBlockName("TBoldGravel") + .setBlockTextureName("thaumicbases:gravel") + .setHardness(0.6F) + .setResistance(0) + .setStepSound(Block.soundTypeGravel); + public static Block advAlchFurnace = new BlockAdvAlchemicalFurnace().setBlockName("advAlchFurnace"); + public static Block entityDeconstructor = new BlockEntityDeconstructor() + .setBlockName("entityDeconstructor") + .setBlockTextureName("thaumicbases:entityDeconstructor/block") + .setHardness(1); + public static Block oldBrick = new TBBlockDeco(Material.rock, false) + .setBlockName("TBoldBricks") + .setBlockTextureName("thaumicbases:brick") + .setHardness(1) + .setResistance(1); + public static Block oldLapis = new TBBlockDeco(Material.rock, false) + .setBlockName("TBoldLapis") + .setBlockTextureName("thaumicbases:lapis_block") + .setHardness(1) + .setResistance(1); + public static Block oldIron = new TBSidedBlock(Material.rock, false) + .setBlockName("TBoldIron") + .setBlockTextureName("thaumicbases:iron_block") + .setHardness(1) + .setResistance(1); + public static Block oldGold = new TBSidedBlock(Material.rock, false) + .setBlockName("TBoldGold") + .setBlockTextureName("thaumicbases:gold_block") + .setHardness(1) + .setResistance(1); + public static Block oldDiamond = new TBSidedBlock(Material.rock, false) + .setBlockName("TBoldDiamond") + .setBlockTextureName("thaumicbases:diamond_block") + .setHardness(1) + .setResistance(1); + public static Block genLogs = new BlockTBLog(); + public static Block nodeManipulator = + new BlockNodeManipulator().setBlockName("nodeManipulator").setHardness(1); + public static Block genericSlab = new BlockHalfSlab(false, Material.rock) + .setHardness(1) + .setResistance(10) + .setBlockName("tb.slab."); + public static Block genericSlab_full = new BlockHalfSlab(true, Material.rock) + .setHardness(1) + .setResistance(10) + .setBlockName("tb.slab."); + public static Block crystalSlab = new BlockCrystalSlab(false, Material.glass).setBlockName("tb.crystalslab."); + public static Block crystalSlab_full = new BlockCrystalSlab(true, Material.glass).setBlockName("tb.crystalslab."); + public static Block relocator = new BlockRelocator().setBlockName("thaumicRelocator"); + public static Block voidBlock = new BlockVoid().setBlockName("tb.voidblock"); + public static Block thaumicAnvil = new BlockThaumicAnvil() + .setBlockName("thaumicAnvil") + .setBlockTextureName("thaumicbases:thaumiumAnvil/") + .setHardness(6) + .setResistance(16) + .setStepSound(Block.soundTypeAnvil); + public static Block voidAnvil = + new BlockVoidAnvil().setBlockName("voidAnvil").setBlockTextureName("thaumicbases:voidAnvil/"); + public static Block enderPlanks = new TBBlockDeco(Material.wood, false) + .setBlockName("enderPlanks") + .setBlockTextureName("thaumicbases:enderTree/planks") + .setHardness(2) + .setResistance(45) + .setStepSound(Block.soundTypeWood); + public static Block nodeLinker = + new BlockNodeLinker().setBlockName("nodeLinker").setHardness(1); + public static Block campfire = new BlockCampfire() + .setBlockName("tb.campfire") + .setBlockTextureName("thaumicbases:campfire") + .setLightLevel(1); + public static Block braizer = new BlockBrazier() + .setBlockName("tb.brazier") + .setBlockTextureName("cobblestone") + .setLightLevel(1); - BlocksRegistry.registerBlock(campfire, "campfire",core,ItemBlock.class); - BlocksRegistry.registerBlock(braizer, "brazier",core,ItemBlock.class); - - - //Deco - BlocksRegistry.registerBlock(eldritchArk, "eldritchArk",core,ItemBlock.class); - BlocksRegistry.registerBlock(ironGreatwood, "ironGreatwood",core,ItemBlock.class); - - //Old blocks - BlocksRegistry.registerBlock(oldBrick, "oldBrick",core,ItemBlock.class); - oldBrick.setHarvestLevel("pickaxe", 0); - OreDictionary.registerOre("brick", oldBrick); - BlocksRegistry.registerBlock(oldLapis, "oldLapis",core,ItemBlock.class); - oldLapis.setHarvestLevel("pickaxe", 0); - OreDictionary.registerOre("blockLapis", oldLapis); - BlocksRegistry.registerBlock(oldIron, "oldIron",core,ItemBlock.class); - oldIron.setHarvestLevel("pickaxe", 0); - OreDictionary.registerOre("blockIron", oldIron); - BlocksRegistry.registerBlock(oldGold, "oldGold",core,ItemBlock.class); - oldGold.setHarvestLevel("pickaxe", 0); - OreDictionary.registerOre("blockGold", oldGold); - BlocksRegistry.registerBlock(oldDiamond, "oldDiamond",core,ItemBlock.class); - oldDiamond.setHarvestLevel("pickaxe", 0); - OreDictionary.registerOre("blockDiamond", oldDiamond); - BlocksRegistry.registerBlock(oldCobble, "oldCobble",core,ItemBlock.class); - oldCobble.setHarvestLevel("pickaxe", 0); - OreDictionary.registerOre("cobblestone", oldCobble); - BlocksRegistry.registerBlock(oldCobbleMossy, "oldCobbleMossy",core,ItemBlock.class); - oldCobbleMossy.setHarvestLevel("pickaxe", 0); - OreDictionary.registerOre("cobblestone", oldCobbleMossy); - OreDictionary.registerOre("mossyCobblestone", oldCobbleMossy); - BlocksRegistry.registerBlock(oldGravel, "oldGravel",core,ItemBlock.class); - oldGravel.setHarvestLevel("shovel", 0); - OreDictionary.registerOre("gravel", oldGravel); - - - BlocksRegistry.registerBlock(genericSlab, "genericSlab",core,ItemBlockSlab_0.class); - BlocksRegistry.registerBlock(genericSlab_full, "genericSlab_full",core,ItemBlockSlab_0.class); - BlocksRegistry.registerBlock(crystalSlab, "crystalSlab",core,ItemBlockSlab_1.class); - BlocksRegistry.registerBlock(crystalSlab_full, "crystalSlab_full",core,ItemBlockSlab_1.class); - + public static void setup() { + // storage blocks + BlocksRegistry.registerBlock(quicksilverBlock, "quicksilverBlock", core, ItemBlock.class); + OreDictionary.registerOre("blockQuicksilver", quicksilverBlock); + BlocksRegistry.registerBlock(quicksilverBrick, "quicksilverBrick", core, ItemBlock.class); + OreDictionary.registerOre("blockQuicksilver", quicksilverBrick); + BlocksRegistry.registerBlock(crystalBlock, "crystalBlock", core, ItemBlockCrystal.class); + OreDictionary.registerOre("blockCrystalCluster", new ItemStack(crystalBlock, 1, OreDictionary.WILDCARD_VALUE)); + BlocksRegistry.registerBlock(dustBlock, "blockSalisMundus", core, ItemBlock.class); + OreDictionary.registerOre("blockSalisMundus", dustBlock); + BlocksRegistry.registerBlock(thauminiteBlock, "thauminiteBlock", core, ItemBlock.class); + OreDictionary.registerOre("blockThauminite", thauminiteBlock); - if (TBConfig.allowTobacco) { - //Tobacco - BlocksRegistry.registerBlock(tobacco, "tobacco",core,ItemBlock.class); - } - - if (TBConfig.enableBloodyMess) { - //Spike - BlocksRegistry.registerBlock(spike, "spike",core,ItemBlockSpike.class); - } - - //TODO flora - /*if (TBConfig.enableFlora) {*/ - //flora - BlocksRegistry.registerBlock(plax, "plax",core,ItemBlock.class); - BlocksRegistry.registerBlock(aureliaPetal, "aureliaPetal",core,ItemBlock.class); - BlocksRegistry.registerBlock(aurelia, "aurelia",core,ItemBlock.class); - BlocksRegistry.registerBlock(metalleat, "metalleat",core,ItemBlock.class); - BlocksRegistry.registerBlock(lucrite, "lucrite",core,ItemBlock.class); - BlocksRegistry.registerBlock(knose, "knose",core,ItemBlock.class); - BlocksRegistry.registerBlock(sweed, "sweed",core,ItemBlock.class); - BlocksRegistry.registerBlock(lazullia, "lazullia",core,ItemBlock.class); - BlocksRegistry.registerBlock(rainbowCactus, "rainbowCactus",core,ItemBlock.class); - BlocksRegistry.registerBlock(redlonStem, "redlonStem",core,ItemBlock.class); - BlocksRegistry.registerBlock(ashroom, "ashroom",core,ItemBlock.class); - BlocksRegistry.registerBlock(flaxium, "flaxium",core,ItemBlock.class); - BlocksRegistry.registerBlock(glieonia, "glieonia",core,ItemBlock.class); - BlocksRegistry.registerBlock(briar, "briar",core,ItemBlock.class); - BlocksRegistry.registerBlock(voidPlant, "voidPlant",core,ItemBlock.class); - //trees - BlocksRegistry.registerBlock(sapling, "goldenOakSapling",core,ItemBlockTBSapling.class); - OreDictionary.registerOre("treeSapling", sapling); - BlocksRegistry.registerBlock(genLeaves, "genLeaves",core,ItemBlockTBLeaves.class); - BlocksRegistry.registerBlock(genLogs, "genLogs",core,ItemBlockTBLogs.class); - OreDictionary.registerOre("logWood", new ItemStack(genLogs,1,OreDictionary.WILDCARD_VALUE)); - BlocksRegistry.registerBlock(enderPlanks, "enderPlanks",core,ItemBlock.class); - OreDictionary.registerOre("plankWood", enderPlanks); - - Blocks.fire.setFireInfo(genLogs, 5, 5); - Blocks.fire.setFireInfo(genLeaves, 30, 60); - Blocks.fire.setFireInfo(enderPlanks, 5, 20); - //} - - if (TBConfig.enableNodeTools) { - //node - BlocksRegistry.registerBlock(nodeManipulator, "nodeManipulator",core,ItemBlockModeManipulator.class); - BlocksRegistry.registerBlock(nodeLinker, "nodeLinker",core,ItemBlock.class); - } - - - //Ent Decon - BlocksRegistry.registerBlock(entityDeconstructor, "entityDeconstructor",core,ItemBlock.class); - + BlocksRegistry.registerBlock(voidBlock, "voidBlock", core, ItemBlock.class); + OreDictionary.registerOre("blockVoidMetal", voidBlock); + OreDictionary.registerOre("blockVoidmetal", voidBlock); + OreDictionary.registerOre("blockVoid", voidBlock); + OreDictionary.registerOre("voidBlock", voidBlock); - - } - - - + BlocksRegistry.registerBlock(pyrofluid, "pyrofluid", core, ItemBlockPyrofluid.class); + + BlocksRegistry.registerBlock(overchanter, "overchanter", core, ItemBlock.class); + + BlocksRegistry.registerBlock(cryingObsidian, "cryingObsidian", core, ItemBlock.class); + cryingObsidian.setHarvestLevel("pickaxe", 3); + + BlocksRegistry.registerBlock(advAlchFurnace, "advAlchFurnace", core, ItemBlock.class); + + // levitator + BlocksRegistry.registerBlock(relocator, "relocator", core, ItemBlockMetadata.class); + + BlocksRegistry.registerBlock(thaumicAnvil, "thaumicAnvil", core, ItemAnvilBlock.class); + BlocksRegistry.registerBlock(voidAnvil, "voidAnvil", core, ItemAnvilBlock.class); + + BlocksRegistry.registerBlock(campfire, "campfire", core, ItemBlock.class); + BlocksRegistry.registerBlock(braizer, "brazier", core, ItemBlock.class); + + // Deco + BlocksRegistry.registerBlock(eldritchArk, "eldritchArk", core, ItemBlock.class); + BlocksRegistry.registerBlock(ironGreatwood, "ironGreatwood", core, ItemBlock.class); + + // Old blocks + BlocksRegistry.registerBlock(oldBrick, "oldBrick", core, ItemBlock.class); + oldBrick.setHarvestLevel("pickaxe", 0); + OreDictionary.registerOre("brick", oldBrick); + BlocksRegistry.registerBlock(oldLapis, "oldLapis", core, ItemBlock.class); + oldLapis.setHarvestLevel("pickaxe", 0); + OreDictionary.registerOre("blockLapis", oldLapis); + BlocksRegistry.registerBlock(oldIron, "oldIron", core, ItemBlock.class); + oldIron.setHarvestLevel("pickaxe", 0); + OreDictionary.registerOre("blockIron", oldIron); + BlocksRegistry.registerBlock(oldGold, "oldGold", core, ItemBlock.class); + oldGold.setHarvestLevel("pickaxe", 0); + OreDictionary.registerOre("blockGold", oldGold); + BlocksRegistry.registerBlock(oldDiamond, "oldDiamond", core, ItemBlock.class); + oldDiamond.setHarvestLevel("pickaxe", 0); + OreDictionary.registerOre("blockDiamond", oldDiamond); + BlocksRegistry.registerBlock(oldCobble, "oldCobble", core, ItemBlock.class); + oldCobble.setHarvestLevel("pickaxe", 0); + OreDictionary.registerOre("cobblestone", oldCobble); + BlocksRegistry.registerBlock(oldCobbleMossy, "oldCobbleMossy", core, ItemBlock.class); + oldCobbleMossy.setHarvestLevel("pickaxe", 0); + OreDictionary.registerOre("cobblestone", oldCobbleMossy); + OreDictionary.registerOre("mossyCobblestone", oldCobbleMossy); + BlocksRegistry.registerBlock(oldGravel, "oldGravel", core, ItemBlock.class); + oldGravel.setHarvestLevel("shovel", 0); + OreDictionary.registerOre("gravel", oldGravel); + + BlocksRegistry.registerBlock(genericSlab, "genericSlab", core, ItemBlockSlab_0.class); + BlocksRegistry.registerBlock(genericSlab_full, "genericSlab_full", core, ItemBlockSlab_0.class); + BlocksRegistry.registerBlock(crystalSlab, "crystalSlab", core, ItemBlockSlab_1.class); + BlocksRegistry.registerBlock(crystalSlab_full, "crystalSlab_full", core, ItemBlockSlab_1.class); + + if (TBConfig.allowTobacco) { + // Tobacco + BlocksRegistry.registerBlock(tobacco, "tobacco", core, ItemBlock.class); + } + + if (TBConfig.enableBloodyMess) { + // Spike + BlocksRegistry.registerBlock(spike, "spike", core, ItemBlockSpike.class); + } + + // TODO flora + /*if (TBConfig.enableFlora) {*/ + // flora + BlocksRegistry.registerBlock(plax, "plax", core, ItemBlock.class); + BlocksRegistry.registerBlock(aureliaPetal, "aureliaPetal", core, ItemBlock.class); + BlocksRegistry.registerBlock(aurelia, "aurelia", core, ItemBlock.class); + BlocksRegistry.registerBlock(metalleat, "metalleat", core, ItemBlock.class); + BlocksRegistry.registerBlock(lucrite, "lucrite", core, ItemBlock.class); + BlocksRegistry.registerBlock(knose, "knose", core, ItemBlock.class); + BlocksRegistry.registerBlock(sweed, "sweed", core, ItemBlock.class); + BlocksRegistry.registerBlock(lazullia, "lazullia", core, ItemBlock.class); + BlocksRegistry.registerBlock(rainbowCactus, "rainbowCactus", core, ItemBlock.class); + BlocksRegistry.registerBlock(redlonStem, "redlonStem", core, ItemBlock.class); + BlocksRegistry.registerBlock(ashroom, "ashroom", core, ItemBlock.class); + BlocksRegistry.registerBlock(flaxium, "flaxium", core, ItemBlock.class); + BlocksRegistry.registerBlock(glieonia, "glieonia", core, ItemBlock.class); + BlocksRegistry.registerBlock(briar, "briar", core, ItemBlock.class); + BlocksRegistry.registerBlock(voidPlant, "voidPlant", core, ItemBlock.class); + // trees + BlocksRegistry.registerBlock(sapling, "goldenOakSapling", core, ItemBlockTBSapling.class); + OreDictionary.registerOre("treeSapling", sapling); + BlocksRegistry.registerBlock(genLeaves, "genLeaves", core, ItemBlockTBLeaves.class); + BlocksRegistry.registerBlock(genLogs, "genLogs", core, ItemBlockTBLogs.class); + OreDictionary.registerOre("logWood", new ItemStack(genLogs, 1, OreDictionary.WILDCARD_VALUE)); + BlocksRegistry.registerBlock(enderPlanks, "enderPlanks", core, ItemBlock.class); + OreDictionary.registerOre("plankWood", enderPlanks); + + Blocks.fire.setFireInfo(genLogs, 5, 5); + Blocks.fire.setFireInfo(genLeaves, 30, 60); + Blocks.fire.setFireInfo(enderPlanks, 5, 20); + // } + + if (TBConfig.enableNodeTools) { + // node + BlocksRegistry.registerBlock(nodeManipulator, "nodeManipulator", core, ItemBlockModeManipulator.class); + BlocksRegistry.registerBlock(nodeLinker, "nodeLinker", core, ItemBlock.class); + } + + // Ent Decon + BlocksRegistry.registerBlock(entityDeconstructor, "entityDeconstructor", core, ItemBlock.class); + } } diff --git a/src/main/java/tb/init/TBEnchant.java b/src/main/java/tb/init/TBEnchant.java index dbaabc2..f9da333 100644 --- a/src/main/java/tb/init/TBEnchant.java +++ b/src/main/java/tb/init/TBEnchant.java @@ -1,8 +1,9 @@ package tb.init; -import java.lang.reflect.Method; - import cpw.mods.fml.common.Loader; +import java.lang.reflect.Method; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; import tb.common.enchantment.EnchantmentElderKnowledge; import tb.common.enchantment.EnchantmentEldritchBane; import tb.common.enchantment.EnchantmentMagicTouch; @@ -11,43 +12,78 @@ import tb.common.enchantment.EnchantmentVaporising; import tb.utils.TBConfig; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; public class TBEnchant { - - public static void setup() - { - elderKnowledge = new EnchantmentElderKnowledge(TBConfig.elderKnowledgeID,12,EnumEnchantmentType.weapon).setName("elderKnowledge"); - eldritchBane = new EnchantmentEldritchBane(TBConfig.eldritchBaneID,7,EnumEnchantmentType.weapon).setName("eldritchBane"); - magicTouch = new EnchantmentMagicTouch(TBConfig.magicTouchID,11,EnumEnchantmentType.weapon).setName("magicTouch"); - tainted = new EnchantmentTainted(TBConfig.taintedID,9,EnumEnchantmentType.weapon).setName("tainted"); - vaporising = new EnchantmentVaporising(TBConfig.vaporisingID,6,EnumEnchantmentType.weapon).setName("vaporising"); - if(Loader.isModLoaded("ThaumicTinkerer") && TBConfig.enableTTCompathability) - { - try - { - Class c = Class.forName("thaumic.tinkerer.common.enchantment.core.EnchantmentManager"); - Method reg = c.getMethod("registerExponentialCostData", Enchantment.class,String.class,boolean.class,AspectList.class); - reg.invoke(null, elderKnowledge,"thaumicbases:textures/enchantments/elder_knowledge.png",false,new AspectList().add(Aspect.AIR, 8).add(Aspect.ORDER, 12).add(Aspect.EARTH, 16)); - reg.invoke(null, eldritchBane,"thaumicbases:textures/enchantments/eldritch_bane.png",false,new AspectList().add(Aspect.FIRE, 12).add(Aspect.ENTROPY, 12).add(Aspect.ORDER, 8)); - reg.invoke(null, magicTouch,"thaumicbases:textures/enchantments/magic_touched.png",false,new AspectList().add(Aspect.FIRE, 16).add(Aspect.ORDER, 16).add(Aspect.WATER, 8).add(Aspect.ENTROPY, 12)); - reg.invoke(null, tainted,"thaumicbases:textures/enchantments/tainted.png",false,new AspectList().add(Aspect.FIRE, 12).add(Aspect.ENTROPY, 16)); - reg.invoke(null, vaporising,"thaumicbases:textures/enchantments/vaporising.png",false,new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.ORDER, 12).add(Aspect.FIRE, 16)); - } - catch(Exception e) - { - System.out.println("[ThaumicBases]Unable to add ThaumicTinkerer integration - mod not found"); - return; - } - } - } - - public static Enchantment - elderKnowledge, - eldritchBane, - magicTouch, - tainted, - vaporising; + public static void setup() { + elderKnowledge = new EnchantmentElderKnowledge(TBConfig.elderKnowledgeID, 12, EnumEnchantmentType.weapon) + .setName("elderKnowledge"); + eldritchBane = new EnchantmentEldritchBane(TBConfig.eldritchBaneID, 7, EnumEnchantmentType.weapon) + .setName("eldritchBane"); + magicTouch = + new EnchantmentMagicTouch(TBConfig.magicTouchID, 11, EnumEnchantmentType.weapon).setName("magicTouch"); + tainted = new EnchantmentTainted(TBConfig.taintedID, 9, EnumEnchantmentType.weapon).setName("tainted"); + vaporising = + new EnchantmentVaporising(TBConfig.vaporisingID, 6, EnumEnchantmentType.weapon).setName("vaporising"); + + if (Loader.isModLoaded("ThaumicTinkerer") && TBConfig.enableTTCompathability) { + try { + Class c = Class.forName("thaumic.tinkerer.common.enchantment.core.EnchantmentManager"); + Method reg = c.getMethod( + "registerExponentialCostData", + Enchantment.class, + String.class, + boolean.class, + AspectList.class); + reg.invoke( + null, + elderKnowledge, + "thaumicbases:textures/enchantments/elder_knowledge.png", + false, + new AspectList() + .add(Aspect.AIR, 8) + .add(Aspect.ORDER, 12) + .add(Aspect.EARTH, 16)); + reg.invoke( + null, + eldritchBane, + "thaumicbases:textures/enchantments/eldritch_bane.png", + false, + new AspectList() + .add(Aspect.FIRE, 12) + .add(Aspect.ENTROPY, 12) + .add(Aspect.ORDER, 8)); + reg.invoke( + null, + magicTouch, + "thaumicbases:textures/enchantments/magic_touched.png", + false, + new AspectList() + .add(Aspect.FIRE, 16) + .add(Aspect.ORDER, 16) + .add(Aspect.WATER, 8) + .add(Aspect.ENTROPY, 12)); + reg.invoke( + null, + tainted, + "thaumicbases:textures/enchantments/tainted.png", + false, + new AspectList().add(Aspect.FIRE, 12).add(Aspect.ENTROPY, 16)); + reg.invoke( + null, + vaporising, + "thaumicbases:textures/enchantments/vaporising.png", + false, + new AspectList() + .add(Aspect.ENTROPY, 8) + .add(Aspect.ORDER, 12) + .add(Aspect.FIRE, 16)); + } catch (Exception e) { + System.out.println("[ThaumicBases]Unable to add ThaumicTinkerer integration - mod not found"); + return; + } + } + } + + public static Enchantment elderKnowledge, eldritchBane, magicTouch, tainted, vaporising; } diff --git a/src/main/java/tb/init/TBFociUpgrades.java b/src/main/java/tb/init/TBFociUpgrades.java index 968ee52..823b0c6 100644 --- a/src/main/java/tb/init/TBFociUpgrades.java +++ b/src/main/java/tb/init/TBFociUpgrades.java @@ -7,18 +7,49 @@ import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.FocusUpgradeType; public class TBFociUpgrades { - - public static void init() - { - - } - - public static FocusUpgradeType aquatic = new FocusUpgradeType(TBConfig.aquaticFociUID, new ResourceLocation("thaumicbases","textures/items/foci/drain/aquatic.png"), "tb.foci.aquatic.name", "tb.foci.aquatic.desc", new AspectList().add(Aspect.WATER, 16).add(Aspect.ORDER, 16)); - public static FocusUpgradeType netheric = new FocusUpgradeType(TBConfig.nethericFociUID, new ResourceLocation("thaumicbases","textures/items/foci/drain/netheric.png"), "tb.foci.netheric.name", "tb.foci.netheric.desc", new AspectList().add(Aspect.FIRE, 16).add(Aspect.ENTROPY, 16)); - public static FocusUpgradeType decomposing = new FocusUpgradeType(TBConfig.decomposingFociUID, new ResourceLocation("thaumicbases","textures/items/foci/experience/decomposing.png"), "tb.foci.decomposing.name", "tb.foci.decomposing.desc", new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.EARTH, 16)); - public static FocusUpgradeType vaporizing = new FocusUpgradeType(TBConfig.vaporisingFociUID, new ResourceLocation("thaumicbases","textures/items/foci/experience/vaporizing.png"), "tb.foci.vaporizing.name", "tb.foci.vaporizing.desc", new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.ORDER, 16).add(Aspect.AIR, 16)); - public static FocusUpgradeType warping = new FocusUpgradeType(TBConfig.warpingFociUID, new ResourceLocation("thaumicbases","textures/items/foci/flux/warping.png"), "tb.foci.warping.name", "tb.foci.warping.desc", new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.FIRE, 16).add(Aspect.AIR, 16)); - public static FocusUpgradeType crystalization = new FocusUpgradeType(TBConfig.crystalizationFociUID, new ResourceLocation("thaumicbases","textures/items/foci/flux/crystalization.png"), "tb.foci.crystalization.name", "tb.foci.crystalization.desc", new AspectList().add(Aspect.ORDER, 16).add(Aspect.EARTH, 16).add(Aspect.WATER, 16)); - public static FocusUpgradeType calming = new FocusUpgradeType(TBConfig.calmingFociUID, new ResourceLocation("thaumicbases","textures/items/foci/flux/calming.png"), "tb.foci.calming.name", "tb.foci.calming.desc", new AspectList().add(Aspect.WATER, 16).add(Aspect.ORDER, 16).add(Aspect.EARTH, 16)); - + + public static void init() {} + + public static FocusUpgradeType aquatic = new FocusUpgradeType( + TBConfig.aquaticFociUID, + new ResourceLocation("thaumicbases", "textures/items/foci/drain/aquatic.png"), + "tb.foci.aquatic.name", + "tb.foci.aquatic.desc", + new AspectList().add(Aspect.WATER, 16).add(Aspect.ORDER, 16)); + public static FocusUpgradeType netheric = new FocusUpgradeType( + TBConfig.nethericFociUID, + new ResourceLocation("thaumicbases", "textures/items/foci/drain/netheric.png"), + "tb.foci.netheric.name", + "tb.foci.netheric.desc", + new AspectList().add(Aspect.FIRE, 16).add(Aspect.ENTROPY, 16)); + public static FocusUpgradeType decomposing = new FocusUpgradeType( + TBConfig.decomposingFociUID, + new ResourceLocation("thaumicbases", "textures/items/foci/experience/decomposing.png"), + "tb.foci.decomposing.name", + "tb.foci.decomposing.desc", + new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.EARTH, 16)); + public static FocusUpgradeType vaporizing = new FocusUpgradeType( + TBConfig.vaporisingFociUID, + new ResourceLocation("thaumicbases", "textures/items/foci/experience/vaporizing.png"), + "tb.foci.vaporizing.name", + "tb.foci.vaporizing.desc", + new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.ORDER, 16).add(Aspect.AIR, 16)); + public static FocusUpgradeType warping = new FocusUpgradeType( + TBConfig.warpingFociUID, + new ResourceLocation("thaumicbases", "textures/items/foci/flux/warping.png"), + "tb.foci.warping.name", + "tb.foci.warping.desc", + new AspectList().add(Aspect.ENTROPY, 16).add(Aspect.FIRE, 16).add(Aspect.AIR, 16)); + public static FocusUpgradeType crystalization = new FocusUpgradeType( + TBConfig.crystalizationFociUID, + new ResourceLocation("thaumicbases", "textures/items/foci/flux/crystalization.png"), + "tb.foci.crystalization.name", + "tb.foci.crystalization.desc", + new AspectList().add(Aspect.ORDER, 16).add(Aspect.EARTH, 16).add(Aspect.WATER, 16)); + public static FocusUpgradeType calming = new FocusUpgradeType( + TBConfig.calmingFociUID, + new ResourceLocation("thaumicbases", "textures/items/foci/flux/calming.png"), + "tb.foci.calming.name", + "tb.foci.calming.desc", + new AspectList().add(Aspect.WATER, 16).add(Aspect.ORDER, 16).add(Aspect.EARTH, 16)); } diff --git a/src/main/java/tb/init/TBItems.java b/src/main/java/tb/init/TBItems.java index 7b3a4e1..23c67e4 100644 --- a/src/main/java/tb/init/TBItems.java +++ b/src/main/java/tb/init/TBItems.java @@ -44,167 +44,251 @@ import thaumcraft.api.wands.WandRod; import thaumcraft.common.items.wands.WandRodPrimalOnUpdate; public class TBItems { - - public static final Class core = TBCore.class; - - public static Item resource = new TBResource().setUnlocalizedName("resource"); - - public static ToolMaterial thauminite = EnumHelper.addToolMaterial("THAUMINITE", 3, 974, 7F, 2.8F, 15); - public static ArmorMaterial thauminiteA = EnumHelper.addArmorMaterial("ATHAUMINITE", 27, new int[]{3, 8, 6, 3}, 17); - public static ArmorMaterial bloodyA = EnumHelper.addArmorMaterial("TBBLOODY", 21, new int[]{2, 6, 5, 2}, 21); - - public static Item thauminiteAxe = new ItemThauminiteAxe(thauminite).setUnlocalizedName("thauminiteAxe").setTextureName("thaumicbases:thauminite/thauminiteaxe"); - public static Item thauminiteHoe = new ItemThauminiteHoe(thauminite).setUnlocalizedName("thauminiteHoe").setTextureName("thaumicbases:thauminite/thauminitehoe"); - public static Item thauminitePickaxe = new ItemThauminitePickaxe(thauminite).setUnlocalizedName("thauminitePickaxe").setTextureName("thaumicbases:thauminite/thauminitepick"); - public static Item thauminiteShears = new ItemThauminiteShears().setUnlocalizedName("thauminiteShears").setTextureName("thaumicbases:thauminite/thauminiteshears").setFull3D().setMaxStackSize(1).setMaxDamage(974); - public static Item thauminiteShovel = new ItemThauminiteShovel(thauminite).setUnlocalizedName("thauminiteShovel").setTextureName("thaumicbases:thauminite/thauminiteshovel"); - public static Item thauminiteSword = new ItemThauminiteSword(thauminite).setUnlocalizedName("thauminiteSword").setTextureName("thaumicbases:thauminite/thauminitesword"); - public static Item thauminiteHelmet = new ItemThauminiteArmor(thauminiteA,0).setUnlocalizedName("thauminiteHelmet").setTextureName("thaumicbases:thauminite/thauminitehelm"); - public static Item thauminiteChest = new ItemThauminiteArmor(thauminiteA,1).setUnlocalizedName("thauminiteChest").setTextureName("thaumicbases:thauminite/thauminitechest"); - public static Item thauminiteLeggings = new ItemThauminiteArmor(thauminiteA,2).setUnlocalizedName("thauminiteLegs").setTextureName("thaumicbases:thauminite/thauminitelegs"); - public static Item thauminiteBoots = new ItemThauminiteArmor(thauminiteA,3).setUnlocalizedName("thauminiteBoots").setTextureName("thaumicbases:thauminite/thauminiteboots"); + public static final Class core = TBCore.class; - public static Item pyroBucket = new ItemPyrofluidBucket().setUnlocalizedName("pyrofluidBucket").setTextureName("thaumicbases:bucket_blazing_fluid"); - - public static Item plaxSeed = new ItemSeeds(TBBlocks.plax, Blocks.farmland).setUnlocalizedName("plaxSeeds").setTextureName("thaumicbases:plax_seeds"); - public static Item metalleatSeeds = new ItemSeeds(TBBlocks.metalleat, Blocks.farmland).setUnlocalizedName("metalleatSeeds").setTextureName("thaumicbases:metalleat_seeds"); - public static Item lucriteSeeds = new ItemSeeds(TBBlocks.lucrite, Blocks.farmland).setUnlocalizedName("lucriteSeeds").setTextureName("thaumicbases:lucrite_seeds"); - - //TODO ROSA - public static Item knoseFragment = new ItemKnoseFragment().setUnlocalizedName("knoseFragment.").setTextureName("thaumicbases:knose/"); - public static Item knoseSeed = new ItemKnoseSeeds(TBBlocks.knose, TBBlocks.crystalBlock).setUnlocalizedName("knoseSeed").setTextureName("thaumicbases:knose_seed"); - - public static Item sweedSeeds = new ItemKnoseSeeds(TBBlocks.sweed,Blocks.grass).setUnlocalizedName("sweedSeeds").setTextureName("thaumicbases:seeds_sweed"); - public static Item lazulliaSeeds = new ItemSeeds(TBBlocks.lazullia,Blocks.farmland).setUnlocalizedName("lazulliaSeeds").setTextureName("thaumicbases:lazullia_seeds"); - public static Item redlonSeeds = new ItemSeeds(TBBlocks.redlonStem,Blocks.farmland).setUnlocalizedName("redlonSeeds").setTextureName("thaumicbases:redlon_seed"); - public static Item glieoniaSeed = new ItemKnoseSeeds(TBBlocks.glieonia,Blocks.grass).setUnlocalizedName("glieoniaSeed").setTextureName("thaumicbases:glieonia_seed"); - public static Item rosehipSyrup = new ItemRosehipSyrup().setUnlocalizedName("rosehipSyrup").setTextureName("thaumicbases:rosehip_syrup").setMaxStackSize(16); - public static Item voidSeed = new ItemSeeds(TBBlocks.voidPlant,Blocks.farmland).setUnlocalizedName("voidSeed").setTextureName("thaumicbases:void_seed"); - - public static Item tobaccoSeeds = new ItemSeeds(TBBlocks.tobacco,Blocks.farmland).setUnlocalizedName("tobaccoSeeds").setTextureName("thaumicbases:tobacco_seeds"); - public static Item mortar = new ItemMortarAndPestle().setUnlocalizedName("mortar").setTextureName("thaumicbases:mortar"); - public static Item tobacco = new TBTobacco().setUnlocalizedName("tobacco"); - public static Item greatwoodPipe = new ItemSmokingPipe(false).setUnlocalizedName("greatwoodPipe").setTextureName("thaumicbases:smokingPipe"); - public static Item silverwoodPipe = new ItemSmokingPipe(true).setUnlocalizedName("silverwoodPipe").setTextureName("thaumicbases:smokingPipe_silverwood"); - - public static Item bloodyChest = new ItemBloodyArmor(bloodyA,1).setUnlocalizedName("bloodyChest").setTextureName("thaumicbases:bloodyRobes/bloodychest"); - public static Item bloodyLeggings = new ItemBloodyArmor(bloodyA,2).setUnlocalizedName("bloodyLegs").setTextureName("thaumicbases:bloodyRobes/bloodylegs"); - public static Item bloodyBoots = new ItemBloodyArmor(bloodyA,3).setUnlocalizedName("bloodyBoots").setTextureName("thaumicbases:bloodyRobes/bloodyboots"); - - public static Item concentratedTaint = new ItemConcentratedTaint().setUnlocalizedName("concentratedTaint").setTextureName("thaumicbases:concentratedTaint").setMaxStackSize(1); - - public static Item fociActivation = new FociActivation().setUnlocalizedName("activationFoci").setTextureName("thaumicbases:foci/activation/foci"); - public static Item fociDrain = new FociDrain().setUnlocalizedName("drainFoci").setTextureName("thaumicbases:foci/drain/foci"); - public static Item fociExperience = new FociExperience().setUnlocalizedName("experienceFoci").setTextureName("thaumicbases:foci/experience/foci"); - public static Item fociFlux = new FociFlux().setUnlocalizedName("fluxFoci").setTextureName("thaumicbases:foci/flux/foci"); - - public static Item nodeFoci = new ItemNodeFoci().setUnlocalizedName("nodeFoci."); - - public static Item voidShears = new ItemVoidShears().setTextureName("thaumicbases:shears").setUnlocalizedName("tb.voidShears").setFull3D().setMaxDamage(184).setFull3D().setMaxStackSize(1); - public static Item voidFAS = new ItemVoidFlintAndSteel().setTextureName("thaumicbases:flint_and_steel").setUnlocalizedName("tb.voidFAS").setFull3D().setMaxDamage(184).setFull3D().setMaxStackSize(1); - - public static Item revolver = new ItemRevolver().setMaxDamage(1561).setMaxStackSize(1).setFull3D().setUnlocalizedName("tb.revolver"); - public static Item castingBracelet = new ItemCastingBracelet().setUnlocalizedName("tb.bracelet"); - - public static WandCap WAND_CAP_THAUMINITE; - - public static WandRod WAND_ROD_THAUMIUM; - public static WandRod WAND_ROD_VOID; - public static StaffRod STAFF_ROD_THAUMIUM; - - - public static void setup() - { + public static Item resource = new TBResource().setUnlocalizedName("resource"); - ItemRegistry.registerItem(resource, "resource",core); - - ItemRegistry.registerItem(thauminiteAxe, "thauminiteAxe",core); - thauminiteAxe.setHarvestLevel("axe", 3); - ItemRegistry.registerItem(thauminiteHoe, "thauminiteHoe",core); - thauminiteHoe.setHarvestLevel("hoe", 3); - ItemRegistry.registerItem(thauminitePickaxe, "thauminitePickaxe",core); - thauminitePickaxe.setHarvestLevel("pickaxe", 3); - ItemRegistry.registerItem(thauminiteShears, "thauminiteShears",core); - thauminiteShears.setHarvestLevel("shears", 3); - ItemRegistry.registerItem(thauminiteShovel, "thauminiteShovel",core); - thauminiteShovel.setHarvestLevel("shovel", 3); - ItemRegistry.registerItem(thauminiteSword, "thauminiteSword",core); - thauminiteSword.setHarvestLevel("sword", 3); - - ItemRegistry.registerItem(thauminiteHelmet, "thauminiteHelmet",core); - ItemRegistry.registerItem(thauminiteChest, "thauminiteChest",core); - ItemRegistry.registerItem(thauminiteLeggings, "thauminiteLeggings",core); - ItemRegistry.registerItem(thauminiteBoots, "thauminiteBoots",core); - - ItemRegistry.registerItem(pyroBucket, "pyroBucket",core); - - ItemRegistry.registerItem(concentratedTaint, "concentratedTaint",core); - - ItemRegistry.registerItem(fociActivation, "fociActivation",core); - ItemRegistry.registerItem(fociDrain, "fociDrain",core); - ItemRegistry.registerItem(fociExperience, "fociExperience",core); - ItemRegistry.registerItem(fociFlux, "fociFlux",core); - - - if (TBConfig.allowTobacco) { - ItemRegistry.registerItem(tobacco, "tobaccoPowder",core); - ItemRegistry.registerItem(greatwoodPipe, "greatwoodPipe",core); - ItemRegistry.registerItem(silverwoodPipe, "silverwoodPipe",core); - ItemRegistry.registerItem(tobaccoSeeds, "tobaccoSeeds",core); - ItemRegistry.registerItem(mortar, "mortar",core); - } - - if (TBConfig.enableBloodyMess) { - ItemRegistry.registerItem(bloodyChest, "bloodyChest",core); - ItemRegistry.registerItem(bloodyLeggings, "bloodyLeggings",core); - ItemRegistry.registerItem(bloodyBoots, "bloodyBoots",core); - } - - if (TBConfig.enableBracelets) { - ItemRegistry.registerItem(castingBracelet, "castingBracelet",core); - } - - //TODO flora - /*if (TBConfig.enableFlora) {*/ - ItemRegistry.registerItem(plaxSeed, "plaxSeed",core); - ItemRegistry.registerItem(metalleatSeeds, "metalleatSeeds",core); - ItemRegistry.registerItem(lucriteSeeds, "lucriteSeeds",core); - ItemRegistry.registerItem(knoseFragment, "knoseFragment",core); - ItemRegistry.registerItem(knoseSeed, "knoseSeed",core); - ItemRegistry.registerItem(sweedSeeds, "sweedSeeds",core); - ItemRegistry.registerItem(lazulliaSeeds, "lazulliaSeeds",core); - ItemRegistry.registerItem(redlonSeeds, "redlonSeeds",core); - ItemRegistry.registerItem(glieoniaSeed, "glieoniaSeed",core); - ItemRegistry.registerItem(rosehipSyrup, "rosehipSyrup",core); - ItemRegistry.registerItem(voidSeed, "voidSeed",core); - //} - - if (TBConfig.enableNodeTools) { - ItemRegistry.registerItem(nodeFoci, "nodeFoci",core); - } - - - if (TBConfig.enableRevolver) { - ItemRegistry.registerItem(revolver, "revolver",core); - } - + public static ToolMaterial thauminite = EnumHelper.addToolMaterial("THAUMINITE", 3, 974, 7F, 2.8F, 15); + public static ArmorMaterial thauminiteA = + EnumHelper.addArmorMaterial("ATHAUMINITE", 27, new int[] {3, 8, 6, 3}, 17); + public static ArmorMaterial bloodyA = EnumHelper.addArmorMaterial("TBBLOODY", 21, new int[] {2, 6, 5, 2}, 21); - ItemRegistry.registerItem(voidShears, "voidShears",core); - ItemRegistry.registerItem(voidFAS, "voidFAS",core); + public static Item thauminiteAxe = new ItemThauminiteAxe(thauminite) + .setUnlocalizedName("thauminiteAxe") + .setTextureName("thaumicbases:thauminite/thauminiteaxe"); + public static Item thauminiteHoe = new ItemThauminiteHoe(thauminite) + .setUnlocalizedName("thauminiteHoe") + .setTextureName("thaumicbases:thauminite/thauminitehoe"); + public static Item thauminitePickaxe = new ItemThauminitePickaxe(thauminite) + .setUnlocalizedName("thauminitePickaxe") + .setTextureName("thaumicbases:thauminite/thauminitepick"); + public static Item thauminiteShears = new ItemThauminiteShears() + .setUnlocalizedName("thauminiteShears") + .setTextureName("thaumicbases:thauminite/thauminiteshears") + .setFull3D() + .setMaxStackSize(1) + .setMaxDamage(974); + public static Item thauminiteShovel = new ItemThauminiteShovel(thauminite) + .setUnlocalizedName("thauminiteShovel") + .setTextureName("thaumicbases:thauminite/thauminiteshovel"); + public static Item thauminiteSword = new ItemThauminiteSword(thauminite) + .setUnlocalizedName("thauminiteSword") + .setTextureName("thaumicbases:thauminite/thauminitesword"); - - - OreDictionary.registerOre("ingotThauminite", new ItemStack(resource,1,1)); - - WAND_CAP_THAUMINITE = new WandCap("thauminite",0.85F,new ItemStack(resource,1,2),6); - WAND_CAP_THAUMINITE.setTexture(new ResourceLocation("thaumicbases","textures/items/thauminite/wand_cap_thauminite_uv.png")); - - WAND_ROD_THAUMIUM = new WandRod("tbthaumium", 80, new ItemStack(resource,1,3), 6, new WandRodPrimalOnUpdate(), new ResourceLocation("thaumicbases","textures/items/wand_rod_thaumium_uv.png")); - WAND_ROD_VOID = new WandRod("tbvoid", 160, new ItemStack(resource,1,4), 16, new WandRodPrimalOnUpdate(), new ResourceLocation("thaumicbases","textures/items/wand_rod_void_uv.png")); - - - } + public static Item thauminiteHelmet = new ItemThauminiteArmor(thauminiteA, 0) + .setUnlocalizedName("thauminiteHelmet") + .setTextureName("thaumicbases:thauminite/thauminitehelm"); + public static Item thauminiteChest = new ItemThauminiteArmor(thauminiteA, 1) + .setUnlocalizedName("thauminiteChest") + .setTextureName("thaumicbases:thauminite/thauminitechest"); + public static Item thauminiteLeggings = new ItemThauminiteArmor(thauminiteA, 2) + .setUnlocalizedName("thauminiteLegs") + .setTextureName("thaumicbases:thauminite/thauminitelegs"); + public static Item thauminiteBoots = new ItemThauminiteArmor(thauminiteA, 3) + .setUnlocalizedName("thauminiteBoots") + .setTextureName("thaumicbases:thauminite/thauminiteboots"); + public static Item pyroBucket = new ItemPyrofluidBucket() + .setUnlocalizedName("pyrofluidBucket") + .setTextureName("thaumicbases:bucket_blazing_fluid"); + public static Item plaxSeed = new ItemSeeds(TBBlocks.plax, Blocks.farmland) + .setUnlocalizedName("plaxSeeds") + .setTextureName("thaumicbases:plax_seeds"); + public static Item metalleatSeeds = new ItemSeeds(TBBlocks.metalleat, Blocks.farmland) + .setUnlocalizedName("metalleatSeeds") + .setTextureName("thaumicbases:metalleat_seeds"); + public static Item lucriteSeeds = new ItemSeeds(TBBlocks.lucrite, Blocks.farmland) + .setUnlocalizedName("lucriteSeeds") + .setTextureName("thaumicbases:lucrite_seeds"); + + // TODO ROSA + public static Item knoseFragment = + new ItemKnoseFragment().setUnlocalizedName("knoseFragment.").setTextureName("thaumicbases:knose/"); + public static Item knoseSeed = new ItemKnoseSeeds(TBBlocks.knose, TBBlocks.crystalBlock) + .setUnlocalizedName("knoseSeed") + .setTextureName("thaumicbases:knose_seed"); + + public static Item sweedSeeds = new ItemKnoseSeeds(TBBlocks.sweed, Blocks.grass) + .setUnlocalizedName("sweedSeeds") + .setTextureName("thaumicbases:seeds_sweed"); + public static Item lazulliaSeeds = new ItemSeeds(TBBlocks.lazullia, Blocks.farmland) + .setUnlocalizedName("lazulliaSeeds") + .setTextureName("thaumicbases:lazullia_seeds"); + public static Item redlonSeeds = new ItemSeeds(TBBlocks.redlonStem, Blocks.farmland) + .setUnlocalizedName("redlonSeeds") + .setTextureName("thaumicbases:redlon_seed"); + public static Item glieoniaSeed = new ItemKnoseSeeds(TBBlocks.glieonia, Blocks.grass) + .setUnlocalizedName("glieoniaSeed") + .setTextureName("thaumicbases:glieonia_seed"); + public static Item rosehipSyrup = new ItemRosehipSyrup() + .setUnlocalizedName("rosehipSyrup") + .setTextureName("thaumicbases:rosehip_syrup") + .setMaxStackSize(16); + public static Item voidSeed = new ItemSeeds(TBBlocks.voidPlant, Blocks.farmland) + .setUnlocalizedName("voidSeed") + .setTextureName("thaumicbases:void_seed"); + + public static Item tobaccoSeeds = new ItemSeeds(TBBlocks.tobacco, Blocks.farmland) + .setUnlocalizedName("tobaccoSeeds") + .setTextureName("thaumicbases:tobacco_seeds"); + public static Item mortar = + new ItemMortarAndPestle().setUnlocalizedName("mortar").setTextureName("thaumicbases:mortar"); + public static Item tobacco = new TBTobacco().setUnlocalizedName("tobacco"); + public static Item greatwoodPipe = + new ItemSmokingPipe(false).setUnlocalizedName("greatwoodPipe").setTextureName("thaumicbases:smokingPipe"); + public static Item silverwoodPipe = new ItemSmokingPipe(true) + .setUnlocalizedName("silverwoodPipe") + .setTextureName("thaumicbases:smokingPipe_silverwood"); + + public static Item bloodyChest = new ItemBloodyArmor(bloodyA, 1) + .setUnlocalizedName("bloodyChest") + .setTextureName("thaumicbases:bloodyRobes/bloodychest"); + public static Item bloodyLeggings = new ItemBloodyArmor(bloodyA, 2) + .setUnlocalizedName("bloodyLegs") + .setTextureName("thaumicbases:bloodyRobes/bloodylegs"); + public static Item bloodyBoots = new ItemBloodyArmor(bloodyA, 3) + .setUnlocalizedName("bloodyBoots") + .setTextureName("thaumicbases:bloodyRobes/bloodyboots"); + + public static Item concentratedTaint = new ItemConcentratedTaint() + .setUnlocalizedName("concentratedTaint") + .setTextureName("thaumicbases:concentratedTaint") + .setMaxStackSize(1); + + public static Item fociActivation = new FociActivation() + .setUnlocalizedName("activationFoci") + .setTextureName("thaumicbases:foci/activation/foci"); + public static Item fociDrain = + new FociDrain().setUnlocalizedName("drainFoci").setTextureName("thaumicbases:foci/drain/foci"); + public static Item fociExperience = new FociExperience() + .setUnlocalizedName("experienceFoci") + .setTextureName("thaumicbases:foci/experience/foci"); + public static Item fociFlux = + new FociFlux().setUnlocalizedName("fluxFoci").setTextureName("thaumicbases:foci/flux/foci"); + + public static Item nodeFoci = new ItemNodeFoci().setUnlocalizedName("nodeFoci."); + + public static Item voidShears = new ItemVoidShears() + .setTextureName("thaumicbases:shears") + .setUnlocalizedName("tb.voidShears") + .setFull3D() + .setMaxDamage(184) + .setFull3D() + .setMaxStackSize(1); + public static Item voidFAS = new ItemVoidFlintAndSteel() + .setTextureName("thaumicbases:flint_and_steel") + .setUnlocalizedName("tb.voidFAS") + .setFull3D() + .setMaxDamage(184) + .setFull3D() + .setMaxStackSize(1); + + public static Item revolver = + new ItemRevolver().setMaxDamage(1561).setMaxStackSize(1).setFull3D().setUnlocalizedName("tb.revolver"); + public static Item castingBracelet = new ItemCastingBracelet().setUnlocalizedName("tb.bracelet"); + + public static WandCap WAND_CAP_THAUMINITE; + + public static WandRod WAND_ROD_THAUMIUM; + public static WandRod WAND_ROD_VOID; + public static StaffRod STAFF_ROD_THAUMIUM; + + public static void setup() { + + ItemRegistry.registerItem(resource, "resource", core); + + ItemRegistry.registerItem(thauminiteAxe, "thauminiteAxe", core); + thauminiteAxe.setHarvestLevel("axe", 3); + ItemRegistry.registerItem(thauminiteHoe, "thauminiteHoe", core); + thauminiteHoe.setHarvestLevel("hoe", 3); + ItemRegistry.registerItem(thauminitePickaxe, "thauminitePickaxe", core); + thauminitePickaxe.setHarvestLevel("pickaxe", 3); + ItemRegistry.registerItem(thauminiteShears, "thauminiteShears", core); + thauminiteShears.setHarvestLevel("shears", 3); + ItemRegistry.registerItem(thauminiteShovel, "thauminiteShovel", core); + thauminiteShovel.setHarvestLevel("shovel", 3); + ItemRegistry.registerItem(thauminiteSword, "thauminiteSword", core); + thauminiteSword.setHarvestLevel("sword", 3); + + ItemRegistry.registerItem(thauminiteHelmet, "thauminiteHelmet", core); + ItemRegistry.registerItem(thauminiteChest, "thauminiteChest", core); + ItemRegistry.registerItem(thauminiteLeggings, "thauminiteLeggings", core); + ItemRegistry.registerItem(thauminiteBoots, "thauminiteBoots", core); + + ItemRegistry.registerItem(pyroBucket, "pyroBucket", core); + + ItemRegistry.registerItem(concentratedTaint, "concentratedTaint", core); + + ItemRegistry.registerItem(fociActivation, "fociActivation", core); + ItemRegistry.registerItem(fociDrain, "fociDrain", core); + ItemRegistry.registerItem(fociExperience, "fociExperience", core); + ItemRegistry.registerItem(fociFlux, "fociFlux", core); + + if (TBConfig.allowTobacco) { + ItemRegistry.registerItem(tobacco, "tobaccoPowder", core); + ItemRegistry.registerItem(greatwoodPipe, "greatwoodPipe", core); + ItemRegistry.registerItem(silverwoodPipe, "silverwoodPipe", core); + ItemRegistry.registerItem(tobaccoSeeds, "tobaccoSeeds", core); + ItemRegistry.registerItem(mortar, "mortar", core); + } + + if (TBConfig.enableBloodyMess) { + ItemRegistry.registerItem(bloodyChest, "bloodyChest", core); + ItemRegistry.registerItem(bloodyLeggings, "bloodyLeggings", core); + ItemRegistry.registerItem(bloodyBoots, "bloodyBoots", core); + } + + if (TBConfig.enableBracelets) { + ItemRegistry.registerItem(castingBracelet, "castingBracelet", core); + } + + // TODO flora + /*if (TBConfig.enableFlora) {*/ + ItemRegistry.registerItem(plaxSeed, "plaxSeed", core); + ItemRegistry.registerItem(metalleatSeeds, "metalleatSeeds", core); + ItemRegistry.registerItem(lucriteSeeds, "lucriteSeeds", core); + ItemRegistry.registerItem(knoseFragment, "knoseFragment", core); + ItemRegistry.registerItem(knoseSeed, "knoseSeed", core); + ItemRegistry.registerItem(sweedSeeds, "sweedSeeds", core); + ItemRegistry.registerItem(lazulliaSeeds, "lazulliaSeeds", core); + ItemRegistry.registerItem(redlonSeeds, "redlonSeeds", core); + ItemRegistry.registerItem(glieoniaSeed, "glieoniaSeed", core); + ItemRegistry.registerItem(rosehipSyrup, "rosehipSyrup", core); + ItemRegistry.registerItem(voidSeed, "voidSeed", core); + // } + + if (TBConfig.enableNodeTools) { + ItemRegistry.registerItem(nodeFoci, "nodeFoci", core); + } + + if (TBConfig.enableRevolver) { + ItemRegistry.registerItem(revolver, "revolver", core); + } + + ItemRegistry.registerItem(voidShears, "voidShears", core); + ItemRegistry.registerItem(voidFAS, "voidFAS", core); + + OreDictionary.registerOre("ingotThauminite", new ItemStack(resource, 1, 1)); + + WAND_CAP_THAUMINITE = new WandCap("thauminite", 0.85F, new ItemStack(resource, 1, 2), 6); + WAND_CAP_THAUMINITE.setTexture( + new ResourceLocation("thaumicbases", "textures/items/thauminite/wand_cap_thauminite_uv.png")); + + WAND_ROD_THAUMIUM = new WandRod( + "tbthaumium", + 80, + new ItemStack(resource, 1, 3), + 6, + new WandRodPrimalOnUpdate(), + new ResourceLocation("thaumicbases", "textures/items/wand_rod_thaumium_uv.png")); + WAND_ROD_VOID = new WandRod( + "tbvoid", + 160, + new ItemStack(resource, 1, 4), + 16, + new WandRodPrimalOnUpdate(), + new ResourceLocation("thaumicbases", "textures/items/wand_rod_void_uv.png")); + } } diff --git a/src/main/java/tb/init/TBRecipes.java b/src/main/java/tb/init/TBRecipes.java index a02573e..ba81f83 100644 --- a/src/main/java/tb/init/TBRecipes.java +++ b/src/main/java/tb/init/TBRecipes.java @@ -1,14 +1,9 @@ package tb.init; +import cpw.mods.fml.common.registry.GameRegistry; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; - -import tb.common.block.BlockHalfSlab; -import tb.common.block.BlockTBPlant; -import thaumcraft.common.config.ConfigBlocks; -import thaumcraft.common.config.ConfigItems; -import thaumcraft.common.lib.utils.CropUtils; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -17,137 +12,165 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -import cpw.mods.fml.common.registry.GameRegistry; +import tb.common.block.BlockHalfSlab; +import tb.common.block.BlockTBPlant; +import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.config.ConfigItems; +import thaumcraft.common.lib.utils.CropUtils; public class TBRecipes { - - public static void setup() - { - OreDictionary.registerOre("obsidian", Blocks.obsidian); - - ShapelessOreRecipe qBl = new ShapelessOreRecipe(new ItemStack(TBBlocks.quicksilverBlock), new Object[]{"quicksilver","quicksilver","quicksilver","quicksilver","quicksilver","quicksilver","quicksilver","quicksilver","quicksilver"}); - ShapelessOreRecipe qSi = new ShapelessOreRecipe(new ItemStack(ConfigItems.itemResource, 9, 3),new Object[]{"blockQuicksilver"}); - ShapelessOreRecipe qBr = new ShapelessOreRecipe(new ItemStack(TBBlocks.quicksilverBrick, 4, 0),new Object[]{"blockQuicksilver","blockQuicksilver","blockQuicksilver","blockQuicksilver"}); - ShapelessOreRecipe smB = new ShapelessOreRecipe(new ItemStack(ConfigItems.itemResource,9,14),new Object[]{"blockSalisMundus"}); - ShapelessOreRecipe tnU = new ShapelessOreRecipe(new ItemStack(TBItems.resource,9,0),new Object[]{new ItemStack(TBItems.resource,1,1)}); - ShapelessOreRecipe tnI = new ShapelessOreRecipe(new ItemStack(TBItems.resource,1,1),new Object[]{new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0),new ItemStack(TBItems.resource,1,0)}); - ShapelessOreRecipe tnB = new ShapelessOreRecipe(new ItemStack(TBBlocks.thauminiteBlock, 1, 0),new Object[]{"ingotThauminite","ingotThauminite","ingotThauminite","ingotThauminite","ingotThauminite","ingotThauminite","ingotThauminite","ingotThauminite","ingotThauminite"}); - ShapelessOreRecipe tiB = new ShapelessOreRecipe(new ItemStack(TBItems.resource,9,1),new Object[]{TBBlocks.thauminiteBlock}); - ShapelessOreRecipe biP = new ShapelessOreRecipe(new ItemStack(Blocks.planks,4,2),new Object[]{new ItemStack(TBBlocks.genLogs,1,0)}); - ShapelessOreRecipe spP = new ShapelessOreRecipe(new ItemStack(Blocks.planks,4,1),new Object[]{new ItemStack(TBBlocks.genLogs,1,1)}); - ShapelessOreRecipe enP = new ShapelessOreRecipe(new ItemStack(TBBlocks.enderPlanks,4,0),new Object[]{new ItemStack(TBBlocks.genLogs,1,2)}); - - ShapedOreRecipe eAr = new ShapedOreRecipe(new ItemStack(TBBlocks.eldritchArk,5,0),new Object[]{ - "@#@", - "###", - "@#@", - '@',"nuggetGold", - '#',"obsidian" - }); - - ShapedOreRecipe iGw = new ShapedOreRecipe(new ItemStack(TBBlocks.ironGreatwood,5,0),new Object[]{ - "@#@", - "###", - "@#@", - '@',"nuggetIron", - '#',new ItemStack(ConfigBlocks.blockWoodenDevice,1,6) - }); - - GameRegistry.addSmelting(new ItemStack(TBBlocks.genLogs,1,0), new ItemStack(Items.coal,1,1), 0.15F); - GameRegistry.addSmelting(new ItemStack(TBBlocks.genLogs,1,1), new ItemStack(Items.coal,1,1), 0.15F); - GameRegistry.addSmelting(new ItemStack(TBBlocks.genLogs,1,2), new ItemStack(Items.coal,1,1), 0.15F); - - recipes.put("quicksilverBlock", qBl); - recipes.put("quicksilver", qSi); - recipes.put("quicksilverBrick", qBr); - recipes.put("salisMundusFromBlock", smB); - recipes.put("thauminiteNugget", tnU); - recipes.put("thauminiteIngot", tnI); - recipes.put("thauminiteIngotFromBlock", tiB); - recipes.put("thauminiteBlock", tnB); - recipes.put("eldritchArk", eAr); - recipes.put("ironGreatwood", iGw); - recipes.put("birchPlanks", biP); - recipes.put("sprucePlanks", spP); - recipes.put("enderPlanks", enP); - GameRegistry.addRecipe(qBl); - GameRegistry.addRecipe(qSi); - GameRegistry.addRecipe(qBr); - GameRegistry.addRecipe(smB); - GameRegistry.addRecipe(tnU); - GameRegistry.addRecipe(tnI); - GameRegistry.addRecipe(tiB); - GameRegistry.addRecipe(tnB); - GameRegistry.addRecipe(eAr); - GameRegistry.addRecipe(iGw); - GameRegistry.addRecipe(biP); - GameRegistry.addRecipe(spP); - GameRegistry.addRecipe(enP); - - for(int i = 0; i < BlockHalfSlab.parents.length; ++i) - { - ShapedOreRecipe slabRec = new ShapedOreRecipe(new ItemStack(TBBlocks.genericSlab,6,i),new Object[]{ - "###", - '#',BlockHalfSlab.parents[i] - }); - slabs.add(slabRec); - GameRegistry.addRecipe(slabRec); - } - - for(int i = 0; i < 8; ++i) - { - ShapedOreRecipe slabRec = new ShapedOreRecipe(new ItemStack(TBBlocks.crystalSlab,6,i),new Object[]{ - "###", - '#',new ItemStack(TBBlocks.crystalBlock,1,i) - }); - slabs.add(slabRec); - GameRegistry.addRecipe(slabRec); - } - - BlockTBPlant.class.cast(TBBlocks.plax).dropItem = new ItemStack(Items.string,3,0); - BlockTBPlant.class.cast(TBBlocks.plax).dropSeed = new ItemStack(TBItems.plaxSeed,1,0); - - BlockTBPlant.class.cast(TBBlocks.metalleat).dropItem = new ItemStack(ConfigItems.itemNugget,2,0); - BlockTBPlant.class.cast(TBBlocks.metalleat).dropSeed = new ItemStack(TBItems.metalleatSeeds,1,0); - - BlockTBPlant.class.cast(TBBlocks.lucrite).dropItem = new ItemStack(Items.gold_nugget,3,0); - BlockTBPlant.class.cast(TBBlocks.lucrite).dropSeed = new ItemStack(TBItems.lucriteSeeds,1,0); - - BlockTBPlant.class.cast(TBBlocks.knose).dropSeed = new ItemStack(TBItems.knoseSeed,1,0); - - BlockTBPlant.class.cast(TBBlocks.sweed).dropSeed = new ItemStack(TBItems.sweedSeeds,1,0); - - BlockTBPlant.class.cast(TBBlocks.lazullia).dropItem = new ItemStack(Items.dye,1,4); - BlockTBPlant.class.cast(TBBlocks.lazullia).dropSeed = new ItemStack(TBItems.lazulliaSeeds,1,0); - - BlockTBPlant.class.cast(TBBlocks.ashroom).dropSeed = new ItemStack(TBBlocks.ashroom,1,0); - - BlockTBPlant.class.cast(TBBlocks.glieonia).dropItem = new ItemStack(Items.glowstone_dust,2,0); - BlockTBPlant.class.cast(TBBlocks.glieonia).dropSeed = new ItemStack(TBItems.glieoniaSeed,1,0); - - BlockTBPlant.class.cast(TBBlocks.tobacco).dropItem = new ItemStack(TBItems.resource,1,7); - BlockTBPlant.class.cast(TBBlocks.tobacco).dropSeed = new ItemStack(TBItems.tobaccoSeeds,1,0); - - BlockTBPlant.class.cast(TBBlocks.voidPlant).dropItem = new ItemStack(ConfigItems.itemResource,1,17); - BlockTBPlant.class.cast(TBBlocks.voidPlant).dropSeed = new ItemStack(TBItems.voidSeed,1,0); - - EntityEnderman.setCarriable(TBBlocks.genLogs, true); - - CropUtils.addStandardCrop(new ItemStack(TBBlocks.aureliaPetal), 0); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.briar), 7); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.glieonia), 3); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.knose), 3); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.lazullia), 7); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.lucrite), 7); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.metalleat), 7); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.plax), 7); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.sweed), 3); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.tobacco), 7); - CropUtils.addStandardCrop(new ItemStack(TBBlocks.voidPlant), 7); - } - - public static final Hashtable recipes = new Hashtable(); - - public static final List slabs = new ArrayList(); + public static void setup() { + OreDictionary.registerOre("obsidian", Blocks.obsidian); + + ShapelessOreRecipe qBl = new ShapelessOreRecipe(new ItemStack(TBBlocks.quicksilverBlock), new Object[] { + "quicksilver", + "quicksilver", + "quicksilver", + "quicksilver", + "quicksilver", + "quicksilver", + "quicksilver", + "quicksilver", + "quicksilver" + }); + ShapelessOreRecipe qSi = new ShapelessOreRecipe( + new ItemStack(ConfigItems.itemResource, 9, 3), new Object[] {"blockQuicksilver"}); + ShapelessOreRecipe qBr = new ShapelessOreRecipe( + new ItemStack(TBBlocks.quicksilverBrick, 4, 0), + new Object[] {"blockQuicksilver", "blockQuicksilver", "blockQuicksilver", "blockQuicksilver"}); + ShapelessOreRecipe smB = new ShapelessOreRecipe( + new ItemStack(ConfigItems.itemResource, 9, 14), new Object[] {"blockSalisMundus"}); + ShapelessOreRecipe tnU = new ShapelessOreRecipe( + new ItemStack(TBItems.resource, 9, 0), new Object[] {new ItemStack(TBItems.resource, 1, 1)}); + ShapelessOreRecipe tnI = new ShapelessOreRecipe(new ItemStack(TBItems.resource, 1, 1), new Object[] { + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0), + new ItemStack(TBItems.resource, 1, 0) + }); + ShapelessOreRecipe tnB = new ShapelessOreRecipe(new ItemStack(TBBlocks.thauminiteBlock, 1, 0), new Object[] { + "ingotThauminite", + "ingotThauminite", + "ingotThauminite", + "ingotThauminite", + "ingotThauminite", + "ingotThauminite", + "ingotThauminite", + "ingotThauminite", + "ingotThauminite" + }); + ShapelessOreRecipe tiB = + new ShapelessOreRecipe(new ItemStack(TBItems.resource, 9, 1), new Object[] {TBBlocks.thauminiteBlock}); + ShapelessOreRecipe biP = new ShapelessOreRecipe( + new ItemStack(Blocks.planks, 4, 2), new Object[] {new ItemStack(TBBlocks.genLogs, 1, 0)}); + ShapelessOreRecipe spP = new ShapelessOreRecipe( + new ItemStack(Blocks.planks, 4, 1), new Object[] {new ItemStack(TBBlocks.genLogs, 1, 1)}); + ShapelessOreRecipe enP = new ShapelessOreRecipe( + new ItemStack(TBBlocks.enderPlanks, 4, 0), new Object[] {new ItemStack(TBBlocks.genLogs, 1, 2)}); + + ShapedOreRecipe eAr = new ShapedOreRecipe( + new ItemStack(TBBlocks.eldritchArk, 5, 0), + new Object[] {"@#@", "###", "@#@", '@', "nuggetGold", '#', "obsidian"}); + + ShapedOreRecipe iGw = new ShapedOreRecipe(new ItemStack(TBBlocks.ironGreatwood, 5, 0), new Object[] { + "@#@", "###", "@#@", '@', "nuggetIron", '#', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6) + }); + + GameRegistry.addSmelting(new ItemStack(TBBlocks.genLogs, 1, 0), new ItemStack(Items.coal, 1, 1), 0.15F); + GameRegistry.addSmelting(new ItemStack(TBBlocks.genLogs, 1, 1), new ItemStack(Items.coal, 1, 1), 0.15F); + GameRegistry.addSmelting(new ItemStack(TBBlocks.genLogs, 1, 2), new ItemStack(Items.coal, 1, 1), 0.15F); + + recipes.put("quicksilverBlock", qBl); + recipes.put("quicksilver", qSi); + recipes.put("quicksilverBrick", qBr); + recipes.put("salisMundusFromBlock", smB); + recipes.put("thauminiteNugget", tnU); + recipes.put("thauminiteIngot", tnI); + recipes.put("thauminiteIngotFromBlock", tiB); + recipes.put("thauminiteBlock", tnB); + recipes.put("eldritchArk", eAr); + recipes.put("ironGreatwood", iGw); + recipes.put("birchPlanks", biP); + recipes.put("sprucePlanks", spP); + recipes.put("enderPlanks", enP); + GameRegistry.addRecipe(qBl); + GameRegistry.addRecipe(qSi); + GameRegistry.addRecipe(qBr); + GameRegistry.addRecipe(smB); + GameRegistry.addRecipe(tnU); + GameRegistry.addRecipe(tnI); + GameRegistry.addRecipe(tiB); + GameRegistry.addRecipe(tnB); + GameRegistry.addRecipe(eAr); + GameRegistry.addRecipe(iGw); + GameRegistry.addRecipe(biP); + GameRegistry.addRecipe(spP); + GameRegistry.addRecipe(enP); + + for (int i = 0; i < BlockHalfSlab.parents.length; ++i) { + ShapedOreRecipe slabRec = new ShapedOreRecipe( + new ItemStack(TBBlocks.genericSlab, 6, i), new Object[] {"###", '#', BlockHalfSlab.parents[i]}); + slabs.add(slabRec); + GameRegistry.addRecipe(slabRec); + } + + for (int i = 0; i < 8; ++i) { + ShapedOreRecipe slabRec = new ShapedOreRecipe( + new ItemStack(TBBlocks.crystalSlab, 6, i), + new Object[] {"###", '#', new ItemStack(TBBlocks.crystalBlock, 1, i)}); + slabs.add(slabRec); + GameRegistry.addRecipe(slabRec); + } + + BlockTBPlant.class.cast(TBBlocks.plax).dropItem = new ItemStack(Items.string, 3, 0); + BlockTBPlant.class.cast(TBBlocks.plax).dropSeed = new ItemStack(TBItems.plaxSeed, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.metalleat).dropItem = new ItemStack(ConfigItems.itemNugget, 2, 0); + BlockTBPlant.class.cast(TBBlocks.metalleat).dropSeed = new ItemStack(TBItems.metalleatSeeds, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.lucrite).dropItem = new ItemStack(Items.gold_nugget, 3, 0); + BlockTBPlant.class.cast(TBBlocks.lucrite).dropSeed = new ItemStack(TBItems.lucriteSeeds, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.knose).dropSeed = new ItemStack(TBItems.knoseSeed, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.sweed).dropSeed = new ItemStack(TBItems.sweedSeeds, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.lazullia).dropItem = new ItemStack(Items.dye, 1, 4); + BlockTBPlant.class.cast(TBBlocks.lazullia).dropSeed = new ItemStack(TBItems.lazulliaSeeds, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.ashroom).dropSeed = new ItemStack(TBBlocks.ashroom, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.glieonia).dropItem = new ItemStack(Items.glowstone_dust, 2, 0); + BlockTBPlant.class.cast(TBBlocks.glieonia).dropSeed = new ItemStack(TBItems.glieoniaSeed, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.tobacco).dropItem = new ItemStack(TBItems.resource, 1, 7); + BlockTBPlant.class.cast(TBBlocks.tobacco).dropSeed = new ItemStack(TBItems.tobaccoSeeds, 1, 0); + + BlockTBPlant.class.cast(TBBlocks.voidPlant).dropItem = new ItemStack(ConfigItems.itemResource, 1, 17); + BlockTBPlant.class.cast(TBBlocks.voidPlant).dropSeed = new ItemStack(TBItems.voidSeed, 1, 0); + + EntityEnderman.setCarriable(TBBlocks.genLogs, true); + + CropUtils.addStandardCrop(new ItemStack(TBBlocks.aureliaPetal), 0); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.briar), 7); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.glieonia), 3); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.knose), 3); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.lazullia), 7); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.lucrite), 7); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.metalleat), 7); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.plax), 7); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.sweed), 3); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.tobacco), 7); + CropUtils.addStandardCrop(new ItemStack(TBBlocks.voidPlant), 7); + } + + public static final Hashtable recipes = new Hashtable(); + + public static final List slabs = new ArrayList(); } diff --git a/src/main/java/tb/init/TBThaumonomicon.java b/src/main/java/tb/init/TBThaumonomicon.java index 0a10c1e..b9082cc 100644 --- a/src/main/java/tb/init/TBThaumonomicon.java +++ b/src/main/java/tb/init/TBThaumonomicon.java @@ -2,6 +2,16 @@ package tb.init; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; import tb.api.RevolverUpgrade; import tb.utils.RevolverInfusionRecipe; import tb.utils.TBConfig; @@ -18,2483 +28,4275 @@ import thaumcraft.api.research.ResearchItem; import thaumcraft.api.research.ResearchPage; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; public class TBThaumonomicon { - - public static final String catName = "THAUMICBASES"; - public static final ResourceLocation icon = new ResourceLocation("thaumicbases","textures/thaumonomicon/bases1.png"); - public static final ResourceLocation back = new ResourceLocation("thaumicbases","textures/thaumonomicon/background.png"); - @SuppressWarnings({ "unchecked" }) - public static void setup() - { - OreDictionary.registerOre("pestleAndMortar", new ItemStack(TBItems.mortar,1,OreDictionary.WILDCARD_VALUE)); - - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.pyrofluid,1,OreDictionary.WILDCARD_VALUE), new AspectList().add(Aspect.FIRE, 16).add(Aspect.MAGIC, 8).add(Aspect.LIGHT, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.ironGreatwood,1,OreDictionary.WILDCARD_VALUE), new AspectList().add(Aspect.TREE, 1).add(Aspect.METAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.plaxSeed), new AspectList().add(Aspect.CROP, 1).add(Aspect.CLOTH, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.aurelia,1,OreDictionary.WILDCARD_VALUE), new AspectList().add(Aspect.PLANT, 1).add(Aspect.AURA, 3).add(Aspect.LIGHT, 1).add(Aspect.SENSES, 1).add(Aspect.LIFE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.aureliaPetal,1,OreDictionary.WILDCARD_VALUE), new AspectList().add(Aspect.PLANT, 1).add(Aspect.AURA, 6).add(Aspect.SENSES, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.resource,1,5), new AspectList().add(Aspect.PLANT, 1).add(Aspect.AURA, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.resource,1,6), new AspectList().add(Aspect.PLANT, 1).add(Aspect.HEAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.resource,1,7), new AspectList().add(Aspect.PLANT, 1).add(Aspect.MAN, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.tobacco,1,0), new AspectList().add(Aspect.PLANT, 1).add(Aspect.MAN, 1).add(Aspect.ENTROPY, 0)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.mortar,1,OreDictionary.WILDCARD_VALUE), new AspectList().add(Aspect.TREE, 6).add(Aspect.TOOL, 1)); - - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,0), new AspectList().add(Aspect.PLANT, 1).add(Aspect.AIR, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,1), new AspectList().add(Aspect.PLANT, 1).add(Aspect.FIRE, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,2), new AspectList().add(Aspect.PLANT, 1).add(Aspect.WATER, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,3), new AspectList().add(Aspect.PLANT, 1).add(Aspect.EARTH, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,4), new AspectList().add(Aspect.PLANT, 1).add(Aspect.ORDER, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,5), new AspectList().add(Aspect.PLANT, 1).add(Aspect.ENTROPY, 6)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,6), new AspectList().add(Aspect.PLANT, 1).add(primals(2))); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.knoseFragment,1,7), new AspectList().add(Aspect.PLANT, 1).add(Aspect.TAINT, 6)); - - boolean isFMLoaded = Loader.isModLoaded("ForbiddenMagic"); - Aspect nether = Aspect.FIRE; - if(isFMLoaded) - nether = Aspect.getAspect("infernus"); - - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.genLeaves,1,0),new int[]{0,8}, new AspectList().add(Aspect.PLANT, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.genLeaves,1,1),new int[]{1,9}, new AspectList().add(Aspect.PLANT, 1).add(Aspect.LIFE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.genLeaves,1,2),new int[]{2,10}, new AspectList().add(Aspect.PLANT, 1).add(nether, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.genLeaves,1,3),new int[]{3,11}, new AspectList().add(Aspect.PLANT, 1).add(Aspect.ELDRITCH, 1)); - - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.genLogs,1,0), new int[]{0,4,8}, new AspectList().add(Aspect.TREE, 3).add(Aspect.HEAL, 1).add(Aspect.LIFE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.genLogs,1,1), new int[]{1,5,9}, new AspectList().add(Aspect.TREE, 3).add(Aspect.FIRE, 1).add(nether, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.genLogs,1,2), new int[]{2,6,10}, new AspectList().add(Aspect.TREE, 3).add(Aspect.ELDRITCH, 1).add(Aspect.VOID, 1)); - - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.sapling,1,0), new int[]{0,8}, new AspectList().add(Aspect.PLANT, 3).add(Aspect.GREED, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.sapling,1,1), new int[]{1,9}, new AspectList().add(Aspect.PLANT, 3).add(Aspect.LIFE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.sapling,1,2), new int[]{2,10}, new AspectList().add(Aspect.PLANT, 3).add(nether, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBBlocks.sapling,1,3), new int[]{3,11}, new AspectList().add(Aspect.PLANT, 3).add(Aspect.ELDRITCH, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(TBItems.fociExperience,1,0), new AspectList().add(Aspect.METAL, 24).add(Aspect.GREED, 17).add(Aspect.CRYSTAL, 12).add(Aspect.EARTH, 7).add(Aspect.VOID, 5).add(Aspect.HUNGER, 5)); - - ResearchCategories.registerCategory(catName, icon, back); - - CrucibleRecipe wool3Rec = new CrucibleRecipe("TB.AdvancedEntropy",new ItemStack(Items.string,3,0),new ItemStack(Blocks.wool,1,OreDictionary.WILDCARD_VALUE),new AspectList().add(Aspect.ENTROPY, 1)); - CrucibleRecipe sandstone3Rec = new CrucibleRecipe("TB.AdvancedEntropy",new ItemStack(Blocks.sand,3,0),new ItemStack(Blocks.sandstone,1,OreDictionary.WILDCARD_VALUE),new AspectList().add(Aspect.ENTROPY, 1)); - CrucibleRecipe blaze3Rec = new CrucibleRecipe("TB.AdvancedEntropy",new ItemStack(Items.blaze_powder,3,0),new ItemStack(Items.blaze_rod,1,0),new AspectList().add(Aspect.ENTROPY, 1)); - - CrucibleRecipe wool4Rec = new CrucibleRecipe("TB.MasterEntropy",new ItemStack(Items.string,4,0),new ItemStack(Blocks.wool,1,OreDictionary.WILDCARD_VALUE),new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.CRAFT, 1)); - CrucibleRecipe sandstone4Rec = new CrucibleRecipe("TB.MasterEntropy",new ItemStack(Blocks.sand,4,0),new ItemStack(Blocks.sandstone,1,OreDictionary.WILDCARD_VALUE),new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.CRAFT, 1)); - CrucibleRecipe blaze4Rec = new CrucibleRecipe("TB.MasterEntropy",new ItemStack(Items.blaze_powder,4,0),new ItemStack(Items.blaze_rod,1,0),new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.CRAFT, 1)); - - CrucibleRecipe glassSand = new CrucibleRecipe("TB.StrongEntropy",new ItemStack(Blocks.sand,1,0),"blockGlass",new AspectList().add(Aspect.ENTROPY, 1)); - CrucibleRecipe gravelSand = new CrucibleRecipe("TB.StrongEntropy",new ItemStack(Blocks.sand,1,0),new ItemStack(Blocks.gravel),new AspectList().add(Aspect.ENTROPY, 1)); - CrucibleRecipe barsIron = new CrucibleRecipe("TB.StrongEntropy",new ItemStack(ConfigItems.itemNugget,3,0),new ItemStack(Blocks.iron_bars),new AspectList().add(Aspect.ENTROPY, 1)); - - CrucibleRecipe arrows = new CrucibleRecipe("TB.SimpleDublication",new ItemStack(Items.arrow,2,0),new ItemStack(Items.arrow,1,0),new AspectList().add(Aspect.WEAPON, 1)); - CrucibleRecipe snowball = new CrucibleRecipe("TB.SimpleDublication",new ItemStack(Items.snowball,2,0),new ItemStack(Items.snowball,1,0),new AspectList().add(Aspect.COLD, 1)); - CrucibleRecipe redstone = new CrucibleRecipe("TB.SimpleDublication",new ItemStack(Items.redstone,2,0),new ItemStack(Items.redstone,1,0),new AspectList().add(Aspect.MECHANISM, 1).add(Aspect.ENERGY, 1)); - - CrucibleRecipe amber = new CrucibleRecipe("TB.Amber",new ItemStack(ConfigItems.itemResource, 1, 6),new ItemStack(Blocks.sapling,1,1),new AspectList().add(Aspect.TRAP, 2)); - CrucibleRecipe cinnabar = new CrucibleRecipe("TB.Quicksilver",new ItemStack(ConfigItems.itemResource, 3, 3),new ItemStack(ConfigBlocks.blockMagicalLog,1,1),new AspectList().add(Aspect.ORDER, 1).add(Aspect.POISON, 1)); - CrucibleRecipe salisMundis = new CrucibleRecipe("TB.SM",new ItemStack(ConfigItems.itemResource, 2, 14),new ItemStack(ConfigItems.itemResource, 1, 14),new AspectList().add(primals(2)).add(Aspect.MAGIC, 3)); - - CrucibleRecipe chiseledBricks = new CrucibleRecipe("TB.AlchemyRestoration",new ItemStack(Blocks.stonebrick,1,3),new ItemStack(Blocks.stonebrick,1,0),new AspectList().add(Aspect.ORDER, 1)); - CrucibleRecipe gravel2Cobble = new CrucibleRecipe("TB.AlchemyRestoration",new ItemStack(Blocks.cobblestone,1,0),new ItemStack(Blocks.gravel,1,0),new AspectList().add(Aspect.ORDER, 1)); - CrucibleRecipe icePacking = new CrucibleRecipe("TB.AlchemyRestoration",new ItemStack(Blocks.packed_ice,1,0),new ItemStack(Blocks.ice,1,0),new AspectList().add(Aspect.EARTH, 1).add(Aspect.COLD, 3)); - - CrucibleRecipe blazepowderRest = new CrucibleRecipe("TB.Backprocessing",new ItemStack(Items.blaze_rod,1,0),new ItemStack(Items.blaze_powder,1,0),new AspectList().add(Aspect.ORDER, 6).add(Aspect.FIRE, 3).add(Aspect.MAGIC, 2).add(Aspect.CRAFT, 8).add(Aspect.EXCHANGE, 6).add(Aspect.ENERGY, 3)); - CrucibleRecipe boneRest = new CrucibleRecipe("TB.Backprocessing",new ItemStack(Items.bone,1,0),new ItemStack(Items.dye,1,15),new AspectList().add(Aspect.ORDER, 2).add(Aspect.SENSES, 6).add(Aspect.CRAFT, 2).add(Aspect.EXCHANGE, 1).add(Aspect.DEATH, 4)); - CrucibleRecipe sugarRest = new CrucibleRecipe("TB.Backprocessing",new ItemStack(Items.reeds,1,0),new ItemStack(Items.sugar,1,0),new AspectList().add(Aspect.ORDER, 1).add(Aspect.LIFE, 2)); - CrucibleRecipe cactiRest = new CrucibleRecipe("TB.Backprocessing",new ItemStack(Blocks.cactus,1,0),new ItemStack(Items.dye,1,2),new AspectList().add(Aspect.ORDER, 1).add(Aspect.LIFE, 2).add(Aspect.EARTH, 1)); - - CrucibleRecipe pyrofluidRec = new CrucibleRecipe("TB.Pyrofluid",new ItemStack(TBItems.pyroBucket,1,0),new ItemStack(Items.lava_bucket,1,0),new AspectList().add(Aspect.FIRE, 24).add(Aspect.MAGIC, 8)); - - InfusionEnchantmentRecipe elderKnowledgeEnch = new InfusionEnchantmentRecipe("TB.ElderKnowledge",TBEnchant.elderKnowledge,2,new AspectList().add(Aspect.MAGIC, 8).add(Aspect.MIND, 8).add(Aspect.WEAPON, 8), new ItemStack[]{new ItemStack(Items.paper,1,0),new ItemStack(Items.paper,1,0),new ItemStack(Items.paper,1,0),new ItemStack(ConfigItems.itemZombieBrain,1,0),new ItemStack(ConfigItems.itemResource,1,14)}); - InfusionEnchantmentRecipe elderBaneEnch = new InfusionEnchantmentRecipe("TB.Eldritchbane",TBEnchant.eldritchBane,2,new AspectList().add(Aspect.DEATH, 8).add(Aspect.ELDRITCH, 8).add(Aspect.WEAPON, 8), new ItemStack[]{new ItemStack(Items.ender_pearl,1,0),new ItemStack(Items.ender_eye,1,0),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14)}); - InfusionEnchantmentRecipe magicTouchEnch = new InfusionEnchantmentRecipe("TB.MagicTouch",TBEnchant.magicTouch,2,new AspectList().add(Aspect.MAGIC, 8).add(Aspect.AURA, 8).add(Aspect.WEAPON, 8), new ItemStack[]{new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(Items.paper,1,0)}); - InfusionEnchantmentRecipe vaporisingEnch = new InfusionEnchantmentRecipe("TB.Vaporising",TBEnchant.vaporising,2,new AspectList().add(Aspect.MAGIC, 8).add(Aspect.CRYSTAL, 8).add(Aspect.TRAP, 8), new ItemStack[]{new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(Items.diamond,1,0)}); - InfusionEnchantmentRecipe taintedEnch = new InfusionEnchantmentRecipe("TB.Tainted",TBEnchant.tainted,5,new AspectList().add(Aspect.TAINT, 16), new ItemStack[]{new ItemStack(ConfigItems.itemResource,1,11),new ItemStack(ConfigItems.itemResource,1,12),new ItemStack(ConfigItems.itemResource,1,14)}); - - ShapelessArcaneRecipe salisMundusBlockRec = new ShapelessArcaneRecipe("TB.SMB", TBBlocks.dustBlock, new AspectList().add(primals(1)), new Object[]{new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14),new ItemStack(ConfigItems.itemResource,1,14)}); - - - //thauminite - CrucibleRecipe thauminiteRec = new CrucibleRecipe("TB.Thauminite",new ItemStack(TBItems.resource,8,0),new ItemStack(ConfigItems.itemResource,1,2),new AspectList().add(Aspect.METAL, 4).add(Aspect.CRYSTAL, 8).add(Aspect.MAGIC, 2)); - - ShapedArcaneRecipe[] toolsRec = new ShapedArcaneRecipe[10]; - - ItemStack tiG = new ItemStack(TBItems.resource,1,1); - - toolsRec[0] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteAxe,primals(15),new Object[]{ - "##", - "#|", - " |", - '#',tiG, - '|',"stickWood" - }); - - toolsRec[1] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteHoe,primals(15),new Object[]{ - "##", - " |", - " |", - '#',tiG, - '|',"stickWood" - }); - - toolsRec[2] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteShovel,primals(15),new Object[]{ - "#", - "|", - "|", - '#',tiG, - '|',"stickWood" - }); - - toolsRec[3] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteSword,primals(15),new Object[]{ - "#", - "#", - "|", - '#',tiG, - '|',"stickWood" - }); - - toolsRec[4] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteShears,primals(15),new Object[]{ - " #", - "# ", - '#',tiG - }); - - toolsRec[5] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminitePickaxe,primals(15),new Object[]{ - "###", - " | ", - " | ", - '#',tiG, - '|',"stickWood" - }); - - toolsRec[6] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteHelmet,primals(25),new Object[]{ - "###", - "# #", - '#',tiG - }); - - toolsRec[7] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteChest,primals(25),new Object[]{ - "# #", - "###", - "###", - '#',tiG - }); - - toolsRec[8] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteLeggings,primals(25),new Object[]{ - "###", - "# #", - "# #", - '#',tiG - }); - - toolsRec[9] = new ShapedArcaneRecipe("TB.Thauminite",TBItems.thauminiteBoots,primals(25),new Object[]{ - "# #", - "# #", - '#',tiG - }); - + public static final String catName = "THAUMICBASES"; + public static final ResourceLocation icon = + new ResourceLocation("thaumicbases", "textures/thaumonomicon/bases1.png"); + public static final ResourceLocation back = + new ResourceLocation("thaumicbases", "textures/thaumonomicon/background.png"); - ShapedArcaneRecipe thauminiteCaps = new ShapedArcaneRecipe("CAP_thauminite", new ItemStack(TBItems.resource,1,2), primals(25), new Object[]{ - "###", - "#@#", - "@@@", - '#',new ItemStack(TBItems.resource,1,0), - '@',new ItemStack(ConfigItems.itemResource,1,14) - }); - - ShapedArcaneRecipe thaumicWandCore = new ShapedArcaneRecipe("ROD_tbthaumium", new ItemStack(TBItems.resource,1,3), primals(50), new Object[]{ - " @#", - "@#@", - "#@ ", - '#',new ItemStack(ConfigItems.itemResource,1,2), - '@',new ItemStack(ConfigItems.itemResource,1,14) - }); - + @SuppressWarnings({"unchecked"}) + public static void setup() { + OreDictionary.registerOre("pestleAndMortar", new ItemStack(TBItems.mortar, 1, OreDictionary.WILDCARD_VALUE)); - CrucibleRecipe[] shards = new CrucibleRecipe[6]; - if (Loader.isModLoaded("gregtech")){ + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.pyrofluid, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.FIRE, 16).add(Aspect.MAGIC, 8).add(Aspect.LIGHT, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.ironGreatwood, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.TREE, 1).add(Aspect.METAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.plaxSeed), + new AspectList().add(Aspect.CROP, 1).add(Aspect.CLOTH, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.aurelia, 1, OreDictionary.WILDCARD_VALUE), + new AspectList() + .add(Aspect.PLANT, 1) + .add(Aspect.AURA, 3) + .add(Aspect.LIGHT, 1) + .add(Aspect.SENSES, 1) + .add(Aspect.LIFE, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.aureliaPetal, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.AURA, 6).add(Aspect.SENSES, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.resource, 1, 5), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.AURA, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.resource, 1, 6), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.HEAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.resource, 1, 7), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.MAN, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.tobacco, 1, 0), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.MAN, 1).add(Aspect.ENTROPY, 0)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.mortar, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.TREE, 6).add(Aspect.TOOL, 1)); - shards[0] = new CrucibleRecipe("TB.OreDestruction", new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 0), new ItemStack(GameRegistry.findBlock("gregtech","gt.blockores"), 1, 540), - new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.AIR, 3)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 0), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.AIR, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 1), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.FIRE, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 2), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.WATER, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 3), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.EARTH, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 4), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.ORDER, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 5), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.ENTROPY, 6)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 6), + new AspectList().add(Aspect.PLANT, 1).add(primals(2))); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.knoseFragment, 1, 7), + new AspectList().add(Aspect.PLANT, 1).add(Aspect.TAINT, 6)); - shards[1] = new CrucibleRecipe("TB.OreDestruction", new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 1), new ItemStack(GameRegistry.findBlock("gregtech","gt.blockores"), 1, 541), - new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.FIRE, 3)); + boolean isFMLoaded = Loader.isModLoaded("ForbiddenMagic"); + Aspect nether = Aspect.FIRE; + if (isFMLoaded) nether = Aspect.getAspect("infernus"); - shards[2] = new CrucibleRecipe("TB.OreDestruction", new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 2), new ItemStack(GameRegistry.findBlock("gregtech","gt.blockores"), 1, 543), - new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.WATER, 3)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.genLeaves, 1, 0), new int[] {0, 8}, new AspectList().add(Aspect.PLANT, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.genLeaves, 1, 1), + new int[] {1, 9}, + new AspectList().add(Aspect.PLANT, 1).add(Aspect.LIFE, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.genLeaves, 1, 2), + new int[] {2, 10}, + new AspectList().add(Aspect.PLANT, 1).add(nether, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.genLeaves, 1, 3), + new int[] {3, 11}, + new AspectList().add(Aspect.PLANT, 1).add(Aspect.ELDRITCH, 1)); - shards[3] = new CrucibleRecipe("TB.OreDestruction", new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 3), new ItemStack(GameRegistry.findBlock("gregtech","gt.blockores"), 1, 542), - new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.EARTH, 3)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.genLogs, 1, 0), + new int[] {0, 4, 8}, + new AspectList().add(Aspect.TREE, 3).add(Aspect.HEAL, 1).add(Aspect.LIFE, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.genLogs, 1, 1), + new int[] {1, 5, 9}, + new AspectList().add(Aspect.TREE, 3).add(Aspect.FIRE, 1).add(nether, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.genLogs, 1, 2), + new int[] {2, 6, 10}, + new AspectList().add(Aspect.TREE, 3).add(Aspect.ELDRITCH, 1).add(Aspect.VOID, 1)); - shards[4] = new CrucibleRecipe("TB.OreDestruction", new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 4), new ItemStack(GameRegistry.findBlock("gregtech","gt.blockores"), 1, 545), - new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.ORDER, 3)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.sapling, 1, 0), + new int[] {0, 8}, + new AspectList().add(Aspect.PLANT, 3).add(Aspect.GREED, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.sapling, 1, 1), + new int[] {1, 9}, + new AspectList().add(Aspect.PLANT, 3).add(Aspect.LIFE, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.sapling, 1, 2), + new int[] {2, 10}, + new AspectList().add(Aspect.PLANT, 3).add(nether, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBBlocks.sapling, 1, 3), + new int[] {3, 11}, + new AspectList().add(Aspect.PLANT, 3).add(Aspect.ELDRITCH, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(TBItems.fociExperience, 1, 0), + new AspectList() + .add(Aspect.METAL, 24) + .add(Aspect.GREED, 17) + .add(Aspect.CRYSTAL, 12) + .add(Aspect.EARTH, 7) + .add(Aspect.VOID, 5) + .add(Aspect.HUNGER, 5)); - shards[5] = new CrucibleRecipe("TB.OreDestruction", new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 5), new ItemStack(GameRegistry.findBlock("gregtech","gt.blockores"), 1, 544), - new AspectList().add(Aspect.MAGIC, 1).add(Aspect.ENTROPY, 5)); - }else{ + ResearchCategories.registerCategory(catName, icon, back); - for (int i = 0; i < 6; ++i) - shards[i] = new CrucibleRecipe("TB.OreDestruction", new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, i), new ItemStack(ConfigBlocks.blockCustomOre, 1, 1 + i), new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(getPrimalForLoop(i), 3)); - } - CrucibleRecipe[] cBlocks = new CrucibleRecipe[7]; - - for(int i = 0; i < 7; ++i) - if(i < 6) - cBlocks[i] = new CrucibleRecipe("TB.CrystalBlocks",new ItemStack(TBBlocks.crystalBlock,1,i),new ItemStack(ConfigBlocks.blockCrystal,1,i),new AspectList().add(primals(1)).add(Aspect.CRAFT, 2).add(getPrimalForLoop(i), 2)); - else - cBlocks[i] = new CrucibleRecipe("TB.CrystalBlocks",new ItemStack(TBBlocks.crystalBlock,1,i),new ItemStack(ConfigBlocks.blockCrystal,1,i),new AspectList().add(primals(1)).add(Aspect.CRAFT, 2).add(primals(1))); - - CrucibleRecipe[] cTaintedBlocks = new CrucibleRecipe[7]; - - for(int i = 0; i < 7; ++i) - if(i < 6) - cTaintedBlocks[i] = new CrucibleRecipe("TB.CrystalBlocks",new ItemStack(TBBlocks.crystalBlock,1,7),new ItemStack(ConfigBlocks.blockCrystal,1,i),new AspectList().add(primals(1)).add(Aspect.CRAFT, 2).add(getPrimalForLoop(i), 2).add(Aspect.TAINT, 2)); - else - cTaintedBlocks[i] = new CrucibleRecipe("TB.CrystalBlocks",new ItemStack(TBBlocks.crystalBlock,1,7),new ItemStack(ConfigBlocks.blockCrystal,1,i),new AspectList().add(primals(1)).add(Aspect.CRAFT, 2).add(primals(1)).add(Aspect.TAINT, 2)); - - InfusionRecipe voidRodRecipe = new InfusionRecipe("ROD_tbvoid", new ItemStack(TBItems.resource,1,4), 6, new AspectList().add(Aspect.ELDRITCH, 64).add(Aspect.VOID, 64).add(Aspect.MAGIC, 64).add(Aspect.AURA, 24).add(Aspect.ENERGY, 24), new ItemStack(TBItems.resource,1,3), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.crystalBlock,1,7), - new ItemStack(TBBlocks.crystalBlock,1,7) - }); - - InfusionRecipe drainFociRec = new InfusionRecipe("TB.Foci.Drain",new ItemStack(TBItems.fociDrain),0,new AspectList().add(Aspect.WATER, 3).add(Aspect.VOID, 6),new ItemStack(ConfigItems.itemFocusExcavation,1,0),new ItemStack[]{ - new ItemStack(Items.bucket), - new ItemStack(Items.bucket), - new ItemStack(ConfigBlocks.blockJar,1,3), - new ItemStack(ConfigBlocks.blockJar,1,3) - }); - - InfusionRecipe expFociRec = new InfusionRecipe("TB.Foci.Experience",new ItemStack(TBItems.fociExperience),5,new AspectList().add(Aspect.GREED, 32).add(Aspect.VOID, 32).add(Aspect.MIND, 16).add(Aspect.HUNGER, 32).add(Aspect.MINE, 8),new ItemStack(ConfigItems.itemFocusExcavation,1,0),new ItemStack[]{ - new ItemStack(Items.gold_ingot), - new ItemStack(Items.gold_ingot), - new ItemStack(Items.emerald), - new ItemStack(Items.emerald), - new ItemStack(Items.iron_axe,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(Items.iron_pickaxe,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(Items.iron_shovel,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(Items.shears,1,OreDictionary.WILDCARD_VALUE) - }); - - InfusionRecipe fluxFociRec = new InfusionRecipe("TB.Foci.Flux",new ItemStack(TBItems.fociFlux),3,new AspectList().add(Aspect.WATER, 16).add(Aspect.VOID, 16).add(Aspect.ORDER, 16),new ItemStack(Items.diamond,1,0),new ItemStack[]{ - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(ConfigBlocks.blockStoneDevice,1,14), - new ItemStack(ConfigBlocks.blockJar,1,3) - }); - - InfusionRecipe activationFociRec = new InfusionRecipe("TB.Foci.Activation",new ItemStack(TBItems.fociActivation),0,new AspectList().add(Aspect.TRAVEL, 8).add(Aspect.SENSES, 8).add(Aspect.MOTION, 8),new ItemStack(ConfigItems.itemResource,1,10),new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,9), - new ItemStack(ConfigItems.itemResource,1,9), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - Block[] recBlocks = new Block[]{ - Blocks.cobblestone, - Blocks.gravel, - Blocks.mossy_cobblestone, - Blocks.iron_block, - Blocks.diamond_block, - Blocks.lapis_block, - Blocks.gold_block, - Blocks.brick_block - }; - - Block[] recResult = new Block[]{ - TBBlocks.oldCobble, - TBBlocks.oldGravel, - TBBlocks.oldCobbleMossy, - TBBlocks.oldIron, - TBBlocks.oldDiamond, - TBBlocks.oldLapis, - TBBlocks.oldGold, - TBBlocks.oldBrick - }; - - ShapedArcaneRecipe[] oldRec = new ShapedArcaneRecipe[recResult.length]; - - for(int i = 0; i < oldRec.length; ++i) - oldRec[i] = new ShapedArcaneRecipe("TB.DecoBlocks",new ItemStack(recResult[i],6,0),new AspectList().add(Aspect.ENTROPY, 1),new Object[]{ - "# #", - "# #", - "# #", - '#',recBlocks[i] - }); - - ShapedArcaneRecipe advFurnaceRecipe = new ShapedArcaneRecipe("TB.AdvAlc",TBBlocks.advAlchFurnace,new AspectList().add(Aspect.WATER, 20).add(Aspect.FIRE, 20).add(Aspect.AIR, 10),new Object[]{ - "# #", - "#@#", - "$$$", - '#',new ItemStack(ConfigItems.itemResource,1,2), - '@',new ItemStack(ConfigBlocks.blockStoneDevice,1,0), - '$',new ItemStack(ConfigBlocks.blockWoodenDevice,1,0) - }); - - InfusionRecipe cryingObsidianRec = new InfusionRecipe("TB.CryingObs", new ItemStack(TBBlocks.cryingObsidian,1,0), 2, new AspectList().add(Aspect.TRAVEL, 16).add(Aspect.LIFE, 16).add(Aspect.SOUL, 16), new ItemStack(Blocks.obsidian), new ItemStack[]{ - new ItemStack(Items.diamond), - new ItemStack(Items.bed), - new ItemStack(TBBlocks.oldLapis), - new ItemStack(TBBlocks.oldLapis) - }); - - InfusionRecipe overchanterRec = new InfusionRecipe("TB.Overchanter",new ItemStack(TBBlocks.overchanter,1,0),4,new AspectList().add(primals(32)).add(Aspect.MAGIC, 32).add(Aspect.MECHANISM, 32).add(Aspect.MIND, 16),new ItemStack(Blocks.enchanting_table),new ItemStack[]{ - new ItemStack(TBBlocks.crystalBlock,1,0), - new ItemStack(TBBlocks.crystalBlock,1,1), - new ItemStack(TBBlocks.crystalBlock,1,2), - new ItemStack(TBBlocks.crystalBlock,1,3), - new ItemStack(TBBlocks.crystalBlock,1,4), - new ItemStack(TBBlocks.crystalBlock,1,5), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigBlocks.blockCosmeticSolid,1,4), - new ItemStack(ConfigBlocks.blockCosmeticSolid,1,4) - }); - + CrucibleRecipe wool3Rec = new CrucibleRecipe( + "TB.AdvancedEntropy", + new ItemStack(Items.string, 3, 0), + new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.ENTROPY, 1)); + CrucibleRecipe sandstone3Rec = new CrucibleRecipe( + "TB.AdvancedEntropy", + new ItemStack(Blocks.sand, 3, 0), + new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.ENTROPY, 1)); + CrucibleRecipe blaze3Rec = new CrucibleRecipe( + "TB.AdvancedEntropy", + new ItemStack(Items.blaze_powder, 3, 0), + new ItemStack(Items.blaze_rod, 1, 0), + new AspectList().add(Aspect.ENTROPY, 1)); - - - ShapedArcaneRecipe relocatorRec = new ShapedArcaneRecipe("TB.Relocator",new ItemStack(TBBlocks.relocator,1,0),new AspectList().add(Aspect.AIR, 5).add(Aspect.EARTH, 15).add(Aspect.WATER, 5),new Object[]{ - "GAG", - "ENE", - "GWG", - 'G',new ItemStack(ConfigBlocks.blockWoodenDevice,1,6), - 'A',"shardAir", - 'E',"shardEarth", - 'W',"shardWater", - 'N',new ItemStack(ConfigItems.itemResource,1,1) - }); - - ShapedArcaneRecipe irelocatorRec = new ShapedArcaneRecipe("TB.Relocator",new ItemStack(TBBlocks.relocator,1,6),new AspectList().add(Aspect.AIR, 5).add(Aspect.EARTH, 15).add(Aspect.WATER, 5),new Object[]{ - "GAG", - "ENE", - "GWG", - 'G',new ItemStack(ConfigBlocks.blockWoodenDevice,1,6), - 'A',"shardAir", - 'E',"shardEarth", - 'W',"shardWater", - 'N',new ItemStack(ConfigItems.itemResource,1,0) - }); - - - - ShapedArcaneRecipe thaumicAnvilRec = new ShapedArcaneRecipe("TB.ThaumicAnvil",new ItemStack(TBBlocks.thaumicAnvil,1,0),primals(25),new Object[]{ - "###", - " $ ", - "$$$", - '#',new ItemStack(ConfigBlocks.blockCosmeticSolid,1,4), - '$',new ItemStack(ConfigItems.itemResource,1,2) - }); - - InfusionRecipe voidAnvilRec = new InfusionRecipe("TB.VoidAnvil",new ItemStack(TBBlocks.voidAnvil,1,0),3,new AspectList().add(Aspect.CRAFT,32).add(Aspect.TOOL, 24).add(Aspect.WEAPON,24).add(Aspect.ORDER, 48),new ItemStack(TBBlocks.thaumicAnvil,1,OreDictionary.WILDCARD_VALUE),new ItemStack[]{ - new ItemStack(TBBlocks.voidBlock), - new ItemStack(TBBlocks.voidBlock), - new ItemStack(TBBlocks.voidBlock), - new ItemStack(TBBlocks.voidBlock), - new ItemStack(TBBlocks.voidBlock) - }); - + CrucibleRecipe wool4Rec = new CrucibleRecipe( + "TB.MasterEntropy", + new ItemStack(Items.string, 4, 0), + new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.CRAFT, 1)); + CrucibleRecipe sandstone4Rec = new CrucibleRecipe( + "TB.MasterEntropy", + new ItemStack(Blocks.sand, 4, 0), + new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.CRAFT, 1)); + CrucibleRecipe blaze4Rec = new CrucibleRecipe( + "TB.MasterEntropy", + new ItemStack(Items.blaze_powder, 4, 0), + new ItemStack(Items.blaze_rod, 1, 0), + new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.CRAFT, 1)); - ShapedArcaneRecipe campfireRec = new ShapedArcaneRecipe("TB.Campfire",new ItemStack(TBBlocks.campfire),new AspectList().add(Aspect.FIRE, 5).add(Aspect.ENTROPY, 3),new Object[]{ - "SSS", - "COC", - "GGG", - 'S',"stickWood", - 'C',"cobblestone", - 'O',new ItemStack(Items.coal,1,OreDictionary.WILDCARD_VALUE), - 'G',Blocks.gravel - }); - - ShapedArcaneRecipe brazierRec = new ShapedArcaneRecipe("TB.Brazier",new ItemStack(TBBlocks.braizer),new AspectList().add(Aspect.FIRE, 5).add(Aspect.ENTROPY, 3),new Object[]{ - "SCS", - " V ", - "SSS", - 'S',new ItemStack(ConfigBlocks.blockSlabStone,1,0), - 'C',new ItemStack(Items.coal,1,OreDictionary.WILDCARD_VALUE), - 'V',new ItemStack(ConfigBlocks.blockCosmeticSolid,1,6) - }); - - ShapedOreRecipe voidBlockRec = new ShapedOreRecipe(new ItemStack(TBBlocks.voidBlock,1,0),new Object[]{ - "###", - "###", - "###", - '#',new ItemStack(ConfigItems.itemResource,1,16) - }); - - ShapelessOreRecipe voidIngotRec = new ShapelessOreRecipe(new ItemStack(ConfigItems.itemResource,9,16),new ItemStack(TBBlocks.voidBlock)); - - - //TODO recipes - - - //copy(ResearchCategories.getResearchList("ALCHEMY").research.get("CRUCIBLE"),"TB.CRUCIBLE",catName,0,3).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("ALCHEMY").research.get("THAUMIUM"),"TB.THAUMIUM",catName,8,0).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("ALCHEMY").research.get("DISTILESSENTIA"),"TB.DISTILESSENTIA",catName,6,2).setConcealed().setHidden().registerResearchItem(); - - //copy(ResearchCategories.getResearchList("ARTIFICE").research.get("INFUSION"),"TB.INFUSION",catName,0,-3).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("ARTIFICE").research.get("BELLOWS"),"TB.BELLOWS",catName,6,3).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("ARTIFICE").research.get("LEVITATOR"),"TB.LEVITATOR",catName,6,5).setConcealed().setHidden().registerResearchItem(); - - //copy(ResearchCategories.getResearchList("ELDRITCH").research.get("VOIDMETAL"),"TB.VOIDMETAL",catName,15,1).setConcealed().setHidden().registerResearchItem(); - - new FakeResearchItem("TB.CRUCIBLE", "THAUMICBASES", "CRUCIBLE", "ALCHEMY", 0, 3, ResearchCategories.getResearch("CRUCIBLE").icon_item).registerResearchItem(); - new FakeResearchItem("TB.THAUMIUM", "THAUMICBASES", "THAUMIUM", "ALCHEMY", 8, 0, ResearchCategories.getResearch("THAUMIUM").icon_item).registerResearchItem(); - new FakeResearchItem("TB.DISTILESSENTIA", "THAUMICBASES", "DISTILESSENTIA", "ALCHEMY", 6, 2, ResearchCategories.getResearch("DISTILESSENTIA").icon_item).registerResearchItem(); - - new FakeResearchItem("TB.INFUSION", "THAUMICBASES", "INFUSION", "ARTIFICE", 0, -3, ResearchCategories.getResearch("INFUSION").icon_item).registerResearchItem(); - new FakeResearchItem("TB.BELLOWS", "THAUMICBASES", "BELLOWS", "ARTIFICE", 6, 3, ResearchCategories.getResearch("BELLOWS").icon_item).registerResearchItem(); - new FakeResearchItem("TB.LEVITATOR", "THAUMICBASES", "LEVITATOR", "ARTIFICE", 6, 5, ResearchCategories.getResearch("LEVITATOR").icon_item).registerResearchItem(); - - new FakeResearchItem("TB.VOIDMETAL", "THAUMICBASES", "VOIDMETAL", "ELDRITCH", 15, 1, ResearchCategories.getResearch("VOIDMETAL").icon_item).registerResearchItem(); + CrucibleRecipe glassSand = new CrucibleRecipe( + "TB.StrongEntropy", + new ItemStack(Blocks.sand, 1, 0), + "blockGlass", + new AspectList().add(Aspect.ENTROPY, 1)); + CrucibleRecipe gravelSand = new CrucibleRecipe( + "TB.StrongEntropy", + new ItemStack(Blocks.sand, 1, 0), + new ItemStack(Blocks.gravel), + new AspectList().add(Aspect.ENTROPY, 1)); + CrucibleRecipe barsIron = new CrucibleRecipe( + "TB.StrongEntropy", + new ItemStack(ConfigItems.itemNugget, 3, 0), + new ItemStack(Blocks.iron_bars), + new AspectList().add(Aspect.ENTROPY, 1)); - - //-2,-18 - //5,-3 - - IRecipe[] slabs = new IRecipe[12]; - slabs = TBRecipes.slabs.toArray(slabs); - - new ResearchItem("TB.DecoBlocks",catName,new AspectList(),0,2,0,new ItemStack(TBBlocks.quicksilverBlock,1,0)) - .setRound() - .setAutoUnlock() - .setPages( - new ResearchPage("tb.rec.decoBlocks.page.0"), - new ResearchPage(TBRecipes.recipes.get("quicksilverBlock")), - new ResearchPage(TBRecipes.recipes.get("quicksilver")), - new ResearchPage(TBRecipes.recipes.get("quicksilverBrick")), - new ResearchPage(TBRecipes.recipes.get("eldritchArk")), - new ResearchPage(TBRecipes.recipes.get("ironGreatwood")), - new ResearchPage(oldRec), - new ResearchPage(slabs) - ).registerResearchItem(); - - new ResearchItem("TB.AdvancedEntropy",catName,new AspectList().add(Aspect.ENTROPY, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3),-3,2,1,new ItemStack(Items.blaze_powder,1,0)) - .setParents("TB.CRUCIBLE") - .setPages( - new ResearchPage("tb.rec.advEntr.page.0"), - new ResearchPage(wool3Rec), - new ResearchPage(sandstone3Rec), - new ResearchPage(blaze3Rec) - ).registerResearchItem(); - - new ResearchItem("TB.AlchemyRestoration",catName,new AspectList().add(Aspect.ORDER, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3),-3,4,1,new ItemStack(Blocks.packed_ice,1,0)) - .setParents("TB.CRUCIBLE") - .setPages( - new ResearchPage("tb.rec.alcRest.page.0"), - new ResearchPage(chiseledBricks), - new ResearchPage(gravel2Cobble), - new ResearchPage(icePacking) - ).registerResearchItem(); - - new ResearchItem("TB.Pyrofluid",catName,new AspectList().add(Aspect.FIRE, 16).add(Aspect.MAGIC, 6).add(Aspect.ELDRITCH, 8).add(Aspect.GREED, 6),1,6,4,new ItemStack(TBItems.pyroBucket,1,0)) - .setParents("TB.CRUCIBLE") - .setPages( - new ResearchPage("tb.rec.pyrofluid.page.0"), - new ResearchPage(pyrofluidRec) - ).registerResearchItem(); - - new ResearchItem("TB.CrystalBlocks",catName,new AspectList().add(primals(8)),-4,5,1,new ItemStack(TBBlocks.crystalBlock,1,OreDictionary.WILDCARD_VALUE)) - .setParents("TB.AlchemyRestoration") - .setPages( - new ResearchPage("tb.rec.cBlocks.page.0"), - new ResearchPage(cBlocks), - new ResearchPage(cTaintedBlocks) - ).registerResearchItem(); - - new ResearchItem("TB.Backprocessing",catName,new AspectList().add(Aspect.ORDER, 8).add(Aspect.EXCHANGE, 8).add(Aspect.CRAFT, 8),-6,3,1,new ItemStack(Items.reeds,1,0)) - .setParents("TB.AlchemyRestoration","TB.AdvancedEntropy") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.backProc.page.0"), - new ResearchPage(blazepowderRest), - new ResearchPage(boneRest), - new ResearchPage(sugarRest), - new ResearchPage(cactiRest) - ).registerResearchItem(); - - //0, -3 - - new ResearchItem("TB.MasterEntropy",catName,new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.MAGIC, 4).add(Aspect.GREED, 2),-5,1,3,new ItemStack(Items.string,1,0)) - .setParents("TB.AdvancedEntropy") - .setPages( - new ResearchPage("tb.rec.mastEntr.page.0"), - new ResearchPage(wool4Rec), - new ResearchPage(sandstone4Rec), - new ResearchPage(blaze4Rec) - ).registerResearchItem(); - - new ResearchItem("TB.StrongEntropy",catName,new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.WEAPON, 2),-1,1,3,new ItemStack(Blocks.sand,1,0)) - .setParents("TB.AdvancedEntropy") - .setSecondary() - .setPages( - new ResearchPage("tb.rec.strEntr.page.0"), - new ResearchPage(glassSand), - new ResearchPage(gravelSand), - new ResearchPage(barsIron) - ).registerResearchItem(); - - new ResearchItem("TB.SimpleDublication",catName,new AspectList().add(Aspect.EXCHANGE, 6).add(Aspect.ORDER, 6),3,5,1,new ItemStack(Items.arrow,1,0)) - .setParents("TB.CRUCIBLE") - .setSecondary() - .setPages( - new ResearchPage("tb.rec.simDup.page.0"), - new ResearchPage(arrows), - new ResearchPage(snowball), - new ResearchPage(redstone) - ).registerResearchItem(); - - new ResearchItem("TB.Amber",catName,new AspectList().add(Aspect.TRAP, 6).add(Aspect.ORDER, 6),3,4,1,new ItemStack(ConfigItems.itemResource,1,6)) - .setParents("TB.CRUCIBLE") - .setSecondary() - .setPages( - new ResearchPage("tb.rec.amber.page.0"), - new ResearchPage(amber) - ).registerResearchItem(); - - new ResearchItem("TB.Quicksilver",catName,new AspectList().add(Aspect.TREE, 6).add(Aspect.ORDER, 6),3,2,1,new ItemStack(ConfigItems.itemResource,1,3)) - .setParents("TB.CRUCIBLE") - .setSecondary() - .setPages( - new ResearchPage("tb.rec.cinnabar.page.0"), - new ResearchPage(cinnabar) - ).registerResearchItem(); - - new ResearchItem("TB.Thauminite",catName,new AspectList().add(Aspect.METAL, 4).add(Aspect.MAGIC, 3).add(Aspect.CRYSTAL, 8).add(Aspect.CRAFT, 2),6,-1,2,new ItemStack(TBItems.resource,1,1)) - .setParents("TB.THAUMIUM") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.thauminite.page.0"), - new ResearchPage(thauminiteRec), - new ResearchPage(TBRecipes.recipes.get("thauminiteIngot")), - new ResearchPage(TBRecipes.recipes.get("thauminiteNugget")), - new ResearchPage(TBRecipes.recipes.get("thauminiteBlock")), - new ResearchPage(toolsRec) - ).registerResearchItem(); - - new ResearchItem("ROD_tbthaumium",catName,new AspectList().add(Aspect.METAL, 4).add(Aspect.MAGIC, 3).add(Aspect.AURA, 4).add(Aspect.CRAFT, 2).add(Aspect.MAN, 6),10,-1,2,new ItemStack(TBItems.resource,1,3)) - .setParents("TB.THAUMIUM") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.thaumRod.page.0"), - new ResearchPage(thaumicWandCore) - ).registerResearchItem(); - - new ResearchItem("ROD_tbvoid",catName,new AspectList().add(Aspect.ELDRITCH, 4).add(Aspect.MAGIC, 3).add(Aspect.AURA, 4).add(Aspect.VOID, 2).add(Aspect.MIND, 6),13,-1,4,new ItemStack(TBItems.resource,1,4)) - .setParents("ROD_tbthaumium","TB.VOIDMETAL") - .setConcealed() - .setSpecial() - .setPages( - new ResearchPage("tb.rec.voidRod.page.0"), - new ResearchPage(voidRodRecipe) - ).registerResearchItem(); - - new ResearchItem("CAP_thauminite",catName,new AspectList().add(Aspect.METAL, 4).add(Aspect.MAGIC, 3).add(Aspect.AURA, 4),5,0,2,new ItemStack(TBItems.resource,1,2)) - .setParents("TB.Thauminite") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.capthauminite.page.0"), - new ResearchPage(thauminiteCaps) - ).registerResearchItem(); - - new ResearchItem("TB.SM",catName,new AspectList().add(primals(4)),3,3,1,new ItemStack(ConfigItems.itemResource,1,14)) - .setParents("TB.CRUCIBLE","TB.Quicksilver","TB.Amber") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.sm.page.0"), - new ResearchPage(salisMundis) - ).registerResearchItem(); - - new ResearchItem("TB.SMB",catName,new AspectList().add(primals(6)).add(Aspect.CRAFT, 2),4,3,1,new ItemStack(TBBlocks.dustBlock)) - .setParents("TB.SM") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.smb.page.0"), - new ResearchPage(salisMundusBlockRec) - ).registerResearchItem(); - - new ResearchItem("TB.OreDestruction",catName,new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.MAGIC, 4).add(Aspect.ORDER, 1).add(Aspect.FIRE, 1).add(Aspect.AIR, 1).add(Aspect.EARTH, 1).add(Aspect.WATER, 1),-7,1,3,new ItemStack(ConfigItems.itemShard,1,OreDictionary.WILDCARD_VALUE)) - .setParents("TB.MasterEntropy") - .setPages( - new ResearchPage("tb.rec.oreDestr.page.0"), - new ResearchPage(shards) - ).registerResearchItem(); - - - //copy(ResearchCategories.getResearchList("ARTIFICE").research.get("INFUSIONENCHANTMENT"), "TB.INFUSIONENCHANTMENT", catName, 0, 8).setHidden().registerResearchItem(); - - new FakeResearchItem("TB.INFUSIONENCHANTMENT", "THAUMICBASES", "INFUSIONENCHANTMENT", "ARTIFICE", 0, 8, ResearchCategories.getResearch("INFUSIONENCHANTMENT").icon_resource).registerResearchItem(); - - new ResearchItem("TB.ElderKnowledge",catName,new AspectList().add(Aspect.MAGIC, 8).add(Aspect.MIND, 8).add(Aspect.WEAPON, 8),-2,8,1,new ResourceLocation("thaumicbases","textures/enchantments/elder_knowledge.png")) - .setParents("TB.INFUSIONENCHANTMENT") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.enchantments.ewisdom"), - new ResearchPage(elderKnowledgeEnch) - ).registerResearchItem(); - - new ResearchItem("TB.EldritchBane",catName,new AspectList().add(Aspect.DEATH, 8).add(Aspect.ELDRITCH, 8).add(Aspect.WEAPON, 8),-1,10,1,new ResourceLocation("thaumicbases","textures/enchantments/eldritch_bane.png")) - .setParents("TB.INFUSIONENCHANTMENT") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.enchantments.ebane"), - new ResearchPage(elderBaneEnch) - ).registerResearchItem(); - - new ResearchItem("TB.MagicTouch",catName,new AspectList().add(Aspect.MAGIC, 8).add(Aspect.AURA, 8).add(Aspect.WEAPON, 8),-1,6,1,new ResourceLocation("thaumicbases","textures/enchantments/magic_touched.png")) - .setParents("TB.INFUSIONENCHANTMENT") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.enchantments.magictouched"), - new ResearchPage(magicTouchEnch) - ).registerResearchItem(); - - new ResearchItem("TB.Vaporising",catName,new AspectList().add(Aspect.MAGIC, 8).add(Aspect.CRYSTAL, 8).add(Aspect.TRAP, 8),-3,7,1,new ResourceLocation("thaumicbases","textures/enchantments/vaporising.png")) - .setParents("TB.INFUSIONENCHANTMENT") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.enchantments.vaporising"), - new ResearchPage(vaporisingEnch) - ).registerResearchItem(); - - new ResearchItem("TB.Tainted",catName,new AspectList().add(Aspect.TAINT, 16),-3,9,1,new ResourceLocation("thaumicbases","textures/enchantments/tainted.png")) - .setParents("TB.INFUSIONENCHANTMENT") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.enchantments.taint"), - new ResearchPage(taintedEnch) - ).registerResearchItem(); - - - - - - new ResearchItem("TB.Foci.Drain",catName,new AspectList().add(Aspect.WATER, 6).add(Aspect.VOID, 3),-3,-2,0,new ItemStack(TBItems.fociDrain)) - .setParents("TB.INFUSION") - .setParentsHidden("FOCUSEXCAVATION","JARVOID") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.drainFoci.page.0"), - new ResearchPage(drainFociRec), - new ResearchPage("tb.rec.drainFoci.page.1"), - new ResearchPage("tb.rec.drainFoci.page.2") - ).registerResearchItem(); - - new ResearchItem("TB.Foci.Experience",catName,new AspectList().add(Aspect.GREED, 16).add(Aspect.HUNGER, 16).add(Aspect.MINE, 2).add(Aspect.MIND, 8),-2,-5 ,1,new ItemStack(TBItems.fociExperience)) - .setParents("TB.INFUSION") - .setParentsHidden("FOCUSEXCAVATION") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.expFoci.page.0"), - new ResearchPage(expFociRec), - new ResearchPage("tb.rec.expFoci.page.1"), - new ResearchPage("tb.rec.expFoci.page.2") - ).registerResearchItem(); - - new ResearchItem("TB.Foci.Flux",catName,new AspectList().add(Aspect.WATER, 4).add(Aspect.ORDER, 4).add(Aspect.VOID, 4),-2,-1,0,new ItemStack(TBItems.fociFlux)) - .setParents("TB.INFUSION") - .setParentsHidden("JARVOID","FLUXSCRUB") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.fluxFoci.page.0"), - new ResearchPage(fluxFociRec), - new ResearchPage("tb.rec.fluxFoci.page.1"), - new ResearchPage("tb.rec.fluxFoci.page.2"), - new ResearchPage("tb.rec.fluxFoci.page.3") - ).registerResearchItem(); - - new ResearchItem("TB.Foci.Activation",catName,new AspectList().add(Aspect.TRAVEL, 4).add(Aspect.MOTION, 4).add(Aspect.SENSES, 4),-3,-4,0,new ItemStack(TBItems.fociActivation)) - .setParents("TB.INFUSION") - .setParentsHidden("MIRRORHAND") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.actFoci.page.0"), - new ResearchPage(activationFociRec), - new ResearchPage("tb.rec.actFoci.page.1") - ).registerResearchItem(); - - new ResearchItem("TB.AdvAlc",catName,new AspectList().add(Aspect.MOTION, 16).add(Aspect.AIR, 16).add(Aspect.FIRE, 8).add(Aspect.CRAFT, 4),8,2,2,new ItemStack(TBBlocks.advAlchFurnace)) - .setParents("TB.THAUMIUM","TB.DISTILESSENTIA","TB.BELLOWS") - .setPages( - new ResearchPage("tb.rec.advAlc.page.0"), - new ResearchPage(advFurnaceRecipe) - ).registerResearchItem(); + CrucibleRecipe arrows = new CrucibleRecipe( + "TB.SimpleDublication", + new ItemStack(Items.arrow, 2, 0), + new ItemStack(Items.arrow, 1, 0), + new AspectList().add(Aspect.WEAPON, 1)); + CrucibleRecipe snowball = new CrucibleRecipe( + "TB.SimpleDublication", + new ItemStack(Items.snowball, 2, 0), + new ItemStack(Items.snowball, 1, 0), + new AspectList().add(Aspect.COLD, 1)); + CrucibleRecipe redstone = new CrucibleRecipe( + "TB.SimpleDublication", + new ItemStack(Items.redstone, 2, 0), + new ItemStack(Items.redstone, 1, 0), + new AspectList().add(Aspect.MECHANISM, 1).add(Aspect.ENERGY, 1)); - new ResearchItem("TB.CryingObs",catName,new AspectList().add(Aspect.TRAVEL, 8).add(Aspect.LIFE, 8).add(Aspect.SOUL, 8),3,-4,2,new ItemStack(TBBlocks.cryingObsidian,1,0)) - .setParents("TB.INFUSION") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.cryingObs.page.0"), - new ResearchPage(cryingObsidianRec) - ).registerResearchItem(); - - new ResearchItem("TB.Overchanter",catName,new AspectList().add(primals(8)).add(Aspect.MIND, 8).add(Aspect.MAGIC, 8),-5,-3,3,new ItemStack(TBBlocks.overchanter,1,0)) - .setParents("TB.INFUSION") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.overchanter.page.0"), - new ResearchPage("tb.rec.overchanter.page.1"), - new ResearchPage("tb.rec.overchanter.page.2"), - new ResearchPage(overchanterRec) - ).registerResearchItem(); - - + CrucibleRecipe amber = new CrucibleRecipe( + "TB.Amber", + new ItemStack(ConfigItems.itemResource, 1, 6), + new ItemStack(Blocks.sapling, 1, 1), + new AspectList().add(Aspect.TRAP, 2)); + CrucibleRecipe cinnabar = new CrucibleRecipe( + "TB.Quicksilver", + new ItemStack(ConfigItems.itemResource, 3, 3), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), + new AspectList().add(Aspect.ORDER, 1).add(Aspect.POISON, 1)); + CrucibleRecipe salisMundis = new CrucibleRecipe( + "TB.SM", + new ItemStack(ConfigItems.itemResource, 2, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new AspectList().add(primals(2)).add(Aspect.MAGIC, 3)); - new ResearchItem("TB.Relocator",catName,new AspectList().add(Aspect.MOTION, 4).add(Aspect.AIR, 4).add(Aspect.VOID, 4),6,7,1,new ItemStack(TBBlocks.relocator,1,0)) - .setParents("TB.LEVITATOR") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.relocator.page.0"), - new ResearchPage(relocatorRec), - new ResearchPage(irelocatorRec) - ).registerResearchItem(); - - new ResearchItem("TB.ThaumicAnvil",catName,new AspectList().add(Aspect.METAL, 4).add(Aspect.CRAFT, 3),10,2,2,new ItemStack(TBBlocks.thaumicAnvil,1,0)) - .setParents("TB.THAUMIUM") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.thaumicAnvil.page.0"), - new ResearchPage(thaumicAnvilRec) - ).registerResearchItem(); - - new ResearchItem("TB.VoidAnvil",catName,new AspectList().add(Aspect.METAL, 4).add(Aspect.CRAFT, 3).add(Aspect.TOOL,4).add(Aspect.ELDRITCH, 4),13,2,2,new ItemStack(TBBlocks.voidAnvil,1,0)) - .setParents("TB.VOIDMETAL","TB.ThaumicAnvil") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.voidAnvil.page.0"), - new ResearchPage("tb.rec.voidAnvil.page.1"), - new ResearchPage(voidAnvilRec) - ).registerResearchItem(); - - new ResearchItem("TB.Campfire",catName,new AspectList().add(Aspect.FIRE, 3).add(Aspect.MIND, 3).add(Aspect.ENTROPY, 3),9,5,1,new ItemStack(TBBlocks.campfire,1,0)) - .setRound() - .setPages( - new ResearchPage("tb.rec.campfire.page.0"), - new ResearchPage(campfireRec) - ).registerResearchItem(); - - new ResearchItem("TB.Brazier",catName,new AspectList().add(Aspect.FIRE, 3).add(Aspect.MIND, 3).add(Aspect.ENTROPY, 3).add(Aspect.MAGIC, 3).add(Aspect.MOTION, 3),9,7,0,new ItemStack(TBBlocks.braizer,1,0)) - .setParents("TB.Campfire") - .setSecondary() - .setPages( - new ResearchPage("tb.rec.brazier.page.0"), - new ResearchPage(brazierRec) - ).registerResearchItem(); - - - - - //TODO last recipes - //-4,-14 - + CrucibleRecipe chiseledBricks = new CrucibleRecipe( + "TB.AlchemyRestoration", + new ItemStack(Blocks.stonebrick, 1, 3), + new ItemStack(Blocks.stonebrick, 1, 0), + new AspectList().add(Aspect.ORDER, 1)); + CrucibleRecipe gravel2Cobble = new CrucibleRecipe( + "TB.AlchemyRestoration", + new ItemStack(Blocks.cobblestone, 1, 0), + new ItemStack(Blocks.gravel, 1, 0), + new AspectList().add(Aspect.ORDER, 1)); + CrucibleRecipe icePacking = new CrucibleRecipe( + "TB.AlchemyRestoration", + new ItemStack(Blocks.packed_ice, 1, 0), + new ItemStack(Blocks.ice, 1, 0), + new AspectList().add(Aspect.EARTH, 1).add(Aspect.COLD, 3)); - - //Add warp to research - ThaumcraftApi.addWarpToResearch("TB.HerobrinesScythe", 4); - //ench - ThaumcraftApi.addWarpToResearch("TB.Tainted", 3); - - ThaumcraftApi.addWarpToResearch("TB.CryingObs", 1); - ThaumcraftApi.addWarpToResearch("TB.EntityDec", 2); - ThaumcraftApi.addWarpToResearch("TB.VoidAnvil", 2); + CrucibleRecipe blazepowderRest = new CrucibleRecipe( + "TB.Backprocessing", + new ItemStack(Items.blaze_rod, 1, 0), + new ItemStack(Items.blaze_powder, 1, 0), + new AspectList() + .add(Aspect.ORDER, 6) + .add(Aspect.FIRE, 3) + .add(Aspect.MAGIC, 2) + .add(Aspect.CRAFT, 8) + .add(Aspect.EXCHANGE, 6) + .add(Aspect.ENERGY, 3)); + CrucibleRecipe boneRest = new CrucibleRecipe( + "TB.Backprocessing", + new ItemStack(Items.bone, 1, 0), + new ItemStack(Items.dye, 1, 15), + new AspectList() + .add(Aspect.ORDER, 2) + .add(Aspect.SENSES, 6) + .add(Aspect.CRAFT, 2) + .add(Aspect.EXCHANGE, 1) + .add(Aspect.DEATH, 4)); + CrucibleRecipe sugarRest = new CrucibleRecipe( + "TB.Backprocessing", + new ItemStack(Items.reeds, 1, 0), + new ItemStack(Items.sugar, 1, 0), + new AspectList().add(Aspect.ORDER, 1).add(Aspect.LIFE, 2)); + CrucibleRecipe cactiRest = new CrucibleRecipe( + "TB.Backprocessing", + new ItemStack(Blocks.cactus, 1, 0), + new ItemStack(Items.dye, 1, 2), + new AspectList().add(Aspect.ORDER, 1).add(Aspect.LIFE, 2).add(Aspect.EARTH, 1)); + CrucibleRecipe pyrofluidRec = new CrucibleRecipe( + "TB.Pyrofluid", + new ItemStack(TBItems.pyroBucket, 1, 0), + new ItemStack(Items.lava_bucket, 1, 0), + new AspectList().add(Aspect.FIRE, 24).add(Aspect.MAGIC, 8)); - //Add new crudible recips - ThaumcraftApi.getCraftingRecipes().add(wool3Rec); - ThaumcraftApi.getCraftingRecipes().add(sandstone3Rec); - ThaumcraftApi.getCraftingRecipes().add(blaze3Rec); - ThaumcraftApi.getCraftingRecipes().add(wool4Rec); - ThaumcraftApi.getCraftingRecipes().add(sandstone4Rec); - ThaumcraftApi.getCraftingRecipes().add(blaze4Rec); - ThaumcraftApi.getCraftingRecipes().add(glassSand); - ThaumcraftApi.getCraftingRecipes().add(gravelSand); - ThaumcraftApi.getCraftingRecipes().add(barsIron); - ThaumcraftApi.getCraftingRecipes().add(arrows); - ThaumcraftApi.getCraftingRecipes().add(snowball); - ThaumcraftApi.getCraftingRecipes().add(redstone); - ThaumcraftApi.getCraftingRecipes().add(amber); - - //Infusion enchants - ThaumcraftApi.getCraftingRecipes().add(elderKnowledgeEnch); - ThaumcraftApi.getCraftingRecipes().add(elderBaneEnch); - ThaumcraftApi.getCraftingRecipes().add(magicTouchEnch); - ThaumcraftApi.getCraftingRecipes().add(vaporisingEnch); - ThaumcraftApi.getCraftingRecipes().add(taintedEnch); - - // - ThaumcraftApi.getCraftingRecipes().add(cinnabar); - ThaumcraftApi.getCraftingRecipes().add(salisMundis); - ThaumcraftApi.getCraftingRecipes().add(chiseledBricks); - ThaumcraftApi.getCraftingRecipes().add(gravel2Cobble); - ThaumcraftApi.getCraftingRecipes().add(icePacking); - ThaumcraftApi.getCraftingRecipes().add(blazepowderRest); - ThaumcraftApi.getCraftingRecipes().add(boneRest); - ThaumcraftApi.getCraftingRecipes().add(sugarRest); - ThaumcraftApi.getCraftingRecipes().add(cactiRest); - - ThaumcraftApi.getCraftingRecipes().add(salisMundusBlockRec); - - ThaumcraftApi.getCraftingRecipes().add(thauminiteRec); - ThaumcraftApi.getCraftingRecipes().add(thauminiteCaps); - - ThaumcraftApi.getCraftingRecipes().add(pyrofluidRec); - + InfusionEnchantmentRecipe elderKnowledgeEnch = new InfusionEnchantmentRecipe( + "TB.ElderKnowledge", + TBEnchant.elderKnowledge, + 2, + new AspectList().add(Aspect.MAGIC, 8).add(Aspect.MIND, 8).add(Aspect.WEAPON, 8), + new ItemStack[] { + new ItemStack(Items.paper, 1, 0), + new ItemStack(Items.paper, 1, 0), + new ItemStack(Items.paper, 1, 0), + new ItemStack(ConfigItems.itemZombieBrain, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + InfusionEnchantmentRecipe elderBaneEnch = new InfusionEnchantmentRecipe( + "TB.Eldritchbane", + TBEnchant.eldritchBane, + 2, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.ELDRITCH, 8).add(Aspect.WEAPON, 8), + new ItemStack[] { + new ItemStack(Items.ender_pearl, 1, 0), + new ItemStack(Items.ender_eye, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + InfusionEnchantmentRecipe magicTouchEnch = new InfusionEnchantmentRecipe( + "TB.MagicTouch", + TBEnchant.magicTouch, + 2, + new AspectList().add(Aspect.MAGIC, 8).add(Aspect.AURA, 8).add(Aspect.WEAPON, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.paper, 1, 0) + }); + InfusionEnchantmentRecipe vaporisingEnch = new InfusionEnchantmentRecipe( + "TB.Vaporising", + TBEnchant.vaporising, + 2, + new AspectList().add(Aspect.MAGIC, 8).add(Aspect.CRYSTAL, 8).add(Aspect.TRAP, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.diamond, 1, 0) + }); + InfusionEnchantmentRecipe taintedEnch = new InfusionEnchantmentRecipe( + "TB.Tainted", TBEnchant.tainted, 5, new AspectList().add(Aspect.TAINT, 16), new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 11), + new ItemStack(ConfigItems.itemResource, 1, 12), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); - ThaumcraftApi.getCraftingRecipes().add(thaumicWandCore); - ThaumcraftApi.getCraftingRecipes().add(voidRodRecipe); + ShapelessArcaneRecipe salisMundusBlockRec = + new ShapelessArcaneRecipe("TB.SMB", TBBlocks.dustBlock, new AspectList().add(primals(1)), new Object[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + // thauminite + CrucibleRecipe thauminiteRec = new CrucibleRecipe( + "TB.Thauminite", + new ItemStack(TBItems.resource, 8, 0), + new ItemStack(ConfigItems.itemResource, 1, 2), + new AspectList().add(Aspect.METAL, 4).add(Aspect.CRYSTAL, 8).add(Aspect.MAGIC, 2)); - //TODO Tobacco - if(TBConfig.allowTobacco) - { - - ThaumcraftApi.addWarpToResearch("TB.Tobacco.Eldritch", 2); - ThaumcraftApi.addWarpToResearch("TB.Tobacco.Tainted", 3); - - ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.tobacco,1,1), 1); - - ShapelessArcaneRecipe saturatingTobaccoRec = new ShapelessArcaneRecipe("TB.Tobacco.Saturating",new ItemStack(TBItems.tobacco,1,3),new AspectList().add(Aspect.EARTH, 10).add(Aspect.FIRE, 10).add(Aspect.WATER, 10),new Object[]{new ItemStack(TBItems.tobacco,1,0),new ItemStack(Items.pumpkin_seeds)}); - ShapelessArcaneRecipe saturatingTobaccoRecM = new ShapelessArcaneRecipe("TB.Tobacco.Saturating",new ItemStack(TBItems.tobacco,1,3),new AspectList().add(Aspect.EARTH, 10).add(Aspect.FIRE, 10).add(Aspect.WATER, 10),new Object[]{new ItemStack(TBItems.tobacco,1,0),new ItemStack(Items.melon_seeds)}); - - //Seeds - CrucibleRecipe tobaccoSeedRec = new CrucibleRecipe("TB.Tobacco",new ItemStack(TBItems.tobaccoSeeds,1,0),new ItemStack(Items.wheat_seeds,1,0),new AspectList().add(Aspect.MIND, 4).add(Aspect.WATER, 4).add(Aspect.MAN, 4).add(Aspect.CROP, 4)); - - //M&P - ShapelessArcaneRecipe pestleRecipe = new ShapelessArcaneRecipe("TB.Tobacco",TBItems.mortar,new AspectList().add(primals(4)),new Object[]{ - new ItemStack(Items.bowl), - new ItemStack(Items.stick), - new ItemStack(Blocks.wooden_slab), - new ItemStack(Blocks.wooden_slab), - new ItemStack(Blocks.wooden_slab) - }); - - ShapelessArcaneRecipe genTobaccoRec = new ShapelessArcaneRecipe("TB.Tobacco",new ItemStack(TBItems.tobacco,1,0),new AspectList().add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1), new Object[]{ - "pestleAndMortar", - new ItemStack(TBItems.resource,1,7) - }); - - - //GW pipe - ShapedArcaneRecipe pipeRecipe = new ShapedArcaneRecipe("TB.Tobacco",TBItems.greatwoodPipe,new AspectList().add(primals(4)),new Object[]{ - "#@ ", - " ##", - '#',new ItemStack(ConfigBlocks.blockWoodenDevice,1,6), - '@',new ItemStack(ConfigItems.itemResource,1,14) - }); - - new ResearchItem("TB.Tobacco",catName,new AspectList().add(Aspect.CROP, 4).add(Aspect.HARVEST, 4).add(Aspect.MAN, 4).add(Aspect.MIND, 4),11,-7,3,new ItemStack(TBItems.greatwoodPipe,1,0)) - .setParentsHidden("TB.Plax") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.tobacco.page.0"), - new ResearchPage(tobaccoSeedRec), - new ResearchPage("tb.rec.tobacco.page.1"), - new ResearchPage(pipeRecipe), - new ResearchPage(pestleRecipe), - new ResearchPage(genTobaccoRec), - new ResearchPage("tb.rec.tobacco.page.2") - ).registerResearchItem(); - - //SW Pipe - InfusionRecipe silverwoodPipeRec = new InfusionRecipe("TB.SilverwoodPipe",new ItemStack(TBItems.silverwoodPipe,1,0),4,new AspectList().add(Aspect.AURA, 8).add(Aspect.ORDER, 32).add(Aspect.HEAL, 16),new ItemStack(TBItems.greatwoodPipe,1,0),new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockWoodenDevice,1,7), - new ItemStack(ConfigBlocks.blockWoodenDevice,1,7), - new ItemStack(ConfigBlocks.blockWoodenDevice,1,7), - new ItemStack(ConfigBlocks.blockWoodenDevice,1,7), - new ItemStack(ConfigBlocks.blockCustomPlant,1,2) - }); - - new ResearchItem("TB.SilverwoodPipe",catName,new AspectList().add(Aspect.ORDER, 8).add(Aspect.HEAL, 8).add(Aspect.AURA, 8),13,-9,1,new ItemStack(TBItems.silverwoodPipe,1,0)) - .setParents("TB.Tobacco") - .setParentsHidden("TB.INFUSION") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.silverPipe.page.0"), - new ResearchPage(silverwoodPipeRec) - ).registerResearchItem(); - - // - - InfusionRecipe eldritchTobacoRec = new InfusionRecipe("TB.Tobacco.Eldritch",new ItemStack(TBItems.tobacco,1,1),1,new AspectList().add(Aspect.ELDRITCH, 4).add(Aspect.DEATH, 1),new ItemStack(TBItems.tobacco,1,0),new ItemStack[]{ - new ItemStack(Items.ender_eye,1,0), - new ItemStack(Items.arrow,1,0) - }); - - InfusionRecipe wispyTobaccoRec = new InfusionRecipe("TB.Tobacco.Wispy",new ItemStack(TBItems.tobacco,1,8),1,new AspectList().add(Aspect.AURA, 4).add(Aspect.MAGIC, 6),new ItemStack(TBItems.tobacco,1,0),new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemCrystalEssence,1,OreDictionary.WILDCARD_VALUE) - }); + ShapedArcaneRecipe[] toolsRec = new ShapedArcaneRecipe[10]; + ItemStack tiG = new ItemStack(TBItems.resource, 1, 1); + toolsRec[0] = new ShapedArcaneRecipe("TB.Thauminite", TBItems.thauminiteAxe, primals(15), new Object[] { + "##", "#|", " |", '#', tiG, '|', "stickWood" + }); - - CrucibleRecipe angryTobaccoRec = new CrucibleRecipe("TB.Tobacco.Angry",new ItemStack(TBItems.tobacco,1,2),new ItemStack(TBItems.tobacco,1,0),new AspectList().add(Aspect.WEAPON, 4).add(Aspect.HUNGER, 4)); - CrucibleRecipe miningTobaccoRec = new CrucibleRecipe("TB.Tobacco.Mining",new ItemStack(TBItems.tobacco,1,5),new ItemStack(TBItems.tobacco,1,0),new AspectList().add(Aspect.MINE, 4).add(Aspect.MOTION, 4)); - CrucibleRecipe wisdomTobaccoRec = new CrucibleRecipe("TB.Tobacco.Wisdom",new ItemStack(TBItems.tobacco,1,4),new ItemStack(TBItems.tobacco,1,0),new AspectList().add(Aspect.MIND, 4).add(Aspect.AIR, 4)); - CrucibleRecipe taintTobaccoRec = new CrucibleRecipe("TB.Tobacco.Tainted",new ItemStack(TBItems.tobacco,1,7),new ItemStack(TBItems.tobacco,1,0),new AspectList().add(Aspect.TAINT, 4).add(Aspect.MIND, 4)); - ShapelessArcaneRecipe sanityTobaccoRec = new ShapelessArcaneRecipe("TB.Tobacco.Sanity",new ItemStack(TBItems.tobacco,1,6),new AspectList().add(Aspect.ORDER, 10).add(Aspect.AIR, 10).add(Aspect.ENTROPY, 10),new Object[]{new ItemStack(TBItems.tobacco,1,0)}); - + toolsRec[1] = new ShapedArcaneRecipe("TB.Thauminite", TBItems.thauminiteHoe, primals(15), new Object[] { + "##", " |", " |", '#', tiG, '|', "stickWood" + }); - - new ResearchItem("TB.Tobacco.Eldritch",catName,new AspectList().add(Aspect.DEATH, 4).add(Aspect.ELDRITCH, 4),14,-7,0,new ItemStack(TBItems.tobacco,1,1)) - .setParents("TB.Tobacco") - .setParentsHidden("TB.INFUSION") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.etobacco.page.0"), - new ResearchPage(eldritchTobacoRec) - ).registerResearchItem(); - - new ResearchItem("TB.Tobacco.Wispy",catName,new AspectList().add(Aspect.AURA, 4).add(Aspect.MAGIC, 4),15,-9,0,new ItemStack(TBItems.tobacco,1,8)) - .setParents("TB.Tobacco") - .setParentsHidden("TB.INFUSION") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.wtobacco.page.0"), - new ResearchPage(wispyTobaccoRec) - ).registerResearchItem(); - - new ResearchItem("TB.Tobacco.Angry",catName,new AspectList().add(Aspect.WEAPON, 4).add(Aspect.HUNGER, 4),11,-9,0,new ItemStack(TBItems.tobacco,1,2)) - .setParents("TB.Tobacco") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.atobacco.page.0"), - new ResearchPage(angryTobaccoRec) - ).registerResearchItem(); - - new ResearchItem("TB.Tobacco.Mining",catName,new AspectList().add(Aspect.MINE, 4).add(Aspect.MOTION, 4),8,-7,0,new ItemStack(TBItems.tobacco,1,5)) - .setParents("TB.Tobacco") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.mtobacco.page.0"), - new ResearchPage(miningTobaccoRec) - ).registerResearchItem(); - - new ResearchItem("TB.Tobacco.Wisdom",catName,new AspectList().add(Aspect.MIND, 4).add(Aspect.AIR, 4),13,-6,0,new ItemStack(TBItems.tobacco,1,4)) - .setParents("TB.Tobacco") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.witobacco.page.0"), - new ResearchPage(wisdomTobaccoRec) - ).registerResearchItem(); - - new ResearchItem("TB.Tobacco.Tainted",catName,new AspectList().add(Aspect.MIND, 4).add(Aspect.TAINT, 4),15,-8,0,new ItemStack(TBItems.tobacco,1,7)) - .setParents("TB.Tobacco") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.ttobacco.page.0"), - new ResearchPage(taintTobaccoRec) - ).registerResearchItem(); - - new ResearchItem("TB.Tobacco.Saturating",catName,new AspectList().add(Aspect.FLESH, 4).add(Aspect.HUNGER, 4),10,-9,0,new ItemStack(TBItems.tobacco,1,3)) - .setParents("TB.Tobacco") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.stobacco.page.0"), - new ResearchPage(new ShapelessArcaneRecipe[]{saturatingTobaccoRec,saturatingTobaccoRecM}) - ).registerResearchItem(); - - new ResearchItem("TB.Tobacco.Sanity",catName,new AspectList().add(Aspect.ORDER, 4).add(Aspect.MIND, 4),9,-8,0,new ItemStack(TBItems.tobacco,1,6)) - .setParents("TB.Tobacco") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.satobacco.page.0"), - new ResearchPage(sanityTobaccoRec) - ).registerResearchItem(); - + toolsRec[2] = new ShapedArcaneRecipe("TB.Thauminite", TBItems.thauminiteShovel, primals(15), new Object[] { + "#", "|", "|", '#', tiG, '|', "stickWood" + }); - - ThaumcraftApi.getCraftingRecipes().add(tobaccoSeedRec); - ThaumcraftApi.getCraftingRecipes().add(pestleRecipe); - ThaumcraftApi.getCraftingRecipes().add(pipeRecipe); - ThaumcraftApi.getCraftingRecipes().add(genTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(eldritchTobacoRec); - ThaumcraftApi.getCraftingRecipes().add(wispyTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(angryTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(miningTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(wisdomTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(taintTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(saturatingTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(saturatingTobaccoRecM); - ThaumcraftApi.getCraftingRecipes().add(sanityTobaccoRec); - ThaumcraftApi.getCraftingRecipes().add(silverwoodPipeRec); - } - - - //TODO BloodyMess - if (TBConfig.enableBloodyMess) { - - //copy(ResearchCategories.getResearchList("ARTIFICE").research.get("ENCHFABRIC"),"TB.ENCHFABRIC",catName,8,-3).setConcealed().setHidden().registerResearchItem(); - - new FakeResearchItem("TB.ENCHFABRIC", "THAUMICBASES", "ENCHFABRIC", "ARTIFICE", 8, -3, ResearchCategories.getResearch("ENCHFABRIC").icon_item).registerResearchItem(); - - ThaumcraftApi.addWarpToResearch("TB.BloodyRobes", 2); - - ShapedArcaneRecipe bloodyChestRec = new ShapedArcaneRecipe("TB.BloodyRobes",new ItemStack(TBItems.bloodyChest,1,0),new AspectList().add(Aspect.AIR, 5), new Object[]{ - "# #", - "###", - "###", - '#',new ItemStack(TBItems.resource,1,8) - }); - - ShapedArcaneRecipe bloodyLegsRec = new ShapedArcaneRecipe("TB.BloodyRobes",new ItemStack(TBItems.bloodyLeggings,1,0),new AspectList().add(Aspect.WATER, 5), new Object[]{ - "###", - "# #", - "# #", - '#',new ItemStack(TBItems.resource,1,8) - }); - - ShapedArcaneRecipe bloodyBootsRec = new ShapedArcaneRecipe("TB.BloodyRobes",new ItemStack(TBItems.bloodyBoots,1,0),new AspectList().add(Aspect.EARTH, 3), new Object[]{ - "# #", - "# #", - '#',new ItemStack(TBItems.resource,1,8) - }); - - ShapedArcaneRecipe ironSpikeRec = new ShapedArcaneRecipe("TB.Spike.Iron",new ItemStack(TBBlocks.spike,1,0),new AspectList().add(Aspect.FIRE, 1).add(Aspect.ENTROPY, 1), new Object[]{ - " * ", - "*#*", - "#_#", - '*',"nuggetIron", - '#',"ingotIron", - '_',new ItemStack(Blocks.heavy_weighted_pressure_plate,1,0) - }); - - ShapedArcaneRecipe thaumiumSpikeRec = new ShapedArcaneRecipe("TB.Spike.Thaumic",new ItemStack(TBBlocks.spike,1,2),primals(4), new Object[]{ - " * ", - "*#*", - "#_#", - '*',"nuggetThaumium", - '#',"ingotThaumium", - '_',new ItemStack(TBBlocks.spike,1,0) - }); - - ShapedArcaneRecipe voidSpikeRec = new ShapedArcaneRecipe("TB.Spike.Void",new ItemStack(TBBlocks.spike,1,4),primals(4), new Object[]{ - " * ", - "*#*", - "#_#", - '*',"nuggetVoid", - '#',"ingotVoid", - '_',new ItemStack(TBBlocks.spike,1,2) - }); - - CrucibleRecipe cleanEFabricRec = new CrucibleRecipe("TB.Spike.Iron",new ItemStack(ConfigItems.itemResource,1,7),new ItemStack(TBItems.resource,1,8),new AspectList().add(Aspect.ORDER, 1)); - - new ResearchItem("TB.Spike.Iron",catName,new AspectList().add(Aspect.WEAPON, 6).add(Aspect.HUNGER, 6).add(Aspect.METAL, 6),10,-3,1,new ItemStack(TBBlocks.spike,1,0)) - .setParents("TB.ENCHFABRIC") - .setPages( - new ResearchPage("tb.rec.spikeIron.page.0"), - new ResearchPage(ironSpikeRec), - new ResearchPage(cleanEFabricRec) - ).registerResearchItem(); - - new ResearchItem("TB.Spike.Thaumic",catName,new AspectList().add(Aspect.WEAPON, 6).add(Aspect.MAGIC, 6).add(Aspect.MECHANISM, 6),13,-3,1,new ItemStack(TBBlocks.spike,1,2)) - .setConcealed() - .setParents("TB.Spike.Iron") - .setParentsHidden("TB.THAUMIUM") - .setPages( - new ResearchPage("tb.rec.spikeThaumic.page.0"), - new ResearchPage(thaumiumSpikeRec) - ).registerResearchItem(); - - new ResearchItem("TB.BloodyRobes",catName,new AspectList().add(Aspect.HUNGER, 6).add(Aspect.FLESH, 6).add(Aspect.ARMOR, 6),12,-4,1,new ItemStack(TBItems.bloodyChest,1,0)) - .setConcealed() - .setParents("TB.Spike.Iron") - .setPages( - new ResearchPage("tb.rec.bloodyRobes.page.0"), - new ResearchPage(bloodyChestRec), - new ResearchPage(bloodyLegsRec), - new ResearchPage(bloodyBootsRec) - ).registerResearchItem(); - - new ResearchItem("TB.Spike.Void",catName,new AspectList().add(Aspect.WEAPON, 6).add(Aspect.ELDRITCH, 6).add(Aspect.ARMOR, 6),15,-2,2,new ItemStack(TBBlocks.spike,1,4)) - .setConcealed() - .setParents("TB.Spike.Thaumic") - .setParentsHidden("TB.VOIDMETAL") - .setPages( - new ResearchPage("tb.rec.spikeVoid.page.0"), - new ResearchPage(voidSpikeRec) - ).registerResearchItem(); - - ThaumcraftApi.getCraftingRecipes().add(ironSpikeRec); - ThaumcraftApi.getCraftingRecipes().add(thaumiumSpikeRec); - ThaumcraftApi.getCraftingRecipes().add(voidSpikeRec); - ThaumcraftApi.getCraftingRecipes().add(cleanEFabricRec); - ThaumcraftApi.getCraftingRecipes().add(bloodyChestRec); - ThaumcraftApi.getCraftingRecipes().add(bloodyLegsRec); - ThaumcraftApi.getCraftingRecipes().add(bloodyBootsRec); - } - - - //TODO Bracelets - if (TBConfig.enableBracelets) { - - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("CAP_gold"),"TB.CAP_gold",catName,-8,10).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_greatwood"),"TB.ROD_greatwood",catName,-10,6).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_silverwood"),"TB.ROD_silverwood",catName,-12,6).setConcealed().setHidden().registerResearchItem(); - - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_reed"),"TB.ROD_reed",catName,-19,5).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_blaze"),"TB.ROD_blaze",catName,-15,5).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_obsidian"),"TB.ROD_obsidian",catName,-19,11).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_ice"),"TB.ROD_ice",catName,-17,5).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_quartz"),"TB.ROD_quartz",catName,-17,11).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_bone"),"TB.ROD_bone",catName,-15,11).setConcealed().setHidden().registerResearchItem(); - - //copy(ResearchCategories.getResearchList("ELDRITCH").research.get("ROD_primal_staff"),"TB.ROD_primal_staff",catName,-19,8).setConcealed().setHidden().registerResearchItem(); - - - new FakeResearchItem("TB.CAP_gold", "THAUMICBASES", "CAP_gold", "THAUMATURGY", -8, 10, ResearchCategories.getResearch("CAP_gold").icon_item).registerResearchItem(); - new FakeResearchItem("TB.ROD_greatwood", "THAUMICBASES", "ROD_greatwood", "THAUMATURGY", -10, 6, ResearchCategories.getResearch("ROD_greatwood").icon_item).registerResearchItem(); - new FakeResearchItem("TB.ROD_silverwood", "THAUMICBASES", "ROD_silverwood", "THAUMATURGY", -12, 6, ResearchCategories.getResearch("ROD_silverwood").icon_item).registerResearchItem(); - - new FakeResearchItem("TB.ROD_reed", "THAUMICBASES", "ROD_reed", "THAUMATURGY", -19, 5, ResearchCategories.getResearch("ROD_reed").icon_item).registerResearchItem(); - new FakeResearchItem("TB.ROD_blaze", "THAUMICBASES", "ROD_blaze", "THAUMATURGY", -15, 5, ResearchCategories.getResearch("ROD_blaze").icon_item).registerResearchItem(); - new FakeResearchItem("TB.ROD_obsidian", "THAUMICBASES", "ROD_obsidian", "THAUMATURGY", -19, 11, ResearchCategories.getResearch("ROD_obsidian").icon_item).registerResearchItem(); - new FakeResearchItem("TB.ROD_ice", "THAUMICBASES", "ROD_ice", "THAUMATURGY", -17, 5, ResearchCategories.getResearch("ROD_ice").icon_item).registerResearchItem(); - new FakeResearchItem("TB.ROD_quartz", "THAUMICBASES", "ROD_quartz", "THAUMATURGY", -17, 11, ResearchCategories.getResearch("ROD_quartz").icon_item).registerResearchItem(); - new FakeResearchItem("TB.ROD_bone", "THAUMICBASES", "ROD_bone", "THAUMATURGY", -15, 11, ResearchCategories.getResearch("ROD_bone").icon_item).registerResearchItem(); - - new FakeResearchItem("TB.ROD_primal_staff", "THAUMICBASES", "ROD_primal_staff", "THAUMATURGY", -19, 8, ResearchCategories.getResearch("ROD_primal_staff").icon_item).registerResearchItem(); - - - - - - - ThaumcraftApi.addWarpToResearch("TB.Bracelet.Void", 2); - ThaumcraftApi.addWarpToResearch("TB.Bracelet.Bone", 1); - ThaumcraftApi.addWarpToResearch("TB.Bracelet.Primal", 4); - - ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.castingBracelet,1,12), 3); - - ShapedArcaneRecipe ironBraceletRec = new ShapedArcaneRecipe("TB.Bracelet.Iron",new ItemStack(TBItems.castingBracelet,1,0),primals(1),new Object[]{ - "CIC", - "N N", - 'C',new ItemStack(ConfigItems.itemWandCap,1,0), - 'I',"ingotIron", - 'N',"nuggetIron" - }); - - ShapedArcaneRecipe goldBraceletRec = new ShapedArcaneRecipe("TB.Bracelet.Gold",new ItemStack(TBItems.castingBracelet,1,1),primals(5),new Object[]{ - "CIC", - "N N", - 'C',new ItemStack(ConfigItems.itemWandCap,1,1), - 'I',"ingotGold", - 'N',"nuggetGold" - }); - - ShapedArcaneRecipe greatwoodBraceletRec = new ShapedArcaneRecipe("TB.Bracelet.Greatwood",new ItemStack(TBItems.castingBracelet,1,2),primals(25),new Object[]{ - "CIC", - "I I", - 'C',new ItemStack(ConfigItems.itemWandCap,1,1), - 'I',new ItemStack(ConfigBlocks.blockMagicalLog,1,0) - }); - - ShapedArcaneRecipe thaumiumBraceletRec = new ShapedArcaneRecipe("TB.Bracelet.Thaumium",new ItemStack(TBItems.castingBracelet,1,3),primals(25),new Object[]{ - "CIC", - "INI", - "N N", - 'C',new ItemStack(TBItems.resource,1,2), - 'I',new ItemStack(ConfigItems.itemResource,1,2), - 'N',new ItemStack(ConfigItems.itemResource,1,14) - }); - - InfusionRecipe silverwoodBraceletRec = new InfusionRecipe("TB.Bracelet.Silverwood",new ItemStack(TBItems.castingBracelet,1,4),5,primals(17).add(Aspect.MAGIC, 17),new ItemStack(ConfigItems.itemWandRod,1,2),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(ConfigBlocks.blockMagicalLog,1,1), - new ItemStack(ConfigBlocks.blockCrystal,1,6), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(ConfigBlocks.blockMagicalLog,1,1), - new ItemStack(ConfigBlocks.blockCrystal,1,6) - }); - - InfusionRecipe voidBraceletRec = new InfusionRecipe("TB.Bracelet.Void",new ItemStack(TBItems.castingBracelet,1,11),8,new AspectList().add(Aspect.ELDRITCH, 64).add(Aspect.VOID, 64).add(Aspect.MAGIC, 64).add(Aspect.AURA, 24).add(Aspect.ENERGY, 24),new ItemStack(TBItems.resource,1,4),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(TBBlocks.crystalBlock,1,6) - }); - - InfusionRecipe reedBraceletRec = new InfusionRecipe("TB.Bracelet.Reed",new ItemStack(TBItems.castingBracelet,1,5),2,new AspectList().add(Aspect.AIR, 24).add(Aspect.MOTION, 12).add(Aspect.MAGIC,8),new ItemStack(ConfigItems.itemWandRod,1,5),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,0), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,0) - }); - - InfusionRecipe boneBraceletRec = new InfusionRecipe("TB.Bracelet.Bone",new ItemStack(TBItems.castingBracelet,1,6),2,new AspectList().add(Aspect.ENTROPY, 24).add(Aspect.UNDEAD, 12).add(Aspect.MAGIC,8),new ItemStack(ConfigItems.itemWandRod,1,7),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,5), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,5) - }); - - InfusionRecipe obsidianBraceletRec = new InfusionRecipe("TB.Bracelet.Obsidian",new ItemStack(TBItems.castingBracelet,1,7),2,new AspectList().add(Aspect.EARTH, 24).add(Aspect.DARKNESS, 12).add(Aspect.MAGIC,8),new ItemStack(ConfigItems.itemWandRod,1,1),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,3), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,3) - }); - - InfusionRecipe blazeBraceletRec = new InfusionRecipe("TB.Bracelet.Blaze",new ItemStack(TBItems.castingBracelet,1,8),2,new AspectList().add(Aspect.FIRE, 24).add(Aspect.BEAST, 12).add(Aspect.MAGIC,8),new ItemStack(ConfigItems.itemWandRod,1,6),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,1), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,1) - }); - - InfusionRecipe iceBraceletRec = new InfusionRecipe("TB.Bracelet.Ice",new ItemStack(TBItems.castingBracelet,1,9),2,new AspectList().add(Aspect.WATER, 24).add(Aspect.COLD, 12).add(Aspect.MAGIC,8),new ItemStack(ConfigItems.itemWandRod,1,3),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,2), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,2) - }); - - InfusionRecipe quartzBraceletRec = new InfusionRecipe("TB.Bracelet.Quartz",new ItemStack(TBItems.castingBracelet,1,10),2,new AspectList().add(Aspect.ORDER, 24).add(Aspect.ENERGY, 12).add(Aspect.MAGIC,8),new ItemStack(ConfigItems.itemWandRod,1,4),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,4), - new ItemStack(ConfigItems.itemWandCap,1,2), - new ItemStack(ConfigItems.itemShard,1,4) - }); - - InfusionRecipe primalBraceletRec = new InfusionRecipe("TB.Bracelet.Primal",new ItemStack(TBItems.castingBracelet,1,12),7,primals(48).add(Aspect.MAGIC,96),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigItems.itemWandCap,1,7), - new ItemStack(TBItems.castingBracelet,1,5), - new ItemStack(TBItems.castingBracelet,1,6), - new ItemStack(TBItems.castingBracelet,1,7), - new ItemStack(ConfigItems.itemWandCap,1,7), - new ItemStack(TBItems.castingBracelet,1,8), - new ItemStack(TBItems.castingBracelet,1,9), - new ItemStack(TBItems.castingBracelet,1,10) - }); - - - - - new ResearchItem("TB.Bracelet.Iron",catName,new AspectList().add(Aspect.METAL, 3).add(Aspect.MAGIC, 3),-6,7,0,new ItemStack(TBItems.castingBracelet,1,0)) - .setRound() - .setPages( - new ResearchPage("tb.rec.bracelet.iron.page.0"), - new ResearchPage("tb.rec.bracelet.iron.page.1"), - new ResearchPage("tb.rec.bracelet.iron.page.2"), - new ResearchPage(ironBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Gold",catName,new AspectList().add(Aspect.METAL, 3).add(Aspect.MAGIC, 3).add(Aspect.GREED, 3),-8,8,0,new ItemStack(TBItems.castingBracelet,1,1)) - .setParents("TB.Bracelet.Iron","TB.CAP_gold") - .setPages( - new ResearchPage("tb.rec.bracelet.gold.page.0"), - new ResearchPage(goldBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Greatwood",catName,new AspectList().add(Aspect.TREE, 3).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 3),-10,8,0,new ItemStack(TBItems.castingBracelet,1,2)) - .setConcealed() - .setParents("TB.Bracelet.Gold","TB.ROD_greatwood") - .setPages( - new ResearchPage("tb.rec.bracelet.greatwood.page.0"), - new ResearchPage(greatwoodBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Thaumium",catName,new AspectList().add(Aspect.METAL, 3).add(Aspect.MAGIC, 3).add(Aspect.ENERGY, 3).add(Aspect.AURA, 3),-10,11,0,new ItemStack(TBItems.castingBracelet,1,3)) - .setConcealed() - .setParents("TB.Bracelet.Greatwood") - .setParentsHidden("TB.THAUMIUM", "CAP_thauminite") - .setPages( - new ResearchPage("tb.rec.bracelet.thaumium.page.0"), - new ResearchPage(thaumiumBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Silverwood",catName,new AspectList().add(Aspect.ORDER, 3).add(Aspect.MAGIC, 3).add(Aspect.TREE, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-12,8,1,new ItemStack(TBItems.castingBracelet,1,4)) - .setConcealed() - .setParents("TB.Bracelet.Greatwood","TB.ROD_silverwood") - .setPages( - new ResearchPage("tb.rec.bracelet.silverwood.page.0"), - new ResearchPage(silverwoodBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Void",catName,new AspectList().add(Aspect.VOID, 3).add(Aspect.MAGIC, 3).add(Aspect.ELDRITCH, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-12,11,3,new ItemStack(TBItems.castingBracelet,1,11)) - .setConcealed() - .setParents("TB.Bracelet.Silverwood") - .setParentsHidden("TB.VOIDMETAL") - .setPages( - new ResearchPage("tb.rec.bracelet.void.page.0"), - new ResearchPage(voidBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Reed",catName,new AspectList().add(Aspect.AIR, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-19,6,2,new ItemStack(TBItems.castingBracelet,1,5)) - .setConcealed() - .setParents("TB.ROD_reed") - .setParentsHidden("TB.Bracelet.Greatwood") - .setPages( - new ResearchPage("tb.rec.bracelet.reed.page.0"), - new ResearchPage(reedBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Blaze",catName,new AspectList().add(Aspect.FIRE, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-15,6,2,new ItemStack(TBItems.castingBracelet,1,8)) - .setConcealed() - .setParents("TB.ROD_blaze") - .setParentsHidden("TB.Bracelet.Greatwood") - .setPages( - new ResearchPage("tb.rec.bracelet.blaze.page.0"), - new ResearchPage(blazeBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Obsidian",catName,new AspectList().add(Aspect.EARTH, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-19,10,2,new ItemStack(TBItems.castingBracelet,1,7)) - .setConcealed() - .setParents("TB.ROD_obsidian") - .setParentsHidden("TB.Bracelet.Greatwood") - .setPages( - new ResearchPage("tb.rec.bracelet.obsidian.page.0"), - new ResearchPage(obsidianBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Ice",catName,new AspectList().add(Aspect.WATER, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-17,6,2,new ItemStack(TBItems.castingBracelet,1,9)) - .setConcealed() - .setParents("TB.ROD_ice") - .setParentsHidden("TB.Bracelet.Greatwood") - .setPages( - new ResearchPage("tb.rec.bracelet.ice.page.0"), - new ResearchPage(iceBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Quartz",catName,new AspectList().add(Aspect.ORDER, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-17,10,2,new ItemStack(TBItems.castingBracelet,1,10)) - .setConcealed() - .setParents("TB.ROD_quartz") - .setParentsHidden("TB.Bracelet.Greatwood") - .setPages( - new ResearchPage("tb.rec.bracelet.quartz.page.0"), - new ResearchPage(quartzBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Bone",catName,new AspectList().add(Aspect.ENTROPY, 3).add(Aspect.MAGIC, 3).add(Aspect.CRAFT, 3).add(Aspect.AURA, 3).add(Aspect.EXCHANGE, 3),-15,10,2,new ItemStack(TBItems.castingBracelet,1,6)) - .setConcealed() - .setParents("TB.ROD_bone") - .setParentsHidden("TB.Bracelet.Greatwood") - .setPages( - new ResearchPage("tb.rec.bracelet.bone.page.0"), - new ResearchPage(boneBraceletRec) - ).registerResearchItem(); - - new ResearchItem("TB.Bracelet.Primal",catName,primals(6).add(Aspect.MAGIC, 12).add(Aspect.ELDRITCH, 12),-17,8,4,new ItemStack(TBItems.castingBracelet,1,12)) - .setConcealed() - .setSpecial() - .setParents( - "TB.ROD_primal_staff", - "TB.Bracelet.Bone", - "TB.Bracelet.Quartz", - "TB.Bracelet.Ice", - "TB.Bracelet.Obsidian", - "TB.Bracelet.Blaze", - "TB.Bracelet.Reed", - "TB.Bracelet.Silverwood" - ) - .setPages( - new ResearchPage("tb.rec.bracelet.primal.page.0"), - new ResearchPage(primalBraceletRec) - ).registerResearchItem(); - - ThaumcraftApi.getCraftingRecipes().add(ironBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(goldBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(greatwoodBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(thaumiumBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(silverwoodBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(voidBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(reedBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(boneBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(obsidianBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(blazeBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(iceBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(quartzBraceletRec); - ThaumcraftApi.getCraftingRecipes().add(primalBraceletRec); - - } - - - //TODO Flora - if (TBConfig.enableFlora) { - - ThaumcraftApi.addWarpToResearch("TB.Aurelia", 2); - ThaumcraftApi.addWarpToResearch("TB.Flaxium", 2); - ThaumcraftApi.addWarpToResearch("TB.Lucrite", 1); - - CrucibleRecipe plaxRec = new CrucibleRecipe("TB.Plax",new ItemStack(TBItems.plaxSeed,1,0),new ItemStack(Items.wheat_seeds),new AspectList().add(Aspect.CLOTH, 4)); - CrucibleRecipe metalleatRec = new CrucibleRecipe("TB.Metalleat",new ItemStack(TBItems.metalleatSeeds,1,0),new ItemStack(Items.wheat_seeds),new AspectList().add(Aspect.ORDER, 4).add(Aspect.METAL, 12).add(Aspect.LIFE, 4)); - CrucibleRecipe lucriteRec = new CrucibleRecipe("TB.Lucrite",new ItemStack(TBItems.lucriteSeeds,1,0),new ItemStack(Items.golden_carrot),new AspectList().add(Aspect.HUNGER, 4).add(Aspect.GREED, 12).add(Aspect.LIFE, 4)); - - CrucibleRecipe aureliaRec = new CrucibleRecipe("TB.Aurelia",new ItemStack(TBBlocks.aurelia),new ItemStack(Blocks.red_flower,1,7),new AspectList().add(Aspect.PLANT, 8).add(Aspect.ELDRITCH, 2).add(Aspect.AURA, 2)); - CrucibleRecipe knoseRec = new CrucibleRecipe("TB.Knose",new ItemStack(TBItems.knoseSeed),new ItemStack(Blocks.double_plant,1,4),new AspectList().add(Aspect.MIND, 16).add(Aspect.LIFE, 8).add(Aspect.ENERGY, 2)); - CrucibleRecipe knowledgeFragmentRec = new CrucibleRecipe("TB.Knose",new ItemStack(ConfigItems.itemResource,1,9),new ItemStack(TBItems.knoseFragment,1,OreDictionary.WILDCARD_VALUE),new AspectList().add(Aspect.ORDER, 1).add(Aspect.EXCHANGE, 1)); - CrucibleRecipe sweedRec = new CrucibleRecipe("TB.BasicPlants",new ItemStack(TBItems.sweedSeeds),new ItemStack(Blocks.tallgrass,1,OreDictionary.WILDCARD_VALUE),new AspectList().add(Aspect.MOTION, 2).add(Aspect.LIFE, 1)); - CrucibleRecipe lazulliaRec = new CrucibleRecipe("TB.Lazullia",new ItemStack(TBItems.lazulliaSeeds),new ItemStack(Items.wheat_seeds),new AspectList().add(Aspect.SENSES, 12).add(Aspect.GREED, 3)); - CrucibleRecipe rainbowCactiRec = new CrucibleRecipe("TB.RainbowCacti",new ItemStack(TBBlocks.rainbowCactus),new ItemStack(Blocks.cactus),new AspectList().add(Aspect.EXCHANGE, 24).add(Aspect.SENSES, 6)); - CrucibleRecipe redlonRec = new CrucibleRecipe("TB.Redlon",new ItemStack(TBItems.redlonSeeds),new ItemStack(Items.melon_seeds),new AspectList().add(Aspect.MECHANISM, 16).add(Aspect.ENERGY, 16)); - CrucibleRecipe aspectShroomRec = new CrucibleRecipe("TB.Ashroom",new ItemStack(TBBlocks.ashroom,1,0),new ItemStack(ConfigBlocks.blockCustomPlant,1,5),new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.CROP, 2)); - CrucibleRecipe flaxiumRec = new CrucibleRecipe("TB.Flaxium",new ItemStack(TBBlocks.flaxium,1,0),new ItemStack(Blocks.red_flower,1,2),new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.MAGIC, 2)); - CrucibleRecipe glieoniaRec = new CrucibleRecipe("TB.Glieonia",new ItemStack(TBItems.glieoniaSeed,1,0),new ItemStack(Blocks.red_flower,1,3),new AspectList().add(Aspect.LIGHT, 8).add(Aspect.MAGIC, 6).add(Aspect.LIFE, 4)); - CrucibleRecipe briarRec = new CrucibleRecipe("TB.Briar",new ItemStack(TBBlocks.briar,1,0),new ItemStack(Blocks.double_plant,1,4),new AspectList().add(Aspect.HEAL, 4).add(Aspect.LIFE, 4).add(Aspect.PLANT, 4)); - - ShapelessArcaneRecipe rosehipRec = new ShapelessArcaneRecipe("TB.Briar",TBItems.rosehipSyrup,new AspectList().add(Aspect.FIRE, 3).add(Aspect.WATER, 5), new Object[]{ - new ItemStack(ConfigItems.itemEssence,1,0), - new ItemStack(TBItems.resource,1,6), - new ItemStack(Items.sugar,1,0) - }); - - InfusionRecipe voidSeedRec = new InfusionRecipe("TB.VoidSeed",new ItemStack(TBItems.voidSeed,1,0),3,new AspectList().add(Aspect.ELDRITCH, 16).add(Aspect.DARKNESS, 16).add(Aspect.CROP, 16),new ItemStack(ConfigItems.itemResource,1,17),new ItemStack[]{ - new ItemStack(Items.wheat_seeds,1,0), - new ItemStack(Items.pumpkin_seeds,1,0), - new ItemStack(Items.melon_seeds,1,0), - new ItemStack(Items.poisonous_potato,1,0), - new ItemStack(Items.carrot,1,0), - new ItemStack(Items.nether_wart,1,0), - }); - - InfusionRecipe goldenOakRec = new InfusionRecipe("TB.GoldenOak",new ItemStack(TBBlocks.sapling),2,new AspectList().add(Aspect.PLANT, 16).add(Aspect.GREED, 64),new ItemStack(Blocks.sapling,1,0),new ItemStack[]{ - new ItemStack(Items.apple), - new ItemStack(Items.apple), - new ItemStack(Items.golden_apple), - new ItemStack(Items.golden_apple) - }); - - InfusionRecipe peacefulSaplingRec = new InfusionRecipe("TB.PeacefulSapling",new ItemStack(TBBlocks.sapling,1,1),2,new AspectList().add(Aspect.TREE, 16).add(Aspect.LIFE, 12).add(Aspect.HEAL, 6),new ItemStack(Blocks.sapling,1,2),new ItemStack[]{ - new ItemStack(Items.slime_ball), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.slime_ball), - new ItemStack(ConfigBlocks.blockCustomPlant,1,2), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockMetalDevice,1,13), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockCustomPlant,1,2) - }); - - InfusionRecipe netherSaplingRec = new InfusionRecipe("TB.NetherSapling",new ItemStack(TBBlocks.sapling,1,2),5,new AspectList().add(Aspect.TREE, 32).add(nether, 32).add(Aspect.HUNGER, 16),new ItemStack(ConfigBlocks.blockCustomPlant,1,0),new ItemStack[]{ - new ItemStack(ConfigBlocks.blockCustomPlant,1,3), - new ItemStack(ConfigItems.itemShard,1,1), - new ItemStack(ConfigBlocks.blockCustomPlant,1,3), - new ItemStack(ConfigBlocks.blockCustomPlant,1,4), - new ItemStack(ConfigBlocks.blockCustomPlant,1,3), - new ItemStack(ConfigBlocks.blockCustomPlant,1,3), - new ItemStack(ConfigItems.itemShard,1,1), - new ItemStack(Items.lava_bucket,1,0), - new ItemStack(ConfigItems.itemShard,1,1), - new ItemStack(ConfigBlocks.blockCustomPlant,1,4) - }); - - InfusionRecipe enderSaplingRec = new InfusionRecipe("TB.EnderSapling",new ItemStack(TBBlocks.sapling,1,3),7,new AspectList().add(Aspect.TREE, 64).add(Aspect.ELDRITCH, 24).add(Aspect.VOID, 16).add(Aspect.DARKNESS, 8),new ItemStack(ConfigBlocks.blockCustomPlant,1,1),new ItemStack[]{ - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(Items.ender_pearl,1,0), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(ConfigItems.itemResource,1,1), - new ItemStack(Items.ender_pearl,1,0), - new ItemStack(Items.ender_pearl,1,0), - new ItemStack(ConfigBlocks.blockCustomPlant,1,4), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(Items.ender_pearl,1,0), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(ConfigItems.itemResource,1,1) - }); - - new ResearchItem("TB.BasicPlants",catName,new AspectList().add(Aspect.CROP, 2).add(Aspect.PLANT, 2),-8,-2,1,new ItemStack(Items.wheat_seeds,1,0)) - .setParentsHidden("TB.CRUCIBLE") - .setRound() - .setPages( - new ResearchPage("tb.rec.basicPlants.page.0"), - new ResearchPage(sweedRec) - ).registerResearchItem(); - - new ResearchItem("TB.Plax",catName,new AspectList().add(Aspect.CROP, 1).add(Aspect.CLOTH, 1),-11,-2,1,new ItemStack(TBItems.plaxSeed,1,0)) - .setParents("TB.BasicPlants") - .setPages( - new ResearchPage("tb.rec.plax.page.0"), - new ResearchPage(plaxRec) - ).registerResearchItem(); - - new ResearchItem("TB.Briar",catName,new AspectList().add(Aspect.CROP, 4).add(Aspect.PLANT, 4).add(Aspect.HEAL, 4),-13,-3,1,new ItemStack(TBItems.resource,1,6)) - .setParents("TB.Plax") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.briar.page.0"), - new ResearchPage(briarRec), - new ResearchPage(rosehipRec) - ).registerResearchItem(); - - new ResearchItem("TB.Aurelia",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.MAGIC, 6).add(Aspect.AURA, 6),-10,0,0,new ItemStack(TBBlocks.aurelia,1,0)) - .setParents("TB.BasicPlants") - .setPages( - new ResearchPage("tb.rec.aurelia.page.0"), - new ResearchPage("tb.rec.aurelia.page.1"), - new ResearchPage(aureliaRec) - ).registerResearchItem(); - - new ResearchItem("TB.Knose",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.MIND, 6).add(Aspect.EARTH, 6),-10,2,0,new ItemStack(TBItems.knoseFragment,1,OreDictionary.WILDCARD_VALUE)) - .setParents("TB.Aurelia") - .setParentsHidden("TB.CrystalBlocks") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.knose.page.0"), - new ResearchPage("tb.rec.knose.page.1"), - new ResearchPage(knoseRec), - new ResearchPage(knowledgeFragmentRec) - ).registerResearchItem(); - - new ResearchItem("TB.Ashroom",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.ENTROPY, 6).add(Aspect.AURA, 6).add(Aspect.AIR, 6).add(Aspect.CROP, 4),-9,2,2,new ItemStack(TBBlocks.ashroom)) - .setParents("TB.Aurelia") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.ashroom.page.0"), - new ResearchPage(aspectShroomRec) - ).registerResearchItem(); - - new ResearchItem("TB.Glieonia",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.LIGHT, 6).add(Aspect.SENSES, 6).add(Aspect.FIRE, 6).add(Aspect.PLANT, 4),-12,1,2,new ItemStack(TBItems.glieoniaSeed)) - .setParents("TB.Aurelia") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.glieonia.page.0"), - new ResearchPage(glieoniaRec) - ).registerResearchItem(); - - new ResearchItem("TB.Flaxium",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.ENTROPY, 6).add(Aspect.AURA, 6).add(Aspect.MAGIC, 6),-11,2,2,new ItemStack(TBBlocks.flaxium)) - .setParents("TB.Aurelia") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.flaxium.page.0"), - new ResearchPage(flaxiumRec) - ).registerResearchItem(); - - new ResearchItem("TB.Metalleat",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.MAGIC, 6).add(Aspect.METAL, 6).add(Aspect.EXCHANGE, 6),-10,-4,0,new ItemStack(TBItems.metalleatSeeds,1,0)) - .setParents("TB.BasicPlants") - .setPages( - new ResearchPage("tb.rec.metalleat.page.0"), - new ResearchPage(metalleatRec) - ).registerResearchItem(); - - new ResearchItem("TB.Lazullia",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.MAGIC, 6).add(Aspect.GREED, 6).add(Aspect.CRYSTAL, 6).add(Aspect.PLANT, 6).add(Aspect.SENSES, 8),-8,-5,2,new ItemStack(TBItems.lazulliaSeeds,1,0)) - .setParents("TB.Metalleat") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.lazullia.page.0"+(Loader.isModLoaded("essentialcraft") ? "_ec3" : "")), - new ResearchPage(lazulliaRec) - ).registerResearchItem(); - - new ResearchItem("TB.RainbowCacti",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.MAGIC, 6).add(Aspect.EXCHANGE, 6).add(Aspect.CROP, 6).add(Aspect.ENTROPY, 6).add(Aspect.SENSES, 8),-11,-6,2,new ItemStack(TBBlocks.rainbowCactus,1,0)) - .setParents("TB.Metalleat") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.rainCacti.page.0"), - new ResearchPage(rainbowCactiRec) - ).registerResearchItem(); - - new ResearchItem("TB.Lucrite",catName,new AspectList().add(Aspect.GREED, 6).add(Aspect.MAGIC, 6).add(Aspect.PLANT, 6).add(Aspect.HUNGER, 6),-9,-6,0,new ItemStack(TBItems.lucriteSeeds,1,0)) - .setParents("TB.Metalleat") - .setParentsHidden("TB.SMB") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.lucrite.page.0"), - new ResearchPage(lucriteRec) - ).registerResearchItem(); - - new ResearchItem("TB.Redlon",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.MECHANISM, 6).add(Aspect.ENERGY, 6).add(Aspect.CROP, 6).add(Aspect.ORDER, 6).add(Aspect.GREED, 8),-10,-6,3,new ItemStack(TBItems.redlonSeeds,1,0)) - .setParents("TB.Metalleat") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.redlon.page.0"), - new ResearchPage(redlonRec) - ).registerResearchItem(); + toolsRec[3] = new ShapedArcaneRecipe("TB.Thauminite", TBItems.thauminiteSword, primals(15), new Object[] { + "#", "#", "|", '#', tiG, '|', "stickWood" + }); - //void seed - new ResearchItem("TB.VoidSeed",catName,new AspectList().add(Aspect.LIFE, 6).add(Aspect.ELDRITCH, 6).add(Aspect.DARKNESS, 6),16,3,1,new ItemStack(TBItems.voidSeed,1,0)) - .setParents("TB.VOIDMETAL") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.voidSeed.page.0"), - new ResearchPage(voidSeedRec) - ).registerResearchItem(); - - //saplings - new ResearchItem("TB.GoldenOak",catName,new AspectList().add(Aspect.GREED, 8).add(Aspect.HUNGER, 8).add(Aspect.CROP, 8),-15,-1,0,new ItemStack(TBBlocks.sapling,1,0)) - .setParents("TB.Briar") - .setParentsHidden("TB.INFUSION") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.goldenOak.page.0"), - new ResearchPage(goldenOakRec) - ).registerResearchItem(); - - new ResearchItem("TB.PeacefulSapling",catName,new AspectList().add(Aspect.LIFE, 8).add(Aspect.HEAL, 8).add(Aspect.TREE, 8),-18,-1,0,new ItemStack(TBBlocks.sapling,1,1)) - .setParents("TB.GoldenOak") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.peacefulTree.page.0"), - new ResearchPage(peacefulSaplingRec) - ).registerResearchItem(); - - new ResearchItem("TB.NetherSapling",catName,new AspectList().add(Aspect.TREE, 8).add(Aspect.FIRE, 8).add(nether, 8),-17,0,0,new ItemStack(TBBlocks.sapling,1,2)) - .setParents("TB.GoldenOak") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.netherTree.page.0"), - new ResearchPage(netherSaplingRec) - ).registerResearchItem(); - - new ResearchItem("TB.EnderSapling",catName,new AspectList().add(Aspect.TREE, 8).add(Aspect.ELDRITCH, 8).add(Aspect.VOID, 8),-17,-2,0,new ItemStack(TBBlocks.sapling,1,3)) - .setParents("TB.GoldenOak") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.enderTree.page.0"), - new ResearchPage(enderSaplingRec) - ).registerResearchItem(); - - ThaumcraftApi.getCraftingRecipes().add(plaxRec); - ThaumcraftApi.getCraftingRecipes().add(metalleatRec); - ThaumcraftApi.getCraftingRecipes().add(lucriteRec); - ThaumcraftApi.getCraftingRecipes().add(knoseRec); - ThaumcraftApi.getCraftingRecipes().add(knowledgeFragmentRec); - ThaumcraftApi.getCraftingRecipes().add(sweedRec); - ThaumcraftApi.getCraftingRecipes().add(lazulliaRec); - ThaumcraftApi.getCraftingRecipes().add(rainbowCactiRec); - ThaumcraftApi.getCraftingRecipes().add(redlonRec); - ThaumcraftApi.getCraftingRecipes().add(aspectShroomRec); - ThaumcraftApi.getCraftingRecipes().add(flaxiumRec); - ThaumcraftApi.getCraftingRecipes().add(glieoniaRec); - ThaumcraftApi.getCraftingRecipes().add(briarRec); - ThaumcraftApi.getCraftingRecipes().add(rosehipRec); - ThaumcraftApi.getCraftingRecipes().add(aureliaRec); - ThaumcraftApi.getCraftingRecipes().add(voidSeedRec); - - ThaumcraftApi.getCraftingRecipes().add(peacefulSaplingRec); - ThaumcraftApi.getCraftingRecipes().add(netherSaplingRec); - ThaumcraftApi.getCraftingRecipes().add(enderSaplingRec); - ThaumcraftApi.getCraftingRecipes().add(goldenOakRec); - - } - - //TODO nodes - if (TBConfig.enableNodeTools) { - - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("NODESTABILIZERADV"),"TB.NODESTABILIZERADV",catName,-2,-7).setConcealed().setHidden().registerResearchItem(); - //copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("VISPOWER"),"TB.VISPOWER",catName,2,-7).setConcealed().setHidden().registerResearchItem(); - - new FakeResearchItem("TB.NODESTABILIZERADV", "THAUMICBASES", "NODESTABILIZERADV", "THAUMATURGY", -2, -7, ResearchCategories.getResearch("NODESTABILIZERADV").icon_item).registerResearchItem(); - new FakeResearchItem("TB.VISPOWER", "THAUMICBASES", "VISPOWER", "THAUMATURGY", 2, -7, ResearchCategories.getResearch("VISPOWER").icon_item).registerResearchItem(); - - - ThaumcraftApi.addWarpToResearch("TB.NodeMan", 1); - ThaumcraftApi.addWarpToResearch("TB.NodeFoci.Destr", 2); - ThaumcraftApi.addWarpToResearch("TB.NodeFoci.Taint", 3); - - ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.nodeFoci,1,1), 1); - ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.nodeFoci,1,9), 2); - - InfusionRecipe nodeManipulatorRec = new InfusionRecipe("TB.NodeMan",new ItemStack(TBBlocks.nodeManipulator,1,0),6,new AspectList().add(Aspect.MECHANISM, 32).add(Aspect.AURA, 32).add(Aspect.MAGIC,16).add(Aspect.ENERGY, 64).add(Aspect.VOID, 16),new ItemStack(ConfigBlocks.blockStoneDevice,1,11),new ItemStack[]{ - new ItemStack(ConfigBlocks.blockStoneDevice,1,10), - new ItemStack(ConfigBlocks.blockMirror,1,0), - new ItemStack(ConfigBlocks.blockMirror,1,6), - new ItemStack(ConfigBlocks.blockStoneDevice,1,14), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigBlocks.blockStoneDevice,1,10), - new ItemStack(ConfigBlocks.blockMirror,1,0), - new ItemStack(ConfigBlocks.blockMirror,1,6), - new ItemStack(ConfigBlocks.blockStoneDevice,1,14), - new ItemStack(TBBlocks.dustBlock,1,0) - }); - - boolean flag = TBConfig.brightFociRequiresPrimordialPearl; - - InfusionRecipe brightFociRec = new InfusionRecipe("TB.NodeFoci.Bright",new ItemStack(TBItems.nodeFoci,1,0),3,new AspectList().add(Aspect.AURA, flag ? 256 : 64).add(Aspect.LIGHT, flag ? 64 : 16).add(Aspect.ENERGY, flag ? 256 : 32),flag ? new ItemStack(ConfigItems.itemEldritchObject,1,3) : new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigBlocks.blockMetalDevice,1,7), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockCustomPlant,1,3), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockMetalDevice,1,7), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockCustomPlant,1,3), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - InfusionRecipe destructionFociRec = new InfusionRecipe("TB.NodeFoci.Destr",new ItemStack(TBItems.nodeFoci,1,1),5,new AspectList().add(Aspect.AURA, 64).add(Aspect.VOID, 16).add(Aspect.DEATH, 32),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,6), - new ItemStack(TBBlocks.crystalBlock,1,7), - new ItemStack(ConfigBlocks.blockTube,1,7), - new ItemStack(ConfigItems.itemFocusExcavation,1,0), - new ItemStack(ConfigItems.itemResource,1,6), - new ItemStack(TBBlocks.crystalBlock,1,7), - new ItemStack(ConfigBlocks.blockTube,1,7), - new ItemStack(ConfigItems.itemFocusExcavation,1,0) - }); - - InfusionRecipe efficiencyFociRec = new InfusionRecipe("TB.NodeFoci.Efficiency",new ItemStack(TBItems.nodeFoci,1,2),1,new AspectList().add(Aspect.AURA, 64).add(Aspect.VOID, 16).add(Aspect.DEATH, 32),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigItems.itemShard,1,6), - new ItemStack(TBBlocks.dustBlock,1,0) - }); - - InfusionRecipe hungerFociRec = new InfusionRecipe("TB.NodeFoci.Hunger",new ItemStack(TBItems.nodeFoci,1,3),7,new AspectList().add(Aspect.AURA, 64).add(Aspect.VOID, 64).add(Aspect.HUNGER, 256).add(Aspect.GREED, 64).add(Aspect.ENERGY, 128),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemThaumometer,1,0), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockStoneDevice,1,11), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemThaumometer,1,0), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigBlocks.blockStoneDevice,1,11) - }); - - InfusionRecipe unstableFociRec = new InfusionRecipe("TB.NodeFoci.Unstable",new ItemStack(TBItems.nodeFoci,1,4),3,new AspectList().add(Aspect.AURA, 64).add(Aspect.DEATH, 32).add(Aspect.ENTROPY, 64),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(Items.ender_pearl), - new ItemStack(TBBlocks.crystalBlock,1,5), - new ItemStack(Items.ender_pearl), - new ItemStack(TBBlocks.crystalBlock,1,5), - new ItemStack(Items.ender_pearl), - new ItemStack(TBBlocks.crystalBlock,1,5), - new ItemStack(Items.ender_pearl), - new ItemStack(TBBlocks.crystalBlock,1,5) - }); - - InfusionRecipe pureFociRec = new InfusionRecipe("TB.NodeFoci.Purity",new ItemStack(TBItems.nodeFoci,1,5),0,new AspectList().add(Aspect.AURA, 64).add(Aspect.LIFE, 64).add(Aspect.ORDER, 64),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigBlocks.blockCustomPlant,1,1), - new ItemStack(ConfigBlocks.blockCustomPlant,1,4), - new ItemStack(ConfigBlocks.blockMagicalLog,1,1), - new ItemStack(ConfigBlocks.blockCustomPlant,1,2), - new ItemStack(ConfigBlocks.blockMagicalLeaves,1,1), - new ItemStack(ConfigBlocks.blockCustomPlant,1,4), - new ItemStack(ConfigBlocks.blockMagicalLog,1,1), - new ItemStack(ConfigBlocks.blockCustomPlant,1,2) - }); - - InfusionRecipe sinisterFociRec = new InfusionRecipe("TB.NodeFoci.Sinister",new ItemStack(TBItems.nodeFoci,1,6),4,new AspectList().add(Aspect.AURA, 64).add(Aspect.DARKNESS, 32).add(Aspect.UNDEAD, 64),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigItems.itemWispEssence,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(TBBlocks.crystalBlock,1,7), - new ItemStack(ConfigItems.itemFocusPech,1,0), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(ConfigItems.itemWispEssence,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(TBBlocks.crystalBlock,1,7), - new ItemStack(ConfigItems.itemFocusPech,1,0), - new ItemStack(TBBlocks.crystalBlock,1,6) - }); - - InfusionRecipe speedFociRec = new InfusionRecipe("TB.NodeFoci.Speed",new ItemStack(TBItems.nodeFoci,1,7),1,new AspectList().add(Aspect.AURA, 64).add(Aspect.MOTION, 32).add(Aspect.MAGIC, 16),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(TBBlocks.dustBlock,1,0) - }); - - InfusionRecipe stabilityFociRec = new InfusionRecipe("TB.NodeFoci.Stability",new ItemStack(TBItems.nodeFoci,1,8),1,new AspectList().add(Aspect.AURA, 64).add(Aspect.ORDER, 32).add(Aspect.EXCHANGE, 16),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigItems.itemResource,1,10), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.crystalBlock,1,6), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(ConfigItems.itemResource,1,10), - new ItemStack(TBBlocks.dustBlock,1,0), - new ItemStack(TBBlocks.crystalBlock,1,6) - }); - - InfusionRecipe taintFociRec = new InfusionRecipe("TB.NodeFoci.Taint",new ItemStack(TBItems.nodeFoci,1,9),5,new AspectList().add(Aspect.AURA, 64).add(Aspect.TAINT, 64).add(Aspect.ENTROPY, 16),new ItemStack(ConfigItems.itemResource,1,15),new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,11), - new ItemStack(TBBlocks.crystalBlock,1,7), - new ItemStack(ConfigItems.itemResource,1,12), - new ItemStack(TBItems.knoseFragment,1,7), - new ItemStack(ConfigItems.itemResource,1,11), - new ItemStack(TBBlocks.crystalBlock,1,7), - new ItemStack(ConfigItems.itemResource,1,12), - new ItemStack(TBItems.knoseFragment,1,7), - }); - - ShapedArcaneRecipe nodeLinkRec = new ShapedArcaneRecipe("TB.NodeLinker", new ItemStack(TBBlocks.nodeLinker,1,0), primals(5), new Object[]{ - "TPT", - "ANA", - "BOB", - 'T',new ItemStack(ConfigBlocks.blockMetalDevice,1,14), - 'P',new ItemStack(ConfigItems.itemResource,1,15), - 'A',new ItemStack(ConfigBlocks.blockCosmeticSolid,1,6), - 'B',new ItemStack(ConfigBlocks.blockCosmeticSolid,1,7), - 'O',Blocks.obsidian, - 'N',new ItemStack(ConfigItems.itemResource,1,0) - }); - - new ResearchItem("TB.NodeMan",catName,new AspectList().add(Aspect.MECHANISM, 8).add(Aspect.AURA, 8).add(Aspect.ENERGY, 16).add(Aspect.MAGIC, 8),0,-8,3,new ItemStack(TBBlocks.nodeManipulator)) - .setParents("TB.INFUSION","TB.NODESTABILIZERADV","TB.VISPOWER") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.nodeMan.page.0"), - new ResearchPage("tb.rec.nodeMan.page.1"), - new ResearchPage("tb.rec.nodeMan.page.2"), - new ResearchPage("tb.rec.nodeMan.page.3"), - new ResearchPage(nodeManipulatorRec) - ).registerResearchItem(); - - if(flag){ - //copy(ResearchCategories.getResearchList("ELDRITCH").research.get("PRIMPEARL"),"TB.PRIMPEARL",catName,0,-13).setConcealed().setHidden().registerResearchItem(); - - new FakeResearchItem("TB.PRIMPEARL", "THAUMICBASES", "PRIMPEARL", "ELDRITCH", 0, -13, ResearchCategories.getResearch("PRIMPEARL").icon_item).registerResearchItem(); - } - - String[] bParents = flag ? new String[]{"TB.NodeMan","TB.PRIMPEARL"} : new String[]{"TB.NodeMan"}; - - new ResearchItem("TB.NodeFoci.Bright",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.LIGHT, 8),0,-11,0,new ItemStack(TBItems.nodeFoci,1,0)) - .setParents(bParents) - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.bright.page.0"), - new ResearchPage(brightFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Destr",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.DEATH, 8).add(Aspect.VOID, 8),2,-10,0,new ItemStack(TBItems.nodeFoci,1,1)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.destr.page.0"), - new ResearchPage(destructionFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Efficiency",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.MAGIC, 8).add(Aspect.ENERGY, 8),-4,-8,0,new ItemStack(TBItems.nodeFoci,1,2)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.efficiency.page.0"), - new ResearchPage(efficiencyFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Hunger",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.HUNGER, 16).add(Aspect.ENERGY, 16),4,-9,0,new ItemStack(TBItems.nodeFoci,1,3)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setSpecial() - .setPages( - new ResearchPage("tb.rec.foci.hunger.page.0"), - new ResearchPage(hungerFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Unstable",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.ENTROPY, 8).add(Aspect.VOID, 8),-2,-10,0,new ItemStack(TBItems.nodeFoci,1,4)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.unstable.page.0"), - new ResearchPage(unstableFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Purity",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.LIFE, 8).add(Aspect.ORDER, 8),-1,-11,0,new ItemStack(TBItems.nodeFoci,1,5)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.pure.page.0"), - new ResearchPage(pureFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Sinister",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.UNDEAD, 8).add(Aspect.ENTROPY, 8),-3,-10,0,new ItemStack(TBItems.nodeFoci,1,6)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.sinister.page.0"), - new ResearchPage(sinisterFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Speed",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.MOTION, 8).add(Aspect.ENERGY, 8),-4,-9,0,new ItemStack(TBItems.nodeFoci,1,7)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.speed.page.0"), - new ResearchPage(speedFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Stability",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.ORDER, 8).add(Aspect.EXCHANGE, 8),1,-11,0,new ItemStack(TBItems.nodeFoci,1,8)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.stability.page.0"), - new ResearchPage(stabilityFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeFoci.Taint",catName,new AspectList().add(Aspect.AURA, 8).add(Aspect.TAINT, 16).add(Aspect.ENERGY, 8),3,-10,0,new ItemStack(TBItems.nodeFoci,1,9)) - .setParents("TB.NodeMan") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.foci.taint.page.0"), - new ResearchPage(taintFociRec) - ).registerResearchItem(); - - new ResearchItem("TB.NodeLinker",catName,new AspectList().add(Aspect.MECHANISM, 8).add(Aspect.AURA, 8).add(Aspect.TRAVEL, 16).add(Aspect.MAGIC, 8),5,-6,3,new ItemStack(TBBlocks.nodeLinker)) - .setParents("TB.VISPOWER") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.nodeLink.page.0"), - new ResearchPage("tb.rec.nodeLink.page.1"), - new ResearchPage("tb.rec.nodeLink.page.2"), - new ResearchPage(nodeLinkRec) - ).registerResearchItem(); - - - ThaumcraftApi.getCraftingRecipes().add(nodeManipulatorRec); - - ThaumcraftApi.getCraftingRecipes().add(brightFociRec); - ThaumcraftApi.getCraftingRecipes().add(destructionFociRec); - ThaumcraftApi.getCraftingRecipes().add(efficiencyFociRec); - ThaumcraftApi.getCraftingRecipes().add(hungerFociRec); - ThaumcraftApi.getCraftingRecipes().add(unstableFociRec); - ThaumcraftApi.getCraftingRecipes().add(pureFociRec); - ThaumcraftApi.getCraftingRecipes().add(sinisterFociRec); - ThaumcraftApi.getCraftingRecipes().add(speedFociRec); - ThaumcraftApi.getCraftingRecipes().add(stabilityFociRec); - ThaumcraftApi.getCraftingRecipes().add(taintFociRec); - - ThaumcraftApi.getCraftingRecipes().add(nodeLinkRec); - - } - + toolsRec[4] = new ShapedArcaneRecipe( + "TB.Thauminite", TBItems.thauminiteShears, primals(15), new Object[] {" #", "# ", '#', tiG}); - //TODO revolver - if (TBConfig.enableRevolver) { - - ThaumcraftApi.addWarpToResearch("TB.Revolver.Eldritch", 2); - ThaumcraftApi.addWarpToResearch("TB.Revolver.Primal", 4); - ThaumcraftApi.addWarpToResearch("TB.Revolver.Tainted", 3); - ThaumcraftApi.addWarpToResearch("TB.Revolver.Void", 2); - - - InfusionRecipe revolverRec = new InfusionRecipe("TB.Revolver",new ItemStack(TBItems.revolver,1,0),5,new AspectList().add(Aspect.WEAPON, 256).add(Aspect.METAL, 32).add(Aspect.TREE, 16).add(Aspect.TOOL, 12).add(Aspect.ENERGY, 32).add(Aspect.MECHANISM, 12).add(Aspect.VOID, 16).add(Aspect.FIRE, 32),new ItemStack(Blocks.iron_block),new ItemStack[]{ - new ItemStack(Items.fire_charge,1,0), - new ItemStack(Items.gunpowder,1,0), - new ItemStack(ConfigItems.itemResource,1,15), - new ItemStack(ConfigBlocks.blockMagicalLog,1,0), - new ItemStack(Items.gunpowder,1,0), - new ItemStack(ConfigItems.itemFocusFire,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(Items.fire_charge,1,0), - new ItemStack(Items.gunpowder,1,0), - new ItemStack(ConfigItems.itemBowBone,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(ConfigBlocks.blockMagicalLog,1,0), - new ItemStack(Items.gunpowder,1,0), - new ItemStack(Blocks.redstone_torch,1,0) - }); - - RevolverInfusionRecipe accuracyRec = new RevolverInfusionRecipe("TB.Revolver.Accuracy", RevolverUpgrade.accuracy, 1, new AspectList().add(Aspect.ORDER, 8).add(Aspect.SENSES,8), new ItemStack[]{ - new ItemStack(Blocks.glass_pane,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(Items.carrot,1,0), - new ItemStack(Blocks.glass_pane,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(Blocks.glass_pane,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Blocks.glass_pane,1,OreDictionary.WILDCARD_VALUE) - }); - - RevolverInfusionRecipe atropodsRec = new RevolverInfusionRecipe("TB.Revolver.Atropods", RevolverUpgrade.atropodsBane, 1, new AspectList().add(Aspect.DEATH, 8).add(Aspect.BEAST, 8).add(Aspect.CLOTH, 8), new ItemStack[]{ - new ItemStack(Items.spider_eye,1,0), - new ItemStack(Items.fermented_spider_eye,1,0), - new ItemStack(Items.spider_eye,1,0), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - RevolverInfusionRecipe eldritchBRec = new RevolverInfusionRecipe("TB.Revolver.EldritchBane", RevolverUpgrade.eldritchBane, 2, new AspectList().add(Aspect.DEATH, 8).add(Aspect.ELDRITCH, 8), new ItemStack[]{ - new ItemStack(Items.ender_eye,1,0), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.ender_pearl,1,0) - }); - - RevolverInfusionRecipe duelingRec = new RevolverInfusionRecipe("TB.Revolver.Dueling", RevolverUpgrade.dueling, 2, new AspectList().add(Aspect.DEATH, 8).add(Aspect.MAN, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.bed,1,0), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.ghast_tear,1,0), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - RevolverInfusionRecipe efficiencyRec = new RevolverInfusionRecipe("TB.Revolver.Efficiency", RevolverUpgrade.efficiency, 0, new AspectList().add(Aspect.ORDER, 8).add(Aspect.EXCHANGE, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.blaze_powder,1,0), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.enchanted_book,1,0), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - RevolverInfusionRecipe eldritchRec = new RevolverInfusionRecipe("TB.Revolver.Eldritch", RevolverUpgrade.eldritch, 5, new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.VOID, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemEldritchObject,1,0), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemEldritchObject,1,0), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - RevolverInfusionRecipe heavyRec = new RevolverInfusionRecipe("TB.Revolver.Heavy", RevolverUpgrade.heavy, 0, new AspectList().add(Aspect.WEAPON, 8).add(Aspect.METAL, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.iron_sword,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - RevolverInfusionRecipe knowledgeRec = new RevolverInfusionRecipe("TB.Revolver.Knowledge", RevolverUpgrade.knowledge, 0, new AspectList().add(Aspect.MIND, 8).add(Aspect.AURA, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemInkwell,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.book,1,0), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.paper,1,0) - }); - - RevolverInfusionRecipe piercingRec = new RevolverInfusionRecipe("TB.Revolver.Piercing", RevolverUpgrade.piercig, 12, new AspectList().add(Aspect.WEAPON, 32).add(Aspect.AIR, 64), new ItemStack[]{ - new ItemStack(ConfigItems.itemPrimalArrow,1,0), - new ItemStack(ConfigItems.itemPrimalArrow,1,1), - new ItemStack(ConfigItems.itemPrimalArrow,1,2), - new ItemStack(Items.diamond_sword,1,OreDictionary.WILDCARD_VALUE), - new ItemStack(ConfigItems.itemPrimalArrow,1,3), - new ItemStack(ConfigItems.itemPrimalArrow,1,4), - new ItemStack(ConfigItems.itemPrimalArrow,1,5) - }); - - RevolverInfusionRecipe powerRec = new RevolverInfusionRecipe("TB.Revolver.Power", RevolverUpgrade.power, 2, new AspectList().add(Aspect.WEAPON, 16), new ItemStack[]{ - new ItemStack(Items.gunpowder), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.fire_charge), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.fireworks,1,OreDictionary.WILDCARD_VALUE) - }); - - RevolverInfusionRecipe primalRec = new RevolverInfusionRecipe("TB.Revolver.Primal", RevolverUpgrade.primal, 12, new AspectList().add(Aspect.WEAPON, 64).add(primals(64)).add(Aspect.MAGIC, 64), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemEldritchObject,1,3), - new ItemStack(Items.diamond), - new ItemStack(ConfigItems.itemEldritchObject,1,3), - new ItemStack(ConfigItems.itemResource,1,14), - }); - - ItemStack silver = OreDictionary.doesOreNameExist("ingotSilver") && OreDictionary.getOres("ingotSilver") != null && OreDictionary.getOres("ingotSilver").size() > 0? OreDictionary.getOres("ingotSilver").get(0) : new ItemStack(ConfigItems.itemResource,1,15); - - RevolverInfusionRecipe silverRec = new RevolverInfusionRecipe("TB.Revolver.Silver", RevolverUpgrade.silver, 0, new AspectList().add(Aspect.DEATH, 8).add(Aspect.BEAST, 8).add(Aspect.UNDEAD, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemResource,1,3), - silver, - new ItemStack(ConfigItems.itemResource,1,3), - new ItemStack(ConfigItems.itemResource,1,14), - }); - - RevolverInfusionRecipe speedRec = new RevolverInfusionRecipe("TB.Revolver.Speed", RevolverUpgrade.speed, 2, new AspectList().add(Aspect.MOTION, 8).add(Aspect.AIR, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(Items.feather), - new ItemStack(ConfigItems.itemResource,1,14), - }); - - RevolverInfusionRecipe taintedRec = new RevolverInfusionRecipe("TB.Revolver.Tainted", RevolverUpgrade.tainted, 4, new AspectList().add(Aspect.TAINT, 8).add(Aspect.WEAPON, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,11), - new ItemStack(ConfigItems.itemResource,1,14), - new ItemStack(ConfigItems.itemResource,1,12), - new ItemStack(ConfigItems.itemResource,1,14) - }); - - RevolverInfusionRecipe voidRec = new RevolverInfusionRecipe("TB.Revolver.Void", RevolverUpgrade.uvoid, 4, new AspectList().add(Aspect.VOID, 8).add(Aspect.TOOL, 8), new ItemStack[]{ - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(ConfigItems.itemResource,1,16), - new ItemStack(ConfigItems.itemResource,1,16) - }); - - new ResearchItem("TB.Revolver",catName,new AspectList().add(Aspect.WEAPON, 5).add(Aspect.FIRE, 5).add(Aspect.VOID, 4).add(Aspect.TOOL, 2).add(Aspect.ENERGY, 2),-16,-7,4,new ItemStack(TBItems.revolver,1,0)) - .setParentsHidden("TB.INFUSION") - .setConcealed() - .setPages( - new ResearchPage("tb.rec.revolver.page.0"), - new ResearchPage("tb.rec.revolver.page.1"), - new ResearchPage("tb.rec.revolver.page.2"), - new ResearchPage(revolverRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Accuracy",catName,new AspectList().add(Aspect.ORDER, 8).add(Aspect.MECHANISM, 8).add(Aspect.SENSES, 4),-19,-7,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/ACCURACY.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.acc.page.0"), - new ResearchPage(accuracyRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Atropods",catName,new AspectList().add(Aspect.DEATH, 8).add(Aspect.BEAST, 8).add(Aspect.CLOTH, 4),-14,-10,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/BANE_OF_ATROPODS.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.atr.page.0"), - new ResearchPage(atropodsRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.EldritchBane",catName,new AspectList().add(Aspect.DEATH, 8).add(Aspect.ELDRITCH, 4),-13,-8,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/BANE_OF_ELDRITCH.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.elb.page.0"), - new ResearchPage(eldritchBRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Dueling",catName,new AspectList().add(Aspect.DEATH, 8).add(Aspect.MAN, 8),-15,-10,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/DUELING.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.duel.page.0"), - new ResearchPage(duelingRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Efficiency",catName,new AspectList().add(Aspect.ORDER, 8).add(Aspect.EXCHANGE, 8),-19,-8,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/EFFICIENCY.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.eff.page.0"), - new ResearchPage(efficiencyRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Eldritch",catName,new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.VOID, 8),-13,-7,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/ELDRITCH.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.eld.page.0"), - new ResearchPage(eldritchRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Heavy",catName,new AspectList().add(Aspect.WEAPON, 8).add(Aspect.METAL, 8),-19,-6,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/HEAVY.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.hev.page.0"), - new ResearchPage(heavyRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Knowledge",catName,new AspectList().add(Aspect.MIND, 8).add(Aspect.MAGIC, 8),-18,-10,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/KNOWLEGDE.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.kno.page.0"), - new ResearchPage(knowledgeRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Piercing",catName,new AspectList().add(Aspect.WEAPON, 8).add(Aspect.AIR, 8),-17,-10,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/PIERCING.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.pir.page.0"), - new ResearchPage(piercingRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Power",catName,new AspectList().add(Aspect.WEAPON, 8).add(Aspect.MECHANISM, 8),-16,-10,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/POWER.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.pow.page.0"), - new ResearchPage(powerRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Primal",catName,new AspectList().add(Aspect.WEAPON, 8).add(Aspect.AURA, 8).add(primals(16)),-15,-5,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/PRIMAL.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setSpecial() - .setPages( - new ResearchPage("tb.rec.revolver.primal.page.0"), - new ResearchPage(primalRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Silver",catName,new AspectList().add(Aspect.DEATH, 8).add(Aspect.UNDEAD, 8),-13,-9,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/SILVER.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.sil.page.0"), - new ResearchPage(silverRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Speed",catName,new AspectList().add(Aspect.MOTION, 8).add(Aspect.AIR, 8),-19,-9,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/SPEED.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.spe.page.0"), - new ResearchPage(speedRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Tainted",catName,new AspectList().add(Aspect.TAINT, 8).add(Aspect.MAGIC, 8),-18,-4,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/TAINTED.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.tai.page.0"), - new ResearchPage(taintedRec) - ).registerResearchItem(); - - new ResearchItem("TB.Revolver.Void",catName,new AspectList().add(Aspect.VOID, 8).add(Aspect.METAL, 8),-19,-5,0,new ResourceLocation("thaumicbases","textures/thaumonomicon/revolver/VOID.png")) - .setParents("TB.Revolver") - .setConcealed() - .setSecondary() - .setPages( - new ResearchPage("tb.rec.revolver.void.page.0"), - new ResearchPage(voidRec) - ).registerResearchItem(); - - - ThaumcraftApi.getCraftingRecipes().add(revolverRec); - ThaumcraftApi.getCraftingRecipes().add(accuracyRec); - ThaumcraftApi.getCraftingRecipes().add(atropodsRec); - ThaumcraftApi.getCraftingRecipes().add(eldritchBRec); - ThaumcraftApi.getCraftingRecipes().add(duelingRec); - ThaumcraftApi.getCraftingRecipes().add(efficiencyRec); - ThaumcraftApi.getCraftingRecipes().add(eldritchRec); - ThaumcraftApi.getCraftingRecipes().add(heavyRec); - ThaumcraftApi.getCraftingRecipes().add(knowledgeRec); - ThaumcraftApi.getCraftingRecipes().add(piercingRec); - ThaumcraftApi.getCraftingRecipes().add(powerRec); - ThaumcraftApi.getCraftingRecipes().add(primalRec); - ThaumcraftApi.getCraftingRecipes().add(silverRec); - ThaumcraftApi.getCraftingRecipes().add(speedRec); - ThaumcraftApi.getCraftingRecipes().add(taintedRec); - ThaumcraftApi.getCraftingRecipes().add(voidRec); - - } - - //TODO void metal stuff - ShapedOreRecipe voidShearsRec = new ShapedOreRecipe(new ItemStack(TBItems.voidShears),new Object[]{ - " #", - "# ", - '#',new ItemStack(ConfigItems.itemResource,1,16) - }); - - ShapedOreRecipe voidFlint = new ShapedOreRecipe(new ItemStack(TBItems.voidFAS),new Object[]{ - "# ", - " C", - '#',new ItemStack(ConfigItems.itemResource,1,16), - 'C',new ItemStack(Items.flint) - }); - - ResearchItem voidIngot = ResearchCategories.getResearchList("ELDRITCH").research.get("VOIDMETAL"); - - ResearchPage[] currentPages = voidIngot.getPages(); - ResearchPage[] newPages = new ResearchPage[currentPages.length+4]; - System.arraycopy(currentPages, 0, newPages, 0, currentPages.length); - newPages[newPages.length-4] = new ResearchPage(voidFlint); - newPages[newPages.length-3] = new ResearchPage(voidShearsRec); - newPages[newPages.length-2] = new ResearchPage(voidBlockRec); - newPages[newPages.length-1] = new ResearchPage(voidIngotRec); - voidIngot.setPages(newPages); - - CraftingManager.getInstance().getRecipeList().add(voidShearsRec); - CraftingManager.getInstance().getRecipeList().add(voidFlint); - - CraftingManager.getInstance().getRecipeList().add(voidBlockRec); - CraftingManager.getInstance().getRecipeList().add(voidIngotRec); - - - //TODO entity decon - - InfusionRecipe entityDeconstructorRec = new InfusionRecipe("TB.EntityDec",new ItemStack(TBBlocks.entityDeconstructor,1,0),4,new AspectList().add(Aspect.DEATH, 16).add(Aspect.SOUL, 4).add(Aspect.MIND, 16),new ItemStack(ConfigItems.itemThaumometer),new ItemStack[]{ - new ItemStack(Blocks.light_weighted_pressure_plate), - new ItemStack(Blocks.light_weighted_pressure_plate), - new ItemStack(Blocks.heavy_weighted_pressure_plate), - new ItemStack(Blocks.heavy_weighted_pressure_plate), - new ItemStack(ConfigItems.itemResource,1,9), - new ItemStack(ConfigItems.itemResource,1,9), - new ItemStack(ConfigItems.itemResource,1,15), - new ItemStack(ConfigItems.itemResource,1,15) - }); - - new ResearchItem("TB.EntityDec",catName,new AspectList().add(Aspect.MIND, 8).add(Aspect.DEATH, 8).add(Aspect.SOUL, 8),3,-2,1,new ItemStack(TBBlocks.entityDeconstructor,1,0)) - .setParents("TB.INFUSION") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.eDec.page.0"), - new ResearchPage(entityDeconstructorRec) - ).registerResearchItem(); - - new ResearchItem("TB.EntityDecAdv",catName,new AspectList().add(Aspect.MIND, 8).add(Aspect.DEATH, 8),5,-3,1,new ItemStack(ConfigBlocks.blockCrystal,1,OreDictionary.WILDCARD_VALUE)) - .setParents("TB.EntityDec") - .setSecondary() - .setConcealed() - .setPages( - new ResearchPage("tb.rec.eDeca.page.0"), - new ResearchPage("tb.rec.eDeca.page.1") - ).registerResearchItem(); - - ThaumcraftApi.getCraftingRecipes().add(entityDeconstructorRec); - - - - - ThaumcraftApi.getCraftingRecipes().add(drainFociRec); - ThaumcraftApi.getCraftingRecipes().add(expFociRec); - ThaumcraftApi.getCraftingRecipes().add(fluxFociRec); - ThaumcraftApi.getCraftingRecipes().add(activationFociRec); - - ThaumcraftApi.getCraftingRecipes().add(advFurnaceRecipe); - ThaumcraftApi.getCraftingRecipes().add(cryingObsidianRec); - ThaumcraftApi.getCraftingRecipes().add(overchanterRec); - + toolsRec[5] = new ShapedArcaneRecipe("TB.Thauminite", TBItems.thauminitePickaxe, primals(15), new Object[] { + "###", " | ", " | ", '#', tiG, '|', "stickWood" + }); - ThaumcraftApi.getCraftingRecipes().add(relocatorRec); - ThaumcraftApi.getCraftingRecipes().add(irelocatorRec); - ThaumcraftApi.getCraftingRecipes().add(thaumicAnvilRec); - ThaumcraftApi.getCraftingRecipes().add(voidAnvilRec); - - ThaumcraftApi.getCraftingRecipes().add(campfireRec); - ThaumcraftApi.getCraftingRecipes().add(brazierRec); - + toolsRec[6] = new ShapedArcaneRecipe( + "TB.Thauminite", TBItems.thauminiteHelmet, primals(25), new Object[] {"###", "# #", '#', tiG}); - - //TODO actual recipes - - for(int i = 0; i < 6; ++i) - ThaumcraftApi.getCraftingRecipes().add(shards[i]); - - for(int i = 0; i < oldRec.length; ++i) - ThaumcraftApi.getCraftingRecipes().add(oldRec[i]); - - for(int i = 0; i < 10; ++i) - ThaumcraftApi.getCraftingRecipes().add(toolsRec[i]); + toolsRec[7] = new ShapedArcaneRecipe( + "TB.Thauminite", TBItems.thauminiteChest, primals(25), new Object[] {"# #", "###", "###", '#', tiG}); + + toolsRec[8] = new ShapedArcaneRecipe( + "TB.Thauminite", TBItems.thauminiteLeggings, primals(25), new Object[] {"###", "# #", "# #", '#', tiG}); + + toolsRec[9] = new ShapedArcaneRecipe( + "TB.Thauminite", TBItems.thauminiteBoots, primals(25), new Object[] {"# #", "# #", '#', tiG}); + + ShapedArcaneRecipe thauminiteCaps = new ShapedArcaneRecipe( + "CAP_thauminite", new ItemStack(TBItems.resource, 1, 2), primals(25), new Object[] { + "###", + "#@#", + "@@@", + '#', + new ItemStack(TBItems.resource, 1, 0), + '@', + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + ShapedArcaneRecipe thaumicWandCore = new ShapedArcaneRecipe( + "ROD_tbthaumium", new ItemStack(TBItems.resource, 1, 3), primals(50), new Object[] { + " @#", + "@#@", + "#@ ", + '#', + new ItemStack(ConfigItems.itemResource, 1, 2), + '@', + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + CrucibleRecipe[] shards = new CrucibleRecipe[6]; + if (Loader.isModLoaded("gregtech")) { + + shards[0] = new CrucibleRecipe( + "TB.OreDestruction", + new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 0), + new ItemStack(GameRegistry.findBlock("gregtech", "gt.blockores"), 1, 540), + new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.AIR, 3)); + + shards[1] = new CrucibleRecipe( + "TB.OreDestruction", + new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 1), + new ItemStack(GameRegistry.findBlock("gregtech", "gt.blockores"), 1, 541), + new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.FIRE, 3)); + + shards[2] = new CrucibleRecipe( + "TB.OreDestruction", + new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 2), + new ItemStack(GameRegistry.findBlock("gregtech", "gt.blockores"), 1, 543), + new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.WATER, 3)); + + shards[3] = new CrucibleRecipe( + "TB.OreDestruction", + new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 3), + new ItemStack(GameRegistry.findBlock("gregtech", "gt.blockores"), 1, 542), + new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.EARTH, 3)); + + shards[4] = new CrucibleRecipe( + "TB.OreDestruction", + new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 4), + new ItemStack(GameRegistry.findBlock("gregtech", "gt.blockores"), 1, 545), + new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.MAGIC, 1).add(Aspect.ORDER, 3)); + + shards[5] = new CrucibleRecipe( + "TB.OreDestruction", + new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, 5), + new ItemStack(GameRegistry.findBlock("gregtech", "gt.blockores"), 1, 544), + new AspectList().add(Aspect.MAGIC, 1).add(Aspect.ENTROPY, 5)); + } else { + + for (int i = 0; i < 6; ++i) + shards[i] = new CrucibleRecipe( + "TB.OreDestruction", + new ItemStack(ConfigItems.itemShard, TBConfig.shardsFromOre, i), + new ItemStack(ConfigBlocks.blockCustomOre, 1, 1 + i), + new AspectList() + .add(Aspect.ENTROPY, 2) + .add(Aspect.MAGIC, 1) + .add(getPrimalForLoop(i), 3)); + } + CrucibleRecipe[] cBlocks = new CrucibleRecipe[7]; + + for (int i = 0; i < 7; ++i) + if (i < 6) + cBlocks[i] = new CrucibleRecipe( + "TB.CrystalBlocks", + new ItemStack(TBBlocks.crystalBlock, 1, i), + new ItemStack(ConfigBlocks.blockCrystal, 1, i), + new AspectList().add(primals(1)).add(Aspect.CRAFT, 2).add(getPrimalForLoop(i), 2)); + else + cBlocks[i] = new CrucibleRecipe( + "TB.CrystalBlocks", + new ItemStack(TBBlocks.crystalBlock, 1, i), + new ItemStack(ConfigBlocks.blockCrystal, 1, i), + new AspectList().add(primals(1)).add(Aspect.CRAFT, 2).add(primals(1))); + + CrucibleRecipe[] cTaintedBlocks = new CrucibleRecipe[7]; + + for (int i = 0; i < 7; ++i) + if (i < 6) + cTaintedBlocks[i] = new CrucibleRecipe( + "TB.CrystalBlocks", + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigBlocks.blockCrystal, 1, i), + new AspectList() + .add(primals(1)) + .add(Aspect.CRAFT, 2) + .add(getPrimalForLoop(i), 2) + .add(Aspect.TAINT, 2)); + else + cTaintedBlocks[i] = new CrucibleRecipe( + "TB.CrystalBlocks", + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigBlocks.blockCrystal, 1, i), + new AspectList() + .add(primals(1)) + .add(Aspect.CRAFT, 2) + .add(primals(1)) + .add(Aspect.TAINT, 2)); + + InfusionRecipe voidRodRecipe = new InfusionRecipe( + "ROD_tbvoid", + new ItemStack(TBItems.resource, 1, 4), + 6, + new AspectList() + .add(Aspect.ELDRITCH, 64) + .add(Aspect.VOID, 64) + .add(Aspect.MAGIC, 64) + .add(Aspect.AURA, 24) + .add(Aspect.ENERGY, 24), + new ItemStack(TBItems.resource, 1, 3), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(TBBlocks.crystalBlock, 1, 7) + }); + + InfusionRecipe drainFociRec = new InfusionRecipe( + "TB.Foci.Drain", + new ItemStack(TBItems.fociDrain), + 0, + new AspectList().add(Aspect.WATER, 3).add(Aspect.VOID, 6), + new ItemStack(ConfigItems.itemFocusExcavation, 1, 0), + new ItemStack[] { + new ItemStack(Items.bucket), + new ItemStack(Items.bucket), + new ItemStack(ConfigBlocks.blockJar, 1, 3), + new ItemStack(ConfigBlocks.blockJar, 1, 3) + }); + + InfusionRecipe expFociRec = new InfusionRecipe( + "TB.Foci.Experience", + new ItemStack(TBItems.fociExperience), + 5, + new AspectList() + .add(Aspect.GREED, 32) + .add(Aspect.VOID, 32) + .add(Aspect.MIND, 16) + .add(Aspect.HUNGER, 32) + .add(Aspect.MINE, 8), + new ItemStack(ConfigItems.itemFocusExcavation, 1, 0), + new ItemStack[] { + new ItemStack(Items.gold_ingot), + new ItemStack(Items.gold_ingot), + new ItemStack(Items.emerald), + new ItemStack(Items.emerald), + new ItemStack(Items.iron_axe, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Items.iron_pickaxe, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Items.iron_shovel, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Items.shears, 1, OreDictionary.WILDCARD_VALUE) + }); + + InfusionRecipe fluxFociRec = new InfusionRecipe( + "TB.Foci.Flux", + new ItemStack(TBItems.fociFlux), + 3, + new AspectList().add(Aspect.WATER, 16).add(Aspect.VOID, 16).add(Aspect.ORDER, 16), + new ItemStack(Items.diamond, 1, 0), + new ItemStack[] { + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 14), + new ItemStack(ConfigBlocks.blockJar, 1, 3) + }); + + InfusionRecipe activationFociRec = new InfusionRecipe( + "TB.Foci.Activation", + new ItemStack(TBItems.fociActivation), + 0, + new AspectList().add(Aspect.TRAVEL, 8).add(Aspect.SENSES, 8).add(Aspect.MOTION, 8), + new ItemStack(ConfigItems.itemResource, 1, 10), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + Block[] recBlocks = new Block[] { + Blocks.cobblestone, + Blocks.gravel, + Blocks.mossy_cobblestone, + Blocks.iron_block, + Blocks.diamond_block, + Blocks.lapis_block, + Blocks.gold_block, + Blocks.brick_block + }; + + Block[] recResult = new Block[] { + TBBlocks.oldCobble, + TBBlocks.oldGravel, + TBBlocks.oldCobbleMossy, + TBBlocks.oldIron, + TBBlocks.oldDiamond, + TBBlocks.oldLapis, + TBBlocks.oldGold, + TBBlocks.oldBrick + }; + + ShapedArcaneRecipe[] oldRec = new ShapedArcaneRecipe[recResult.length]; + + for (int i = 0; i < oldRec.length; ++i) + oldRec[i] = new ShapedArcaneRecipe( + "TB.DecoBlocks", + new ItemStack(recResult[i], 6, 0), + new AspectList().add(Aspect.ENTROPY, 1), + new Object[] {"# #", "# #", "# #", '#', recBlocks[i]}); + + ShapedArcaneRecipe advFurnaceRecipe = new ShapedArcaneRecipe( + "TB.AdvAlc", + TBBlocks.advAlchFurnace, + new AspectList().add(Aspect.WATER, 20).add(Aspect.FIRE, 20).add(Aspect.AIR, 10), + new Object[] { + "# #", + "#@#", + "$$$", + '#', + new ItemStack(ConfigItems.itemResource, 1, 2), + '@', + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 0), + '$', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 0) + }); + + InfusionRecipe cryingObsidianRec = new InfusionRecipe( + "TB.CryingObs", + new ItemStack(TBBlocks.cryingObsidian, 1, 0), + 2, + new AspectList().add(Aspect.TRAVEL, 16).add(Aspect.LIFE, 16).add(Aspect.SOUL, 16), + new ItemStack(Blocks.obsidian), + new ItemStack[] { + new ItemStack(Items.diamond), + new ItemStack(Items.bed), + new ItemStack(TBBlocks.oldLapis), + new ItemStack(TBBlocks.oldLapis) + }); + + InfusionRecipe overchanterRec = new InfusionRecipe( + "TB.Overchanter", + new ItemStack(TBBlocks.overchanter, 1, 0), + 4, + new AspectList() + .add(primals(32)) + .add(Aspect.MAGIC, 32) + .add(Aspect.MECHANISM, 32) + .add(Aspect.MIND, 16), + new ItemStack(Blocks.enchanting_table), + new ItemStack[] { + new ItemStack(TBBlocks.crystalBlock, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 1), + new ItemStack(TBBlocks.crystalBlock, 1, 2), + new ItemStack(TBBlocks.crystalBlock, 1, 3), + new ItemStack(TBBlocks.crystalBlock, 1, 4), + new ItemStack(TBBlocks.crystalBlock, 1, 5), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 4), + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 4) + }); + + ShapedArcaneRecipe relocatorRec = new ShapedArcaneRecipe( + "TB.Relocator", + new ItemStack(TBBlocks.relocator, 1, 0), + new AspectList().add(Aspect.AIR, 5).add(Aspect.EARTH, 15).add(Aspect.WATER, 5), + new Object[] { + "GAG", + "ENE", + "GWG", + 'G', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + 'A', + "shardAir", + 'E', + "shardEarth", + 'W', + "shardWater", + 'N', + new ItemStack(ConfigItems.itemResource, 1, 1) + }); + + ShapedArcaneRecipe irelocatorRec = new ShapedArcaneRecipe( + "TB.Relocator", + new ItemStack(TBBlocks.relocator, 1, 6), + new AspectList().add(Aspect.AIR, 5).add(Aspect.EARTH, 15).add(Aspect.WATER, 5), + new Object[] { + "GAG", + "ENE", + "GWG", + 'G', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + 'A', + "shardAir", + 'E', + "shardEarth", + 'W', + "shardWater", + 'N', + new ItemStack(ConfigItems.itemResource, 1, 0) + }); + + ShapedArcaneRecipe thaumicAnvilRec = new ShapedArcaneRecipe( + "TB.ThaumicAnvil", new ItemStack(TBBlocks.thaumicAnvil, 1, 0), primals(25), new Object[] { + "###", + " $ ", + "$$$", + '#', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 4), + '$', + new ItemStack(ConfigItems.itemResource, 1, 2) + }); + + InfusionRecipe voidAnvilRec = new InfusionRecipe( + "TB.VoidAnvil", + new ItemStack(TBBlocks.voidAnvil, 1, 0), + 3, + new AspectList() + .add(Aspect.CRAFT, 32) + .add(Aspect.TOOL, 24) + .add(Aspect.WEAPON, 24) + .add(Aspect.ORDER, 48), + new ItemStack(TBBlocks.thaumicAnvil, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack[] { + new ItemStack(TBBlocks.voidBlock), + new ItemStack(TBBlocks.voidBlock), + new ItemStack(TBBlocks.voidBlock), + new ItemStack(TBBlocks.voidBlock), + new ItemStack(TBBlocks.voidBlock) + }); + + ShapedArcaneRecipe campfireRec = new ShapedArcaneRecipe( + "TB.Campfire", + new ItemStack(TBBlocks.campfire), + new AspectList().add(Aspect.FIRE, 5).add(Aspect.ENTROPY, 3), + new Object[] { + "SSS", + "COC", + "GGG", + 'S', + "stickWood", + 'C', + "cobblestone", + 'O', + new ItemStack(Items.coal, 1, OreDictionary.WILDCARD_VALUE), + 'G', + Blocks.gravel + }); + + ShapedArcaneRecipe brazierRec = new ShapedArcaneRecipe( + "TB.Brazier", + new ItemStack(TBBlocks.braizer), + new AspectList().add(Aspect.FIRE, 5).add(Aspect.ENTROPY, 3), + new Object[] { + "SCS", + " V ", + "SSS", + 'S', + new ItemStack(ConfigBlocks.blockSlabStone, 1, 0), + 'C', + new ItemStack(Items.coal, 1, OreDictionary.WILDCARD_VALUE), + 'V', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6) + }); + + ShapedOreRecipe voidBlockRec = new ShapedOreRecipe( + new ItemStack(TBBlocks.voidBlock, 1, 0), + new Object[] {"###", "###", "###", '#', new ItemStack(ConfigItems.itemResource, 1, 16)}); + + ShapelessOreRecipe voidIngotRec = new ShapelessOreRecipe( + new ItemStack(ConfigItems.itemResource, 9, 16), new ItemStack(TBBlocks.voidBlock)); + + // TODO recipes + + // copy(ResearchCategories.getResearchList("ALCHEMY").research.get("CRUCIBLE"),"TB.CRUCIBLE",catName,0,3).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("ALCHEMY").research.get("THAUMIUM"),"TB.THAUMIUM",catName,8,0).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("ALCHEMY").research.get("DISTILESSENTIA"),"TB.DISTILESSENTIA",catName,6,2).setConcealed().setHidden().registerResearchItem(); + + // copy(ResearchCategories.getResearchList("ARTIFICE").research.get("INFUSION"),"TB.INFUSION",catName,0,-3).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("ARTIFICE").research.get("BELLOWS"),"TB.BELLOWS",catName,6,3).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("ARTIFICE").research.get("LEVITATOR"),"TB.LEVITATOR",catName,6,5).setConcealed().setHidden().registerResearchItem(); + + // copy(ResearchCategories.getResearchList("ELDRITCH").research.get("VOIDMETAL"),"TB.VOIDMETAL",catName,15,1).setConcealed().setHidden().registerResearchItem(); + + new FakeResearchItem( + "TB.CRUCIBLE", + "THAUMICBASES", + "CRUCIBLE", + "ALCHEMY", + 0, + 3, + ResearchCategories.getResearch("CRUCIBLE").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.THAUMIUM", + "THAUMICBASES", + "THAUMIUM", + "ALCHEMY", + 8, + 0, + ResearchCategories.getResearch("THAUMIUM").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.DISTILESSENTIA", + "THAUMICBASES", + "DISTILESSENTIA", + "ALCHEMY", + 6, + 2, + ResearchCategories.getResearch("DISTILESSENTIA").icon_item) + .registerResearchItem(); + + new FakeResearchItem( + "TB.INFUSION", + "THAUMICBASES", + "INFUSION", + "ARTIFICE", + 0, + -3, + ResearchCategories.getResearch("INFUSION").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.BELLOWS", + "THAUMICBASES", + "BELLOWS", + "ARTIFICE", + 6, + 3, + ResearchCategories.getResearch("BELLOWS").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.LEVITATOR", + "THAUMICBASES", + "LEVITATOR", + "ARTIFICE", + 6, + 5, + ResearchCategories.getResearch("LEVITATOR").icon_item) + .registerResearchItem(); + + new FakeResearchItem( + "TB.VOIDMETAL", + "THAUMICBASES", + "VOIDMETAL", + "ELDRITCH", + 15, + 1, + ResearchCategories.getResearch("VOIDMETAL").icon_item) + .registerResearchItem(); + + // -2,-18 + // 5,-3 + + IRecipe[] slabs = new IRecipe[12]; + slabs = TBRecipes.slabs.toArray(slabs); + + new ResearchItem( + "TB.DecoBlocks", + catName, + new AspectList(), + 0, + 2, + 0, + new ItemStack(TBBlocks.quicksilverBlock, 1, 0)) + .setRound() + .setAutoUnlock() + .setPages( + new ResearchPage("tb.rec.decoBlocks.page.0"), + new ResearchPage(TBRecipes.recipes.get("quicksilverBlock")), + new ResearchPage(TBRecipes.recipes.get("quicksilver")), + new ResearchPage(TBRecipes.recipes.get("quicksilverBrick")), + new ResearchPage(TBRecipes.recipes.get("eldritchArk")), + new ResearchPage(TBRecipes.recipes.get("ironGreatwood")), + new ResearchPage(oldRec), + new ResearchPage(slabs)) + .registerResearchItem(); + + new ResearchItem( + "TB.AdvancedEntropy", + catName, + new AspectList() + .add(Aspect.ENTROPY, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3), + -3, + 2, + 1, + new ItemStack(Items.blaze_powder, 1, 0)) + .setParents("TB.CRUCIBLE") + .setPages( + new ResearchPage("tb.rec.advEntr.page.0"), + new ResearchPage(wool3Rec), + new ResearchPage(sandstone3Rec), + new ResearchPage(blaze3Rec)) + .registerResearchItem(); + + new ResearchItem( + "TB.AlchemyRestoration", + catName, + new AspectList() + .add(Aspect.ORDER, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3), + -3, + 4, + 1, + new ItemStack(Blocks.packed_ice, 1, 0)) + .setParents("TB.CRUCIBLE") + .setPages( + new ResearchPage("tb.rec.alcRest.page.0"), + new ResearchPage(chiseledBricks), + new ResearchPage(gravel2Cobble), + new ResearchPage(icePacking)) + .registerResearchItem(); + + new ResearchItem( + "TB.Pyrofluid", + catName, + new AspectList() + .add(Aspect.FIRE, 16) + .add(Aspect.MAGIC, 6) + .add(Aspect.ELDRITCH, 8) + .add(Aspect.GREED, 6), + 1, + 6, + 4, + new ItemStack(TBItems.pyroBucket, 1, 0)) + .setParents("TB.CRUCIBLE") + .setPages(new ResearchPage("tb.rec.pyrofluid.page.0"), new ResearchPage(pyrofluidRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.CrystalBlocks", + catName, + new AspectList().add(primals(8)), + -4, + 5, + 1, + new ItemStack(TBBlocks.crystalBlock, 1, OreDictionary.WILDCARD_VALUE)) + .setParents("TB.AlchemyRestoration") + .setPages( + new ResearchPage("tb.rec.cBlocks.page.0"), + new ResearchPage(cBlocks), + new ResearchPage(cTaintedBlocks)) + .registerResearchItem(); + + new ResearchItem( + "TB.Backprocessing", + catName, + new AspectList() + .add(Aspect.ORDER, 8) + .add(Aspect.EXCHANGE, 8) + .add(Aspect.CRAFT, 8), + -6, + 3, + 1, + new ItemStack(Items.reeds, 1, 0)) + .setParents("TB.AlchemyRestoration", "TB.AdvancedEntropy") + .setSecondary() + .setConcealed() + .setPages( + new ResearchPage("tb.rec.backProc.page.0"), + new ResearchPage(blazepowderRest), + new ResearchPage(boneRest), + new ResearchPage(sugarRest), + new ResearchPage(cactiRest)) + .registerResearchItem(); + + // 0, -3 + + new ResearchItem( + "TB.MasterEntropy", + catName, + new AspectList() + .add(Aspect.ENTROPY, 8) + .add(Aspect.MAGIC, 4) + .add(Aspect.GREED, 2), + -5, + 1, + 3, + new ItemStack(Items.string, 1, 0)) + .setParents("TB.AdvancedEntropy") + .setPages( + new ResearchPage("tb.rec.mastEntr.page.0"), + new ResearchPage(wool4Rec), + new ResearchPage(sandstone4Rec), + new ResearchPage(blaze4Rec)) + .registerResearchItem(); + + new ResearchItem( + "TB.StrongEntropy", + catName, + new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.WEAPON, 2), + -1, + 1, + 3, + new ItemStack(Blocks.sand, 1, 0)) + .setParents("TB.AdvancedEntropy") + .setSecondary() + .setPages( + new ResearchPage("tb.rec.strEntr.page.0"), + new ResearchPage(glassSand), + new ResearchPage(gravelSand), + new ResearchPage(barsIron)) + .registerResearchItem(); + + new ResearchItem( + "TB.SimpleDublication", + catName, + new AspectList().add(Aspect.EXCHANGE, 6).add(Aspect.ORDER, 6), + 3, + 5, + 1, + new ItemStack(Items.arrow, 1, 0)) + .setParents("TB.CRUCIBLE") + .setSecondary() + .setPages( + new ResearchPage("tb.rec.simDup.page.0"), + new ResearchPage(arrows), + new ResearchPage(snowball), + new ResearchPage(redstone)) + .registerResearchItem(); + + new ResearchItem( + "TB.Amber", + catName, + new AspectList().add(Aspect.TRAP, 6).add(Aspect.ORDER, 6), + 3, + 4, + 1, + new ItemStack(ConfigItems.itemResource, 1, 6)) + .setParents("TB.CRUCIBLE") + .setSecondary() + .setPages(new ResearchPage("tb.rec.amber.page.0"), new ResearchPage(amber)) + .registerResearchItem(); + + new ResearchItem( + "TB.Quicksilver", + catName, + new AspectList().add(Aspect.TREE, 6).add(Aspect.ORDER, 6), + 3, + 2, + 1, + new ItemStack(ConfigItems.itemResource, 1, 3)) + .setParents("TB.CRUCIBLE") + .setSecondary() + .setPages(new ResearchPage("tb.rec.cinnabar.page.0"), new ResearchPage(cinnabar)) + .registerResearchItem(); + + new ResearchItem( + "TB.Thauminite", + catName, + new AspectList() + .add(Aspect.METAL, 4) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRYSTAL, 8) + .add(Aspect.CRAFT, 2), + 6, + -1, + 2, + new ItemStack(TBItems.resource, 1, 1)) + .setParents("TB.THAUMIUM") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.thauminite.page.0"), + new ResearchPage(thauminiteRec), + new ResearchPage(TBRecipes.recipes.get("thauminiteIngot")), + new ResearchPage(TBRecipes.recipes.get("thauminiteNugget")), + new ResearchPage(TBRecipes.recipes.get("thauminiteBlock")), + new ResearchPage(toolsRec)) + .registerResearchItem(); + + new ResearchItem( + "ROD_tbthaumium", + catName, + new AspectList() + .add(Aspect.METAL, 4) + .add(Aspect.MAGIC, 3) + .add(Aspect.AURA, 4) + .add(Aspect.CRAFT, 2) + .add(Aspect.MAN, 6), + 10, + -1, + 2, + new ItemStack(TBItems.resource, 1, 3)) + .setParents("TB.THAUMIUM") + .setConcealed() + .setPages(new ResearchPage("tb.rec.thaumRod.page.0"), new ResearchPage(thaumicWandCore)) + .registerResearchItem(); + + new ResearchItem( + "ROD_tbvoid", + catName, + new AspectList() + .add(Aspect.ELDRITCH, 4) + .add(Aspect.MAGIC, 3) + .add(Aspect.AURA, 4) + .add(Aspect.VOID, 2) + .add(Aspect.MIND, 6), + 13, + -1, + 4, + new ItemStack(TBItems.resource, 1, 4)) + .setParents("ROD_tbthaumium", "TB.VOIDMETAL") + .setConcealed() + .setSpecial() + .setPages(new ResearchPage("tb.rec.voidRod.page.0"), new ResearchPage(voidRodRecipe)) + .registerResearchItem(); + + new ResearchItem( + "CAP_thauminite", + catName, + new AspectList() + .add(Aspect.METAL, 4) + .add(Aspect.MAGIC, 3) + .add(Aspect.AURA, 4), + 5, + 0, + 2, + new ItemStack(TBItems.resource, 1, 2)) + .setParents("TB.Thauminite") + .setConcealed() + .setPages(new ResearchPage("tb.rec.capthauminite.page.0"), new ResearchPage(thauminiteCaps)) + .registerResearchItem(); + + new ResearchItem( + "TB.SM", + catName, + new AspectList().add(primals(4)), + 3, + 3, + 1, + new ItemStack(ConfigItems.itemResource, 1, 14)) + .setParents("TB.CRUCIBLE", "TB.Quicksilver", "TB.Amber") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.sm.page.0"), new ResearchPage(salisMundis)) + .registerResearchItem(); + + new ResearchItem( + "TB.SMB", + catName, + new AspectList().add(primals(6)).add(Aspect.CRAFT, 2), + 4, + 3, + 1, + new ItemStack(TBBlocks.dustBlock)) + .setParents("TB.SM") + .setConcealed() + .setPages(new ResearchPage("tb.rec.smb.page.0"), new ResearchPage(salisMundusBlockRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.OreDestruction", + catName, + new AspectList() + .add(Aspect.ENTROPY, 8) + .add(Aspect.MAGIC, 4) + .add(Aspect.ORDER, 1) + .add(Aspect.FIRE, 1) + .add(Aspect.AIR, 1) + .add(Aspect.EARTH, 1) + .add(Aspect.WATER, 1), + -7, + 1, + 3, + new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE)) + .setParents("TB.MasterEntropy") + .setPages(new ResearchPage("tb.rec.oreDestr.page.0"), new ResearchPage(shards)) + .registerResearchItem(); + + // copy(ResearchCategories.getResearchList("ARTIFICE").research.get("INFUSIONENCHANTMENT"), + // "TB.INFUSIONENCHANTMENT", catName, 0, 8).setHidden().registerResearchItem(); + + new FakeResearchItem( + "TB.INFUSIONENCHANTMENT", + "THAUMICBASES", + "INFUSIONENCHANTMENT", + "ARTIFICE", + 0, + 8, + ResearchCategories.getResearch("INFUSIONENCHANTMENT").icon_resource) + .registerResearchItem(); + + new ResearchItem( + "TB.ElderKnowledge", + catName, + new AspectList() + .add(Aspect.MAGIC, 8) + .add(Aspect.MIND, 8) + .add(Aspect.WEAPON, 8), + -2, + 8, + 1, + new ResourceLocation("thaumicbases", "textures/enchantments/elder_knowledge.png")) + .setParents("TB.INFUSIONENCHANTMENT") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.enchantments.ewisdom"), new ResearchPage(elderKnowledgeEnch)) + .registerResearchItem(); + + new ResearchItem( + "TB.EldritchBane", + catName, + new AspectList() + .add(Aspect.DEATH, 8) + .add(Aspect.ELDRITCH, 8) + .add(Aspect.WEAPON, 8), + -1, + 10, + 1, + new ResourceLocation("thaumicbases", "textures/enchantments/eldritch_bane.png")) + .setParents("TB.INFUSIONENCHANTMENT") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.enchantments.ebane"), new ResearchPage(elderBaneEnch)) + .registerResearchItem(); + + new ResearchItem( + "TB.MagicTouch", + catName, + new AspectList() + .add(Aspect.MAGIC, 8) + .add(Aspect.AURA, 8) + .add(Aspect.WEAPON, 8), + -1, + 6, + 1, + new ResourceLocation("thaumicbases", "textures/enchantments/magic_touched.png")) + .setParents("TB.INFUSIONENCHANTMENT") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.enchantments.magictouched"), new ResearchPage(magicTouchEnch)) + .registerResearchItem(); + + new ResearchItem( + "TB.Vaporising", + catName, + new AspectList() + .add(Aspect.MAGIC, 8) + .add(Aspect.CRYSTAL, 8) + .add(Aspect.TRAP, 8), + -3, + 7, + 1, + new ResourceLocation("thaumicbases", "textures/enchantments/vaporising.png")) + .setParents("TB.INFUSIONENCHANTMENT") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.enchantments.vaporising"), new ResearchPage(vaporisingEnch)) + .registerResearchItem(); + + new ResearchItem( + "TB.Tainted", + catName, + new AspectList().add(Aspect.TAINT, 16), + -3, + 9, + 1, + new ResourceLocation("thaumicbases", "textures/enchantments/tainted.png")) + .setParents("TB.INFUSIONENCHANTMENT") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.enchantments.taint"), new ResearchPage(taintedEnch)) + .registerResearchItem(); + + new ResearchItem( + "TB.Foci.Drain", + catName, + new AspectList().add(Aspect.WATER, 6).add(Aspect.VOID, 3), + -3, + -2, + 0, + new ItemStack(TBItems.fociDrain)) + .setParents("TB.INFUSION") + .setParentsHidden("FOCUSEXCAVATION", "JARVOID") + .setConcealed() + .setSecondary() + .setPages( + new ResearchPage("tb.rec.drainFoci.page.0"), + new ResearchPage(drainFociRec), + new ResearchPage("tb.rec.drainFoci.page.1"), + new ResearchPage("tb.rec.drainFoci.page.2")) + .registerResearchItem(); + + new ResearchItem( + "TB.Foci.Experience", + catName, + new AspectList() + .add(Aspect.GREED, 16) + .add(Aspect.HUNGER, 16) + .add(Aspect.MINE, 2) + .add(Aspect.MIND, 8), + -2, + -5, + 1, + new ItemStack(TBItems.fociExperience)) + .setParents("TB.INFUSION") + .setParentsHidden("FOCUSEXCAVATION") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.expFoci.page.0"), + new ResearchPage(expFociRec), + new ResearchPage("tb.rec.expFoci.page.1"), + new ResearchPage("tb.rec.expFoci.page.2")) + .registerResearchItem(); + + new ResearchItem( + "TB.Foci.Flux", + catName, + new AspectList() + .add(Aspect.WATER, 4) + .add(Aspect.ORDER, 4) + .add(Aspect.VOID, 4), + -2, + -1, + 0, + new ItemStack(TBItems.fociFlux)) + .setParents("TB.INFUSION") + .setParentsHidden("JARVOID", "FLUXSCRUB") + .setConcealed() + .setSecondary() + .setPages( + new ResearchPage("tb.rec.fluxFoci.page.0"), + new ResearchPage(fluxFociRec), + new ResearchPage("tb.rec.fluxFoci.page.1"), + new ResearchPage("tb.rec.fluxFoci.page.2"), + new ResearchPage("tb.rec.fluxFoci.page.3")) + .registerResearchItem(); + + new ResearchItem( + "TB.Foci.Activation", + catName, + new AspectList() + .add(Aspect.TRAVEL, 4) + .add(Aspect.MOTION, 4) + .add(Aspect.SENSES, 4), + -3, + -4, + 0, + new ItemStack(TBItems.fociActivation)) + .setParents("TB.INFUSION") + .setParentsHidden("MIRRORHAND") + .setConcealed() + .setSecondary() + .setPages( + new ResearchPage("tb.rec.actFoci.page.0"), + new ResearchPage(activationFociRec), + new ResearchPage("tb.rec.actFoci.page.1")) + .registerResearchItem(); + + new ResearchItem( + "TB.AdvAlc", + catName, + new AspectList() + .add(Aspect.MOTION, 16) + .add(Aspect.AIR, 16) + .add(Aspect.FIRE, 8) + .add(Aspect.CRAFT, 4), + 8, + 2, + 2, + new ItemStack(TBBlocks.advAlchFurnace)) + .setParents("TB.THAUMIUM", "TB.DISTILESSENTIA", "TB.BELLOWS") + .setPages(new ResearchPage("tb.rec.advAlc.page.0"), new ResearchPage(advFurnaceRecipe)) + .registerResearchItem(); + + new ResearchItem( + "TB.CryingObs", + catName, + new AspectList() + .add(Aspect.TRAVEL, 8) + .add(Aspect.LIFE, 8) + .add(Aspect.SOUL, 8), + 3, + -4, + 2, + new ItemStack(TBBlocks.cryingObsidian, 1, 0)) + .setParents("TB.INFUSION") + .setConcealed() + .setPages(new ResearchPage("tb.rec.cryingObs.page.0"), new ResearchPage(cryingObsidianRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Overchanter", + catName, + new AspectList().add(primals(8)).add(Aspect.MIND, 8).add(Aspect.MAGIC, 8), + -5, + -3, + 3, + new ItemStack(TBBlocks.overchanter, 1, 0)) + .setParents("TB.INFUSION") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.overchanter.page.0"), + new ResearchPage("tb.rec.overchanter.page.1"), + new ResearchPage("tb.rec.overchanter.page.2"), + new ResearchPage(overchanterRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Relocator", + catName, + new AspectList() + .add(Aspect.MOTION, 4) + .add(Aspect.AIR, 4) + .add(Aspect.VOID, 4), + 6, + 7, + 1, + new ItemStack(TBBlocks.relocator, 1, 0)) + .setParents("TB.LEVITATOR") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.relocator.page.0"), + new ResearchPage(relocatorRec), + new ResearchPage(irelocatorRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.ThaumicAnvil", + catName, + new AspectList().add(Aspect.METAL, 4).add(Aspect.CRAFT, 3), + 10, + 2, + 2, + new ItemStack(TBBlocks.thaumicAnvil, 1, 0)) + .setParents("TB.THAUMIUM") + .setConcealed() + .setPages(new ResearchPage("tb.rec.thaumicAnvil.page.0"), new ResearchPage(thaumicAnvilRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.VoidAnvil", + catName, + new AspectList() + .add(Aspect.METAL, 4) + .add(Aspect.CRAFT, 3) + .add(Aspect.TOOL, 4) + .add(Aspect.ELDRITCH, 4), + 13, + 2, + 2, + new ItemStack(TBBlocks.voidAnvil, 1, 0)) + .setParents("TB.VOIDMETAL", "TB.ThaumicAnvil") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.voidAnvil.page.0"), + new ResearchPage("tb.rec.voidAnvil.page.1"), + new ResearchPage(voidAnvilRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Campfire", + catName, + new AspectList().add(Aspect.FIRE, 3).add(Aspect.MIND, 3).add(Aspect.ENTROPY, 3), + 9, + 5, + 1, + new ItemStack(TBBlocks.campfire, 1, 0)) + .setRound() + .setPages(new ResearchPage("tb.rec.campfire.page.0"), new ResearchPage(campfireRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Brazier", + catName, + new AspectList() + .add(Aspect.FIRE, 3) + .add(Aspect.MIND, 3) + .add(Aspect.ENTROPY, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.MOTION, 3), + 9, + 7, + 0, + new ItemStack(TBBlocks.braizer, 1, 0)) + .setParents("TB.Campfire") + .setSecondary() + .setPages(new ResearchPage("tb.rec.brazier.page.0"), new ResearchPage(brazierRec)) + .registerResearchItem(); + + // TODO last recipes + // -4,-14 + + // Add warp to research + ThaumcraftApi.addWarpToResearch("TB.HerobrinesScythe", 4); + // ench + ThaumcraftApi.addWarpToResearch("TB.Tainted", 3); + + ThaumcraftApi.addWarpToResearch("TB.CryingObs", 1); + ThaumcraftApi.addWarpToResearch("TB.EntityDec", 2); + ThaumcraftApi.addWarpToResearch("TB.VoidAnvil", 2); + + // Add new crudible recips + ThaumcraftApi.getCraftingRecipes().add(wool3Rec); + ThaumcraftApi.getCraftingRecipes().add(sandstone3Rec); + ThaumcraftApi.getCraftingRecipes().add(blaze3Rec); + ThaumcraftApi.getCraftingRecipes().add(wool4Rec); + ThaumcraftApi.getCraftingRecipes().add(sandstone4Rec); + ThaumcraftApi.getCraftingRecipes().add(blaze4Rec); + ThaumcraftApi.getCraftingRecipes().add(glassSand); + ThaumcraftApi.getCraftingRecipes().add(gravelSand); + ThaumcraftApi.getCraftingRecipes().add(barsIron); + ThaumcraftApi.getCraftingRecipes().add(arrows); + ThaumcraftApi.getCraftingRecipes().add(snowball); + ThaumcraftApi.getCraftingRecipes().add(redstone); + ThaumcraftApi.getCraftingRecipes().add(amber); + + // Infusion enchants + ThaumcraftApi.getCraftingRecipes().add(elderKnowledgeEnch); + ThaumcraftApi.getCraftingRecipes().add(elderBaneEnch); + ThaumcraftApi.getCraftingRecipes().add(magicTouchEnch); + ThaumcraftApi.getCraftingRecipes().add(vaporisingEnch); + ThaumcraftApi.getCraftingRecipes().add(taintedEnch); + + // + ThaumcraftApi.getCraftingRecipes().add(cinnabar); + ThaumcraftApi.getCraftingRecipes().add(salisMundis); + ThaumcraftApi.getCraftingRecipes().add(chiseledBricks); + ThaumcraftApi.getCraftingRecipes().add(gravel2Cobble); + ThaumcraftApi.getCraftingRecipes().add(icePacking); + ThaumcraftApi.getCraftingRecipes().add(blazepowderRest); + ThaumcraftApi.getCraftingRecipes().add(boneRest); + ThaumcraftApi.getCraftingRecipes().add(sugarRest); + ThaumcraftApi.getCraftingRecipes().add(cactiRest); + + ThaumcraftApi.getCraftingRecipes().add(salisMundusBlockRec); + + ThaumcraftApi.getCraftingRecipes().add(thauminiteRec); + ThaumcraftApi.getCraftingRecipes().add(thauminiteCaps); + + ThaumcraftApi.getCraftingRecipes().add(pyrofluidRec); + + ThaumcraftApi.getCraftingRecipes().add(thaumicWandCore); + ThaumcraftApi.getCraftingRecipes().add(voidRodRecipe); + + // TODO Tobacco + if (TBConfig.allowTobacco) { + + ThaumcraftApi.addWarpToResearch("TB.Tobacco.Eldritch", 2); + ThaumcraftApi.addWarpToResearch("TB.Tobacco.Tainted", 3); + + ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.tobacco, 1, 1), 1); + + ShapelessArcaneRecipe saturatingTobaccoRec = new ShapelessArcaneRecipe( + "TB.Tobacco.Saturating", + new ItemStack(TBItems.tobacco, 1, 3), + new AspectList().add(Aspect.EARTH, 10).add(Aspect.FIRE, 10).add(Aspect.WATER, 10), + new Object[] {new ItemStack(TBItems.tobacco, 1, 0), new ItemStack(Items.pumpkin_seeds)}); + ShapelessArcaneRecipe saturatingTobaccoRecM = new ShapelessArcaneRecipe( + "TB.Tobacco.Saturating", + new ItemStack(TBItems.tobacco, 1, 3), + new AspectList().add(Aspect.EARTH, 10).add(Aspect.FIRE, 10).add(Aspect.WATER, 10), + new Object[] {new ItemStack(TBItems.tobacco, 1, 0), new ItemStack(Items.melon_seeds)}); + + // Seeds + CrucibleRecipe tobaccoSeedRec = new CrucibleRecipe( + "TB.Tobacco", + new ItemStack(TBItems.tobaccoSeeds, 1, 0), + new ItemStack(Items.wheat_seeds, 1, 0), + new AspectList() + .add(Aspect.MIND, 4) + .add(Aspect.WATER, 4) + .add(Aspect.MAN, 4) + .add(Aspect.CROP, 4)); + + // M&P + ShapelessArcaneRecipe pestleRecipe = new ShapelessArcaneRecipe( + "TB.Tobacco", TBItems.mortar, new AspectList().add(primals(4)), new Object[] { + new ItemStack(Items.bowl), + new ItemStack(Items.stick), + new ItemStack(Blocks.wooden_slab), + new ItemStack(Blocks.wooden_slab), + new ItemStack(Blocks.wooden_slab) + }); + + ShapelessArcaneRecipe genTobaccoRec = new ShapelessArcaneRecipe( + "TB.Tobacco", + new ItemStack(TBItems.tobacco, 1, 0), + new AspectList().add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1), + new Object[] {"pestleAndMortar", new ItemStack(TBItems.resource, 1, 7)}); + + // GW pipe + ShapedArcaneRecipe pipeRecipe = new ShapedArcaneRecipe( + "TB.Tobacco", TBItems.greatwoodPipe, new AspectList().add(primals(4)), new Object[] { + "#@ ", + " ##", + '#', + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), + '@', + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + new ResearchItem( + "TB.Tobacco", + catName, + new AspectList() + .add(Aspect.CROP, 4) + .add(Aspect.HARVEST, 4) + .add(Aspect.MAN, 4) + .add(Aspect.MIND, 4), + 11, + -7, + 3, + new ItemStack(TBItems.greatwoodPipe, 1, 0)) + .setParentsHidden("TB.Plax") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.tobacco.page.0"), + new ResearchPage(tobaccoSeedRec), + new ResearchPage("tb.rec.tobacco.page.1"), + new ResearchPage(pipeRecipe), + new ResearchPage(pestleRecipe), + new ResearchPage(genTobaccoRec), + new ResearchPage("tb.rec.tobacco.page.2")) + .registerResearchItem(); + + // SW Pipe + InfusionRecipe silverwoodPipeRec = new InfusionRecipe( + "TB.SilverwoodPipe", + new ItemStack(TBItems.silverwoodPipe, 1, 0), + 4, + new AspectList().add(Aspect.AURA, 8).add(Aspect.ORDER, 32).add(Aspect.HEAL, 16), + new ItemStack(TBItems.greatwoodPipe, 1, 0), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 7), + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 7), + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 7), + new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 7), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 2) + }); + + new ResearchItem( + "TB.SilverwoodPipe", + catName, + new AspectList() + .add(Aspect.ORDER, 8) + .add(Aspect.HEAL, 8) + .add(Aspect.AURA, 8), + 13, + -9, + 1, + new ItemStack(TBItems.silverwoodPipe, 1, 0)) + .setParents("TB.Tobacco") + .setParentsHidden("TB.INFUSION") + .setConcealed() + .setPages(new ResearchPage("tb.rec.silverPipe.page.0"), new ResearchPage(silverwoodPipeRec)) + .registerResearchItem(); + + // + + InfusionRecipe eldritchTobacoRec = new InfusionRecipe( + "TB.Tobacco.Eldritch", + new ItemStack(TBItems.tobacco, 1, 1), + 1, + new AspectList().add(Aspect.ELDRITCH, 4).add(Aspect.DEATH, 1), + new ItemStack(TBItems.tobacco, 1, 0), + new ItemStack[] {new ItemStack(Items.ender_eye, 1, 0), new ItemStack(Items.arrow, 1, 0)}); + + InfusionRecipe wispyTobaccoRec = new InfusionRecipe( + "TB.Tobacco.Wispy", + new ItemStack(TBItems.tobacco, 1, 8), + 1, + new AspectList().add(Aspect.AURA, 4).add(Aspect.MAGIC, 6), + new ItemStack(TBItems.tobacco, 1, 0), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemCrystalEssence, 1, OreDictionary.WILDCARD_VALUE) + }); + + CrucibleRecipe angryTobaccoRec = new CrucibleRecipe( + "TB.Tobacco.Angry", + new ItemStack(TBItems.tobacco, 1, 2), + new ItemStack(TBItems.tobacco, 1, 0), + new AspectList().add(Aspect.WEAPON, 4).add(Aspect.HUNGER, 4)); + CrucibleRecipe miningTobaccoRec = new CrucibleRecipe( + "TB.Tobacco.Mining", + new ItemStack(TBItems.tobacco, 1, 5), + new ItemStack(TBItems.tobacco, 1, 0), + new AspectList().add(Aspect.MINE, 4).add(Aspect.MOTION, 4)); + CrucibleRecipe wisdomTobaccoRec = new CrucibleRecipe( + "TB.Tobacco.Wisdom", + new ItemStack(TBItems.tobacco, 1, 4), + new ItemStack(TBItems.tobacco, 1, 0), + new AspectList().add(Aspect.MIND, 4).add(Aspect.AIR, 4)); + CrucibleRecipe taintTobaccoRec = new CrucibleRecipe( + "TB.Tobacco.Tainted", + new ItemStack(TBItems.tobacco, 1, 7), + new ItemStack(TBItems.tobacco, 1, 0), + new AspectList().add(Aspect.TAINT, 4).add(Aspect.MIND, 4)); + ShapelessArcaneRecipe sanityTobaccoRec = new ShapelessArcaneRecipe( + "TB.Tobacco.Sanity", + new ItemStack(TBItems.tobacco, 1, 6), + new AspectList().add(Aspect.ORDER, 10).add(Aspect.AIR, 10).add(Aspect.ENTROPY, 10), + new Object[] {new ItemStack(TBItems.tobacco, 1, 0)}); + + new ResearchItem( + "TB.Tobacco.Eldritch", + catName, + new AspectList().add(Aspect.DEATH, 4).add(Aspect.ELDRITCH, 4), + 14, + -7, + 0, + new ItemStack(TBItems.tobacco, 1, 1)) + .setParents("TB.Tobacco") + .setParentsHidden("TB.INFUSION") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.etobacco.page.0"), new ResearchPage(eldritchTobacoRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Tobacco.Wispy", + catName, + new AspectList().add(Aspect.AURA, 4).add(Aspect.MAGIC, 4), + 15, + -9, + 0, + new ItemStack(TBItems.tobacco, 1, 8)) + .setParents("TB.Tobacco") + .setParentsHidden("TB.INFUSION") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.wtobacco.page.0"), new ResearchPage(wispyTobaccoRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Tobacco.Angry", + catName, + new AspectList().add(Aspect.WEAPON, 4).add(Aspect.HUNGER, 4), + 11, + -9, + 0, + new ItemStack(TBItems.tobacco, 1, 2)) + .setParents("TB.Tobacco") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.atobacco.page.0"), new ResearchPage(angryTobaccoRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Tobacco.Mining", + catName, + new AspectList().add(Aspect.MINE, 4).add(Aspect.MOTION, 4), + 8, + -7, + 0, + new ItemStack(TBItems.tobacco, 1, 5)) + .setParents("TB.Tobacco") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.mtobacco.page.0"), new ResearchPage(miningTobaccoRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Tobacco.Wisdom", + catName, + new AspectList().add(Aspect.MIND, 4).add(Aspect.AIR, 4), + 13, + -6, + 0, + new ItemStack(TBItems.tobacco, 1, 4)) + .setParents("TB.Tobacco") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.witobacco.page.0"), new ResearchPage(wisdomTobaccoRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Tobacco.Tainted", + catName, + new AspectList().add(Aspect.MIND, 4).add(Aspect.TAINT, 4), + 15, + -8, + 0, + new ItemStack(TBItems.tobacco, 1, 7)) + .setParents("TB.Tobacco") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.ttobacco.page.0"), new ResearchPage(taintTobaccoRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Tobacco.Saturating", + catName, + new AspectList().add(Aspect.FLESH, 4).add(Aspect.HUNGER, 4), + 10, + -9, + 0, + new ItemStack(TBItems.tobacco, 1, 3)) + .setParents("TB.Tobacco") + .setConcealed() + .setSecondary() + .setPages( + new ResearchPage("tb.rec.stobacco.page.0"), + new ResearchPage(new ShapelessArcaneRecipe[] {saturatingTobaccoRec, saturatingTobaccoRecM})) + .registerResearchItem(); + + new ResearchItem( + "TB.Tobacco.Sanity", + catName, + new AspectList().add(Aspect.ORDER, 4).add(Aspect.MIND, 4), + 9, + -8, + 0, + new ItemStack(TBItems.tobacco, 1, 6)) + .setParents("TB.Tobacco") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.satobacco.page.0"), new ResearchPage(sanityTobaccoRec)) + .registerResearchItem(); + + ThaumcraftApi.getCraftingRecipes().add(tobaccoSeedRec); + ThaumcraftApi.getCraftingRecipes().add(pestleRecipe); + ThaumcraftApi.getCraftingRecipes().add(pipeRecipe); + ThaumcraftApi.getCraftingRecipes().add(genTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(eldritchTobacoRec); + ThaumcraftApi.getCraftingRecipes().add(wispyTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(angryTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(miningTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(wisdomTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(taintTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(saturatingTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(saturatingTobaccoRecM); + ThaumcraftApi.getCraftingRecipes().add(sanityTobaccoRec); + ThaumcraftApi.getCraftingRecipes().add(silverwoodPipeRec); + } + + // TODO BloodyMess + if (TBConfig.enableBloodyMess) { + + // copy(ResearchCategories.getResearchList("ARTIFICE").research.get("ENCHFABRIC"),"TB.ENCHFABRIC",catName,8,-3).setConcealed().setHidden().registerResearchItem(); + + new FakeResearchItem( + "TB.ENCHFABRIC", + "THAUMICBASES", + "ENCHFABRIC", + "ARTIFICE", + 8, + -3, + ResearchCategories.getResearch("ENCHFABRIC").icon_item) + .registerResearchItem(); + + ThaumcraftApi.addWarpToResearch("TB.BloodyRobes", 2); + + ShapedArcaneRecipe bloodyChestRec = new ShapedArcaneRecipe( + "TB.BloodyRobes", + new ItemStack(TBItems.bloodyChest, 1, 0), + new AspectList().add(Aspect.AIR, 5), + new Object[] {"# #", "###", "###", '#', new ItemStack(TBItems.resource, 1, 8)}); + + ShapedArcaneRecipe bloodyLegsRec = new ShapedArcaneRecipe( + "TB.BloodyRobes", + new ItemStack(TBItems.bloodyLeggings, 1, 0), + new AspectList().add(Aspect.WATER, 5), + new Object[] {"###", "# #", "# #", '#', new ItemStack(TBItems.resource, 1, 8)}); + + ShapedArcaneRecipe bloodyBootsRec = new ShapedArcaneRecipe( + "TB.BloodyRobes", + new ItemStack(TBItems.bloodyBoots, 1, 0), + new AspectList().add(Aspect.EARTH, 3), + new Object[] {"# #", "# #", '#', new ItemStack(TBItems.resource, 1, 8)}); + + ShapedArcaneRecipe ironSpikeRec = new ShapedArcaneRecipe( + "TB.Spike.Iron", + new ItemStack(TBBlocks.spike, 1, 0), + new AspectList().add(Aspect.FIRE, 1).add(Aspect.ENTROPY, 1), + new Object[] { + " * ", + "*#*", + "#_#", + '*', + "nuggetIron", + '#', + "ingotIron", + '_', + new ItemStack(Blocks.heavy_weighted_pressure_plate, 1, 0) + }); + + ShapedArcaneRecipe thaumiumSpikeRec = new ShapedArcaneRecipe( + "TB.Spike.Thaumic", new ItemStack(TBBlocks.spike, 1, 2), primals(4), new Object[] { + " * ", + "*#*", + "#_#", + '*', + "nuggetThaumium", + '#', + "ingotThaumium", + '_', + new ItemStack(TBBlocks.spike, 1, 0) + }); + + ShapedArcaneRecipe voidSpikeRec = new ShapedArcaneRecipe( + "TB.Spike.Void", new ItemStack(TBBlocks.spike, 1, 4), primals(4), new Object[] { + " * ", + "*#*", + "#_#", + '*', + "nuggetVoid", + '#', + "ingotVoid", + '_', + new ItemStack(TBBlocks.spike, 1, 2) + }); + + CrucibleRecipe cleanEFabricRec = new CrucibleRecipe( + "TB.Spike.Iron", + new ItemStack(ConfigItems.itemResource, 1, 7), + new ItemStack(TBItems.resource, 1, 8), + new AspectList().add(Aspect.ORDER, 1)); + + new ResearchItem( + "TB.Spike.Iron", + catName, + new AspectList() + .add(Aspect.WEAPON, 6) + .add(Aspect.HUNGER, 6) + .add(Aspect.METAL, 6), + 10, + -3, + 1, + new ItemStack(TBBlocks.spike, 1, 0)) + .setParents("TB.ENCHFABRIC") + .setPages( + new ResearchPage("tb.rec.spikeIron.page.0"), + new ResearchPage(ironSpikeRec), + new ResearchPage(cleanEFabricRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Spike.Thaumic", + catName, + new AspectList() + .add(Aspect.WEAPON, 6) + .add(Aspect.MAGIC, 6) + .add(Aspect.MECHANISM, 6), + 13, + -3, + 1, + new ItemStack(TBBlocks.spike, 1, 2)) + .setConcealed() + .setParents("TB.Spike.Iron") + .setParentsHidden("TB.THAUMIUM") + .setPages(new ResearchPage("tb.rec.spikeThaumic.page.0"), new ResearchPage(thaumiumSpikeRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.BloodyRobes", + catName, + new AspectList() + .add(Aspect.HUNGER, 6) + .add(Aspect.FLESH, 6) + .add(Aspect.ARMOR, 6), + 12, + -4, + 1, + new ItemStack(TBItems.bloodyChest, 1, 0)) + .setConcealed() + .setParents("TB.Spike.Iron") + .setPages( + new ResearchPage("tb.rec.bloodyRobes.page.0"), + new ResearchPage(bloodyChestRec), + new ResearchPage(bloodyLegsRec), + new ResearchPage(bloodyBootsRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Spike.Void", + catName, + new AspectList() + .add(Aspect.WEAPON, 6) + .add(Aspect.ELDRITCH, 6) + .add(Aspect.ARMOR, 6), + 15, + -2, + 2, + new ItemStack(TBBlocks.spike, 1, 4)) + .setConcealed() + .setParents("TB.Spike.Thaumic") + .setParentsHidden("TB.VOIDMETAL") + .setPages(new ResearchPage("tb.rec.spikeVoid.page.0"), new ResearchPage(voidSpikeRec)) + .registerResearchItem(); + + ThaumcraftApi.getCraftingRecipes().add(ironSpikeRec); + ThaumcraftApi.getCraftingRecipes().add(thaumiumSpikeRec); + ThaumcraftApi.getCraftingRecipes().add(voidSpikeRec); + ThaumcraftApi.getCraftingRecipes().add(cleanEFabricRec); + ThaumcraftApi.getCraftingRecipes().add(bloodyChestRec); + ThaumcraftApi.getCraftingRecipes().add(bloodyLegsRec); + ThaumcraftApi.getCraftingRecipes().add(bloodyBootsRec); + } + + // TODO Bracelets + if (TBConfig.enableBracelets) { + + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("CAP_gold"),"TB.CAP_gold",catName,-8,10).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_greatwood"),"TB.ROD_greatwood",catName,-10,6).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_silverwood"),"TB.ROD_silverwood",catName,-12,6).setConcealed().setHidden().registerResearchItem(); + + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_reed"),"TB.ROD_reed",catName,-19,5).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_blaze"),"TB.ROD_blaze",catName,-15,5).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_obsidian"),"TB.ROD_obsidian",catName,-19,11).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_ice"),"TB.ROD_ice",catName,-17,5).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_quartz"),"TB.ROD_quartz",catName,-17,11).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("ROD_bone"),"TB.ROD_bone",catName,-15,11).setConcealed().setHidden().registerResearchItem(); + + // copy(ResearchCategories.getResearchList("ELDRITCH").research.get("ROD_primal_staff"),"TB.ROD_primal_staff",catName,-19,8).setConcealed().setHidden().registerResearchItem(); + + new FakeResearchItem( + "TB.CAP_gold", + "THAUMICBASES", + "CAP_gold", + "THAUMATURGY", + -8, + 10, + ResearchCategories.getResearch("CAP_gold").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.ROD_greatwood", + "THAUMICBASES", + "ROD_greatwood", + "THAUMATURGY", + -10, + 6, + ResearchCategories.getResearch("ROD_greatwood").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.ROD_silverwood", + "THAUMICBASES", + "ROD_silverwood", + "THAUMATURGY", + -12, + 6, + ResearchCategories.getResearch("ROD_silverwood").icon_item) + .registerResearchItem(); + + new FakeResearchItem( + "TB.ROD_reed", + "THAUMICBASES", + "ROD_reed", + "THAUMATURGY", + -19, + 5, + ResearchCategories.getResearch("ROD_reed").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.ROD_blaze", + "THAUMICBASES", + "ROD_blaze", + "THAUMATURGY", + -15, + 5, + ResearchCategories.getResearch("ROD_blaze").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.ROD_obsidian", + "THAUMICBASES", + "ROD_obsidian", + "THAUMATURGY", + -19, + 11, + ResearchCategories.getResearch("ROD_obsidian").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.ROD_ice", + "THAUMICBASES", + "ROD_ice", + "THAUMATURGY", + -17, + 5, + ResearchCategories.getResearch("ROD_ice").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.ROD_quartz", + "THAUMICBASES", + "ROD_quartz", + "THAUMATURGY", + -17, + 11, + ResearchCategories.getResearch("ROD_quartz").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.ROD_bone", + "THAUMICBASES", + "ROD_bone", + "THAUMATURGY", + -15, + 11, + ResearchCategories.getResearch("ROD_bone").icon_item) + .registerResearchItem(); + + new FakeResearchItem( + "TB.ROD_primal_staff", + "THAUMICBASES", + "ROD_primal_staff", + "THAUMATURGY", + -19, + 8, + ResearchCategories.getResearch("ROD_primal_staff").icon_item) + .registerResearchItem(); + + ThaumcraftApi.addWarpToResearch("TB.Bracelet.Void", 2); + ThaumcraftApi.addWarpToResearch("TB.Bracelet.Bone", 1); + ThaumcraftApi.addWarpToResearch("TB.Bracelet.Primal", 4); + + ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.castingBracelet, 1, 12), 3); + + ShapedArcaneRecipe ironBraceletRec = new ShapedArcaneRecipe( + "TB.Bracelet.Iron", new ItemStack(TBItems.castingBracelet, 1, 0), primals(1), new Object[] { + "CIC", + "N N", + 'C', + new ItemStack(ConfigItems.itemWandCap, 1, 0), + 'I', + "ingotIron", + 'N', + "nuggetIron" + }); + + ShapedArcaneRecipe goldBraceletRec = new ShapedArcaneRecipe( + "TB.Bracelet.Gold", new ItemStack(TBItems.castingBracelet, 1, 1), primals(5), new Object[] { + "CIC", + "N N", + 'C', + new ItemStack(ConfigItems.itemWandCap, 1, 1), + 'I', + "ingotGold", + 'N', + "nuggetGold" + }); + + ShapedArcaneRecipe greatwoodBraceletRec = new ShapedArcaneRecipe( + "TB.Bracelet.Greatwood", new ItemStack(TBItems.castingBracelet, 1, 2), primals(25), new Object[] { + "CIC", + "I I", + 'C', + new ItemStack(ConfigItems.itemWandCap, 1, 1), + 'I', + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 0) + }); + + ShapedArcaneRecipe thaumiumBraceletRec = new ShapedArcaneRecipe( + "TB.Bracelet.Thaumium", new ItemStack(TBItems.castingBracelet, 1, 3), primals(25), new Object[] { + "CIC", + "INI", + "N N", + 'C', + new ItemStack(TBItems.resource, 1, 2), + 'I', + new ItemStack(ConfigItems.itemResource, 1, 2), + 'N', + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + InfusionRecipe silverwoodBraceletRec = new InfusionRecipe( + "TB.Bracelet.Silverwood", + new ItemStack(TBItems.castingBracelet, 1, 4), + 5, + primals(17).add(Aspect.MAGIC, 17), + new ItemStack(ConfigItems.itemWandRod, 1, 2), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), + new ItemStack(ConfigBlocks.blockCrystal, 1, 6), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), + new ItemStack(ConfigBlocks.blockCrystal, 1, 6) + }); + + InfusionRecipe voidBraceletRec = new InfusionRecipe( + "TB.Bracelet.Void", + new ItemStack(TBItems.castingBracelet, 1, 11), + 8, + new AspectList() + .add(Aspect.ELDRITCH, 64) + .add(Aspect.VOID, 64) + .add(Aspect.MAGIC, 64) + .add(Aspect.AURA, 24) + .add(Aspect.ENERGY, 24), + new ItemStack(TBItems.resource, 1, 4), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(TBBlocks.crystalBlock, 1, 6) + }); + + InfusionRecipe reedBraceletRec = new InfusionRecipe( + "TB.Bracelet.Reed", + new ItemStack(TBItems.castingBracelet, 1, 5), + 2, + new AspectList().add(Aspect.AIR, 24).add(Aspect.MOTION, 12).add(Aspect.MAGIC, 8), + new ItemStack(ConfigItems.itemWandRod, 1, 5), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 0), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 0) + }); + + InfusionRecipe boneBraceletRec = new InfusionRecipe( + "TB.Bracelet.Bone", + new ItemStack(TBItems.castingBracelet, 1, 6), + 2, + new AspectList() + .add(Aspect.ENTROPY, 24) + .add(Aspect.UNDEAD, 12) + .add(Aspect.MAGIC, 8), + new ItemStack(ConfigItems.itemWandRod, 1, 7), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 5), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 5) + }); + + InfusionRecipe obsidianBraceletRec = new InfusionRecipe( + "TB.Bracelet.Obsidian", + new ItemStack(TBItems.castingBracelet, 1, 7), + 2, + new AspectList() + .add(Aspect.EARTH, 24) + .add(Aspect.DARKNESS, 12) + .add(Aspect.MAGIC, 8), + new ItemStack(ConfigItems.itemWandRod, 1, 1), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 3), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 3) + }); + + InfusionRecipe blazeBraceletRec = new InfusionRecipe( + "TB.Bracelet.Blaze", + new ItemStack(TBItems.castingBracelet, 1, 8), + 2, + new AspectList().add(Aspect.FIRE, 24).add(Aspect.BEAST, 12).add(Aspect.MAGIC, 8), + new ItemStack(ConfigItems.itemWandRod, 1, 6), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 1), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 1) + }); + + InfusionRecipe iceBraceletRec = new InfusionRecipe( + "TB.Bracelet.Ice", + new ItemStack(TBItems.castingBracelet, 1, 9), + 2, + new AspectList().add(Aspect.WATER, 24).add(Aspect.COLD, 12).add(Aspect.MAGIC, 8), + new ItemStack(ConfigItems.itemWandRod, 1, 3), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 2), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 2) + }); + + InfusionRecipe quartzBraceletRec = new InfusionRecipe( + "TB.Bracelet.Quartz", + new ItemStack(TBItems.castingBracelet, 1, 10), + 2, + new AspectList() + .add(Aspect.ORDER, 24) + .add(Aspect.ENERGY, 12) + .add(Aspect.MAGIC, 8), + new ItemStack(ConfigItems.itemWandRod, 1, 4), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 4), + new ItemStack(ConfigItems.itemWandCap, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 4) + }); + + InfusionRecipe primalBraceletRec = new InfusionRecipe( + "TB.Bracelet.Primal", + new ItemStack(TBItems.castingBracelet, 1, 12), + 7, + primals(48).add(Aspect.MAGIC, 96), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigItems.itemWandCap, 1, 7), + new ItemStack(TBItems.castingBracelet, 1, 5), + new ItemStack(TBItems.castingBracelet, 1, 6), + new ItemStack(TBItems.castingBracelet, 1, 7), + new ItemStack(ConfigItems.itemWandCap, 1, 7), + new ItemStack(TBItems.castingBracelet, 1, 8), + new ItemStack(TBItems.castingBracelet, 1, 9), + new ItemStack(TBItems.castingBracelet, 1, 10) + }); + + new ResearchItem( + "TB.Bracelet.Iron", + catName, + new AspectList().add(Aspect.METAL, 3).add(Aspect.MAGIC, 3), + -6, + 7, + 0, + new ItemStack(TBItems.castingBracelet, 1, 0)) + .setRound() + .setPages( + new ResearchPage("tb.rec.bracelet.iron.page.0"), + new ResearchPage("tb.rec.bracelet.iron.page.1"), + new ResearchPage("tb.rec.bracelet.iron.page.2"), + new ResearchPage(ironBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Gold", + catName, + new AspectList() + .add(Aspect.METAL, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.GREED, 3), + -8, + 8, + 0, + new ItemStack(TBItems.castingBracelet, 1, 1)) + .setParents("TB.Bracelet.Iron", "TB.CAP_gold") + .setPages(new ResearchPage("tb.rec.bracelet.gold.page.0"), new ResearchPage(goldBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Greatwood", + catName, + new AspectList() + .add(Aspect.TREE, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.ENERGY, 3), + -10, + 8, + 0, + new ItemStack(TBItems.castingBracelet, 1, 2)) + .setConcealed() + .setParents("TB.Bracelet.Gold", "TB.ROD_greatwood") + .setPages( + new ResearchPage("tb.rec.bracelet.greatwood.page.0"), + new ResearchPage(greatwoodBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Thaumium", + catName, + new AspectList() + .add(Aspect.METAL, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.ENERGY, 3) + .add(Aspect.AURA, 3), + -10, + 11, + 0, + new ItemStack(TBItems.castingBracelet, 1, 3)) + .setConcealed() + .setParents("TB.Bracelet.Greatwood") + .setParentsHidden("TB.THAUMIUM", "CAP_thauminite") + .setPages( + new ResearchPage("tb.rec.bracelet.thaumium.page.0"), new ResearchPage(thaumiumBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Silverwood", + catName, + new AspectList() + .add(Aspect.ORDER, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.TREE, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -12, + 8, + 1, + new ItemStack(TBItems.castingBracelet, 1, 4)) + .setConcealed() + .setParents("TB.Bracelet.Greatwood", "TB.ROD_silverwood") + .setPages( + new ResearchPage("tb.rec.bracelet.silverwood.page.0"), + new ResearchPage(silverwoodBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Void", + catName, + new AspectList() + .add(Aspect.VOID, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.ELDRITCH, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -12, + 11, + 3, + new ItemStack(TBItems.castingBracelet, 1, 11)) + .setConcealed() + .setParents("TB.Bracelet.Silverwood") + .setParentsHidden("TB.VOIDMETAL") + .setPages(new ResearchPage("tb.rec.bracelet.void.page.0"), new ResearchPage(voidBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Reed", + catName, + new AspectList() + .add(Aspect.AIR, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -19, + 6, + 2, + new ItemStack(TBItems.castingBracelet, 1, 5)) + .setConcealed() + .setParents("TB.ROD_reed") + .setParentsHidden("TB.Bracelet.Greatwood") + .setPages(new ResearchPage("tb.rec.bracelet.reed.page.0"), new ResearchPage(reedBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Blaze", + catName, + new AspectList() + .add(Aspect.FIRE, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -15, + 6, + 2, + new ItemStack(TBItems.castingBracelet, 1, 8)) + .setConcealed() + .setParents("TB.ROD_blaze") + .setParentsHidden("TB.Bracelet.Greatwood") + .setPages(new ResearchPage("tb.rec.bracelet.blaze.page.0"), new ResearchPage(blazeBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Obsidian", + catName, + new AspectList() + .add(Aspect.EARTH, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -19, + 10, + 2, + new ItemStack(TBItems.castingBracelet, 1, 7)) + .setConcealed() + .setParents("TB.ROD_obsidian") + .setParentsHidden("TB.Bracelet.Greatwood") + .setPages( + new ResearchPage("tb.rec.bracelet.obsidian.page.0"), new ResearchPage(obsidianBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Ice", + catName, + new AspectList() + .add(Aspect.WATER, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -17, + 6, + 2, + new ItemStack(TBItems.castingBracelet, 1, 9)) + .setConcealed() + .setParents("TB.ROD_ice") + .setParentsHidden("TB.Bracelet.Greatwood") + .setPages(new ResearchPage("tb.rec.bracelet.ice.page.0"), new ResearchPage(iceBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Quartz", + catName, + new AspectList() + .add(Aspect.ORDER, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -17, + 10, + 2, + new ItemStack(TBItems.castingBracelet, 1, 10)) + .setConcealed() + .setParents("TB.ROD_quartz") + .setParentsHidden("TB.Bracelet.Greatwood") + .setPages(new ResearchPage("tb.rec.bracelet.quartz.page.0"), new ResearchPage(quartzBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Bone", + catName, + new AspectList() + .add(Aspect.ENTROPY, 3) + .add(Aspect.MAGIC, 3) + .add(Aspect.CRAFT, 3) + .add(Aspect.AURA, 3) + .add(Aspect.EXCHANGE, 3), + -15, + 10, + 2, + new ItemStack(TBItems.castingBracelet, 1, 6)) + .setConcealed() + .setParents("TB.ROD_bone") + .setParentsHidden("TB.Bracelet.Greatwood") + .setPages(new ResearchPage("tb.rec.bracelet.bone.page.0"), new ResearchPage(boneBraceletRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Bracelet.Primal", + catName, + primals(6).add(Aspect.MAGIC, 12).add(Aspect.ELDRITCH, 12), + -17, + 8, + 4, + new ItemStack(TBItems.castingBracelet, 1, 12)) + .setConcealed() + .setSpecial() + .setParents( + "TB.ROD_primal_staff", + "TB.Bracelet.Bone", + "TB.Bracelet.Quartz", + "TB.Bracelet.Ice", + "TB.Bracelet.Obsidian", + "TB.Bracelet.Blaze", + "TB.Bracelet.Reed", + "TB.Bracelet.Silverwood") + .setPages(new ResearchPage("tb.rec.bracelet.primal.page.0"), new ResearchPage(primalBraceletRec)) + .registerResearchItem(); + + ThaumcraftApi.getCraftingRecipes().add(ironBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(goldBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(greatwoodBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(thaumiumBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(silverwoodBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(voidBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(reedBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(boneBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(obsidianBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(blazeBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(iceBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(quartzBraceletRec); + ThaumcraftApi.getCraftingRecipes().add(primalBraceletRec); + } + + // TODO Flora + if (TBConfig.enableFlora) { + + ThaumcraftApi.addWarpToResearch("TB.Aurelia", 2); + ThaumcraftApi.addWarpToResearch("TB.Flaxium", 2); + ThaumcraftApi.addWarpToResearch("TB.Lucrite", 1); + + CrucibleRecipe plaxRec = new CrucibleRecipe( + "TB.Plax", + new ItemStack(TBItems.plaxSeed, 1, 0), + new ItemStack(Items.wheat_seeds), + new AspectList().add(Aspect.CLOTH, 4)); + CrucibleRecipe metalleatRec = new CrucibleRecipe( + "TB.Metalleat", + new ItemStack(TBItems.metalleatSeeds, 1, 0), + new ItemStack(Items.wheat_seeds), + new AspectList().add(Aspect.ORDER, 4).add(Aspect.METAL, 12).add(Aspect.LIFE, 4)); + CrucibleRecipe lucriteRec = new CrucibleRecipe( + "TB.Lucrite", + new ItemStack(TBItems.lucriteSeeds, 1, 0), + new ItemStack(Items.golden_carrot), + new AspectList().add(Aspect.HUNGER, 4).add(Aspect.GREED, 12).add(Aspect.LIFE, 4)); + + CrucibleRecipe aureliaRec = new CrucibleRecipe( + "TB.Aurelia", + new ItemStack(TBBlocks.aurelia), + new ItemStack(Blocks.red_flower, 1, 7), + new AspectList() + .add(Aspect.PLANT, 8) + .add(Aspect.ELDRITCH, 2) + .add(Aspect.AURA, 2)); + CrucibleRecipe knoseRec = new CrucibleRecipe( + "TB.Knose", + new ItemStack(TBItems.knoseSeed), + new ItemStack(Blocks.double_plant, 1, 4), + new AspectList().add(Aspect.MIND, 16).add(Aspect.LIFE, 8).add(Aspect.ENERGY, 2)); + CrucibleRecipe knowledgeFragmentRec = new CrucibleRecipe( + "TB.Knose", + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(TBItems.knoseFragment, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.ORDER, 1).add(Aspect.EXCHANGE, 1)); + CrucibleRecipe sweedRec = new CrucibleRecipe( + "TB.BasicPlants", + new ItemStack(TBItems.sweedSeeds), + new ItemStack(Blocks.tallgrass, 1, OreDictionary.WILDCARD_VALUE), + new AspectList().add(Aspect.MOTION, 2).add(Aspect.LIFE, 1)); + CrucibleRecipe lazulliaRec = new CrucibleRecipe( + "TB.Lazullia", + new ItemStack(TBItems.lazulliaSeeds), + new ItemStack(Items.wheat_seeds), + new AspectList().add(Aspect.SENSES, 12).add(Aspect.GREED, 3)); + CrucibleRecipe rainbowCactiRec = new CrucibleRecipe( + "TB.RainbowCacti", + new ItemStack(TBBlocks.rainbowCactus), + new ItemStack(Blocks.cactus), + new AspectList().add(Aspect.EXCHANGE, 24).add(Aspect.SENSES, 6)); + CrucibleRecipe redlonRec = new CrucibleRecipe( + "TB.Redlon", + new ItemStack(TBItems.redlonSeeds), + new ItemStack(Items.melon_seeds), + new AspectList().add(Aspect.MECHANISM, 16).add(Aspect.ENERGY, 16)); + CrucibleRecipe aspectShroomRec = new CrucibleRecipe( + "TB.Ashroom", + new ItemStack(TBBlocks.ashroom, 1, 0), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 5), + new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.CROP, 2)); + CrucibleRecipe flaxiumRec = new CrucibleRecipe( + "TB.Flaxium", + new ItemStack(TBBlocks.flaxium, 1, 0), + new ItemStack(Blocks.red_flower, 1, 2), + new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.MAGIC, 2)); + CrucibleRecipe glieoniaRec = new CrucibleRecipe( + "TB.Glieonia", + new ItemStack(TBItems.glieoniaSeed, 1, 0), + new ItemStack(Blocks.red_flower, 1, 3), + new AspectList().add(Aspect.LIGHT, 8).add(Aspect.MAGIC, 6).add(Aspect.LIFE, 4)); + CrucibleRecipe briarRec = new CrucibleRecipe( + "TB.Briar", + new ItemStack(TBBlocks.briar, 1, 0), + new ItemStack(Blocks.double_plant, 1, 4), + new AspectList().add(Aspect.HEAL, 4).add(Aspect.LIFE, 4).add(Aspect.PLANT, 4)); + + ShapelessArcaneRecipe rosehipRec = new ShapelessArcaneRecipe( + "TB.Briar", + TBItems.rosehipSyrup, + new AspectList().add(Aspect.FIRE, 3).add(Aspect.WATER, 5), + new Object[] { + new ItemStack(ConfigItems.itemEssence, 1, 0), + new ItemStack(TBItems.resource, 1, 6), + new ItemStack(Items.sugar, 1, 0) + }); + + InfusionRecipe voidSeedRec = new InfusionRecipe( + "TB.VoidSeed", + new ItemStack(TBItems.voidSeed, 1, 0), + 3, + new AspectList() + .add(Aspect.ELDRITCH, 16) + .add(Aspect.DARKNESS, 16) + .add(Aspect.CROP, 16), + new ItemStack(ConfigItems.itemResource, 1, 17), + new ItemStack[] { + new ItemStack(Items.wheat_seeds, 1, 0), + new ItemStack(Items.pumpkin_seeds, 1, 0), + new ItemStack(Items.melon_seeds, 1, 0), + new ItemStack(Items.poisonous_potato, 1, 0), + new ItemStack(Items.carrot, 1, 0), + new ItemStack(Items.nether_wart, 1, 0), + }); + + InfusionRecipe goldenOakRec = new InfusionRecipe( + "TB.GoldenOak", + new ItemStack(TBBlocks.sapling), + 2, + new AspectList().add(Aspect.PLANT, 16).add(Aspect.GREED, 64), + new ItemStack(Blocks.sapling, 1, 0), + new ItemStack[] { + new ItemStack(Items.apple), + new ItemStack(Items.apple), + new ItemStack(Items.golden_apple), + new ItemStack(Items.golden_apple) + }); + + InfusionRecipe peacefulSaplingRec = new InfusionRecipe( + "TB.PeacefulSapling", + new ItemStack(TBBlocks.sapling, 1, 1), + 2, + new AspectList().add(Aspect.TREE, 16).add(Aspect.LIFE, 12).add(Aspect.HEAL, 6), + new ItemStack(Blocks.sapling, 1, 2), + new ItemStack[] { + new ItemStack(Items.slime_ball), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.slime_ball), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 2), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockMetalDevice, 1, 13), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 2) + }); + + InfusionRecipe netherSaplingRec = new InfusionRecipe( + "TB.NetherSapling", + new ItemStack(TBBlocks.sapling, 1, 2), + 5, + new AspectList().add(Aspect.TREE, 32).add(nether, 32).add(Aspect.HUNGER, 16), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 0), + new ItemStack[] { + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), + new ItemStack(ConfigItems.itemShard, 1, 1), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 4), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), + new ItemStack(ConfigItems.itemShard, 1, 1), + new ItemStack(Items.lava_bucket, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 1), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 4) + }); + + InfusionRecipe enderSaplingRec = new InfusionRecipe( + "TB.EnderSapling", + new ItemStack(TBBlocks.sapling, 1, 3), + 7, + new AspectList() + .add(Aspect.TREE, 64) + .add(Aspect.ELDRITCH, 24) + .add(Aspect.VOID, 16) + .add(Aspect.DARKNESS, 8), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 1), + new ItemStack[] { + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(Items.ender_pearl, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 1), + new ItemStack(Items.ender_pearl, 1, 0), + new ItemStack(Items.ender_pearl, 1, 0), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 4), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(Items.ender_pearl, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(ConfigItems.itemResource, 1, 1) + }); + + new ResearchItem( + "TB.BasicPlants", + catName, + new AspectList().add(Aspect.CROP, 2).add(Aspect.PLANT, 2), + -8, + -2, + 1, + new ItemStack(Items.wheat_seeds, 1, 0)) + .setParentsHidden("TB.CRUCIBLE") + .setRound() + .setPages(new ResearchPage("tb.rec.basicPlants.page.0"), new ResearchPage(sweedRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Plax", + catName, + new AspectList().add(Aspect.CROP, 1).add(Aspect.CLOTH, 1), + -11, + -2, + 1, + new ItemStack(TBItems.plaxSeed, 1, 0)) + .setParents("TB.BasicPlants") + .setPages(new ResearchPage("tb.rec.plax.page.0"), new ResearchPage(plaxRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Briar", + catName, + new AspectList() + .add(Aspect.CROP, 4) + .add(Aspect.PLANT, 4) + .add(Aspect.HEAL, 4), + -13, + -3, + 1, + new ItemStack(TBItems.resource, 1, 6)) + .setParents("TB.Plax") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.briar.page.0"), + new ResearchPage(briarRec), + new ResearchPage(rosehipRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Aurelia", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.MAGIC, 6) + .add(Aspect.AURA, 6), + -10, + 0, + 0, + new ItemStack(TBBlocks.aurelia, 1, 0)) + .setParents("TB.BasicPlants") + .setPages( + new ResearchPage("tb.rec.aurelia.page.0"), + new ResearchPage("tb.rec.aurelia.page.1"), + new ResearchPage(aureliaRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Knose", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.MIND, 6) + .add(Aspect.EARTH, 6), + -10, + 2, + 0, + new ItemStack(TBItems.knoseFragment, 1, OreDictionary.WILDCARD_VALUE)) + .setParents("TB.Aurelia") + .setParentsHidden("TB.CrystalBlocks") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.knose.page.0"), + new ResearchPage("tb.rec.knose.page.1"), + new ResearchPage(knoseRec), + new ResearchPage(knowledgeFragmentRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Ashroom", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.ENTROPY, 6) + .add(Aspect.AURA, 6) + .add(Aspect.AIR, 6) + .add(Aspect.CROP, 4), + -9, + 2, + 2, + new ItemStack(TBBlocks.ashroom)) + .setParents("TB.Aurelia") + .setConcealed() + .setPages(new ResearchPage("tb.rec.ashroom.page.0"), new ResearchPage(aspectShroomRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Glieonia", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.LIGHT, 6) + .add(Aspect.SENSES, 6) + .add(Aspect.FIRE, 6) + .add(Aspect.PLANT, 4), + -12, + 1, + 2, + new ItemStack(TBItems.glieoniaSeed)) + .setParents("TB.Aurelia") + .setConcealed() + .setPages(new ResearchPage("tb.rec.glieonia.page.0"), new ResearchPage(glieoniaRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Flaxium", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.ENTROPY, 6) + .add(Aspect.AURA, 6) + .add(Aspect.MAGIC, 6), + -11, + 2, + 2, + new ItemStack(TBBlocks.flaxium)) + .setParents("TB.Aurelia") + .setConcealed() + .setPages(new ResearchPage("tb.rec.flaxium.page.0"), new ResearchPage(flaxiumRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Metalleat", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.MAGIC, 6) + .add(Aspect.METAL, 6) + .add(Aspect.EXCHANGE, 6), + -10, + -4, + 0, + new ItemStack(TBItems.metalleatSeeds, 1, 0)) + .setParents("TB.BasicPlants") + .setPages(new ResearchPage("tb.rec.metalleat.page.0"), new ResearchPage(metalleatRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Lazullia", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.MAGIC, 6) + .add(Aspect.GREED, 6) + .add(Aspect.CRYSTAL, 6) + .add(Aspect.PLANT, 6) + .add(Aspect.SENSES, 8), + -8, + -5, + 2, + new ItemStack(TBItems.lazulliaSeeds, 1, 0)) + .setParents("TB.Metalleat") + .setConcealed() + .setPages( + new ResearchPage( + "tb.rec.lazullia.page.0" + (Loader.isModLoaded("essentialcraft") ? "_ec3" : "")), + new ResearchPage(lazulliaRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.RainbowCacti", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.MAGIC, 6) + .add(Aspect.EXCHANGE, 6) + .add(Aspect.CROP, 6) + .add(Aspect.ENTROPY, 6) + .add(Aspect.SENSES, 8), + -11, + -6, + 2, + new ItemStack(TBBlocks.rainbowCactus, 1, 0)) + .setParents("TB.Metalleat") + .setConcealed() + .setPages(new ResearchPage("tb.rec.rainCacti.page.0"), new ResearchPage(rainbowCactiRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Lucrite", + catName, + new AspectList() + .add(Aspect.GREED, 6) + .add(Aspect.MAGIC, 6) + .add(Aspect.PLANT, 6) + .add(Aspect.HUNGER, 6), + -9, + -6, + 0, + new ItemStack(TBItems.lucriteSeeds, 1, 0)) + .setParents("TB.Metalleat") + .setParentsHidden("TB.SMB") + .setConcealed() + .setPages(new ResearchPage("tb.rec.lucrite.page.0"), new ResearchPage(lucriteRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Redlon", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.MECHANISM, 6) + .add(Aspect.ENERGY, 6) + .add(Aspect.CROP, 6) + .add(Aspect.ORDER, 6) + .add(Aspect.GREED, 8), + -10, + -6, + 3, + new ItemStack(TBItems.redlonSeeds, 1, 0)) + .setParents("TB.Metalleat") + .setConcealed() + .setPages(new ResearchPage("tb.rec.redlon.page.0"), new ResearchPage(redlonRec)) + .registerResearchItem(); + + // void seed + new ResearchItem( + "TB.VoidSeed", + catName, + new AspectList() + .add(Aspect.LIFE, 6) + .add(Aspect.ELDRITCH, 6) + .add(Aspect.DARKNESS, 6), + 16, + 3, + 1, + new ItemStack(TBItems.voidSeed, 1, 0)) + .setParents("TB.VOIDMETAL") + .setConcealed() + .setPages(new ResearchPage("tb.rec.voidSeed.page.0"), new ResearchPage(voidSeedRec)) + .registerResearchItem(); + + // saplings + new ResearchItem( + "TB.GoldenOak", + catName, + new AspectList() + .add(Aspect.GREED, 8) + .add(Aspect.HUNGER, 8) + .add(Aspect.CROP, 8), + -15, + -1, + 0, + new ItemStack(TBBlocks.sapling, 1, 0)) + .setParents("TB.Briar") + .setParentsHidden("TB.INFUSION") + .setConcealed() + .setPages(new ResearchPage("tb.rec.goldenOak.page.0"), new ResearchPage(goldenOakRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.PeacefulSapling", + catName, + new AspectList() + .add(Aspect.LIFE, 8) + .add(Aspect.HEAL, 8) + .add(Aspect.TREE, 8), + -18, + -1, + 0, + new ItemStack(TBBlocks.sapling, 1, 1)) + .setParents("TB.GoldenOak") + .setConcealed() + .setPages(new ResearchPage("tb.rec.peacefulTree.page.0"), new ResearchPage(peacefulSaplingRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NetherSapling", + catName, + new AspectList() + .add(Aspect.TREE, 8) + .add(Aspect.FIRE, 8) + .add(nether, 8), + -17, + 0, + 0, + new ItemStack(TBBlocks.sapling, 1, 2)) + .setParents("TB.GoldenOak") + .setConcealed() + .setPages(new ResearchPage("tb.rec.netherTree.page.0"), new ResearchPage(netherSaplingRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.EnderSapling", + catName, + new AspectList() + .add(Aspect.TREE, 8) + .add(Aspect.ELDRITCH, 8) + .add(Aspect.VOID, 8), + -17, + -2, + 0, + new ItemStack(TBBlocks.sapling, 1, 3)) + .setParents("TB.GoldenOak") + .setConcealed() + .setPages(new ResearchPage("tb.rec.enderTree.page.0"), new ResearchPage(enderSaplingRec)) + .registerResearchItem(); + + ThaumcraftApi.getCraftingRecipes().add(plaxRec); + ThaumcraftApi.getCraftingRecipes().add(metalleatRec); + ThaumcraftApi.getCraftingRecipes().add(lucriteRec); + ThaumcraftApi.getCraftingRecipes().add(knoseRec); + ThaumcraftApi.getCraftingRecipes().add(knowledgeFragmentRec); + ThaumcraftApi.getCraftingRecipes().add(sweedRec); + ThaumcraftApi.getCraftingRecipes().add(lazulliaRec); + ThaumcraftApi.getCraftingRecipes().add(rainbowCactiRec); + ThaumcraftApi.getCraftingRecipes().add(redlonRec); + ThaumcraftApi.getCraftingRecipes().add(aspectShroomRec); + ThaumcraftApi.getCraftingRecipes().add(flaxiumRec); + ThaumcraftApi.getCraftingRecipes().add(glieoniaRec); + ThaumcraftApi.getCraftingRecipes().add(briarRec); + ThaumcraftApi.getCraftingRecipes().add(rosehipRec); + ThaumcraftApi.getCraftingRecipes().add(aureliaRec); + ThaumcraftApi.getCraftingRecipes().add(voidSeedRec); + + ThaumcraftApi.getCraftingRecipes().add(peacefulSaplingRec); + ThaumcraftApi.getCraftingRecipes().add(netherSaplingRec); + ThaumcraftApi.getCraftingRecipes().add(enderSaplingRec); + ThaumcraftApi.getCraftingRecipes().add(goldenOakRec); + } + + // TODO nodes + if (TBConfig.enableNodeTools) { + + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("NODESTABILIZERADV"),"TB.NODESTABILIZERADV",catName,-2,-7).setConcealed().setHidden().registerResearchItem(); + // copy(ResearchCategories.getResearchList("THAUMATURGY").research.get("VISPOWER"),"TB.VISPOWER",catName,2,-7).setConcealed().setHidden().registerResearchItem(); + + new FakeResearchItem( + "TB.NODESTABILIZERADV", + "THAUMICBASES", + "NODESTABILIZERADV", + "THAUMATURGY", + -2, + -7, + ResearchCategories.getResearch("NODESTABILIZERADV").icon_item) + .registerResearchItem(); + new FakeResearchItem( + "TB.VISPOWER", + "THAUMICBASES", + "VISPOWER", + "THAUMATURGY", + 2, + -7, + ResearchCategories.getResearch("VISPOWER").icon_item) + .registerResearchItem(); + + ThaumcraftApi.addWarpToResearch("TB.NodeMan", 1); + ThaumcraftApi.addWarpToResearch("TB.NodeFoci.Destr", 2); + ThaumcraftApi.addWarpToResearch("TB.NodeFoci.Taint", 3); + + ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.nodeFoci, 1, 1), 1); + ThaumcraftApi.addWarpToItem(new ItemStack(TBItems.nodeFoci, 1, 9), 2); + + InfusionRecipe nodeManipulatorRec = new InfusionRecipe( + "TB.NodeMan", + new ItemStack(TBBlocks.nodeManipulator, 1, 0), + 6, + new AspectList() + .add(Aspect.MECHANISM, 32) + .add(Aspect.AURA, 32) + .add(Aspect.MAGIC, 16) + .add(Aspect.ENERGY, 64) + .add(Aspect.VOID, 16), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 11), + new ItemStack[] { + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 10), + new ItemStack(ConfigBlocks.blockMirror, 1, 0), + new ItemStack(ConfigBlocks.blockMirror, 1, 6), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 14), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 10), + new ItemStack(ConfigBlocks.blockMirror, 1, 0), + new ItemStack(ConfigBlocks.blockMirror, 1, 6), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 14), + new ItemStack(TBBlocks.dustBlock, 1, 0) + }); + + boolean flag = TBConfig.brightFociRequiresPrimordialPearl; + + InfusionRecipe brightFociRec = new InfusionRecipe( + "TB.NodeFoci.Bright", + new ItemStack(TBItems.nodeFoci, 1, 0), + 3, + new AspectList() + .add(Aspect.AURA, flag ? 256 : 64) + .add(Aspect.LIGHT, flag ? 64 : 16) + .add(Aspect.ENERGY, flag ? 256 : 32), + flag + ? new ItemStack(ConfigItems.itemEldritchObject, 1, 3) + : new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigBlocks.blockMetalDevice, 1, 7), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockMetalDevice, 1, 7), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 3), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + InfusionRecipe destructionFociRec = new InfusionRecipe( + "TB.NodeFoci.Destr", + new ItemStack(TBItems.nodeFoci, 1, 1), + 5, + new AspectList().add(Aspect.AURA, 64).add(Aspect.VOID, 16).add(Aspect.DEATH, 32), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 6), + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigBlocks.blockTube, 1, 7), + new ItemStack(ConfigItems.itemFocusExcavation, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 6), + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigBlocks.blockTube, 1, 7), + new ItemStack(ConfigItems.itemFocusExcavation, 1, 0) + }); + + InfusionRecipe efficiencyFociRec = new InfusionRecipe( + "TB.NodeFoci.Efficiency", + new ItemStack(TBItems.nodeFoci, 1, 2), + 1, + new AspectList().add(Aspect.AURA, 64).add(Aspect.VOID, 16).add(Aspect.DEATH, 32), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0) + }); + + InfusionRecipe hungerFociRec = new InfusionRecipe( + "TB.NodeFoci.Hunger", + new ItemStack(TBItems.nodeFoci, 1, 3), + 7, + new AspectList() + .add(Aspect.AURA, 64) + .add(Aspect.VOID, 64) + .add(Aspect.HUNGER, 256) + .add(Aspect.GREED, 64) + .add(Aspect.ENERGY, 128), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemThaumometer, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 11), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemThaumometer, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigBlocks.blockStoneDevice, 1, 11) + }); + + InfusionRecipe unstableFociRec = new InfusionRecipe( + "TB.NodeFoci.Unstable", + new ItemStack(TBItems.nodeFoci, 1, 4), + 3, + new AspectList().add(Aspect.AURA, 64).add(Aspect.DEATH, 32).add(Aspect.ENTROPY, 64), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(Items.ender_pearl), + new ItemStack(TBBlocks.crystalBlock, 1, 5), + new ItemStack(Items.ender_pearl), + new ItemStack(TBBlocks.crystalBlock, 1, 5), + new ItemStack(Items.ender_pearl), + new ItemStack(TBBlocks.crystalBlock, 1, 5), + new ItemStack(Items.ender_pearl), + new ItemStack(TBBlocks.crystalBlock, 1, 5) + }); + + InfusionRecipe pureFociRec = new InfusionRecipe( + "TB.NodeFoci.Purity", + new ItemStack(TBItems.nodeFoci, 1, 5), + 0, + new AspectList().add(Aspect.AURA, 64).add(Aspect.LIFE, 64).add(Aspect.ORDER, 64), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 1), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 4), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 2), + new ItemStack(ConfigBlocks.blockMagicalLeaves, 1, 1), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 4), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 1), + new ItemStack(ConfigBlocks.blockCustomPlant, 1, 2) + }); + + InfusionRecipe sinisterFociRec = new InfusionRecipe( + "TB.NodeFoci.Sinister", + new ItemStack(TBItems.nodeFoci, 1, 6), + 4, + new AspectList() + .add(Aspect.AURA, 64) + .add(Aspect.DARKNESS, 32) + .add(Aspect.UNDEAD, 64), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigItems.itemWispEssence, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigItems.itemFocusPech, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(ConfigItems.itemWispEssence, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigItems.itemFocusPech, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 6) + }); + + InfusionRecipe speedFociRec = new InfusionRecipe( + "TB.NodeFoci.Speed", + new ItemStack(TBItems.nodeFoci, 1, 7), + 1, + new AspectList().add(Aspect.AURA, 64).add(Aspect.MOTION, 32).add(Aspect.MAGIC, 16), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0) + }); + + InfusionRecipe stabilityFociRec = new InfusionRecipe( + "TB.NodeFoci.Stability", + new ItemStack(TBItems.nodeFoci, 1, 8), + 1, + new AspectList().add(Aspect.AURA, 64).add(Aspect.ORDER, 32).add(Aspect.EXCHANGE, 16), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 10), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 6), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 10), + new ItemStack(TBBlocks.dustBlock, 1, 0), + new ItemStack(TBBlocks.crystalBlock, 1, 6) + }); + + InfusionRecipe taintFociRec = new InfusionRecipe( + "TB.NodeFoci.Taint", + new ItemStack(TBItems.nodeFoci, 1, 9), + 5, + new AspectList().add(Aspect.AURA, 64).add(Aspect.TAINT, 64).add(Aspect.ENTROPY, 16), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 11), + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigItems.itemResource, 1, 12), + new ItemStack(TBItems.knoseFragment, 1, 7), + new ItemStack(ConfigItems.itemResource, 1, 11), + new ItemStack(TBBlocks.crystalBlock, 1, 7), + new ItemStack(ConfigItems.itemResource, 1, 12), + new ItemStack(TBItems.knoseFragment, 1, 7), + }); + + ShapedArcaneRecipe nodeLinkRec = new ShapedArcaneRecipe( + "TB.NodeLinker", new ItemStack(TBBlocks.nodeLinker, 1, 0), primals(5), new Object[] { + "TPT", + "ANA", + "BOB", + 'T', + new ItemStack(ConfigBlocks.blockMetalDevice, 1, 14), + 'P', + new ItemStack(ConfigItems.itemResource, 1, 15), + 'A', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 6), + 'B', + new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 7), + 'O', + Blocks.obsidian, + 'N', + new ItemStack(ConfigItems.itemResource, 1, 0) + }); + + new ResearchItem( + "TB.NodeMan", + catName, + new AspectList() + .add(Aspect.MECHANISM, 8) + .add(Aspect.AURA, 8) + .add(Aspect.ENERGY, 16) + .add(Aspect.MAGIC, 8), + 0, + -8, + 3, + new ItemStack(TBBlocks.nodeManipulator)) + .setParents("TB.INFUSION", "TB.NODESTABILIZERADV", "TB.VISPOWER") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.nodeMan.page.0"), + new ResearchPage("tb.rec.nodeMan.page.1"), + new ResearchPage("tb.rec.nodeMan.page.2"), + new ResearchPage("tb.rec.nodeMan.page.3"), + new ResearchPage(nodeManipulatorRec)) + .registerResearchItem(); + + if (flag) { + // copy(ResearchCategories.getResearchList("ELDRITCH").research.get("PRIMPEARL"),"TB.PRIMPEARL",catName,0,-13).setConcealed().setHidden().registerResearchItem(); + + new FakeResearchItem( + "TB.PRIMPEARL", + "THAUMICBASES", + "PRIMPEARL", + "ELDRITCH", + 0, + -13, + ResearchCategories.getResearch("PRIMPEARL").icon_item) + .registerResearchItem(); + } + + String[] bParents = flag ? new String[] {"TB.NodeMan", "TB.PRIMPEARL"} : new String[] {"TB.NodeMan"}; + + new ResearchItem( + "TB.NodeFoci.Bright", + catName, + new AspectList().add(Aspect.AURA, 8).add(Aspect.LIGHT, 8), + 0, + -11, + 0, + new ItemStack(TBItems.nodeFoci, 1, 0)) + .setParents(bParents) + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.bright.page.0"), new ResearchPage(brightFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Destr", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.DEATH, 8) + .add(Aspect.VOID, 8), + 2, + -10, + 0, + new ItemStack(TBItems.nodeFoci, 1, 1)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.destr.page.0"), new ResearchPage(destructionFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Efficiency", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.MAGIC, 8) + .add(Aspect.ENERGY, 8), + -4, + -8, + 0, + new ItemStack(TBItems.nodeFoci, 1, 2)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.efficiency.page.0"), new ResearchPage(efficiencyFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Hunger", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.HUNGER, 16) + .add(Aspect.ENERGY, 16), + 4, + -9, + 0, + new ItemStack(TBItems.nodeFoci, 1, 3)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setSpecial() + .setPages(new ResearchPage("tb.rec.foci.hunger.page.0"), new ResearchPage(hungerFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Unstable", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.ENTROPY, 8) + .add(Aspect.VOID, 8), + -2, + -10, + 0, + new ItemStack(TBItems.nodeFoci, 1, 4)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.unstable.page.0"), new ResearchPage(unstableFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Purity", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.LIFE, 8) + .add(Aspect.ORDER, 8), + -1, + -11, + 0, + new ItemStack(TBItems.nodeFoci, 1, 5)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.pure.page.0"), new ResearchPage(pureFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Sinister", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.UNDEAD, 8) + .add(Aspect.ENTROPY, 8), + -3, + -10, + 0, + new ItemStack(TBItems.nodeFoci, 1, 6)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.sinister.page.0"), new ResearchPage(sinisterFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Speed", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.MOTION, 8) + .add(Aspect.ENERGY, 8), + -4, + -9, + 0, + new ItemStack(TBItems.nodeFoci, 1, 7)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.speed.page.0"), new ResearchPage(speedFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Stability", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.ORDER, 8) + .add(Aspect.EXCHANGE, 8), + 1, + -11, + 0, + new ItemStack(TBItems.nodeFoci, 1, 8)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.stability.page.0"), new ResearchPage(stabilityFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeFoci.Taint", + catName, + new AspectList() + .add(Aspect.AURA, 8) + .add(Aspect.TAINT, 16) + .add(Aspect.ENERGY, 8), + 3, + -10, + 0, + new ItemStack(TBItems.nodeFoci, 1, 9)) + .setParents("TB.NodeMan") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.foci.taint.page.0"), new ResearchPage(taintFociRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.NodeLinker", + catName, + new AspectList() + .add(Aspect.MECHANISM, 8) + .add(Aspect.AURA, 8) + .add(Aspect.TRAVEL, 16) + .add(Aspect.MAGIC, 8), + 5, + -6, + 3, + new ItemStack(TBBlocks.nodeLinker)) + .setParents("TB.VISPOWER") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.nodeLink.page.0"), + new ResearchPage("tb.rec.nodeLink.page.1"), + new ResearchPage("tb.rec.nodeLink.page.2"), + new ResearchPage(nodeLinkRec)) + .registerResearchItem(); + + ThaumcraftApi.getCraftingRecipes().add(nodeManipulatorRec); + + ThaumcraftApi.getCraftingRecipes().add(brightFociRec); + ThaumcraftApi.getCraftingRecipes().add(destructionFociRec); + ThaumcraftApi.getCraftingRecipes().add(efficiencyFociRec); + ThaumcraftApi.getCraftingRecipes().add(hungerFociRec); + ThaumcraftApi.getCraftingRecipes().add(unstableFociRec); + ThaumcraftApi.getCraftingRecipes().add(pureFociRec); + ThaumcraftApi.getCraftingRecipes().add(sinisterFociRec); + ThaumcraftApi.getCraftingRecipes().add(speedFociRec); + ThaumcraftApi.getCraftingRecipes().add(stabilityFociRec); + ThaumcraftApi.getCraftingRecipes().add(taintFociRec); + + ThaumcraftApi.getCraftingRecipes().add(nodeLinkRec); + } + + // TODO revolver + if (TBConfig.enableRevolver) { + + ThaumcraftApi.addWarpToResearch("TB.Revolver.Eldritch", 2); + ThaumcraftApi.addWarpToResearch("TB.Revolver.Primal", 4); + ThaumcraftApi.addWarpToResearch("TB.Revolver.Tainted", 3); + ThaumcraftApi.addWarpToResearch("TB.Revolver.Void", 2); + + InfusionRecipe revolverRec = new InfusionRecipe( + "TB.Revolver", + new ItemStack(TBItems.revolver, 1, 0), + 5, + new AspectList() + .add(Aspect.WEAPON, 256) + .add(Aspect.METAL, 32) + .add(Aspect.TREE, 16) + .add(Aspect.TOOL, 12) + .add(Aspect.ENERGY, 32) + .add(Aspect.MECHANISM, 12) + .add(Aspect.VOID, 16) + .add(Aspect.FIRE, 32), + new ItemStack(Blocks.iron_block), + new ItemStack[] { + new ItemStack(Items.fire_charge, 1, 0), + new ItemStack(Items.gunpowder, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 0), + new ItemStack(Items.gunpowder, 1, 0), + new ItemStack(ConfigItems.itemFocusFire, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Items.fire_charge, 1, 0), + new ItemStack(Items.gunpowder, 1, 0), + new ItemStack(ConfigItems.itemBowBone, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(ConfigBlocks.blockMagicalLog, 1, 0), + new ItemStack(Items.gunpowder, 1, 0), + new ItemStack(Blocks.redstone_torch, 1, 0) + }); + + RevolverInfusionRecipe accuracyRec = new RevolverInfusionRecipe( + "TB.Revolver.Accuracy", + RevolverUpgrade.accuracy, + 1, + new AspectList().add(Aspect.ORDER, 8).add(Aspect.SENSES, 8), + new ItemStack[] { + new ItemStack(Blocks.glass_pane, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Items.carrot, 1, 0), + new ItemStack(Blocks.glass_pane, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Blocks.glass_pane, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Blocks.glass_pane, 1, OreDictionary.WILDCARD_VALUE) + }); + + RevolverInfusionRecipe atropodsRec = new RevolverInfusionRecipe( + "TB.Revolver.Atropods", + RevolverUpgrade.atropodsBane, + 1, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.BEAST, 8).add(Aspect.CLOTH, 8), + new ItemStack[] { + new ItemStack(Items.spider_eye, 1, 0), + new ItemStack(Items.fermented_spider_eye, 1, 0), + new ItemStack(Items.spider_eye, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + RevolverInfusionRecipe eldritchBRec = new RevolverInfusionRecipe( + "TB.Revolver.EldritchBane", + RevolverUpgrade.eldritchBane, + 2, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.ELDRITCH, 8), + new ItemStack[] { + new ItemStack(Items.ender_eye, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.ender_pearl, 1, 0) + }); + + RevolverInfusionRecipe duelingRec = new RevolverInfusionRecipe( + "TB.Revolver.Dueling", + RevolverUpgrade.dueling, + 2, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.MAN, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.bed, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.ghast_tear, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + RevolverInfusionRecipe efficiencyRec = new RevolverInfusionRecipe( + "TB.Revolver.Efficiency", + RevolverUpgrade.efficiency, + 0, + new AspectList().add(Aspect.ORDER, 8).add(Aspect.EXCHANGE, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.blaze_powder, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.enchanted_book, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + RevolverInfusionRecipe eldritchRec = new RevolverInfusionRecipe( + "TB.Revolver.Eldritch", + RevolverUpgrade.eldritch, + 5, + new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.VOID, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemEldritchObject, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemEldritchObject, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + RevolverInfusionRecipe heavyRec = new RevolverInfusionRecipe( + "TB.Revolver.Heavy", + RevolverUpgrade.heavy, + 0, + new AspectList().add(Aspect.WEAPON, 8).add(Aspect.METAL, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.iron_sword, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + RevolverInfusionRecipe knowledgeRec = new RevolverInfusionRecipe( + "TB.Revolver.Knowledge", + RevolverUpgrade.knowledge, + 0, + new AspectList().add(Aspect.MIND, 8).add(Aspect.AURA, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemInkwell, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.book, 1, 0), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.paper, 1, 0) + }); + + RevolverInfusionRecipe piercingRec = new RevolverInfusionRecipe( + "TB.Revolver.Piercing", + RevolverUpgrade.piercig, + 12, + new AspectList().add(Aspect.WEAPON, 32).add(Aspect.AIR, 64), + new ItemStack[] { + new ItemStack(ConfigItems.itemPrimalArrow, 1, 0), + new ItemStack(ConfigItems.itemPrimalArrow, 1, 1), + new ItemStack(ConfigItems.itemPrimalArrow, 1, 2), + new ItemStack(Items.diamond_sword, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(ConfigItems.itemPrimalArrow, 1, 3), + new ItemStack(ConfigItems.itemPrimalArrow, 1, 4), + new ItemStack(ConfigItems.itemPrimalArrow, 1, 5) + }); + + RevolverInfusionRecipe powerRec = new RevolverInfusionRecipe( + "TB.Revolver.Power", + RevolverUpgrade.power, + 2, + new AspectList().add(Aspect.WEAPON, 16), + new ItemStack[] { + new ItemStack(Items.gunpowder), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.fire_charge), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.fireworks, 1, OreDictionary.WILDCARD_VALUE) + }); + + RevolverInfusionRecipe primalRec = new RevolverInfusionRecipe( + "TB.Revolver.Primal", + RevolverUpgrade.primal, + 12, + new AspectList().add(Aspect.WEAPON, 64).add(primals(64)).add(Aspect.MAGIC, 64), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemEldritchObject, 1, 3), + new ItemStack(Items.diamond), + new ItemStack(ConfigItems.itemEldritchObject, 1, 3), + new ItemStack(ConfigItems.itemResource, 1, 14), + }); + + ItemStack silver = OreDictionary.doesOreNameExist("ingotSilver") + && OreDictionary.getOres("ingotSilver") != null + && OreDictionary.getOres("ingotSilver").size() > 0 + ? OreDictionary.getOres("ingotSilver").get(0) + : new ItemStack(ConfigItems.itemResource, 1, 15); + + RevolverInfusionRecipe silverRec = new RevolverInfusionRecipe( + "TB.Revolver.Silver", + RevolverUpgrade.silver, + 0, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.BEAST, 8).add(Aspect.UNDEAD, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 3), + silver, + new ItemStack(ConfigItems.itemResource, 1, 3), + new ItemStack(ConfigItems.itemResource, 1, 14), + }); + + RevolverInfusionRecipe speedRec = new RevolverInfusionRecipe( + "TB.Revolver.Speed", + RevolverUpgrade.speed, + 2, + new AspectList().add(Aspect.MOTION, 8).add(Aspect.AIR, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(Items.feather), + new ItemStack(ConfigItems.itemResource, 1, 14), + }); + + RevolverInfusionRecipe taintedRec = new RevolverInfusionRecipe( + "TB.Revolver.Tainted", + RevolverUpgrade.tainted, + 4, + new AspectList().add(Aspect.TAINT, 8).add(Aspect.WEAPON, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 11), + new ItemStack(ConfigItems.itemResource, 1, 14), + new ItemStack(ConfigItems.itemResource, 1, 12), + new ItemStack(ConfigItems.itemResource, 1, 14) + }); + + RevolverInfusionRecipe voidRec = new RevolverInfusionRecipe( + "TB.Revolver.Void", + RevolverUpgrade.uvoid, + 4, + new AspectList().add(Aspect.VOID, 8).add(Aspect.TOOL, 8), + new ItemStack[] { + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16), + new ItemStack(ConfigItems.itemResource, 1, 16) + }); + + new ResearchItem( + "TB.Revolver", + catName, + new AspectList() + .add(Aspect.WEAPON, 5) + .add(Aspect.FIRE, 5) + .add(Aspect.VOID, 4) + .add(Aspect.TOOL, 2) + .add(Aspect.ENERGY, 2), + -16, + -7, + 4, + new ItemStack(TBItems.revolver, 1, 0)) + .setParentsHidden("TB.INFUSION") + .setConcealed() + .setPages( + new ResearchPage("tb.rec.revolver.page.0"), + new ResearchPage("tb.rec.revolver.page.1"), + new ResearchPage("tb.rec.revolver.page.2"), + new ResearchPage(revolverRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Accuracy", + catName, + new AspectList() + .add(Aspect.ORDER, 8) + .add(Aspect.MECHANISM, 8) + .add(Aspect.SENSES, 4), + -19, + -7, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/ACCURACY.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.acc.page.0"), new ResearchPage(accuracyRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Atropods", + catName, + new AspectList() + .add(Aspect.DEATH, 8) + .add(Aspect.BEAST, 8) + .add(Aspect.CLOTH, 4), + -14, + -10, + 0, + new ResourceLocation( + "thaumicbases", "textures/thaumonomicon/revolver/BANE_OF_ATROPODS.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.atr.page.0"), new ResearchPage(atropodsRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.EldritchBane", + catName, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.ELDRITCH, 4), + -13, + -8, + 0, + new ResourceLocation( + "thaumicbases", "textures/thaumonomicon/revolver/BANE_OF_ELDRITCH.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.elb.page.0"), new ResearchPage(eldritchBRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Dueling", + catName, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.MAN, 8), + -15, + -10, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/DUELING.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.duel.page.0"), new ResearchPage(duelingRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Efficiency", + catName, + new AspectList().add(Aspect.ORDER, 8).add(Aspect.EXCHANGE, 8), + -19, + -8, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/EFFICIENCY.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.eff.page.0"), new ResearchPage(efficiencyRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Eldritch", + catName, + new AspectList().add(Aspect.ELDRITCH, 8).add(Aspect.VOID, 8), + -13, + -7, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/ELDRITCH.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.eld.page.0"), new ResearchPage(eldritchRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Heavy", + catName, + new AspectList().add(Aspect.WEAPON, 8).add(Aspect.METAL, 8), + -19, + -6, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/HEAVY.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.hev.page.0"), new ResearchPage(heavyRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Knowledge", + catName, + new AspectList().add(Aspect.MIND, 8).add(Aspect.MAGIC, 8), + -18, + -10, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/KNOWLEGDE.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.kno.page.0"), new ResearchPage(knowledgeRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Piercing", + catName, + new AspectList().add(Aspect.WEAPON, 8).add(Aspect.AIR, 8), + -17, + -10, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/PIERCING.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.pir.page.0"), new ResearchPage(piercingRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Power", + catName, + new AspectList().add(Aspect.WEAPON, 8).add(Aspect.MECHANISM, 8), + -16, + -10, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/POWER.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.pow.page.0"), new ResearchPage(powerRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Primal", + catName, + new AspectList() + .add(Aspect.WEAPON, 8) + .add(Aspect.AURA, 8) + .add(primals(16)), + -15, + -5, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/PRIMAL.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setSpecial() + .setPages(new ResearchPage("tb.rec.revolver.primal.page.0"), new ResearchPage(primalRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Silver", + catName, + new AspectList().add(Aspect.DEATH, 8).add(Aspect.UNDEAD, 8), + -13, + -9, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/SILVER.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.sil.page.0"), new ResearchPage(silverRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Speed", + catName, + new AspectList().add(Aspect.MOTION, 8).add(Aspect.AIR, 8), + -19, + -9, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/SPEED.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.spe.page.0"), new ResearchPage(speedRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Tainted", + catName, + new AspectList().add(Aspect.TAINT, 8).add(Aspect.MAGIC, 8), + -18, + -4, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/TAINTED.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.tai.page.0"), new ResearchPage(taintedRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.Revolver.Void", + catName, + new AspectList().add(Aspect.VOID, 8).add(Aspect.METAL, 8), + -19, + -5, + 0, + new ResourceLocation("thaumicbases", "textures/thaumonomicon/revolver/VOID.png")) + .setParents("TB.Revolver") + .setConcealed() + .setSecondary() + .setPages(new ResearchPage("tb.rec.revolver.void.page.0"), new ResearchPage(voidRec)) + .registerResearchItem(); + + ThaumcraftApi.getCraftingRecipes().add(revolverRec); + ThaumcraftApi.getCraftingRecipes().add(accuracyRec); + ThaumcraftApi.getCraftingRecipes().add(atropodsRec); + ThaumcraftApi.getCraftingRecipes().add(eldritchBRec); + ThaumcraftApi.getCraftingRecipes().add(duelingRec); + ThaumcraftApi.getCraftingRecipes().add(efficiencyRec); + ThaumcraftApi.getCraftingRecipes().add(eldritchRec); + ThaumcraftApi.getCraftingRecipes().add(heavyRec); + ThaumcraftApi.getCraftingRecipes().add(knowledgeRec); + ThaumcraftApi.getCraftingRecipes().add(piercingRec); + ThaumcraftApi.getCraftingRecipes().add(powerRec); + ThaumcraftApi.getCraftingRecipes().add(primalRec); + ThaumcraftApi.getCraftingRecipes().add(silverRec); + ThaumcraftApi.getCraftingRecipes().add(speedRec); + ThaumcraftApi.getCraftingRecipes().add(taintedRec); + ThaumcraftApi.getCraftingRecipes().add(voidRec); + } + + // TODO void metal stuff + ShapedOreRecipe voidShearsRec = new ShapedOreRecipe( + new ItemStack(TBItems.voidShears), + new Object[] {" #", "# ", '#', new ItemStack(ConfigItems.itemResource, 1, 16)}); + + ShapedOreRecipe voidFlint = new ShapedOreRecipe(new ItemStack(TBItems.voidFAS), new Object[] { + "# ", " C", '#', new ItemStack(ConfigItems.itemResource, 1, 16), 'C', new ItemStack(Items.flint) + }); + + ResearchItem voidIngot = + ResearchCategories.getResearchList("ELDRITCH").research.get("VOIDMETAL"); + + ResearchPage[] currentPages = voidIngot.getPages(); + ResearchPage[] newPages = new ResearchPage[currentPages.length + 4]; + System.arraycopy(currentPages, 0, newPages, 0, currentPages.length); + newPages[newPages.length - 4] = new ResearchPage(voidFlint); + newPages[newPages.length - 3] = new ResearchPage(voidShearsRec); + newPages[newPages.length - 2] = new ResearchPage(voidBlockRec); + newPages[newPages.length - 1] = new ResearchPage(voidIngotRec); + voidIngot.setPages(newPages); + + CraftingManager.getInstance().getRecipeList().add(voidShearsRec); + CraftingManager.getInstance().getRecipeList().add(voidFlint); + + CraftingManager.getInstance().getRecipeList().add(voidBlockRec); + CraftingManager.getInstance().getRecipeList().add(voidIngotRec); + + // TODO entity decon + + InfusionRecipe entityDeconstructorRec = new InfusionRecipe( + "TB.EntityDec", + new ItemStack(TBBlocks.entityDeconstructor, 1, 0), + 4, + new AspectList().add(Aspect.DEATH, 16).add(Aspect.SOUL, 4).add(Aspect.MIND, 16), + new ItemStack(ConfigItems.itemThaumometer), + new ItemStack[] { + new ItemStack(Blocks.light_weighted_pressure_plate), + new ItemStack(Blocks.light_weighted_pressure_plate), + new ItemStack(Blocks.heavy_weighted_pressure_plate), + new ItemStack(Blocks.heavy_weighted_pressure_plate), + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(ConfigItems.itemResource, 1, 9), + new ItemStack(ConfigItems.itemResource, 1, 15), + new ItemStack(ConfigItems.itemResource, 1, 15) + }); + + new ResearchItem( + "TB.EntityDec", + catName, + new AspectList() + .add(Aspect.MIND, 8) + .add(Aspect.DEATH, 8) + .add(Aspect.SOUL, 8), + 3, + -2, + 1, + new ItemStack(TBBlocks.entityDeconstructor, 1, 0)) + .setParents("TB.INFUSION") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.eDec.page.0"), new ResearchPage(entityDeconstructorRec)) + .registerResearchItem(); + + new ResearchItem( + "TB.EntityDecAdv", + catName, + new AspectList().add(Aspect.MIND, 8).add(Aspect.DEATH, 8), + 5, + -3, + 1, + new ItemStack(ConfigBlocks.blockCrystal, 1, OreDictionary.WILDCARD_VALUE)) + .setParents("TB.EntityDec") + .setSecondary() + .setConcealed() + .setPages(new ResearchPage("tb.rec.eDeca.page.0"), new ResearchPage("tb.rec.eDeca.page.1")) + .registerResearchItem(); + + ThaumcraftApi.getCraftingRecipes().add(entityDeconstructorRec); + + ThaumcraftApi.getCraftingRecipes().add(drainFociRec); + ThaumcraftApi.getCraftingRecipes().add(expFociRec); + ThaumcraftApi.getCraftingRecipes().add(fluxFociRec); + ThaumcraftApi.getCraftingRecipes().add(activationFociRec); + + ThaumcraftApi.getCraftingRecipes().add(advFurnaceRecipe); + ThaumcraftApi.getCraftingRecipes().add(cryingObsidianRec); + ThaumcraftApi.getCraftingRecipes().add(overchanterRec); + + ThaumcraftApi.getCraftingRecipes().add(relocatorRec); + ThaumcraftApi.getCraftingRecipes().add(irelocatorRec); + ThaumcraftApi.getCraftingRecipes().add(thaumicAnvilRec); + ThaumcraftApi.getCraftingRecipes().add(voidAnvilRec); + + ThaumcraftApi.getCraftingRecipes().add(campfireRec); + ThaumcraftApi.getCraftingRecipes().add(brazierRec); + + // TODO actual recipes + + for (int i = 0; i < 6; ++i) ThaumcraftApi.getCraftingRecipes().add(shards[i]); + + for (int i = 0; i < oldRec.length; ++i) + ThaumcraftApi.getCraftingRecipes().add(oldRec[i]); + + for (int i = 0; i < 10; ++i) ThaumcraftApi.getCraftingRecipes().add(toolsRec[i]); + + for (int i = 0; i < 7; ++i) { + ThaumcraftApi.getCraftingRecipes().add(cBlocks[i]); + ThaumcraftApi.getCraftingRecipes().add(cTaintedBlocks[i]); + } + } + + public static Aspect getPrimalForLoop(int loopInt) { + switch (loopInt) { + case 0: + return Aspect.AIR; + case 1: + return Aspect.FIRE; + case 2: + return Aspect.WATER; + case 3: + return Aspect.EARTH; + case 4: + return Aspect.ORDER; + case 5: + return Aspect.ENTROPY; + default: + return Aspect.AIR; + } + } + + public static AspectList primals(int amount) { + return new AspectList() + .add(Aspect.AIR, amount) + .add(Aspect.WATER, amount) + .add(Aspect.EARTH, amount) + .add(Aspect.FIRE, amount) + .add(Aspect.ORDER, amount) + .add(Aspect.ENTROPY, amount); + } + + /* + public static ResearchItem copy(ResearchItem res, String newKey, String newCat, int dC, int dR) + { + ResearchItem rItem; + + if(res.icon_resource != null) + rItem = new ResearchItem(newKey,newCat,res.tags,dC,dR,res.getComplexity(),res.icon_resource); + else + rItem = new ResearchItem(newKey,newCat,res.tags,dC,dR,res.getComplexity(),res.icon_item); + + rItem.parents = res.parents; + rItem.parentsHidden = res.parentsHidden; + rItem.siblings = res.siblings; + rItem.setPages(res.getPages()); + rItem.setAspectTriggers(new Aspect[0]); + rItem.setEntityTriggers(new String[0]); + rItem.setItemTriggers(new ItemStack[0]); + + if(res.isAutoUnlock()) + rItem.setAutoUnlock(); + + if(res.isConcealed()) + rItem.setConcealed(); + + if(res.isHidden()) + rItem.setHidden(); + + if(res.isLost()) + rItem.setLost(); + + if(res.isRound()) + rItem.setRound(); + + if(res.isSecondary()) + rItem.setSecondary(); + + if(res.isSpecial()) + rItem.setSpecial(); + + if(res.isStub()) + rItem.setStub(); + + if(res.siblings != null && res.siblings.length > 0) + { + String[] sibStr = new String[res.siblings.length+1]; + for(int i = 0; i < res.siblings.length; ++i) + sibStr[i] = res.siblings[i]; + + sibStr[sibStr.length - 1] = newKey; + + res.setSiblings(sibStr); + }else + { + res.setSiblings(newKey); + } + + return rItem; + }*/ - for(int i = 0; i < 7; ++i) - { - ThaumcraftApi.getCraftingRecipes().add(cBlocks[i]); - ThaumcraftApi.getCraftingRecipes().add(cTaintedBlocks[i]); - } - } - - public static Aspect getPrimalForLoop(int loopInt) - { - switch(loopInt) - { - case 0: - return Aspect.AIR; - case 1: - return Aspect.FIRE; - case 2: - return Aspect.WATER; - case 3: - return Aspect.EARTH; - case 4: - return Aspect.ORDER; - case 5: - return Aspect.ENTROPY; - default: - return Aspect.AIR; - } - } - - public static AspectList primals(int amount) - { - return new AspectList().add(Aspect.AIR, amount).add(Aspect.WATER, amount).add(Aspect.EARTH, amount).add(Aspect.FIRE, amount).add(Aspect.ORDER, amount).add(Aspect.ENTROPY, amount); - } - - /* - public static ResearchItem copy(ResearchItem res, String newKey, String newCat, int dC, int dR) - { - ResearchItem rItem; - - if(res.icon_resource != null) - rItem = new ResearchItem(newKey,newCat,res.tags,dC,dR,res.getComplexity(),res.icon_resource); - else - rItem = new ResearchItem(newKey,newCat,res.tags,dC,dR,res.getComplexity(),res.icon_item); - - rItem.parents = res.parents; - rItem.parentsHidden = res.parentsHidden; - rItem.siblings = res.siblings; - rItem.setPages(res.getPages()); - rItem.setAspectTriggers(new Aspect[0]); - rItem.setEntityTriggers(new String[0]); - rItem.setItemTriggers(new ItemStack[0]); - - if(res.isAutoUnlock()) - rItem.setAutoUnlock(); - - if(res.isConcealed()) - rItem.setConcealed(); - - if(res.isHidden()) - rItem.setHidden(); - - if(res.isLost()) - rItem.setLost(); - - if(res.isRound()) - rItem.setRound(); - - if(res.isSecondary()) - rItem.setSecondary(); - - if(res.isSpecial()) - rItem.setSpecial(); - - if(res.isStub()) - rItem.setStub(); - - if(res.siblings != null && res.siblings.length > 0) - { - String[] sibStr = new String[res.siblings.length+1]; - for(int i = 0; i < res.siblings.length; ++i) - sibStr[i] = res.siblings[i]; - - sibStr[sibStr.length - 1] = newKey; - - res.setSiblings(sibStr); - }else - { - res.setSiblings(newKey); - } - - return rItem; - }*/ - } diff --git a/src/main/java/tb/init/TBTiles.java b/src/main/java/tb/init/TBTiles.java index 04c29e0..38778a6 100644 --- a/src/main/java/tb/init/TBTiles.java +++ b/src/main/java/tb/init/TBTiles.java @@ -1,5 +1,6 @@ package tb.init; +import cpw.mods.fml.common.registry.GameRegistry; import tb.common.tile.TileAdvAlchemicalFurnace; import tb.common.tile.TileBrazier; import tb.common.tile.TileCampfire; @@ -8,20 +9,17 @@ import tb.common.tile.TileNodeLinker; import tb.common.tile.TileNodeManipulator; import tb.common.tile.TileOverchanter; import tb.common.tile.TileRelocator; -import cpw.mods.fml.common.registry.GameRegistry; public class TBTiles { - - public static void setup() - { - GameRegistry.registerTileEntity(TileAdvAlchemicalFurnace.class, "tb.advancedAlchemicalFurnace"); - GameRegistry.registerTileEntity(TileEntityDeconstructor.class, "tb.entityDeconstructor"); - GameRegistry.registerTileEntity(TileOverchanter.class, "tb.overchanter"); - GameRegistry.registerTileEntity(TileNodeManipulator.class, "tb.manipulator"); - GameRegistry.registerTileEntity(TileRelocator.class, "tb.relocator"); - GameRegistry.registerTileEntity(TileNodeLinker.class, "tb.nodeLinker"); - GameRegistry.registerTileEntity(TileCampfire.class, "tb.campfire"); - GameRegistry.registerTileEntity(TileBrazier.class, "tb.brazier"); - } + public static void setup() { + GameRegistry.registerTileEntity(TileAdvAlchemicalFurnace.class, "tb.advancedAlchemicalFurnace"); + GameRegistry.registerTileEntity(TileEntityDeconstructor.class, "tb.entityDeconstructor"); + GameRegistry.registerTileEntity(TileOverchanter.class, "tb.overchanter"); + GameRegistry.registerTileEntity(TileNodeManipulator.class, "tb.manipulator"); + GameRegistry.registerTileEntity(TileRelocator.class, "tb.relocator"); + GameRegistry.registerTileEntity(TileNodeLinker.class, "tb.nodeLinker"); + GameRegistry.registerTileEntity(TileCampfire.class, "tb.campfire"); + GameRegistry.registerTileEntity(TileBrazier.class, "tb.brazier"); + } } diff --git a/src/main/java/tb/network/proxy/PacketTB.java b/src/main/java/tb/network/proxy/PacketTB.java index 38d42c5..aa5f831 100644 --- a/src/main/java/tb/network/proxy/PacketTB.java +++ b/src/main/java/tb/network/proxy/PacketTB.java @@ -1,36 +1,33 @@ package tb.network.proxy; -import net.minecraft.nbt.NBTTagCompound; -import io.netty.buffer.ByteBuf; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; +import io.netty.buffer.ByteBuf; +import net.minecraft.nbt.NBTTagCompound; -public class PacketTB implements IMessage{ +public class PacketTB implements IMessage { - int id; - NBTTagCompound sent; - - public PacketTB() - { - //FML registry - } - - public PacketTB(NBTTagCompound tag, int i) - { - id = i; - sent = tag; - } - - @Override - public void fromBytes(ByteBuf buf) { - id = ByteBufUtils.readVarInt(buf, 1); - sent = ByteBufUtils.readTag(buf); - } + int id; + NBTTagCompound sent; - @Override - public void toBytes(ByteBuf buf) { - ByteBufUtils.writeVarInt(buf, id, 1); - ByteBufUtils.writeTag(buf, sent); - } + public PacketTB() { + // FML registry + } + public PacketTB(NBTTagCompound tag, int i) { + id = i; + sent = tag; + } + + @Override + public void fromBytes(ByteBuf buf) { + id = ByteBufUtils.readVarInt(buf, 1); + sent = ByteBufUtils.readTag(buf); + } + + @Override + public void toBytes(ByteBuf buf) { + ByteBufUtils.writeVarInt(buf, id, 1); + ByteBufUtils.writeTag(buf, sent); + } } diff --git a/src/main/java/tb/network/proxy/TBClient.java b/src/main/java/tb/network/proxy/TBClient.java index f232cd2..69b6697 100644 --- a/src/main/java/tb/network/proxy/TBClient.java +++ b/src/main/java/tb/network/proxy/TBClient.java @@ -1,6 +1,15 @@ package tb.network.proxy; import DummyCore.Client.GuiCommon; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.common.MinecraftForge; import tb.client.RevolverEvents; import tb.client.gui.GuiRevolver; import tb.client.gui.GuiThaumicAnvil; @@ -10,7 +19,6 @@ import tb.client.render.block.CampfireRenderer; import tb.client.render.block.ThaumicRelocatorRenderer; import tb.client.render.entity.RenderBullet; import tb.client.render.item.CastingBraceletRenderer; -import tb.client.render.item.HerobrinesScytheRenderer; import tb.client.render.item.NodeFociRenderer; import tb.client.render.item.NodeLinkerItemRenderer; import tb.client.render.item.NodeManipulatorItemRenderer; @@ -30,90 +38,84 @@ import tb.init.TBItems; import thaumcraft.client.fx.ParticleEngine; import thaumcraft.client.fx.bolt.FXLightningBolt; import thaumcraft.client.fx.particles.FXSparkle; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.common.MinecraftForge; public class TBClient extends TBServer { - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - - if(ID == 0x421922) - { - TileEntity tile = world.getTileEntity(x, y, z); - - if(tile != null) - { - if(tile instanceof TileOverchanter) - { - return new GuiCommon(new ContainerOverchanter(player.inventory,tile), tile); - } - } - }else - { - if(ID == 0x421921) - return new GuiThaumicAnvil(player.inventory, world, x, y, z); - - if(ID == 0x421920) - return new GuiVoidAnvil(player.inventory, world, x, y, z); - - if(ID == 0x421919) - return new GuiRevolver(player.inventory, world, x, y, z); - } - - return null; - } - - @Override - public void registerRenderInformation() - { - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDeconstructor.class, new RenderEntityDeconstructor()); - ClientRegistry.bindTileEntitySpecialRenderer(TileOverchanter.class, new RenderOverchanter()); - ClientRegistry.bindTileEntitySpecialRenderer(TileNodeManipulator.class, new RenderNodeManipulator()); - ClientRegistry.bindTileEntitySpecialRenderer(TileNodeLinker.class, new RenderNodeLinker()); - - MinecraftForgeClient.registerItemRenderer(TBItems.nodeFoci, new NodeFociRenderer()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TBBlocks.nodeManipulator), new NodeManipulatorItemRenderer()); - MinecraftForgeClient.registerItemRenderer(TBItems.revolver, new RenderRevolver()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TBBlocks.nodeLinker), new NodeLinkerItemRenderer()); - MinecraftForgeClient.registerItemRenderer(TBItems.castingBracelet, new CastingBraceletRenderer()); - - RenderingRegistry.registerBlockHandler(new ThaumicRelocatorRenderer()); - RenderingRegistry.registerBlockHandler(new CampfireRenderer()); - RenderingRegistry.registerBlockHandler(new BrazierRenderer()); - RenderingRegistry.registerEntityRenderingHandler(EntityRevolverBullet.class, new RenderBullet()); - - MinecraftForge.EVENT_BUS.register(new RevolverEvents()); - } - - @Override - public void lightning(World world, double sx, double sy, double sz, double ex, double ey, double ez, int dur, float curve, int speed, int type) - { - FXLightningBolt bolt = new FXLightningBolt(world, sx, sy, sz, ex, ey, ez, world.rand.nextLong(), dur, curve, speed); - - bolt.defaultFractal(); - bolt.setType(type); - bolt.setWidth(0.125F); - bolt.finalizeBolt(); - } - - public void sparkle(World w, double x, double y, double z, double dx, double dy, double dz, int color, float scale) - { - FXSparkle fx = new FXSparkle(w,x,y,z,dx,dy,dz,scale,color,1); - fx.noClip = true; - ParticleEngine.instance.addEffect(w, fx); - } - - public World clientWorld() - { - return Minecraft.getMinecraft().theWorld; - } + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + + if (ID == 0x421922) { + TileEntity tile = world.getTileEntity(x, y, z); + + if (tile != null) { + if (tile instanceof TileOverchanter) { + return new GuiCommon(new ContainerOverchanter(player.inventory, tile), tile); + } + } + } else { + if (ID == 0x421921) return new GuiThaumicAnvil(player.inventory, world, x, y, z); + + if (ID == 0x421920) return new GuiVoidAnvil(player.inventory, world, x, y, z); + + if (ID == 0x421919) return new GuiRevolver(player.inventory, world, x, y, z); + } + + return null; + } + + @Override + public void registerRenderInformation() { + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDeconstructor.class, new RenderEntityDeconstructor()); + ClientRegistry.bindTileEntitySpecialRenderer(TileOverchanter.class, new RenderOverchanter()); + ClientRegistry.bindTileEntitySpecialRenderer(TileNodeManipulator.class, new RenderNodeManipulator()); + ClientRegistry.bindTileEntitySpecialRenderer(TileNodeLinker.class, new RenderNodeLinker()); + + MinecraftForgeClient.registerItemRenderer(TBItems.nodeFoci, new NodeFociRenderer()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(TBBlocks.nodeManipulator), new NodeManipulatorItemRenderer()); + MinecraftForgeClient.registerItemRenderer(TBItems.revolver, new RenderRevolver()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(TBBlocks.nodeLinker), new NodeLinkerItemRenderer()); + MinecraftForgeClient.registerItemRenderer(TBItems.castingBracelet, new CastingBraceletRenderer()); + + RenderingRegistry.registerBlockHandler(new ThaumicRelocatorRenderer()); + RenderingRegistry.registerBlockHandler(new CampfireRenderer()); + RenderingRegistry.registerBlockHandler(new BrazierRenderer()); + RenderingRegistry.registerEntityRenderingHandler(EntityRevolverBullet.class, new RenderBullet()); + + MinecraftForge.EVENT_BUS.register(new RevolverEvents()); + } + + @Override + public void lightning( + World world, + double sx, + double sy, + double sz, + double ex, + double ey, + double ez, + int dur, + float curve, + int speed, + int type) { + FXLightningBolt bolt = + new FXLightningBolt(world, sx, sy, sz, ex, ey, ez, world.rand.nextLong(), dur, curve, speed); + + bolt.defaultFractal(); + bolt.setType(type); + bolt.setWidth(0.125F); + bolt.finalizeBolt(); + } + + public void sparkle( + World w, double x, double y, double z, double dx, double dy, double dz, int color, float scale) { + FXSparkle fx = new FXSparkle(w, x, y, z, dx, dy, dz, scale, color, 1); + fx.noClip = true; + ParticleEngine.instance.addEffect(w, fx); + } + + public World clientWorld() { + return Minecraft.getMinecraft().theWorld; + } } diff --git a/src/main/java/tb/network/proxy/TBNetworkManager.java b/src/main/java/tb/network/proxy/TBNetworkManager.java index 8904011..a426c95 100644 --- a/src/main/java/tb/network/proxy/TBNetworkManager.java +++ b/src/main/java/tb/network/proxy/TBNetworkManager.java @@ -1,40 +1,43 @@ package tb.network.proxy; -import tb.core.TBCore; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import io.netty.channel.ChannelHandler; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.channel.ChannelHandler; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import tb.core.TBCore; @ChannelHandler.Sharable -public class TBNetworkManager implements IMessageHandler -{ +public class TBNetworkManager implements IMessageHandler { - @Override - public IMessage onMessage(PacketTB message, MessageContext ctx) - { - if(message.id == 0) - { - NBTTagCompound tag = message.sent; - World w = TBCore.proxy.clientWorld(); - w.playSound(tag.getDouble("x"), tag.getDouble("y"), tag.getDouble("z"), tag.getString("snd"), tag.getFloat("v"), tag.getFloat("p"), false); - } - return null; - } - - public static void playSoundOnServer(World w, String sound, double x, double y, double z, float volume, float pitch) - { - NBTTagCompound tg = new NBTTagCompound(); - tg.setString("snd", sound); - tg.setDouble("x", x); - tg.setDouble("y", y); - tg.setDouble("z", z); - tg.setFloat("v", volume); - tg.setFloat("p", pitch); - TBCore.network.sendToAllAround(new PacketTB(tg,0), new TargetPoint(w.provider.dimensionId,x,y,z,32)); - } + @Override + public IMessage onMessage(PacketTB message, MessageContext ctx) { + if (message.id == 0) { + NBTTagCompound tag = message.sent; + World w = TBCore.proxy.clientWorld(); + w.playSound( + tag.getDouble("x"), + tag.getDouble("y"), + tag.getDouble("z"), + tag.getString("snd"), + tag.getFloat("v"), + tag.getFloat("p"), + false); + } + return null; + } + public static void playSoundOnServer( + World w, String sound, double x, double y, double z, float volume, float pitch) { + NBTTagCompound tg = new NBTTagCompound(); + tg.setString("snd", sound); + tg.setDouble("x", x); + tg.setDouble("y", y); + tg.setDouble("z", z); + tg.setFloat("v", volume); + tg.setFloat("p", pitch); + TBCore.network.sendToAllAround(new PacketTB(tg, 0), new TargetPoint(w.provider.dimensionId, x, y, z, 32)); + } } diff --git a/src/main/java/tb/network/proxy/TBServer.java b/src/main/java/tb/network/proxy/TBServer.java index 56b0cef..ad4ff1d 100644 --- a/src/main/java/tb/network/proxy/TBServer.java +++ b/src/main/java/tb/network/proxy/TBServer.java @@ -1,71 +1,65 @@ package tb.network.proxy; +import cpw.mods.fml.common.network.IGuiHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; import tb.common.inventory.ContainerOverchanter; import tb.common.inventory.ContainerRevolver; import tb.common.inventory.ContainerThaumicAnvil; import tb.common.inventory.ContainerVoidAnvil; import tb.common.tile.TileOverchanter; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import cpw.mods.fml.common.network.IGuiHandler; -public class TBServer implements IGuiHandler{ +public class TBServer implements IGuiHandler { - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - - if(ID == 0x421922) - { - TileEntity tile = world.getTileEntity(x, y, z); - - if(tile != null) - { - if(tile instanceof TileOverchanter) - { - return new ContainerOverchanter(player.inventory,tile); - } - } - }else - { - - if(ID == 0x421921) - return new ContainerThaumicAnvil(player.inventory, world, x, y, z, player); - - if(ID == 0x421920) - return new ContainerVoidAnvil(player.inventory, world, x, y, z, player); - - if(ID == 0x421919) - return new ContainerRevolver(player.inventory, world, x, y, z); - } - - return null; - } + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - // TODO Auto-generated method stub - return null; - } - - public void registerRenderInformation() - { - - } - - public void lightning(World world, double sx, double sy, double sz, double ex, double ey, double ez, int dur, float curve, int speed, int type) - { - - } - - public void sparkle(World w, double x, double y, double z, double dx, double dy, double dz, int color, float scale) - { - - } - - public World clientWorld() - { - return null; - } + if (ID == 0x421922) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null) { + if (tile instanceof TileOverchanter) { + return new ContainerOverchanter(player.inventory, tile); + } + } + } else { + + if (ID == 0x421921) return new ContainerThaumicAnvil(player.inventory, world, x, y, z, player); + + if (ID == 0x421920) return new ContainerVoidAnvil(player.inventory, world, x, y, z, player); + + if (ID == 0x421919) return new ContainerRevolver(player.inventory, world, x, y, z); + } + + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + // TODO Auto-generated method stub + return null; + } + + public void registerRenderInformation() {} + + public void lightning( + World world, + double sx, + double sy, + double sz, + double ex, + double ey, + double ez, + int dur, + float curve, + int speed, + int type) {} + + public void sparkle( + World w, double x, double y, double z, double dx, double dy, double dz, int color, float scale) {} + + public World clientWorld() { + return null; + } } diff --git a/src/main/java/tb/utils/RevolverInfusionRecipe.java b/src/main/java/tb/utils/RevolverInfusionRecipe.java index f41381b..df3bf35 100644 --- a/src/main/java/tb/utils/RevolverInfusionRecipe.java +++ b/src/main/java/tb/utils/RevolverInfusionRecipe.java @@ -1,8 +1,7 @@ package tb.utils; -import java.util.ArrayList; - import DummyCore.Utils.Pair; +import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -14,93 +13,86 @@ import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.InfusionRecipe; -public class RevolverInfusionRecipe extends InfusionRecipe{ +public class RevolverInfusionRecipe extends InfusionRecipe { - RevolverUpgrade upgrade; - - public RevolverInfusionRecipe(String research, RevolverUpgrade output, int inst,AspectList aspects2, ItemStack[] recipe) - { - super(research, new ItemStack(TBItems.revolver,1,OreDictionary.WILDCARD_VALUE), inst, aspects2, new ItemStack(TBItems.revolver,1,OreDictionary.WILDCARD_VALUE), recipe); - upgrade = output; - } + RevolverUpgrade upgrade; - @Override - public boolean matches(ArrayList input, ItemStack central, World world, EntityPlayer player) - { - ArrayList> upgrades = ItemRevolver.getAllUpgradesFor(central); - for(Pair p : upgrades) - { - RevolverUpgrade up = p.getFirst(); - if(up.conflictsWith(upgrade)) - return false; - } - - if(ItemRevolver.getUpgradeLevel(central, upgrade)+1 > upgrade.getMaxLevel()) - return false; - - if (getRecipeInput() == null) - return false; - - if(this.research.length() <= 0) - return false; - - if (this.research.length() > 0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research)) - return false; - - ItemStack i2 = central.copy(); - if (getRecipeInput().getItemDamage() == OreDictionary.WILDCARD_VALUE) - i2.setItemDamage(OreDictionary.WILDCARD_VALUE); - - ArrayList ii = new ArrayList(); - for (ItemStack is : input) - ii.add(is.copy()); - - for (ItemStack comp : getComponents()) - { - boolean b = false; - for (int a = 0; a < ii.size(); a++) - { - i2 = ((ItemStack)ii.get(a)).copy(); - if (comp.getItemDamage() == OreDictionary.WILDCARD_VALUE) - i2.setItemDamage(OreDictionary.WILDCARD_VALUE); - - if (areItemStacksEqual(i2, comp, true)) - { - ii.remove(a); - b = true; - break; - } - } - if (!b) - return false; - } - - return ii.size() == 0; - } - - @Override - public Object getRecipeOutput(ItemStack input) - { - ItemStack istk = input.copy(); - ItemRevolver.addUpgrade(istk, upgrade, ItemRevolver.getUpgradeLevel(istk, upgrade)+1); - return istk; - } - - @Override - public AspectList getAspects(ItemStack input) - { - AspectList retAsp = this.aspects.copy(); - - for(int i = 0; i < ItemRevolver.getUpgradeLevel(input, upgrade); ++i) - for(int j = 0; j < retAsp.size(); ++j) - retAsp.add(retAsp.getAspects()[j], retAsp.getAmount(retAsp.getAspects()[j])); - - return retAsp; - } - - @Override - public int getInstability(ItemStack input) - { - return super.getInstability(input)+upgrade.getInstabilityForLevel(ItemRevolver.getUpgradeLevel(input, upgrade)); - } + public RevolverInfusionRecipe( + String research, RevolverUpgrade output, int inst, AspectList aspects2, ItemStack[] recipe) { + super( + research, + new ItemStack(TBItems.revolver, 1, OreDictionary.WILDCARD_VALUE), + inst, + aspects2, + new ItemStack(TBItems.revolver, 1, OreDictionary.WILDCARD_VALUE), + recipe); + upgrade = output; + } + + @Override + public boolean matches(ArrayList input, ItemStack central, World world, EntityPlayer player) { + ArrayList> upgrades = ItemRevolver.getAllUpgradesFor(central); + for (Pair p : upgrades) { + RevolverUpgrade up = p.getFirst(); + if (up.conflictsWith(upgrade)) return false; + } + + if (ItemRevolver.getUpgradeLevel(central, upgrade) + 1 > upgrade.getMaxLevel()) return false; + + if (getRecipeInput() == null) return false; + + if (this.research.length() <= 0) return false; + + if (this.research.length() > 0 + && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research)) return false; + + ItemStack i2 = central.copy(); + if (getRecipeInput().getItemDamage() == OreDictionary.WILDCARD_VALUE) + i2.setItemDamage(OreDictionary.WILDCARD_VALUE); + + ArrayList ii = new ArrayList(); + for (ItemStack is : input) ii.add(is.copy()); + + for (ItemStack comp : getComponents()) { + boolean b = false; + for (int a = 0; a < ii.size(); a++) { + i2 = ((ItemStack) ii.get(a)).copy(); + if (comp.getItemDamage() == OreDictionary.WILDCARD_VALUE) + i2.setItemDamage(OreDictionary.WILDCARD_VALUE); + + if (areItemStacksEqual(i2, comp, true)) { + ii.remove(a); + b = true; + break; + } + } + if (!b) return false; + } + + return ii.size() == 0; + } + + @Override + public Object getRecipeOutput(ItemStack input) { + ItemStack istk = input.copy(); + ItemRevolver.addUpgrade(istk, upgrade, ItemRevolver.getUpgradeLevel(istk, upgrade) + 1); + return istk; + } + + @Override + public AspectList getAspects(ItemStack input) { + AspectList retAsp = this.aspects.copy(); + + for (int i = 0; i < ItemRevolver.getUpgradeLevel(input, upgrade); ++i) + for (int j = 0; j < retAsp.size(); ++j) + retAsp.add(retAsp.getAspects()[j], retAsp.getAmount(retAsp.getAspects()[j])); + + return retAsp; + } + + @Override + public int getInstability(ItemStack input) { + return super.getInstability(input) + + upgrade.getInstabilityForLevel(ItemRevolver.getUpgradeLevel(input, upgrade)); + } } diff --git a/src/main/java/tb/utils/TBConfig.java b/src/main/java/tb/utils/TBConfig.java index fba1401..98d0d2c 100644 --- a/src/main/java/tb/utils/TBConfig.java +++ b/src/main/java/tb/utils/TBConfig.java @@ -1,114 +1,143 @@ package tb.utils; +import DummyCore.Utils.IDummyConfig; import net.minecraft.enchantment.Enchantment; import net.minecraftforge.common.config.Configuration; -import DummyCore.Utils.IDummyConfig; -public class TBConfig implements IDummyConfig{ - - static Configuration cfg; - - public static int elderKnowledgeID; - public static int eldritchBaneID; - public static int magicTouchID; - public static int taintedID; - public static int vaporisingID; - - public static int aquaticFociUID; - public static int nethericFociUID; - public static int decomposingFociUID; - public static int vaporisingFociUID; - public static int calmingFociUID; - public static int crystalizationFociUID; - public static int warpingFociUID; - - public static boolean allowTobacco; - public static boolean enableTTCompathability; - public static int shardsFromOre; - public static boolean brightFociRequiresPrimordialPearl; - public static boolean enableRevolver; - public static boolean enableNodeTools; - public static boolean enableBracelets; - public static boolean enableFlora; - public static boolean enableBloodyMess; - //public static boolean enableVoidTools; +public class TBConfig implements IDummyConfig { - public static int minBlazePowderFromPyrofluid; - public static int maxBlazePowderFromPyrofluid; - - public static int speedMultiplierForFurnace; - public static boolean makeRequireAlumentum; - + static Configuration cfg; - @Override - public void load(Configuration config) { - cfg = config; - - //Adv. alchemy furnace - speedMultiplierForFurnace = cfg.getInt( - "speedMultiplierForFurnace", "Advanced Alchemy Furnace", 2, 0, Integer.MAX_VALUE, - "This is the speed of the Advanced Alchamical Furnace. TC's basic has 1."); - - makeRequireAlumentum = cfg.getBoolean( - "makeRequireAlumentium", "Advanced Alchemy Furnace", true, - "Does the Advanced Alchemical Furnace requires Alumentum to work faster"); - - //enchants - elderKnowledgeID = cfg.getInt("elderKnowledgeEnchantmentID", "Enchantments", 98, 0, Enchantment.enchantmentsList.length, ""); - eldritchBaneID = cfg.getInt("eldritchBaneEnchantmentID", "Enchantments", 99, 0, Enchantment.enchantmentsList.length, ""); - magicTouchID = cfg.getInt("magicTouchEnchantmentID", "Enchantments", 100, 0, Enchantment.enchantmentsList.length, ""); - taintedID = cfg.getInt("taintedEnchantmentID", "Enchantments", 101, 0, Enchantment.enchantmentsList.length, ""); - vaporisingID = cfg.getInt("vaporisingEnchantmentID", "Enchantments", 102, 0, Enchantment.enchantmentsList.length, ""); - - //focus upgrades - aquaticFociUID = cfg.getInt("aquaticFociUID", "Foci", 42, 0, Integer.MAX_VALUE, ""); - nethericFociUID = cfg.getInt("nethericFociUID", "Foci", 43, 0, Integer.MAX_VALUE, ""); - decomposingFociUID = cfg.getInt("decomposingFociUID", "Foci", 44, 0, Integer.MAX_VALUE, ""); - vaporisingFociUID = cfg.getInt("vaporisingFociUID", "Foci", 45, 0, Integer.MAX_VALUE, ""); - calmingFociUID = cfg.getInt("calmingFociUID", "Foci", 46, 0, Integer.MAX_VALUE, ""); - crystalizationFociUID = cfg.getInt("crystalizationFociUID", "Foci", 47, 0, Integer.MAX_VALUE, ""); - warpingFociUID = cfg.getInt("warpingFociUID", "Foci", 48, 0, Integer.MAX_VALUE, ""); - - //general + module disable - allowTobacco = cfg.getBoolean("allowTobacco", "General", true, - "If set to false the tobacco will be disabled - there will be no recipes/no entries in Thaumonomicon"); - - enableTTCompathability = cfg.getBoolean("enableTTCompathability", "General", true, - "Allow the mod to register it's enchantments in the Thaumic Tinkerer's enchanter? Set to false if Thaumic Tinkerer is crashing you."); - - shardsFromOre = cfg.getInt("shardsFromOre", "General", 8, 1, 64, - "Amount of shards recieved from crucible ore processing"); - - brightFociRequiresPrimordialPearl = cfg.getBoolean("brightFociRequiresPrimordialPearl", "General", true, - "Does the Brightness Foci for the Node Manipulator requires a Primordial Pearl"); - - enableRevolver = cfg.getBoolean("enableRevolver", "General", true, - "If set to false the revolver and upgrades will be disabled - there will be no recipes/no entries in Thaumonomicon"); - - enableNodeTools = cfg.getBoolean("enableNodeTools", "General", true, - "If set to false, will disable the Node Modifer, focuses, and the Node Linker's entries and recipes"); - - enableBracelets = cfg.getBoolean("enableBracelets", "General", true, - "If set to false the various bracelets will be disabled - there will be no recipes/no entries in Thaumonomicon"); - - enableFlora = cfg.getBoolean("enableFlora", "General", true, - "If set to false the various plant items will be disabled - there will be no recipes/no entries in Thaumonomicon"); - - enableBloodyMess = cfg.getBoolean("enableBloodyMess", "General", true, - "If set to false the spikes and bloody robes will be disabled - there will be no recipes/no entries in Thaumonomicon"); - - /*enableVoidTools = cfg.getBoolean("enableVoidTools", "General", true, - "If set to false the void shears and igniter will be disabled - there will be no recipes/no entries in Thaumonomicon"); - */ - - - //pyrofluid - minBlazePowderFromPyrofluid = cfg.getInt("minBlazePowderFromPyrofluid", "Pyrofluid", 5, 0, Integer.MAX_VALUE, ""); - maxBlazePowderFromPyrofluid = cfg.getInt("maxBlazePowderFromPyrofluid", "Pyrofluid", 5+32, 0, Integer.MAX_VALUE, ""); - + public static int elderKnowledgeID; + public static int eldritchBaneID; + public static int magicTouchID; + public static int taintedID; + public static int vaporisingID; - } - + public static int aquaticFociUID; + public static int nethericFociUID; + public static int decomposingFociUID; + public static int vaporisingFociUID; + public static int calmingFociUID; + public static int crystalizationFociUID; + public static int warpingFociUID; + public static boolean allowTobacco; + public static boolean enableTTCompathability; + public static int shardsFromOre; + public static boolean brightFociRequiresPrimordialPearl; + public static boolean enableRevolver; + public static boolean enableNodeTools; + public static boolean enableBracelets; + public static boolean enableFlora; + public static boolean enableBloodyMess; + // public static boolean enableVoidTools; + public static int minBlazePowderFromPyrofluid; + public static int maxBlazePowderFromPyrofluid; + + public static int speedMultiplierForFurnace; + public static boolean makeRequireAlumentum; + + @Override + public void load(Configuration config) { + cfg = config; + + // Adv. alchemy furnace + speedMultiplierForFurnace = cfg.getInt( + "speedMultiplierForFurnace", + "Advanced Alchemy Furnace", + 2, + 0, + Integer.MAX_VALUE, + "This is the speed of the Advanced Alchamical Furnace. TC's basic has 1."); + + makeRequireAlumentum = cfg.getBoolean( + "makeRequireAlumentium", + "Advanced Alchemy Furnace", + true, + "Does the Advanced Alchemical Furnace requires Alumentum to work faster"); + + // enchants + elderKnowledgeID = cfg.getInt( + "elderKnowledgeEnchantmentID", "Enchantments", 98, 0, Enchantment.enchantmentsList.length, ""); + eldritchBaneID = + cfg.getInt("eldritchBaneEnchantmentID", "Enchantments", 99, 0, Enchantment.enchantmentsList.length, ""); + magicTouchID = + cfg.getInt("magicTouchEnchantmentID", "Enchantments", 100, 0, Enchantment.enchantmentsList.length, ""); + taintedID = cfg.getInt("taintedEnchantmentID", "Enchantments", 101, 0, Enchantment.enchantmentsList.length, ""); + vaporisingID = + cfg.getInt("vaporisingEnchantmentID", "Enchantments", 102, 0, Enchantment.enchantmentsList.length, ""); + + // focus upgrades + aquaticFociUID = cfg.getInt("aquaticFociUID", "Foci", 42, 0, Integer.MAX_VALUE, ""); + nethericFociUID = cfg.getInt("nethericFociUID", "Foci", 43, 0, Integer.MAX_VALUE, ""); + decomposingFociUID = cfg.getInt("decomposingFociUID", "Foci", 44, 0, Integer.MAX_VALUE, ""); + vaporisingFociUID = cfg.getInt("vaporisingFociUID", "Foci", 45, 0, Integer.MAX_VALUE, ""); + calmingFociUID = cfg.getInt("calmingFociUID", "Foci", 46, 0, Integer.MAX_VALUE, ""); + crystalizationFociUID = cfg.getInt("crystalizationFociUID", "Foci", 47, 0, Integer.MAX_VALUE, ""); + warpingFociUID = cfg.getInt("warpingFociUID", "Foci", 48, 0, Integer.MAX_VALUE, ""); + + // general + module disable + allowTobacco = cfg.getBoolean( + "allowTobacco", + "General", + true, + "If set to false the tobacco will be disabled - there will be no recipes/no entries in Thaumonomicon"); + + enableTTCompathability = cfg.getBoolean( + "enableTTCompathability", + "General", + true, + "Allow the mod to register it's enchantments in the Thaumic Tinkerer's enchanter? Set to false if Thaumic Tinkerer is crashing you."); + + shardsFromOre = cfg.getInt( + "shardsFromOre", "General", 8, 1, 64, "Amount of shards recieved from crucible ore processing"); + + brightFociRequiresPrimordialPearl = cfg.getBoolean( + "brightFociRequiresPrimordialPearl", + "General", + true, + "Does the Brightness Foci for the Node Manipulator requires a Primordial Pearl"); + + enableRevolver = cfg.getBoolean( + "enableRevolver", + "General", + true, + "If set to false the revolver and upgrades will be disabled - there will be no recipes/no entries in Thaumonomicon"); + + enableNodeTools = cfg.getBoolean( + "enableNodeTools", + "General", + true, + "If set to false, will disable the Node Modifer, focuses, and the Node Linker's entries and recipes"); + + enableBracelets = cfg.getBoolean( + "enableBracelets", + "General", + true, + "If set to false the various bracelets will be disabled - there will be no recipes/no entries in Thaumonomicon"); + + enableFlora = cfg.getBoolean( + "enableFlora", + "General", + true, + "If set to false the various plant items will be disabled - there will be no recipes/no entries in Thaumonomicon"); + + enableBloodyMess = cfg.getBoolean( + "enableBloodyMess", + "General", + true, + "If set to false the spikes and bloody robes will be disabled - there will be no recipes/no entries in Thaumonomicon"); + + /*enableVoidTools = cfg.getBoolean("enableVoidTools", "General", true, + "If set to false the void shears and igniter will be disabled - there will be no recipes/no entries in Thaumonomicon"); + */ + + // pyrofluid + minBlazePowderFromPyrofluid = + cfg.getInt("minBlazePowderFromPyrofluid", "Pyrofluid", 5, 0, Integer.MAX_VALUE, ""); + maxBlazePowderFromPyrofluid = + cfg.getInt("maxBlazePowderFromPyrofluid", "Pyrofluid", 5 + 32, 0, Integer.MAX_VALUE, ""); + } } diff --git a/src/main/java/tb/utils/TBUtils.java b/src/main/java/tb/utils/TBUtils.java index 48e0971..da0efb2 100644 --- a/src/main/java/tb/utils/TBUtils.java +++ b/src/main/java/tb/utils/TBUtils.java @@ -1,54 +1,52 @@ package tb.utils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.common.util.FakePlayer; import thaumcraft.api.aspects.Aspect; import thaumcraft.common.Thaumcraft; import thaumcraft.common.lib.network.PacketHandler; import thaumcraft.common.lib.network.playerdata.PacketAspectPool; import thaumcraft.common.lib.research.ResearchManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraftforge.common.util.FakePlayer; public class TBUtils { - - public static void addAspectToKnowledgePool(EntityPlayer player, Aspect aspect, short amount) - { - Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount); - ResearchManager.scheduleSave(player); - if(player instanceof EntityPlayerMP) - if (!(player instanceof FakePlayer)) { - PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), Short.valueOf(amount), Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP)player); - } - } - - /** - * @param type 0 = Temporary, 1 = Regular, 2 = Permanent - */ - public static void addWarpToPlayer(EntityPlayer addTo, int amount, int type) - { - switch(type) - { - case 2: - { - Thaumcraft.addWarpToPlayer(addTo, amount, false); - return; - } - case 1: - { - Thaumcraft.addStickyWarpToPlayer(addTo, amount); - return; - } - case 0: - { - Thaumcraft.addWarpToPlayer(addTo, amount, true); - return; - } - default: - { - Thaumcraft.addWarpToPlayer(addTo, amount, false); - return; - } - } - } + public static void addAspectToKnowledgePool(EntityPlayer player, Aspect aspect, short amount) { + Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount); + ResearchManager.scheduleSave(player); + if (player instanceof EntityPlayerMP) + if (!(player instanceof FakePlayer)) { + PacketHandler.INSTANCE.sendTo( + new PacketAspectPool( + aspect.getTag(), + Short.valueOf(amount), + Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor( + player.getCommandSenderName(), aspect))), + (EntityPlayerMP) player); + } + } + + /** + * @param type 0 = Temporary, 1 = Regular, 2 = Permanent + */ + public static void addWarpToPlayer(EntityPlayer addTo, int amount, int type) { + switch (type) { + case 2: { + Thaumcraft.addWarpToPlayer(addTo, amount, false); + return; + } + case 1: { + Thaumcraft.addStickyWarpToPlayer(addTo, amount); + return; + } + case 0: { + Thaumcraft.addWarpToPlayer(addTo, amount, true); + return; + } + default: { + Thaumcraft.addWarpToPlayer(addTo, amount, false); + return; + } + } + } }