From 932ec20cfbfa02da35216e48dd836cde6118fd4f Mon Sep 17 00:00:00 2001 From: miozune Date: Tue, 1 Nov 2022 11:09:22 +0900 Subject: [PATCH] updateBuildScript & spotlessApply --- build.gradle | 653 +++++++++++---- settings.gradle | 11 +- .../arc/bloodarsenal/client/ClientProxy.java | 39 +- .../renderer/block/RenderBloodTNTPrimed.java | 52 +- .../renderer/block/RenderTileLifeInfuser.java | 16 +- .../block/TileLifeInfuserRenderer.java | 51 +- .../block/TilePortableAltarRenderer.java | 115 +-- .../item/TilePortableAltarItemRenderer.java | 21 +- .../entity/RenderEntityBloodHound.java | 43 +- .../client/renderer/item/RenderBow.java | 47 +- .../renderer/model/ModelLifeInfuser.java | 19 +- .../model/ModelPortableBloodAltar.java | 26 +- .../renderer/model/ModelVampireCostume.java | 124 ++- .../arc/bloodarsenal/common/BloodArsenal.java | 143 ++-- .../common/BloodArsenalConfig.java | 148 ++-- .../common/BloodArsenalEventHooks.java | 195 ++--- .../common/BloodArsenalRecipes.java | 750 +++++++++++++++--- .../arc/bloodarsenal/common/CommonProxy.java | 31 +- .../common/block/BlockBloodCake.java | 119 ++- .../block/BlockBloodInfusedDiamond.java | 9 +- .../block/BlockBloodInfusedGlowstone.java | 13 +- .../common/block/BlockBloodInfusedPlanks.java | 6 +- .../common/block/BlockBloodInfusedWood.java | 15 +- .../common/block/BlockBloodLamp.java | 6 +- .../common/block/BlockBloodStainedGlass.java | 26 +- .../common/block/BlockBloodStainedIce.java | 58 +- .../block/BlockBloodStainedPackedIce.java | 12 +- .../common/block/BlockBloodStone.java | 31 +- .../common/block/BlockBloodTNT.java | 111 +-- .../common/block/BlockBloodTorch.java | 6 +- .../common/block/BlockBurnedString.java | 184 ++--- .../common/block/BlockCompactedMRS.java | 104 +-- .../common/block/BlockCompacter.java | 199 ++--- .../common/block/BlockInfusedIron.java | 9 +- .../common/block/BlockLPMaterializer.java | 121 ++- .../common/block/BlockLifeInfuser.java | 106 +-- .../common/block/BlockPortableAltar.java | 196 ++--- .../bloodarsenal/common/block/ModBlocks.java | 50 +- .../common/block/MultipartHandler.java | 32 +- .../common/entity/EntityBloodTNT.java | 55 +- .../common/entity/ModLivingDropsEvent.java | 48 +- .../common/entity/ai/AIAttackOnCollide.java | 109 ++- .../common/entity/ai/AIFollowOwner.java | 83 +- .../common/entity/ai/AIHurtByTarget.java | 41 +- .../common/entity/ai/AILeapAtTarget.java | 33 +- .../common/entity/ai/AIOwnerHurtByTarget.java | 35 +- .../common/entity/ai/AIOwnerHurtTarget.java | 33 +- .../common/entity/mob/EntityBloodHound.java | 307 +++---- .../bloodarsenal/common/gui/ConfigGui.java | 53 +- .../common/gui/ConfigGuiFactory.java | 37 +- .../bloodarsenal/common/gui/GuiHandler.java | 15 +- .../common/items/ItemBloodArsenal.java | 96 ++- .../common/items/ItemBloodCookie.java | 22 +- .../common/items/ItemBloodMoney.java | 103 +-- .../common/items/ItemBloodOrange.java | 12 +- .../common/items/ItemBoundDiamondShards.java | 32 +- .../common/items/ItemJuiceAndCookies.java | 22 +- .../common/items/ItemSoulBooster.java | 65 +- .../common/items/ItemSoulNullifier.java | 99 +-- .../bloodarsenal/common/items/ModItems.java | 57 +- .../items/armor/ElementalLifeImbuedArmor.java | 164 ++-- .../common/items/armor/GlassArmor.java | 25 +- .../common/items/armor/LifeImbuedArmor.java | 164 ++-- .../common/items/armor/VampireCostume.java | 140 ++-- .../bauble/EmpoweredSacrificeAmulet.java | 151 ++-- .../bauble/EmpoweredSelfSacrificeAmulet.java | 166 ++-- .../common/items/bauble/ItemBauble.java | 54 +- .../common/items/bauble/SacrificeAmulet.java | 87 +- .../items/bauble/SelfSacrificeAmulet.java | 101 +-- .../common/items/bauble/VampireRing.java | 27 +- .../common/items/block/BloodStoneBlock.java | 15 +- .../common/items/block/CompactedMRSBlock.java | 25 +- .../items/block/PortableAltarBlock.java | 28 +- .../common/items/book/BloodBurnedTome.java | 131 ++- .../common/items/book/RecipeHolder.java | 27 +- .../common/items/orb/TransparentOrb.java | 60 +- .../common/items/sigil/SigilDivinity.java | 99 +-- .../common/items/sigil/SigilEnder.java | 72 +- .../common/items/sigil/SigilLightning.java | 78 +- .../common/items/sigil/SigilSwimming.java | 99 +-- .../common/items/sigil/SigilUtils.java | 22 +- .../items/sigil/holding/AHPacketHandler.java | 6 +- .../sigil/holding/AHPacketProcessor.java | 21 +- .../holding/ContainerAugmentedHolding.java | 137 ++-- .../sigil/holding/GuiAugmentedHolding.java | 16 +- .../holding/InventoryAugmentedHolding.java | 151 ++-- .../sigil/holding/SigilAugmentedHolding.java | 178 ++--- .../common/items/tool/BoundBow.java | 181 ++--- .../common/items/tool/BoundIgniter.java | 152 ++-- .../common/items/tool/BoundShears.java | 196 ++--- .../common/items/tool/BoundSickle.java | 222 +++--- .../items/tool/GlassDaggerOfSacrifice.java | 108 ++- .../items/tool/GlassSacrificialDagger.java | 138 ++-- .../common/items/tool/IFillable.java | 3 +- .../common/items/tool/InfusedDiamond.java | 52 +- .../common/items/tool/InfusedDiamondAxe.java | 105 ++- .../items/tool/InfusedDiamondPickaxe.java | 125 +-- .../items/tool/InfusedDiamondShovel.java | 106 +-- .../items/tool/InfusedDiamondSword.java | 95 +-- .../common/items/tool/InfusedIronAxe.java | 46 +- .../common/items/tool/InfusedIronPickaxe.java | 46 +- .../common/items/tool/InfusedIronShovel.java | 46 +- .../common/items/tool/InfusedIronSword.java | 45 +- .../common/items/tool/InfusedWoodAxe.java | 43 +- .../common/items/tool/InfusedWoodPickaxe.java | 43 +- .../common/items/tool/InfusedWoodShovel.java | 43 +- .../common/items/tool/InfusedWoodSword.java | 42 +- .../common/items/tool/ToolCapabilities.java | 200 +++-- .../bloodarsenal/common/misc/WAILAPlugin.java | 112 ++- .../common/potion/PotionBloodArsenal.java | 15 +- .../common/rituals/RitualEffectEnchant.java | 226 ++---- .../common/rituals/RitualEffectFishing.java | 75 +- .../common/rituals/RitualEffectMidas.java | 74 +- .../rituals/RitualEffectMobDisable.java | 71 +- .../common/rituals/RitualEffectWithering.java | 79 +- .../common/rituals/RitualRegistry.java | 39 +- .../thaumcraft/BloodArsenalResearchItem.java | 28 +- .../thaumcraft/BloodArsenalThaumcraft.java | 116 ++- .../thaumcraft/BloodWoodStaffUpdate.java | 80 +- .../thaumcraft/BloodWoodWandUpdate.java | 75 +- .../common/thaumcraft/BloodyWandCap.java | 16 +- .../common/thaumcraft/ItemWandCaps.java | 30 +- .../common/thaumcraft/ItemWandCores.java | 36 +- .../tileentity/FluidTankRestricted.java | 18 +- .../common/tileentity/PacketHandler.java | 216 +++-- .../common/tileentity/TileCompactedMRS.java | 373 ++++----- .../common/tileentity/TileCompacter.java | 8 +- .../common/tileentity/TileLPMaterializer.java | 321 +++----- .../common/tileentity/TileLifeInfuser.java | 318 ++++---- .../common/tileentity/TilePortableAltar.java | 680 +++++++--------- .../container/ContainerPortableAltar.java | 53 +- .../common/tinkers/BloodArsenalModifiers.java | 9 +- .../common/tinkers/BloodArsenalTinkers.java | 78 +- .../common/tinkers/IClientCode.java | 3 +- .../common/tinkers/ModSoulbound.java | 73 +- .../common/tinkers/TConEvents.java | 16 +- .../tinkers/TextureResourcePackBase.java | 143 ++-- .../TextureResourcePackBloodInfusedIron.java | 236 ++---- 138 files changed, 6082 insertions(+), 7070 deletions(-) diff --git a/build.gradle b/build.gradle index c09bee2..309db15 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,40 @@ -//version: 1652851397 +//version: 1666827308 /* -DO NOT CHANGE THIS FILE! - -Also, you may replace this file at any time if there is an update available. -Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. -*/ + DO NOT CHANGE THIS FILE! + Also, you may replace this file at any time if there is an update available. + Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle for updates. + */ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.matthewprenger.cursegradle.CurseArtifact +import com.matthewprenger.cursegradle.CurseRelation +import com.modrinth.minotaur.dependencies.ModDependency +import com.modrinth.minotaur.dependencies.VersionDependency 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 { + mavenCentral() + maven { name 'forge' url 'https://maven.minecraftforge.net' } + maven { + // GTNH ForgeGradle Fork + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + } maven { name 'sonatype' url 'https://oss.sonatype.org/content/repositories/snapshots/' @@ -28,31 +43,39 @@ buildscript { name 'Scala CI dependencies' url 'https://repo1.maven.org/maven2/' } - maven { - name 'jitpack' - url 'https://jitpack.io' - } } dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7' + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.9' } } - plugins { id 'java-library' id 'idea' id 'eclipse' id 'scala' id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false - id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false - id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false - id 'org.ajoberstar.grgit' version '4.1.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.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' apply false + id 'com.modrinth.minotaur' version '2.+' apply false + id 'com.matthewprenger.cursegradle' version '1.4.0' apply false } +boolean settingsupdated = verifySettingsGradle() +settingsupdated = verifyGitAttributes() || settingsupdated +if (settingsupdated) + throw new GradleException("Settings has been updated, please re-run task.") + +dependencies { + implementation 'com.diffplug:blowdryer:1.6.0' +} + +apply plugin: 'com.diffplug.blowdryer' if (project.file('.git/HEAD').isFile()) { apply plugin: 'com.palantir.git-version' @@ -78,7 +101,14 @@ idea { } } -if(JavaVersion.current() != JavaVersion.VERSION_1_8) { +boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false + +if (!disableSpotless) { + apply plugin: 'com.diffplug.spotless' + apply from: Blowdryer.file('spotless.gradle') +} + +if (JavaVersion.current() != JavaVersion.VERSION_1_8) { throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) } @@ -103,63 +133,79 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") -boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false -boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() +propertyDefaultIfUnset("noPublishedSources", false) +propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) +propertyDefaultIfUnset("forceEnableMixins", false) +propertyDefaultIfUnset("channel", "stable") +propertyDefaultIfUnset("mappingsVersion", "12") +propertyDefaultIfUnset("modrinthProjectId", "") +propertyDefaultIfUnset("modrinthRelations", "") +propertyDefaultIfUnset("curseForgeProjectId", "") +propertyDefaultIfUnset("curseForgeRelations", "") String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" -String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") -String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") -String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") -if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + +final String modGroupPath = modGroup.toString().replaceAll("\\.", "/") +final String apiPackagePath = apiPackage.toString().replaceAll("\\.", "/") + +String targetPackageJava = javaSourceDir + modGroupPath +String targetPackageScala = scalaSourceDir + modGroupPath +String targetPackageKotlin = kotlinSourceDir + modGroupPath +if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } -if(apiPackage) { - targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { +if (apiPackage) { + targetPackageJava = javaSourceDir + modGroupPath + "/" + apiPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + "/" + apiPackagePath + targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + apiPackagePath + if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } } -if(accessTransformersFile) { +if (accessTransformersFile) { String targetFile = "src/main/resources/META-INF/" + accessTransformersFile - if(!getFile(targetFile).exists()) { + if (!getFile(targetFile).exists()) { throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) } } -if(usesMixins.toBoolean()) { - if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { - throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") +if (usesMixins.toBoolean()) { + if (mixinsPackage.isEmpty()) { + throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!") + } + final String mixinPackagePath = mixinsPackage.toString().replaceAll("\\.", "/") + final String mixinPluginPath = mixinPlugin.toString().replaceAll("\\.", "/") + + targetPackageJava = javaSourceDir + modGroupPath + "/" + mixinPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + "/" + mixinPackagePath + targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPackagePath + if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } - targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) - } - - String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" - if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) + if (!mixinPlugin.isEmpty()) { + String targetFileJava = javaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" + String targetFileScala = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" + String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPluginPath + ".kt" + if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) + } } } -if(coreModClass) { - String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" - if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { +if (coreModClass) { + final String coreModPath = coreModClass.toString().replaceAll("\\.", "/") + String targetFileJava = javaSourceDir + modGroupPath + "/" + coreModPath + ".java" + String targetFileScala = scalaSourceDir + modGroupPath + "/" + coreModPath + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + coreModPath + ".java" + String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + coreModPath + ".kt" + if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } @@ -189,7 +235,7 @@ try { 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' + + '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' @@ -200,22 +246,21 @@ ext { modVersion = identifiedVersion } -if(identifiedVersion == versionOverride) { +if (identifiedVersion == versionOverride) { out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } group = modGroup -if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { +if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { archivesBaseName = customArchiveBaseName -} -else { +} else { archivesBaseName = modId } def arguments = [] def jvmArguments = [] -if (usesMixins.toBoolean()) { +if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { arguments += [ "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] @@ -234,16 +279,16 @@ minecraft { if (replaceGradleTokenInFile) { replaceIn replaceGradleTokenInFile - if(gradleTokenModId) { + if (gradleTokenModId) { replace gradleTokenModId, modId } - if(gradleTokenModName) { + if (gradleTokenModName) { replace gradleTokenModName, modName } - if(gradleTokenVersion) { + if (gradleTokenVersion) { replace gradleTokenVersion, modVersion } - if(gradleTokenGroupName) { + if (gradleTokenGroupName) { replace gradleTokenGroupName, modGroup } } @@ -252,7 +297,7 @@ minecraft { args(arguments) jvmArgs(jvmArguments) - if(developmentEnvironmentUserName) { + if (developmentEnvironmentUserName) { args("--username", developmentEnvironmentUserName) } } @@ -263,7 +308,7 @@ minecraft { } } -if(file('addon.gradle').exists()) { +if (file('addon.gradle').exists()) { apply from: 'addon.gradle' } @@ -280,33 +325,23 @@ repositories { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' } - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { maven { - name 'sponge' - url 'https://repo.spongepowered.org/repository/maven-public' - } - maven { - url 'https://jitpack.io' + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" } } } dependencies { - if(usesMixins.toBoolean()) { + 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') - // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { - // Mixin includes a lot of dependencies that are too up-to-date - 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') + annotationProcessor('org.spongepowered:mixin:0.8.5-GTNH:processor') + } + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + compile('com.gtnewhorizon:gtnhmixins:2.0.1') } } @@ -318,13 +353,18 @@ def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" task generateAssets { if (usesMixins.toBoolean()) { - def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); + def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json") if (!mixinConfigFile.exists()) { + def mixinPluginLine = "" + if(!mixinPlugin.isEmpty()) { + // We might not have a mixin plugin if we're using early/late mixins + mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """ + } + mixinConfigFile.text = """{ "required": true, - "minVersion": "0.7.11", - "package": "${modGroup}.${mixinsPackage}", - "plugin": "${modGroup}.${mixinPlugin}", + "minVersion": "0.8.5-GTNH", + "package": "${modGroup}.${mixinsPackage}",${mixinPluginLine} "refmap": "${mixingConfigRefMap}", "target": "@env(DEFAULT)", "compatibilityLevel": "JAVA_8", @@ -354,7 +394,10 @@ shadowJar { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile + ] dependsOn(relocateShadowJar) } @@ -369,38 +412,38 @@ jar { attributes(getManifestAttributes()) } - if(usesShadowedDependencies.toBoolean()) { + if (usesShadowedDependencies.toBoolean()) { dependsOn(shadowJar) enabled = false } } reobf { - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { addExtraSrgFile mixinSrg } } afterEvaluate { - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { tasks.compileJava { options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobf.srg}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" ] } } } runClient { - if(developmentEnvironmentUserName) { + if (developmentEnvironmentUserName) { arguments += [ - "--username", - developmentEnvironmentUserName + "--username", + developmentEnvironmentUserName ] } @@ -415,9 +458,9 @@ runServer { tasks.withType(JavaExec).configureEach { javaLauncher.set( - javaToolchains.launcherFor { - languageVersion = projectJavaVersion - } + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } ) } @@ -425,6 +468,7 @@ processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version + exclude("spotless.gradle") // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { @@ -437,43 +481,44 @@ processResources { "modName": modName } - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { from refMap } // copy everything else that's not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' + exclude 'spotless.gradle' } } def getManifestAttributes() { def manifestAttributes = [:] - if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { + if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } - if(accessTransformersFile) { - manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + if (accessTransformersFile) { + manifestAttributes += ["FMLAT": accessTransformersFile.toString()] } - if(coreModClass) { + if (coreModClass) { manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] } - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes } task sourcesJar(type: Jar) { - from (sourceSets.main.allSource) - from (file("$projectDir/LICENSE")) + from(sourceSets.main.allSource) + from(file("$projectDir/LICENSE")) getArchiveClassifier().set('sources') } @@ -492,7 +537,10 @@ task shadowDevJar(type: ShadowJar) { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile + ] } task relocateShadowDevJar(type: ConfigureShadowRelocation) { @@ -520,22 +568,22 @@ task devJar(type: Jar) { attributes(getManifestAttributes()) } - if(usesShadowedDependencies.toBoolean()) { + if (usesShadowedDependencies.toBoolean()) { dependsOn(circularResolverJar) enabled = false } } task apiJar(type: Jar) { - from (sourceSets.main.allSource) { - include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + from(sourceSets.main.allSource) { + include modGroupPath + "/" + apiPackagePath + '/**' } - from (sourceSets.main.output) { - include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + from(sourceSets.main.output) { + include modGroupPath + "/" + apiPackagePath + '/**' } - from (sourceSets.main.resources.srcDirs) { + from(sourceSets.main.resources.srcDirs) { include("LICENSE") } @@ -543,11 +591,11 @@ task apiJar(type: Jar) { } artifacts { - if(!noPublishedSources) { + if (!noPublishedSources) { archives sourcesJar } archives devJar - if(apiPackage) { + if (apiPackage) { archives apiJar } } @@ -565,10 +613,10 @@ publishing { publications { maven(MavenPublication) { from components.java - if(usesShadowedDependencies.toBoolean()) { + if (usesShadowedDependencies.toBoolean()) { artifact source: shadowJar, classifier: "" } - if(!noPublishedSources) { + if (!noPublishedSources) { artifact source: sourcesJar, classifier: "sources" } artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" @@ -583,8 +631,11 @@ publishing { // remove extra garbage from minecraft and minecraftDeps configuration pom.withXml { - def badArtifacts = [:].withDefault {[] as Set} - for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) { + 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 } @@ -613,6 +664,113 @@ publishing { } } +if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) { + apply plugin: 'com.modrinth.minotaur' + + File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") + + modrinth { + token = System.getenv("MODRINTH_TOKEN") + projectId = modrinthProjectId + versionNumber = identifiedVersion + versionType = identifiedVersion.endsWith("-pre") ? "beta" : "release" + changelog = changelogFile.exists() ? changelogFile.getText("UTF-8") : "" + uploadFile = jar + additionalFiles = getSecondaryArtifacts() + gameVersions = [minecraftVersion] + loaders = ["forge"] + debugMode = false + } + + if (modrinthRelations.size() != 0) { + String[] deps = modrinthRelations.split(";") + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(":") + String[] qual = parts[0].split("-") + addModrinthDep(qual[0], qual[1], parts[1]) + } + } + if (usesMixins.toBoolean()) { + addModrinthDep("required", "version", "gtnhmixins") + } + tasks.modrinth.dependsOn(build) + tasks.publish.dependsOn(tasks.modrinth) +} + +if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) { + apply plugin: 'com.matthewprenger.cursegradle' + + File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") + + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = curseForgeProjectId + if (changelogFile.exists()) { + changelogType = "markdown" + changelog = changelogFile + } + releaseType = identifiedVersion.endsWith("-pre") ? "beta" : "release" + addGameVersion minecraftVersion + addGameVersion "Forge" + mainArtifact jar + for (artifact in getSecondaryArtifacts()) addArtifact artifact + } + + options { + javaIntegration = false + forgeGradleIntegration = false + debug = false + } + } + + if (curseForgeRelations.size() != 0) { + String[] deps = curseForgeRelations.split(";") + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(":") + addCurseForgeRelation(parts[0], parts[1]) + } + } + if (usesMixins.toBoolean()) { + addCurseForgeRelation("requiredDependency", "gtnhmixins") + } + tasks.curseforge.dependsOn(build) + tasks.publish.dependsOn(tasks.curseforge) +} + +def addModrinthDep(scope, type, name) { + com.modrinth.minotaur.dependencies.Dependency dep; + if (!(scope in ["required", "optional", "incompatible", "embedded"])) { + throw new Exception("Invalid modrinth dependency scope: " + scope) + } + switch (type) { + case "project": + dep = new ModDependency(name, scope) + break + case "version": + dep = new VersionDependency(name, scope) + break + default: + throw new Exception("Invalid modrinth dependency type: " + type) + } + project.modrinth.dependencies.add(dep) +} + +def addCurseForgeRelation(type, name) { + if (!(type in ["requiredDependency", "embeddedLibrary", "optionalDependency", "tool", "incompatible"])) { + throw new Exception("Invalid CurseForge relation type: " + type) + } + CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact + CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation())) + rel."$type"(name) +} + // Updating task updateBuildScript { doLast { @@ -622,7 +780,7 @@ task updateBuildScript { } } -if (isNewBuildScriptVersionAvailable(projectDir.toString())) { +if (!project.getGradle().startParameter.isOffline() && isNewBuildScriptVersionAvailable(projectDir.toString())) { if (autoUpdateBuildScript.toBoolean()) { performBuildScriptUpdate(projectDir.toString()) } else { @@ -631,7 +789,40 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) { } static URL availableBuildScriptUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle") + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") +} + +static URL exampleSettingsGradleUrl() { + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example") +} + +static URL exampleGitAttributesUrl() { + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes") +} + + +boolean verifyGitAttributes() { + def gitattributesFile = getFile(".gitattributes") + if (!gitattributesFile.exists()) { + println("Downloading default .gitattributes") + exampleGitAttributesUrl().withInputStream { i -> gitattributesFile.withOutputStream { it << i } } + exec { + workingDir '.' + commandLine 'git', 'add', '--renormalize', '.' + } + return true + } + return false +} + +boolean verifySettingsGradle() { + def settingsFile = getFile("settings.gradle") + if (!settingsFile.exists()) { + println("Downloading default settings.gradle") + exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } } + return true + } + return false } boolean performBuildScriptUpdate(String projectDir) { @@ -639,6 +830,10 @@ boolean performBuildScriptUpdate(String projectDir) { def buildscriptFile = getFile("build.gradle") availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + boolean settingsupdated = verifySettingsGradle() + settingsupdated = verifyGitAttributes() || settingsupdated + if (settingsupdated) + throw new GradleException("Settings has been updated, please re-run task.") return true } return false @@ -658,7 +853,7 @@ boolean isNewBuildScriptVersionAvailable(String projectDir) { static String getVersionHash(String buildScriptContent) { String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") - if(versionLine != null) { + if (versionLine != null) { return versionLine.split(": ").last() } return "" @@ -669,7 +864,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 { @@ -678,42 +969,57 @@ def deobf(String sourceURL) { //get rid of directories: int lastSlash = fileName.lastIndexOf("/") - if(lastSlash > 0) { + if (lastSlash > 0) { 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(".")) } String hostName = url.getHost() - if(hostName.startsWith("www.")) { + if (hostName.startsWith("www.")) { hostName = hostName.substring(4) } List parts = Arrays.asList(hostName.split("\\.")) Collections.reverse(parts) hostName = String.join(".", parts) - return deobf(sourceURL, hostName + "/" + fileName) - } catch(Exception e) { - return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) + return deobf(sourceURL, "$hostName/$fileName") + } catch (Exception e) { + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") } } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String 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()) { + if (file(deobfFile).exists()) { return files(deobfFile) } + String mappingsVer + String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' + 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 @@ -727,14 +1033,48 @@ def deobf(String sourceURL, String fileName) { } exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' workingDir bon2Dir - standardOutput = new ByteArrayOutputStream() + standardOutput = new FileOutputStream("${deobfFile}.log") } return files(deobfFile) } +def zipMappings(String zipPath, String url, String bon2Dir) { + File zipFile = new File(zipPath) + if (zipFile.exists()) { + return + } + + String fieldsCache = "$bon2Dir/data/fields.csv" + String methodsCache = "$bon2Dir/data/methods.csv" + + download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true + } + download.run { + src "${url}methods.csv" + dest methodsCache + quiet true + } + + zipFile.getParentFile().mkdirs() + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) + + zos.putNextEntry(new ZipEntry("fields.csv")) + Files.copy(Paths.get(fieldsCache), zos) + zos.closeEntry() + + zos.putNextEntry(new ZipEntry("methods.csv")) + Files.copy(Paths.get(methodsCache), zos) + zos.closeEntry() + + zos.close() +} + // Helper methods def checkPropertyExists(String propertyName) { @@ -743,6 +1083,21 @@ def checkPropertyExists(String propertyName) { } } +def propertyDefaultIfUnset(String propertyName, defaultValue) { + if (!project.hasProperty(propertyName) || project.property(propertyName) == "") { + project.ext.setProperty(propertyName, defaultValue) + } +} + def getFile(String relativePath) { return new File(projectDir, relativePath) } + +def getSecondaryArtifacts() { + // Because noPublishedSources from the beginning of the script is somehow not visible here... + boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false + def secondaryArtifacts = [devJar] + if (!noPublishedSources) secondaryArtifacts += [sourcesJar] + if (apiPackage) secondaryArtifacts += [apiJar] + return secondaryArtifacts +} diff --git a/settings.gradle b/settings.gradle index cbad5c1..93c852a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,10 @@ -rootProject.name = 'BloodArsenal' \ No newline at end of file +plugins { + id 'com.diffplug.blowdryerSetup' version '1.6.0' +} + +apply plugin: 'com.diffplug.blowdryerSetup' + +blowdryerSetup { + github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5') + //devLocal '.' // Use this when testing config updates locally +} diff --git a/src/main/java/com/arc/bloodarsenal/client/ClientProxy.java b/src/main/java/com/arc/bloodarsenal/client/ClientProxy.java index 92a112c..f26cf83 100644 --- a/src/main/java/com/arc/bloodarsenal/client/ClientProxy.java +++ b/src/main/java/com/arc/bloodarsenal/client/ClientProxy.java @@ -1,14 +1,14 @@ package com.arc.bloodarsenal.client; +import com.arc.bloodarsenal.client.renderer.block.*; +import com.arc.bloodarsenal.client.renderer.block.TilePortableAltarRenderer; +import com.arc.bloodarsenal.client.renderer.block.item.TilePortableAltarItemRenderer; +import com.arc.bloodarsenal.client.renderer.item.RenderBow; import com.arc.bloodarsenal.common.CommonProxy; import com.arc.bloodarsenal.common.block.ModBlocks; import com.arc.bloodarsenal.common.entity.EntityBloodTNT; import com.arc.bloodarsenal.common.items.ModItems; import com.arc.bloodarsenal.common.items.sigil.SigilUtils; -import com.arc.bloodarsenal.client.renderer.block.*; -import com.arc.bloodarsenal.client.renderer.item.RenderBow; -import com.arc.bloodarsenal.client.renderer.block.TilePortableAltarRenderer; -import com.arc.bloodarsenal.client.renderer.block.item.TilePortableAltarItemRenderer; import com.arc.bloodarsenal.common.tileentity.TileLifeInfuser; import com.arc.bloodarsenal.common.tileentity.TilePortableAltar; import com.arc.bloodarsenal.common.tinkers.IClientCode; @@ -21,11 +21,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; -public class ClientProxy extends CommonProxy -{ +public class ClientProxy extends CommonProxy { @Override - public void init() - { + public void init() { registerRenders(); registerEvents(); getClientWorld(); @@ -33,37 +31,38 @@ public class ClientProxy extends CommonProxy } @Override - public void registerRenders() - { + public void registerRenders() { MinecraftForgeClient.registerItemRenderer(ModItems.bound_bow, new RenderBow()); RenderingRegistry.registerEntityRenderingHandler(EntityBloodTNT.class, new RenderBloodTNTPrimed()); -// RenderingRegistry.registerEntityRenderingHandler(EntityBloodHound.class, new RenderEntityBloodHound(new ModelWolf(), new ModelWolf(), 0.5F)); + // RenderingRegistry.registerEntityRenderingHandler(EntityBloodHound.class, new + // RenderEntityBloodHound(new ModelWolf(), new ModelWolf(), 0.5F)); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.life_infuser), new RenderTileLifeInfuser()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.life_infuser), new RenderTileLifeInfuser()); ClientRegistry.bindTileEntitySpecialRenderer(TilePortableAltar.class, new TilePortableAltarRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileLifeInfuser.class, new TileLifeInfuserRenderer()); } @Override - public void registerEvents() - { + public void registerEvents() { MinecraftForge.EVENT_BUS.register(new SigilUtils()); } @Override - public World getClientWorld() - { + public World getClientWorld() { return FMLClientHandler.instance().getClient().theWorld; } @Override - public void initRendering() - { - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.portable_altar), new TilePortableAltarItemRenderer()); + public void initRendering() { + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.portable_altar), new TilePortableAltarItemRenderer()); } @Override - public void executeClientCode(IClientCode clientCode) {clientCode.executeClientCode();} + public void executeClientCode(IClientCode clientCode) { + clientCode.executeClientCode(); + } } diff --git a/src/main/java/com/arc/bloodarsenal/client/renderer/block/RenderBloodTNTPrimed.java b/src/main/java/com/arc/bloodarsenal/client/renderer/block/RenderBloodTNTPrimed.java index f039294..52395e5 100644 --- a/src/main/java/com/arc/bloodarsenal/client/renderer/block/RenderBloodTNTPrimed.java +++ b/src/main/java/com/arc/bloodarsenal/client/renderer/block/RenderBloodTNTPrimed.java @@ -12,12 +12,10 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class RenderBloodTNTPrimed extends Render -{ +public class RenderBloodTNTPrimed extends Render { private RenderBlocks blockRenderer = new RenderBlocks(); - public RenderBloodTNTPrimed() - { + public RenderBloodTNTPrimed() { this.shadowSize = 0.5F; } @@ -27,23 +25,25 @@ public class RenderBloodTNTPrimed extends Render * (Render 1.0F) - { + if (f2 > 1.0F) { f2 = 1.0F; } @@ -53,12 +53,11 @@ public class RenderBloodTNTPrimed extends Render GL11.glScalef(f3, f3, f3); } - f2 = (1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 100.0F) * 0.8F; + f2 = (1.0F - ((float) p_76986_1_.fuse - p_76986_9_ + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(p_76986_1_); this.blockRenderer.renderBlockAsItem(ModBlocks.blood_tnt, 0, p_76986_1_.getBrightness(p_76986_9_)); - if (p_76986_1_.fuse / 5 % 2 == 0) - { + if (p_76986_1_.fuse / 5 % 2 == 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); @@ -77,17 +76,15 @@ public class RenderBloodTNTPrimed extends Render /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(EntityBloodTNT p_110775_1_) - { + protected ResourceLocation getEntityTexture(EntityBloodTNT p_110775_1_) { return TextureMap.locationBlocksTexture; } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(Entity p_110775_1_) - { - return this.getEntityTexture((EntityBloodTNT)p_110775_1_); + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return this.getEntityTexture((EntityBloodTNT) p_110775_1_); } /** @@ -96,8 +93,13 @@ public class RenderBloodTNTPrimed extends Render * (Render PURPLE?", false, "Purple is always better than Red. But I won't tell you how to live your life. Even if it is incorrect.").getBoolean(isRedGood); - cakeIsLie = config.get(misc, "The cake is a lie", false, "The cake is a lie").getBoolean(cakeIsLie); - isGlassDangerous = config.get(misc, "Is glass dangerous?", true, "Breaking glass is dangerous unless you're a wimp").getBoolean(isGlassDangerous); + isRedGood = config.get( + misc, + "Is RED > PURPLE?", + false, + "Purple is always better than Red. But I won't tell you how to live your life. Even if it is incorrect.") + .getBoolean(isRedGood); + cakeIsLie = config.get(misc, "The cake is a lie", false, "The cake is a lie") + .getBoolean(cakeIsLie); + isGlassDangerous = config.get( + misc, "Is glass dangerous?", true, "Breaking glass is dangerous unless you're a wimp") + .getBoolean(isGlassDangerous); config.save(); } diff --git a/src/main/java/com/arc/bloodarsenal/common/BloodArsenalEventHooks.java b/src/main/java/com/arc/bloodarsenal/common/BloodArsenalEventHooks.java index bacfc0c..422b3c1 100644 --- a/src/main/java/com/arc/bloodarsenal/common/BloodArsenalEventHooks.java +++ b/src/main/java/com/arc/bloodarsenal/common/BloodArsenalEventHooks.java @@ -6,6 +6,7 @@ import com.arc.bloodarsenal.common.items.armor.GlassArmor; import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockGlass; import net.minecraft.block.material.Material; @@ -17,147 +18,124 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.world.BlockEvent; -import net.minecraftforge.common.util.FakePlayer; -import java.util.Random; - -public class BloodArsenalEventHooks -{ +public class BloodArsenalEventHooks { private Random rand = new Random(); @SubscribeEvent - public void onEntityDamaged(LivingAttackEvent event) - { + public void onEntityDamaged(LivingAttackEvent event) { EntityLivingBase entityAttacked = event.entityLiving; Entity entityAttacking = event.source.getSourceOfDamage(); float damageDone = event.ammount; - if (entityAttacking != null && entityAttacked != null) - { - if (entityAttacking instanceof EntityLivingBase) - { - if (((EntityLivingBase) entityAttacking).isPotionActive(BloodArsenal.vampiricAura)) - { + if (entityAttacking != null && entityAttacked != null) { + if (entityAttacking instanceof EntityLivingBase) { + if (((EntityLivingBase) entityAttacking).isPotionActive(BloodArsenal.vampiricAura)) { float drainedHealth = damageDone / 4; - ((EntityLivingBase) entityAttacking).setHealth(((EntityLivingBase) entityAttacking).getHealth() + drainedHealth); + ((EntityLivingBase) entityAttacking) + .setHealth(((EntityLivingBase) entityAttacking).getHealth() + drainedHealth); } } - if (entityAttacked instanceof EntityPlayer) - { - if (entityAttacked.isPotionActive(BloodArsenal.swimming)) - { - if (entityAttacked.isInsideOfMaterial(Material.lava)) - { - if (event.source.isFireDamage()) - { + if (entityAttacked instanceof EntityPlayer) { + if (entityAttacked.isPotionActive(BloodArsenal.swimming)) { + if (entityAttacked.isInsideOfMaterial(Material.lava)) { + if (event.source.isFireDamage()) { event.setCanceled(true); } } } - if (entityAttacked instanceof EntityPlayerMP && !(entityAttacked instanceof FakePlayer)) - { - EntityPlayerMP player = (EntityPlayerMP) entityAttacked; + if (entityAttacked instanceof EntityPlayerMP && !(entityAttacked instanceof FakePlayer)) { + EntityPlayerMP player = (EntityPlayerMP) entityAttacked; - if (player.inventory.armorInventory != null) - { - for (int i = 0; i < 4; i++) - { - ItemStack armorStack = player.inventory.armorInventory[3 - i]; + if (player.inventory.armorInventory != null) { + for (int i = 0; i < 4; i++) { + ItemStack armorStack = player.inventory.armorInventory[3 - i]; - if (armorStack != null && armorStack.getItem() instanceof GlassArmor) - { - if (entityAttacking instanceof EntityLivingBase) - { - ((EntityLivingBase) entityAttacking).addPotionEffect(new PotionEffect(BloodArsenalConfig.bleedingID, rand.nextInt(3) * 20, rand.nextInt(1))); - } - } - } - } + if (armorStack != null && armorStack.getItem() instanceof GlassArmor) { + if (entityAttacking instanceof EntityLivingBase) { + ((EntityLivingBase) entityAttacking) + .addPotionEffect(new PotionEffect( + BloodArsenalConfig.bleedingID, + rand.nextInt(3) * 20, + rand.nextInt(1))); + } + } + } + } } } } } @SubscribeEvent - public void onEntityUpdate(LivingEvent.LivingUpdateEvent event) - { + public void onEntityUpdate(LivingEvent.LivingUpdateEvent event) { EntityLivingBase entityLiving = event.entityLiving; - if (entityLiving != null) - { - if (entityLiving instanceof FakePlayer) - return; + if (entityLiving != null) { + if (entityLiving instanceof FakePlayer) return; - if (entityLiving.isPotionActive(BloodArsenal.bleeding)) - { - int amplifier = entityLiving.getActivePotionEffect(BloodArsenal.bleeding).getAmplifier(); - int duration = entityLiving.getActivePotionEffect(BloodArsenal.bleeding).getDuration(); + if (entityLiving.isPotionActive(BloodArsenal.bleeding)) { + int amplifier = entityLiving + .getActivePotionEffect(BloodArsenal.bleeding) + .getAmplifier(); + int duration = entityLiving + .getActivePotionEffect(BloodArsenal.bleeding) + .getDuration(); int damage = (rand.nextInt(2) * (amplifier + 1) + rand.nextInt(2)); entityLiving.addPotionEffect(new PotionEffect(Potion.blindness.id, duration, 1)); - if (entityLiving.worldObj.getWorldTime() % (60 / (amplifier + 1)) == 0) - { + if (entityLiving.worldObj.getWorldTime() % (60 / (amplifier + 1)) == 0) { entityLiving.attackEntityFrom(BloodArsenal.deathFromBlood, damage); entityLiving.hurtResistantTime = Math.min(entityLiving.hurtResistantTime, 60 / (amplifier + 1)); entityLiving.onEntityUpdate(); } } - if (entityLiving.isPotionActive(BloodArsenal.soulBurn)) - { - int amplifier = entityLiving.getActivePotionEffect(BloodArsenal.soulBurn).getAmplifier(); + if (entityLiving.isPotionActive(BloodArsenal.soulBurn)) { + int amplifier = entityLiving + .getActivePotionEffect(BloodArsenal.soulBurn) + .getAmplifier(); entityLiving.setFire(2); - if (entityLiving instanceof EntityPlayer && entityLiving.getHealth() > 0.0) - { - if (entityLiving.worldObj.getWorldTime() % (10 / (amplifier + 1)) == 0) - { + if (entityLiving instanceof EntityPlayer && entityLiving.getHealth() > 0.0) { + if (entityLiving.worldObj.getWorldTime() % (10 / (amplifier + 1)) == 0) { int lpToMinus = 1000 * (2 ^ (amplifier + 1)); - SoulNetworkHandler.syphonAndDamageFromNetwork(entityLiving.getCommandSenderName(), (EntityPlayer) entityLiving, lpToMinus); + SoulNetworkHandler.syphonAndDamageFromNetwork( + entityLiving.getCommandSenderName(), (EntityPlayer) entityLiving, lpToMinus); } } } - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.isPotionActive(BloodArsenal.swimming)) - { - if (entityLiving.isInWater() || entityLiving.isInsideOfMaterial(Material.lava)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.isPotionActive(BloodArsenal.swimming)) { + if (entityLiving.isInWater() || entityLiving.isInsideOfMaterial(Material.lava)) { entityLiving.setAir(300); entityLiving.motionX *= 1.2D; - if (entityLiving.motionY > 0.0D) - { + if (entityLiving.motionY > 0.0D) { entityLiving.motionY *= 1.2D; } entityLiving.motionZ *= 1.2D; double maxSpeed = 0.2D; - if (entityLiving.motionX > maxSpeed) - { + if (entityLiving.motionX > maxSpeed) { entityLiving.motionX = maxSpeed; - } - else if (entityLiving.motionX < -maxSpeed) - { + } else if (entityLiving.motionX < -maxSpeed) { entityLiving.motionX = -maxSpeed; } - if (entityLiving.motionY > maxSpeed) - { + if (entityLiving.motionY > maxSpeed) { entityLiving.motionY = maxSpeed; } - if (entityLiving.motionZ > maxSpeed) - { + if (entityLiving.motionZ > maxSpeed) { entityLiving.motionZ = maxSpeed; - } - else if (entityLiving.motionZ < -maxSpeed) - { + } else if (entityLiving.motionZ < -maxSpeed) { entityLiving.motionZ = -maxSpeed; } } @@ -167,18 +145,13 @@ public class BloodArsenalEventHooks } @SubscribeEvent - public void breakSpeed(PlayerEvent.BreakSpeed event) - { + public void breakSpeed(PlayerEvent.BreakSpeed event) { EntityLivingBase entityLiving = event.entityLiving; - if (entityLiving != null) - { - if (entityLiving instanceof EntityPlayer && !(entityLiving instanceof FakePlayer)) - { - if (entityLiving.isPotionActive(BloodArsenal.swimming)) - { - if (entityLiving.isInWater() || entityLiving.isInsideOfMaterial(Material.lava)) - { + if (entityLiving != null) { + if (entityLiving instanceof EntityPlayer && !(entityLiving instanceof FakePlayer)) { + if (entityLiving.isPotionActive(BloodArsenal.swimming)) { + if (entityLiving.isInWater() || entityLiving.isInsideOfMaterial(Material.lava)) { event.newSpeed = 1.75F; } } @@ -187,39 +160,31 @@ public class BloodArsenalEventHooks } @SubscribeEvent - public void harvestEvent(BlockEvent.HarvestDropsEvent event) - { - if (GameRegistry.findItem(BloodArsenal.MODID, "glass_shard") != null) - { + public void harvestEvent(BlockEvent.HarvestDropsEvent event) { + if (GameRegistry.findItem(BloodArsenal.MODID, "glass_shard") != null) { Block block = event.block; EntityPlayer player = event.harvester; Random random = new Random(); - if (player != null && player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) - { - if (!event.world.isRemote && !event.isSilkTouching) - { - if (block != null && block instanceof BlockGlass) - { - if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.flint) - { + if (player != null && player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) { + if (!event.world.isRemote && !event.isSilkTouching) { + if (block != null && block instanceof BlockGlass) { + if (player.getCurrentEquippedItem() != null + && player.getCurrentEquippedItem().getItem() == Items.flint) { event.drops.add(new ItemStack(ModItems.glass_shard)); - if (random.nextInt() + 5 < 8) - { + if (random.nextInt() + 5 < 8) { event.drops.add(new ItemStack(ModItems.glass_shard)); } event.dropChance = 0.25F; - if (BloodArsenalConfig.isGlassDangerous && random.nextInt(5) > 3) - { - player.addPotionEffect(new PotionEffect(BloodArsenal.bleeding.id, 4 * 20, random.nextInt(2))); + if (BloodArsenalConfig.isGlassDangerous && random.nextInt(5) > 3) { + player.addPotionEffect( + new PotionEffect(BloodArsenal.bleeding.id, 4 * 20, random.nextInt(2))); } - } - else - { - if (BloodArsenalConfig.isGlassDangerous && random.nextInt(3) == 2) - { - player.addPotionEffect(new PotionEffect(BloodArsenal.bleeding.id, 8 * 20, random.nextInt(3))); + } else { + if (BloodArsenalConfig.isGlassDangerous && random.nextInt(3) == 2) { + player.addPotionEffect( + new PotionEffect(BloodArsenal.bleeding.id, 8 * 20, random.nextInt(3))); } } } @@ -229,10 +194,8 @@ public class BloodArsenalEventHooks } @SubscribeEvent - public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) - { - if (event.modID.equals(BloodArsenal.MODID)) - { + public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { + if (event.modID.equals(BloodArsenal.MODID)) { BloodArsenalConfig.syncConfig(); BloodArsenal.logger.info("Refreshing configuration file"); } diff --git a/src/main/java/com/arc/bloodarsenal/common/BloodArsenalRecipes.java b/src/main/java/com/arc/bloodarsenal/common/BloodArsenalRecipes.java index 976f8dc..1fb2d55 100644 --- a/src/main/java/com/arc/bloodarsenal/common/BloodArsenalRecipes.java +++ b/src/main/java/com/arc/bloodarsenal/common/BloodArsenalRecipes.java @@ -13,40 +13,68 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -public class BloodArsenalRecipes -{ - public static void registerAltarRecipes() - { - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModBlocks.blood_tnt), new ItemStack(Blocks.tnt), 3, 10000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(Blocks.log), 2, 3000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModBlocks.blood_infused_iron_block), new ItemStack(Blocks.iron_block), 3, 54000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.item_blood_cake), new ItemStack(Items.cake), 3, 10000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_infused_iron), new ItemStack(Items.iron_ingot), 3, 6000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_orange), new ItemStack(Items.dye, 1, 14), 1, 200, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_infused_diamond_active), new ItemStack(ModItems.blood_infused_diamond_unactive), 4, 80000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.soul_fragment), new ItemStack(ModItems.heart), 4, 75000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_cookie), new ItemStack(Items.cookie), 1, 2000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_infused_glowstone_dust), new ItemStack(Items.glowstone_dust), 3, 5000, 5, 5, false); - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_money), new ItemStack(Items.paper), 3, 10000, 5, 5, false); +public class BloodArsenalRecipes { + public static void registerAltarRecipes() { + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModBlocks.blood_tnt), new ItemStack(Blocks.tnt), 3, 10000, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(Blocks.log), 2, 3000, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModBlocks.blood_infused_iron_block), + new ItemStack(Blocks.iron_block), + 3, + 54000, + 5, + 5, + false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.item_blood_cake), new ItemStack(Items.cake), 3, 10000, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.blood_infused_iron), new ItemStack(Items.iron_ingot), 3, 6000, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.blood_orange), new ItemStack(Items.dye, 1, 14), 1, 200, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.blood_infused_diamond_active), + new ItemStack(ModItems.blood_infused_diamond_unactive), + 4, + 80000, + 5, + 5, + false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.soul_fragment), new ItemStack(ModItems.heart), 4, 75000, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.blood_cookie), new ItemStack(Items.cookie), 1, 2000, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.blood_infused_glowstone_dust), + new ItemStack(Items.glowstone_dust), + 3, + 5000, + 5, + 5, + false); + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.blood_money), new ItemStack(Items.paper), 3, 10000, 5, 5, false); } - public static void registerBindingRecipes() - { + public static void registerBindingRecipes() { BindingRegistry.registerRecipe(new ItemStack(ModItems.bound_bow), new ItemStack(Items.bow)); BindingRegistry.registerRecipe(new ItemStack(ModItems.bound_sickle), new ItemStack(Items.diamond_hoe)); BindingRegistry.registerRecipe(new ItemStack(ModItems.bound_shears), new ItemStack(Items.shears)); - BindingRegistry.registerRecipe(new ItemStack(ModItems.blood_infused_diamond_bound), new ItemStack(ModItems.blood_infused_diamond_active)); + BindingRegistry.registerRecipe( + new ItemStack(ModItems.blood_infused_diamond_bound), + new ItemStack(ModItems.blood_infused_diamond_active)); BindingRegistry.registerRecipe(new ItemStack(ModItems.bound_igniter), new ItemStack(Items.flint_and_steel)); - if (BloodArsenal.isHalloween()) - { - BindingRegistry.registerRecipe(new ItemStack(ModItems.vampire_cape), new ItemStack(Items.leather_chestplate)); - BindingRegistry.registerRecipe(new ItemStack(ModItems.vampire_greaves), new ItemStack(Items.leather_leggings)); + if (BloodArsenal.isHalloween()) { + BindingRegistry.registerRecipe( + new ItemStack(ModItems.vampire_cape), new ItemStack(Items.leather_chestplate)); + BindingRegistry.registerRecipe( + new ItemStack(ModItems.vampire_greaves), new ItemStack(Items.leather_leggings)); BindingRegistry.registerRecipe(new ItemStack(ModItems.vampire_boots), new ItemStack(Items.leather_boots)); } } - public static void registerRecipes() - { + public static void registerRecipes() { int craftingConstant = OreDictionary.WILDCARD_VALUE; ItemStack blankSlate = new ItemStack(WayofTime.alchemicalWizardry.ModItems.blankSlate); @@ -55,110 +83,634 @@ public class BloodArsenalRecipes ItemStack demonicSlate = new ItemStack(WayofTime.alchemicalWizardry.ModItems.demonicSlate); ItemStack etherealSlate = new ItemStack(WayofTime.alchemicalWizardry.ModItems.baseItems, 1, 27); ItemStack weakOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.weakBloodOrb, 1, craftingConstant); - ItemStack apprenticeOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.apprenticeBloodOrb, 1, craftingConstant); - ItemStack magicianOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.magicianBloodOrb, 1, craftingConstant); + ItemStack apprenticeOrb = + new ItemStack(WayofTime.alchemicalWizardry.ModItems.apprenticeBloodOrb, 1, craftingConstant); + ItemStack magicianOrb = + new ItemStack(WayofTime.alchemicalWizardry.ModItems.magicianBloodOrb, 1, craftingConstant); ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, craftingConstant); - ItemStack archmageOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.archmageBloodOrb, 1, craftingConstant); - ItemStack transcendentOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.transcendentBloodOrb, 1, craftingConstant); + ItemStack archmageOrb = + new ItemStack(WayofTime.alchemicalWizardry.ModItems.archmageBloodOrb, 1, craftingConstant); + ItemStack transcendentOrb = + new ItemStack(WayofTime.alchemicalWizardry.ModItems.transcendentBloodOrb, 1, craftingConstant); - addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_ice, 8), "aaa", "aba", "aaa", 'a', Blocks.ice, 'b', apprenticeOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_glass, 8), "aaa", "aba", "aaa", 'a', Blocks.glass, 'b', apprenticeOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.life_infuser), "aba", "aca", "ada", 'a', ModItems.blood_infused_iron, 'b', magicianOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.blockAltar, 'd', Items.bucket); - addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.lp_materializer), "aba", "bcb", "aba", 'a', ModItems.blood_infused_iron, 'b', imbuedSlate, 'c', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.compacter), "aaa", "bcb", "ded", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_diamond_bound, 'c', Blocks.piston, 'd', ModBlocks.blood_infused_iron_block, 'e', archmageOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_axe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_axe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_pickaxe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_pickaxe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_shovel_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_shovel_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_sword_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_sword_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_diamond), "aba", "bcb", "aba", 'a', Blocks.glass, 'b', Items.diamond, 'c', masterOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_diamond_unactive), "aba", "bcb", "ada", 'a', ModItems.amorphic_catalyst, 'b', ModBlocks.blood_infused_iron_block, 'c', ModItems.blood_diamond, 'd', masterOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_axe_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_axe_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_pickaxe_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_pickaxe_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_shovel_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_shovel_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_sword_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_sword_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.soul_booster), "aaa", "aba", "aca", 'a', ModItems.soul_fragment, 'b', Blocks.beacon, 'c', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.soul_nullifier), "aaa", "aba", "aca", 'a', ModItems.soul_fragment, 'b', WayofTime.alchemicalWizardry.ModItems.armourInhibitor, 'c', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_swimming), "aba", "cdc", "aea", 'a', Items.water_bucket, 'b', Items.bucket, 'c', Items.lava_bucket, 'd', WayofTime.alchemicalWizardry.ModItems.voidSigil, 'e', apprenticeOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_ender), "aba", "cdc", "efe", 'a', Blocks.obsidian, 'b', Items.ender_eye, 'c', Items.ender_pearl, 'd', imbuedSlate, 'e', Blocks.ender_chest, 'f', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_divinity), "aba", "cde", "fgf", 'a', ModBlocks.blood_infused_glowstone, 'b', new ItemStack(Items.golden_apple, 1, 1), 'c', Items.nether_star, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfElementalAffinity, 'e', ModItems.blood_infused_diamond_bound, 'f', ModItems.amorphic_catalyst, 'g', transcendentOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_burned_string, 4), "aaa", "aba", "aaa", 'a', Items.string, 'b', weakOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_augmented_holding), "aba", "cde", "fgf", 'a', demonicSlate, 'b', masterOrb, 'c', Items.blaze_rod, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfHolding, 'e', Items.ghast_tear, 'f', ModItems.blood_infused_iron, 'g', Blocks.chest); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_lightning), "aba", "cdc", "efg", 'a', new ItemStack(ModBlocks.blood_stone, 1, 3), 'b', Blocks.iron_block, 'c', ModBlocks.blood_infused_iron_block, 'd', etherealSlate, 'e', Items.nether_star, 'f', archmageOrb, 'g', ModItems.blood_infused_diamond_bound); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_sacrificial_dagger), "aaa", "aba", "cdc", 'a', ModItems.glass_shard, 'b', WayofTime.alchemicalWizardry.ModItems.sacrificialDagger, 'c', ModItems.blood_infused_iron, 'd', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_dagger_of_sacrifice), "aaa", "aba", "cdc", 'a', ModItems.glass_shard, 'b', WayofTime.alchemicalWizardry.ModItems.daggerOfSacrifice, 'c', ModItems.blood_infused_iron, 'd', magicianOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_helmet), "aaa", "aba", 'a', ModItems.glass_shard, 'b', apprenticeOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_chestplate), "aba", "aaa", "aaa", 'a', ModItems.glass_shard, 'b', apprenticeOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_leggings), "aaa", "aba", "a a", 'a', ModItems.glass_shard, 'b', apprenticeOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.glass_boots), "a a", "aba", 'a', ModItems.glass_shard, 'b', apprenticeOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.transparent_orb), "aba", "bcb", "ded", 'a', ModBlocks.blood_stained_glass, 'b', Blocks.glass, 'c', transcendentOrb, 'd', ModItems.blood_burned_string, 'e', WayofTime.alchemicalWizardry.ModItems.divinationSigil); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.life_imbued_helmet), "aba", "aca", 'a', ModItems.blood_infused_iron, 'b', magicianOrb, 'c', Items.iron_helmet); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.life_imbued_chestplate), "aba", "aca", "aaa", 'a', ModItems.blood_infused_iron, 'b', magicianOrb, 'c', Items.iron_chestplate); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.life_imbued_leggings), "aba", "aca", "a a", 'a', ModItems.blood_infused_iron, 'b', magicianOrb, 'c', Items.iron_leggings); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.life_imbued_boots), "aba", "aca", 'a', ModItems.blood_infused_iron, 'b', magicianOrb, 'c', Items.iron_boots); + addOreDictBloodOrbRecipe( + new ItemStack(ModBlocks.blood_stained_ice, 8), + "aaa", + "aba", + "aaa", + 'a', + Blocks.ice, + 'b', + apprenticeOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModBlocks.blood_stained_glass, 8), + "aaa", + "aba", + "aaa", + 'a', + Blocks.glass, + 'b', + apprenticeOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModBlocks.life_infuser), + "aba", + "aca", + "ada", + 'a', + ModItems.blood_infused_iron, + 'b', + magicianOrb, + 'c', + WayofTime.alchemicalWizardry.ModBlocks.blockAltar, + 'd', + Items.bucket); + addOreDictBloodOrbRecipe( + new ItemStack(ModBlocks.lp_materializer), + "aba", + "bcb", + "aba", + 'a', + ModItems.blood_infused_iron, + 'b', + imbuedSlate, + 'c', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModBlocks.compacter), + "aaa", + "bcb", + "ded", + 'a', + ModBlocks.blood_infused_planks, + 'b', + ModItems.blood_infused_diamond_bound, + 'c', + Blocks.piston, + 'd', + ModBlocks.blood_infused_iron_block, + 'e', + archmageOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_axe_iron), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_iron, + 'b', + ModItems.blood_infused_axe_wood, + 'c', + ModItems.amorphic_catalyst, + 'd', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_pickaxe_iron), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_iron, + 'b', + ModItems.blood_infused_pickaxe_wood, + 'c', + ModItems.amorphic_catalyst, + 'd', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_shovel_iron), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_iron, + 'b', + ModItems.blood_infused_shovel_wood, + 'c', + ModItems.amorphic_catalyst, + 'd', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_sword_iron), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_iron, + 'b', + ModItems.blood_infused_sword_wood, + 'c', + ModItems.amorphic_catalyst, + 'd', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_diamond), + "aba", + "bcb", + "aba", + 'a', + Blocks.glass, + 'b', + Items.diamond, + 'c', + masterOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_diamond_unactive), + "aba", + "bcb", + "ada", + 'a', + ModItems.amorphic_catalyst, + 'b', + ModBlocks.blood_infused_iron_block, + 'c', + ModItems.blood_diamond, + 'd', + masterOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_axe_diamond), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_diamond_bound, + 'b', + ModItems.blood_infused_axe_iron, + 'c', + ModItems.amorphic_catalyst, + 'd', + masterOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_pickaxe_diamond), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_diamond_bound, + 'b', + ModItems.blood_infused_pickaxe_iron, + 'c', + ModItems.amorphic_catalyst, + 'd', + masterOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_shovel_diamond), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_diamond_bound, + 'b', + ModItems.blood_infused_shovel_iron, + 'c', + ModItems.amorphic_catalyst, + 'd', + masterOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_infused_sword_diamond), + "aaa", + "aba", + "cdc", + 'a', + ModItems.blood_infused_diamond_bound, + 'b', + ModItems.blood_infused_sword_iron, + 'c', + ModItems.amorphic_catalyst, + 'd', + masterOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.soul_booster), + "aaa", + "aba", + "aca", + 'a', + ModItems.soul_fragment, + 'b', + Blocks.beacon, + 'c', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.soul_nullifier), + "aaa", + "aba", + "aca", + 'a', + ModItems.soul_fragment, + 'b', + WayofTime.alchemicalWizardry.ModItems.armourInhibitor, + 'c', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.sigil_of_swimming), + "aba", + "cdc", + "aea", + 'a', + Items.water_bucket, + 'b', + Items.bucket, + 'c', + Items.lava_bucket, + 'd', + WayofTime.alchemicalWizardry.ModItems.voidSigil, + 'e', + apprenticeOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.sigil_of_ender), + "aba", + "cdc", + "efe", + 'a', + Blocks.obsidian, + 'b', + Items.ender_eye, + 'c', + Items.ender_pearl, + 'd', + imbuedSlate, + 'e', + Blocks.ender_chest, + 'f', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.sigil_of_divinity), + "aba", + "cde", + "fgf", + 'a', + ModBlocks.blood_infused_glowstone, + 'b', + new ItemStack(Items.golden_apple, 1, 1), + 'c', + Items.nether_star, + 'd', + WayofTime.alchemicalWizardry.ModItems.sigilOfElementalAffinity, + 'e', + ModItems.blood_infused_diamond_bound, + 'f', + ModItems.amorphic_catalyst, + 'g', + transcendentOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.blood_burned_string, 4), "aaa", "aba", "aaa", 'a', Items.string, 'b', weakOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.sigil_of_augmented_holding), + "aba", + "cde", + "fgf", + 'a', + demonicSlate, + 'b', + masterOrb, + 'c', + Items.blaze_rod, + 'd', + WayofTime.alchemicalWizardry.ModItems.sigilOfHolding, + 'e', + Items.ghast_tear, + 'f', + ModItems.blood_infused_iron, + 'g', + Blocks.chest); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.sigil_of_lightning), + "aba", + "cdc", + "efg", + 'a', + new ItemStack(ModBlocks.blood_stone, 1, 3), + 'b', + Blocks.iron_block, + 'c', + ModBlocks.blood_infused_iron_block, + 'd', + etherealSlate, + 'e', + Items.nether_star, + 'f', + archmageOrb, + 'g', + ModItems.blood_infused_diamond_bound); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.glass_sacrificial_dagger), + "aaa", + "aba", + "cdc", + 'a', + ModItems.glass_shard, + 'b', + WayofTime.alchemicalWizardry.ModItems.sacrificialDagger, + 'c', + ModItems.blood_infused_iron, + 'd', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.glass_dagger_of_sacrifice), + "aaa", + "aba", + "cdc", + 'a', + ModItems.glass_shard, + 'b', + WayofTime.alchemicalWizardry.ModItems.daggerOfSacrifice, + 'c', + ModItems.blood_infused_iron, + 'd', + magicianOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.glass_helmet), "aaa", "aba", 'a', ModItems.glass_shard, 'b', apprenticeOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.glass_chestplate), + "aba", + "aaa", + "aaa", + 'a', + ModItems.glass_shard, + 'b', + apprenticeOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.glass_leggings), + "aaa", + "aba", + "a a", + 'a', + ModItems.glass_shard, + 'b', + apprenticeOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.glass_boots), "a a", "aba", 'a', ModItems.glass_shard, 'b', apprenticeOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.transparent_orb), + "aba", + "bcb", + "ded", + 'a', + ModBlocks.blood_stained_glass, + 'b', + Blocks.glass, + 'c', + transcendentOrb, + 'd', + ModItems.blood_burned_string, + 'e', + WayofTime.alchemicalWizardry.ModItems.divinationSigil); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.life_imbued_helmet), + "aba", + "aca", + 'a', + ModItems.blood_infused_iron, + 'b', + magicianOrb, + 'c', + Items.iron_helmet); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.life_imbued_chestplate), + "aba", + "aca", + "aaa", + 'a', + ModItems.blood_infused_iron, + 'b', + magicianOrb, + 'c', + Items.iron_chestplate); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.life_imbued_leggings), + "aba", + "aca", + "a a", + 'a', + ModItems.blood_infused_iron, + 'b', + magicianOrb, + 'c', + Items.iron_leggings); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.life_imbued_boots), + "aba", + "aca", + 'a', + ModItems.blood_infused_iron, + 'b', + magicianOrb, + 'c', + Items.iron_boots); addOreDictRecipe(new ItemStack(ModBlocks.blood_stone), "aaa", "aaa", "aaa", 'a', blankSlate); addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 1), "aaa", "aaa", "aaa", 'a', reinforcedSlate); addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 2), "aaa", "aaa", "aaa", 'a', imbuedSlate); addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 3), "aaa", "aaa", "aaa", 'a', demonicSlate); addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 4), "aaa", "aaa", "aaa", 'a', etherealSlate); - addOreDictRecipe(new ItemStack(ModBlocks.blood_infused_iron_block), "aaa", "aaa", "aaa", 'a', ModItems.blood_infused_iron); - addOreDictRecipe(new ItemStack(ModBlocks.blood_stained_ice_packed), "aa", "aa", 'a', ModBlocks.blood_stained_ice); - addOreDictRecipe(new ItemStack(ModBlocks.blood_infused_glowstone), "aa", "aa", 'a', ModItems.blood_infused_glowstone_dust); - addOreDictRecipe(new ItemStack(ModBlocks.blood_lamp), "aba", "bcb", "aba", 'a', ModItems.blood_infused_iron, 'b', ModBlocks.blood_stained_glass, 'c', ModBlocks.blood_infused_glowstone); - addOreDictRecipe(new ItemStack(ModBlocks.blood_infused_diamond_block), "aaa", "aaa", "aaa", 'a', ModItems.blood_infused_diamond_bound); - addOreDictRecipe(new ItemStack(ModBlocks.blood_torch), "a", "b", 'a', ModItems.bound_igniter, 'b', ModItems.blood_infused_stick); + addOreDictRecipe( + new ItemStack(ModBlocks.blood_infused_iron_block), + "aaa", + "aaa", + "aaa", + 'a', + ModItems.blood_infused_iron); + addOreDictRecipe( + new ItemStack(ModBlocks.blood_stained_ice_packed), "aa", "aa", 'a', ModBlocks.blood_stained_ice); + addOreDictRecipe( + new ItemStack(ModBlocks.blood_infused_glowstone), + "aa", + "aa", + 'a', + ModItems.blood_infused_glowstone_dust); + addOreDictRecipe( + new ItemStack(ModBlocks.blood_lamp), + "aba", + "bcb", + "aba", + 'a', + ModItems.blood_infused_iron, + 'b', + ModBlocks.blood_stained_glass, + 'c', + ModBlocks.blood_infused_glowstone); + addOreDictRecipe( + new ItemStack(ModBlocks.blood_infused_diamond_block), + "aaa", + "aaa", + "aaa", + 'a', + ModItems.blood_infused_diamond_bound); + addOreDictRecipe( + new ItemStack(ModBlocks.blood_torch), + "a", + "b", + 'a', + ModItems.bound_igniter, + 'b', + ModItems.blood_infused_stick); addOreDictRecipe(new ItemStack(ModItems.blood_infused_stick), "a", "a", 'a', ModBlocks.blood_infused_planks); - addOreDictRecipe(new ItemStack(ModItems.blood_infused_pickaxe_wood), "aaa", " b ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); - addOreDictRecipe(new ItemStack(ModItems.blood_infused_axe_wood), "aa ", "ab ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); - addOreDictRecipe(new ItemStack(ModItems.blood_infused_shovel_wood), " a ", " b ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); - addOreDictRecipe(new ItemStack(ModItems.blood_infused_sword_wood), " a ", " a ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); - addOreDictRecipe(new ItemStack(ModItems.blood_money, 1, 1), "aa", "aa", 'a', new ItemStack(ModItems.blood_money)); - addOreDictRecipe(new ItemStack(ModItems.blood_money, 1, 2), "aa", "aa", 'a', new ItemStack(ModItems.blood_money, 1, 1)); - addOreDictRecipe(new ItemStack(ModItems.blood_money, 1, 3), "aa", "aa", 'a', new ItemStack(ModItems.blood_money, 1, 2)); + addOreDictRecipe( + new ItemStack(ModItems.blood_infused_pickaxe_wood), + "aaa", + " b ", + " b ", + 'a', + ModBlocks.blood_infused_planks, + 'b', + ModItems.blood_infused_stick); + addOreDictRecipe( + new ItemStack(ModItems.blood_infused_axe_wood), + "aa ", + "ab ", + " b ", + 'a', + ModBlocks.blood_infused_planks, + 'b', + ModItems.blood_infused_stick); + addOreDictRecipe( + new ItemStack(ModItems.blood_infused_shovel_wood), + " a ", + " b ", + " b ", + 'a', + ModBlocks.blood_infused_planks, + 'b', + ModItems.blood_infused_stick); + addOreDictRecipe( + new ItemStack(ModItems.blood_infused_sword_wood), + " a ", + " a ", + " b ", + 'a', + ModBlocks.blood_infused_planks, + 'b', + ModItems.blood_infused_stick); + addOreDictRecipe( + new ItemStack(ModItems.blood_money, 1, 1), "aa", "aa", 'a', new ItemStack(ModItems.blood_money)); + addOreDictRecipe( + new ItemStack(ModItems.blood_money, 1, 2), "aa", "aa", 'a', new ItemStack(ModItems.blood_money, 1, 1)); + addOreDictRecipe( + new ItemStack(ModItems.blood_money, 1, 3), "aa", "aa", 'a', new ItemStack(ModItems.blood_money, 1, 2)); addShapelessOreDictRecipe(new ItemStack(ModBlocks.blood_infused_planks, 4), ModBlocks.blood_infused_wood); - addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.blankSlate, 9), ModBlocks.blood_stone); - addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.reinforcedSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 1)); - addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.imbuedSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 2)); - addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.demonicSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 3)); - addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.baseAlchemyItems, 9, 27), new ItemStack(ModBlocks.blood_stone, 1, 4)); - //This is a long one - addShapelessOreDictRecipe(new ItemStack(ModItems.amorphic_catalyst), WayofTime.alchemicalWizardry.ModItems.blankSlate, WayofTime.alchemicalWizardry.ModItems.aether, WayofTime.alchemicalWizardry.ModItems.terrae, WayofTime.alchemicalWizardry.ModItems.crystallos, WayofTime.alchemicalWizardry.ModItems.sanctus, WayofTime.alchemicalWizardry.ModItems.magicales, WayofTime.alchemicalWizardry.ModItems.crepitous, WayofTime.alchemicalWizardry.ModItems.incendium, WayofTime.alchemicalWizardry.ModItems.aquasalus); + addShapelessOreDictRecipe( + new ItemStack(WayofTime.alchemicalWizardry.ModItems.blankSlate, 9), ModBlocks.blood_stone); + addShapelessOreDictRecipe( + new ItemStack(WayofTime.alchemicalWizardry.ModItems.reinforcedSlate, 9), + new ItemStack(ModBlocks.blood_stone, 1, 1)); + addShapelessOreDictRecipe( + new ItemStack(WayofTime.alchemicalWizardry.ModItems.imbuedSlate, 9), + new ItemStack(ModBlocks.blood_stone, 1, 2)); + addShapelessOreDictRecipe( + new ItemStack(WayofTime.alchemicalWizardry.ModItems.demonicSlate, 9), + new ItemStack(ModBlocks.blood_stone, 1, 3)); + addShapelessOreDictRecipe( + new ItemStack(WayofTime.alchemicalWizardry.ModItems.baseAlchemyItems, 9, 27), + new ItemStack(ModBlocks.blood_stone, 1, 4)); + // This is a long one + addShapelessOreDictRecipe( + new ItemStack(ModItems.amorphic_catalyst), + WayofTime.alchemicalWizardry.ModItems.blankSlate, + WayofTime.alchemicalWizardry.ModItems.aether, + WayofTime.alchemicalWizardry.ModItems.terrae, + WayofTime.alchemicalWizardry.ModItems.crystallos, + WayofTime.alchemicalWizardry.ModItems.sanctus, + WayofTime.alchemicalWizardry.ModItems.magicales, + WayofTime.alchemicalWizardry.ModItems.crepitous, + WayofTime.alchemicalWizardry.ModItems.incendium, + WayofTime.alchemicalWizardry.ModItems.aquasalus); addShapelessOreDictRecipe(new ItemStack(ModItems.blood_infused_iron, 9), ModBlocks.blood_infused_iron_block); addShapelessOreDictRecipe(new ItemStack(ModItems.orange_juice), ModItems.blood_orange, Items.glass_bottle); addShapelessOreDictRecipe(new ItemStack(ModItems.juice_and_cookies), Items.cookie, ModItems.orange_juice); } - public static void addBaublesRecipe() - { + public static void addBaublesRecipe() { int craftingConstant = OreDictionary.WILDCARD_VALUE; ItemStack weakOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.weakBloodOrb, 1, craftingConstant); -// ItemStack apprenticeOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.apprenticeBloodOrb, 1, craftingConstant); -// ItemStack magicianOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.magicianBloodOrb, 1, craftingConstant); + // ItemStack apprenticeOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.apprenticeBloodOrb, 1, + // craftingConstant); + // ItemStack magicianOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.magicianBloodOrb, 1, + // craftingConstant); ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, craftingConstant); -// ItemStack archmageOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.archmageBloodOrb, 1, craftingConstant); -// ItemStack transcendentOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.transcendentBloodOrb, 1, craftingConstant); + // ItemStack archmageOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.archmageBloodOrb, 1, + // craftingConstant); + // ItemStack transcendentOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.transcendentBloodOrb, + // 1, craftingConstant); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.vampire_ring), "ab ", "bcb", " b ", 'a', ModItems.blood_infused_diamond_bound, 'b', Blocks.stone, 'c', masterOrb); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', Items.gold_ingot); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.self_sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', Items.glowstone_dust); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.empowered_self_sacrifice_amulet), "aba", "cdc", "ecf", 'a', ModItems.blood_infused_glowstone_dust, 'b', Items.blaze_rod, 'c', WayofTime.alchemicalWizardry.ModBlocks.runeOfSelfSacrifice, 'd', ModItems.self_sacrifice_amulet, 'e', Blocks.glowstone, 'f', ModItems.amorphic_catalyst); - addOreDictBloodOrbRecipe(new ItemStack(ModItems.empowered_sacrifice_amulet), "aba", "cdc", "ecf", 'a', ModItems.blood_infused_glowstone_dust, 'b', Items.blaze_rod, 'c', WayofTime.alchemicalWizardry.ModBlocks.runeOfSacrifice, 'd', ModItems.sacrifice_amulet, 'e', Blocks.gold_block, 'f', ModItems.amorphic_catalyst); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.vampire_ring), + "ab ", + "bcb", + " b ", + 'a', + ModItems.blood_infused_diamond_bound, + 'b', + Blocks.stone, + 'c', + masterOrb); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.sacrifice_amulet), + "aaa", + "aba", + "caa", + 'a', + ModItems.blood_burned_string, + 'b', + weakOrb, + 'c', + Items.gold_ingot); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.self_sacrifice_amulet), + "aaa", + "aba", + "caa", + 'a', + ModItems.blood_burned_string, + 'b', + weakOrb, + 'c', + Items.glowstone_dust); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.empowered_self_sacrifice_amulet), + "aba", + "cdc", + "ecf", + 'a', + ModItems.blood_infused_glowstone_dust, + 'b', + Items.blaze_rod, + 'c', + WayofTime.alchemicalWizardry.ModBlocks.runeOfSelfSacrifice, + 'd', + ModItems.self_sacrifice_amulet, + 'e', + Blocks.glowstone, + 'f', + ModItems.amorphic_catalyst); + addOreDictBloodOrbRecipe( + new ItemStack(ModItems.empowered_sacrifice_amulet), + "aba", + "cdc", + "ecf", + 'a', + ModItems.blood_infused_glowstone_dust, + 'b', + Items.blaze_rod, + 'c', + WayofTime.alchemicalWizardry.ModBlocks.runeOfSacrifice, + 'd', + ModItems.sacrifice_amulet, + 'e', + Blocks.gold_block, + 'f', + ModItems.amorphic_catalyst); } - public static void addOreDictRecipe(ItemStack output, Object... recipe) - { + public static void addOreDictRecipe(ItemStack output, Object... recipe) { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(output, recipe)); } - public static void addOreDictBloodOrbRecipe(ItemStack output, Object... recipe) - { + public static void addOreDictBloodOrbRecipe(ItemStack output, Object... recipe) { CraftingManager.getInstance().getRecipeList().add(new ShapedBloodOrbRecipe(output, recipe)); } - public static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) - { + public static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) { CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe)); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/CommonProxy.java b/src/main/java/com/arc/bloodarsenal/common/CommonProxy.java index 07b6549..23e3b00 100644 --- a/src/main/java/com/arc/bloodarsenal/common/CommonProxy.java +++ b/src/main/java/com/arc/bloodarsenal/common/CommonProxy.java @@ -5,37 +5,32 @@ import com.arc.bloodarsenal.common.tinkers.IClientCode; import cpw.mods.fml.common.registry.EntityRegistry; import net.minecraft.world.World; -public class CommonProxy -{ - public void init() - { - //registerEntityTrackers(); +public class CommonProxy { + public void init() { + // registerEntityTrackers(); } - public void registerRenders() - { - //Absolutely nothing + public void registerRenders() { + // Absolutely nothing } - public void registerEvents() - { - } + public void registerEvents() {} - public World getClientWorld() - { + public World getClientWorld() { return null; } public static void registerEntityTrackers() { int entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityBloodTNT.class, "bloodTNT", entityID); - EntityRegistry.registerModEntity(EntityBloodTNT.class, "bloodTNT", entityID, BloodArsenal.instance, 64, 100, true); -// EntityRegistry.registerModEntity(EntityBloodHound.class, "BloodHound", 3, BloodArsenal.instance, 96, 3, true); + EntityRegistry.registerModEntity( + EntityBloodTNT.class, "bloodTNT", entityID, BloodArsenal.instance, 64, 100, true); + // EntityRegistry.registerModEntity(EntityBloodHound.class, "BloodHound", 3, BloodArsenal.instance, 96, + // 3, true); } - public void initRendering() - { - //TODO Auto-generated stub + public void initRendering() { + // TODO Auto-generated stub } public void executeClientCode(IClientCode clientCode) {} diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodCake.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodCake.java index 0b45493..0f913ea 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodCake.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodCake.java @@ -6,6 +6,7 @@ import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; 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.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -19,25 +20,22 @@ import squeek.applecore.api.food.FoodValues; import squeek.applecore.api.food.IEdibleBlock; import squeek.applecore.api.food.ItemFoodProxy; -import java.util.Random; - @Optional.Interface(iface = "squeek.applecore.api.food.IEdibleBlock", modid = "AppleCore") -public class BlockBloodCake extends Block implements IEdibleBlock -{ +public class BlockBloodCake extends Block implements IEdibleBlock { private boolean isEdibleAtMaxHunger = false; + @SideOnly(Side.CLIENT) private IIcon cakeTop; + @SideOnly(Side.CLIENT) private IIcon cakeBottom; - public BlockBloodCake() - { + public BlockBloodCake() { super(Material.cake); } @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) - { + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { int l = world.getBlockMetadata(x, y, z); float f = 0.0625F; float f1 = (float) (1 + l) / 12.0F; @@ -45,170 +43,151 @@ public class BlockBloodCake extends Block implements IEdibleBlock } @Override - public void setBlockBoundsForItemRender() - { + public void setBlockBoundsForItemRender() { float f = 0.0625F; float f1 = 0.5F; this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { int l = world.getBlockMetadata(x, y, z); float f = 0.0625F; float f1 = (float) (1 + l) / 12.0F; float f2 = 0.5F; - return AxisAlignedBB.getBoundingBox((double)((float)x + f1), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)((float)y + f2 - f), (double)((float)(z + 1) - f)); + return AxisAlignedBB.getBoundingBox( + (double) ((float) x + f1), + (double) y, + (double) ((float) z + f), + (double) ((float) (x + 1) - f), + (double) ((float) y + f2 - f), + (double) ((float) (z + 1) - f)); } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override @SideOnly(Side.CLIENT) - public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) - { + public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { int l = world.getBlockMetadata(x, y, z); float f = 0.0625F; float f1 = (float) (1 + l) / 12.0F; float f2 = 0.5F; - return AxisAlignedBB.getBoundingBox((double)((float)x + f1), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)((float)y + f2), (double)((float)(z + 1) - f)); + return AxisAlignedBB.getBoundingBox( + (double) ((float) x + f1), + (double) y, + (double) ((float) z + f), + (double) ((float) (x + 1) - f), + (double) ((float) y + f2), + (double) ((float) (z + 1) - f)); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int par1, int x) - { + public IIcon getIcon(int par1, int x) { return par1 == 1 ? cakeTop : (par1 == 0 ? cakeBottom : (x > 0 && par1 == 4 ? null : blockIcon)); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("BloodArsenal:blood_cake_side"); cakeTop = iconRegister.registerIcon("BloodArsenal:blood_cake_top"); cakeBottom = iconRegister.registerIcon("BloodArsenal:blood_cake_bottom"); } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { eatCake(player); return true; } @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) - { + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { eatCake(player); } - public void eatCake(EntityPlayer player) - { + public void eatCake(EntityPlayer player) { String playerEating = player.getCommandSenderName(); - if (player.canEat(isEdibleAtMaxHunger)) - { - if (Loader.isModLoaded("AppleCore")) - { + if (player.canEat(isEdibleAtMaxHunger)) { + if (Loader.isModLoaded("AppleCore")) { onEatenCompatibility(new ItemStack(this), player); - } - else - { + } else { player.getFoodStats().addStats(2, 1.5F); } SoulNetworkHandler.syphonFromNetwork(playerEating, 200); - if (BloodArsenalConfig.cakeIsLie) - { + if (BloodArsenalConfig.cakeIsLie) { player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.cake.lie"))); - } - else - { + } else { player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.cake.eating"))); } - } - else if (player.canEat(true)) - { - if (BloodArsenalConfig.cakeIsLie) - { + } else if (player.canEat(true)) { + if (BloodArsenalConfig.cakeIsLie) { player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.cake.lie"))); - } - else - { + } else { player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.cake.tooFull"))); } } } @Override - public boolean canPlaceBlockAt(World world, int x, int y, int z) - { + public boolean canPlaceBlockAt(World world, int x, int y, int z) { return super.canPlaceBlockAt(world, x, y, z) && canBlockStay(world, x, y, z); } @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { - if (!this.canBlockStay(world, x, y, z)) - { + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + if (!this.canBlockStay(world, x, y, z)) { world.setBlockToAir(x, y, z); } } @Override - public boolean canBlockStay(World world, int x, int y, int z) - { + public boolean canBlockStay(World world, int x, int y, int z) { return world.getBlock(x, y - 1, z).getMaterial().isSolid(); } @Override - public int quantityDropped(Random par1Random) - { + public int quantityDropped(Random par1Random) { return 0; } @Override - public Item getItem(World world, int x, int y, int z) - { + public Item getItem(World world, int x, int y, int z) { return null; } @Override @SideOnly(Side.CLIENT) - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) - { + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { return new ItemStack(this); } // === AppleCore methods === @Override - public void setEdibleAtMaxHunger(boolean edibleAtMaxHunger) - { + public void setEdibleAtMaxHunger(boolean edibleAtMaxHunger) { isEdibleAtMaxHunger = edibleAtMaxHunger; } @Override - public FoodValues getFoodValues(ItemStack itemStack) - { + public FoodValues getFoodValues(ItemStack itemStack) { return new FoodValues(2, 1.5f); } @Optional.Method(modid = "AppleCore") - public void onEatenCompatibility(ItemStack itemStack, EntityPlayer player) - { + public void onEatenCompatibility(ItemStack itemStack, EntityPlayer player) { player.getFoodStats().func_151686_a(new ItemFoodProxy(this), itemStack); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedDiamond.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedDiamond.java index ae1f87a..c999f0e 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedDiamond.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedDiamond.java @@ -4,10 +4,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.IBlockAccess; -public class BlockBloodInfusedDiamond extends Block -{ - public BlockBloodInfusedDiamond() - { +public class BlockBloodInfusedDiamond extends Block { + public BlockBloodInfusedDiamond() { super(Material.iron); setHardness(10.0F); setResistance(12.0F); @@ -15,8 +13,7 @@ public class BlockBloodInfusedDiamond extends Block } @Override - public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) - { + public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedGlowstone.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedGlowstone.java index e116104..b02aa6a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedGlowstone.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedGlowstone.java @@ -1,16 +1,13 @@ package com.arc.bloodarsenal.common.block; import com.arc.bloodarsenal.common.items.ModItems; +import java.util.Random; import net.minecraft.block.BlockGlowstone; import net.minecraft.block.material.Material; import net.minecraft.item.Item; -import java.util.Random; - -public class BlockBloodInfusedGlowstone extends BlockGlowstone -{ - public BlockBloodInfusedGlowstone() - { +public class BlockBloodInfusedGlowstone extends BlockGlowstone { + public BlockBloodInfusedGlowstone() { super(Material.glass); setHardness(0.5F); setResistance(0.75F); @@ -18,5 +15,7 @@ public class BlockBloodInfusedGlowstone extends BlockGlowstone setLightLevel(1.0F); } - public Item getItemDropped(int par1, Random random, int par3) {return ModItems.blood_infused_glowstone_dust;} + public Item getItemDropped(int par1, Random random, int par3) { + return ModItems.blood_infused_glowstone_dust; + } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedPlanks.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedPlanks.java index 16fa6d3..8376a45 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedPlanks.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedPlanks.java @@ -3,10 +3,8 @@ package com.arc.bloodarsenal.common.block; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -public class BlockBloodInfusedPlanks extends Block -{ - public BlockBloodInfusedPlanks() - { +public class BlockBloodInfusedPlanks extends Block { + public BlockBloodInfusedPlanks() { super(Material.wood); setHardness(3.0F); setResistance(6.0F); diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedWood.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedWood.java index 7ea879d..c6b1d30 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedWood.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodInfusedWood.java @@ -7,13 +7,11 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; -public class BlockBloodInfusedWood extends BlockRotatedPillar -{ +public class BlockBloodInfusedWood extends BlockRotatedPillar { @SideOnly(Side.CLIENT) private IIcon top; - public BlockBloodInfusedWood() - { + public BlockBloodInfusedWood() { super(Material.wood); setHardness(3.0F); setResistance(6.0F); @@ -21,20 +19,17 @@ public class BlockBloodInfusedWood extends BlockRotatedPillar } @SideOnly(Side.CLIENT) - public IIcon getSideIcon(int par1) - { + public IIcon getSideIcon(int par1) { return blockIcon; } @SideOnly(Side.CLIENT) - public IIcon getTopIcon(int par1) - { + public IIcon getTopIcon(int par1) { return top; } @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_wood"); top = iconRegister.registerIcon("BloodArsenal:blood_infused_wood_top"); } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodLamp.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodLamp.java index 7b05590..102657b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodLamp.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodLamp.java @@ -3,10 +3,8 @@ package com.arc.bloodarsenal.common.block; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -public class BlockBloodLamp extends Block -{ - public BlockBloodLamp() - { +public class BlockBloodLamp extends Block { + public BlockBloodLamp() { super(Material.iron); setStepSound(soundTypePiston); setHardness(5.0F); diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedGlass.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedGlass.java index 9d907dc..d0fbb97 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedGlass.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedGlass.java @@ -2,16 +2,13 @@ package com.arc.bloodarsenal.common.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.BlockBreakable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import java.util.Random; - -public class BlockBloodStainedGlass extends BlockBreakable -{ - public BlockBloodStainedGlass() - { +public class BlockBloodStainedGlass extends BlockBreakable { + public BlockBloodStainedGlass() { super("blood_stained_glass", Material.glass, false); setHardness(1.0F); setResistance(4.0F); @@ -20,27 +17,28 @@ public class BlockBloodStainedGlass extends BlockBreakable @Override @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return 1; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public int quantityDropped(Random par1Random) {return 0;} + public int quantityDropped(Random par1Random) { + return 0; + } @Override - protected boolean canSilkHarvest() {return true;} + protected boolean canSilkHarvest() { + return true; + } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("BloodArsenal:blood_stained_glass"); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedIce.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedIce.java index 9a9dd0a..05a6f80 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedIce.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedIce.java @@ -2,6 +2,8 @@ package com.arc.bloodarsenal.common.block; 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.BlockBreakable; import net.minecraft.block.material.Material; @@ -16,13 +18,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; -import java.util.ArrayList; -import java.util.Random; - -public class BlockBloodStainedIce extends BlockBreakable -{ - public BlockBloodStainedIce() - { +public class BlockBloodStainedIce extends BlockBreakable { + public BlockBloodStainedIce() { super("blood_stained_ice", Material.ice, false); slipperiness = 0.99F; setTickRandomly(true); @@ -34,39 +31,33 @@ public class BlockBloodStainedIce extends BlockBreakable @Override @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return 1; } @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) - { + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, 1 - par5); } @Override - public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) - { + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1); par2EntityPlayer.addExhaustion(0.025F); - if (canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) - { + if (canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) + && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ArrayList items = new ArrayList(); ItemStack itemstack = createStackedBlock(par6); if (itemstack != null) items.add(itemstack); - ForgeEventFactory.fireBlockHarvesting(items, par1World, this, par3, par4, par5, par6, 0, 1.0f, true, par2EntityPlayer); - for (ItemStack is : items) - dropBlockAsItem(par1World, par3, par4, par5, is); - } - else - { - if (par1World.provider.isHellWorld) - { + ForgeEventFactory.fireBlockHarvesting( + items, par1World, this, par3, par4, par5, par6, 0, 1.0f, true, par2EntityPlayer); + for (ItemStack is : items) dropBlockAsItem(par1World, par3, par4, par5, is); + } else { + if (par1World.provider.isHellWorld) { par1World.setBlockToAir(par3, par4, par5); return; } @@ -77,26 +68,21 @@ public class BlockBloodStainedIce extends BlockBreakable harvesters.set(null); Material material = par1World.getBlock(par3, par4 - 1, par5).getMaterial(); - if (material.blocksMovement() || material.isLiquid()) - { + if (material.blocksMovement() || material.isLiquid()) { par1World.setBlock(par3, par4, par5, Blocks.flowing_water); } } } @Override - public int quantityDropped(Random par1Random) - { + public int quantityDropped(Random par1Random) { return 0; } @Override - public void updateTick(World par1World, int par2, int par3, int par4, Random par5) - { - if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11 - getLightOpacity()) - { - if (par1World.provider.isHellWorld) - { + public void updateTick(World par1World, int par2, int par3, int par4, Random par5) { + if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11 - getLightOpacity()) { + if (par1World.provider.isHellWorld) { par1World.setBlock(par2, par3, par4, Blocks.air); return; } @@ -107,15 +93,13 @@ public class BlockBloodStainedIce extends BlockBreakable } @Override - public int getMobilityFlag() - { + public int getMobilityFlag() { return 0; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("BloodArsenal:blood_stained_ice"); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedPackedIce.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedPackedIce.java index 4a7df24..30060ea 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedPackedIce.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStainedPackedIce.java @@ -1,14 +1,11 @@ package com.arc.bloodarsenal.common.block; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import java.util.Random; - -public class BlockBloodStainedPackedIce extends Block -{ - public BlockBloodStainedPackedIce() - { +public class BlockBloodStainedPackedIce extends Block { + public BlockBloodStainedPackedIce() { super(Material.packedIce); slipperiness = 0.99F; setHardness(1.0F); @@ -16,8 +13,7 @@ public class BlockBloodStainedPackedIce extends Block setStepSound(soundTypeGlass); } - public int quantityDropped(Random par1) - { + public int quantityDropped(Random par1) { return 0; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStone.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStone.java index 3787405..072441a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStone.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodStone.java @@ -2,6 +2,7 @@ package com.arc.bloodarsenal.common.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -10,18 +11,14 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - -public class BlockBloodStone extends Block -{ +public class BlockBloodStone extends Block { private IIcon blood_stone_1; private IIcon blood_stone_2; private IIcon blood_stone_3; private IIcon blood_stone_4; private IIcon blood_stone_5; - public BlockBloodStone() - { + public BlockBloodStone() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -30,8 +27,7 @@ public class BlockBloodStone extends Block @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blood_stone_1 = iconRegister.registerIcon("BloodArsenal:blood_stone_1"); blood_stone_2 = iconRegister.registerIcon("BloodArsenal:blood_stone_2"); blood_stone_3 = iconRegister.registerIcon("BloodArsenal:blood_stone_3"); @@ -41,28 +37,22 @@ public class BlockBloodStone extends Block @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1Item, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.blood_stone)) - { + public void getSubBlocks(Item par1Item, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.blood_stone)) { par3List.add(new ItemStack(par1Item, 1, 0)); par3List.add(new ItemStack(par1Item, 1, 1)); par3List.add(new ItemStack(par1Item, 1, 2)); par3List.add(new ItemStack(par1Item, 1, 3)); par3List.add(new ItemStack(par1Item, 1, 4)); - } - else - { + } else { super.getSubBlocks(par1Item, par2CreativeTabs, par3List); } } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - switch (meta) - { + public IIcon getIcon(int side, int meta) { + switch (meta) { case 0: return blood_stone_1; @@ -84,8 +74,7 @@ public class BlockBloodStone extends Block } @Override - public int damageDropped(int metadata) - { + public int damageDropped(int metadata) { return metadata; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTNT.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTNT.java index 8317887..857518f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTNT.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTNT.java @@ -4,6 +4,7 @@ import com.arc.bloodarsenal.common.entity.EntityBloodTNT; import com.arc.bloodarsenal.common.items.ModItems; 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.BlockTNT; import net.minecraft.client.renderer.texture.IIconRegister; @@ -16,17 +17,14 @@ import net.minecraft.util.IIcon; import net.minecraft.world.Explosion; import net.minecraft.world.World; -import java.util.Random; - -public class BlockBloodTNT extends BlockTNT -{ +public class BlockBloodTNT extends BlockTNT { @SideOnly(Side.CLIENT) private IIcon top; + @SideOnly(Side.CLIENT) private IIcon bottom; - - public BlockBloodTNT() - { + + public BlockBloodTNT() { super(); setHardness(0.0F); setStepSound(soundTypeGrass); @@ -34,63 +32,62 @@ public class BlockBloodTNT extends BlockTNT @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int par1, int par2) - { + public IIcon getIcon(int par1, int par2) { return par1 == 0 ? bottom : (par1 == 1 ? top : blockIcon); } @Override - public void onBlockAdded(World par1World, int par2, int par3, int par4) - { + public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); - if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) - { + if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); par1World.setBlockToAir(par2, par3, par4); } } @Override - public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5Block) - { - if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) - { + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5Block) { + if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) { onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); par1World.setBlockToAir(par2, par3, par4); } } @Override - public int quantityDropped(Random par1Random) - { + public int quantityDropped(Random par1Random) { return 1; } @Override - public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4, Explosion par5Explosion) - { - if (!par1World.isRemote) - { - EntityBloodTNT entitytntprimed = new EntityBloodTNT(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par5Explosion.getExplosivePlacedBy()); + public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4, Explosion par5Explosion) { + if (!par1World.isRemote) { + EntityBloodTNT entitytntprimed = new EntityBloodTNT( + par1World, + (double) ((float) par2 + 0.5F), + (double) ((float) par3 + 0.5F), + (double) ((float) par4 + 0.5F), + par5Explosion.getExplosivePlacedBy()); entitytntprimed.fuse = par1World.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8; par1World.spawnEntityInWorld(entitytntprimed); } } @Override - public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) - { + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) { spawnTNT(par1World, par2, par3, par4, par5, null); } - public void spawnTNT(World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase) - { - if (!par1World.isRemote) - { - if ((par5 & 1) == 1) - { - EntityBloodTNT entitytntprimed = new EntityBloodTNT(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par6EntityLivingBase); + public void spawnTNT( + World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase) { + if (!par1World.isRemote) { + if ((par5 & 1) == 1) { + EntityBloodTNT entitytntprimed = new EntityBloodTNT( + par1World, + (double) ((float) par2 + 0.5F), + (double) ((float) par3 + 0.5F), + (double) ((float) par4 + 0.5F), + par6EntityLivingBase); par1World.spawnEntityInWorld(entitytntprimed); par1World.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); } @@ -98,46 +95,56 @@ public class BlockBloodTNT extends BlockTNT } @Override - public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5, int par6, float par7, float par8, float par9) - { - if (par5.getCurrentEquippedItem() != null && (par5.getCurrentEquippedItem().getItem() == Items.flint_and_steel || par5.getCurrentEquippedItem().getItem() == ModItems.bound_igniter)) - { + public boolean onBlockActivated( + World par1World, + int par2, + int par3, + int par4, + EntityPlayer par5, + int par6, + float par7, + float par8, + float par9) { + if (par5.getCurrentEquippedItem() != null + && (par5.getCurrentEquippedItem().getItem() == Items.flint_and_steel + || par5.getCurrentEquippedItem().getItem() == ModItems.bound_igniter)) { spawnTNT(par1World, par2, par3, par4, 1, par5); par1World.setBlockToAir(par2, par3, par4); par5.getCurrentEquippedItem().damageItem(1, par5); return true; - } - else - { + } else { return super.onBlockActivated(par1World, par2, par3, par4, par5, par6, par7, par8, par9); } } @Override - public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) - { - if (par5Entity instanceof EntityArrow && !par1World.isRemote) - { - EntityArrow entityarrow = (EntityArrow)par5Entity; + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { + if (par5Entity instanceof EntityArrow && !par1World.isRemote) { + EntityArrow entityarrow = (EntityArrow) par5Entity; - if (entityarrow.isBurning()) - { - spawnTNT(par1World, par2, par3, par4, 1, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)entityarrow.shootingEntity : null); + if (entityarrow.isBurning()) { + spawnTNT( + par1World, + par2, + par3, + par4, + 1, + entityarrow.shootingEntity instanceof EntityLivingBase + ? (EntityLivingBase) entityarrow.shootingEntity + : null); par1World.setBlockToAir(par2, par3, par4); } } } @Override - public boolean canDropFromExplosion(Explosion par1Explosion) - { + public boolean canDropFromExplosion(Explosion par1Explosion) { return false; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("BloodArsenal:blood_tnt_side"); top = iconRegister.registerIcon("BloodArsenal:blood_tnt_top"); bottom = iconRegister.registerIcon("BloodArsenal:blood_tnt_bottom"); diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTorch.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTorch.java index f822877..9d33547 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTorch.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBloodTorch.java @@ -2,10 +2,8 @@ package com.arc.bloodarsenal.common.block; import net.minecraft.block.BlockTorch; -public class BlockBloodTorch extends BlockTorch -{ - public BlockBloodTorch() - { +public class BlockBloodTorch extends BlockTorch { + public BlockBloodTorch() { super(); setHardness(0.0F); setLightLevel(0.9375F); diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockBurnedString.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockBurnedString.java index b68f3c1..19daafd 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockBurnedString.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockBurnedString.java @@ -3,6 +3,9 @@ package com.arc.bloodarsenal.common.block; import com.arc.bloodarsenal.common.items.ModItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -15,143 +18,129 @@ import net.minecraft.util.Direction; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public class BlockBurnedString extends Block -{ - public BlockBurnedString() - { +public class BlockBurnedString extends Block { + public BlockBurnedString() { super(Material.circuits); setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F); setTickRandomly(true); } @Override - public int tickRate(World p_149738_1_) - { + public int tickRate(World p_149738_1_) { return 10; } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { + public AxisAlignedBB getCollisionBoundingBoxFromPool( + World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return 1; } @Override - public int getRenderType() - { + public int getRenderType() { return 30; } @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return ModItems.blood_burned_string; } @Override - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) - { + public void setBlockBoundsBasedOnState( + IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { int l = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_); boolean flag = (l & 4) == 4; boolean flag1 = (l & 2) == 2; - if (!flag1) - { + if (!flag1) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.09375F, 1.0F); - } - else if (!flag) - { + } else if (!flag) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); - } - else - { + } else { this.setBlockBounds(0.0F, 0.0625F, 0.0F, 1.0F, 0.15625F, 1.0F); } } @Override @SideOnly(Side.CLIENT) - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) - { + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return ModItems.blood_burned_string; } @Override - public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) - { + public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { int l = World.doesBlockHaveSolidTopSurface(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_) ? 0 : 2; p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, l, 3); this.func_150138_a(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, l); } @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { + public void breakBlock( + World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { this.func_150138_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_6_ | 1); } @Override - public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) - { - if (!p_149681_1_.isRemote) - { - if (p_149681_6_.getCurrentEquippedItem() != null && p_149681_6_.getCurrentEquippedItem().getItem() == Items.shears) - { + public void onBlockHarvested( + World p_149681_1_, + int p_149681_2_, + int p_149681_3_, + int p_149681_4_, + int p_149681_5_, + EntityPlayer p_149681_6_) { + if (!p_149681_1_.isRemote) { + if (p_149681_6_.getCurrentEquippedItem() != null + && p_149681_6_.getCurrentEquippedItem().getItem() == Items.shears) { p_149681_1_.setBlockMetadataWithNotify(p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_ | 8, 4); } } } - private void func_150138_a(World p_150138_1_, int p_150138_2_, int p_150138_3_, int p_150138_4_, int p_150138_5_) - { + private void func_150138_a(World p_150138_1_, int p_150138_2_, int p_150138_3_, int p_150138_4_, int p_150138_5_) { int i1 = 0; - while (i1 < 2) - { + while (i1 < 2) { int j1 = 1; - while (true) - { - if (j1 < 42) - { + while (true) { + if (j1 < 42) { int k1 = p_150138_2_ + Direction.offsetX[i1] * j1; int l1 = p_150138_4_ + Direction.offsetZ[i1] * j1; Block block = p_150138_1_.getBlock(k1, p_150138_3_, l1); - if (block == Blocks.tripwire_hook) - { + if (block == Blocks.tripwire_hook) { int i2 = p_150138_1_.getBlockMetadata(k1, p_150138_3_, l1) & 3; - if (i2 == Direction.rotateOpposite[i1]) - { - Blocks.tripwire_hook.func_150136_a(p_150138_1_, k1, p_150138_3_, l1, false, p_150138_1_.getBlockMetadata(k1, p_150138_3_, l1), true, j1, p_150138_5_); + if (i2 == Direction.rotateOpposite[i1]) { + Blocks.tripwire_hook.func_150136_a( + p_150138_1_, + k1, + p_150138_3_, + l1, + false, + p_150138_1_.getBlockMetadata(k1, p_150138_3_, l1), + true, + j1, + p_150138_5_); } - } - else if (block == Blocks.tripwire) - { + } else if (block == Blocks.tripwire) { ++j1; continue; } @@ -164,12 +153,10 @@ public class BlockBurnedString extends Block } @Override - public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) - { - if (!p_149670_1_.isRemote) - { - if ((p_149670_1_.getBlockMetadata(p_149670_2_, p_149670_3_, p_149670_4_) & 1) != 1) - { + public void onEntityCollidedWithBlock( + World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) { + if (!p_149670_1_.isRemote) { + if ((p_149670_1_.getBlockMetadata(p_149670_2_, p_149670_3_, p_149670_4_) & 1) != 1) { this.func_150140_e(p_149670_1_, p_149670_2_, p_149670_3_, p_149670_4_); } @@ -177,85 +164,82 @@ public class BlockBurnedString extends Block } } - public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) - { - if (!p_149674_1_.isRemote) - { - if ((p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_) & 1) == 1) - { + public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { + if (!p_149674_1_.isRemote) { + if ((p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_) & 1) == 1) { this.func_150140_e(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); } } } - private void func_150140_e(World p_150140_1_, int p_150140_2_, int p_150140_3_, int p_150140_4_) - { + private void func_150140_e(World p_150140_1_, int p_150140_2_, int p_150140_3_, int p_150140_4_) { int l = p_150140_1_.getBlockMetadata(p_150140_2_, p_150140_3_, p_150140_4_); boolean flag = (l & 1) == 1; boolean flag1 = false; - List list = p_150140_1_.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBox((double)p_150140_2_ + this.minX, (double)p_150140_3_ + this.minY, (double)p_150140_4_ + this.minZ, (double)p_150140_2_ + this.maxX, (double)p_150140_3_ + this.maxY, (double)p_150140_4_ + this.maxZ)); + List list = p_150140_1_.getEntitiesWithinAABBExcludingEntity( + (Entity) null, + AxisAlignedBB.getBoundingBox( + (double) p_150140_2_ + this.minX, + (double) p_150140_3_ + this.minY, + (double) p_150140_4_ + this.minZ, + (double) p_150140_2_ + this.maxX, + (double) p_150140_3_ + this.maxY, + (double) p_150140_4_ + this.maxZ)); - if (!list.isEmpty()) - { + if (!list.isEmpty()) { Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { - Entity entity = (Entity)iterator.next(); + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); - if (!entity.doesEntityNotTriggerPressurePlate()) - { + if (!entity.doesEntityNotTriggerPressurePlate()) { flag1 = true; break; } } } - if (flag1 && !flag) - { + if (flag1 && !flag) { l |= 1; } - if (!flag1 && flag) - { + if (!flag1 && flag) { l &= -2; } - if (flag1 != flag) - { + if (flag1 != flag) { p_150140_1_.setBlockMetadataWithNotify(p_150140_2_, p_150140_3_, p_150140_4_, l, 3); this.func_150138_a(p_150140_1_, p_150140_2_, p_150140_3_, p_150140_4_, l); } - if (flag1) - { + if (flag1) { p_150140_1_.scheduleBlockUpdate(p_150140_2_, p_150140_3_, p_150140_4_, this, this.tickRate(p_150140_1_)); } } @SideOnly(Side.CLIENT) - public static boolean func_150139_a(IBlockAccess p_150139_0_, int p_150139_1_, int p_150139_2_, int p_150139_3_, int p_150139_4_, int p_150139_5_) - { + public static boolean func_150139_a( + IBlockAccess p_150139_0_, + int p_150139_1_, + int p_150139_2_, + int p_150139_3_, + int p_150139_4_, + int p_150139_5_) { int j1 = p_150139_1_ + Direction.offsetX[p_150139_5_]; int k1 = p_150139_3_ + Direction.offsetZ[p_150139_5_]; Block block = p_150139_0_.getBlock(j1, p_150139_2_, k1); boolean flag = (p_150139_4_ & 2) == 2; int l1; - if (block == Blocks.tripwire_hook) - { + if (block == Blocks.tripwire_hook) { l1 = p_150139_0_.getBlockMetadata(j1, p_150139_2_, k1); int i2 = l1 & 3; return i2 == Direction.rotateOpposite[p_150139_5_]; - } - else if (block == Blocks.tripwire) - { + } else if (block == Blocks.tripwire) { l1 = p_150139_0_.getBlockMetadata(j1, p_150139_2_, k1); boolean flag1 = (l1 & 2) == 2; return flag == flag1; - } - else - { + } else { return false; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockCompactedMRS.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockCompactedMRS.java index d7eeaa9..87e37f2 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockCompactedMRS.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockCompactedMRS.java @@ -6,6 +6,8 @@ import WayofTime.alchemicalWizardry.common.items.ActivationCrystal; import com.arc.bloodarsenal.common.tileentity.TileCompactedMRS; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -19,13 +21,8 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class BlockCompactedMRS extends BlockMasterStone -{ - public BlockCompactedMRS() - { +public class BlockCompactedMRS extends BlockMasterStone { + public BlockCompactedMRS() { super(); setBlockName("compacted_mrs"); setHardness(4.0F); @@ -34,21 +31,17 @@ public class BlockCompactedMRS extends BlockMasterStone @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("BloodArsenal:compacted_mrs"); } @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.compacted_mrs)) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.compacted_mrs)) { par3List.add(new ItemStack(par1, 1, 0)); - for (String ritualName : Rituals.keyList) - { + for (String ritualName : Rituals.keyList) { ItemStack stack = new ItemStack(par1, 1, 0); NBTTagCompound tag = new NBTTagCompound(); TileCompactedMRS tile = new TileCompactedMRS(); @@ -57,8 +50,7 @@ public class BlockCompactedMRS extends BlockMasterStone NBTTagCompound savedTag = new NBTTagCompound(); - if (tile != null) - { + if (tile != null) { tile.writeToNBT(savedTag); } @@ -70,41 +62,33 @@ public class BlockCompactedMRS extends BlockMasterStone par3List.add(stack); } - } - else - { + } else { super.getSubBlocks(par1, par2CreativeTabs, par3List); } } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) { TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileCompactedMRS) - { + if (tile instanceof TileCompactedMRS) { NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) - { + if (tag != null) { ((TileCompactedMRS) tile).readNBTOnPlace(tag); } } } @Override - public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) - { + public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) { TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileCompactedMRS) - { + if (tile instanceof TileCompactedMRS) { ((TileCompactedMRS) tile).useOnRitualBroken(); } - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { dropBlockAsItem(world, x, y, z, meta, 0); } @@ -112,14 +96,12 @@ public class BlockCompactedMRS extends BlockMasterStone } @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 list = new ArrayList(); TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileCompactedMRS) - { + if (tile instanceof TileCompactedMRS) { ItemStack drop = new ItemStack(this); NBTTagCompound tag = new NBTTagCompound(); ((TileCompactedMRS) tile).writeNBTOnHarvest(tag); @@ -132,67 +114,58 @@ public class BlockCompactedMRS extends BlockMasterStone } @Override - public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) - { + public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) { super.onBlockDestroyedByExplosion(world, x, y, z, explosion); TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileCompactedMRS) - { + if (tile instanceof TileCompactedMRS) { ((TileCompactedMRS) tile).useOnRitualBrokenExplosion(); } } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { TileCompactedMRS tileEntity = (TileCompactedMRS) world.getTileEntity(x, y, z); - if (tileEntity != null) - { + if (tileEntity != null) { ItemStack playerItem = player.getCurrentEquippedItem(); - if (playerItem == null) - { + if (playerItem == null) { return false; - } - else - { + } else { Item item = playerItem.getItem(); - if (!(item instanceof ActivationCrystal)) - { + if (!(item instanceof ActivationCrystal)) { return false; - } - else - { + } else { ActivationCrystal acItem = (ActivationCrystal) item; - tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, ActivationCrystal.getOwnerName(playerItem)); + tileEntity.activateRitual( + world, + acItem.getCrystalLevel(playerItem), + playerItem, + player, + ActivationCrystal.getOwnerName(playerItem)); world.markBlockForUpdate(x, y, z); return true; } } - } - else - { + } else { return false; } } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) - { + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { Item item = getItem(world, x, y, z); - if (item == null) - { + if (item == null) { return null; } TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileCompactedMRS) - { + if (tile instanceof TileCompactedMRS) { ItemStack drop = new ItemStack(this); NBTTagCompound tag = new NBTTagCompound(); ((TileCompactedMRS) tile).writeNBTOnHarvest(tag); @@ -204,8 +177,7 @@ public class BlockCompactedMRS extends BlockMasterStone } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TileCompactedMRS(); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockCompacter.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockCompacter.java index 4df6a59..e65602f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockCompacter.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockCompacter.java @@ -16,6 +16,7 @@ import com.arc.bloodarsenal.common.tileentity.TileCompacter; import com.arc.bloodarsenal.common.tileentity.TilePortableAltar; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -31,10 +32,7 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidContainerRegistry; -import java.util.List; - -public class BlockCompacter extends BlockContainer -{ +public class BlockCompacter extends BlockContainer { private String ritualName; private int direction; @@ -62,11 +60,11 @@ public class BlockCompacter extends BlockContainer @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon; - public BlockCompacter() - { + public BlockCompacter() { super(Material.iron); setHardness(8.0F); setResistance(5.0F); @@ -74,33 +72,25 @@ public class BlockCompacter extends BlockContainer } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { world.markBlockForUpdate(x, y, z); TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity != null && !player.isSneaking()) - { + if (tileEntity != null && !player.isSneaking()) { ItemStack playerItem = player.getCurrentEquippedItem(); - if (playerItem == null) - { + if (playerItem == null) { return false; - } - else - { + } else { Item item = playerItem.getItem(); - if (!(item instanceof IBloodOrb)) - { + if (!(item instanceof IBloodOrb)) { return false; - } - else - { + } else { Block block = world.getBlock(x, y + 1, z); - if (block != null) - { + if (block != null) { TileEntity tile; world.markBlockForUpdate(x, y, z); @@ -109,28 +99,22 @@ public class BlockCompacter extends BlockContainer String owner = player.getCommandSenderName(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); - if (block instanceof BlockMasterStone) - { + if (block instanceof BlockMasterStone) { tile = world.getTileEntity(x, y + 1, z); checkRitual(tile); List ritualList = Rituals.getRitualList(ritualName); - if (ritualList == null) - { + if (ritualList == null) { return false; - } - else - { + } else { float multiplier = 1; - for (RitualComponent ritualComponent : ritualList) - { + for (RitualComponent ritualComponent : ritualList) { int stoneType = ritualComponent.getStoneType(); - switch (stoneType) - { + switch (stoneType) { case 0: break; @@ -157,43 +141,37 @@ public class BlockCompacter extends BlockContainer } int activationCost = Rituals.getCostForActivation(ritualName); - int cost = (activationCost * (int) multiplier) / 2; //Divided by 2 since this fires twice apparently and also because I'm nice + int cost = (activationCost * (int) multiplier) + / 2; // Divided by 2 since this fires twice apparently and also because I'm nice - if (cost <= currentEssence) - { + if (cost <= currentEssence) { compactRitual(tile); SoulNetworkHandler.syphonFromNetwork(owner, cost); --player.inventory.getCurrentItem().stackSize; - } - else - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.notEnoughLP"))); + } else { + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.compacter.notEnoughLP"))); return true; } } return true; - } - else if (block instanceof BlockAltar && world.getTileEntity(x, y + 1, z) != null) - { + } else if (block instanceof BlockAltar && world.getTileEntity(x, y + 1, z) != null) { tile = world.getTileEntity(x, y + 1, z); TEAltar altar = (TEAltar) tile; checkAltar(altar); - if (tier == 0) - { + if (tier == 0) { return false; - } - else if (altar.getStackInSlot(0) != null) - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.itemInAltar"))); - } - else - { + } else if (altar.getStackInSlot(0) != null) { + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.compacter.itemInAltar"))); + } else { float multiplier = 1; - AltarUpgradeComponent upgradeComponent = UpgradedAltars.getUpgrades(world, x, y + 1, z, tier); + AltarUpgradeComponent upgradeComponent = + UpgradedAltars.getUpgrades(world, x, y + 1, z, tier); int speedUpgrades = upgradeComponent.getSpeedUpgrades(); int efficiencyUpgrades = upgradeComponent.getEfficiencyUpgrades(); @@ -217,24 +195,20 @@ public class BlockCompacter extends BlockContainer IBloodOrb bloodOrb = (IBloodOrb) item; - if (bloodOrb.getOrbLevel() >= tier) - { + if (bloodOrb.getOrbLevel() >= tier) { int cost = ((tier * 10) * (int) (multiplier * 5)) + capacity; - if (cost <= currentEssence) - { + if (cost <= currentEssence) { compactAltar(tile); SoulNetworkHandler.syphonFromNetwork(owner, cost); --player.inventory.getCurrentItem().stackSize; + } else { + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.compacter.notEnoughLP"))); } - else - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.notEnoughLP"))); - } - } - else - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.compacter.wrongOrbTier"))); + } else { + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.compacter.wrongOrbTier"))); } } @@ -245,37 +219,31 @@ public class BlockCompacter extends BlockContainer return true; } } - } - else - { + } else { return false; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { return side == 1 ? this.topIcon : (side == 0 ? this.blockIcon : this.sideIcon); } @Override @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() + "_bottom"); this.topIcon = p_149651_1_.registerIcon(this.getTextureName() + "_top"); this.sideIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side"); } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TileCompacter(); } - private void checkRitual(TileEntity tileEntity) - { + private void checkRitual(TileEntity tileEntity) { TEMasterStone masterStone = (TEMasterStone) tileEntity; World world = masterStone.getWorld(); int x = masterStone.xCoord; @@ -284,12 +252,9 @@ public class BlockCompacter extends BlockContainer ritualName = Rituals.checkValidRitual(world, x, y, z); - if (ritualName.equals("")) - { + if (ritualName.equals("")) { return; - } - else - { + } else { direction = Rituals.getDirectionOfRitual(world, x, y, z, ritualName); } @@ -297,8 +262,7 @@ public class BlockCompacter extends BlockContainer world.markBlockForUpdate(x, y + 1, z); } - private void compactRitual(TileEntity tileEntity) - { + private void compactRitual(TileEntity tileEntity) { TEMasterStone masterStone = (TEMasterStone) tileEntity; World world = masterStone.getWorld(); int x = masterStone.xCoord; @@ -307,16 +271,20 @@ public class BlockCompacter extends BlockContainer List ritualList = Rituals.getRitualList(ritualName); - if (ritualList == null) - { + if (ritualList == null) { return; } - for (RitualComponent ritualComponent : ritualList) - { - world.setBlockToAir(x + ritualComponent.getX(direction), y + ritualComponent.getY(), z + ritualComponent.getZ(direction)); + for (RitualComponent ritualComponent : ritualList) { + world.setBlockToAir( + x + ritualComponent.getX(direction), + y + ritualComponent.getY(), + z + ritualComponent.getZ(direction)); world.setBlockToAir(x, y, z); - world.markBlockForUpdate(x + ritualComponent.getX(direction), y + ritualComponent.getY(), z + ritualComponent.getZ(direction)); + world.markBlockForUpdate( + x + ritualComponent.getX(direction), + y + ritualComponent.getY(), + z + ritualComponent.getZ(direction)); } world.setBlock(x, y, z, ModBlocks.compacted_mrs); @@ -325,12 +293,9 @@ public class BlockCompacter extends BlockContainer world.markBlockForUpdate(x, y, z); } - private void configureMRS(World world, int x, int y, int z, Block block) - { - if (block instanceof BlockCompactedMRS) - { - if (world.getBlock(x, y, z) == block) - { + private void configureMRS(World world, int x, int y, int z, Block block) { + if (block instanceof BlockCompactedMRS) { + if (world.getBlock(x, y, z) == block) { TileCompactedMRS tile = (TileCompactedMRS) world.getTileEntity(x, y, z); tile.setRitualName(ritualName); @@ -340,23 +305,20 @@ public class BlockCompacter extends BlockContainer } } - private void checkAltar(TEAltar altar) - { + private void checkAltar(TEAltar altar) { World world = altar.getWorldObj(); int x = altar.xCoord; int y = altar.yCoord; int z = altar.zCoord; tier = altar.getTier(); - if (tier == 0) - { + if (tier == 0) { return; } AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(world, x, y, z, tier); - if (upgrades == null) - { + if (upgrades == null) { this.consumptionMultiplier = 0; this.efficiencyMultiplier = 1; this.sacrificeEfficiencyMultiplier = 0; @@ -373,7 +335,8 @@ public class BlockCompacter extends BlockContainer efficiencyMultiplier = (float) Math.pow(0.80, upgrades.getSpeedUpgrades()); sacrificeEfficiencyMultiplier = (float) (0.12 * upgrades.getSacrificeUpgrades()); selfSacrificeEfficiencyMultiplier = (float) (0.12 * upgrades.getSelfSacrificeUpgrades()); - capacityMultiplier = (float) ((1 * Math.pow(1.14, upgrades.getBetterCapacitiveUpgrades()) + 0.20 * upgrades.getAltarCapacitiveUpgrades())); + capacityMultiplier = (float) ((1 * Math.pow(1.14, upgrades.getBetterCapacitiveUpgrades()) + + 0.20 * upgrades.getAltarCapacitiveUpgrades())); dislocationMultiplier = (float) (Math.pow(1.5, upgrades.getDisplacementUpgrades())); orbCapacityMultiplier = (float) (1 + 0.04 * upgrades.getOrbCapacitiveUpgrades()); capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier); @@ -393,8 +356,7 @@ public class BlockCompacter extends BlockContainer world.markBlockForUpdate(x, y - 1, z); } - private void compactAltar(TileEntity tileEntity) - { + private void compactAltar(TileEntity tileEntity) { TEAltar altar = (TEAltar) tileEntity; World world = altar.getWorldObj(); int x = altar.xCoord; @@ -403,13 +365,12 @@ public class BlockCompacter extends BlockContainer List altarComponents = UpgradedAltars.getAltarUpgradeListForTier(tier); - if (altarComponents != null && !world.isRemote) - { - for (AltarComponent altarComponent : altarComponents) - { + if (altarComponents != null && !world.isRemote) { + for (AltarComponent altarComponent : altarComponents) { world.setBlockToAir(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); world.setBlockToAir(x, y, z); - world.markBlockForUpdate(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); + world.markBlockForUpdate( + x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); } } @@ -420,12 +381,9 @@ public class BlockCompacter extends BlockContainer world.markBlockForUpdate(x, y - 1, z); } - private void configureAltar(World world, int x, int y, int z, Block block) - { - if (block instanceof BlockPortableAltar) - { - if (world.getBlock(x, y, z) == block) - { + private void configureAltar(World world, int x, int y, int z, Block block) { + if (block instanceof BlockPortableAltar) { + if (world.getBlock(x, y, z) == block) { TilePortableAltar altar = (TilePortableAltar) world.getTileEntity(x, y, z); altar.setTier(tier); @@ -439,7 +397,16 @@ public class BlockCompacter extends BlockContainer altar.setCapacityMultiplier(capacityMultiplier); altar.setCapacity(capacity); altar.setBufferCapacity(bufferCapacity); - altar.setUpgrades(speedUpgrades, efficiencyUpgrades, sacrificeUpgrades, selfSacrificeUpgrades, displacementUpgrades, altarCapacitiveUpgrades, orbCapacitiveUpgrades, betterCapacitiveUpgrades, accelerationUpgrades); + altar.setUpgrades( + speedUpgrades, + efficiencyUpgrades, + sacrificeUpgrades, + selfSacrificeUpgrades, + displacementUpgrades, + altarCapacitiveUpgrades, + orbCapacitiveUpgrades, + betterCapacitiveUpgrades, + accelerationUpgrades); world.markBlockForUpdate(x, y, z); diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockInfusedIron.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockInfusedIron.java index b981ae1..f6b9f05 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockInfusedIron.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockInfusedIron.java @@ -4,10 +4,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.IBlockAccess; -public class BlockInfusedIron extends Block -{ - public BlockInfusedIron() - { +public class BlockInfusedIron extends Block { + public BlockInfusedIron() { super(Material.iron); setHardness(7.5F); setResistance(5.0F); @@ -15,8 +13,7 @@ public class BlockInfusedIron extends Block } @Override - public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) - { + public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockLPMaterializer.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockLPMaterializer.java index 1095cb0..75cdc6b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockLPMaterializer.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockLPMaterializer.java @@ -1,7 +1,12 @@ package com.arc.bloodarsenal.common.block; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; +import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding; +import com.arc.bloodarsenal.common.tileentity.TileLPMaterializer; +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,24 +22,15 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidContainerRegistry; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; -import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding; -import com.arc.bloodarsenal.common.tileentity.TileLPMaterializer; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BlockLPMaterializer extends BlockContainer -{ +public class BlockLPMaterializer extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon output; + @SideOnly(Side.CLIENT) private IIcon side; - public BlockLPMaterializer() - { + public BlockLPMaterializer() { super(Material.iron); setHardness(7.0F); setResistance(14.0F); @@ -42,107 +38,84 @@ public class BlockLPMaterializer extends BlockContainer @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int par1, int par2) - { + public IIcon getIcon(int par1, int par2) { return par1 == 0 || par1 == 1 ? output : side; } @Override @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return 1; } @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess blockSide, int x, int y, int z, int side) - { + public boolean shouldSideBeRendered(IBlockAccess blockSide, int x, int y, int z, int side) { return true; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("BloodArsenal:lp_materializer_output"); output = iconRegister.registerIcon("BloodArsenal:lp_materializer_output"); side = iconRegister.registerIcon("BloodArsenal:lp_materializer_side"); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { TileLPMaterializer tileEntity = (TileLPMaterializer) world.getTileEntity(x, y, z); - if (tileEntity == null) - { + if (tileEntity == null) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); - if (playerItem != null)// <-- + if (playerItem != null) // <-- { - if (playerItem.getItem().equals(ModItems.divinationSigil)) - { - if (player.worldObj.isRemote) - { + if (playerItem.getItem().equals(ModItems.divinationSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendChatInfoToPlayer(player); } return true; - } - else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) - { + } else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) { ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentSigil(playerItem); - if (item != null && item.getItem().equals(ModItems.divinationSigil)) - { - if (player.worldObj.isRemote) - { + if (item != null && item.getItem().equals(ModItems.divinationSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendChatInfoToPlayer(player); } return true; } - } - else if (playerItem.getItem() == Items.bucket) - { - if (tileEntity.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME) - { + } else if (playerItem.getItem() == Items.bucket) { + if (tileEntity.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME) { --playerItem.stackSize; player.inventory.addItemStackToInventory(new ItemStack(ModItems.bucketLife)); tileEntity.drain(FluidContainerRegistry.BUCKET_VOLUME, true); } } - if (tileEntity.getStackInSlot(0) == null && playerItem.getItem() instanceof IBloodOrb) - { + if (tileEntity.getStackInSlot(0) == null && playerItem.getItem() instanceof IBloodOrb) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(0, newItem); } - } - else if (player.isSneaking()) - { - if (tileEntity.getStackInSlot(0) != null) - { + } else if (player.isSneaking()) { + if (tileEntity.getStackInSlot(0) != null) { ItemStack newItem = tileEntity.getStackInSlot(0).copy(); newItem.stackSize = 1; player.inventory.addItemStackToInventory(newItem); @@ -154,38 +127,38 @@ public class BlockLPMaterializer extends BlockContainer } @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) - { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { dropItems(world, x, y, z); super.breakBlock(world, x, y, z, par5, par6); } - private void dropItems(World world, int x, int y, int z) - { + private void dropItems(World world, int x, int y, int z) { Random rand = new Random(); TileEntity tileEntity = world.getTileEntity(x, y, z); - if (!(tileEntity instanceof IInventory)) - { + if (!(tileEntity instanceof IInventory)) { return; } IInventory inventory = (IInventory) tileEntity; - for (int i = 0; i < inventory.getSizeInventory(); i++) - { + for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack item = inventory.getStackInSlot(i); - if (item != null && item.stackSize > 0) - { + if (item != null && item.stackSize > 0) { float rx = rand.nextFloat() * 0.8F + 0.1F; float ry = rand.nextFloat() * 0.8F + 0.1F; float rz = rand.nextFloat() * 0.8F + 0.1F; - EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); + EntityItem entityItem = new EntityItem( + world, + x + rx, + y + ry, + z + rz, + new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); - if (item.hasTagCompound()) - { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + if (item.hasTagCompound()) { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) + item.getTagCompound().copy()); } float factor = 0.05F; @@ -199,14 +172,12 @@ public class BlockLPMaterializer extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TileLPMaterializer(); } @Override - public boolean hasTileEntity() - { + public boolean hasTileEntity() { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockLifeInfuser.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockLifeInfuser.java index 9f958fb..ffd8a35 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockLifeInfuser.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockLifeInfuser.java @@ -1,7 +1,9 @@ package com.arc.bloodarsenal.common.block; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding; +import com.arc.bloodarsenal.common.tileentity.TileLifeInfuser; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -14,15 +16,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidContainerRegistry; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding; -import com.arc.bloodarsenal.common.tileentity.TileLifeInfuser; - -public class BlockLifeInfuser extends BlockContainer -{ - public BlockLifeInfuser() - { +public class BlockLifeInfuser extends BlockContainer { + public BlockLifeInfuser() { super(Material.iron); setHardness(6.0F); setResistance(12.0F); @@ -32,73 +28,55 @@ public class BlockLifeInfuser extends BlockContainer } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { TileLifeInfuser tileEntity = (TileLifeInfuser) world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) - { + if (tileEntity == null || player.isSneaking()) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); ItemStack bucket = new ItemStack(Items.bucket); - if (playerItem != null)// <-- + if (playerItem != null) // <-- { - if (playerItem.getItem().equals(ModItems.divinationSigil) || playerItem.getItem().equals(ModItems.itemSeerSigil)) - { - if (player.worldObj.isRemote) - { + if (playerItem.getItem().equals(ModItems.divinationSigil) + || playerItem.getItem().equals(ModItems.itemSeerSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendChatInfoToPlayer(player); } return true; - } - else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) - { + } else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) { ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentSigil(playerItem); - if (item != null && item.getItem().equals(ModItems.divinationSigil)) - { - if (player.worldObj.isRemote) - { + if (item != null && item.getItem().equals(ModItems.divinationSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendChatInfoToPlayer(player); } return true; } - } - else if (playerItem.getItem().equals(ModItems.bucketLife)) - { - if (tileEntity.getFluid().amount <= tileEntity.capacity - FluidContainerRegistry.BUCKET_VOLUME) - { - if (!player.capabilities.isCreativeMode) - { + } else if (playerItem.getItem().equals(ModItems.bucketLife)) { + if (tileEntity.getFluid().amount <= tileEntity.capacity - FluidContainerRegistry.BUCKET_VOLUME) { + if (!player.capabilities.isCreativeMode) { --playerItem.stackSize; player.inventory.addItemStackToInventory(bucket); } tileEntity.fillMainTank(FluidContainerRegistry.BUCKET_VOLUME); } - } - else if (tileEntity.getStackInSlot(0) == null) - { + } else if (tileEntity.getStackInSlot(0) == null) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(0, newItem); } - } - else if (tileEntity.getStackInSlot(0) != null && playerItem == null) - { + } else if (tileEntity.getStackInSlot(0) != null && playerItem == null) { player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); tileEntity.setInventorySlotContents(0, null); } @@ -107,38 +85,38 @@ public class BlockLifeInfuser extends BlockContainer } @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) - { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { dropItems(world, x, y, z); super.breakBlock(world, x, y, z, par5, par6); } - private void dropItems(World world, int x, int y, int z) - { + private void dropItems(World world, int x, int y, int z) { Random rand = new Random(); TileEntity tileEntity = world.getTileEntity(x, y, z); - if (!(tileEntity instanceof IInventory)) - { + if (!(tileEntity instanceof IInventory)) { return; } IInventory inventory = (IInventory) tileEntity; - for (int i = 0; i < inventory.getSizeInventory(); i++) - { + for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack item = inventory.getStackInSlot(i); - if (item != null && item.stackSize > 0) - { + if (item != null && item.stackSize > 0) { float rx = rand.nextFloat() * 0.8F + 0.1F; float ry = rand.nextFloat() * 0.8F + 0.1F; float rz = rand.nextFloat() * 0.8F + 0.1F; - EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); + EntityItem entityItem = new EntityItem( + world, + x + rx, + y + ry, + z + rz, + new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); - if (item.hasTagCompound()) - { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + if (item.hasTagCompound()) { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) + item.getTagCompound().copy()); } float factor = 0.05F; @@ -152,26 +130,22 @@ public class BlockLifeInfuser extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TileLifeInfuser(); } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public int getRenderType() - { + public int getRenderType() { return -1; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/BlockPortableAltar.java b/src/main/java/com/arc/bloodarsenal/common/block/BlockPortableAltar.java index 6465459..429b2ae 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/BlockPortableAltar.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/BlockPortableAltar.java @@ -1,8 +1,14 @@ package com.arc.bloodarsenal.common.block; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.items.IAltarManipulator; +import WayofTime.alchemicalWizardry.common.items.EnergyBattery; +import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding; +import com.arc.bloodarsenal.common.tileentity.TilePortableAltar; +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.BlockContainer; import net.minecraft.block.material.Material; @@ -18,29 +24,21 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.api.items.IAltarManipulator; -import WayofTime.alchemicalWizardry.common.items.EnergyBattery; -import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding; -import com.arc.bloodarsenal.common.tileentity.TilePortableAltar; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BlockPortableAltar extends BlockContainer -{ +public class BlockPortableAltar extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon1; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockPortableAltar() - { + public BlockPortableAltar() { super(Material.rock); setHardness(7.0F); setResistance(10.0F); @@ -50,8 +48,7 @@ public class BlockPortableAltar extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top"); this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2"); @@ -60,10 +57,8 @@ public class BlockPortableAltar extends BlockContainer @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - switch (side) - { + public IIcon getIcon(int side, int meta) { + switch (side) { case 0: return bottomIcon; case 1: @@ -74,22 +69,18 @@ public class BlockPortableAltar extends BlockContainer } @Override - public boolean hasComparatorInputOverride() - { + public boolean hasComparatorInputOverride() { return true; } @Override - public int getComparatorInputOverride(World world, int x, int y, int z, int meta) - { + public int getComparatorInputOverride(World world, int x, int y, int z, int meta) { TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TilePortableAltar) - { + if (tile instanceof TilePortableAltar) { ItemStack stack = ((TilePortableAltar) tile).getStackInSlot(0); - if (stack != null && stack.getItem() instanceof EnergyBattery) - { + if (stack != null && stack.getItem() instanceof EnergyBattery) { EnergyBattery bloodOrb = (EnergyBattery) stack.getItem(); int maxEssence = bloodOrb.getMaxEssence(); int currentEssence = bloodOrb.getCurrentEssence(stack); @@ -102,74 +93,50 @@ public class BlockPortableAltar extends BlockContainer } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { TilePortableAltar tileEntity = (TilePortableAltar) world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) - { + if (tileEntity == null || player.isSneaking()) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); - if (playerItem != null) - { - if (playerItem.getItem().equals(ModItems.divinationSigil)) - { - if (player.worldObj.isRemote) - { + if (playerItem != null) { + if (playerItem.getItem().equals(ModItems.divinationSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendChatInfoToPlayer(player); } return true; - } - else if (playerItem.getItem().equals(ModItems.itemSeerSigil)) - { - if (player.worldObj.isRemote) - { + } else if (playerItem.getItem().equals(ModItems.itemSeerSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendMoreChatInfoToPlayer(player); } return true; - } - else if (playerItem.getItem() instanceof IAltarManipulator) - { + } else if (playerItem.getItem() instanceof IAltarManipulator) { return false; - } - else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) - { + } else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) { ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentSigil(playerItem); - if (item != null && item.getItem().equals(ModItems.divinationSigil)) - { - if (player.worldObj.isRemote) - { + if (item != null && item.getItem().equals(ModItems.divinationSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendChatInfoToPlayer(player); } return true; - } - else if (item != null && item.getItem().equals(ModItems.itemSeerSigil)) - { - if (player.worldObj.isRemote) - { + } else if (item != null && item.getItem().equals(ModItems.itemSeerSigil)) { + if (player.worldObj.isRemote) { world.markBlockForUpdate(x, y, z); - } - else - { + } else { tileEntity.sendMoreChatInfoToPlayer(player); } @@ -178,16 +145,13 @@ public class BlockPortableAltar extends BlockContainer } } - if (tileEntity.getStackInSlot(0) == null && playerItem != null) - { + if (tileEntity.getStackInSlot(0) == null && playerItem != null) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(0, newItem); tileEntity.startCycle(); - } - else if (tileEntity.getStackInSlot(0) != null && playerItem == null) - { + } else if (tileEntity.getStackInSlot(0) != null && playerItem == null) { player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); tileEntity.setInventorySlotContents(0, null); tileEntity.setActive(false); @@ -197,40 +161,38 @@ public class BlockPortableAltar extends BlockContainer } @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) - { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { dropItems(world, x, y, z); super.breakBlock(world, x, y, z, par5, par6); } - private void dropItems(World world, int x, int y, int z) - { + private void dropItems(World world, int x, int y, int z) { Random rand = new Random(); TileEntity tileEntity = world.getTileEntity(x, y, z); - if (!(tileEntity instanceof IInventory)) - { + if (!(tileEntity instanceof IInventory)) { return; } IInventory inventory = (IInventory) tileEntity; - for (int i = 0; i < inventory.getSizeInventory(); i++) - { + for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack item = inventory.getStackInSlot(i); - if (item != null && item.stackSize > 0) - { + if (item != null && item.stackSize > 0) { float rx = rand.nextFloat() * 0.8F + 0.1F; float ry = rand.nextFloat() * 0.8F + 0.1F; float rz = rand.nextFloat() * 0.8F + 0.1F; - EntityItem entityItem = new EntityItem(world, - x + rx, y + ry, z + rz, + EntityItem entityItem = new EntityItem( + world, + x + rx, + y + ry, + z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); - if (item.hasTagCompound()) - { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + if (item.hasTagCompound()) { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) + item.getTagCompound().copy()); } float factor = 0.05F; @@ -244,30 +206,25 @@ public class BlockPortableAltar extends BlockContainer } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) { TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TilePortableAltar) - { + if (tile instanceof TilePortableAltar) { NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) - { + if (tag != null) { ((TilePortableAltar) tile).readNBTOnPlace(tag); } } } @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 list = new ArrayList(); TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TilePortableAltar) - { + if (tile instanceof TilePortableAltar) { ItemStack drop = new ItemStack(this); NBTTagCompound tag = new NBTTagCompound(); ((TilePortableAltar) tile).writeNBTOnHarvest(tag); @@ -280,10 +237,8 @@ public class BlockPortableAltar extends BlockContainer } @Override - public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) - { - if (!player.capabilities.isCreativeMode) - { + public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) { + if (!player.capabilities.isCreativeMode) { dropBlockAsItem(world, x, y, z, meta, 0); } @@ -291,43 +246,36 @@ public class BlockPortableAltar extends BlockContainer } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public int getRenderType() - { + public int getRenderType() { return -1; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean hasTileEntity() - { + public boolean hasTileEntity() { return true; } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) - { + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { Item item = getItem(world, x, y, z); - if (item == null) - { + if (item == null) { return null; } TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TilePortableAltar) - { + if (tile instanceof TilePortableAltar) { ItemStack drop = new ItemStack(this); NBTTagCompound tag = new NBTTagCompound(); ((TilePortableAltar) tile).writeNBTOnHarvest(tag); @@ -339,24 +287,20 @@ public class BlockPortableAltar extends BlockContainer } @Override - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { TilePortableAltar tileEntity = (TilePortableAltar) world.getTileEntity(x, y, z); - if (!tileEntity.isActive()) - { + if (!tileEntity.isActive()) { return; } - if (rand.nextInt(3) != 0) - { + if (rand.nextInt(3) != 0) { return; } } @Override - public TileEntity createNewTileEntity(World var1, int var2) - { + public TileEntity createNewTileEntity(World var1, int var2) { return new TilePortableAltar(); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/ModBlocks.java b/src/main/java/com/arc/bloodarsenal/common/block/ModBlocks.java index c4a900c..e408a37 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/ModBlocks.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/ModBlocks.java @@ -7,13 +7,11 @@ import com.arc.bloodarsenal.common.items.block.CompactedMRSBlock; import com.arc.bloodarsenal.common.items.block.PortableAltarBlock; import com.arc.bloodarsenal.common.tileentity.*; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -import java.util.ArrayList; - -public class ModBlocks -{ +public class ModBlocks { public static Block blood_stone; public static Block blood_tnt; public static Block blood_stained_glass; @@ -36,8 +34,7 @@ public class ModBlocks public static ArrayList blocksNotToBeRegistered = new ArrayList(); - public static void init() - { + public static void init() { blood_stone = registerBlock(new BlockBloodStone(), BloodStoneBlock.class, "blood_stone"); blood_tnt = registerBlock(new BlockBloodTNT(), "blood_tnt"); blood_stained_glass = registerBlock(new BlockBloodStainedGlass(), "blood_stained_glass"); @@ -51,7 +48,8 @@ public class ModBlocks blood_infused_glowstone = registerBlock(new BlockBloodInfusedGlowstone(), "blood_infused_glowstone"); blood_lamp = registerBlock(new BlockBloodLamp(), "blood_lamp"); blood_infused_diamond_block = registerBlock(new BlockBloodInfusedDiamond(), "blood_infused_diamond_block"); - portable_altar = (BlockPortableAltar) registerBlock(new BlockPortableAltar(), PortableAltarBlock.class, "portable_altar"); + portable_altar = (BlockPortableAltar) + registerBlock(new BlockPortableAltar(), PortableAltarBlock.class, "portable_altar"); life_infuser = registerBlock(new BlockLifeInfuser(), "life_infuser"); compacter = registerBlock(new BlockCompacter(), "compacter"); lp_materializer = registerBlock(new BlockLPMaterializer(), "lp_materializer"); @@ -59,8 +57,7 @@ public class ModBlocks block_burned_string = registerBlock(new BlockBurnedString(), "block_burned_string"); } - public static void registerTileEntities() - { + public static void registerTileEntities() { GameRegistry.registerTileEntity(TilePortableAltar.class, "portable_altar"); GameRegistry.registerTileEntity(TileLifeInfuser.class, "life_infuser"); GameRegistry.registerTileEntity(TileCompacter.class, "compacter"); @@ -68,59 +65,48 @@ public class ModBlocks GameRegistry.registerTileEntity(TileCompactedMRS.class, "compacted_mrs"); } - public static Block registerBlock(Block block, String unlocalizedName) - { + public static Block registerBlock(Block block, String unlocalizedName) { block.setBlockName(unlocalizedName); block.setBlockTextureName(BloodArsenal.MODID + ":" + unlocalizedName); - if (!(block instanceof BlockBloodCake || block instanceof BlockBurnedString)) - { + if (!(block instanceof BlockBloodCake || block instanceof BlockBurnedString)) { block.setCreativeTab(BloodArsenal.BA_TAB); } blocksNotToBeRegistered.clear(); - for (String unlocName : BloodArsenalConfig.blocksToBeDisabled) - { - if (unlocName.equals(unlocalizedName)) - { + for (String unlocName : BloodArsenalConfig.blocksToBeDisabled) { + if (unlocName.equals(unlocalizedName)) { blocksNotToBeRegistered.add(unlocName); } } - if (!blocksNotToBeRegistered.contains(unlocalizedName)) - { + if (!blocksNotToBeRegistered.contains(unlocalizedName)) { GameRegistry.registerBlock(block, unlocalizedName); } return block; } - public static Block registerBlock(Block block, Class itemBlockClass, String unlocalizedName) - { + public static Block registerBlock(Block block, Class itemBlockClass, String unlocalizedName) { block.setCreativeTab(BloodArsenal.BA_TAB); - for (String unlocName : BloodArsenalConfig.blocksToBeDisabled) - { + for (String unlocName : BloodArsenalConfig.blocksToBeDisabled) { System.out.println(unlocName); - if (unlocName.equals(unlocalizedName)) - { + if (unlocName.equals(unlocalizedName)) { blocksNotToBeRegistered.add(unlocName); } } - if (!blocksNotToBeRegistered.contains(unlocalizedName)) - { + if (!blocksNotToBeRegistered.contains(unlocalizedName)) { GameRegistry.registerBlock(block, itemBlockClass, unlocalizedName); } return block; } - public static void registerMultiparts() - { - try - { + public static void registerMultiparts() { + try { Class clazz = Class.forName("com.arc.bloodarsenal.common.block.MultipartHandler"); clazz.newInstance(); + } catch (Throwable e) { } - catch(Throwable e) {} } } diff --git a/src/main/java/com/arc/bloodarsenal/common/block/MultipartHandler.java b/src/main/java/com/arc/bloodarsenal/common/block/MultipartHandler.java index a243063..a2a12cf 100644 --- a/src/main/java/com/arc/bloodarsenal/common/block/MultipartHandler.java +++ b/src/main/java/com/arc/bloodarsenal/common/block/MultipartHandler.java @@ -12,17 +12,14 @@ package com.arc.bloodarsenal.common.block; import codechicken.microblock.BlockMicroMaterial; import codechicken.microblock.MicroMaterialRegistry; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import java.util.ArrayList; -import java.util.List; - -public class MultipartHandler -{ - public MultipartHandler() - { +public class MultipartHandler { + public MultipartHandler() { registerAllMultiparts(ModBlocks.blood_stone); registerAllMultiparts(ModBlocks.blood_stained_glass); registerAllMultiparts(ModBlocks.blood_infused_wood); @@ -35,31 +32,26 @@ public class MultipartHandler registerAllMultiparts(ModBlocks.blood_infused_diamond_block); } - private static void registerAllMultiparts(Block block) - { + private static void registerAllMultiparts(Block block) { List stacks = new ArrayList(); Item item = Item.getItemFromBlock(block); block.getSubBlocks(item, block.getCreativeTabToDisplayOn(), stacks); - for (ItemStack stack : stacks) - { - if (stack.getItem() == item) - { + for (ItemStack stack : stacks) { + if (stack.getItem() == item) { registerMultipart(block, stack.getItemDamage()); } } } - private static void registerMultipartMetadataLine(Block block, int maxMeta) - { - for (int i = 0; i < maxMeta; i++) - { + private static void registerMultipartMetadataLine(Block block, int maxMeta) { + for (int i = 0; i < maxMeta; i++) { registerMultipart(block, i); } } - private static void registerMultipart(Block block, int meta) - { - MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), block.getUnlocalizedName() + (meta == 0 ? "" : "_" + meta)); + private static void registerMultipart(Block block, int meta) { + MicroMaterialRegistry.registerMaterial( + new BlockMicroMaterial(block, meta), block.getUnlocalizedName() + (meta == 0 ? "" : "_" + meta)); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/EntityBloodTNT.java b/src/main/java/com/arc/bloodarsenal/common/entity/EntityBloodTNT.java index 96cb8a1..da62dec 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/EntityBloodTNT.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/EntityBloodTNT.java @@ -7,27 +7,25 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public class EntityBloodTNT extends Entity -{ +public class EntityBloodTNT extends Entity { public int fuse; private EntityLivingBase tntPlacedBy; - - public EntityBloodTNT(World par1World) - { + + public EntityBloodTNT(World par1World) { super(par1World); preventEntitySpawning = true; setSize(0.98F, 0.98F); yOffset = height / 2.0F; } - public EntityBloodTNT(World par1World, double par2, double par4, double par6, EntityLivingBase par8EntityLivingBase) - { + public EntityBloodTNT( + World par1World, double par2, double par4, double par6, EntityLivingBase par8EntityLivingBase) { this(par1World); setPosition(par2, par4, par6); - float f = (float)(Math.random() * Math.PI * 2.0D); - motionX = (double)(-((float)Math.sin((double)f)) * 0.02F); + float f = (float) (Math.random() * Math.PI * 2.0D); + motionX = (double) (-((float) Math.sin((double) f)) * 0.02F); motionY = 0.20000000298023224D; - motionZ = (double)(-((float)Math.cos((double)f)) * 0.02F); + motionZ = (double) (-((float) Math.cos((double) f)) * 0.02F); fuse = 60; prevPosX = par2; prevPosY = par4; @@ -39,20 +37,17 @@ public class EntityBloodTNT extends Entity public void entityInit() {} @Override - public boolean canTriggerWalking() - { + public boolean canTriggerWalking() { return false; } @Override - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return !isDead; } @Override - public void onUpdate() - { + public void onUpdate() { prevPosX = posX; prevPosY = posY; prevPosZ = posZ; @@ -62,53 +57,43 @@ public class EntityBloodTNT extends Entity motionY *= 0.9800000190734863D; motionZ *= 0.9800000190734863D; - if (onGround) - { + if (onGround) { motionY *= -0.5D; } - if (fuse-- <= 0) - { + if (fuse-- <= 0) { setDead(); - if (!worldObj.isRemote) - { + if (!worldObj.isRemote) { explode(); } - } - else - { + } else { worldObj.spawnParticle("smoke", posX, posY + 0.5D, posZ, 0.0D, 0.0D, 0.0D); } } - private void explode() - { + private void explode() { float f = 6.0F; worldObj.createExplosion(this, posX, posY, posZ, f, true); } @Override - protected void writeEntityToNBT(NBTTagCompound par1) - { + protected void writeEntityToNBT(NBTTagCompound par1) { par1.setByte("Fuse", (byte) fuse); } @Override - protected void readEntityFromNBT(NBTTagCompound par1) - { + protected void readEntityFromNBT(NBTTagCompound par1) { fuse = par1.getByte("Fuse"); } @Override @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 0.0F; } - public EntityLivingBase getTntPlacedBy() - { + public EntityLivingBase getTntPlacedBy() { return tntPlacedBy; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/ModLivingDropsEvent.java b/src/main/java/com/arc/bloodarsenal/common/entity/ModLivingDropsEvent.java index 42f4a85..ab02dbe 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/ModLivingDropsEvent.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/ModLivingDropsEvent.java @@ -4,6 +4,7 @@ import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.items.ModItems; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.Random; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityWolf; @@ -12,59 +13,42 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraftforge.event.entity.living.LivingDropsEvent; -import java.util.Random; - -public class ModLivingDropsEvent -{ +public class ModLivingDropsEvent { @SubscribeEvent - public void onEntityDrop(LivingDropsEvent event) - { + public void onEntityDrop(LivingDropsEvent event) { Random random = new Random(); - if (GameRegistry.findItem(BloodArsenal.MODID, "heart") != null) - { - if (event.source.getDamageType().equals("player")) - { + if (GameRegistry.findItem(BloodArsenal.MODID, "heart") != null) { + if (event.source.getDamageType().equals("player")) { PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness); - if (event.entityLiving instanceof EntityZombie) - { - if (effect != null) - { - if (random.nextFloat() < 0.01F) - { + if (event.entityLiving instanceof EntityZombie) { + if (effect != null) { + if (random.nextFloat() < 0.01F) { event.entityLiving.dropItem(ModItems.heart, 1); } } } - if (event.entityLiving instanceof EntityVillager) - { - if (effect != null) - { - if (random.nextFloat() < 0.25F) - { + if (event.entityLiving instanceof EntityVillager) { + if (effect != null) { + if (random.nextFloat() < 0.25F) { event.entityLiving.dropItem(ModItems.heart, 1); } } } - if (event.entityLiving instanceof EntityPlayer) - { - if (effect != null) - { + if (event.entityLiving instanceof EntityPlayer) { + if (effect != null) { event.entityLiving.dropItem(ModItems.heart, 1); } } } } - if (GameRegistry.findItem(BloodArsenal.MODID, "wolf_hide") != null) - { - if (event.entityLiving instanceof EntityWolf) - { - if (random.nextFloat() < 0.4F) - { + if (GameRegistry.findItem(BloodArsenal.MODID, "wolf_hide") != null) { + if (event.entityLiving instanceof EntityWolf) { + if (random.nextFloat() < 0.4F) { event.entityLiving.dropItem(ModItems.wolf_hide, 1); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIAttackOnCollide.java b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIAttackOnCollide.java index 7ea7c8e..49dcabe 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIAttackOnCollide.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIAttackOnCollide.java @@ -8,8 +8,7 @@ import net.minecraft.pathfinding.PathPoint; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class AIAttackOnCollide extends EntityAIBase -{ +public class AIAttackOnCollide extends EntityAIBase { World worldObj; EntityCreature attacker; int attackTick; @@ -24,14 +23,12 @@ public class AIAttackOnCollide extends EntityAIBase private int failedPathFindingPenalty; - public AIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) - { + public AIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) { this(p_i1635_1_, p_i1635_3_, p_i1635_5_); this.classTarget = p_i1635_2_; } - public AIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) - { + public AIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) { this.attacker = p_i1636_1_; this.worldObj = p_i1636_1_.worldObj; this.speedTowardsTarget = p_i1636_2_; @@ -40,117 +37,107 @@ public class AIAttackOnCollide extends EntityAIBase } @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); - if (entitylivingbase == null) - { + if (entitylivingbase == null) { return false; - } - else if (!entitylivingbase.isEntityAlive()) - { + } else if (!entitylivingbase.isEntityAlive()) { return false; - } - else if (this.classTarget != null && !this.classTarget.isAssignableFrom(entitylivingbase.getClass())) - { + } else if (this.classTarget != null && !this.classTarget.isAssignableFrom(entitylivingbase.getClass())) { return false; - } - else - { - if (-- this.field_75445_i <= 0) - { + } else { + if (--this.field_75445_i <= 0) { this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); return this.entityPathEntity != null; - } - else - { + } else { return true; } } } @Override - public boolean continueExecuting() - { + public boolean continueExecuting() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); - return entitylivingbase != null && entitylivingbase.isEntityAlive() && (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistance(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ))); + return entitylivingbase != null + && entitylivingbase.isEntityAlive() + && (!this.longMemory + ? !this.attacker.getNavigator().noPath() + : this.attacker.isWithinHomeDistance( + MathHelper.floor_double(entitylivingbase.posX), + MathHelper.floor_double(entitylivingbase.posY), + MathHelper.floor_double(entitylivingbase.posZ))); } @Override - public void startExecuting() - { + public void startExecuting() { this.attacker.getNavigator().setPath(this.entityPathEntity, this.speedTowardsTarget); this.field_75445_i = 0; } @Override - public void resetTask() - { + public void resetTask() { this.attacker.getNavigator().clearPathEntity(); } @Override - public void updateTask() - { + public void updateTask() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); this.attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F); - double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); - double d1 = (double)(this.attacker.width * 2.0F * this.attacker.width * 2.0F + entitylivingbase.width); + double d0 = this.attacker.getDistanceSq( + entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); + double d1 = (double) (this.attacker.width * 2.0F * this.attacker.width * 2.0F + entitylivingbase.width); --this.field_75445_i; - if ((this.longMemory || this.attacker.getEntitySenses().canSee(entitylivingbase)) && this.field_75445_i <= 0 && (this.field_151497_i == 0.0D && this.field_151495_j == 0.0D && this.field_151496_k == 0.0D || entitylivingbase.getDistanceSq(this.field_151497_i, this.field_151495_j, this.field_151496_k) >= 1.0D || this.attacker.getRNG().nextFloat() < 0.05F)) - { + if ((this.longMemory || this.attacker.getEntitySenses().canSee(entitylivingbase)) + && this.field_75445_i <= 0 + && (this.field_151497_i == 0.0D && this.field_151495_j == 0.0D && this.field_151496_k == 0.0D + || entitylivingbase.getDistanceSq(this.field_151497_i, this.field_151495_j, this.field_151496_k) + >= 1.0D + || this.attacker.getRNG().nextFloat() < 0.05F)) { this.field_151497_i = entitylivingbase.posX; this.field_151495_j = entitylivingbase.boundingBox.minY; this.field_151496_k = entitylivingbase.posZ; - this.field_75445_i = failedPathFindingPenalty + 4 + this.attacker.getRNG().nextInt(7); + this.field_75445_i = + failedPathFindingPenalty + 4 + this.attacker.getRNG().nextInt(7); - if (this.attacker.getNavigator().getPath() != null) - { - PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); - if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) - { + if (this.attacker.getNavigator().getPath() != null) { + PathPoint finalPathPoint = + this.attacker.getNavigator().getPath().getFinalPathPoint(); + if (finalPathPoint != null + && entitylivingbase.getDistanceSq( + finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) + < 1) { failedPathFindingPenalty = 0; - } - else - { + } else { failedPathFindingPenalty += 10; } - } - else - { + } else { failedPathFindingPenalty += 10; } - if (d0 > 1024.0D) - { + if (d0 > 1024.0D) { this.field_75445_i += 10; - } - else if (d0 > 256.0D) - { + } else if (d0 > 256.0D) { this.field_75445_i += 5; } - if (!this.attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) - { + if (!this.attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) { this.field_75445_i += 15; } } this.attackTick = Math.max(this.attackTick - 1, 0); - if (d0 <= d1 && this.attackTick <= 20) - { + if (d0 <= d1 && this.attackTick <= 20) { this.attackTick = 20; - if (this.attacker.getHeldItem() != null) - { + if (this.attacker.getHeldItem() != null) { this.attacker.swingItem(); } this.attacker.attackEntityAsMob(entitylivingbase); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIFollowOwner.java b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIFollowOwner.java index 33e7585..634f3b3 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIFollowOwner.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIFollowOwner.java @@ -7,8 +7,7 @@ import net.minecraft.pathfinding.PathNavigate; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class AIFollowOwner extends EntityAIBase -{ +public class AIFollowOwner extends EntityAIBase { private EntityTameable thePet; private EntityLivingBase theOwner; World theWorld; @@ -19,8 +18,7 @@ public class AIFollowOwner extends EntityAIBase float minDist; private boolean field_75344_i; - public AIFollowOwner(EntityTameable p_i1625_1_, double p_i1625_2_, float p_i1625_4_, float p_i1625_5_) - { + public AIFollowOwner(EntityTameable p_i1625_1_, double p_i1625_2_, float p_i1625_4_, float p_i1625_5_) { this.thePet = p_i1625_1_; this.theWorld = p_i1625_1_.worldObj; this.field_75336_f = p_i1625_2_; @@ -33,24 +31,16 @@ public class AIFollowOwner extends EntityAIBase /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { + public boolean shouldExecute() { EntityLivingBase entitylivingbase = this.thePet.getOwner(); - if (entitylivingbase == null) - { + if (entitylivingbase == null) { return false; - } - else if (this.thePet.isSitting()) - { + } else if (this.thePet.isSitting()) { return false; - } - else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < (double)(this.minDist * this.minDist)) - { + } else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < (double) (this.minDist * this.minDist)) { return false; - } - else - { + } else { this.theOwner = entitylivingbase; return true; } @@ -59,16 +49,16 @@ public class AIFollowOwner extends EntityAIBase /** * Returns whether an in-progress EntityAIBase should continue executing */ - public boolean continueExecuting() - { - return !this.petPathfinder.noPath() && this.thePet.getDistanceSqToEntity(this.theOwner) > (double)(this.maxDist * this.maxDist) && !this.thePet.isSitting(); + public boolean continueExecuting() { + return !this.petPathfinder.noPath() + && this.thePet.getDistanceSqToEntity(this.theOwner) > (double) (this.maxDist * this.maxDist) + && !this.thePet.isSitting(); } /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { + public void startExecuting() { this.field_75343_h = 0; this.field_75344_i = this.thePet.getNavigator().getAvoidsWater(); this.thePet.getNavigator().setAvoidsWater(false); @@ -77,8 +67,7 @@ public class AIFollowOwner extends EntityAIBase /** * Resets the task */ - public void resetTask() - { + public void resetTask() { this.theOwner = null; this.petPathfinder.clearPathEntity(); this.thePet.getNavigator().setAvoidsWater(this.field_75344_i); @@ -87,33 +76,37 @@ public class AIFollowOwner extends EntityAIBase /** * Updates the task */ - public void updateTask() - { - this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float)this.thePet.getVerticalFaceSpeed()); + public void updateTask() { + this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float) + this.thePet.getVerticalFaceSpeed()); - if (!this.thePet.isSitting()) - { - if (--this.field_75343_h <= 0) - { + if (!this.thePet.isSitting()) { + if (--this.field_75343_h <= 0) { this.field_75343_h = 10; - if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.field_75336_f)) - { - if (!this.thePet.getLeashed()) - { - if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) - { + if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.field_75336_f)) { + if (!this.thePet.getLeashed()) { + if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) { int i = MathHelper.floor_double(this.theOwner.posX) - 2; int j = MathHelper.floor_double(this.theOwner.posZ) - 2; int k = MathHelper.floor_double(this.theOwner.boundingBox.minY); - for (int l = 0; l <= 4; ++l) - { - for (int i1 = 0; i1 <= 4; ++i1) - { - if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && World.doesBlockHaveSolidTopSurface(this.theWorld, i + l, k - 1, j + i1) && !this.theWorld.getBlock(i + l, k, j + i1).isNormalCube() && !this.theWorld.getBlock(i + l, k + 1, j + i1).isNormalCube()) - { - this.thePet.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch); + for (int l = 0; l <= 4; ++l) { + for (int i1 = 0; i1 <= 4; ++i1) { + if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) + && World.doesBlockHaveSolidTopSurface(this.theWorld, i + l, k - 1, j + i1) + && !this.theWorld + .getBlock(i + l, k, j + i1) + .isNormalCube() + && !this.theWorld + .getBlock(i + l, k + 1, j + i1) + .isNormalCube()) { + this.thePet.setLocationAndAngles( + (double) ((float) (i + l) + 0.5F), + (double) k, + (double) ((float) (j + i1) + 0.5F), + this.thePet.rotationYaw, + this.thePet.rotationPitch); this.petPathfinder.clearPathEntity(); return; } @@ -125,4 +118,4 @@ public class AIFollowOwner extends EntityAIBase } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIHurtByTarget.java b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIHurtByTarget.java index 0136f1d..830c302 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIHurtByTarget.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIHurtByTarget.java @@ -1,19 +1,16 @@ package com.arc.bloodarsenal.common.entity.ai; +import java.util.Iterator; +import java.util.List; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.ai.EntityAITarget; import net.minecraft.util.AxisAlignedBB; -import java.util.Iterator; -import java.util.List; - -public class AIHurtByTarget extends EntityAITarget -{ +public class AIHurtByTarget extends EntityAITarget { boolean entityCallsForHelp; private int field_142052_b; - public AIHurtByTarget(EntityCreature p_i1660_1_, boolean p_i1660_2_) - { + public AIHurtByTarget(EntityCreature p_i1660_1_, boolean p_i1660_2_) { super(p_i1660_1_, false); this.entityCallsForHelp = p_i1660_2_; this.setMutexBits(1); @@ -22,8 +19,7 @@ public class AIHurtByTarget extends EntityAITarget /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { + public boolean shouldExecute() { int i = this.taskOwner.func_142015_aE(); return i != this.field_142052_b && this.isSuitableTarget(this.taskOwner.getAITarget(), false); } @@ -31,23 +27,30 @@ public class AIHurtByTarget extends EntityAITarget /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { + public void startExecuting() { this.taskOwner.setAttackTarget(this.taskOwner.getAITarget()); this.field_142052_b = this.taskOwner.func_142015_aE(); - if (this.entityCallsForHelp) - { + if (this.entityCallsForHelp) { double d0 = this.getTargetDistance(); - List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getBoundingBox(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0)); + List list = this.taskOwner.worldObj.getEntitiesWithinAABB( + this.taskOwner.getClass(), + AxisAlignedBB.getBoundingBox( + this.taskOwner.posX, + this.taskOwner.posY, + this.taskOwner.posZ, + this.taskOwner.posX + 1.0D, + this.taskOwner.posY + 1.0D, + this.taskOwner.posZ + 1.0D) + .expand(d0, 10.0D, d0)); Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { - EntityCreature entitycreature = (EntityCreature)iterator.next(); + while (iterator.hasNext()) { + EntityCreature entitycreature = (EntityCreature) iterator.next(); - if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget())) - { + if (this.taskOwner != entitycreature + && entitycreature.getAttackTarget() == null + && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget())) { entitycreature.setAttackTarget(this.taskOwner.getAITarget()); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AILeapAtTarget.java b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AILeapAtTarget.java index 19901ca..a3bc38e 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AILeapAtTarget.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AILeapAtTarget.java @@ -5,48 +5,43 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.util.MathHelper; -public class AILeapAtTarget extends EntityAIBase -{ +public class AILeapAtTarget extends EntityAIBase { EntityLiving leaper; EntityLivingBase leapTarget; float leapMotionY; - public AILeapAtTarget(EntityLiving entity, float leapMotionY) - { + public AILeapAtTarget(EntityLiving entity, float leapMotionY) { this.leaper = entity; this.leapMotionY = leapMotionY; setMutexBits(5); } @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { this.leapTarget = this.leaper.getAttackTarget(); - if (this.leapTarget == null) - { + if (this.leapTarget == null) { return false; - } - else - { + } else { double d0 = this.leaper.getDistanceSqToEntity(this.leapTarget); - return d0 >= 4.0D && d0 <= 16.0D && this.leaper.onGround && this.leaper.getRNG().nextInt(5) == 0; + return d0 >= 4.0D + && d0 <= 16.0D + && this.leaper.onGround + && this.leaper.getRNG().nextInt(5) == 0; } } @Override - public boolean continueExecuting() - { + public boolean continueExecuting() { return !this.leaper.onGround; } - public void startExecuting() - { + public void startExecuting() { double d0 = this.leapTarget.posX - this.leaper.posX; double d1 = this.leapTarget.posZ - this.leaper.posZ; float f = MathHelper.sqrt_double(d0 * d0 + d1 * d1); - this.leaper.motionX += d0 / (double)f * 0.5D * 0.800000011920929D + this.leaper.motionX * 0.20000000298023224D; - this.leaper.motionZ += d1 / (double)f * 0.5D * 0.800000011920929D + this.leaper.motionZ * 0.20000000298023224D; - this.leaper.motionY = (double)this.leapMotionY; + this.leaper.motionX += d0 / (double) f * 0.5D * 0.800000011920929D + this.leaper.motionX * 0.20000000298023224D; + this.leaper.motionZ += d1 / (double) f * 0.5D * 0.800000011920929D + this.leaper.motionZ * 0.20000000298023224D; + this.leaper.motionY = (double) this.leapMotionY; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtByTarget.java b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtByTarget.java index 02c6d92..111049d 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtByTarget.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtByTarget.java @@ -4,14 +4,12 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAITarget; import net.minecraft.entity.passive.EntityTameable; -public class AIOwnerHurtByTarget extends EntityAITarget -{ +public class AIOwnerHurtByTarget extends EntityAITarget { EntityTameable theDefendingTameable; EntityLivingBase theOwnerAttacker; private int field_142051_e; - public AIOwnerHurtByTarget(EntityTameable p_i1667_1_) - { + public AIOwnerHurtByTarget(EntityTameable p_i1667_1_) { super(p_i1667_1_, false); this.theDefendingTameable = p_i1667_1_; this.setMutexBits(1); @@ -20,25 +18,20 @@ public class AIOwnerHurtByTarget extends EntityAITarget /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { - if (!this.theDefendingTameable.isTamed()) - { + public boolean shouldExecute() { + if (!this.theDefendingTameable.isTamed()) { return false; - } - else - { + } else { EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner(); - if (entitylivingbase == null) - { + if (entitylivingbase == null) { return false; - } - else - { + } else { this.theOwnerAttacker = entitylivingbase.getAITarget(); int i = entitylivingbase.func_142015_aE(); - return i != this.field_142051_e && this.isSuitableTarget(this.theOwnerAttacker, false) && this.theDefendingTameable.func_142018_a(this.theOwnerAttacker, entitylivingbase); + return i != this.field_142051_e + && this.isSuitableTarget(this.theOwnerAttacker, false) + && this.theDefendingTameable.func_142018_a(this.theOwnerAttacker, entitylivingbase); } } } @@ -46,16 +39,14 @@ public class AIOwnerHurtByTarget extends EntityAITarget /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { + public void startExecuting() { this.taskOwner.setAttackTarget(this.theOwnerAttacker); EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner(); - if (entitylivingbase != null) - { + if (entitylivingbase != null) { this.field_142051_e = entitylivingbase.func_142015_aE(); } super.startExecuting(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtTarget.java b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtTarget.java index 0662d99..b91f71f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtTarget.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/ai/AIOwnerHurtTarget.java @@ -4,14 +4,12 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAITarget; import net.minecraft.entity.passive.EntityTameable; -public class AIOwnerHurtTarget extends EntityAITarget -{ +public class AIOwnerHurtTarget extends EntityAITarget { EntityTameable theEntityTameable; EntityLivingBase theTarget; private int field_142050_e; - public AIOwnerHurtTarget(EntityTameable p_i1668_1_) - { + public AIOwnerHurtTarget(EntityTameable p_i1668_1_) { super(p_i1668_1_, false); this.theEntityTameable = p_i1668_1_; this.setMutexBits(1); @@ -20,25 +18,20 @@ public class AIOwnerHurtTarget extends EntityAITarget /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { - if (!this.theEntityTameable.isTamed()) - { + public boolean shouldExecute() { + if (!this.theEntityTameable.isTamed()) { return false; - } - else - { + } else { EntityLivingBase entitylivingbase = this.theEntityTameable.getOwner(); - if (entitylivingbase == null) - { + if (entitylivingbase == null) { return false; - } - else - { + } else { this.theTarget = entitylivingbase.getLastAttacker(); int i = entitylivingbase.getLastAttackerTime(); - return i != this.field_142050_e && this.isSuitableTarget(this.theTarget, false) && this.theEntityTameable.func_142018_a(this.theTarget, entitylivingbase); + return i != this.field_142050_e + && this.isSuitableTarget(this.theTarget, false) + && this.theEntityTameable.func_142018_a(this.theTarget, entitylivingbase); } } } @@ -46,13 +39,11 @@ public class AIOwnerHurtTarget extends EntityAITarget /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { + public void startExecuting() { this.taskOwner.setAttackTarget(this.theTarget); EntityLivingBase entitylivingbase = this.theEntityTameable.getOwner(); - if (entitylivingbase != null) - { + if (entitylivingbase != null) { this.field_142050_e = entitylivingbase.getLastAttackerTime(); } diff --git a/src/main/java/com/arc/bloodarsenal/common/entity/mob/EntityBloodHound.java b/src/main/java/com/arc/bloodarsenal/common/entity/mob/EntityBloodHound.java index 68f85f3..247da3b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/entity/mob/EntityBloodHound.java +++ b/src/main/java/com/arc/bloodarsenal/common/entity/mob/EntityBloodHound.java @@ -25,19 +25,19 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class EntityBloodHound extends EntityTameable -{ +public class EntityBloodHound extends EntityTameable { private float field_70926_e; private float field_70924_f; /** true is the wolf is wet else false */ private boolean isShaking; + private boolean field_70928_h; /** This time increases while wolf is shaking and emitting water particles. */ private float timeWolfIsShaking; + private float prevTimeWolfIsShaking; - public EntityBloodHound(World world) - { + public EntityBloodHound(World world) { super(world); setSize(0.9F, 1.2F); this.tasks.addTask(1, new EntityAISwimming(this)); @@ -52,17 +52,13 @@ public class EntityBloodHound extends EntityTameable this.setTamed(true); } - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - if (this.isTamed()) - { + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); - } - else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); } } @@ -70,24 +66,19 @@ public class EntityBloodHound extends EntityTameable /** * Returns true if the newer Entity AI code should be run */ - public boolean isAIEnabled() - { + public boolean isAIEnabled() { return true; } /** * Sets the active target the Task system uses for tracking */ - public void setAttackTarget(EntityLivingBase p_70624_1_) - { + public void setAttackTarget(EntityLivingBase p_70624_1_) { super.setAttackTarget(p_70624_1_); - if (p_70624_1_ == null) - { + if (p_70624_1_ == null) { this.setAngry(false); - } - else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -95,29 +86,25 @@ public class EntityBloodHound extends EntityTameable /** * main AI tick function, replaces updateEntityActionState */ - protected void updateAITick() - { + protected void updateAITick() { this.dataWatcher.updateObject(18, this.getHealth()); } - protected void entityInit() - { + protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(18, this.getHealth()); this.dataWatcher.addObject(19, (byte) 0); this.dataWatcher.addObject(20, (byte) BlockColored.func_150032_b(1)); } - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) - { + protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.wolf.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound p_70014_1_) - { + public void writeEntityToNBT(NBTTagCompound p_70014_1_) { super.writeEntityToNBT(p_70014_1_); p_70014_1_.setBoolean("Angry", this.isAngry()); } @@ -125,8 +112,7 @@ public class EntityBloodHound extends EntityTameable /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound p_70037_1_) - { + public void readEntityFromNBT(NBTTagCompound p_70037_1_) { super.readEntityFromNBT(p_70037_1_); this.setAngry(p_70037_1_.getBoolean("Angry")); } @@ -134,37 +120,38 @@ public class EntityBloodHound extends EntityTameable /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { - return this.isAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); + protected String getLivingSound() { + return this.isAngry() + ? "mob.wolf.growl" + : (this.rand.nextInt(3) == 0 + ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F + ? "mob.wolf.whine" + : "mob.wolf.panting") + : "mob.wolf.bark"); } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.wolf.hurt"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.wolf.death"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } - protected Item getDropItem() - { + protected Item getDropItem() { return Item.getItemById(-1); } @@ -172,84 +159,79 @@ public class EntityBloodHound extends EntityTameable * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */ - public void onLivingUpdate() - { + public void onLivingUpdate() { super.onLivingUpdate(); - if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) - { + if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) { this.field_70928_h = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; - this.worldObj.setEntityState(this, (byte)8); + this.worldObj.setEntityState(this, (byte) 8); } } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); this.field_70924_f = this.field_70926_e; - if (this.func_70922_bv()) - { + if (this.func_70922_bv()) { this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F; - } - else - { + } else { this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F; } - if (this.func_70922_bv()) - { + if (this.func_70922_bv()) { this.numTicksToChaseTarget = 10; } - if (this.isWet()) - { + if (this.isWet()) { this.isShaking = true; this.field_70928_h = false; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; - } - else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) - { - if (this.timeWolfIsShaking == 0.0F) - { - this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) { + if (this.timeWolfIsShaking == 0.0F) { + this.playSound( + "mob.wolf.shake", + this.getSoundVolume(), + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); } this.prevTimeWolfIsShaking = this.timeWolfIsShaking; this.timeWolfIsShaking += 0.05F; - if (this.prevTimeWolfIsShaking >= 2.0F) - { + if (this.prevTimeWolfIsShaking >= 2.0F) { this.isShaking = false; this.field_70928_h = false; this.prevTimeWolfIsShaking = 0.0F; this.timeWolfIsShaking = 0.0F; } - if (this.timeWolfIsShaking > 0.4F) - { - float f = (float)this.boundingBox.minY; - int i = (int)(MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F); + if (this.timeWolfIsShaking > 0.4F) { + float f = (float) this.boundingBox.minY; + int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F); - for (int j = 0; j < i; ++j) - { + for (int j = 0; j < i; ++j) { float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; - this.worldObj.spawnParticle("splash", this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle( + "splash", + this.posX + (double) f1, + (double) (f + 0.8F), + this.posZ + (double) f2, + this.motionX, + this.motionY, + this.motionZ); } } } } @SideOnly(Side.CLIENT) - public boolean getWolfShaking() - { + public boolean getWolfShaking() { return this.isShaking; } @@ -257,64 +239,60 @@ public class EntityBloodHound extends EntityTameable * Used when calculating the amount of shading to apply while the wolf is shaking. */ @SideOnly(Side.CLIENT) - public float getShadingWhileShaking(float p_70915_1_) - { - return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F; + public float getShadingWhileShaking(float p_70915_1_) { + return 0.75F + + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) + / 2.0F + * 0.25F; } @SideOnly(Side.CLIENT) - public float getShakeAngle(float p_70923_1_, float p_70923_2_) - { - float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F; + public float getShakeAngle(float p_70923_1_, float p_70923_2_) { + float f2 = (this.prevTimeWolfIsShaking + + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + + p_70923_2_) + / 1.8F; - if (f2 < 0.0F) - { + if (f2 < 0.0F) { f2 = 0.0F; - } - else if (f2 > 1.0F) - { + } else if (f2 > 1.0F) { f2 = 1.0F; } - return MathHelper.sin(f2 * (float)Math.PI) * MathHelper.sin(f2 * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI; + return MathHelper.sin(f2 * (float) Math.PI) + * MathHelper.sin(f2 * (float) Math.PI * 11.0F) + * 0.15F + * (float) Math.PI; } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @SideOnly(Side.CLIENT) - public float getInterestedAngle(float p_70917_1_) - { - return (this.field_70924_f + (this.field_70926_e - this.field_70924_f) * p_70917_1_) * 0.15F * (float)Math.PI; + public float getInterestedAngle(float p_70917_1_) { + return (this.field_70924_f + (this.field_70926_e - this.field_70924_f) * p_70917_1_) * 0.15F * (float) Math.PI; } /** * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently * use in wolves. */ - public int getVerticalFaceSpeed() - { + public int getVerticalFaceSpeed() { return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); } /** * Called when the entity is attacked. */ - public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { + if (this.isEntityInvulnerable()) { return false; - } - else - { + } else { Entity entity = p_70097_1_.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { p_70097_2_ = (p_70097_2_ + 1.0F) / 2.0F; } @@ -322,38 +300,30 @@ public class EntityBloodHound extends EntityTameable } } - public boolean attackEntityAsMob(Entity p_70652_1_) - { + public boolean attackEntityAsMob(Entity p_70652_1_) { int i = this.isTamed() ? 4 : 2; - return p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i); + return p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } /** * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ - public boolean interact(EntityPlayer p_70085_1_) - { + public boolean interact(EntityPlayer p_70085_1_) { ItemStack itemstack = p_70085_1_.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { - ItemFood itemfood = (ItemFood)itemstack.getItem(); + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { + ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) - { - if (!p_70085_1_.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) { + if (!p_70085_1_.capabilities.isCreativeMode) { --itemstack.stackSize; } - this.heal((float)itemfood.func_150905_g(itemstack)); + this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, null); } @@ -362,31 +332,24 @@ public class EntityBloodHound extends EntityTameable } } - if (this.func_152114_e(p_70085_1_) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) - { + if (this.func_152114_e(p_70085_1_) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); this.setTarget(null); this.setAttackTarget(null); } - } - else if (itemstack != null && itemstack.getItem() == Items.bone && !this.isAngry()) - { - if (!p_70085_1_.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem() == Items.bone && !this.isAngry()) { + if (!p_70085_1_.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(3) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(3) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -394,12 +357,10 @@ public class EntityBloodHound extends EntityTameable this.setHealth(20.0F); this.func_152115_b(p_70085_1_.getUniqueID().toString()); this.playTameEffect(true); - this.worldObj.setEntityState(this, (byte)7); - } - else - { + this.worldObj.setEntityState(this, (byte) 7); + } else { this.playTameEffect(false); - this.worldObj.setEntityState(this, (byte)6); + this.worldObj.setEntityState(this, (byte) 6); } } @@ -410,96 +371,84 @@ public class EntityBloodHound extends EntityTameable } @SideOnly(Side.CLIENT) - public void handleHealthUpdate(byte p_70103_1_) - { - if (p_70103_1_ == 8) - { + public void handleHealthUpdate(byte p_70103_1_) { + if (p_70103_1_ == 8) { this.field_70928_h = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; - } - else - { + } else { super.handleHealthUpdate(p_70103_1_); } } @SideOnly(Side.CLIENT) - public float getTailRotation() - { - return this.isAngry() ? 1.5393804F : (this.isTamed() ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F)); + public float getTailRotation() { + return this.isAngry() + ? 1.5393804F + : (this.isTamed() + ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float) Math.PI + : ((float) Math.PI / 5F)); } /** * Will return how many at most can spawn in a chunk at once. */ - public int getMaxSpawnedInChunk() - { + public int getMaxSpawnedInChunk() { return 8; } /** * Determines whether this wolf is angry or not. */ - public boolean isAngry() - { + public boolean isAngry() { return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; } /** * Sets whether this wolf is angry or not. */ - public void setAngry(boolean p_70916_1_) - { + public void setAngry(boolean p_70916_1_) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (p_70916_1_) - { + if (p_70916_1_) { this.dataWatcher.updateObject(16, b0 | 2); - } - else - { + } else { this.dataWatcher.updateObject(16, b0 & -3); } } - public boolean func_70922_bv() - { + public boolean func_70922_bv() { return this.dataWatcher.getWatchableObjectByte(19) == 1; } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return !this.isTamed() && this.ticksExisted > 2400; } - public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) - { - if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) - { - if (p_142018_1_ instanceof EntityWolf) - { - EntityWolf entitywolf = (EntityWolf)p_142018_1_; + public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) { + if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) { + if (p_142018_1_ instanceof EntityWolf) { + EntityWolf entitywolf = (EntityWolf) p_142018_1_; - if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_) { return false; } } - return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame(); - } - else - { + return p_142018_1_ instanceof EntityPlayer + && p_142018_2_ instanceof EntityPlayer + && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) + ? false + : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame(); + } else { return false; } } - public EntityWolf createChild(EntityAgeable p_90011_1_) - { + public EntityWolf createChild(EntityAgeable p_90011_1_) { EntityWolf entitywolf = new EntityWolf(this.worldObj); return entitywolf; diff --git a/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGui.java b/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGui.java index dde1f4d..bf9eb03 100644 --- a/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGui.java +++ b/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGui.java @@ -1,37 +1,40 @@ package com.arc.bloodarsenal.common.gui; +import static com.arc.bloodarsenal.common.BloodArsenalConfig.*; + import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.client.config.*; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigElement; -import java.util.ArrayList; -import java.util.List; +public class ConfigGui extends GuiConfig { + public ConfigGui(GuiScreen parentScreen) { + super( + parentScreen, + getConfigElements(parentScreen), + BloodArsenal.MODID, + false, + false, + "BloodArsenal Configuration"); + } -import static com.arc.bloodarsenal.common.BloodArsenalConfig.*; + @SuppressWarnings("rawtypes") + private static List getConfigElements(GuiScreen parent) { + List list = new ArrayList(); -public class ConfigGui extends GuiConfig -{ - public ConfigGui(GuiScreen parentScreen) - { - super(parentScreen, getConfigElements(parentScreen), BloodArsenal.MODID, false, false, "BloodArsenal Configuration"); - } - - @SuppressWarnings("rawtypes") - private static List getConfigElements(GuiScreen parent) - { - List list = new ArrayList(); - - // Adds sections declared in BloodArsenalConfig. toLowerCase() is used because the configuration class automatically does this, so must we. - list.add(new ConfigElement(config.getCategory(potionId.toLowerCase()))); - list.add(new ConfigElement(config.getCategory(ritualBlacklist.toLowerCase()))); + // Adds sections declared in BloodArsenalConfig. toLowerCase() is used because the configuration class + // automatically does this, so must we. + list.add(new ConfigElement(config.getCategory(potionId.toLowerCase()))); + list.add(new ConfigElement(config.getCategory(ritualBlacklist.toLowerCase()))); list.add(new ConfigElement(config.getCategory(blockSettings.toLowerCase()))); - list.add(new ConfigElement(config.getCategory(itemSettings.toLowerCase()))); - list.add(new ConfigElement(config.getCategory(modSettings.toLowerCase()))); - list.add(new ConfigElement(config.getCategory(lpSettings.toLowerCase()))); - list.add(new ConfigElement(config.getCategory(misc.toLowerCase()))); + list.add(new ConfigElement(config.getCategory(itemSettings.toLowerCase()))); + list.add(new ConfigElement(config.getCategory(modSettings.toLowerCase()))); + list.add(new ConfigElement(config.getCategory(lpSettings.toLowerCase()))); + list.add(new ConfigElement(config.getCategory(misc.toLowerCase()))); - return list; - } -} \ No newline at end of file + return list; + } +} diff --git a/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGuiFactory.java b/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGuiFactory.java index e38bc52..ac9fffc 100644 --- a/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGuiFactory.java +++ b/src/main/java/com/arc/bloodarsenal/common/gui/ConfigGuiFactory.java @@ -1,31 +1,26 @@ package com.arc.bloodarsenal.common.gui; import cpw.mods.fml.client.IModGuiFactory; +import java.util.Set; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import java.util.Set; +public class ConfigGuiFactory implements IModGuiFactory { + @Override + public void initialize(Minecraft minecraftInstance) {} -public class ConfigGuiFactory implements IModGuiFactory -{ - @Override - public void initialize(Minecraft minecraftInstance) {} + @Override + public Class mainConfigGuiClass() { + return ConfigGui.class; + } - @Override - public Class mainConfigGuiClass() - { - return ConfigGui.class; - } + @Override + public Set runtimeGuiCategories() { + return null; + } - @Override - public Set runtimeGuiCategories() - { - return null; - } - - @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) - { - return null; - } + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { + return null; + } } diff --git a/src/main/java/com/arc/bloodarsenal/common/gui/GuiHandler.java b/src/main/java/com/arc/bloodarsenal/common/gui/GuiHandler.java index 8c18d78..2f8cb61 100644 --- a/src/main/java/com/arc/bloodarsenal/common/gui/GuiHandler.java +++ b/src/main/java/com/arc/bloodarsenal/common/gui/GuiHandler.java @@ -7,13 +7,10 @@ import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class GuiHandler implements IGuiHandler -{ +public class GuiHandler implements IGuiHandler { @Override - public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) - { - switch (id) - { + public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + switch (id) { case 0: return new ContainerAugmentedHolding(player, new InventoryAugmentedHolding(player.getHeldItem())); } @@ -22,10 +19,8 @@ public class GuiHandler implements IGuiHandler } @Override - public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) - { - switch (id) - { + public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + switch (id) { case 0: return new GuiAugmentedHolding(player, new InventoryAugmentedHolding(player.getHeldItem())); } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodArsenal.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodArsenal.java index 17340ff..2405f9a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodArsenal.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodArsenal.java @@ -2,28 +2,33 @@ package com.arc.bloodarsenal.common.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import java.util.List; - -public class ItemBloodArsenal extends Item -{ - private static final String[] ITEM_NAMES = new String[] {"amorphic_catalyst", "blood_infused_stick", "blood_infused_iron", "soul_fragment", "orange_juice", "blood_infused_glowstone_dust", "wolf_hide"}; +public class ItemBloodArsenal extends Item { + private static final String[] ITEM_NAMES = new String[] { + "amorphic_catalyst", + "blood_infused_stick", + "blood_infused_iron", + "soul_fragment", + "orange_juice", + "blood_infused_glowstone_dust", + "wolf_hide" + }; @SideOnly(Side.CLIENT) private IIcon[] icons; - public ItemBloodArsenal() - { + public ItemBloodArsenal() { super(); -// setCreativeTab(BloodArsenal.BA_TAB); + // setCreativeTab(BloodArsenal.BA_TAB); } -/* @Override + /* @Override public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[ITEM_NAMES.length]; @@ -43,60 +48,53 @@ public class ItemBloodArsenal extends Item } */ -// String unlocalizedName = this.getUnlocalizedName().replaceAll("item.", ""); -// itemIcon = iconRegister.registerIcon(BloodArsenal.MODID + ":" + unlocalizedName); + // String unlocalizedName = this.getUnlocalizedName().replaceAll("item.", ""); + // itemIcon = iconRegister.registerIcon(BloodArsenal.MODID + ":" + unlocalizedName); -/* if (this.equals(ModItems.amorphic_catalyst)) - itemIcon = iconRegister.registerIcon("BloodArsenal:amorphic_catalyst"); - else if (this.equals(ModItems.blood_infused_iron)) - itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_iron"); - else if (this.equals(ModItems.soul_fragment)) - itemIcon = iconRegister.registerIcon("BloodArsenal:soul_fragment"); - else if (this.equals(ModItems.heart)) - itemIcon = iconRegister.registerIcon("BloodArsenal:heart"); - else if (this.equals(ModItems.blood_infused_stick)) - itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_stick"); - else if (this.equals(ModItems.blood_cookie)) - itemIcon = iconRegister.registerIcon("BloodArsenal:blood_cookie"); - else if (this.equals(ModItems.orange_juice)) - itemIcon = iconRegister.registerIcon("BloodArsenal:orange_juice"); - else if (this.equals(ModItems.blood_infused_glowstone_dust)) - itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_glowstone_dust"); - else if (this.equals(ModItems.wolf_hide)) - itemIcon = iconRegister.registerIcon("BloodArsenal:wolf_hide"); - else if (this.equals(ModItems.blood_burned_string)) - itemIcon = iconRegister.registerIcon("BloodArsenal:blood_burned_string"); - else if (this.equals(ModItems.glass_shard)) - itemIcon = iconRegister.registerIcon("BloodArsenal:glass_shard"); + /* if (this.equals(ModItems.amorphic_catalyst)) + itemIcon = iconRegister.registerIcon("BloodArsenal:amorphic_catalyst"); + else if (this.equals(ModItems.blood_infused_iron)) + itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_iron"); + else if (this.equals(ModItems.soul_fragment)) + itemIcon = iconRegister.registerIcon("BloodArsenal:soul_fragment"); + else if (this.equals(ModItems.heart)) + itemIcon = iconRegister.registerIcon("BloodArsenal:heart"); + else if (this.equals(ModItems.blood_infused_stick)) + itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_stick"); + else if (this.equals(ModItems.blood_cookie)) + itemIcon = iconRegister.registerIcon("BloodArsenal:blood_cookie"); + else if (this.equals(ModItems.orange_juice)) + itemIcon = iconRegister.registerIcon("BloodArsenal:orange_juice"); + else if (this.equals(ModItems.blood_infused_glowstone_dust)) + itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_glowstone_dust"); + else if (this.equals(ModItems.wolf_hide)) + itemIcon = iconRegister.registerIcon("BloodArsenal:wolf_hide"); + else if (this.equals(ModItems.blood_burned_string)) + itemIcon = iconRegister.registerIcon("BloodArsenal:blood_burned_string"); + else if (this.equals(ModItems.glass_shard)) + itemIcon = iconRegister.registerIcon("BloodArsenal:glass_shard"); - } -*/ + } + */ @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - if (this.equals(ModItems.amorphic_catalyst)) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (this.equals(ModItems.amorphic_catalyst)) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.amorphic_catalyst")); } - if (this.equals(ModItems.blood_infused_stick)) - { + if (this.equals(ModItems.blood_infused_stick)) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.blood_infused_stick")); } - if (this.equals(ModItems.blood_infused_iron)) - { + if (this.equals(ModItems.blood_infused_iron)) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.blood_infused_iron1")); par3List.add(StatCollector.translateToLocal("tooltip.itemba.blood_infused_iron2")); } - if (this.equals(ModItems.heart)) - { + if (this.equals(ModItems.heart)) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.heart")); } - if (this.equals(ModItems.soul_fragment)) - { + if (this.equals(ModItems.soul_fragment)) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.soul_fragment")); } - if (this.equals(ModItems.glass_shard)) - { + if (this.equals(ModItems.glass_shard)) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.glass_shard")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodCookie.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodCookie.java index 637ffaf..82842bb 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodCookie.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodCookie.java @@ -1,6 +1,7 @@ package com.arc.bloodarsenal.common.items; import com.arc.bloodarsenal.common.BloodArsenal; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; @@ -9,12 +10,8 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class ItemBloodCookie extends ItemFood -{ - public ItemBloodCookie() - { +public class ItemBloodCookie extends ItemFood { + public ItemBloodCookie() { super(2, 0.3F, false); setUnlocalizedName("blood_cookie"); setTextureName("BloodArsenal:blood_cookie"); @@ -23,20 +20,15 @@ public class ItemBloodCookie extends ItemFood } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.blood_cookie")); } @Override - public void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!par2World.isRemote) - { + public void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!par2World.isRemote) { par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 20, 2)); - } - else - { + } else { super.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodMoney.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodMoney.java index 6d9f87e..3ea7389 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodMoney.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodMoney.java @@ -6,6 +6,7 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import com.arc.bloodarsenal.common.BloodArsenal; 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.entity.player.EntityPlayer; @@ -17,17 +18,13 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class ItemBloodMoney extends Item -{ - private final int[] MONEY_MULTIPLIER = new int[]{1, 4, 16, 64}; +public class ItemBloodMoney extends Item { + private final int[] MONEY_MULTIPLIER = new int[] {1, 4, 16, 64}; @SideOnly(Side.CLIENT) private IIcon[] icons; - public ItemBloodMoney() - { + public ItemBloodMoney() { super(); setUnlocalizedName("blood_money"); setCreativeTab(BloodArsenal.BA_TAB); @@ -36,19 +33,16 @@ public class ItemBloodMoney extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[MONEY_MULTIPLIER.length]; - for (int i = 0; i < MONEY_MULTIPLIER.length; ++i) - { + for (int i = 0; i < MONEY_MULTIPLIER.length; ++i) { icons[i] = iconRegister.registerIcon("BloodArsenal:" + "blood_money" + MONEY_MULTIPLIER[i]); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { String player = par3EntityPlayer.getCommandSenderName(); World world = par3EntityPlayer.worldObj; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, player); @@ -56,69 +50,55 @@ public class ItemBloodMoney extends Item int currentEssence = SoulNetworkHandler.getCurrentEssence(player); int CONSTANT = 10000; - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(player); world.setItemData(player, data); } - if (world.isRemote) - { + if (world.isRemote) { return par1ItemStack; } - if (SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) - { + if (SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) { return par1ItemStack; } int meta = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, MONEY_MULTIPLIER.length - 1); - if (meta == 0) - { - if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) - { + if (meta == 0) { + if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) + && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) { SoulNetworkHandler.addCurrentEssenceToMaximum(player, MONEY_MULTIPLIER[meta] * CONSTANT, maxLP); - } - else - { - par3EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); + } else { + par3EntityPlayer.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); return par1ItemStack; } - } - else if (meta == 1) - { - if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) - { + } else if (meta == 1) { + if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) + && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) { SoulNetworkHandler.addCurrentEssenceToMaximum(player, MONEY_MULTIPLIER[meta] * CONSTANT, maxLP); - } - else - { - par3EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); + } else { + par3EntityPlayer.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); return par1ItemStack; } - } - else if (meta == 2) - { - if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) - { + } else if (meta == 2) { + if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) + && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) { SoulNetworkHandler.addCurrentEssenceToMaximum(player, MONEY_MULTIPLIER[meta] * CONSTANT, maxLP); - } - else - { - par3EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); + } else { + par3EntityPlayer.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); return par1ItemStack; } - } - else if (meta == 3) - { - if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) - { + } else if (meta == 3) { + if ((maxLP - currentEssence) >= (MONEY_MULTIPLIER[meta] * CONSTANT) + && maxLP >= (MONEY_MULTIPLIER[meta] * CONSTANT)) { SoulNetworkHandler.addCurrentEssenceToMaximum(player, MONEY_MULTIPLIER[meta] * CONSTANT, maxLP); - } - else - { - par3EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); + } else { + par3EntityPlayer.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.bloodMoney.tooMuch"))); return par1ItemStack; } } @@ -129,8 +109,7 @@ public class ItemBloodMoney extends Item } @Override - public String getUnlocalizedName(ItemStack itemStack) - { + public String getUnlocalizedName(ItemStack itemStack) { int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, MONEY_MULTIPLIER.length - 1); return ("" + "item.blood_money" + MONEY_MULTIPLIER[meta]); @@ -138,25 +117,21 @@ public class ItemBloodMoney extends Item @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { + public IIcon getIconFromDamage(int meta) { int j = MathHelper.clamp_int(meta, 0, MONEY_MULTIPLIER.length - 1); return icons[j]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < MONEY_MULTIPLIER.length; ++meta) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { + for (int meta = 0; meta < MONEY_MULTIPLIER.length; ++meta) { list.add(new ItemStack(id, 1, meta)); } } @Override - public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.bloodMoney.money")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodOrange.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodOrange.java index d2ef040..1d7f290 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodOrange.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemBloodOrange.java @@ -1,17 +1,14 @@ package com.arc.bloodarsenal.common.items; import com.arc.bloodarsenal.common.BloodArsenal; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.List; - -public class ItemBloodOrange extends ItemFood -{ - public ItemBloodOrange() - { +public class ItemBloodOrange extends ItemFood { + public ItemBloodOrange() { super(2, 0.2F, false); setUnlocalizedName("blood_orange"); setTextureName("BloodArsenal:blood_orange"); @@ -19,8 +16,7 @@ public class ItemBloodOrange extends ItemFood } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.blood_orange")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemBoundDiamondShards.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemBoundDiamondShards.java index 1056eac..f4abdea 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemBoundDiamondShards.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemBoundDiamondShards.java @@ -2,6 +2,7 @@ package com.arc.bloodarsenal.common.items; 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.entity.player.EntityPlayer; @@ -11,36 +12,29 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; -import java.util.List; - -public class ItemBoundDiamondShards extends Item -{ - private final String[] shardTypes = new String[]{"", "air", "earth", "fire", "water", "dusk", "dawn"}; +public class ItemBoundDiamondShards extends Item { + private final String[] shardTypes = new String[] {"", "air", "earth", "fire", "water", "dusk", "dawn"}; @SideOnly(Side.CLIENT) private IIcon[] icons; - public ItemBoundDiamondShards() - { + public ItemBoundDiamondShards() { super(); setHasSubtypes(true); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[shardTypes.length]; - for (int i = 0; i < shardTypes.length; ++i) - { + for (int i = 0; i < shardTypes.length; ++i) { icons[i] = iconRegister.registerIcon("BloodArsenal:" + "bound_diamond_shard_" + shardTypes[i]); } } @Override - public String getUnlocalizedName(ItemStack itemStack) - { + public String getUnlocalizedName(ItemStack itemStack) { int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, shardTypes.length - 1); return "item.bound_diamond_shard_" + shardTypes[meta]; @@ -48,25 +42,21 @@ public class ItemBoundDiamondShards extends Item @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { + public IIcon getIconFromDamage(int meta) { int j = MathHelper.clamp_int(meta, 0, shardTypes.length - 1); return icons[j]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < shardTypes.length; ++meta) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { + for (int meta = 0; meta < shardTypes.length; ++meta) { list.add(new ItemStack(id, 1, meta)); } } @Override - public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.boundDiamondShard.shard")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemJuiceAndCookies.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemJuiceAndCookies.java index 5735995..7ab6f94 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemJuiceAndCookies.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemJuiceAndCookies.java @@ -1,6 +1,7 @@ package com.arc.bloodarsenal.common.items; import com.arc.bloodarsenal.common.BloodArsenal; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; @@ -8,12 +9,8 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.List; - -public class ItemJuiceAndCookies extends ItemFood -{ - public ItemJuiceAndCookies() - { +public class ItemJuiceAndCookies extends ItemFood { + public ItemJuiceAndCookies() { super(6, 0.6F, false); setMaxStackSize(1); setUnlocalizedName("juice_and_cookies"); @@ -23,21 +20,16 @@ public class ItemJuiceAndCookies extends ItemFood } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add("Eat after losing"); par3List.add("some blood"); } @Override - public void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!par2World.isRemote) - { + public void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!par2World.isRemote) { par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 40, 4)); - } - else - { + } else { super.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulBooster.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulBooster.java index c2faa21..9deb372 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulBooster.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulBooster.java @@ -3,6 +3,7 @@ package com.arc.bloodarsenal.common.items; import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -13,12 +14,8 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class ItemSoulBooster extends Item implements IBindable -{ - public ItemSoulBooster() - { +public class ItemSoulBooster extends Item implements IBindable { + public ItemSoulBooster() { super(); setMaxStackSize(1); setUnlocalizedName("soul_booster"); @@ -27,20 +24,17 @@ public class ItemSoulBooster extends Item implements IBindable } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); setActivated(par1ItemStack, !getActivated(par1ItemStack)); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } @@ -48,30 +42,25 @@ public class ItemSoulBooster extends Item implements IBindable } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 1000); } } - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 2, 0)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 2, 0)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.jump.id, 2, 0)); @@ -80,24 +69,20 @@ public class ItemSoulBooster extends Item implements IBindable } } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { + public boolean getActivated(ItemStack par1ItemStack) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -105,24 +90,18 @@ public class ItemSoulBooster extends Item implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.soul_booster1")); par3List.add(StatCollector.translateToLocal("tooltip.itemba.soul_booster2")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulNullifier.java b/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulNullifier.java index 91d3022..6c8dff9 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulNullifier.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ItemSoulNullifier.java @@ -4,6 +4,8 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.ReflectionHelper; +import java.util.Collection; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -14,13 +16,8 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.Collection; -import java.util.List; - -public class ItemSoulNullifier extends Item implements IBindable -{ - public ItemSoulNullifier() - { +public class ItemSoulNullifier extends Item implements IBindable { + public ItemSoulNullifier() { super(); setMaxStackSize(1); setUnlocalizedName("soul_nullifier"); @@ -29,20 +26,17 @@ public class ItemSoulNullifier extends Item implements IBindable } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); setActivated(par1ItemStack, !getActivated(par1ItemStack)); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } @@ -50,81 +44,68 @@ public class ItemSoulNullifier extends Item implements IBindable } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50); } } - if (par1ItemStack.stackTagCompound.getBoolean("isActive") && !par2World.isRemote) - { - if (par3EntityPlayer.ticksExisted % 20 == 0) - { + if (par1ItemStack.stackTagCompound.getBoolean("isActive") && !par2World.isRemote) { + if (par3EntityPlayer.ticksExisted % 20 == 0) { boolean removed = false; Collection potions = par3EntityPlayer.getActivePotionEffects(); - if (par3EntityPlayer.isBurning()) - { + if (par3EntityPlayer.isBurning()) { par3EntityPlayer.extinguish(); removed = true; - } - else for (PotionEffect potion : potions) - { - int id = potion.getPotionID(); - boolean badEffect; + } else + for (PotionEffect potion : potions) { + int id = potion.getPotionID(); + boolean badEffect; - badEffect = ReflectionHelper.getPrivateValue(Potion.class, Potion.potionTypes[id], new String[]{"isBadEffect", "field_76418_K"}); + badEffect = ReflectionHelper.getPrivateValue( + Potion.class, Potion.potionTypes[id], new String[] {"isBadEffect", "field_76418_K"}); - if (badEffect) - { - par3EntityPlayer.removePotionEffect(id); - removed = true; - break; + if (badEffect) { + par3EntityPlayer.removePotionEffect(id); + removed = true; + break; + } } - } - if (removed) - { + if (removed) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 500); } } } } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { + public boolean getActivated(ItemStack par1ItemStack) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -132,24 +113,18 @@ public class ItemSoulNullifier extends Item implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.itemba.soul_nullifier1")); par3List.add(StatCollector.translateToLocal("tooltip.itemba.soul_nullifier2")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/ModItems.java b/src/main/java/com/arc/bloodarsenal/common/items/ModItems.java index bc32e4b..f0b231b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/ModItems.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/ModItems.java @@ -15,6 +15,8 @@ import com.arc.bloodarsenal.common.items.tool.*; import com.arc.bloodarsenal.common.thaumcraft.*; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.Arrays; import net.minecraft.item.Item; import net.minecraft.item.ItemReed; import net.minecraft.item.ItemStack; @@ -24,11 +26,7 @@ import thaumcraft.api.wands.StaffRod; import thaumcraft.api.wands.WandCap; import thaumcraft.api.wands.WandRod; -import java.util.ArrayList; -import java.util.Arrays; - -public class ModItems -{ +public class ModItems { public static Item bound_bow; public static Item blood_orange; public static Item blood_infused_pickaxe_wood; @@ -103,8 +101,7 @@ public class ModItems public static ArrayList itemsNotToBeRegistered = new ArrayList(); - public static void init() - { + public static void init() { bound_bow = registerItem(new BoundBow(), "bound_bow"); blood_orange = registerItem(new ItemBloodOrange(), "blood_orange"); blood_infused_pickaxe_wood = registerItem(new InfusedWoodPickaxe(), "blood_infused_pickaxe_wood"); @@ -165,44 +162,58 @@ public class ModItems } @Optional.Method(modid = "Baubles") - public static void registerBaubles() - { + public static void registerBaubles() { vampire_ring = registerItem(new VampireRing(), "vampire_ring"); self_sacrifice_amulet = registerItem(new SelfSacrificeAmulet(), "self_sacrifice_amulet"); sacrifice_amulet = registerItem(new SacrificeAmulet(), "sacrifice_amulet"); empowered_sacrifice_amulet = registerItem(new EmpoweredSacrificeAmulet(), "empowered_sacrifice_amulet"); - empowered_self_sacrifice_amulet = registerItem(new EmpoweredSelfSacrificeAmulet(), "empowered_self_sacrifice_amulet"); + empowered_self_sacrifice_amulet = + registerItem(new EmpoweredSelfSacrificeAmulet(), "empowered_self_sacrifice_amulet"); } @Optional.Method(modid = "Thaumcraft") - public static void registerThaumcraftItems() - { + public static void registerThaumcraftItems() { wandCore = (new ItemWandCores()).setUnlocalizedName("wand_cores"); GameRegistry.registerItem(wandCore, "wand_cores"); wandCap = (new ItemWandCaps()).setUnlocalizedName("wand_caps"); GameRegistry.registerItem(wandCap, "wand_caps"); - WAND_ROD_BLOOD_INFUSED_WOOD = new WandRod("blood_wood", 100, new ItemStack(wandCore, 1, 0), 16, new BloodWoodWandUpdate(), new ResourceLocation("bloodarsenal", "models/wand_rod_blood_wood.png")); - STAFF_ROD_BLOOD_INFUSED_WOOD = new StaffRod("blood_wood", 60, new ItemStack(wandCore, 1, 1), 27, new BloodWoodStaffUpdate(), new ResourceLocation("bloodarsenal", "models/wand_rod_blood_wood.png")); - WAND_CAP_BLOOD_INFUSED_IRON = new BloodyWandCap("blood_iron", 0.85F, Arrays.asList(new Aspect[]{Aspect.WATER}), 0.80F, new ItemStack(wandCap, 1, 0), 5, new ResourceLocation("bloodarsenal", "models/wand_cap_blood_iron.png")); + WAND_ROD_BLOOD_INFUSED_WOOD = new WandRod( + "blood_wood", + 100, + new ItemStack(wandCore, 1, 0), + 16, + new BloodWoodWandUpdate(), + new ResourceLocation("bloodarsenal", "models/wand_rod_blood_wood.png")); + STAFF_ROD_BLOOD_INFUSED_WOOD = new StaffRod( + "blood_wood", + 60, + new ItemStack(wandCore, 1, 1), + 27, + new BloodWoodStaffUpdate(), + new ResourceLocation("bloodarsenal", "models/wand_rod_blood_wood.png")); + WAND_CAP_BLOOD_INFUSED_IRON = new BloodyWandCap( + "blood_iron", + 0.85F, + Arrays.asList(new Aspect[] {Aspect.WATER}), + 0.80F, + new ItemStack(wandCap, 1, 0), + 5, + new ResourceLocation("bloodarsenal", "models/wand_cap_blood_iron.png")); } - public static Item registerItem(Item item, String unlocalizedName) - { + public static Item registerItem(Item item, String unlocalizedName) { item.setUnlocalizedName(unlocalizedName); item.setTextureName(BloodArsenal.MODID + ":" + unlocalizedName); item.setCreativeTab(BloodArsenal.BA_TAB); itemsNotToBeRegistered.clear(); - for (String unlocName : BloodArsenalConfig.itemsToBeDisabled) - { - if (unlocName.equals(unlocalizedName)) - { + for (String unlocName : BloodArsenalConfig.itemsToBeDisabled) { + if (unlocName.equals(unlocalizedName)) { itemsNotToBeRegistered.add(unlocName); } } - if (!itemsNotToBeRegistered.contains(unlocalizedName)) - { + if (!itemsNotToBeRegistered.contains(unlocalizedName)) { GameRegistry.registerItem(item, unlocalizedName); } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/armor/ElementalLifeImbuedArmor.java b/src/main/java/com/arc/bloodarsenal/common/items/armor/ElementalLifeImbuedArmor.java index 3c6bb8f..01b271c 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/armor/ElementalLifeImbuedArmor.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/armor/ElementalLifeImbuedArmor.java @@ -4,6 +4,8 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.items.ModItems; import com.arc.bloodarsenal.common.items.tool.IFillable; +import java.util.List; +import java.util.Random; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -22,37 +24,28 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; -import java.util.List; -import java.util.Random; - -public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillable -{ +public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillable { private final int maxLP = 100000; private String LP_STORED = "LPStored"; - public ElementalLifeImbuedArmor(int armorType) - { + public ElementalLifeImbuedArmor(int armorType) { super(BloodArsenal.elementalLifeImbuedArmor, 0, armorType); } /** IFillable */ @Override - public int getMaxLP() - { + public int getMaxLP() { return maxLP; } @Override - public void incrementLPStored(ItemStack itemStack, int incrementAmount) - { + public void incrementLPStored(ItemStack itemStack, int incrementAmount) { setCurrentLPStored(itemStack, getLPStored(itemStack) + incrementAmount); } @Override - public int getLPStored(ItemStack container) - { - if (container.stackTagCompound == null) - { + public int getLPStored(ItemStack container) { + if (container.stackTagCompound == null) { setCurrentLPStored(container, 0); } @@ -60,66 +53,54 @@ public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.armor.elementalLifeImbuedArmor")); - par3List.add(StatCollector.translateToLocal("tooltip.fillable.currentAmount") + " " + EnumChatFormatting.RED + par1ItemStack.getTagCompound().getInteger(LP_STORED)); + par3List.add(StatCollector.translateToLocal("tooltip.fillable.currentAmount") + " " + EnumChatFormatting.RED + + par1ItemStack.getTagCompound().getInteger(LP_STORED)); } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - if (this != ModItems.life_imbued_leggings) - { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (this != ModItems.life_imbued_leggings) { return "BloodArsenal:models/armor/life_imbued_layer_1.png"; - } - else - { + } else { return "BloodArsenal:models/armor/life_imbued_layer_2.png"; } } @Override - public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) - { + public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { return false; } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); } @Override - public int getMaxDamage(ItemStack stack) - { + public int getMaxDamage(ItemStack stack) { return maxLP; } @Override - public EnumRarity getRarity(ItemStack stack) - { + public EnumRarity getRarity(ItemStack stack) { return EnumRarity.rare; } @Override - public void setDamage(ItemStack stack, int damage) - { + public void setDamage(ItemStack stack, int damage) { super.setDamage(stack, 0); } @Override - public boolean isDamaged(ItemStack stack) - { + public boolean isDamaged(ItemStack stack) { return true; } @Override - public int getDisplayDamage(ItemStack stack) - { - if (stack.stackTagCompound == null) - { + public int getDisplayDamage(ItemStack stack) { + if (stack.stackTagCompound == null) { setCurrentLPStored(stack, 0); } @@ -127,22 +108,18 @@ public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor } @Override - public boolean showDurabilityBar(ItemStack stack) - { + public boolean showDurabilityBar(ItemStack stack) { return stack.stackTagCompound == null || !stack.stackTagCompound.getBoolean("CreativeTab"); } @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { + public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(setCurrentLPStored(new ItemStack(item, 1, 0), 0)); list.add(setCurrentLPStored(new ItemStack(item, 1, 0), maxLP)); } - private ItemStack setCurrentLPStored(ItemStack itemStack, int amount) - { - if (itemStack.stackTagCompound == null) - { + private ItemStack setCurrentLPStored(ItemStack itemStack, int amount) { + if (itemStack.stackTagCompound == null) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -150,15 +127,12 @@ public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor return itemStack; } - protected int getBaseAbsorption() - { + protected int getBaseAbsorption() { return 18; } - protected int getAbsorptionRatio() - { - switch (armorType) - { + protected int getAbsorptionRatio() { + switch (armorType) { case 0: return 15; case 1: @@ -173,54 +147,49 @@ public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) - { - if (getLPStored(armor) >= getLPPerDamage(armor)) - { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + if (getLPStored(armor) >= getLPPerDamage(armor)) { return Math.min(getBaseAbsorption(), 20) * getAbsorptionRatio() / 100; } return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) - { + public ArmorProperties getProperties( + EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { final double absorbRatio = 0.5; - if (source.isUnblockable()) - { + if (source.isUnblockable()) { int absorbMax = getLPPerDamage(armor) > 0 ? 25 * getLPStored(armor) / getLPPerDamage(armor) : 0; - return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.025, absorbMax); + return new ArmorProperties( + 0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.025, absorbMax); } int absorbMax = getLPPerDamage(armor) > 0 ? 25 * getLPStored(armor) / getLPPerDamage(armor) : 0; - return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.05, absorbMax); + return new ArmorProperties( + 0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.05, absorbMax); } @Override - public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) - { + public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) { subtractLP(armor, damage * getLPPerDamage(armor), false); } - protected int getLPPerDamage(ItemStack stack) - { - int unbreakingLevel = MathHelper.clamp_int(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack), 0, 4); + protected int getLPPerDamage(ItemStack stack) { + int unbreakingLevel = MathHelper.clamp_int( + EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack), 0, 4); return 100 * (5 - unbreakingLevel) / 5; } - public int subtractLP(ItemStack container, int maxExtract, boolean simulate) - { - if (container.stackTagCompound == null) - { + public int subtractLP(ItemStack container, int maxExtract, boolean simulate) { + if (container.stackTagCompound == null) { setCurrentLPStored(container, 0); } int stored = container.stackTagCompound.getInteger(LP_STORED); int extract = Math.min(maxExtract, stored); - if (!simulate) - { + if (!simulate) { stored -= extract; container.stackTagCompound.setInteger(LP_STORED, stored); } @@ -229,21 +198,19 @@ public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor } @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack armor) - { - if (hasArmorSetItem(player, 0) && hasArmorSetItem(player, 1) && hasArmorSetItem(player, 2) && hasArmorSetItem(player, 3)) - { - if (player.getHealth() < player.getMaxHealth() && !player.isPotionActive(AlchemicalWizardry.customPotionInhibit)) - { - if (world.getWorldTime() % 50 == 0) - { + public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { + if (hasArmorSetItem(player, 0) + && hasArmorSetItem(player, 1) + && hasArmorSetItem(player, 2) + && hasArmorSetItem(player, 3)) { + if (player.getHealth() < player.getMaxHealth() + && !player.isPotionActive(AlchemicalWizardry.customPotionInhibit)) { + if (world.getWorldTime() % 50 == 0) { Random random = new Random(); - if (random.nextInt(9) > 7) - { + if (random.nextInt(9) > 7) { LifeImbuedArmor thisArmor = (LifeImbuedArmor) armor.getItem(); - if (thisArmor.getLPStored(armor) >= 2000) - { + if (thisArmor.getLPStored(armor) >= 2000) { float healHealth = player.getMaxHealth() - player.getHealth(); player.heal(healHealth); thisArmor.subtractLP(armor, ((int) healHealth) * 500, false); @@ -254,21 +221,22 @@ public class ElementalLifeImbuedArmor extends ItemArmor implements ISpecialArmor } } - public boolean hasArmorSetItem(EntityPlayer player, int i) - { + public boolean hasArmorSetItem(EntityPlayer player, int i) { ItemStack stack = player.inventory.armorInventory[3 - i]; - if (stack == null) - { + if (stack == null) { return false; } - switch (i) - { - case 0: return stack.getItem() == ModItems.life_imbued_helmet_water; - case 1: return stack.getItem() == ModItems.life_imbued_chestplate_fire; - case 2: return stack.getItem() == ModItems.life_imbued_leggings_earth; - case 3: return stack.getItem() == ModItems.life_imbued_boots_air; + switch (i) { + case 0: + return stack.getItem() == ModItems.life_imbued_helmet_water; + case 1: + return stack.getItem() == ModItems.life_imbued_chestplate_fire; + case 2: + return stack.getItem() == ModItems.life_imbued_leggings_earth; + case 3: + return stack.getItem() == ModItems.life_imbued_boots_air; } return false; diff --git a/src/main/java/com/arc/bloodarsenal/common/items/armor/GlassArmor.java b/src/main/java/com/arc/bloodarsenal/common/items/armor/GlassArmor.java index 657825e..dedc01e 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/armor/GlassArmor.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/armor/GlassArmor.java @@ -2,6 +2,7 @@ package com.arc.bloodarsenal.common.items.armor; import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.items.ModItems; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; @@ -9,38 +10,28 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class GlassArmor extends ItemArmor -{ - public GlassArmor(int armorType) - { +public class GlassArmor extends ItemArmor { + public GlassArmor(int armorType) { super(BloodArsenal.glassArmor, 1, armorType); setMaxDamage(42); // The answer to everything in the universe } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.armor.glassArmor")); } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - if (this != ModItems.glass_leggings) - { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (this != ModItems.glass_leggings) { return "BloodArsenal:models/armor/glass_layer_1.png"; - } - else - { + } else { return "BloodArsenal:models/armor/glass_layer_2.png"; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/armor/LifeImbuedArmor.java b/src/main/java/com/arc/bloodarsenal/common/items/armor/LifeImbuedArmor.java index 0e4b15a..a06813d 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/armor/LifeImbuedArmor.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/armor/LifeImbuedArmor.java @@ -4,6 +4,8 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.items.ModItems; import com.arc.bloodarsenal.common.items.tool.IFillable; +import java.util.List; +import java.util.Random; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -22,39 +24,30 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; -import java.util.List; -import java.util.Random; - -public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillable -{ +public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillable { private int maxLP = 100000; private String LP_STORED = "LPStored"; public double absorbRatio = 0.5; - public LifeImbuedArmor(int armorType) - { + public LifeImbuedArmor(int armorType) { super(BloodArsenal.lifeImbuedArmor, 0, armorType); setCreativeTab(BloodArsenal.BA_TAB); } /** IFillable */ @Override - public int getMaxLP() - { + public int getMaxLP() { return maxLP; } @Override - public void incrementLPStored(ItemStack itemStack, int incrementAmount) - { + public void incrementLPStored(ItemStack itemStack, int incrementAmount) { setCurrentLPStored(itemStack, getLPStored(itemStack) + incrementAmount); } @Override - public int getLPStored(ItemStack container) - { - if (container.stackTagCompound == null) - { + public int getLPStored(ItemStack container) { + if (container.stackTagCompound == null) { setCurrentLPStored(container, 0); } @@ -62,66 +55,54 @@ public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillab } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.armor.lifeImbuedArmor")); - par3List.add(StatCollector.translateToLocal("tooltip.fillable.currentAmount") + " " + EnumChatFormatting.RED + par1ItemStack.getTagCompound().getInteger(LP_STORED)); + par3List.add(StatCollector.translateToLocal("tooltip.fillable.currentAmount") + " " + EnumChatFormatting.RED + + par1ItemStack.getTagCompound().getInteger(LP_STORED)); } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - if (this != ModItems.life_imbued_leggings) - { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (this != ModItems.life_imbued_leggings) { return "BloodArsenal:models/armor/life_imbued_layer_1.png"; - } - else - { + } else { return "BloodArsenal:models/armor/life_imbued_layer_2.png"; } } @Override - public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) - { + public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { return false; } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); } @Override - public int getMaxDamage(ItemStack stack) - { + public int getMaxDamage(ItemStack stack) { return maxLP; } @Override - public EnumRarity getRarity(ItemStack stack) - { + public EnumRarity getRarity(ItemStack stack) { return EnumRarity.rare; } @Override - public void setDamage(ItemStack stack, int damage) - { + public void setDamage(ItemStack stack, int damage) { super.setDamage(stack, 0); } @Override - public boolean isDamaged(ItemStack stack) - { + public boolean isDamaged(ItemStack stack) { return true; } @Override - public int getDisplayDamage(ItemStack stack) - { - if (stack.stackTagCompound == null) - { + public int getDisplayDamage(ItemStack stack) { + if (stack.stackTagCompound == null) { setCurrentLPStored(stack, 0); } @@ -129,22 +110,18 @@ public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillab } @Override - public boolean showDurabilityBar(ItemStack stack) - { + public boolean showDurabilityBar(ItemStack stack) { return stack.stackTagCompound == null || !stack.stackTagCompound.getBoolean("CreativeTab"); } @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { + public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(setCurrentLPStored(new ItemStack(item, 1, 0), 0)); list.add(setCurrentLPStored(new ItemStack(item, 1, 0), maxLP)); } - private ItemStack setCurrentLPStored(ItemStack itemStack, int amount) - { - if (itemStack.stackTagCompound == null) - { + private ItemStack setCurrentLPStored(ItemStack itemStack, int amount) { + if (itemStack.stackTagCompound == null) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -152,15 +129,12 @@ public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillab return itemStack; } - protected int getBaseAbsorption() - { + protected int getBaseAbsorption() { return 18; } - protected int getAbsorptionRatio() - { - switch (armorType) - { + protected int getAbsorptionRatio() { + switch (armorType) { case 0: return 15; case 1: @@ -175,52 +149,47 @@ public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillab } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) - { - if (getLPStored(armor) >= getLPPerDamage(armor)) - { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + if (getLPStored(armor) >= getLPPerDamage(armor)) { return Math.min(getBaseAbsorption(), 20) * getAbsorptionRatio() / 100; } return 0; } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) - { - if (source.isUnblockable()) - { + public ArmorProperties getProperties( + EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + if (source.isUnblockable()) { int absorbMax = getLPPerDamage(armor) > 0 ? 25 * getLPStored(armor) / getLPPerDamage(armor) : 0; - return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.025, absorbMax); + return new ArmorProperties( + 0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.025, absorbMax); } int absorbMax = getLPPerDamage(armor) > 0 ? 25 * getLPStored(armor) / getLPPerDamage(armor) : 0; - return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.05, absorbMax); + return new ArmorProperties( + 0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.05, absorbMax); } @Override - public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) - { + public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) { subtractLP(armor, damage * getLPPerDamage(armor), false); } - protected int getLPPerDamage(ItemStack stack) - { - int unbreakingLevel = MathHelper.clamp_int(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack), 0, 4); + protected int getLPPerDamage(ItemStack stack) { + int unbreakingLevel = MathHelper.clamp_int( + EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack), 0, 4); return 100 * (5 - unbreakingLevel) / 5; } - public int subtractLP(ItemStack container, int maxExtract, boolean simulate) - { - if (container.stackTagCompound == null) - { + public int subtractLP(ItemStack container, int maxExtract, boolean simulate) { + if (container.stackTagCompound == null) { setCurrentLPStored(container, 0); } int stored = container.stackTagCompound.getInteger(LP_STORED); int extract = Math.min(maxExtract, stored); - if (!simulate) - { + if (!simulate) { stored -= extract; container.stackTagCompound.setInteger(LP_STORED, stored); } @@ -229,21 +198,19 @@ public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillab } @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack armor) - { - if (hasArmorSetItem(player, 0) && hasArmorSetItem(player, 1) && hasArmorSetItem(player, 2) && hasArmorSetItem(player, 3)) - { - if (player.getHealth() < player.getMaxHealth() && !player.isPotionActive(AlchemicalWizardry.customPotionInhibit)) - { - if (world.getWorldTime() % 50 == 0) - { + public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { + if (hasArmorSetItem(player, 0) + && hasArmorSetItem(player, 1) + && hasArmorSetItem(player, 2) + && hasArmorSetItem(player, 3)) { + if (player.getHealth() < player.getMaxHealth() + && !player.isPotionActive(AlchemicalWizardry.customPotionInhibit)) { + if (world.getWorldTime() % 50 == 0) { Random random = new Random(); - if (random.nextInt(9) > 7) - { + if (random.nextInt(9) > 7) { LifeImbuedArmor thisArmor = (LifeImbuedArmor) armor.getItem(); - if (thisArmor.getLPStored(armor) >= 2000) - { + if (thisArmor.getLPStored(armor) >= 2000) { float healHealth = player.getMaxHealth() - player.getHealth(); player.setHealth(player.getHealth() + healHealth); player.onUpdate(); @@ -255,21 +222,22 @@ public class LifeImbuedArmor extends ItemArmor implements ISpecialArmor, IFillab } } - public boolean hasArmorSetItem(EntityPlayer player, int i) - { + public boolean hasArmorSetItem(EntityPlayer player, int i) { ItemStack stack = player.inventory.armorInventory[3 - i]; - if (stack == null) - { + if (stack == null) { return false; } - switch (i) - { - case 0: return stack.getItem() == ModItems.life_imbued_helmet; - case 1: return stack.getItem() == ModItems.life_imbued_chestplate; - case 2: return stack.getItem() == ModItems.life_imbued_leggings; - case 3: return stack.getItem() == ModItems.life_imbued_boots; + switch (i) { + case 0: + return stack.getItem() == ModItems.life_imbued_helmet; + case 1: + return stack.getItem() == ModItems.life_imbued_chestplate; + case 2: + return stack.getItem() == ModItems.life_imbued_leggings; + case 3: + return stack.getItem() == ModItems.life_imbued_boots; } return false; diff --git a/src/main/java/com/arc/bloodarsenal/common/items/armor/VampireCostume.java b/src/main/java/com/arc/bloodarsenal/common/items/armor/VampireCostume.java index c0edd80..251f5a5 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/armor/VampireCostume.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/armor/VampireCostume.java @@ -1,8 +1,8 @@ package com.arc.bloodarsenal.common.items.armor; +import com.arc.bloodarsenal.client.renderer.model.ModelVampireCostume; import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.items.ModItems; -import com.arc.bloodarsenal.client.renderer.model.ModelVampireCostume; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBiped; @@ -19,19 +19,19 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class VampireCostume extends ItemArmor -{ +public class VampireCostume extends ItemArmor { @SideOnly(Side.CLIENT) private IIcon chestIcon; + @SideOnly(Side.CLIENT) private IIcon leggingsIcon; + @SideOnly(Side.CLIENT) private IIcon bootsIcon; private boolean tryComplexRendering = true; - public VampireCostume(int armorType) - { + public VampireCostume(int armorType) { super(BloodArsenal.vampireArmor, 0, armorType); setMaxDamage(0); } @@ -42,33 +42,25 @@ public class VampireCostume extends ItemArmor @Override @SideOnly(Side.CLIENT) - public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) - { - if (tryComplexRendering) - { + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { + if (tryComplexRendering) { int type = ((ItemArmor) itemStack.getItem()).armorType; - if (this.model1 == null) - { + if (this.model1 == null) { this.model1 = new ModelVampireCostume(1.0f, false, true, false, true); } - if (this.model2 == null) - { + if (this.model2 == null) { this.model2 = new ModelVampireCostume(0.5f, false, false, true, false); } - if (type == 1 || type == 3) - { + if (type == 1 || type == 3) { this.model = model1; - } - else - { + } else { this.model = model2; } - if (this.model != null) - { + if (this.model != null) { this.model.bipedHead.showModel = (type == 1); this.model.bipedHeadwear.showModel = (type == 1); this.model.bipedBody.showModel = (type == 1); @@ -82,18 +74,14 @@ public class VampireCostume extends ItemArmor this.model.aimedBow = false; this.model.heldItemRight = (entityLiving.getHeldItem() != null ? 1 : 0); - if (entityLiving instanceof EntityPlayer) - { - if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) - { - EnumAction enumaction = ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); + if (entityLiving instanceof EntityPlayer) { + if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { + EnumAction enumaction = + ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); - if (enumaction == EnumAction.block) - { + if (enumaction == EnumAction.block) { this.model.heldItemRight = 3; - } - else if (enumaction == EnumAction.bow) - { + } else if (enumaction == EnumAction.bow) { this.model.aimedBow = true; } } @@ -101,17 +89,14 @@ public class VampireCostume extends ItemArmor } return model; - } - else - { + } else { return super.getArmorModel(entityLiving, itemStack, armorSlot); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); chestIcon = iconRegister.registerIcon("BloodArsenal:vampire_cape"); leggingsIcon = iconRegister.registerIcon("BloodArsenal:vampire_greaves"); @@ -120,20 +105,16 @@ public class VampireCostume extends ItemArmor @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (equals(ModItems.vampire_cape)) - { + public IIcon getIconFromDamage(int par1) { + if (equals(ModItems.vampire_cape)) { return chestIcon; } - if (equals(ModItems.vampire_greaves)) - { + if (equals(ModItems.vampire_greaves)) { return leggingsIcon; } - if (equals(ModItems.vampire_boots)) - { + if (equals(ModItems.vampire_boots)) { return bootsIcon; } @@ -141,63 +122,48 @@ public class VampireCostume extends ItemArmor } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - if (tryComplexRendering) - { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (tryComplexRendering) { return "BloodArsenal:models/armor/VampireCostume.png"; } - if (entity instanceof EntityLivingBase) - { - if (this.getIsInvisible(stack)) - { - if (this == ModItems.vampire_cape || this == ModItems.vampire_boots) - { + if (entity instanceof EntityLivingBase) { + if (this.getIsInvisible(stack)) { + if (this == ModItems.vampire_cape || this == ModItems.vampire_boots) { return "BloodArsenal:models/armor/VampireCostume_invisible.png"; } - if (this == ModItems.vampire_greaves) - { + if (this == ModItems.vampire_greaves) { return "BloodArsenal:models/armor/VampireCostume_invisible2.png"; } } } - if (this == ModItems.vampire_cape || this == ModItems.vampire_boots) - { + if (this == ModItems.vampire_cape || this == ModItems.vampire_boots) { return "AlchemicalWizardry:models/armor/boundArmour_layer_1.png"; } - if (this == ModItems.vampire_greaves) - { + if (this == ModItems.vampire_greaves) { return "AlchemicalWizardry:models/armor/boundArmour_layer_2.png"; - } - else - { + } else { return null; } } @Override - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) - { + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return false; } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); } @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack armor) - { - if (hasArmorSetItem(player, 1) && hasArmorSetItem(player, 2) && hasArmorSetItem(player, 3)) - { - if (player.getActivePotionEffect(Potion.damageBoost) != null) - { + public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { + if (hasArmorSetItem(player, 1) && hasArmorSetItem(player, 2) && hasArmorSetItem(player, 3)) { + if (player.getActivePotionEffect(Potion.damageBoost) != null) { player.removePotionEffect(Potion.damageBoost.id); } @@ -207,43 +173,39 @@ public class VampireCostume extends ItemArmor setIsInvisible(armor, player.isPotionActive(Potion.invisibility.id)); } - public boolean hasArmorSetItem(EntityPlayer player, int i) - { + public boolean hasArmorSetItem(EntityPlayer player, int i) { ItemStack stack = player.inventory.armorInventory[3 - i]; - if (stack == null) - { + if (stack == null) { return false; } - switch (i) - { - case 1: return stack.getItem() == ModItems.vampire_cape; - case 2: return stack.getItem() == ModItems.vampire_greaves; - case 3: return stack.getItem() == ModItems.vampire_boots; + switch (i) { + case 1: + return stack.getItem() == ModItems.vampire_cape; + case 2: + return stack.getItem() == ModItems.vampire_greaves; + case 3: + return stack.getItem() == ModItems.vampire_boots; } return false; } - public boolean getIsInvisible(ItemStack itemStack) - { + public boolean getIsInvisible(ItemStack itemStack) { NBTTagCompound tag = itemStack.getTagCompound(); - if (tag != null) - { + if (tag != null) { return tag.getBoolean("invisible"); } return false; } - public void setIsInvisible(ItemStack itemStack, boolean invisible) - { + public void setIsInvisible(ItemStack itemStack, boolean invisible) { NBTTagCompound tag = itemStack.getTagCompound(); - if (tag == null) - { + if (tag == null) { itemStack.setTagCompound(new NBTTagCompound()); tag = itemStack.getTagCompound(); } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSacrificeAmulet.java b/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSacrificeAmulet.java index 6732f36..3ee42b6 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSacrificeAmulet.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSacrificeAmulet.java @@ -14,6 +14,7 @@ import com.arc.bloodarsenal.common.items.ModItems; import cpw.mods.fml.common.eventhandler.SubscribeEvent; 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.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -30,12 +31,8 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingDeathEvent; -import java.util.List; - -public class EmpoweredSacrificeAmulet extends SacrificeAmulet implements IBauble, IBindable -{ - public EmpoweredSacrificeAmulet() - { +public class EmpoweredSacrificeAmulet extends SacrificeAmulet implements IBauble, IBindable { + public EmpoweredSacrificeAmulet() { super(); setHasSubtypes(true); MinecraftForge.EVENT_BUS.register(this); @@ -43,34 +40,33 @@ public class EmpoweredSacrificeAmulet extends SacrificeAmulet implements IBauble @Override @SubscribeEvent - public void sacrificeHandler(LivingDeathEvent event) - { + public void sacrificeHandler(LivingDeathEvent event) { Entity killer = event.source.getEntity(); - if (killer != null && killer instanceof EntityPlayerMP && !(killer instanceof FakePlayer) && BloodArsenalConfig.baublesIntegration) - { + if (killer != null + && killer instanceof EntityPlayerMP + && !(killer instanceof FakePlayer) + && BloodArsenalConfig.baublesIntegration) { EntityLivingBase victim = event.entityLiving; EntityPlayer player = (EntityPlayer) killer; InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player); - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack != null) - { - if (stack.getItem() == ModItems.empowered_sacrifice_amulet) - { - EmpoweredSacrificeAmulet sacrificeAmulet = (EmpoweredSacrificeAmulet) ModItems.empowered_sacrifice_amulet; + if (stack != null) { + if (stack.getItem() == ModItems.empowered_sacrifice_amulet) { + EmpoweredSacrificeAmulet sacrificeAmulet = + (EmpoweredSacrificeAmulet) ModItems.empowered_sacrifice_amulet; float victimHealth = victim.getMaxHealth(); boolean healthGood = victimHealth > 4.0F; int lpReceived = healthGood ? 200 : 50; boolean shouldExecute = sacrificeAmulet.getStoredLP(stack) < 50000; - if (shouldExecute) - { - sacrificeAmulet.setStoredLP(stack, Math.min(sacrificeAmulet.getStoredLP(stack) + (lpReceived * 5), 50000)); + if (shouldExecute) { + sacrificeAmulet.setStoredLP( + stack, Math.min(sacrificeAmulet.getStoredLP(stack) + (lpReceived * 5), 50000)); } } } @@ -79,47 +75,42 @@ public class EmpoweredSacrificeAmulet extends SacrificeAmulet implements IBauble } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.bauble.empowered_sacrifice")); - if (!(par1ItemStack.stackTagCompound == null)) - { + if (!(par1ItemStack.stackTagCompound == null)) { par3List.add("Stored LP: " + EnumChatFormatting.RED + this.getStoredLP(par1ItemStack)); - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) - { - if (par1ItemStack.getItemDamage() == 1) - { + public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) { + if (par1ItemStack.getItemDamage() == 1) { String owner = par1ItemStack.stackTagCompound.getString("ownerName"); World world = player.worldObj; - if (!world.isRemote) - { - if (!owner.equals("")) - { - if (player instanceof EntityPlayer) - { - if (owner.equals(SpellHelper.getUsername((EntityPlayer) player))) - { - if (!world.isRemote) - { - if (this.getStoredLP(par1ItemStack) >= 50) - { - SoulNetworkHandler.addCurrentEssenceToMaximum(owner, 50, SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(owner))); + if (!world.isRemote) { + if (!owner.equals("")) { + if (player instanceof EntityPlayer) { + if (owner.equals(SpellHelper.getUsername((EntityPlayer) player))) { + if (!world.isRemote) { + if (this.getStoredLP(par1ItemStack) >= 50) { + SoulNetworkHandler.addCurrentEssenceToMaximum( + owner, + 50, + SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(owner))); setStoredLP(par1ItemStack, getStoredLP(par1ItemStack) - 50); - } - else if (this.getStoredLP(par1ItemStack) > 0) - { - SoulNetworkHandler.addCurrentEssenceToMaximum(owner, this.getStoredLP(par1ItemStack), SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(owner))); + } else if (this.getStoredLP(par1ItemStack) > 0) { + SoulNetworkHandler.addCurrentEssenceToMaximum( + owner, + this.getStoredLP(par1ItemStack), + SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(owner))); setStoredLP(par1ItemStack, 0); } } @@ -131,61 +122,48 @@ public class EmpoweredSacrificeAmulet extends SacrificeAmulet implements IBauble } @Override - public BaubleType getBaubleType(ItemStack par1ItemStack) - { + public BaubleType getBaubleType(ItemStack par1ItemStack) { return BaubleType.AMULET; } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) - { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { EnergyItems.checkAndSetItemOwner(itemStack, player); - if (world.isRemote) - { + if (world.isRemote) { return itemStack; } MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false); - if (player.isSneaking()) - { - if (getDamage(itemStack) == 1) - { + if (player.isSneaking()) { + if (getDamage(itemStack) == 1) { this.setDamage(itemStack, 0); - } - else - { + } else { setDamage(itemStack, 1); } } - if (movingobjectposition == null || movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) - { + if (movingobjectposition == null + || movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { return itemStack; - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = movingobjectposition.blockX; int y = movingobjectposition.blockY; int z = movingobjectposition.blockZ; TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TEAltar)) - { + if (!(tile instanceof TEAltar)) { return super.onItemRightClick(itemStack, world, player); } - TEAltar altar = (TEAltar)tile; + TEAltar altar = (TEAltar) tile; - if (!altar.isActive()) - { + if (!altar.isActive()) { int amount = this.getStoredLP(itemStack); - if (amount > 0) - { + if (amount > 0) { int filledAmount = altar.fillMainTank(amount); amount -= filledAmount; this.setStoredLP(itemStack, amount); @@ -200,35 +178,30 @@ public class EmpoweredSacrificeAmulet extends SacrificeAmulet implements IBauble } @Override - public String getItemStackDisplayName(ItemStack stack) - { - if (stack.getItemDamage() == 1) - { - return super.getItemStackDisplayName(stack) + " " + StatCollector.translateToLocal("item.empowered_amulet_soul_network"); - } - else - { - return super.getItemStackDisplayName(stack) + " " + StatCollector.translateToLocal("item.empowered_amulet_containing"); + public String getItemStackDisplayName(ItemStack stack) { + if (stack.getItemDamage() == 1) { + return super.getItemStackDisplayName(stack) + " " + + StatCollector.translateToLocal("item.empowered_amulet_soul_network"); + } else { + return super.getItemStackDisplayName(stack) + " " + + StatCollector.translateToLocal("item.empowered_amulet_containing"); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("BloodArsenal:sacrifice_amulet"); } @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack p_77636_1_, int pass) - { + public boolean hasEffect(ItemStack p_77636_1_, int pass) { return true; } @Override - public EnumRarity getRarity(ItemStack p_77613_1_) - { + public EnumRarity getRarity(ItemStack p_77613_1_) { return EnumRarity.rare; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSelfSacrificeAmulet.java b/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSelfSacrificeAmulet.java index a24ce2b..076e09f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSelfSacrificeAmulet.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/bauble/EmpoweredSelfSacrificeAmulet.java @@ -14,6 +14,7 @@ import com.arc.bloodarsenal.common.items.ModItems; import cpw.mods.fml.common.eventhandler.SubscribeEvent; 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.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -31,12 +32,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingAttackEvent; -import java.util.List; - -public class EmpoweredSelfSacrificeAmulet extends SelfSacrificeAmulet implements IBauble, IBindable -{ - public EmpoweredSelfSacrificeAmulet() - { +public class EmpoweredSelfSacrificeAmulet extends SelfSacrificeAmulet implements IBauble, IBindable { + public EmpoweredSelfSacrificeAmulet() { super(); setHasSubtypes(true); MinecraftForge.EVENT_BUS.register(this); @@ -44,41 +41,43 @@ public class EmpoweredSelfSacrificeAmulet extends SelfSacrificeAmulet implements @Override @SubscribeEvent - public void selfSacrificeHandler(LivingAttackEvent event) - { + public void selfSacrificeHandler(LivingAttackEvent event) { EntityLivingBase entityAttacked = event.entityLiving; Entity entityAttacking = event.source.getSourceOfDamage(); - if (entityAttacking != null && entityAttacked != null && entityAttacked instanceof EntityPlayerMP && BloodArsenalConfig.baublesIntegration) - { + if (entityAttacking != null + && entityAttacked != null + && entityAttacked instanceof EntityPlayerMP + && BloodArsenalConfig.baublesIntegration) { float damageDone = event.ammount; EntityPlayer player = (EntityPlayer) entityAttacked; InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player); - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack != null) - { - if (stack.getItem() == ModItems.empowered_self_sacrifice_amulet) - { - EmpoweredSelfSacrificeAmulet selfSacrificeAmulet = (EmpoweredSelfSacrificeAmulet) ModItems.empowered_self_sacrifice_amulet; + if (stack != null) { + if (stack.getItem() == ModItems.empowered_self_sacrifice_amulet) { + EmpoweredSelfSacrificeAmulet selfSacrificeAmulet = + (EmpoweredSelfSacrificeAmulet) ModItems.empowered_self_sacrifice_amulet; int lpReceived = (int) damageDone; boolean shouldExecute = selfSacrificeAmulet.getStoredLP(stack) < 50000; - if (shouldExecute) - { + if (shouldExecute) { PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); - if (regenEffect != null && regenEffect.getAmplifier() >= 2) - { - selfSacrificeAmulet.setStoredLP(stack, Math.min(selfSacrificeAmulet.getStoredLP(stack) + (lpReceived * 5) / (regenEffect.getAmplifier() + 1), 50000)); - } - else - { - selfSacrificeAmulet.setStoredLP(stack, Math.min(selfSacrificeAmulet.getStoredLP(stack) + (lpReceived * 5), 50000)); + if (regenEffect != null && regenEffect.getAmplifier() >= 2) { + selfSacrificeAmulet.setStoredLP( + stack, + Math.min( + selfSacrificeAmulet.getStoredLP(stack) + + (lpReceived * 5) / (regenEffect.getAmplifier() + 1), + 50000)); + } else { + selfSacrificeAmulet.setStoredLP( + stack, + Math.min(selfSacrificeAmulet.getStoredLP(stack) + (lpReceived * 5), 50000)); } } } @@ -88,47 +87,42 @@ public class EmpoweredSelfSacrificeAmulet extends SelfSacrificeAmulet implements } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.bauble.empowered_self_sacrifice")); - if (!(par1ItemStack.stackTagCompound == null)) - { + if (!(par1ItemStack.stackTagCompound == null)) { par3List.add("Stored LP: " + EnumChatFormatting.RED + this.getStoredLP(par1ItemStack)); - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) - { - if (par1ItemStack.getItemDamage() == 1) - { + public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) { + if (par1ItemStack.getItemDamage() == 1) { String owner = par1ItemStack.getTagCompound().getString("ownerName"); World world = player.worldObj; - if (!world.isRemote) - { - if (!owner.equals("")) - { - if (player instanceof EntityPlayer) - { - if (owner.equals(SpellHelper.getUsername((EntityPlayer) player))) - { - if (!world.isRemote) - { - if (this.getStoredLP(par1ItemStack) >= 50) - { - SoulNetworkHandler.addCurrentEssenceToMaximum(owner, 50, SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(owner))); + if (!world.isRemote) { + if (!owner.equals("")) { + if (player instanceof EntityPlayer) { + if (owner.equals(SpellHelper.getUsername((EntityPlayer) player))) { + if (!world.isRemote) { + if (this.getStoredLP(par1ItemStack) >= 50) { + SoulNetworkHandler.addCurrentEssenceToMaximum( + owner, + 50, + SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(owner))); setStoredLP(par1ItemStack, getStoredLP(par1ItemStack) - 50); - } - else if (this.getStoredLP(par1ItemStack) > 0) - { - SoulNetworkHandler.addCurrentEssenceToMaximum(owner, this.getStoredLP(par1ItemStack), SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(owner))); + } else if (this.getStoredLP(par1ItemStack) > 0) { + SoulNetworkHandler.addCurrentEssenceToMaximum( + owner, + this.getStoredLP(par1ItemStack), + SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(owner))); setStoredLP(par1ItemStack, 0); } } @@ -140,61 +134,48 @@ public class EmpoweredSelfSacrificeAmulet extends SelfSacrificeAmulet implements } @Override - public BaubleType getBaubleType(ItemStack par1ItemStack) - { + public BaubleType getBaubleType(ItemStack par1ItemStack) { return BaubleType.AMULET; } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) - { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { EnergyItems.checkAndSetItemOwner(itemStack, player); - if (world.isRemote) - { + if (world.isRemote) { return itemStack; } MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false); - if (player.isSneaking()) - { - if (getDamage(itemStack) == 1) - { + if (player.isSneaking()) { + if (getDamage(itemStack) == 1) { this.setDamage(itemStack, 0); - } - else - { + } else { setDamage(itemStack, 1); } } - if (movingobjectposition == null || movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) - { + if (movingobjectposition == null + || movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { return itemStack; - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = movingobjectposition.blockX; int y = movingobjectposition.blockY; int z = movingobjectposition.blockZ; TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TEAltar)) - { + if (!(tile instanceof TEAltar)) { return super.onItemRightClick(itemStack, world, player); } - TEAltar altar = (TEAltar)tile; + TEAltar altar = (TEAltar) tile; - if (!altar.isActive()) - { + if (!altar.isActive()) { int amount = this.getStoredLP(itemStack); - if (amount > 0) - { + if (amount > 0) { int filledAmount = altar.fillMainTank(amount); amount -= filledAmount; this.setStoredLP(itemStack, amount); @@ -210,34 +191,29 @@ public class EmpoweredSelfSacrificeAmulet extends SelfSacrificeAmulet implements @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("BloodArsenal:self_sacrifice_amulet"); } @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack p_77636_1_, int pass) - { + public boolean hasEffect(ItemStack p_77636_1_, int pass) { return true; } @Override - public EnumRarity getRarity(ItemStack p_77613_1_) - { + public EnumRarity getRarity(ItemStack p_77613_1_) { return EnumRarity.rare; } @Override - public String getItemStackDisplayName(ItemStack stack) - { - if (stack.getItemDamage() == 1) - { - return super.getItemStackDisplayName(stack) + " " + StatCollector.translateToLocal("item.empowered_amulet_soul_network"); - } - else - { - return super.getItemStackDisplayName(stack) + " " + StatCollector.translateToLocal("item.empowered_amulet_containing"); + public String getItemStackDisplayName(ItemStack stack) { + if (stack.getItemDamage() == 1) { + return super.getItemStackDisplayName(stack) + " " + + StatCollector.translateToLocal("item.empowered_amulet_soul_network"); + } else { + return super.getItemStackDisplayName(stack) + " " + + StatCollector.translateToLocal("item.empowered_amulet_containing"); } } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/bauble/ItemBauble.java b/src/main/java/com/arc/bloodarsenal/common/items/bauble/ItemBauble.java index 579985d..78fadd0 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/bauble/ItemBauble.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/bauble/ItemBauble.java @@ -11,42 +11,35 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles") -public abstract class ItemBauble extends Item implements IBauble -{ - public ItemBauble() - { +public abstract class ItemBauble extends Item implements IBauble { + public ItemBauble() { super(); setMaxStackSize(1); setMaxDamage(0); } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer); - for (int i = 0; i < baubles.getSizeInventory(); i++) - { - if (baubles.isItemValidForSlot(i, par1ItemStack)) - { + for (int i = 0; i < baubles.getSizeInventory(); i++) { + if (baubles.isItemValidForSlot(i, par1ItemStack)) { ItemStack stackInSlot = baubles.getStackInSlot(i); - if (stackInSlot == null || ((IBauble) stackInSlot.getItem()).canUnequip(stackInSlot, par3EntityPlayer)) - { - if (!par2World.isRemote) - { + if (stackInSlot == null + || ((IBauble) stackInSlot.getItem()).canUnequip(stackInSlot, par3EntityPlayer)) { + if (!par2World.isRemote) { baubles.setInventorySlotContents(i, par1ItemStack.copy()); - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + par3EntityPlayer.inventory.setInventorySlotContents( + par3EntityPlayer.inventory.currentItem, null); } } onEquipped(par1ItemStack, par3EntityPlayer); - if (stackInSlot != null) - { + if (stackInSlot != null) { ((IBauble) stackInSlot.getItem()).onUnequipped(stackInSlot, par3EntityPlayer); return stackInSlot.copy(); } @@ -59,47 +52,40 @@ public abstract class ItemBauble extends Item implements IBauble } @Override - public boolean canEquip(ItemStack stack, EntityLivingBase player) - { + public boolean canEquip(ItemStack stack, EntityLivingBase player) { return true; } @Override - public boolean canUnequip(ItemStack stack, EntityLivingBase player) - { + public boolean canUnequip(ItemStack stack, EntityLivingBase player) { return true; } @Override public void onWornTick(ItemStack stack, EntityLivingBase player) {} + @Override - public void onEquipped(ItemStack stack, EntityLivingBase player) - { + public void onEquipped(ItemStack stack, EntityLivingBase player) { onEquippedOrLoadedIntoWorld(stack, player); } - public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) - { - } + public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {} @Override public void onUnequipped(ItemStack stack, EntityLivingBase player) {} @Override - public boolean hasContainerItem(ItemStack stack) - { + public boolean hasContainerItem(ItemStack stack) { return getContainerItem(stack) != null; } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { return itemStack; } @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) - { + public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) { return false; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/bauble/SacrificeAmulet.java b/src/main/java/com/arc/bloodarsenal/common/items/bauble/SacrificeAmulet.java index aee9f1e..a7d7745 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/bauble/SacrificeAmulet.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/bauble/SacrificeAmulet.java @@ -11,6 +11,7 @@ import com.arc.bloodarsenal.common.items.ModItems; import cpw.mods.fml.common.eventhandler.SubscribeEvent; 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.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -27,45 +28,39 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingDeathEvent; -import java.util.List; - -public class SacrificeAmulet extends ItemBauble implements IAltarManipulator, IBauble -{ - public SacrificeAmulet() - { +public class SacrificeAmulet extends ItemBauble implements IAltarManipulator, IBauble { + public SacrificeAmulet() { super(); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent - public void sacrificeHandler(LivingDeathEvent event) - { + public void sacrificeHandler(LivingDeathEvent event) { Entity killer = event.source.getEntity(); - if (killer != null && killer instanceof EntityPlayerMP && !(killer instanceof FakePlayer) && BloodArsenalConfig.baublesIntegration) - { + if (killer != null + && killer instanceof EntityPlayerMP + && !(killer instanceof FakePlayer) + && BloodArsenalConfig.baublesIntegration) { EntityLivingBase victim = event.entityLiving; EntityPlayer player = (EntityPlayer) killer; InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player); - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack != null) - { - if (stack.getItem() == ModItems.sacrifice_amulet) - { + if (stack != null) { + if (stack.getItem() == ModItems.sacrifice_amulet) { SacrificeAmulet sacrificeAmulet = (SacrificeAmulet) ModItems.sacrifice_amulet; float victimHealth = victim.getMaxHealth(); boolean healthGood = victimHealth > 4.0F; int lpReceived = healthGood ? 200 : 50; boolean shouldExecute = sacrificeAmulet.getStoredLP(stack) < 10000; - if (shouldExecute) - { - sacrificeAmulet.setStoredLP(stack, Math.min(sacrificeAmulet.getStoredLP(stack) + (lpReceived * 2), 10000)); + if (shouldExecute) { + sacrificeAmulet.setStoredLP( + stack, Math.min(sacrificeAmulet.getStoredLP(stack) + (lpReceived * 2), 10000)); } } } @@ -74,64 +69,51 @@ public class SacrificeAmulet extends ItemBauble implements IAltarManipulator, IB } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.bauble.sacrifice")); - if (!(par1ItemStack.stackTagCompound == null)) - { + if (!(par1ItemStack.stackTagCompound == null)) { par3List.add("Stored LP: " + EnumChatFormatting.RED + this.getStoredLP(par1ItemStack)); } } @Override - public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) - { + public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) { super.onWornTick(par1ItemStack, player); } @Override - public BaubleType getBaubleType(ItemStack par1ItemStack) - { + public BaubleType getBaubleType(ItemStack par1ItemStack) { return BaubleType.AMULET; } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) - { - if (world.isRemote) - { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { + if (world.isRemote) { return itemStack; } MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return super.onItemRightClick(itemStack, world, player); - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = movingobjectposition.blockX; int y = movingobjectposition.blockY; int z = movingobjectposition.blockZ; TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TEAltar)) - { + if (!(tile instanceof TEAltar)) { return super.onItemRightClick(itemStack, world, player); } - TEAltar altar = (TEAltar)tile; + TEAltar altar = (TEAltar) tile; - if (!altar.isActive()) - { + if (!altar.isActive()) { int amount = this.getStoredLP(itemStack); - if (amount > 0) - { + if (amount > 0) { int filledAmount = altar.fillMainTank(amount); amount -= filledAmount; this.setStoredLP(itemStack, amount); @@ -147,15 +129,12 @@ public class SacrificeAmulet extends ItemBauble implements IAltarManipulator, IB @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("BloodArsenal:sacrifice_amulet"); } - public void setStoredLP(ItemStack itemStack, int lp) - { - if (!itemStack.hasTagCompound()) - { + public void setStoredLP(ItemStack itemStack, int lp) { + if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -164,10 +143,8 @@ public class SacrificeAmulet extends ItemBauble implements IAltarManipulator, IB tag.setInteger("storedLP", lp); } - public int getStoredLP(ItemStack itemStack) - { - if (!itemStack.hasTagCompound()) - { + public int getStoredLP(ItemStack itemStack) { + if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/bauble/SelfSacrificeAmulet.java b/src/main/java/com/arc/bloodarsenal/common/items/bauble/SelfSacrificeAmulet.java index 46352e8..0bc175a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/bauble/SelfSacrificeAmulet.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/bauble/SelfSacrificeAmulet.java @@ -11,6 +11,7 @@ import com.arc.bloodarsenal.common.items.ModItems; import cpw.mods.fml.common.eventhandler.SubscribeEvent; 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.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -27,51 +28,47 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingAttackEvent; -import java.util.List; - -public class SelfSacrificeAmulet extends ItemBauble implements IAltarManipulator, IBauble -{ - public SelfSacrificeAmulet() - { +public class SelfSacrificeAmulet extends ItemBauble implements IAltarManipulator, IBauble { + public SelfSacrificeAmulet() { super(); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent - public void selfSacrificeHandler(LivingAttackEvent event) - { + public void selfSacrificeHandler(LivingAttackEvent event) { EntityLivingBase entityAttacked = event.entityLiving; - if (entityAttacked != null && entityAttacked instanceof EntityPlayerMP && BloodArsenalConfig.baublesIntegration) - { + if (entityAttacked != null + && entityAttacked instanceof EntityPlayerMP + && BloodArsenalConfig.baublesIntegration) { float damageDone = event.ammount; EntityPlayer player = (EntityPlayer) entityAttacked; InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player); - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack != null) - { - if (stack.getItem() == ModItems.self_sacrifice_amulet) - { + if (stack != null) { + if (stack.getItem() == ModItems.self_sacrifice_amulet) { SelfSacrificeAmulet selfSacrificeAmulet = (SelfSacrificeAmulet) ModItems.self_sacrifice_amulet; int lpReceived = (int) damageDone; boolean shouldExecute = selfSacrificeAmulet.getStoredLP(stack) < 10000; - if (shouldExecute) - { + if (shouldExecute) { PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); - if (regenEffect != null && regenEffect.getAmplifier() >= 2) - { - selfSacrificeAmulet.setStoredLP(stack, Math.min(selfSacrificeAmulet.getStoredLP(stack) + (lpReceived * 2) / (regenEffect.getAmplifier() + 1), 10000)); - } - else - { - selfSacrificeAmulet.setStoredLP(stack, Math.min(selfSacrificeAmulet.getStoredLP(stack) + (lpReceived * 2), 10000)); + if (regenEffect != null && regenEffect.getAmplifier() >= 2) { + selfSacrificeAmulet.setStoredLP( + stack, + Math.min( + selfSacrificeAmulet.getStoredLP(stack) + + (lpReceived * 2) / (regenEffect.getAmplifier() + 1), + 10000)); + } else { + selfSacrificeAmulet.setStoredLP( + stack, + Math.min(selfSacrificeAmulet.getStoredLP(stack) + (lpReceived * 2), 10000)); } } } @@ -81,64 +78,51 @@ public class SelfSacrificeAmulet extends ItemBauble implements IAltarManipulator } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.bauble.self_sacrifice")); - if (!(par1ItemStack.stackTagCompound == null)) - { + if (!(par1ItemStack.stackTagCompound == null)) { par3List.add("Stored LP: " + EnumChatFormatting.RED + this.getStoredLP(par1ItemStack)); } } @Override - public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) - { + public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) { super.onWornTick(par1ItemStack, player); } @Override - public BaubleType getBaubleType(ItemStack par1ItemStack) - { + public BaubleType getBaubleType(ItemStack par1ItemStack) { return BaubleType.AMULET; } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) - { - if (world.isRemote) - { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { + if (world.isRemote) { return itemStack; } MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return super.onItemRightClick(itemStack, world, player); - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = movingobjectposition.blockX; int y = movingobjectposition.blockY; int z = movingobjectposition.blockZ; TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TEAltar)) - { + if (!(tile instanceof TEAltar)) { return super.onItemRightClick(itemStack, world, player); } - TEAltar altar = (TEAltar)tile; + TEAltar altar = (TEAltar) tile; - if (!altar.isActive()) - { + if (!altar.isActive()) { int amount = this.getStoredLP(itemStack); - if (amount > 0) - { + if (amount > 0) { int filledAmount = altar.fillMainTank(amount); amount -= filledAmount; this.setStoredLP(itemStack, amount); @@ -154,15 +138,12 @@ public class SelfSacrificeAmulet extends ItemBauble implements IAltarManipulator @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("BloodArsenal:self_sacrifice_amulet"); } - public void setStoredLP(ItemStack itemStack, int lp) - { - if (!itemStack.hasTagCompound()) - { + public void setStoredLP(ItemStack itemStack, int lp) { + if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -171,10 +152,8 @@ public class SelfSacrificeAmulet extends ItemBauble implements IAltarManipulator tag.setInteger("storedLP", lp); } - public int getStoredLP(ItemStack itemStack) - { - if (!itemStack.hasTagCompound()) - { + public int getStoredLP(ItemStack itemStack) { + if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/bauble/VampireRing.java b/src/main/java/com/arc/bloodarsenal/common/items/bauble/VampireRing.java index 8db03b8..172f135 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/bauble/VampireRing.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/bauble/VampireRing.java @@ -12,24 +12,19 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; -public class VampireRing extends ItemBauble implements IBauble -{ - public VampireRing() - { +public class VampireRing extends ItemBauble implements IBauble { + public VampireRing() { super(); setMaxStackSize(1); setHasSubtypes(true); } @Override - public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) - { + public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) { super.onWornTick(par1ItemStack, player); - if (player instanceof EntityPlayerMP && !player.worldObj.isRemote) - { - if (player.getActivePotionEffect(BloodArsenal.vampiricAura) != null) - { + if (player instanceof EntityPlayerMP && !player.worldObj.isRemote) { + if (player.getActivePotionEffect(BloodArsenal.vampiricAura) != null) { player.removePotionEffect(BloodArsenalConfig.vampiricAuraID); } player.addPotionEffect(new PotionEffect(BloodArsenalConfig.vampiricAuraID, Integer.MAX_VALUE, 0, true)); @@ -37,26 +32,22 @@ public class VampireRing extends ItemBauble implements IBauble } @Override - public void onUnequipped(ItemStack par1ItemStack, EntityLivingBase player) - { + public void onUnequipped(ItemStack par1ItemStack, EntityLivingBase player) { PotionEffect effect = player.getActivePotionEffect(BloodArsenal.vampiricAura); - if (effect != null) - { + if (effect != null) { player.removePotionEffect(BloodArsenalConfig.vampiricAuraID); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("BloodArsenal:vampire_ring"); } @Override - public BaubleType getBaubleType(ItemStack par1ItemStack) - { + public BaubleType getBaubleType(ItemStack par1ItemStack) { return BaubleType.RING; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/block/BloodStoneBlock.java b/src/main/java/com/arc/bloodarsenal/common/items/block/BloodStoneBlock.java index af06940..ce6138b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/block/BloodStoneBlock.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/block/BloodStoneBlock.java @@ -4,21 +4,17 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class BloodStoneBlock extends ItemBlock -{ - public BloodStoneBlock(Block block) - { +public class BloodStoneBlock extends ItemBlock { + public BloodStoneBlock(Block block) { super(block); setHasSubtypes(true); } @Override - public String getUnlocalizedName(ItemStack itemStack) - { + public String getUnlocalizedName(ItemStack itemStack) { String name; - switch (itemStack.getItemDamage()) - { + switch (itemStack.getItemDamage()) { case 0: name = "blood_stone_1"; break; @@ -47,8 +43,7 @@ public class BloodStoneBlock extends ItemBlock } @Override - public int getMetadata(int par1) - { + public int getMetadata(int par1) { return par1; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/block/CompactedMRSBlock.java b/src/main/java/com/arc/bloodarsenal/common/items/block/CompactedMRSBlock.java index 0925841..c99018a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/block/CompactedMRSBlock.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/block/CompactedMRSBlock.java @@ -3,6 +3,7 @@ package com.arc.bloodarsenal.common.items.block; import WayofTime.alchemicalWizardry.api.rituals.Rituals; 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.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; @@ -10,40 +11,30 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.List; - -public class CompactedMRSBlock extends ItemBlock -{ - public CompactedMRSBlock(Block block) - { +public class CompactedMRSBlock extends ItemBlock { + public CompactedMRSBlock(Block block) { super(block); setMaxStackSize(1); } @Override @SideOnly(Side.CLIENT) - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - if (GuiScreen.isShiftKeyDown()) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (GuiScreen.isShiftKeyDown()) { addHiddenTooltip(par1ItemStack, par3List); - } - else - { + } else { addStringToTooltip(StatCollector.translateToLocal("tooltip.shiftinfo"), par3List); } } - public void addHiddenTooltip(ItemStack par1ItemStack, List par3List) - { + public void addHiddenTooltip(ItemStack par1ItemStack, List par3List) { String ritualID = par1ItemStack.getTagCompound().getString("ritualName"); String ritualName = Rituals.getNameOfRitual(ritualID); addStringToTooltip(StatCollector.translateToLocal("tooltip.ritualName") + " &c" + ritualName + "&7", par3List); } - public void addStringToTooltip(String s, List tooltip) - { + public void addStringToTooltip(String s, List tooltip) { tooltip.add(s.replaceAll("&", "\u00a7")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/block/PortableAltarBlock.java b/src/main/java/com/arc/bloodarsenal/common/items/block/PortableAltarBlock.java index e00adcb..32c516f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/block/PortableAltarBlock.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/block/PortableAltarBlock.java @@ -2,6 +2,7 @@ package com.arc.bloodarsenal.common.items.block; 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.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; @@ -9,32 +10,23 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.List; - -public class PortableAltarBlock extends ItemBlock -{ - public PortableAltarBlock(Block block) - { +public class PortableAltarBlock extends ItemBlock { + public PortableAltarBlock(Block block) { super(block); setMaxStackSize(1); } @Override @SideOnly(Side.CLIENT) - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - if (GuiScreen.isShiftKeyDown()) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (GuiScreen.isShiftKeyDown()) { addHiddenTooltip(par1ItemStack, par3List); - } - else - { + } else { addStringToTooltip(StatCollector.translateToLocal("tooltip.shiftinfo"), par3List); } } - public void addHiddenTooltip(ItemStack par1ItemStack, List par3List) - { + public void addHiddenTooltip(ItemStack par1ItemStack, List par3List) { if (!par1ItemStack.hasTagCompound()) return; String capacity = par1ItemStack.getTagCompound().getString("capacity"); @@ -42,12 +34,12 @@ public class PortableAltarBlock extends ItemBlock int currentEssence = par1ItemStack.getTagCompound().getInteger("currentEssence"); addStringToTooltip(StatCollector.translateToLocal("tooltip.altarTier") + " &c" + alterTier + "&7", par3List); - addStringToTooltip(StatCollector.translateToLocal("tooltip.currentEssence") + " &c" + currentEssence + "&7", par3List); + addStringToTooltip( + StatCollector.translateToLocal("tooltip.currentEssence") + " &c" + currentEssence + "&7", par3List); addStringToTooltip(StatCollector.translateToLocal("tooltip.capacity") + " &c" + capacity + "&7", par3List); } - public void addStringToTooltip(String s, List tooltip) - { + public void addStringToTooltip(String s, List tooltip) { tooltip.add(s.replaceAll("&", "\u00a7")); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/book/BloodBurnedTome.java b/src/main/java/com/arc/bloodarsenal/common/items/book/BloodBurnedTome.java index 9ac937f..9e0ff04 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/book/BloodBurnedTome.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/book/BloodBurnedTome.java @@ -14,6 +14,8 @@ import amerifrance.guideapi.pages.PageIRecipe; import amerifrance.guideapi.pages.PageUnlocImage; import com.arc.bloodarsenal.common.items.ModItems; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.List; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -22,64 +24,65 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; -import java.util.List; - -public class BloodBurnedTome -{ +public class BloodBurnedTome { public static Book burnedTome; public static List categories = new ArrayList(); - private final static String R_LOC = "BloodArsenal:book/images/"; + private static final String R_LOC = "BloodArsenal:book/images/"; - public static void registerTome() - { + public static void registerTome() { registerLifebringer(); BookBuilder bookBuilder = new BookBuilder(); - bookBuilder.setCategories(categories).setUnlocBookTitle("guide.bloodarsenal.book.title").setUnlocWelcomeMessage("guide.bloodarsenal.book.welcomeMessage").setUnlocDisplayName("guide.bloodarsenal.book.name").setAuthor("-An Arc Mage").setItemTexture("BloodArsenal:burned_tome"); + bookBuilder + .setCategories(categories) + .setUnlocBookTitle("guide.bloodarsenal.book.title") + .setUnlocWelcomeMessage("guide.bloodarsenal.book.welcomeMessage") + .setUnlocDisplayName("guide.bloodarsenal.book.name") + .setAuthor("-An Arc Mage") + .setItemTexture("BloodArsenal:burned_tome"); burnedTome = bookBuilder.build(); GuideRegistry.registerBook(burnedTome); - GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(GuideRegistry.getItemStackForBook(burnedTome), ModItems.glass_shard, Items.writable_book, new ItemStack(WayofTime.alchemicalWizardry.ModItems.apprenticeBloodOrb, 1, OreDictionary.WILDCARD_VALUE))); + GameRegistry.addRecipe(new ShapelessBloodOrbRecipe( + GuideRegistry.getItemStackForBook(burnedTome), + ModItems.glass_shard, + Items.writable_book, + new ItemStack( + WayofTime.alchemicalWizardry.ModItems.apprenticeBloodOrb, 1, OreDictionary.WILDCARD_VALUE))); RecipeHolder.init(); } - private static void registerLifebringer() - { + private static void registerLifebringer() { List lifeBringerEntries = new ArrayList(); { - //A Different Backstory + // A Different Backstory ArrayList backstoryPages = new ArrayList(); makePage(lifeBringerEntries, backstoryPages, "backstory"); } { - //Glass Is Dangerous + // Glass Is Dangerous ArrayList glass = new ArrayList(); makePage(lifeBringerEntries, glass, "glass"); } - categories.add(new CategoryItemStack(lifeBringerEntries, "guide.bloodarsenal.category.lifeBringer", new ItemStack(ModItems.bound_bow))); + categories.add(new CategoryItemStack( + lifeBringerEntries, "guide.bloodarsenal.category.lifeBringer", new ItemStack(ModItems.bound_bow))); } - private static void makePage(List entries, ArrayList pages, String name, Object... others) - { - pages.addAll(PageHelper.pagesForLongText(replaceColors(StatCollector.translateToLocal("guide.bloodarsenal.entry." + name)))); + private static void makePage(List entries, ArrayList pages, String name, Object... others) { + pages.addAll(PageHelper.pagesForLongText( + replaceColors(StatCollector.translateToLocal("guide.bloodarsenal.entry." + name)))); - if (others != null) - { - for (Object code : others) - { - if (code instanceof IPage) - { + if (others != null) { + for (Object code : others) { + if (code instanceof IPage) { pages.add((IPage) code); } - if (code instanceof Object[]) - { + if (code instanceof Object[]) { Object[] objects = (Object[]) code; - for (Object object : objects) - { + for (Object object : objects) { pages.add((IPage) object); } } @@ -88,23 +91,20 @@ public class BloodBurnedTome entries.add(new EntryUniText(pages, "guide.bloodarsenal.entryTitles." + name)); } - private static Object[] s(String pageName) - { - if (pageName != null) - { - return PageHelper.pagesForLongText(replaceColors(StatCollector.translateToLocal("guide.bloodarsenal.entry." + pageName))).toArray(); + private static Object[] s(String pageName) { + if (pageName != null) { + return PageHelper.pagesForLongText( + replaceColors(StatCollector.translateToLocal("guide.bloodarsenal.entry." + pageName))) + .toArray(); } return null; } - private static Object[] r(IRecipe... recipes) - { - if (recipes != null) - { + private static Object[] r(IRecipe... recipes) { + if (recipes != null) { ArrayList pageIRecipes = new ArrayList(); - for (IRecipe recipe : recipes) - { + for (IRecipe recipe : recipes) { pageIRecipes.add(new PageIRecipe(recipe)); } return pageIRecipes.toArray(); @@ -113,14 +113,14 @@ public class BloodBurnedTome return null; } - private static Object[] i(String... names) - { - if (names != null) - { + private static Object[] i(String... names) { + if (names != null) { ArrayList images = new ArrayList(); - for (String name : names) - { - images.add(new PageUnlocImage(replaceColors(StatCollector.translateToLocal("guide.bloodarsenal.caption." + name)), new ResourceLocation(R_LOC + name + ".png"), true)); + for (String name : names) { + images.add(new PageUnlocImage( + replaceColors(StatCollector.translateToLocal("guide.bloodarsenal.caption." + name)), + new ResourceLocation(R_LOC + name + ".png"), + true)); } return images.toArray(); @@ -129,28 +129,25 @@ public class BloodBurnedTome return null; } - protected static String replaceColors(String text) - { - if (text != null) - { + protected static String replaceColors(String text) { + if (text != null) { return text.replace("@BLD@", EnumChatFormatting.BOLD.toString()) - .replace("@UND@", EnumChatFormatting.UNDERLINE.toString()) - .replace("@ITC@", EnumChatFormatting.ITALIC.toString()) - - .replace("@AQA@", EnumChatFormatting.AQUA.toString()) - .replace("@GLD@", EnumChatFormatting.GOLD.toString()) - .replace("@DRED@", EnumChatFormatting.DARK_RED.toString()) - .replace("@RED@", EnumChatFormatting.RED.toString()) - .replace("@LPRP@", EnumChatFormatting.LIGHT_PURPLE.toString()) - .replace("@PRP@", EnumChatFormatting.DARK_PURPLE.toString()) - .replace("@GRN@", EnumChatFormatting.GREEN.toString()) - .replace("@DGRN@", EnumChatFormatting.DARK_GREEN.toString()) - .replace("@BLU@", EnumChatFormatting.BLUE.toString()) - .replace("@DBLU@", EnumChatFormatting.DARK_BLUE.toString()) - .replace("@GRY@", EnumChatFormatting.GRAY.toString()) - .replace("@DGRY@", EnumChatFormatting.DARK_GRAY.toString()) - .replace("@RST@", EnumChatFormatting.RESET.toString()) - .replace("@END@", EnumChatFormatting.BLACK.toString()); + .replace("@UND@", EnumChatFormatting.UNDERLINE.toString()) + .replace("@ITC@", EnumChatFormatting.ITALIC.toString()) + .replace("@AQA@", EnumChatFormatting.AQUA.toString()) + .replace("@GLD@", EnumChatFormatting.GOLD.toString()) + .replace("@DRED@", EnumChatFormatting.DARK_RED.toString()) + .replace("@RED@", EnumChatFormatting.RED.toString()) + .replace("@LPRP@", EnumChatFormatting.LIGHT_PURPLE.toString()) + .replace("@PRP@", EnumChatFormatting.DARK_PURPLE.toString()) + .replace("@GRN@", EnumChatFormatting.GREEN.toString()) + .replace("@DGRN@", EnumChatFormatting.DARK_GREEN.toString()) + .replace("@BLU@", EnumChatFormatting.BLUE.toString()) + .replace("@DBLU@", EnumChatFormatting.DARK_BLUE.toString()) + .replace("@GRY@", EnumChatFormatting.GRAY.toString()) + .replace("@DGRY@", EnumChatFormatting.DARK_GRAY.toString()) + .replace("@RST@", EnumChatFormatting.RESET.toString()) + .replace("@END@", EnumChatFormatting.BLACK.toString()); } return null; diff --git a/src/main/java/com/arc/bloodarsenal/common/items/book/RecipeHolder.java b/src/main/java/com/arc/bloodarsenal/common/items/book/RecipeHolder.java index 9a8b649..9ed0f6b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/book/RecipeHolder.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/book/RecipeHolder.java @@ -2,31 +2,25 @@ package com.arc.bloodarsenal.common.items.book; import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; -import java.util.List; - -public class RecipeHolder -{ +public class RecipeHolder { private static List recipeList; public static IRecipe glassSacrificialDagger; public static IRecipe glassDaggerOfSacrifice; - public static void init() - { + public static void init() { recipeList = CraftingManager.getInstance().getRecipeList(); } - private static IRecipe getRecipeForItemStack(ItemStack stack) - { - for (Object obj : recipeList) - { + private static IRecipe getRecipeForItemStack(ItemStack stack) { + for (Object obj : recipeList) { IRecipe recipe = (IRecipe) obj; - if (recipe.getRecipeOutput() != null && stack.isItemEqual(recipe.getRecipeOutput())) - { + if (recipe.getRecipeOutput() != null && stack.isItemEqual(recipe.getRecipeOutput())) { return recipe; } } @@ -34,12 +28,9 @@ public class RecipeHolder return null; } - private static AltarRecipe getAltarRecipeForItemStack(ItemStack stack) - { - for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) - { - if (recipe.getResult() != null && stack.isItemEqual(recipe.getResult())) - { + private static AltarRecipe getAltarRecipeForItemStack(ItemStack stack) { + for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) { + if (recipe.getResult() != null && stack.isItemEqual(recipe.getResult())) { return recipe; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/orb/TransparentOrb.java b/src/main/java/com/arc/bloodarsenal/common/items/orb/TransparentOrb.java index 8a5bfa0..6475e9f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/orb/TransparentOrb.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/orb/TransparentOrb.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.items.EnergyBattery; 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.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -12,89 +13,72 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class TransparentOrb extends EnergyBattery -{ +public class TransparentOrb extends EnergyBattery { IIcon icons[] = new IIcon[45]; - public TransparentOrb(int damage) - { + public TransparentOrb(int damage) { super(damage); orbLevel = 6; } @Override - public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean something) - { + public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean something) { list.add(StatCollector.translateToLocal("tooltip.energybattery.desc")); - if (itemStack.getTagCompound() != null) - { - list.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + itemStack.getTagCompound().getString("ownerName")); - list.add(StatCollector.translateToLocal("tooltip.energybattery.currentLP") + " " + this.getCurrentEssence(itemStack)); + if (itemStack.getTagCompound() != null) { + list.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + itemStack.getTagCompound().getString("ownerName")); + list.add(StatCollector.translateToLocal("tooltip.energybattery.currentLP") + " " + + this.getCurrentEssence(itemStack)); } } @Override - public void onUpdate(ItemStack itemStack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) - { - if (itemStack.getTagCompound() == null) - { + public void onUpdate(ItemStack itemStack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) { + if (itemStack.getTagCompound() == null) { return; } - int maxEssence = SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(SoulNetworkHandler.getOwnerName(itemStack))); + int maxEssence = SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(SoulNetworkHandler.getOwnerName(itemStack))); int section = maxEssence / 44; int currentEssence = SoulNetworkHandler.getCurrentEssence(SoulNetworkHandler.getOwnerName(itemStack)); - if (currentEssence > 0) - { + if (currentEssence > 0) { int metaToBe = (currentEssence / section); itemStack.setItemDamage(metaToBe); - } - else - { + } else { itemStack.setItemDamage(0); } } @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return true; } @Override - public IIcon getIcon(ItemStack stack, int pass) - { + public IIcon getIcon(ItemStack stack, int pass) { int i = stack.getItemDamage() + 1; - if (i != stack.getItemDamage() && i < icons.length) - { + if (i != stack.getItemDamage() && i < icons.length) { i = stack.getItemDamage() + 1; return icons[i - 1]; - } - else if (i <= icons.length) - { + } else if (i <= icons.length) { return icons[icons.length - 1]; - } - else - { + } else { return itemIcon; } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("BloodArsenal:orb/orb_0"); icons[0] = iconRegister.registerIcon("BloodArsenal:orb/orb_0"); - for (int i = 0; i < icons.length; i++) - { + for (int i = 0; i < icons.length; i++) { icons[i] = iconRegister.registerIcon("BloodArsenal:orb/orb_" + i); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilDivinity.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilDivinity.java index cae8aac..0581c9a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilDivinity.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilDivinity.java @@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenalConfig; 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.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -18,35 +19,27 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindable, ISigil -{ +public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindable, ISigil { @SideOnly(Side.CLIENT) public IIcon activeIcon; + @SideOnly(Side.CLIENT) public IIcon passiveIcon; - public SigilDivinity() - { + public SigilDivinity() { super(); setMaxStackSize(1); setEnergyUsed(50000); } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.divinity")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } @@ -56,8 +49,7 @@ public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindab @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("BloodArsenal:sigil_of_divinity_deactivated"); activeIcon = iconRegister.registerIcon("BloodArsenal:sigil_of_divinity_activated"); passiveIcon = iconRegister.registerIcon("BloodArsenal:sigil_of_divinity_deactivated"); @@ -65,70 +57,54 @@ public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindab @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (stack.stackTagCompound == null) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (stack.stackTagCompound == null) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.stackTagCompound; - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return activeIcon; - } - else - { + } else { return passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return activeIcon; - } - else - { + } else { return passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.stackTagCompound; tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2, 0)); - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()); } - } - else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -136,39 +112,32 @@ public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindab } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2, 4)); } - if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()); } } } @Override - public void onArmourUpdate(World par1World, EntityPlayer par2EntityPlayer, ItemStack par3ItemStack) - { - if (par3ItemStack.stackTagCompound == null) - { + public void onArmourUpdate(World par1World, EntityPlayer par2EntityPlayer, ItemStack par3ItemStack) { + if (par3ItemStack.stackTagCompound == null) { par3ItemStack.setTagCompound(new NBTTagCompound()); } @@ -176,14 +145,12 @@ public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindab } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return BloodArsenalConfig.sigilDivinityCost; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilEnder.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilEnder.java index 75e79e6..b9b51d1 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilEnder.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilEnder.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenalConfig; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -13,56 +14,49 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import java.util.List; - -public class SigilEnder extends EnergyItems implements IBindable, ISigil -{ - public SigilEnder() - { +public class SigilEnder extends EnergyItems implements IBindable, ISigil { + public SigilEnder() { super(); setMaxStackSize(1); } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.ender1")); par3List.add(StatCollector.translateToLocal("tooltip.sigil.ender2")); - if (!(par1ItemStack.stackTagCompound == null)) - { + if (!(par1ItemStack.stackTagCompound == null)) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) - { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { EnergyItems.checkAndSetItemOwner(itemStack, player); Vec3 playerPrevPos = Vec3.createVectorHelper(player.prevPosX, player.prevPosY, player.prevPosZ); - if (itemStack.stackTagCompound == null) - { + if (itemStack.stackTagCompound == null) { itemStack.setTagCompound(new NBTTagCompound()); } - if (player.isSneaking() && !player.isSwingInProgress) - { - MovingObjectPosition mop = SigilUtils.getTargetBlock(world, (player.prevPosX + (player.posX - player.prevPosX)), + if (player.isSneaking() && !player.isSwingInProgress) { + MovingObjectPosition mop = SigilUtils.getTargetBlock( + world, + (player.prevPosX + (player.posX - player.prevPosX)), (player.prevPosY + (player.posY - player.prevPosY) + 1.62 - player.yOffset), (player.prevPosZ + (player.posZ - player.prevPosZ)), (player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw)), - (player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), false, 128.0); + (player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), + false, + 128.0); - if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1) - { + if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1) { double ex = mop.hitVec.xCoord; double wy = mop.hitVec.yCoord; double zee = mop.hitVec.zCoord; - switch (mop.sideHit) - { + switch (mop.sideHit) { case 0: wy -= 2.0; break; @@ -85,24 +79,38 @@ public class SigilEnder extends EnergyItems implements IBindable, ISigil Vec3 vec3 = Vec3.createVectorHelper(ex, wy, zee); double distance = playerPrevPos.distanceTo(vec3); - if (SoulNetworkHandler.getCurrentEssence(itemStack.getTagCompound().getString("ownerName")) >= distance * BloodArsenalConfig.enderSigilTeleportMultiplier || player.capabilities.isCreativeMode) - { - for (int k = 0; k < 8; ++k) - { - world.spawnParticle("portal", player.posX + (world.rand.nextDouble() - 0.5D) * (double)player.width, player.posY + world.rand.nextDouble() * (double)player.height - 0.25D, player.posZ + (world.rand.nextDouble() - 0.5D) * (double)player.width, 0, 0, 0); - world.spawnParticle("portal", ex + (world.rand.nextDouble() - 0.5D) * (double)player.width, wy + world.rand.nextDouble() * (double) player.height - 0.25D, zee + (world.rand.nextDouble() - 0.5D) * (double)player.width, 0, 0, 0); + if (SoulNetworkHandler.getCurrentEssence( + itemStack.getTagCompound().getString("ownerName")) + >= distance * BloodArsenalConfig.enderSigilTeleportMultiplier + || player.capabilities.isCreativeMode) { + for (int k = 0; k < 8; ++k) { + world.spawnParticle( + "portal", + player.posX + (world.rand.nextDouble() - 0.5D) * (double) player.width, + player.posY + world.rand.nextDouble() * (double) player.height - 0.25D, + player.posZ + (world.rand.nextDouble() - 0.5D) * (double) player.width, + 0, + 0, + 0); + world.spawnParticle( + "portal", + ex + (world.rand.nextDouble() - 0.5D) * (double) player.width, + wy + world.rand.nextDouble() * (double) player.height - 0.25D, + zee + (world.rand.nextDouble() - 0.5D) * (double) player.width, + 0, + 0, + 0); } player.setPositionAndUpdate(ex, wy, zee); - EnergyItems.syphonBatteries(itemStack, player, (int) distance * BloodArsenalConfig.enderSigilTeleportMultiplier); + EnergyItems.syphonBatteries( + itemStack, player, (int) distance * BloodArsenalConfig.enderSigilTeleportMultiplier); world.playSoundAtEntity(player, "mob.endermen.portal", 1F, 1F); player.swingItem(); player.setVelocity(0.0D, 0.0D, 0.0D); } } - } - else if (!player.isSneaking()) - { + } else if (!player.isSneaking()) { player.displayGUIChest(player.getInventoryEnderChest()); world.playSoundAtEntity(player, "mob.endermen.portal", 1F, 1F); EnergyItems.syphonBatteries(itemStack, player, BloodArsenalConfig.enderSigilOpenCost); diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilLightning.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilLightning.java index a0d67ca..0461d04 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilLightning.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilLightning.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenalConfig; +import java.util.List; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -15,72 +16,62 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilLightning extends EnergyItems implements IBindable, ISigil -{ - public SigilLightning() - { +public class SigilLightning extends EnergyItems implements IBindable, ISigil { + public SigilLightning() { super(); setMaxStackSize(1); } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { int mode = par1ItemStack.getItemDamage(); par3List.add(StatCollector.translateToLocal("tooltip.sigil.lightning")); par3List.add(StatCollector.translateToLocal("tooltip.sigil.lightning2") + " " + (mode + 1)); - if (!(par1ItemStack.stackTagCompound == null)) - { + if (!(par1ItemStack.stackTagCompound == null)) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) - { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { EnergyItems.checkAndSetItemOwner(itemStack, player); - if (itemStack.stackTagCompound == null) - { + if (itemStack.stackTagCompound == null) { itemStack.setTagCompound(new NBTTagCompound()); } - if (player.isSneaking()) - { - if (!player.isSwingInProgress) - { + if (player.isSneaking()) { + if (!player.isSwingInProgress) { changeMode(itemStack, true); } - if (world.isRemote) - { + if (world.isRemote) { int mode = itemStack.getItemDamage(); - IChatComponent chatComponent = new ChatComponentText(StatCollector.translateToLocal("tooltip.sigil.lightning2") + " " + (mode + 1)); + IChatComponent chatComponent = new ChatComponentText( + StatCollector.translateToLocal("tooltip.sigil.lightning2") + " " + (mode + 1)); player.addChatComponentMessage(chatComponent); } player.swingItem(); - } - else - { + } else { int mode = itemStack.getItemDamage(); - MovingObjectPosition mop = SigilUtils.getTargetBlock(world, (player.prevPosX + (player.posX - player.prevPosX)), + MovingObjectPosition mop = SigilUtils.getTargetBlock( + world, + (player.prevPosX + (player.posX - player.prevPosX)), (player.prevPosY + (player.posY - player.prevPosY) + 1.62 - player.yOffset), (player.prevPosZ + (player.posZ - player.prevPosZ)), (player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw)), - (player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), false, 128.0); + (player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), + false, + 128.0); - if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1) - { + if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1) { double ex = mop.hitVec.xCoord; double wy = mop.hitVec.yCoord; double zee = mop.hitVec.zCoord; - switch (mop.sideHit) - { + switch (mop.sideHit) { case 0: wy -= 2.0; break; @@ -102,9 +93,8 @@ public class SigilLightning extends EnergyItems implements IBindable, ISigil int cost = 0; - switch (mode) - { - // 8 per lightning bolt + switch (mode) { + // 8 per lightning bolt case 0: cost = 8 * BloodArsenalConfig.lightningSigilMultiplier; break; @@ -122,10 +112,11 @@ public class SigilLightning extends EnergyItems implements IBindable, ISigil break; } - if (SoulNetworkHandler.getCurrentEssence(itemStack.getTagCompound().getString("ownerName")) >= cost || player.capabilities.isCreativeMode) - { - switch (mode) - { + if (SoulNetworkHandler.getCurrentEssence( + itemStack.getTagCompound().getString("ownerName")) + >= cost + || player.capabilities.isCreativeMode) { + switch (mode) { case 0: world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee)); break; @@ -193,17 +184,12 @@ public class SigilLightning extends EnergyItems implements IBindable, ISigil return itemStack; } - private void changeMode(ItemStack itemStack, boolean next) - { + private void changeMode(ItemStack itemStack, boolean next) { int mode = itemStack.getItemDamage(); - if (next) - { - if (mode < 4) - { + if (next) { + if (mode < 4) { mode++; - } - else - { + } else { mode = 0; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilSwimming.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilSwimming.java index cbb5747..2b01cc0 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilSwimming.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilSwimming.java @@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenalConfig; 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.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -17,35 +18,27 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindable, ISigil -{ +public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindable, ISigil { @SideOnly(Side.CLIENT) private static IIcon activeIcon; + @SideOnly(Side.CLIENT) private static IIcon passiveIcon; - public SigilSwimming() - { + public SigilSwimming() { super(); setMaxStackSize(1); setEnergyUsed(100); } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.swimming")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } @@ -55,8 +48,7 @@ public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindab @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("BloodArsenal:sigil_of_swimming_deactivated"); activeIcon = iconRegister.registerIcon("BloodArsenal:sigil_of_swimming_activated"); passiveIcon = iconRegister.registerIcon("BloodArsenal:sigil_of_swimming_deactivated"); @@ -64,70 +56,54 @@ public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindab @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (stack.stackTagCompound == null) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (stack.stackTagCompound == null) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.stackTagCompound; - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return activeIcon; - } - else - { + } else { return passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return activeIcon; - } - else - { + } else { return passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.stackTagCompound; tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); par3EntityPlayer.addPotionEffect(new PotionEffect(BloodArsenalConfig.swimmingID, 2, 0)); - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()); } - } - else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -135,39 +111,32 @@ public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindab } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3EntityPlayer.addPotionEffect(new PotionEffect(BloodArsenalConfig.swimmingID, 2, 0)); } - if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed()); } } } @Override - public void onArmourUpdate(World par1World, EntityPlayer par2EntityPlayer, ItemStack par3ItemStack) - { - if (par3ItemStack.stackTagCompound == null) - { + public void onArmourUpdate(World par1World, EntityPlayer par2EntityPlayer, ItemStack par3ItemStack) { + if (par3ItemStack.stackTagCompound == null) { par3ItemStack.setTagCompound(new NBTTagCompound()); } @@ -175,14 +144,12 @@ public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindab } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return BloodArsenalConfig.sigilSwimmingCost; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilUtils.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilUtils.java index 3432020..d2bfa3c 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilUtils.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/SigilUtils.java @@ -17,10 +17,9 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.client.event.MouseEvent; -public class SigilUtils -{ - public static MovingObjectPosition getTargetBlock(World world, double x, double y, double z, float yaw, float pitch, boolean par3, double range) - { +public class SigilUtils { + public static MovingObjectPosition getTargetBlock( + World world, double x, double y, double z, float yaw, float pitch, boolean par3, double range) { Vec3 var13 = Vec3.createVectorHelper(x, y, z); float var14 = MathHelper.cos(-yaw * 0.01745329F - 3.141593F); float var15 = MathHelper.sin(-yaw * 0.01745329F - 3.141593F); @@ -35,20 +34,16 @@ public class SigilUtils @SideOnly(Side.CLIENT) @SubscribeEvent - public void onMouseEvent(MouseEvent event) - { + public void onMouseEvent(MouseEvent event) { EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; - if (event.dwheel != 0 && player != null && player.isSneaking()) - { + if (event.dwheel != 0 && player != null && player.isSneaking()) { ItemStack stack = player.getCurrentEquippedItem(); - if (stack != null) - { + if (stack != null) { Item item = stack.getItem(); - if (item instanceof SigilAugmentedHolding) - { + if (item instanceof SigilAugmentedHolding) { cycleSigil(stack, player, event.dwheel); event.setCanceled(true); } @@ -56,8 +51,7 @@ public class SigilUtils } } - private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel) - { + private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel) { int mode = SigilAugmentedHolding.getCurrentItem(stack); mode = dWheel < 0 ? SigilAugmentedHolding.next(mode) : SigilAugmentedHolding.prev(mode); SigilAugmentedHolding.cycleSigil(stack, mode); diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketHandler.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketHandler.java index 3524a3c..583ddf6 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketHandler.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketHandler.java @@ -4,12 +4,10 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; -public class AHPacketHandler -{ +public class AHPacketHandler { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("AugmentedHolding"); - public static void init() - { + public static void init() { INSTANCE.registerMessage(AHPacketProcessor.class, AHPacketProcessor.class, 0, Side.SERVER); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketProcessor.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketProcessor.java index 0e0f9a6..22a327a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketProcessor.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/AHPacketProcessor.java @@ -6,45 +6,38 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; -public class AHPacketProcessor implements IMessage, IMessageHandler -{ +public class AHPacketProcessor implements IMessage, IMessageHandler { private int slot; private int mode; public AHPacketProcessor() {} - public AHPacketProcessor(int slot, int mode) - { + public AHPacketProcessor(int slot, int mode) { this.slot = slot; this.mode = mode; } @Override - public void toBytes(ByteBuf buffer) - { + public void toBytes(ByteBuf buffer) { buffer.writeInt(slot); buffer.writeInt(mode); } @Override - public void fromBytes(ByteBuf buffer) - { + public void fromBytes(ByteBuf buffer) { slot = buffer.readInt(); mode = buffer.readInt(); } @Override - public IMessage onMessage(AHPacketProcessor message, MessageContext ctx) - { + public IMessage onMessage(AHPacketProcessor message, MessageContext ctx) { ItemStack itemStack = null; - if (message.slot > -1 && message.slot < 9) - { + if (message.slot > -1 && message.slot < 9) { itemStack = ctx.getServerHandler().playerEntity.inventory.getStackInSlot(message.slot); } - if (itemStack != null) - { + if (itemStack != null) { SigilAugmentedHolding.cycleSigil(itemStack, message.mode); } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/ContainerAugmentedHolding.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/ContainerAugmentedHolding.java index 1a7c9b6..1e92c85 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/ContainerAugmentedHolding.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/ContainerAugmentedHolding.java @@ -8,8 +8,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerAugmentedHolding extends Container -{ +public class ContainerAugmentedHolding extends Container { protected final int PLAYER_INVENTORY_ROWS = 3; protected final int PLAYER_INVENTORY_COLUMNS = 9; @@ -18,117 +17,99 @@ public class ContainerAugmentedHolding extends Container private final EntityPlayer player; public final InventoryAugmentedHolding inventoryHolding; - public ContainerAugmentedHolding(EntityPlayer player, InventoryAugmentedHolding inventoryHolding) - { + public ContainerAugmentedHolding(EntityPlayer player, InventoryAugmentedHolding inventoryHolding) { this.player = player; this.inventoryHolding = inventoryHolding; int currentSlotHeldIn = player.inventory.currentItem; - for (int columnIndex = 0; columnIndex < inventoryColumns; ++columnIndex) - { - this.addSlotToContainer(new SlotHolding(this, inventoryHolding, player, columnIndex, 8 + columnIndex * 18, 15)); + for (int columnIndex = 0; columnIndex < inventoryColumns; ++columnIndex) { + this.addSlotToContainer( + new SlotHolding(this, inventoryHolding, player, columnIndex, 8 + columnIndex * 18, 15)); } - for (int rowIndex = 0; rowIndex < PLAYER_INVENTORY_ROWS; ++rowIndex) - { - for (int columnIndex = 0; columnIndex < PLAYER_INVENTORY_COLUMNS; ++columnIndex) - { - this.addSlotToContainer(new Slot(player.inventory, columnIndex + rowIndex * 9 + 9, 8 + columnIndex * 18, 39 + rowIndex * 18)); + for (int rowIndex = 0; rowIndex < PLAYER_INVENTORY_ROWS; ++rowIndex) { + for (int columnIndex = 0; columnIndex < PLAYER_INVENTORY_COLUMNS; ++columnIndex) { + this.addSlotToContainer(new Slot( + player.inventory, columnIndex + rowIndex * 9 + 9, 8 + columnIndex * 18, 39 + rowIndex * 18)); } } - for (int actionBarIndex = 0; actionBarIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarIndex) - { - if (actionBarIndex == currentSlotHeldIn) - { - this.addSlotToContainer(new SlotDisabled(player.inventory, actionBarIndex, 8 + actionBarIndex * 18, 97)); - } - else - { + for (int actionBarIndex = 0; actionBarIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarIndex) { + if (actionBarIndex == currentSlotHeldIn) { + this.addSlotToContainer( + new SlotDisabled(player.inventory, actionBarIndex, 8 + actionBarIndex * 18, 97)); + } else { this.addSlotToContainer(new Slot(player.inventory, actionBarIndex, 8 + actionBarIndex * 18, 97)); } } } @Override - public boolean canInteractWith(EntityPlayer entityPlayer) - { + public boolean canInteractWith(EntityPlayer entityPlayer) { return true; } @Override - public void onContainerClosed(EntityPlayer entityPlayer) - { + public void onContainerClosed(EntityPlayer entityPlayer) { super.onContainerClosed(entityPlayer); - if (!entityPlayer.worldObj.isRemote) - { + if (!entityPlayer.worldObj.isRemote) { saveInventory(entityPlayer); } } @Override - public void detectAndSendChanges() - { + public void detectAndSendChanges() { super.detectAndSendChanges(); - if (!player.worldObj.isRemote) - { + if (!player.worldObj.isRemote) { saveInventory(player); } } @Override - public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) - { + public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slotIndex); int slots = inventorySlots.size(); - if (slotObject != null && slotObject.getHasStack()) - { + if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); - if (stack.getItem() instanceof ISigil) - { - if (slotIndex < inventoryColumns) - { - if (!this.mergeItemStack(stackInSlot, inventoryColumns, slots, false)) - { + if (stack.getItem() instanceof ISigil) { + if (slotIndex < inventoryColumns) { + if (!this.mergeItemStack(stackInSlot, inventoryColumns, slots, false)) { return null; } - } - else if (!this.mergeItemStack(stackInSlot, 0, inventoryColumns, false)) - { + } else if (!this.mergeItemStack(stackInSlot, 0, inventoryColumns, false)) { return null; } - } - else if (stack.getItem() instanceof SigilAugmentedHolding) - { - if (slotIndex < inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS)) - { - if (!this.mergeItemStack(stackInSlot, inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), inventorySlots.size(), false)) - { + } else if (stack.getItem() instanceof SigilAugmentedHolding) { + if (slotIndex < inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS)) { + if (!this.mergeItemStack( + stackInSlot, + inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), + inventorySlots.size(), + false)) { return null; } - } - else if (!this.mergeItemStack(stackInSlot, inventoryColumns, inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), false)) - { + } else if (!this.mergeItemStack( + stackInSlot, + inventoryColumns, + inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), + false)) { return null; } } - if (stackInSlot.stackSize == 0) - { + if (stackInSlot.stackSize == 0) { slotObject.putStack(null); - } else - { + } else { slotObject.onSlotChanged(); } - if (stackInSlot.stackSize == stack.stackSize) - { + if (stackInSlot.stackSize == stack.stackSize) { return null; } @@ -138,58 +119,54 @@ public class ContainerAugmentedHolding extends Container return stack; } - public void saveInventory(EntityPlayer entityPlayer) - { + public void saveInventory(EntityPlayer entityPlayer) { inventoryHolding.onGuiSaved(entityPlayer); } - private class SlotHolding extends Slot - { + private class SlotHolding extends Slot { private final EntityPlayer player; private ContainerAugmentedHolding containerHolding; - public SlotHolding(ContainerAugmentedHolding containerHolding, IInventory inventory, EntityPlayer player, int slotIndex, int x, int y) - { + public SlotHolding( + ContainerAugmentedHolding containerHolding, + IInventory inventory, + EntityPlayer player, + int slotIndex, + int x, + int y) { super(inventory, slotIndex, x, y); this.player = player; this.containerHolding = containerHolding; } @Override - public void onSlotChanged() - { + public void onSlotChanged() { super.onSlotChanged(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) - { + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { containerHolding.saveInventory(player); } } @Override - public boolean isItemValid(ItemStack itemStack) - { + public boolean isItemValid(ItemStack itemStack) { return itemStack.getItem() instanceof ISigil; } } - private class SlotDisabled extends Slot - { - public SlotDisabled(IInventory inventory, int slotIndex, int x, int y) - { + private class SlotDisabled extends Slot { + public SlotDisabled(IInventory inventory, int slotIndex, int x, int y) { super(inventory, slotIndex, x, y); } @Override - public boolean isItemValid(ItemStack itemStack) - { + public boolean isItemValid(ItemStack itemStack) { return false; } @Override - public boolean canTakeStack(EntityPlayer player) - { + public boolean canTakeStack(EntityPlayer player) { return false; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/GuiAugmentedHolding.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/GuiAugmentedHolding.java index 8590f69..d5483c3 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/GuiAugmentedHolding.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/GuiAugmentedHolding.java @@ -8,26 +8,22 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class GuiAugmentedHolding extends GuiContainer -{ - public GuiAugmentedHolding(EntityPlayer player, InventoryAugmentedHolding inventoryHolding) - { +public class GuiAugmentedHolding extends GuiContainer { + public GuiAugmentedHolding(EntityPlayer player, InventoryAugmentedHolding inventoryHolding) { super(new ContainerAugmentedHolding(player, inventoryHolding)); xSize = 176; ySize = 121; } @Override - protected void drawGuiContainerForegroundLayer(int param1, int param2) - { - //the parameters for drawString are: string, x, y, color + protected void drawGuiContainerForegroundLayer(int param1, int param2) { + // the parameters for drawString are: string, x, y, color fontRendererObj.drawString("Sigil of Augmented Holding", 24, 4, 4210752); } @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - //draw your Gui here, only thing you need to change is the path + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + // draw your Gui here, only thing you need to change is the path ResourceLocation test = new ResourceLocation("bloodarsenal", "textures/gui/SigilAugmentedHolding.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(test); diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/InventoryAugmentedHolding.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/InventoryAugmentedHolding.java index eb2111f..6644fe2 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/InventoryAugmentedHolding.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/InventoryAugmentedHolding.java @@ -1,16 +1,14 @@ package com.arc.bloodarsenal.common.items.sigil.holding; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import java.util.UUID; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import java.util.UUID; - -public class InventoryAugmentedHolding implements IInventory -{ +public class InventoryAugmentedHolding implements IInventory { public ItemStack parentItemStack; protected ItemStack[] inventory; @@ -18,8 +16,7 @@ public class InventoryAugmentedHolding implements IInventory protected static String NBT_LEAST_SIG = "LeastSig"; protected static String NBT_ITEMS = "Items"; - public InventoryAugmentedHolding(ItemStack itemStack) - { + public InventoryAugmentedHolding(ItemStack itemStack) { parentItemStack = itemStack; inventory = new ItemStack[9]; @@ -27,29 +24,26 @@ public class InventoryAugmentedHolding implements IInventory readFromNBT(itemStack.getTagCompound()); } - public void onGuiSaved(EntityPlayer entityPlayer) - { + public void onGuiSaved(EntityPlayer entityPlayer) { parentItemStack = findParentItemStack(entityPlayer); - if (parentItemStack != null) - { + if (parentItemStack != null) { save(); } } - public ItemStack findParentItemStack(EntityPlayer entityPlayer) - { - if (hasUUID(parentItemStack)) - { - UUID parentItemStackUUID = new UUID(parentItemStack.getTagCompound().getLong(NBT_MOST_SIG), parentItemStack.getTagCompound().getLong(NBT_LEAST_SIG)); - for (int i = 0; i < entityPlayer.inventory.getSizeInventory(); i++) - { + public ItemStack findParentItemStack(EntityPlayer entityPlayer) { + if (hasUUID(parentItemStack)) { + UUID parentItemStackUUID = new UUID( + parentItemStack.getTagCompound().getLong(NBT_MOST_SIG), + parentItemStack.getTagCompound().getLong(NBT_LEAST_SIG)); + for (int i = 0; i < entityPlayer.inventory.getSizeInventory(); i++) { ItemStack itemStack = entityPlayer.inventory.getStackInSlot(i); - if (hasUUID(itemStack)) - { - if (itemStack.getTagCompound().getLong(NBT_MOST_SIG) == parentItemStackUUID.getMostSignificantBits() && itemStack.getTagCompound().getLong(NBT_LEAST_SIG) == parentItemStackUUID.getLeastSignificantBits()) - { + if (hasUUID(itemStack)) { + if (itemStack.getTagCompound().getLong(NBT_MOST_SIG) == parentItemStackUUID.getMostSignificantBits() + && itemStack.getTagCompound().getLong(NBT_LEAST_SIG) + == parentItemStackUUID.getLeastSignificantBits()) { return itemStack; } } @@ -59,12 +53,10 @@ public class InventoryAugmentedHolding implements IInventory return null; } - public void save() - { + public void save() { NBTTagCompound nbtTagCompound = parentItemStack.getTagCompound(); - if (nbtTagCompound == null) - { + if (nbtTagCompound == null) { nbtTagCompound = new NBTTagCompound(); UUID uuid = UUID.randomUUID(); @@ -77,32 +69,24 @@ public class InventoryAugmentedHolding implements IInventory } @Override - public int getSizeInventory() - { + public int getSizeInventory() { return inventory.length; } @Override - public ItemStack getStackInSlot(int slotIndex) - { + public ItemStack getStackInSlot(int slotIndex) { return slotIndex >= 0 && slotIndex < this.inventory.length ? inventory[slotIndex] : null; } @Override - public ItemStack decrStackSize(int slotIndex, int decrementAmount) - { + public ItemStack decrStackSize(int slotIndex, int decrementAmount) { ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - if (itemStack.stackSize <= decrementAmount) - { + if (itemStack != null) { + if (itemStack.stackSize <= decrementAmount) { setInventorySlotContents(slotIndex, null); - } - else - { + } else { itemStack = itemStack.splitStack(decrementAmount); - if (itemStack.stackSize == 0) - { + if (itemStack.stackSize == 0) { setInventorySlotContents(slotIndex, null); } } @@ -112,92 +96,73 @@ public class InventoryAugmentedHolding implements IInventory } @Override - public ItemStack getStackInSlotOnClosing(int slotIndex) - { - if (inventory[slotIndex] != null) - { + public ItemStack getStackInSlotOnClosing(int slotIndex) { + if (inventory[slotIndex] != null) { ItemStack itemStack = inventory[slotIndex]; inventory[slotIndex] = null; return itemStack; - } - else - { + } else { return null; } } @Override - public void setInventorySlotContents(int slotIndex, ItemStack itemStack) - { - if (slotIndex >= 0 && slotIndex < this.inventory.length) - { + public void setInventorySlotContents(int slotIndex, ItemStack itemStack) { + if (slotIndex >= 0 && slotIndex < this.inventory.length) { this.inventory[slotIndex] = itemStack; } } @Override - public String getInventoryName() - { + public String getInventoryName() { return "SigilOfAugmentedHolding"; } @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return false; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } @Override - public void markDirty() - { + public void markDirty() { // NOOP } @Override - public boolean isUseableByPlayer(EntityPlayer entityPlayer) - { + public boolean isUseableByPlayer(EntityPlayer entityPlayer) { return true; } @Override - public void openInventory() - { + public void openInventory() { // NOOP } @Override - public void closeInventory() - { + public void closeInventory() { // NOOP } @Override - public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) - { + public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) { return itemStack.getItem() instanceof ISigil; } - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - if (nbtTagCompound != null && nbtTagCompound.hasKey(NBT_ITEMS)) - { + public void readFromNBT(NBTTagCompound nbtTagCompound) { + if (nbtTagCompound != null && nbtTagCompound.hasKey(NBT_ITEMS)) { // Read in the ItemStacks in the inventory from NBT - if (nbtTagCompound.hasKey(NBT_ITEMS)) - { + if (nbtTagCompound.hasKey(NBT_ITEMS)) { NBTTagList tagList = nbtTagCompound.getTagList(NBT_ITEMS, 10); inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < tagList.tagCount(); ++i) - { + for (int i = 0; i < tagList.tagCount(); ++i) { NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); byte slotIndex = tagCompound.getByte("Slot"); - if (slotIndex >= 0 && slotIndex < inventory.length) - { + if (slotIndex >= 0 && slotIndex < inventory.length) { inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); } } @@ -205,14 +170,11 @@ public class InventoryAugmentedHolding implements IInventory } } - public void writeToNBT(NBTTagCompound nbtTagCompound) - { + public void writeToNBT(NBTTagCompound nbtTagCompound) { // Write the ItemStacks in the inventory to NBT NBTTagList tagList = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) - { - if (inventory[currentIndex] != null) - { + for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) { + if (inventory[currentIndex] != null) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte) currentIndex); inventory[currentIndex].writeToNBT(tagCompound); @@ -222,40 +184,33 @@ public class InventoryAugmentedHolding implements IInventory nbtTagCompound.setTag(NBT_ITEMS, tagList); } - public static boolean hasTag(ItemStack itemStack, String keyName) - { + public static boolean hasTag(ItemStack itemStack, String keyName) { return itemStack != null && itemStack.stackTagCompound != null && itemStack.stackTagCompound.hasKey(keyName); } - public static boolean hasUUID(ItemStack itemStack) - { + public static boolean hasUUID(ItemStack itemStack) { return hasTag(itemStack, NBT_MOST_SIG) && hasTag(itemStack, NBT_LEAST_SIG); } - public static void setUUID(ItemStack itemStack) - { + public static void setUUID(ItemStack itemStack) { initNBTTagCompound(itemStack); - if (!hasTag(itemStack, NBT_MOST_SIG) && !hasTag(itemStack, NBT_LEAST_SIG)) - { + if (!hasTag(itemStack, NBT_MOST_SIG) && !hasTag(itemStack, NBT_LEAST_SIG)) { UUID itemUUID = UUID.randomUUID(); setLong(itemStack, NBT_MOST_SIG, itemUUID.getMostSignificantBits()); setLong(itemStack, NBT_LEAST_SIG, itemUUID.getLeastSignificantBits()); } } - private static void initNBTTagCompound(ItemStack itemStack) - { - if (itemStack.stackTagCompound == null) - { + private static void initNBTTagCompound(ItemStack itemStack) { + if (itemStack.stackTagCompound == null) { itemStack.setTagCompound(new NBTTagCompound()); } } - public static void setLong(ItemStack itemStack, String keyName, long keyValue) - { + public static void setLong(ItemStack itemStack, String keyName, long keyValue) { initNBTTagCompound(itemStack); itemStack.stackTagCompound.setLong(keyName, keyValue); } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/SigilAugmentedHolding.java b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/SigilAugmentedHolding.java index 8a825d9..89775a5 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/SigilAugmentedHolding.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/sigil/holding/SigilAugmentedHolding.java @@ -2,6 +2,7 @@ package com.arc.bloodarsenal.common.items.sigil.holding; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -12,36 +13,28 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilAugmentedHolding extends EnergyItems -{ +public class SigilAugmentedHolding extends EnergyItems { private static int invSize = 8; private static final String NBT_CURRENT_SIGIL = "CurrentSigil"; - public SigilAugmentedHolding() - { + public SigilAugmentedHolding() { super(); setMaxStackSize(1); } @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (!(stack.getTagCompound() == null)) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (!(stack.getTagCompound() == null)) { ItemStack[] inv = getInternalInventory(stack); - if (inv == null) - { + if (inv == null) { return this.itemIcon; } ItemStack item = getCurrentSigil(stack); - if (item != null) - { + if (item != null) { return item.getIconIndex(); } } @@ -50,59 +43,62 @@ public class SigilAugmentedHolding extends EnergyItems } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.augmentedHolding")); - if (!(par1ItemStack.getTagCompound() == null)) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!(par1ItemStack.getTagCompound() == null)) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); ItemStack[] inv = getInternalInventory(par1ItemStack); - if (inv == null) - { + if (inv == null) { return; } int currentSlot = getCurrentItem(par1ItemStack); ItemStack item = inv[currentSlot]; - if (item != null) - { + if (item != null) { par3List.add(StatCollector.translateToLocal("tooltip.item.currentitem") + " " + item.getDisplayName()); } - for (int i = 0; i <= invSize; i++) - { - if (inv[i] != null) - { - par3List.add(StatCollector.translateToLocal("tooltip.item.iteminslot") + " " + (i + 1) + ": " + inv[i].getDisplayName()); + for (int i = 0; i <= invSize; i++) { + if (inv[i] != null) { + par3List.add(StatCollector.translateToLocal("tooltip.item.iteminslot") + " " + (i + 1) + ": " + + inv[i].getDisplayName()); } } } } @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) - { - if (checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) - { + public boolean onItemUse( + ItemStack par1ItemStack, + EntityPlayer par2EntityPlayer, + World par3World, + int par4, + int par5, + int par6, + int par7, + float par8, + float par9, + float par10) { + if (checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) { int currentSlot = getCurrentItem(par1ItemStack); ItemStack[] inv = getInternalInventory(par1ItemStack); - if (inv == null) - { + if (inv == null) { return false; } ItemStack itemUsed = inv[currentSlot]; - if (itemUsed == null) - { + if (itemUsed == null) { return false; } - boolean bool = itemUsed.getItem().onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); + boolean bool = itemUsed.getItem() + .onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); saveInventory(par1ItemStack, inv); @@ -113,29 +109,30 @@ public class SigilAugmentedHolding extends EnergyItems } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) - { - if (par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { + if (par3EntityPlayer.isSneaking()) { InventoryAugmentedHolding.setUUID(par1ItemStack); - par3EntityPlayer.openGui(BloodArsenal.instance, 0, par3EntityPlayer.worldObj, (int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ); + par3EntityPlayer.openGui( + BloodArsenal.instance, + 0, + par3EntityPlayer.worldObj, + (int) par3EntityPlayer.posX, + (int) par3EntityPlayer.posY, + (int) par3EntityPlayer.posZ); return par1ItemStack; } int currentSlot = getCurrentItem(par1ItemStack); ItemStack[] inv = getInternalInventory(par1ItemStack); - if (inv == null) - { + if (inv == null) { return par1ItemStack; } ItemStack itemUsed = inv[currentSlot]; - if (itemUsed == null) - { + if (itemUsed == null) { return par1ItemStack; } @@ -146,47 +143,38 @@ public class SigilAugmentedHolding extends EnergyItems return par1ItemStack; } - public static int next(int mode) - { + public static int next(int mode) { int index = mode + 1; - if (index >= invSize + 1) - { + if (index >= invSize + 1) { index = 0; } return index; } - public static int prev(int mode) - { + public static int prev(int mode) { int index = mode - 1; - if (index < 0) - { + if (index < 0) { index = invSize; } return index; } - private static void initModeTag(ItemStack itemStack) - { - if (itemStack.stackTagCompound == null) - { + private static void initModeTag(ItemStack itemStack) { + if (itemStack.stackTagCompound == null) { itemStack.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setInteger(NBT_CURRENT_SIGIL, invSize); } } - public static ItemStack getCurrentSigil(ItemStack itemStack) - { - if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding) - { + public static ItemStack getCurrentSigil(ItemStack itemStack) { + if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding) { ItemStack[] itemStacks = getInternalInventory(itemStack); int currentSlot = getCurrentItem(itemStack); - if (itemStacks != null) - { + if (itemStacks != null) { return itemStacks[currentSlot]; } } @@ -194,10 +182,8 @@ public class SigilAugmentedHolding extends EnergyItems return null; } - public static int getCurrentItem(ItemStack itemStack) - { - if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding) - { + public static int getCurrentItem(ItemStack itemStack) { + if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding) { initModeTag(itemStack); int currentSigil = itemStack.stackTagCompound.getInteger(NBT_CURRENT_SIGIL); currentSigil = MathHelper.clamp_int(currentSigil, 0, invSize); @@ -207,31 +193,26 @@ public class SigilAugmentedHolding extends EnergyItems return 8; } - public static ItemStack[] getInternalInventory(ItemStack itemStack) - { + public static ItemStack[] getInternalInventory(ItemStack itemStack) { initModeTag(itemStack); NBTTagCompound tagCompound = itemStack.getTagCompound(); - if (tagCompound == null) - { + if (tagCompound == null) { return null; } ItemStack[] inv = new ItemStack[9]; NBTTagList tagList = tagCompound.getTagList(InventoryAugmentedHolding.NBT_ITEMS, 10); - if (tagList == null) - { + if (tagList == null) { return null; } - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); - if (slot >= 0 && slot <= invSize) - { + if (slot >= 0 && slot <= invSize) { inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } @@ -239,21 +220,17 @@ public class SigilAugmentedHolding extends EnergyItems return inv; } - public void saveInventory(ItemStack itemStack, ItemStack[] inventory) - { + public void saveInventory(ItemStack itemStack, ItemStack[] inventory) { NBTTagCompound itemTag = itemStack.getTagCompound(); - if (itemTag == null) - { + if (itemTag == null) { itemStack.setTagCompound(new NBTTagCompound()); } NBTTagList itemList = new NBTTagList(); - for (int i = 0; i <= invSize; i++) - { - if (inventory[i] != null) - { + for (int i = 0; i <= invSize; i++) { + if (inventory[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); inventory[i].writeToNBT(tag); @@ -264,37 +241,30 @@ public class SigilAugmentedHolding extends EnergyItems itemTag.setTag(InventoryAugmentedHolding.NBT_ITEMS, itemList); } - public static void cycleSigil(ItemStack itemStack, int mode) - { - if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding) - { + public static void cycleSigil(ItemStack itemStack, int mode) { + if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding) { initModeTag(itemStack); itemStack.stackTagCompound.setInteger(NBT_CURRENT_SIGIL, mode); } } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par1ItemStack.getTagCompound() == null)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par1ItemStack.getTagCompound() == null)) { this.tickInternalInventory(par1ItemStack, par2World, par3Entity, par4, par5); } } - public void tickInternalInventory(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { + public void tickInternalInventory( + ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { ItemStack[] inv = getInternalInventory(par1ItemStack); - if (inv == null) - { + if (inv == null) { return; } - for (int i = 0; i < invSize; i++) - { - if (inv[i] == null) - { + for (int i = 0; i < invSize; i++) { + if (inv[i] == null) { continue; } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundBow.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundBow.java index fad4d08..491611b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundBow.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundBow.java @@ -5,17 +5,18 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; 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.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.ItemBow; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -23,25 +24,25 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; -import java.util.List; - -public class BoundBow extends ItemBow implements IBindable -{ +public class BoundBow extends ItemBow implements IBindable { @SideOnly(Side.CLIENT) private IIcon active; + @SideOnly(Side.CLIENT) private IIcon active_1; + @SideOnly(Side.CLIENT) private IIcon active_2; + @SideOnly(Side.CLIENT) private IIcon active_3; + @SideOnly(Side.CLIENT) private IIcon passive; private int energyUsed; - public BoundBow() - { + public BoundBow() { setMaxStackSize(1); setMaxDamage(0); setUnlocalizedName("bound_bow"); @@ -50,129 +51,110 @@ public class BoundBow extends ItemBow implements IBindable setFull3D(); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @Override - public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) - { + public void onPlayerStoppedUsing( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { int j = getMaxItemUseDuration(par1ItemStack) - par4; ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j); MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) - { + if (event.isCanceled()) { return; } j = event.charge; - boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; + boolean flag = par3EntityPlayer.capabilities.isCreativeMode + || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; - if (flag || par3EntityPlayer.inventory.hasItem(Items.arrow)) - { - float f = (float)j / 6.0F; + if (flag || par3EntityPlayer.inventory.hasItem(Items.arrow)) { + float f = (float) j / 6.0F; f = (f * f + f * 2.0F) / 3.0F; - if ((double)f < 0.1D) - { + if ((double) f < 0.1D) { return; } - if (f > 1.0F) - { + if (f > 1.0F) { f = 1.0F; } EntityArrow entityarrow = new EntityArrow(par2World, par3EntityPlayer, f * 3.0F); - if (f == 1.0F) - { + if (f == 1.0F) { entityarrow.setIsCritical(true); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack); - if (k > 0) - { - entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D); + if (k > 0) { + entityarrow.setDamage(entityarrow.getDamage() + (double) k * 0.5D + 0.5D); } int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack); - if (l > 0) - { + if (l > 0) { entityarrow.setKnockbackStrength(l); } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0) - { + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0) { entityarrow.setFire(100); } par1ItemStack.damageItem(1, par3EntityPlayer); - par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + par2World.playSoundAtEntity( + par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); - if (flag) - { + if (flag) { entityarrow.canBePickedUp = 2; - } - else - { + } else { par3EntityPlayer.inventory.consumeInventoryItem(Items.arrow); } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(entityarrow); entityarrow.setDamage(entityarrow.getDamage() * 1.259178F); } } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 200); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack); MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) - { + if (event.isCanceled()) { return event.result; } - if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Items.arrow)) - { + if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Items.arrow)) { par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); } @@ -180,48 +162,40 @@ public class BoundBow extends ItemBow implements IBindable } @Override - public int getItemEnchantability() - { + public int getItemEnchantability() { return 1; } @Override - public EnumAction getItemUseAction(ItemStack par1ItemStack) - { + public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.bow; } @Override - public int getMaxItemUseDuration(ItemStack par1ItemStack) - { + public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 36000; } @Override - public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return par1ItemStack; } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50); } } @@ -229,24 +203,20 @@ public class BoundBow extends ItemBow implements IBindable par1ItemStack.setItemDamage(0); } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { + public boolean getActivated(ItemStack par1ItemStack) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -254,23 +224,17 @@ public class BoundBow extends ItemBow implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.bound_bow")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } @@ -278,8 +242,7 @@ public class BoundBow extends ItemBow implements IBindable @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("BloodArsenal:bound_bow"); active = iconRegister.registerIcon("BloodArsenal:bound_bow"); active_1 = iconRegister.registerIcon("BloodArsenal:bound_bow_pulling_0"); @@ -289,45 +252,33 @@ public class BoundBow extends ItemBow implements IBindable } @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (stack.stackTagCompound == null) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (stack.stackTagCompound == null) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.stackTagCompound; - if (tag.getBoolean("isActive")) - { - if (useRemaining > 0) - { + if (tag.getBoolean("isActive")) { + if (useRemaining > 0) { int draw = stack.getMaxItemUseDuration() - useRemaining; - if (draw > 17) - { + if (draw > 17) { return active_3; - } - else if (draw > 13) - { + } else if (draw > 13) { return active_2; - } - else if (draw > 0) - { + } else if (draw > 0) { return active_1; } } return active; - } - else - { + } else { return passive; } } @Override - public boolean isItemTool(ItemStack stack) - { + public boolean isItemTool(ItemStack stack) { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundIgniter.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundIgniter.java index a2d9208..11260d0 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundIgniter.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundIgniter.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; 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.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,19 +18,16 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class BoundIgniter extends Item implements IBindable -{ +public class BoundIgniter extends Item implements IBindable { private int energyUsed; @SideOnly(Side.CLIENT) private IIcon active; + @SideOnly(Side.CLIENT) private IIcon passive; - public BoundIgniter() - { + public BoundIgniter() { super(); setUnlocalizedName("bound_igniter"); setMaxStackSize(1); @@ -37,106 +35,99 @@ public class BoundIgniter extends Item implements IBindable setEnergyUsed(100); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (stack.stackTagCompound == null) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (stack.stackTagCompound == null) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.stackTagCompound; - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return active; - } - else - { + } else { return passive; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } return par1ItemStack; } - public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ) - { + public boolean onItemUse( + ItemStack itemStack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int hitSide, + float hitX, + float hitY, + float hitZ) { NBTTagCompound tag = itemStack.stackTagCompound; - if (tag.getBoolean("isActive")) - { - if (!player.capabilities.isCreativeMode) - { + if (tag.getBoolean("isActive")) { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(itemStack, player, 50); } - if (hitSide == 0) - { + if (hitSide == 0) { --y; } - if (hitSide == 1) - { + if (hitSide == 1) { ++y; } - if (hitSide == 2) - { + if (hitSide == 2) { --z; } - if (hitSide == 3) - { + if (hitSide == 3) { ++z; } - if (hitSide == 4) - { + if (hitSide == 4) { --x; } - if (hitSide == 5) - { + if (hitSide == 5) { ++x; } - if (!player.canPlayerEdit(x, y, z, hitSide, itemStack)) - { + if (!player.canPlayerEdit(x, y, z, hitSide, itemStack)) { return false; - } - else - { - if (world.isAirBlock(x, y, z)) - { - world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + } else { + if (world.isAirBlock(x, y, z)) { + world.playSoundEffect( + (double) x + 0.5D, + (double) y + 0.5D, + (double) z + 0.5D, + "fire.ignite", + 1.0F, + itemRand.nextFloat() * 0.4F + 0.8F); world.setBlock(x, y, z, Blocks.fire); } } @@ -146,24 +137,20 @@ public class BoundIgniter extends Item implements IBindable } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 100 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50); } } @@ -171,24 +158,20 @@ public class BoundIgniter extends Item implements IBindable par1ItemStack.setItemDamage(0); } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { + public boolean getActivated(ItemStack par1ItemStack) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -196,8 +179,7 @@ public class BoundIgniter extends Item implements IBindable } @Override - public boolean onLeftClickEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, Entity par3Entity) - { + public boolean onLeftClickEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, Entity par3Entity) { EntityLivingBase living = (EntityLivingBase) par3Entity; living.setFire(4); EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, 50); @@ -206,49 +188,39 @@ public class BoundIgniter extends Item implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.bound_igniter")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) - { + public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) { return false; } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { return itemStack; } @Override - public boolean hasContainerItem(ItemStack stack) - { + public boolean hasContainerItem(ItemStack stack) { return true; } @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("BloodArsenal:bound_igniter"); active = iconRegister.registerIcon("BloodArsenal:bound_igniter"); passive = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundShears.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundShears.java index d55f7ec..e663da7 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundShears.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundShears.java @@ -6,6 +6,9 @@ import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.entity.mob.EntityBloodHound; 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.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -25,21 +28,16 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class BoundShears extends ItemShears implements IBindable -{ +public class BoundShears extends ItemShears implements IBindable { private int energyUsed; @SideOnly(Side.CLIENT) private IIcon active; + @SideOnly(Side.CLIENT) private IIcon passive; - - public BoundShears() - { + + public BoundShears() { super(); setMaxStackSize(1); setUnlocalizedName("bound_shears"); @@ -47,73 +45,77 @@ public class BoundShears extends ItemShears implements IBindable setEnergyUsed(50); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { if (!(par7EntityLivingBase instanceof EntityPlayer)) return false; EntityPlayer player = (EntityPlayer) par7EntityLivingBase; - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, player, 50); } - if (par3Block.getMaterial() != Material.leaves && par3Block != Blocks.web && par3Block != Blocks.tallgrass && par3Block != Blocks.vine && par3Block != Blocks.tripwire && !(par3Block instanceof IShearable)) - { + if (par3Block.getMaterial() != Material.leaves + && par3Block != Blocks.web + && par3Block != Blocks.tallgrass + && par3Block != Blocks.vine + && par3Block != Blocks.tripwire + && !(par3Block instanceof IShearable)) { return super.onBlockDestroyed(par1ItemStack, par2World, par3Block, par4, par5, par6, par7EntityLivingBase); - } - else - { + } else { return true; } } - public boolean func_150897_b(Block par1Block) - { + public boolean func_150897_b(Block par1Block) { return par1Block == Blocks.web || par1Block == Blocks.redstone_wire || par1Block == Blocks.tripwire; } - public float func_150893_a(ItemStack par1ItemStack, Block par2Block) - { - return par2Block != Blocks.web && par2Block.getMaterial() != Material.leaves ? (par2Block == Blocks.wool ? 5.0F : super.func_150893_a(par1ItemStack, par2Block)) : 15.0F; + public float func_150893_a(ItemStack par1ItemStack, Block par2Block) { + return par2Block != Blocks.web && par2Block.getMaterial() != Material.leaves + ? (par2Block == Blocks.wool ? 5.0F : super.func_150893_a(par1ItemStack, par2Block)) + : 15.0F; } @Override - public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) - { + public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) { NBTTagCompound tag = itemstack.stackTagCompound; - if (tag.getBoolean("isActive")) - { - if (!player.capabilities.isCreativeMode) - { + if (tag.getBoolean("isActive")) { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(itemstack, player, 50); } - if (entity.worldObj.isRemote) - { + if (entity.worldObj.isRemote) { return false; } - if (entity instanceof IShearable) - { - IShearable target = (IShearable)entity; - if (target.isShearable(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ)) - { - ArrayList drops = target.onSheared(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ, + if (entity instanceof IShearable) { + IShearable target = (IShearable) entity; + if (target.isShearable( + itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) { + ArrayList drops = target.onSheared( + itemstack, + entity.worldObj, + (int) entity.posX, + (int) entity.posY, + (int) entity.posZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); Random rand = new Random(); - for (ItemStack stack : drops) - { + for (ItemStack stack : drops) { EntityItem ent = entity.entityDropItem(stack, 1.0F); ent.motionY += rand.nextFloat() * 0.05F; ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; @@ -127,33 +129,33 @@ public class BoundShears extends ItemShears implements IBindable } @Override - public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) - { + public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) { NBTTagCompound tag = itemstack.stackTagCompound; - if (tag.getBoolean("isActive")) - { - if (player.worldObj.isRemote) - { + if (tag.getBoolean("isActive")) { + if (player.worldObj.isRemote) { return false; } Block block = player.worldObj.getBlock(x, y, z); - if (block instanceof IShearable) - { - IShearable target = (IShearable)block; - if (target.isShearable(itemstack, player.worldObj, x, y, z)) - { - ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, + if (block instanceof IShearable) { + IShearable target = (IShearable) block; + if (target.isShearable(itemstack, player.worldObj, x, y, z)) { + ArrayList drops = target.onSheared( + itemstack, + player.worldObj, + x, + y, + z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); Random rand = new Random(); - for(ItemStack stack : drops) - { + for (ItemStack stack : drops) { float f = 0.7F; - double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(player.worldObj, (double)x + d, (double)y + d1, (double)z + d2, stack); + double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem( + player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, stack); entityitem.delayBeforeCanPickup = 10; player.worldObj.spawnEntityInWorld(entityitem); } @@ -165,23 +167,17 @@ public class BoundShears extends ItemShears implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.bound_shears1")); par3List.add(StatCollector.translateToLocal("tooltip.tool.bound_shears2")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } @@ -189,76 +185,62 @@ public class BoundShears extends ItemShears implements IBindable @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("BloodArsenal:bound_shears"); active = iconRegister.registerIcon("BloodArsenal:bound_shears"); passive = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); } @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (stack.stackTagCompound == null) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (stack.stackTagCompound == null) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.stackTagCompound; - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return active; - } - else - { + } else { return passive; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityBloodHound(par2World)); } return par1ItemStack; } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { + public boolean getActivated(ItemStack par1ItemStack) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -266,24 +248,20 @@ public class BoundShears extends ItemShears implements IBindable } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundSickle.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundSickle.java index f8b3f04..46e8313 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundSickle.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/BoundSickle.java @@ -1,12 +1,14 @@ package com.arc.bloodarsenal.common.items.tool; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import com.google.common.collect.Sets; import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; +import com.google.common.collect.Sets; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.client.renderer.texture.IIconRegister; @@ -23,11 +25,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.UseHoeEvent; -import java.util.List; -import java.util.Set; - -public class BoundSickle extends ItemTool implements IBindable -{ +public class BoundSickle extends ItemTool implements IBindable { private int energyUsed; private int radiusLeaf = 3; @@ -36,10 +34,24 @@ public class BoundSickle extends ItemTool implements IBindable private static IIcon active; private static IIcon passive; - private static final Set toolBlocks = Sets.newHashSet(new Block[] { Blocks.leaves, Blocks.leaves2, Blocks.wheat, Blocks.potatoes, Blocks.carrots, Blocks.nether_wart, Blocks.red_mushroom, Blocks.brown_mushroom, Blocks.reeds, Blocks.tallgrass, Blocks.vine, Blocks.waterlily, Blocks.red_flower, Blocks.yellow_flower }); + private static final Set toolBlocks = Sets.newHashSet(new Block[] { + Blocks.leaves, + Blocks.leaves2, + Blocks.wheat, + Blocks.potatoes, + Blocks.carrots, + Blocks.nether_wart, + Blocks.red_mushroom, + Blocks.brown_mushroom, + Blocks.reeds, + Blocks.tallgrass, + Blocks.vine, + Blocks.waterlily, + Blocks.red_flower, + Blocks.yellow_flower + }); - public BoundSickle(ToolMaterial toolMaterial) - { + public BoundSickle(ToolMaterial toolMaterial) { super(1.0F, toolMaterial, toolBlocks); setUnlocalizedName("bound_sickle"); setMaxStackSize(1); @@ -49,51 +61,46 @@ public class BoundSickle extends ItemTool implements IBindable setEnergyUsed(50); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int x, int y, int z, EntityLivingBase par7EntityLivingBase) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int x, + int y, + int z, + EntityLivingBase par7EntityLivingBase) { NBTTagCompound tag = par1ItemStack.stackTagCompound; boolean use = false; - if (tag.getBoolean("isActive")) - { - if (!(par7EntityLivingBase instanceof EntityPlayer)) - { + if (tag.getBoolean("isActive")) { + if (!(par7EntityLivingBase instanceof EntityPlayer)) { return false; } EntityPlayer player = (EntityPlayer) par7EntityLivingBase; - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, player, 50); } - if ((par3Block !=null) && (par3Block.isLeaves(par2World, x, y, z))) - { - for (int i = -radiusLeaf; i <= radiusLeaf; i++) - { - for (int j = -radiusLeaf; j <= radiusLeaf; j++) - { - for (int k = -radiusLeaf; k <= radiusLeaf; k++) - { + if ((par3Block != null) && (par3Block.isLeaves(par2World, x, y, z))) { + for (int i = -radiusLeaf; i <= radiusLeaf; i++) { + for (int j = -radiusLeaf; j <= radiusLeaf; j++) { + for (int k = -radiusLeaf; k <= radiusLeaf; k++) { Block blockToCheck = par2World.getBlock(x + i, y + j, z + k); int meta = par2World.getBlockMetadata(x + i, y + j, z + k); - if ((blockToCheck !=null) && (blockToCheck.isLeaves(par2World, x + i, y + j, z + k))) - { - if (blockToCheck.canHarvestBlock(player, meta)) - { + if ((blockToCheck != null) && (blockToCheck.isLeaves(par2World, x + i, y + j, z + k))) { + if (blockToCheck.canHarvestBlock(player, meta)) { blockToCheck.harvestBlock(par2World, player, x + i, y + j, z + k, meta); } par2World.setBlock(x + i, y + j, z + k, Blocks.air); @@ -104,19 +111,14 @@ public class BoundSickle extends ItemTool implements IBindable } } - for (int i = -radiusCrop; i <= radiusCrop; i++) - { - for (int j = -radiusCrop; j <= radiusCrop; j++) - { + for (int i = -radiusCrop; i <= radiusCrop; i++) { + for (int j = -radiusCrop; j <= radiusCrop; j++) { Block blockToCheck = par2World.getBlock(x + i, y, z + j); int meta = par2World.getBlockMetadata(x + i, y, z + j); - if (blockToCheck !=null) - { - if(blockToCheck instanceof BlockBush) - { - if (blockToCheck.canHarvestBlock(player, meta)) - { + if (blockToCheck != null) { + if (blockToCheck instanceof BlockBush) { + if (blockToCheck.canHarvestBlock(player, meta)) { blockToCheck.harvestBlock(par2World, player, x + i, y, z + j, meta); } par2World.setBlock(x + i, y, z + j, Blocks.air); @@ -130,153 +132,136 @@ public class BoundSickle extends ItemTool implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.bound_sickle1")); par3List.add(StatCollector.translateToLocal("tooltip.tool.bound_sickle2")); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (par1ItemStack.stackTagCompound.getBoolean("isActive")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (par1ItemStack.stackTagCompound.getBoolean("isActive")) { par3List.add("Activated"); - } - else - { + } else { par3List.add("Deactivated"); } - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10) - { + public boolean onItemUse( + ItemStack par1ItemStack, + EntityPlayer par2EntityPlayer, + World par3World, + int x, + int y, + int z, + int par7, + float par8, + float par9, + float par10) { NBTTagCompound tag = par1ItemStack.stackTagCompound; - if (tag.getBoolean("isActive")) - { - if (!par2EntityPlayer.capabilities.isCreativeMode) - { + if (tag.getBoolean("isActive")) { + if (!par2EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, 50); } - if (!par2EntityPlayer.canPlayerEdit(x, y, z, par7, par1ItemStack)) - { + if (!par2EntityPlayer.canPlayerEdit(x, y, z, par7, par1ItemStack)) { return false; - } - else - { + } else { UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, x, y, z); - if (MinecraftForge.EVENT_BUS.post(event)) - { + if (MinecraftForge.EVENT_BUS.post(event)) { return false; } - if (event.getResult() == Event.Result.ALLOW) - { + if (event.getResult() == Event.Result.ALLOW) { return true; } Block block = par3World.getBlock(x, y, z); - if (par7 != 0 && par3World.getBlock(x, y + 1, z).isAir(par3World, x, y + 1, z) && (block == Blocks.grass || block == Blocks.dirt)) - { + if (par7 != 0 + && par3World.getBlock(x, y + 1, z).isAir(par3World, x, y + 1, z) + && (block == Blocks.grass || block == Blocks.dirt)) { Block block1 = Blocks.farmland; - par3World.playSoundEffect((double)((float) x + 0.5F), (double)((float) y + 0.5F), (double)((float) z + 0.5F), block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F); + par3World.playSoundEffect( + (double) ((float) x + 0.5F), + (double) ((float) y + 0.5F), + (double) ((float) z + 0.5F), + block1.stepSound.getStepResourcePath(), + (block1.stepSound.getVolume() + 1.0F) / 2.0F, + block1.stepSound.getPitch() * 0.8F); - if (par3World.isRemote) - { + if (par3World.isRemote) { return true; - } - else - { + } else { par3World.setBlock(x, y, z, block1); return true; } - } - else - { + } else { return false; } } - } - else - { + } else { return false; } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon("BloodArsenal:bound_sickle"); active = iconRegister.registerIcon("BloodArsenal:bound_sickle"); passive = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); } @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (stack.stackTagCompound == null) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (stack.stackTagCompound == null) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.stackTagCompound; - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return active; - } - else - { + } else { return passive; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.stackTagCompound.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } return par1ItemStack; } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { + public boolean getActivated(ItemStack par1ItemStack) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -284,24 +269,20 @@ public class BoundSickle extends ItemTool implements IBindable } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer)) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.stackTagCompound == null) - { + if (par1ItemStack.stackTagCompound == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") && par1ItemStack.stackTagCompound.getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (par2World.getWorldTime() % 200 == par1ItemStack.stackTagCompound.getInteger("worldTimeDelay") + && par1ItemStack.stackTagCompound.getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50); } } @@ -311,8 +292,7 @@ public class BoundSickle extends ItemTool implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassDaggerOfSacrifice.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassDaggerOfSacrifice.java index f7ccf09..d3b19f0 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassDaggerOfSacrifice.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassDaggerOfSacrifice.java @@ -8,6 +8,8 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.BloodArsenalConfig; import com.google.common.collect.Multimap; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; @@ -26,15 +28,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - -public class GlassDaggerOfSacrifice extends EnergyItems -{ +public class GlassDaggerOfSacrifice extends EnergyItems { private float weaponDamage; - public GlassDaggerOfSacrifice() - { + public GlassDaggerOfSacrifice() { super(); setMaxStackSize(1); setEnergyUsed(100); @@ -44,33 +41,35 @@ public class GlassDaggerOfSacrifice extends EnergyItems } @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { - if (par3EntityLivingBase == null || par2EntityLivingBase == null || par3EntityLivingBase.worldObj.isRemote || (par3EntityLivingBase instanceof EntityPlayer && SpellHelper.isFakePlayer(par3EntityLivingBase.worldObj, (EntityPlayer) par3EntityLivingBase))) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + if (par3EntityLivingBase == null + || par2EntityLivingBase == null + || par3EntityLivingBase.worldObj.isRemote + || (par3EntityLivingBase instanceof EntityPlayer + && SpellHelper.isFakePlayer( + par3EntityLivingBase.worldObj, (EntityPlayer) par3EntityLivingBase))) { return false; } - if (par2EntityLivingBase instanceof IHoardDemon) - { + if (par2EntityLivingBase instanceof IHoardDemon) { return false; } - if (par2EntityLivingBase.isChild() || par2EntityLivingBase instanceof EntityPlayer || par2EntityLivingBase instanceof IBossDisplayData) - { + if (par2EntityLivingBase.isChild() + || par2EntityLivingBase instanceof EntityPlayer + || par2EntityLivingBase instanceof IBossDisplayData) { return false; } World world = par2EntityLivingBase.worldObj; - if (par2EntityLivingBase.isDead || par2EntityLivingBase.getHealth() < 0.5f) - { + if (par2EntityLivingBase.isDead || par2EntityLivingBase.getHealth() < 0.5f) { return false; } - if (par2EntityLivingBase instanceof IDemon) - { - ((IDemon)par2EntityLivingBase).setDropCrystal(false); + if (par2EntityLivingBase instanceof IDemon) { + ((IDemon) par2EntityLivingBase).setDropCrystal(false); this.findAndNotifyAltarOfDemon(world, par2EntityLivingBase); } @@ -83,23 +82,21 @@ public class GlassDaggerOfSacrifice extends EnergyItems else if (par2EntityLivingBase instanceof EntityEnderman) lifeEssence = 300; else if (par2EntityLivingBase instanceof EntityAnimal) lifeEssence = 350; - if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, lifeEssence)) - { + if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, lifeEssence)) { double posX = par2EntityLivingBase.posX; double posY = par2EntityLivingBase.posY; double posZ = par2EntityLivingBase.posZ; - for (int i = 0; i < 8; i++) - { - SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ); + for (int i = 0; i < 8; i++) { + SpellHelper.sendIndexedParticleToAllAround( + world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ); } par2EntityLivingBase.setHealth(-1); par2EntityLivingBase.onDeath(BloodArsenal.deathFromBlood); } - if (!par2EntityLivingBase.isDead) - { + if (!par2EntityLivingBase.isDead) { par2EntityLivingBase.addPotionEffect(new PotionEffect(BloodArsenalConfig.bleedingID, 20, 0)); } @@ -107,47 +104,47 @@ public class GlassDaggerOfSacrifice extends EnergyItems } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.glassDaggerOfSacrifice")); } @Override - public float func_150893_a(ItemStack par1ItemStack, Block par2Block) - { - if (par2Block == Blocks.web) - { + public float func_150893_a(ItemStack par1ItemStack, Block par2Block) { + if (par2Block == Blocks.web) { return 15.0F; - } else - { + } else { Material material = par2Block.getMaterial(); - return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F; + return material != Material.plants + && material != Material.vine + && material != Material.coral + && material != Material.leaves + && material != Material.gourd + ? 1.0F + : 1.5F; } } @Override - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) - { + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return false; } @Override - public Multimap getItemAttributeModifiers() - { + public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", 2.0d, 0)); + multimap.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Tool modifier", 2.0d, 0)); return multimap; } - public boolean findAndNotifyAltarOfDemon(World world, EntityLivingBase sacrifice) - { + public boolean findAndNotifyAltarOfDemon(World world, EntityLivingBase sacrifice) { int posX = (int) Math.round(sacrifice.posX - 0.5f); int posY = (int) sacrifice.posY; int posZ = (int) Math.round(sacrifice.posZ - 0.5f); IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ); - if (altarEntity == null) - { + if (altarEntity == null) { return false; } @@ -156,15 +153,13 @@ public class GlassDaggerOfSacrifice extends EnergyItems return true; } - public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount) - { + public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount) { int posX = (int) Math.round(sacrifice.posX - 0.5f); int posY = (int) sacrifice.posY; int posZ = (int) Math.round(sacrifice.posZ - 0.5f); IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ); - if (altarEntity == null) - { + if (altarEntity == null) { return false; } @@ -173,20 +168,15 @@ public class GlassDaggerOfSacrifice extends EnergyItems return true; } - public IBloodAltar getAltar(World world, int x, int y, int z) - { + public IBloodAltar getAltar(World world, int x, int y, int z) { TileEntity tileEntity; - for (int i = -2; i <= 2; i++) - { - for (int j = -2; j <= 2; j++) - { - for (int k = -2; k <= 1; k++) - { + for (int i = -2; i <= 2; i++) { + for (int j = -2; j <= 2; j++) { + for (int k = -2; k <= 1; k++) { tileEntity = world.getTileEntity(i + x, k + y, j + z); - if (tileEntity instanceof IBloodAltar) - { + if (tileEntity instanceof IBloodAltar) { return (IBloodAltar) tileEntity; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassSacrificialDagger.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassSacrificialDagger.java index 189363b..5530ff1 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassSacrificialDagger.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/GlassSacrificialDagger.java @@ -9,6 +9,8 @@ import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.BloodArsenalConfig; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -22,13 +24,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; -import java.util.List; -import java.util.Random; - -public class GlassSacrificialDagger extends Item -{ - public GlassSacrificialDagger() - { +public class GlassSacrificialDagger extends Item { + public GlassSacrificialDagger() { super(); setMaxStackSize(1); setFull3D(); @@ -36,118 +33,109 @@ public class GlassSacrificialDagger extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - if (AlchemicalWizardry.wimpySettings) - { + public void registerIcons(IIconRegister iconRegister) { + if (AlchemicalWizardry.wimpySettings) { this.itemIcon = iconRegister.registerIcon("BloodArsenal:glass_sacrificial_orb"); - } - else - { + } else { this.itemIcon = iconRegister.registerIcon("BloodArsenal:glass_sacrificial_dagger"); } } @Override - public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.glassSacrificeDagger")); } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) - { - if (this.canUseForSacrifice(stack)) - { + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if (this.canUseForSacrifice(stack)) { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); return stack; } - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2); - if (MinecraftForge.EVENT_BUS.post(evt)) - { + if (MinecraftForge.EVENT_BUS.post(evt)) { return stack; } - if (evt.shouldDrainHealth) - { + if (evt.shouldDrainHealth) { player.setHealth(player.getHealth() - 2); } - if (!evt.shouldFillAltar) - { + if (!evt.shouldFillAltar) { return stack; } } - if (player instanceof FakePlayer) - { + if (player instanceof FakePlayer) { return stack; } double posX = player.posX; double posY = player.posY; double posZ = player.posZ; - world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); + world.playSoundEffect( + (double) ((float) posX + 0.5F), + (double) ((float) posY + 0.5F), + (double) ((float) posZ + 0.5F), + "random.fizz", + 0.5F, + 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); float f = 1.0F; float f1 = f * 0.6F + 0.4F; float f2 = f * f * 0.7F - 0.5F; float f3 = f * f * 0.6F - 0.7F; - for (int l = 0; l < 8; ++l) - { - world.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3); + for (int l = 0; l < 8; ++l) { + world.spawnParticle( + "reddust", + posX + Math.random() - Math.random(), + posY + Math.random() - Math.random(), + posZ + Math.random() - Math.random(), + f1, + f2, + f3); } - if (!world.isRemote && SpellHelper.isFakePlayer(world, player)) - { + if (!world.isRemote && SpellHelper.isFakePlayer(world, player)) { return stack; } - if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) - { + if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) { findAndFillAltar(world, player, 50); - } else - { + } else { findAndFillAltar(world, player, 500); } - if (player.getHealth() <= 0.001f) - { + if (player.getHealth() <= 0.001f) { player.onDeath(BloodArsenal.deathFromBlood); } Random random = new Random(); - if (random.nextInt(4) < 1) - { + if (random.nextInt(4) < 1) { player.addPotionEffect(new PotionEffect(BloodArsenalConfig.bleedingID, random.nextInt(5) * 20, 0)); } return stack; } @Override - public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) - { + public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) { PlayerSacrificeHandler.sacrificePlayerHealth(player); } @Override - public int getMaxItemUseDuration(ItemStack stack) - { + public int getMaxItemUseDuration(ItemStack stack) { return 72000; } - public void findAndFillAltar(World world, EntityPlayer player, int amount) - { + public void findAndFillAltar(World world, EntityPlayer player, int amount) { int posX = (int) Math.round(player.posX - 0.5f); int posY = (int) player.posY; int posZ = (int) Math.round(player.posZ - 0.5f); IBloodAltar altarEntity = getAltar(world, posX, posY, posZ); - if (altarEntity == null) - { + if (altarEntity == null) { return; } @@ -155,20 +143,15 @@ public class GlassSacrificialDagger extends Item altarEntity.startCycle(); } - public IBloodAltar getAltar(World world, int x, int y, int z) - { + public IBloodAltar getAltar(World world, int x, int y, int z) { TileEntity tileEntity; - for (int i = -2; i <= 2; i++) - { - for (int j = -2; j <= 2; j++) - { - for (int k = -2; k <= 1; k++) - { + for (int i = -2; i <= 2; i++) { + for (int j = -2; j <= 2; j++) { + for (int k = -2; k <= 1; k++) { tileEntity = world.getTileEntity(i + x, k + y, j + z); - if ((tileEntity instanceof IBloodAltar)) - { + if ((tileEntity instanceof IBloodAltar)) { return (IBloodAltar) tileEntity; } } @@ -179,41 +162,33 @@ public class GlassSacrificialDagger extends Item } @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) - { - if (!world.isRemote && entity instanceof EntityPlayer) - { - this.setUseForSacrifice(stack, this.isPlayerPreparedForSacrifice(world, (EntityPlayer)entity)); + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { + if (!world.isRemote && entity instanceof EntityPlayer) { + this.setUseForSacrifice(stack, this.isPlayerPreparedForSacrifice(world, (EntityPlayer) entity)); } } @Override - public String getItemStackDisplayName(ItemStack stack) - { - if (AlchemicalWizardry.wimpySettings) - { + public String getItemStackDisplayName(ItemStack stack) { + if (AlchemicalWizardry.wimpySettings) { return StatCollector.translateToLocal("item.glass_sacrificial_orb.name"); } return super.getItemStackDisplayName(stack); } - public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player) - { + public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player) { return !world.isRemote && (PlayerSacrificeHandler.getPlayerIncense(player) > 0); } - public boolean canUseForSacrifice(ItemStack stack) - { + public boolean canUseForSacrifice(ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); return tag != null && tag.getBoolean("sacrifice"); } - public void setUseForSacrifice(ItemStack stack, boolean sacrifice) - { + public void setUseForSacrifice(ItemStack stack, boolean sacrifice) { NBTTagCompound tag = stack.getTagCompound(); - if (tag == null) - { + if (tag == null) { tag = new NBTTagCompound(); stack.setTagCompound(tag); } @@ -223,8 +198,7 @@ public class GlassSacrificialDagger extends Item @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack stack, int pass) - { + public boolean hasEffect(ItemStack stack, int pass) { return this.canUseForSacrifice(stack) || super.hasEffect(stack, pass); } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/IFillable.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/IFillable.java index 8a4399e..4db5e40 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/IFillable.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/IFillable.java @@ -2,8 +2,7 @@ package com.arc.bloodarsenal.common.items.tool; import net.minecraft.item.ItemStack; -public interface IFillable -{ +public interface IFillable { int getMaxLP(); int getLPStored(ItemStack container); diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamond.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamond.java index 0cb0ac1..404776b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamond.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamond.java @@ -4,6 +4,7 @@ import com.arc.bloodarsenal.common.BloodArsenal; import com.arc.bloodarsenal.common.items.ModItems; 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.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -11,74 +12,53 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.List; - -public class InfusedDiamond extends Item -{ - public InfusedDiamond() - { +public class InfusedDiamond extends Item { + public InfusedDiamond() { super(); setMaxStackSize(1); setCreativeTab(BloodArsenal.BA_TAB); } @Override - public void registerIcons(IIconRegister iconRegister) - { - if (equals(ModItems.blood_diamond)) - { + public void registerIcons(IIconRegister iconRegister) { + if (equals(ModItems.blood_diamond)) { itemIcon = iconRegister.registerIcon("BloodArsenal:blood_diamond"); - } - else if (equals(ModItems.blood_infused_diamond_unactive)) - { + } else if (equals(ModItems.blood_infused_diamond_unactive)) { itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_diamond_unactive"); - } - else if (equals(ModItems.blood_infused_diamond_active)) - { + } else if (equals(ModItems.blood_infused_diamond_active)) { itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_diamond_active"); - } - else if (equals(ModItems.blood_infused_diamond_bound)) - { + } else if (equals(ModItems.blood_infused_diamond_bound)) { itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_diamond_bound"); } } @Override - public EnumRarity getRarity(ItemStack stack) - { - if (equals(ModItems.blood_infused_diamond_bound)) - { + public EnumRarity getRarity(ItemStack stack) { + if (equals(ModItems.blood_infused_diamond_bound)) { return EnumRarity.uncommon; - } - else - { + } else { return EnumRarity.common; } } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - if (equals(ModItems.blood_infused_diamond_unactive)) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (equals(ModItems.blood_infused_diamond_unactive)) { par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_unactive1")); par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_unactive2")); } - if (equals(ModItems.blood_infused_diamond_active)) - { + if (equals(ModItems.blood_infused_diamond_active)) { par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_active1")); par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_active2")); } - if (equals(ModItems.blood_infused_diamond_bound)) - { + if (equals(ModItems.blood_infused_diamond_bound)) { par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_bound")); } } @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack par1ItemStack, int pass) - { + public boolean hasEffect(ItemStack par1ItemStack, int pass) { return equals(ModItems.blood_infused_diamond_bound); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondAxe.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondAxe.java index a753c2b..43688c3 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondAxe.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondAxe.java @@ -5,6 +5,8 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; @@ -19,15 +21,10 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.List; - -public class InfusedDiamondAxe extends ItemAxe implements IBindable -{ +public class InfusedDiamondAxe extends ItemAxe implements IBindable { public static ArrayList oreDictLogs = new ArrayList(); - public InfusedDiamondAxe() - { + public InfusedDiamondAxe() { super(BloodArsenal.infusedIron); setMaxStackSize(1); setUnlocalizedName("blood_infused_axe_diamond"); @@ -38,39 +35,29 @@ public class InfusedDiamondAxe extends ItemAxe implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_infused_diamond_axe")); - if (par1ItemStack.getItemDamage() == 0) - { + if (par1ItemStack.getItemDamage() == 0) { par3List.add("Normal Mode"); - } - else if (par1ItemStack.getItemDamage() == 1) - { + } else if (par1ItemStack.getItemDamage() == 1) { par3List.add("Area Mode"); - } - else if (par1ItemStack.getItemDamage() == 2) - { + } else if (par1ItemStack.getItemDamage() == 2) { par3List.add("Tree Mode"); } - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { ToolCapabilities.changeMode(par1ItemStack); } @@ -78,38 +65,30 @@ public class InfusedDiamondAxe extends ItemAxe implements IBindable } @Override - public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) - { + public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { World world = player.worldObj; Material mat = world.getBlock(x, y, z).getMaterial(); - if (!ToolCapabilities.isRightMaterial(mat, ToolCapabilities.materialsAxe)) - { + if (!ToolCapabilities.isRightMaterial(mat, ToolCapabilities.materialsAxe)) { return false; } MovingObjectPosition block = ToolCapabilities.raytraceFromEntity(world, player, true, 4.5); - if (block == null) - { + if (block == null) { return false; } ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit); - switch (ToolCapabilities.getMode(stack)) - { - case 0: - { - if (!player.capabilities.isCreativeMode) - { + switch (ToolCapabilities.getMode(stack)) { + case 0: { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(stack, player, 100); } break; } - case 1: - { - if (!player.capabilities.isCreativeMode) - { + case 1: { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(stack, player, 1000); } @@ -117,28 +96,37 @@ public class InfusedDiamondAxe extends ItemAxe implements IBindable boolean doY = direction.offsetY == 0; boolean doZ = direction.offsetZ == 0; - ToolCapabilities.removeBlocksInIteration(player, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolCapabilities.materialsAxe); + ToolCapabilities.removeBlocksInIteration( + player, + world, + x, + y, + z, + doX ? -2 : 0, + doY ? -1 : 0, + doZ ? -2 : 0, + doX ? 3 : 1, + doY ? 4 : 1, + doZ ? 3 : 1, + null, + ToolCapabilities.materialsAxe); break; } - case 2: - { + case 2: { Block blck = world.getBlock(x, y, z); - if (ToolCapabilities.isWood(world, x, y, z)) - { - while (blck != Blocks.air) - { + if (ToolCapabilities.isWood(world, x, y, z)) { + while (blck != Blocks.air) { ToolCapabilities.breakFurthestBlock(world, x, y, z, blck, player); blck = world.getBlock(x, y, z); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(stack, player, 5000); } } - List items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - 5, y - 1, z - 5, x + 5, y + 64, z + 5)); - for (EntityItem item : items) - { + List items = world.getEntitiesWithinAABB( + EntityItem.class, AxisAlignedBB.getBoundingBox(x - 5, y - 1, z - 5, x + 5, y + 64, z + 5)); + for (EntityItem item : items) { item.setPosition(x + 0.5, y + 0.5, z + 0.5); item.ticksExisted += 20; } @@ -151,22 +139,19 @@ public class InfusedDiamondAxe extends ItemAxe implements IBindable @Override @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack par1ItemStack, int pass) - { + public boolean hasEffect(ItemStack par1ItemStack, int pass) { return true; } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.rare; } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondPickaxe.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondPickaxe.java index e31f900..3ce499a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondPickaxe.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondPickaxe.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; @@ -17,14 +18,10 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - -public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable -{ +public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable { private int energyUsed; - public InfusedDiamondPickaxe() - { + public InfusedDiamondPickaxe() { super(BloodArsenal.infusedIron); setMaxStackSize(1); setUnlocalizedName("blood_infused_pickaxe_diamond"); @@ -35,50 +32,38 @@ public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable setEnergyUsed(300); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_infused_diamond_pickaxe")); - if (par1ItemStack.getItemDamage() == 0) - { + if (par1ItemStack.getItemDamage() == 0) { par3List.add("Normal Mode"); - } - else if (par1ItemStack.getItemDamage() == 1) - { + } else if (par1ItemStack.getItemDamage() == 1) { par3List.add("Line Mode"); - } - else if (par1ItemStack.getItemDamage() == 2) - { + } else if (par1ItemStack.getItemDamage() == 2) { par3List.add("Square Mode"); } - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { ToolCapabilities.changeMode(par1ItemStack); } @@ -86,10 +71,15 @@ public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { - if (par7EntityLivingBase instanceof EntityPlayer) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } @@ -97,37 +87,29 @@ public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable } @Override - public boolean onBlockStartBreak(ItemStack par1ItemStack, int x, int y, int z, EntityPlayer par5EntityPlayer) - { + public boolean onBlockStartBreak(ItemStack par1ItemStack, int x, int y, int z, EntityPlayer par5EntityPlayer) { World world = par5EntityPlayer.worldObj; Material mat = world.getBlock(x, y, z).getMaterial(); - if (!ToolCapabilities.isRightMaterial(mat, ToolCapabilities.materialsPick)) - { + if (!ToolCapabilities.isRightMaterial(mat, ToolCapabilities.materialsPick)) { return false; } MovingObjectPosition block = ToolCapabilities.raytraceFromEntity(world, par5EntityPlayer, true, 4.5); - if (block == null) - { + if (block == null) { return false; } ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit); - switch (ToolCapabilities.getMode(par1ItemStack)) - { - case 0: - { - if (!par5EntityPlayer.capabilities.isCreativeMode) - { + switch (ToolCapabilities.getMode(par1ItemStack)) { + case 0: { + if (!par5EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par5EntityPlayer, 100); } break; } - case 1: - { - if (!par5EntityPlayer.capabilities.isCreativeMode) - { + case 1: { + if (!par5EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par5EntityPlayer, 1000); } @@ -135,13 +117,24 @@ public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable int yo = -direction.offsetY; int zo = -direction.offsetZ; - ToolCapabilities.removeBlocksInIteration(par5EntityPlayer, world, x, y, z, xo >= 0 ? 0 : -10, yo >= 0 ? 0 : -10, zo >= 0 ? 0 : -10, xo > 0 ? 10 : 1, yo > 0 ? 10 : 1, zo > 0 ? 10 : 1, null, ToolCapabilities.materialsPick); + ToolCapabilities.removeBlocksInIteration( + par5EntityPlayer, + world, + x, + y, + z, + xo >= 0 ? 0 : -10, + yo >= 0 ? 0 : -10, + zo >= 0 ? 0 : -10, + xo > 0 ? 10 : 1, + yo > 0 ? 10 : 1, + zo > 0 ? 10 : 1, + null, + ToolCapabilities.materialsPick); break; } - case 2: - { - if (!par5EntityPlayer.capabilities.isCreativeMode) - { + case 2: { + if (!par5EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par5EntityPlayer, 2500); } @@ -149,7 +142,20 @@ public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable boolean doY = direction.offsetY == 0; boolean doZ = direction.offsetZ == 0; - ToolCapabilities.removeBlocksInIteration(par5EntityPlayer, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolCapabilities.materialsPick); + ToolCapabilities.removeBlocksInIteration( + par5EntityPlayer, + world, + x, + y, + z, + doX ? -2 : 0, + doY ? -1 : 0, + doZ ? -2 : 0, + doX ? 3 : 1, + doY ? 4 : 1, + doZ ? 3 : 1, + null, + ToolCapabilities.materialsPick); break; } } @@ -158,22 +164,19 @@ public class InfusedDiamondPickaxe extends ItemPickaxe implements IBindable @Override @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack par1ItemStack, int pass) - { + public boolean hasEffect(ItemStack par1ItemStack, int pass) { return true; } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.rare; } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondShovel.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondShovel.java index 5597531..ab9088f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondShovel.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondShovel.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -15,12 +16,8 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - -public class InfusedDiamondShovel extends ItemSpade implements IBindable -{ - public InfusedDiamondShovel() - { +public class InfusedDiamondShovel extends ItemSpade implements IBindable { + public InfusedDiamondShovel() { super(BloodArsenal.infusedIron); setMaxStackSize(1); setUnlocalizedName("blood_infused_shovel_diamond"); @@ -31,39 +28,29 @@ public class InfusedDiamondShovel extends ItemSpade implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_infused_diamond_shovel")); - if (par1ItemStack.getItemDamage() == 0) - { + if (par1ItemStack.getItemDamage() == 0) { par3List.add("Normal Mode"); - } - else if (par1ItemStack.getItemDamage() == 1) - { + } else if (par1ItemStack.getItemDamage() == 1) { par3List.add("Line Mode"); - } - else if (par1ItemStack.getItemDamage() == 2) - { + } else if (par1ItemStack.getItemDamage() == 2) { par3List.add("Square Mode"); } - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { ToolCapabilities.changeMode(par1ItemStack); } @@ -71,37 +58,29 @@ public class InfusedDiamondShovel extends ItemSpade implements IBindable } @Override - public boolean onBlockStartBreak(ItemStack par1ItemStack, int x, int y, int z, EntityPlayer par5EntityPlayer) - { + public boolean onBlockStartBreak(ItemStack par1ItemStack, int x, int y, int z, EntityPlayer par5EntityPlayer) { World world = par5EntityPlayer.worldObj; Material mat = world.getBlock(x, y, z).getMaterial(); - if (!ToolCapabilities.isRightMaterial(mat, ToolCapabilities.materialsShovel)) - { + if (!ToolCapabilities.isRightMaterial(mat, ToolCapabilities.materialsShovel)) { return false; } MovingObjectPosition block = ToolCapabilities.raytraceFromEntity(world, par5EntityPlayer, true, 4.5); - if (block == null) - { + if (block == null) { return false; } ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit); - switch (ToolCapabilities.getMode(par1ItemStack)) - { - case 0: - { - if (!par5EntityPlayer.capabilities.isCreativeMode) - { + switch (ToolCapabilities.getMode(par1ItemStack)) { + case 0: { + if (!par5EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par5EntityPlayer, 100); } break; } - case 1: - { - if (!par5EntityPlayer.capabilities.isCreativeMode) - { + case 1: { + if (!par5EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par5EntityPlayer, 1000); } @@ -109,13 +88,24 @@ public class InfusedDiamondShovel extends ItemSpade implements IBindable int yo = -direction.offsetY; int zo = -direction.offsetZ; - ToolCapabilities.removeBlocksInIteration(par5EntityPlayer, world, x, y, z, xo >= 0 ? 0 : -10, yo >= 0 ? 0 : -10, zo >= 0 ? 0 : -10, xo > 0 ? 10 : 1, yo > 0 ? 10 : 1, zo > 0 ? 10 : 1, null, ToolCapabilities.materialsShovel); + ToolCapabilities.removeBlocksInIteration( + par5EntityPlayer, + world, + x, + y, + z, + xo >= 0 ? 0 : -10, + yo >= 0 ? 0 : -10, + zo >= 0 ? 0 : -10, + xo > 0 ? 10 : 1, + yo > 0 ? 10 : 1, + zo > 0 ? 10 : 1, + null, + ToolCapabilities.materialsShovel); break; } - case 2: - { - if (!par5EntityPlayer.capabilities.isCreativeMode) - { + case 2: { + if (!par5EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(par1ItemStack, par5EntityPlayer, 2500); } @@ -123,7 +113,20 @@ public class InfusedDiamondShovel extends ItemSpade implements IBindable boolean doY = direction.offsetY == 0; boolean doZ = direction.offsetZ == 0; - ToolCapabilities.removeBlocksInIteration(par5EntityPlayer, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolCapabilities.materialsShovel); + ToolCapabilities.removeBlocksInIteration( + par5EntityPlayer, + world, + x, + y, + z, + doX ? -2 : 0, + doY ? -1 : 0, + doZ ? -2 : 0, + doX ? 3 : 1, + doY ? 4 : 1, + doZ ? 3 : 1, + null, + ToolCapabilities.materialsShovel); break; } } @@ -132,22 +135,19 @@ public class InfusedDiamondShovel extends ItemSpade implements IBindable @Override @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack par1ItemStack, int pass) - { + public boolean hasEffect(ItemStack par1ItemStack, int pass) { return true; } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.rare; } -} \ No newline at end of file +} diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondSword.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondSword.java index 440bf4a..df2f5e0 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondSword.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedDiamondSword.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -17,12 +18,8 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class InfusedDiamondSword extends ItemSword implements IBindable -{ - public InfusedDiamondSword() - { +public class InfusedDiamondSword extends ItemSword implements IBindable { + public InfusedDiamondSword() { super(BloodArsenal.infusedDiamond); setMaxStackSize(1); setUnlocalizedName("blood_infused_sword_diamond"); @@ -33,27 +30,19 @@ public class InfusedDiamondSword extends ItemSword implements IBindable } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_infused_diamond_sword")); - if (par1ItemStack.getItemDamage() == 0) - { + if (par1ItemStack.getItemDamage() == 0) { par3List.add("Normal Mode"); - } - else if (par1ItemStack.getItemDamage() == 1) - { + } else if (par1ItemStack.getItemDamage() == 1) { par3List.add("Area Mode"); - } - else if (par1ItemStack.getItemDamage() == 2) - { + } else if (par1ItemStack.getItemDamage() == 2) { par3List.add("Fire Mode"); } - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } @@ -62,45 +51,46 @@ public class InfusedDiamondSword extends ItemSword implements IBindable boolean ignoreLeftClick = false; @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { - if (!ignoreLeftClick && entity instanceof EntityLivingBase && ((EntityLivingBase) entity).hurtTime == 0 && !((EntityLivingBase) entity).isDead) - { - switch (ToolCapabilities.getMode(stack)) - { - case 0: - { - if (!player.capabilities.isCreativeMode) - { + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { + if (!ignoreLeftClick + && entity instanceof EntityLivingBase + && ((EntityLivingBase) entity).hurtTime == 0 + && !((EntityLivingBase) entity).isDead) { + switch (ToolCapabilities.getMode(stack)) { + case 0: { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(stack, player, 100); } break; } - case 1: - { + case 1: { int range = 3; - List entities = player.worldObj.getEntitiesWithinAABB(entity.getClass(), AxisAlignedBB.getBoundingBox(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range)); + List entities = player.worldObj.getEntitiesWithinAABB( + entity.getClass(), + AxisAlignedBB.getBoundingBox( + entity.posX - range, + entity.posY - range, + entity.posZ - range, + entity.posX + range, + entity.posY + range, + entity.posZ + range)); ignoreLeftClick = true; - for (Entity entity_ : entities) - { + for (Entity entity_ : entities) { player.attackTargetEntityWithCurrentItem(entity_); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(stack, player, 3000); } } ignoreLeftClick = false; break; } - case 2: - { + case 2: { EntityLivingBase living = (EntityLivingBase) entity; living.setFire(3); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { EnergyItems.syphonBatteries(stack, player, 300); } break; @@ -112,10 +102,9 @@ public class InfusedDiamondSword extends ItemSword implements IBindable } @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { - if (par3EntityLivingBase instanceof EntityPlayer) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + if (par3EntityLivingBase instanceof EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase); } par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2)); @@ -123,12 +112,10 @@ public class InfusedDiamondSword extends ItemSword implements IBindable } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { ToolCapabilities.changeMode(par1ItemStack); } @@ -138,23 +125,19 @@ public class InfusedDiamondSword extends ItemSword implements IBindable @Override @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @Override @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack par1ItemStack, int pass) - { + public boolean hasEffect(ItemStack par1ItemStack, int pass) { return true; } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.rare; } } - diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronAxe.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronAxe.java index 76ebd8b..f20bb1f 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronAxe.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronAxe.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -13,14 +14,10 @@ import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - -public class InfusedIronAxe extends ItemAxe implements IBindable -{ +public class InfusedIronAxe extends ItemAxe implements IBindable { private int energyUsed; - public InfusedIronAxe() - { + public InfusedIronAxe() { super(BloodArsenal.infusedIron); setMaxStackSize(1); setUnlocalizedName("blood_infused_axe_iron"); @@ -30,41 +27,40 @@ public class InfusedIronAxe extends ItemAxe implements IBindable setEnergyUsed(75); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); return par1ItemStack; } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { - if (par7EntityLivingBase instanceof EntityPlayer) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } @@ -72,14 +68,12 @@ public class InfusedIronAxe extends ItemAxe implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.uncommon; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronPickaxe.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronPickaxe.java index 6b05b99..af578b9 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronPickaxe.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronPickaxe.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -13,14 +14,10 @@ import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - -public class InfusedIronPickaxe extends ItemPickaxe implements IBindable -{ +public class InfusedIronPickaxe extends ItemPickaxe implements IBindable { private int energyUsed; - public InfusedIronPickaxe() - { + public InfusedIronPickaxe() { super(BloodArsenal.infusedIron); setMaxStackSize(1); setUnlocalizedName("blood_infused_pickaxe_iron"); @@ -30,41 +27,40 @@ public class InfusedIronPickaxe extends ItemPickaxe implements IBindable setEnergyUsed(75); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); return par1ItemStack; } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { - if (par7EntityLivingBase instanceof EntityPlayer) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } @@ -72,14 +68,12 @@ public class InfusedIronPickaxe extends ItemPickaxe implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.uncommon; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronShovel.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronShovel.java index 40dec59..cc2f99c 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronShovel.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronShovel.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -13,14 +14,10 @@ import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - -public class InfusedIronShovel extends ItemSpade implements IBindable -{ +public class InfusedIronShovel extends ItemSpade implements IBindable { private int energyUsed; - public InfusedIronShovel() - { + public InfusedIronShovel() { super(BloodArsenal.infusedIron); setMaxStackSize(1); setUnlocalizedName("blood_infused_shovel_iron"); @@ -30,41 +27,40 @@ public class InfusedIronShovel extends ItemSpade implements IBindable setEnergyUsed(75); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); return par1ItemStack; } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { - if (par7EntityLivingBase instanceof EntityPlayer) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } @@ -72,14 +68,12 @@ public class InfusedIronShovel extends ItemSpade implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.uncommon; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronSword.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronSword.java index d6fffbc..82140ff 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronSword.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedIronSword.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -12,14 +13,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.world.World; -import java.util.List; - -public class InfusedIronSword extends ItemSword implements IBindable -{ +public class InfusedIronSword extends ItemSword implements IBindable { private int energyUsed; - public InfusedIronSword() - { + public InfusedIronSword() { super(BloodArsenal.infusedIron); setMaxStackSize(1); setUnlocalizedName("blood_infused_sword_iron"); @@ -29,46 +26,36 @@ public class InfusedIronSword extends ItemSword implements IBindable setEnergyUsed(75); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { - if (par3EntityLivingBase instanceof EntityPlayer) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + if (par3EntityLivingBase instanceof EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase); - if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, getEnergyUsed())) - { - - } + if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, getEnergyUsed())) {} } return true; } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); @@ -76,14 +63,12 @@ public class InfusedIronSword extends ItemSword implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack) - { + public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.uncommon; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodAxe.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodAxe.java index 0ee04da..d9f4998 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodAxe.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodAxe.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -12,14 +13,10 @@ import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - -public class InfusedWoodAxe extends ItemAxe implements IBindable -{ +public class InfusedWoodAxe extends ItemAxe implements IBindable { private int energyUsed; - public InfusedWoodAxe() - { + public InfusedWoodAxe() { super(BloodArsenal.infusedWood); setMaxStackSize(1); setUnlocalizedName("blood_infused_axe_wood"); @@ -29,41 +26,40 @@ public class InfusedWoodAxe extends ItemAxe implements IBindable setEnergyUsed(50); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); return par1ItemStack; } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { - if (par7EntityLivingBase instanceof EntityPlayer) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } @@ -71,8 +67,7 @@ public class InfusedWoodAxe extends ItemAxe implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodPickaxe.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodPickaxe.java index d7cfeae..e417f39 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodPickaxe.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodPickaxe.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -12,14 +13,10 @@ import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - -public class InfusedWoodPickaxe extends ItemPickaxe implements IBindable -{ +public class InfusedWoodPickaxe extends ItemPickaxe implements IBindable { private int energyUsed; - public InfusedWoodPickaxe() - { + public InfusedWoodPickaxe() { super(BloodArsenal.infusedWood); setMaxStackSize(1); setUnlocalizedName("blood_infused_pickaxe_wood"); @@ -29,41 +26,40 @@ public class InfusedWoodPickaxe extends ItemPickaxe implements IBindable setEnergyUsed(50); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); return par1ItemStack; } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { - if (par7EntityLivingBase instanceof EntityPlayer) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } @@ -71,8 +67,7 @@ public class InfusedWoodPickaxe extends ItemPickaxe implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodShovel.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodShovel.java index ba14da2..264bde1 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodShovel.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodShovel.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -12,14 +13,10 @@ import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - -public class InfusedWoodShovel extends ItemSpade implements IBindable -{ +public class InfusedWoodShovel extends ItemSpade implements IBindable { private int energyUsed; - public InfusedWoodShovel() - { + public InfusedWoodShovel() { super(BloodArsenal.infusedWood); setMaxStackSize(1); setUnlocalizedName("blood_infused_shovel_wood"); @@ -29,41 +26,40 @@ public class InfusedWoodShovel extends ItemSpade implements IBindable setEnergyUsed(50); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); return par1ItemStack; } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3Block, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { - if (par7EntityLivingBase instanceof EntityPlayer) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3Block, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } @@ -71,8 +67,7 @@ public class InfusedWoodShovel extends ItemSpade implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodSword.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodSword.java index c391297..a2140a5 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodSword.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/InfusedWoodSword.java @@ -5,20 +5,17 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.world.World; -import java.util.List; - -public class InfusedWoodSword extends ItemSword implements IBindable -{ +public class InfusedWoodSword extends ItemSword implements IBindable { private int energyUsed; - public InfusedWoodSword() - { + public InfusedWoodSword() { super(BloodArsenal.infusedWood); setMaxStackSize(1); setUnlocalizedName("blood_infused_sword_wood"); @@ -28,46 +25,36 @@ public class InfusedWoodSword extends ItemSword implements IBindable setEnergyUsed(50); } - public void setEnergyUsed(int par1) - { + public void setEnergyUsed(int par1) { energyUsed = par1; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return energyUsed; } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer , List par3List, boolean par4) - { - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (!(par1ItemStack.stackTagCompound == null)) { + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } } } @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { - if (par3EntityLivingBase instanceof EntityPlayer) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + if (par3EntityLivingBase instanceof EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase); - if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, getEnergyUsed())) - { - - } + if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, getEnergyUsed())) {} } return true; } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); @@ -75,8 +62,7 @@ public class InfusedWoodSword extends ItemSword implements IBindable } @SideOnly(Side.CLIENT) - public boolean isFull3D() - { + public boolean isFull3D() { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/items/tool/ToolCapabilities.java b/src/main/java/com/arc/bloodarsenal/common/items/tool/ToolCapabilities.java index 87da55c..0bd5dd7 100644 --- a/src/main/java/com/arc/bloodarsenal/common/items/tool/ToolCapabilities.java +++ b/src/main/java/com/arc/bloodarsenal/common/items/tool/ToolCapabilities.java @@ -1,5 +1,6 @@ package com.arc.bloodarsenal.common.items.tool; +import java.util.Arrays; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -13,96 +14,105 @@ import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Arrays; +public final class ToolCapabilities { + public static Material[] materialsPick = + new Material[] {Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil + }; + public static Material[] materialsShovel = new Material[] { + Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay + }; + public static Material[] materialsAxe = + new Material[] {Material.coral, Material.leaves, Material.plants, Material.wood}; -public final class ToolCapabilities -{ - public static Material[] materialsPick = new Material[]{ Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil }; - public static Material[] materialsShovel = new Material[]{ Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay }; - public static Material[] materialsAxe = new Material[]{ Material.coral, Material.leaves, Material.plants, Material.wood }; - - public static int getMode(ItemStack tool) - { + public static int getMode(ItemStack tool) { return tool.getItemDamage(); } - public static int getNextMode(int mode) - { + public static int getNextMode(int mode) { return mode == 2 ? 0 : mode + 1; } - public static void changeMode(ItemStack tool) - { + public static void changeMode(ItemStack tool) { int mode = getMode(tool); tool.setItemDamage(getNextMode(mode)); } - public static boolean isRightMaterial(Material material, Material[] materialsListing) - { - for (Material mat : materialsListing) - { - if (material == mat) - { + public static boolean isRightMaterial(Material material, Material[] materialsListing) { + for (Material mat : materialsListing) { + if (material == mat) { return true; } } return false; } - public static void removeBlocksInIteration(EntityPlayer player, World world, int x, int y, int z, int xs, int ys, int zs, int xe, int ye, int ze, Block block, Material[] materialsListing) - { + public static void removeBlocksInIteration( + EntityPlayer player, + World world, + int x, + int y, + int z, + int xs, + int ys, + int zs, + int xe, + int ye, + int ze, + Block block, + Material[] materialsListing) { float blockHardness = (block == null) ? 1.0f : block.getBlockHardness(world, x, y, z); - for (int x1 = xs; x1 < xe; x1++) - { - for (int y1 = ys; y1 < ye; y1++) - { - for (int z1 = zs; z1 < ze; z1++) - { - ToolCapabilities.removeBlockWithDrops(player, world, x1 + x, y1 + y, z1 + z, x, y, z, block, materialsListing); + for (int x1 = xs; x1 < xe; x1++) { + for (int y1 = ys; y1 < ye; y1++) { + for (int z1 = zs; z1 < ze; z1++) { + ToolCapabilities.removeBlockWithDrops( + player, world, x1 + x, y1 + y, z1 + z, x, y, z, block, materialsListing); } } } } - public static void removeBlockWithDrops(EntityPlayer player, World world, int x, int y, int z, int bx, int by, int bz, Block block, Material[] materialsListing) - { - if (!world.blockExists(x, y, z)) - { + public static void removeBlockWithDrops( + EntityPlayer player, + World world, + int x, + int y, + int z, + int bx, + int by, + int bz, + Block block, + Material[] materialsListing) { + if (!world.blockExists(x, y, z)) { return; } Block blk = world.getBlock(x, y, z); - if (block != null && blk != block) - { + if (block != null && blk != block) { return; } int meta = world.getBlockMetadata(x, y, z); Material mat = world.getBlock(x, y, z).getMaterial(); - if (blk != null && !blk.isAir(world, x, y, z) && ((blk.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0))) - { - if (!blk.canHarvestBlock(player, meta) || !isRightMaterial(mat, materialsListing)) - { + if (blk != null + && !blk.isAir(world, x, y, z) + && ((blk.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0))) { + if (!blk.canHarvestBlock(player, meta) || !isRightMaterial(mat, materialsListing)) { return; } - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { int localMeta = world.getBlockMetadata(x, y, z); - if (blk.removedByPlayer(world, player, x, y, z)) - { + if (blk.removedByPlayer(world, player, x, y, z)) { blk.onBlockDestroyedByPlayer(world, x, y, z, localMeta); } blk.harvestBlock(world, player, x, y, z, localMeta); blk.onBlockHarvested(world, x, y, z, localMeta, player); - } - else - { + } else { world.setBlockToAir(x, y, z); } } @@ -113,30 +123,25 @@ public final class ToolCapabilities public static int lastz = 0; public static double lastdistance = 0.0D; - public static boolean isWood(IBlockAccess world, int x, int y, int z) - { + public static boolean isWood(IBlockAccess world, int x, int y, int z) { Block blk = world.getBlock(x, y, z); int metadata = world.getBlockMetadata(x, y, z); - if (blk == Blocks.air) - { + if (blk == Blocks.air) { return false; } - if (blk.canSustainLeaves(world, x, y, z)) - { + if (blk.canSustainLeaves(world, x, y, z)) { return true; } - if (InfusedDiamondAxe.oreDictLogs.contains(Arrays.asList(new Object[]{blk, Integer.valueOf(metadata)}))) - { + if (InfusedDiamondAxe.oreDictLogs.contains(Arrays.asList(new Object[] {blk, Integer.valueOf(metadata)}))) { return true; } return false; } - public static boolean breakFurthestBlock(World world, int x, int y, int z, Block block, EntityPlayer player) - { + public static boolean breakFurthestBlock(World world, int x, int y, int z, Block block, EntityPlayer player) { lastx = x; lasty = y; lastz = z; @@ -146,15 +151,16 @@ public final class ToolCapabilities boolean worked = harvestBlock(world, player, lastx, lasty, lastz); - if (worked) - { - for (int xx = -3; xx <= 3; xx++) - { - for (int yy = -3; yy <= 3; yy++) - { - for (int zz = -3; zz <= 3; zz++) - { - world.scheduleBlockUpdate(lastx + xx, lasty + yy, lastz + zz, world.getBlock(lastx + xx, lasty + yy, lastz + zz), 150 + world.rand.nextInt(150)); + if (worked) { + for (int xx = -3; xx <= 3; xx++) { + for (int yy = -3; yy <= 3; yy++) { + for (int zz = -3; zz <= 3; zz++) { + world.scheduleBlockUpdate( + lastx + xx, + lasty + yy, + lastz + zz, + world.getBlock(lastx + xx, lasty + yy, lastz + zz), + 150 + world.rand.nextInt(150)); } } } @@ -162,38 +168,31 @@ public final class ToolCapabilities return worked; } - public static void findBlocks(World world, int x, int y, int z, Block block) - { - for (int xx = -2; xx <= 2; xx++) - { - for (int yy = 2; yy >= -2; yy--) - { - for (int zz = -2; zz <= 2; zz++) - { - if (Math.abs(lastx + xx - x) > 24) - { + public static void findBlocks(World world, int x, int y, int z, Block block) { + for (int xx = -2; xx <= 2; xx++) { + for (int yy = 2; yy >= -2; yy--) { + for (int zz = -2; zz <= 2; zz++) { + if (Math.abs(lastx + xx - x) > 24) { return; } - if (Math.abs(lasty + yy - y) > 48) - { + if (Math.abs(lasty + yy - y) > 48) { return; } - if (Math.abs(lastz + zz - z) > 24) - { + if (Math.abs(lastz + zz - z) > 24) { return; } - if ((world.getBlock(lastx + xx, lasty + yy, lastz + zz) == block) && (isWood(world, lastx + xx, lasty + yy, lastz + zz)) && (block.getBlockHardness(world, lastx + xx, lasty + yy, lastz + zz) >= 0.0F)) - { + if ((world.getBlock(lastx + xx, lasty + yy, lastz + zz) == block) + && (isWood(world, lastx + xx, lasty + yy, lastz + zz)) + && (block.getBlockHardness(world, lastx + xx, lasty + yy, lastz + zz) >= 0.0F)) { double xd = lastx + xx - x; double yd = lasty + yy - y; double zd = lastz + zz - z; double d = xd * xd + yd * yd + zd * zd; - if (d > lastdistance) - { + if (d > lastdistance) { lastdistance = d; lastx += xx; lasty += yy; @@ -207,13 +206,11 @@ public final class ToolCapabilities } } - public static boolean harvestBlock(World world, EntityPlayer player, int x, int y, int z) - { + public static boolean harvestBlock(World world, EntityPlayer player, int x, int y, int z) { Block block = world.getBlock(x, y, z); int metadata = world.getBlockMetadata(x, y, z); - if (block.getBlockHardness(world, x, y, z) < 0.0F) - { + if (block.getBlockHardness(world, x, y, z) < 0.0F) { return false; } @@ -221,42 +218,34 @@ public final class ToolCapabilities boolean flag = false; - if (player.capabilities.isCreativeMode) - { + if (player.capabilities.isCreativeMode) { flag = removeBlock(world, x, y, z, player); - } - else - { + } else { boolean flag1 = false; - if (block != null) - { + if (block != null) { flag1 = block.canHarvestBlock(player, metadata); } flag = removeBlock(world, x, y, z, player); - if (flag && flag1) - { + if (flag && flag1) { block.harvestBlock(world, player, x, y, z, metadata); } } return true; } - private static boolean removeBlock(World world, int par1, int par2, int par3, EntityPlayer player) - { + private static boolean removeBlock(World world, int par1, int par2, int par3, EntityPlayer player) { Block block = world.getBlock(par1, par2, par3); int metadata = world.getBlockMetadata(par1, par2, par3); - if (block != null) - { + if (block != null) { block.onBlockHarvested(world, par1, par2, par3, metadata, player); } boolean flag = (block != null) && (block.removedByPlayer(world, player, par1, par2, par3)); - if (block != null && flag) - { + if (block != null && flag) { block.onBlockDestroyedByPlayer(world, par1, par2, par3, metadata); } return flag; @@ -266,16 +255,14 @@ public final class ToolCapabilities * @author mDiyo */ - public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) - { + public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) { 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) * f; double d1 = player.prevPosY + (player.posY - player.prevPosY) * f; - if (!world.isRemote && player instanceof EntityPlayer) - { + if (!world.isRemote && player instanceof EntityPlayer) { d1 += 1.62D; } @@ -289,8 +276,7 @@ public final class ToolCapabilities float f8 = f3 * f5; double d3 = range; - if (player instanceof EntityPlayerMP) - { + if (player instanceof EntityPlayerMP) { d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); } diff --git a/src/main/java/com/arc/bloodarsenal/common/misc/WAILAPlugin.java b/src/main/java/com/arc/bloodarsenal/common/misc/WAILAPlugin.java index 2854561..51b740b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/misc/WAILAPlugin.java +++ b/src/main/java/com/arc/bloodarsenal/common/misc/WAILAPlugin.java @@ -13,6 +13,7 @@ import com.arc.bloodarsenal.common.tileentity.TileCompactedMRS; import com.arc.bloodarsenal.common.tileentity.TileLPMaterializer; import com.arc.bloodarsenal.common.tileentity.TileLifeInfuser; import com.arc.bloodarsenal.common.tileentity.TilePortableAltar; +import java.util.List; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataProvider; @@ -26,65 +27,64 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class WAILAPlugin implements IWailaDataProvider -{ +public class WAILAPlugin implements IWailaDataProvider { @Override - public ItemStack getWailaStack(IWailaDataAccessor data, IWailaConfigHandler cfg) - { + public ItemStack getWailaStack(IWailaDataAccessor data, IWailaConfigHandler cfg) { return data.getStack(); } @Override - public List getWailaHead(ItemStack stack, List tip, IWailaDataAccessor data, IWailaConfigHandler cfg) - { + public List getWailaHead( + ItemStack stack, List tip, IWailaDataAccessor data, IWailaConfigHandler cfg) { return tip; } @Override - public List getWailaBody(ItemStack stack, List tip, IWailaDataAccessor data, IWailaConfigHandler cfg) - { - if (data.getTileEntity() != null) - { - if (data.getTileEntity() instanceof TilePortableAltar) - { + public List getWailaBody( + ItemStack stack, List tip, IWailaDataAccessor data, IWailaConfigHandler cfg) { + if (data.getTileEntity() != null) { + if (data.getTileEntity() instanceof TilePortableAltar) { EntityPlayer player = data.getPlayer(); NBTTagCompound tagCompound = data.getNBTData(); EnumChatFormatting red = EnumChatFormatting.RED; - //Basic + // Basic int currentEssence = tagCompound.getInteger("currentEssence"); int tier = tagCompound.getInteger("upgradeLevel"); int capacity = tagCompound.getInteger("capacity"); - //Extended + // Extended TilePortableAltar altar = (TilePortableAltar) data.getTileEntity(); - if (player.getCurrentEquippedItem() != null) - { - if (player.getCurrentEquippedItem().getItem() instanceof SigilDivination || player.getCurrentEquippedItem().getItem() instanceof SigilSeer) - { + if (player.getCurrentEquippedItem() != null) { + if (player.getCurrentEquippedItem().getItem() instanceof SigilDivination + || player.getCurrentEquippedItem().getItem() instanceof SigilSeer) { tip.add(StatCollector.translateToLocal("tooltip.currentEssence") + " " + red + currentEssence); tip.add(StatCollector.translateToLocal("tooltip.altarTier") + " " + red + tier); tip.add(StatCollector.translateToLocal("tooltip.capacity") + " " + red + capacity); addTonsOfInfo(player, altar, tip, cfg); - } - else if (player.getCurrentEquippedItem().getItem() instanceof SigilOfHolding) - { - if (SigilOfHolding.getCurrentSigil(player.getCurrentEquippedItem()).getItem() instanceof SigilDivination || SigilOfHolding.getCurrentSigil(player.getCurrentEquippedItem()).getItem() instanceof SigilSeer) - { - tip.add(StatCollector.translateToLocal("tooltip.currentEssence") + " " + red + currentEssence); + } else if (player.getCurrentEquippedItem().getItem() instanceof SigilOfHolding) { + if (SigilOfHolding.getCurrentSigil(player.getCurrentEquippedItem()) + .getItem() + instanceof SigilDivination + || SigilOfHolding.getCurrentSigil(player.getCurrentEquippedItem()) + .getItem() + instanceof SigilSeer) { + tip.add(StatCollector.translateToLocal("tooltip.currentEssence") + " " + red + + currentEssence); tip.add(StatCollector.translateToLocal("tooltip.altarTier") + " " + red + tier); tip.add(StatCollector.translateToLocal("tooltip.capacity") + " " + red + capacity); } addTonsOfInfo(player, altar, tip, cfg); - } - else if (player.getCurrentEquippedItem().getItem() instanceof SigilAugmentedHolding) - { - if (SigilAugmentedHolding.getCurrentSigil(player.getCurrentEquippedItem()).getItem() instanceof SigilDivination || SigilAugmentedHolding.getCurrentSigil(player.getCurrentEquippedItem()).getItem() instanceof SigilSeer) - { - tip.add(StatCollector.translateToLocal("tooltip.currentEssence") + " " + red + currentEssence); + } else if (player.getCurrentEquippedItem().getItem() instanceof SigilAugmentedHolding) { + if (SigilAugmentedHolding.getCurrentSigil(player.getCurrentEquippedItem()) + .getItem() + instanceof SigilDivination + || SigilAugmentedHolding.getCurrentSigil(player.getCurrentEquippedItem()) + .getItem() + instanceof SigilSeer) { + tip.add(StatCollector.translateToLocal("tooltip.currentEssence") + " " + red + + currentEssence); tip.add(StatCollector.translateToLocal("tooltip.altarTier") + " " + red + tier); tip.add(StatCollector.translateToLocal("tooltip.capacity") + " " + red + capacity); } @@ -92,9 +92,7 @@ public class WAILAPlugin implements IWailaDataProvider addTonsOfInfo(player, altar, tip, cfg); } } - } - else if (data.getTileEntity() instanceof TileCompactedMRS) - { + } else if (data.getTileEntity() instanceof TileCompactedMRS) { EnumChatFormatting red = EnumChatFormatting.RED; NBTTagCompound tagCompound = data.getNBTData(); @@ -104,22 +102,22 @@ public class WAILAPlugin implements IWailaDataProvider int direction = tagCompound.getInteger("direction"); tip.add(StatCollector.translateToLocal("tooltip.ritualName") + " " + red + ritualName); - tip.add(StatCollector.translateToLocal("tooltip.running") + " " + red + (isRunning ? StatCollector.translateToLocal("tooltip.yes") : StatCollector.translateToLocal("tooltip.no"))); + tip.add(StatCollector.translateToLocal("tooltip.running") + " " + red + + (isRunning + ? StatCollector.translateToLocal("tooltip.yes") + : StatCollector.translateToLocal("tooltip.no"))); tip.add(StatCollector.translateToLocal("tooltip.direction") + " " + red + direction); - } - else if (data.getTileEntity() instanceof TileLifeInfuser) - { + } else if (data.getTileEntity() instanceof TileLifeInfuser) { EnumChatFormatting red = EnumChatFormatting.RED; -// NBTTagCompound tagCompound = data.getNBTData(); + // NBTTagCompound tagCompound = data.getNBTData(); -// boolean isRunning = tagCompound.getBoolean("isRunning"); + // boolean isRunning = tagCompound.getBoolean("isRunning"); int currentEssence = ((TileLifeInfuser) data.getTileEntity()).getFluidAmount(); tip.add(StatCollector.translateToLocal("message.tile.contains") + " " + red + currentEssence); -// tip.add(StatCollector.translateToLocal("tooltip.running") + " " + red + (isRunning ? StatCollector.translateToLocal("tooltip.yes") : StatCollector.translateToLocal("tooltip.no"))); - } - else if (data.getTileEntity() instanceof TileLPMaterializer) - { + // tip.add(StatCollector.translateToLocal("tooltip.running") + " " + red + (isRunning ? + // StatCollector.translateToLocal("tooltip.yes") : StatCollector.translateToLocal("tooltip.no"))); + } else if (data.getTileEntity() instanceof TileLPMaterializer) { EnumChatFormatting red = EnumChatFormatting.RED; int currentEssence = ((TileLPMaterializer) data.getTileEntity()).getFluidAmount(); @@ -131,8 +129,8 @@ public class WAILAPlugin implements IWailaDataProvider return tip; } - protected void addTonsOfInfo(EntityPlayer player, TilePortableAltar altar, List tip, IWailaConfigHandler cfg) - { + protected void addTonsOfInfo( + EntityPlayer player, TilePortableAltar altar, List tip, IWailaConfigHandler cfg) { int speedUpgrades = altar.speedUpgrades; int efficiencyUpgrades = altar.efficiencyUpgrades; int sacrificeUpgrades = altar.sacrificeUpgrades; @@ -143,8 +141,7 @@ public class WAILAPlugin implements IWailaDataProvider int betterCapacitiveUpgrades = altar.betterCapacitiveUpgrades; int accelerationUpgrades = altar.accelerationUpgrades; - if (cfg.getConfig(showExtendedTooltip) && player.isSneaking()) - { + if (cfg.getConfig(showExtendedTooltip) && player.isSneaking()) { tip.add(StatCollector.translateToLocal("tooltip.speedUpgrades") + " " + speedUpgrades); tip.add(StatCollector.translateToLocal("tooltip.efficiencyUpgrades") + " " + efficiencyUpgrades); tip.add(StatCollector.translateToLocal("tooltip.sacrificeUpgrades") + " " + sacrificeUpgrades); @@ -152,22 +149,22 @@ public class WAILAPlugin implements IWailaDataProvider tip.add(StatCollector.translateToLocal("tooltip.displacementUpgrades") + " " + displacementUpgrades); tip.add(StatCollector.translateToLocal("tooltip.altarCapacitiveUpgrades") + " " + altarCapacitiveUpgrades); tip.add(StatCollector.translateToLocal("tooltip.orbCapacitiveUpgrades") + " " + orbCapacitiveUpgrades); - tip.add(StatCollector.translateToLocal("tooltip.betterCapacitiveUpgrades") + " " + betterCapacitiveUpgrades); + tip.add(StatCollector.translateToLocal("tooltip.betterCapacitiveUpgrades") + " " + + betterCapacitiveUpgrades); tip.add(StatCollector.translateToLocal("tooltip.accelerationUpgrades") + " " + accelerationUpgrades); } } @Override - public List getWailaTail(ItemStack stack, List tip, IWailaDataAccessor data, IWailaConfigHandler cfg) - { + public List getWailaTail( + ItemStack stack, List tip, IWailaDataAccessor data, IWailaConfigHandler cfg) { return tip; } @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity tileEntity, NBTTagCompound tag, World world, int x, int y, int z) - { - if (tileEntity != null) - { + public NBTTagCompound getNBTData( + EntityPlayerMP player, TileEntity tileEntity, NBTTagCompound tag, World world, int x, int y, int z) { + if (tileEntity != null) { tileEntity.writeToNBT(tag); } @@ -176,8 +173,7 @@ public class WAILAPlugin implements IWailaDataProvider private static String showExtendedTooltip = "bloodarsenal.showExtendedAltarTooltip"; - public static void registerAddon(IWailaRegistrar register) - { + public static void registerAddon(IWailaRegistrar register) { WAILAPlugin dataProvider = new WAILAPlugin(); register.addConfig("BloodArsenal", showExtendedTooltip, false); diff --git a/src/main/java/com/arc/bloodarsenal/common/potion/PotionBloodArsenal.java b/src/main/java/com/arc/bloodarsenal/common/potion/PotionBloodArsenal.java index 55ed787..7b245f5 100644 --- a/src/main/java/com/arc/bloodarsenal/common/potion/PotionBloodArsenal.java +++ b/src/main/java/com/arc/bloodarsenal/common/potion/PotionBloodArsenal.java @@ -6,25 +6,22 @@ import net.minecraft.client.Minecraft; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; -public class PotionBloodArsenal extends Potion -{ - private static final ResourceLocation resourceLocation = new ResourceLocation("bloodarsenal", "textures/misc/potions.png"); +public class PotionBloodArsenal extends Potion { + private static final ResourceLocation resourceLocation = + new ResourceLocation("bloodarsenal", "textures/misc/potions.png"); - public PotionBloodArsenal(int par1, boolean par2, int par3) - { + public PotionBloodArsenal(int par1, boolean par2, int par3) { super(par1, par2, par3); } @Override - public Potion setIconIndex(int par1, int par2) - { + public Potion setIconIndex(int par1, int par2) { super.setIconIndex(par1, par2); return this; } @SideOnly(Side.CLIENT) - public int getStatusIconIndex() - { + public int getStatusIconIndex() { Minecraft.getMinecraft().renderEngine.bindTexture(resourceLocation); return super.getStatusIconIndex(); } diff --git a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectEnchant.java b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectEnchant.java index 796d0b3..b56c6a0 100644 --- a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectEnchant.java +++ b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectEnchant.java @@ -8,6 +8,8 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; +import java.util.ArrayList; +import java.util.List; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.effect.EntityLightningBolt; @@ -22,11 +24,7 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectEnchant extends RitualEffect -{ +public class RitualEffectEnchant extends RitualEffect { private static int[][] PEDESTAL_LOCATIONS = new int[][] {{3, 1, 0}, {-3, 1, 0}, {0, 1, 3}, {0, 1, -3}}; public int stage = 0; @@ -37,22 +35,19 @@ public class RitualEffectEnchant extends RitualEffect public ItemStack enchantItem = null; public List enchants = new ArrayList(); -// public List itemList = new ArrayList(); + // public List itemList = new ArrayList(); @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); World worldSave = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); - if (stage == 0) - { + if (stage == 0) { advanceStage(); } - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(owner); worldSave.setItemData(owner, data); } @@ -64,23 +59,18 @@ public class RitualEffectEnchant extends RitualEffect int z = ritualStone.getZCoord(); EntityPlayer player = world.getPlayerEntityByName(owner); - if (currentEssence < getCostPerRefresh()) - { + if (currentEssence < getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } - else - { + } else { TileEntity topEntity = world.getTileEntity(x, y + 1, z); - if (!(topEntity instanceof TEAltar)) - { + if (!(topEntity instanceof TEAltar)) { ritualStone.setActive(false); sendPlayerInformation(player, 1); return; } - if (!canActivate(world, x, y, z)) - { + if (!canActivate(world, x, y, z)) { ritualStone.setActive(false); sendPlayerInformation(player, 2); return; @@ -89,44 +79,33 @@ public class RitualEffectEnchant extends RitualEffect TEAltar tileAltar = (TEAltar) topEntity; ItemStack targetStack = tileAltar.getStackInSlot(0); - if (targetStack == null) - { + if (targetStack == null) { ritualStone.setActive(false); sendPlayerInformation(player, 3); return; - } - else - { + } else { enchantItem = targetStack; } - switch (stage) - { - case 1: - { - if (stageTicks % 20 == 0) - { + switch (stage) { + case 1: { + if (stageTicks % 20 == 0) { ItemStack[] pedestalStack = getItemsInPedestals(world, x, y, z, true); int count = pedestalStack.length; boolean addedEnchantment = false; - if (count > 0 && !world.isRemote) - { - for (ItemStack itemStack : pedestalStack) - { - if (itemStack != null && itemStack.getItem() == Items.enchanted_book) - { + if (count > 0 && !world.isRemote) { + for (ItemStack itemStack : pedestalStack) { + if (itemStack != null && itemStack.getItem() == Items.enchanted_book) { NBTTagList enchants = Items.enchanted_book.func_92110_g(itemStack); - if (enchants != null && enchants.tagCount() > 0) - { + if (enchants != null && enchants.tagCount() > 0) { NBTTagCompound enchant = enchants.getCompoundTagAt(0); short id = enchant.getShort("id"); short lvl = enchant.getShort("lvl"); - if (!hasEnchantAlready(id) && isEnchantmentValid(id)) - { + if (!hasEnchantAlready(id) && isEnchantmentValid(id)) { this.enchants.add(new EnchantmentData(id, lvl)); addedEnchantment = true; break; @@ -134,54 +113,42 @@ public class RitualEffectEnchant extends RitualEffect } } } - } - else - { + } else { sendPlayerInformation(player, 4); } - if (!addedEnchantment) - { - if (enchants.isEmpty()) - { + if (!addedEnchantment) { + if (enchants.isEmpty()) { stage = 0; ritualStone.setActive(false); - } - else - { + } else { advanceStage(); world.markBlockForUpdate(x, y, z); } } - - } break; } - case 2: - { - if (lpRequired == -1) - { + case 2: { + if (lpRequired == -1) { lpRequired = 0; - for (EnchantmentData d : enchants) - { + for (EnchantmentData d : enchants) { Enchantment ench = Enchantment.enchantmentsList[d.enchant]; - lpRequired += (int) (500F * ((15 - Math.min(15, ench.getWeight())) * 1.05F) * ((3F + d.level * d.level) * 0.25F) * (0.9F + enchants.size() * 0.05F)); + lpRequired += (int) (500F + * ((15 - Math.min(15, ench.getWeight())) * 1.05F) + * ((3F + d.level * d.level) * 0.25F) + * (0.9F + enchants.size() * 0.05F)); player.addChatComponentMessage(new ChatComponentText("Lp required: " + lpRequired)); SoulNetworkHandler.syphonFromNetwork(owner, lpRequired); } - } - else if (SoulNetworkHandler.getCurrentEssence(owner) >= lpRequired) - { + } else if (SoulNetworkHandler.getCurrentEssence(owner) >= lpRequired) { lpRequired = 0; advanceStage(); world.markBlockForUpdate(x, y, z); - } - else - { + } else { sendPlayerInformation(player, 5); ritualStone.setActive(false); } @@ -189,14 +156,10 @@ public class RitualEffectEnchant extends RitualEffect break; } - case 3: - { - if (stageTicks >= 100) - { - for (EnchantmentData d : enchants) - { - if (EnchantmentHelper.getEnchantmentLevel(d.enchant, enchantItem) == 0) - { + case 3: { + if (stageTicks >= 100) { + for (EnchantmentData d : enchants) { + if (EnchantmentHelper.getEnchantmentLevel(d.enchant, enchantItem) == 0) { enchantItem.addEnchantment(Enchantment.enchantmentsList[d.enchant], d.level); } } @@ -216,10 +179,8 @@ public class RitualEffectEnchant extends RitualEffect break; } - case 4: - { - if (stageTicks >= 20) - { + case 4: { + if (stageTicks >= 20) { advanceStage(); world.markBlockForUpdate(x, y, z); ritualStone.setActive(false); @@ -229,23 +190,18 @@ public class RitualEffectEnchant extends RitualEffect } } - if (stage != 0) - { + if (stage != 0) { stageTicks++; } } } - public void advanceStage() - { + public void advanceStage() { stage++; - if (stage == 4) - { + if (stage == 4) { stage3EndTicks = stageTicks; - } - else if (stage == 5) - { + } else if (stage == 5) { stage = 0; stage3EndTicks = 0; } @@ -254,14 +210,12 @@ public class RitualEffectEnchant extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 0; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList enchantRitual = new ArrayList(); enchantRitual.add(new RitualComponent(2, 0, 0, RitualComponent.EARTH)); enchantRitual.add(new RitualComponent(3, 0, 0, RitualComponent.DUSK)); @@ -335,40 +289,30 @@ public class RitualEffectEnchant extends RitualEffect return enchantRitual; } - public ItemStack[] getItemsInPedestals(World world, int x, int y, int z, boolean yes) - { + public ItemStack[] getItemsInPedestals(World world, int x, int y, int z, boolean yes) { ItemStack[] items = new ItemStack[4]; - if (yes) - { + if (yes) { int i = 0; - for (int[] pedestals : PEDESTAL_LOCATIONS) - { - if (i < 4) - { + for (int[] pedestals : PEDESTAL_LOCATIONS) { + if (i < 4) { TileEntity tileEntity = world.getTileEntity(pedestals[0] + x, pedestals[1] + y, pedestals[2] + z); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { items[i] = ((TEPedestal) tileEntity).getStackInSlot(0); i++; } } } - } - else - { + } else { int i = 0; - for (int[] pedestals : PEDESTAL_LOCATIONS) - { - if (i < 4) - { + for (int[] pedestals : PEDESTAL_LOCATIONS) { + if (i < 4) { TileEntity tileEntity = world.getTileEntity(pedestals[0] + x, pedestals[1] + y, pedestals[2] + z); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { items[i] = ((TEPedestal) tileEntity).getStackInSlot(0); i++; } @@ -379,12 +323,9 @@ public class RitualEffectEnchant extends RitualEffect return items; } - private static boolean canActivate(World world, int x, int y, int z) - { - for (int[] pedestals : PEDESTAL_LOCATIONS) - { - if (world.getBlock(pedestals[0] + x, pedestals[1] + y, pedestals[2] + z) != ModBlocks.blockPedestal) - { + private static boolean canActivate(World world, int x, int y, int z) { + for (int[] pedestals : PEDESTAL_LOCATIONS) { + if (world.getBlock(pedestals[0] + x, pedestals[1] + y, pedestals[2] + z) != ModBlocks.blockPedestal) { return false; } } @@ -392,12 +333,9 @@ public class RitualEffectEnchant extends RitualEffect return true; } - private boolean hasEnchantAlready(int enchant) - { - for (EnchantmentData data : enchants) - { - if (data.enchant == enchant) - { + private boolean hasEnchantAlready(int enchant) { + for (EnchantmentData data : enchants) { + if (data.enchant == enchant) { return true; } } @@ -405,21 +343,17 @@ public class RitualEffectEnchant extends RitualEffect return false; } - public boolean isEnchantmentValid(short id) - { + public boolean isEnchantmentValid(short id) { Enchantment ench = Enchantment.enchantmentsList[id]; - if (!ench.canApply(enchantItem) || !ench.type.canEnchantItem(enchantItem.getItem())) - { + if (!ench.canApply(enchantItem) || !ench.type.canEnchantItem(enchantItem.getItem())) { return false; } - for (EnchantmentData data : enchants) - { + for (EnchantmentData data : enchants) { Enchantment otherEnch = Enchantment.enchantmentsList[data.enchant]; - if (!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch)) - { + if (!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch)) { return false; } } @@ -427,37 +361,39 @@ public class RitualEffectEnchant extends RitualEffect return true; } - private static void sendPlayerInformation(EntityPlayer player, int number) - { - switch (number) - { + private static void sendPlayerInformation(EntityPlayer player, int number) { + switch (number) { case 1: - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noAltar"))); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.enchant.noAltar"))); break; case 2: - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noPedestals"))); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.enchant.noPedestals"))); break; case 3: - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noEnchantItem"))); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.enchant.noEnchantItem"))); break; case 4: - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.noEnchantments"))); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.enchant.noEnchantments"))); break; case 5: - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.notEnoughLP"))); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.enchant.notEnoughLP"))); break; case 6: - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.enchant.enchantIsNotValid"))); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("message.enchant.enchantIsNotValid"))); break; } } - private static class EnchantmentData - { + private static class EnchantmentData { public int enchant, level; - public EnchantmentData(int enchant, int level) - { + public EnchantmentData(int enchant, int level) { this.enchant = enchant; this.level = level; } diff --git a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectFishing.java b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectFishing.java index 3107449..260e44c 100644 --- a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectFishing.java +++ b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectFishing.java @@ -7,6 +7,9 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; @@ -17,21 +20,14 @@ import net.minecraft.world.World; import net.minecraftforge.common.FishingHooks; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class RitualEffectFishing extends RitualEffect -{ +public class RitualEffectFishing extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); World worldSave = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(owner); worldSave.setItemData(owner, data); } @@ -43,8 +39,7 @@ public class RitualEffectFishing extends RitualEffect final int orbisTerraeDrain = 20; final int potentiaDrain = 20; - if (world.getWorldTime() % 10 != 5) - { + if (world.getWorldTime() % 10 != 5) { return; } @@ -54,65 +49,51 @@ public class RitualEffectFishing extends RitualEffect TileEntity tile = world.getTileEntity(x, y + 1, z); IInventory tileEntity; - if (tile instanceof IInventory) - { + if (tile instanceof IInventory) { tileEntity = (IInventory) tile; - } - else - { + } else { return; } - if (tileEntity.getSizeInventory() <= 0) - { + if (tileEntity.getSizeInventory() <= 0) { return; } boolean hasRoom = false; - for (int i=0; i= (hasPotentia ? 6 : 8)) - { - ItemStack fishStack = FishingHooks.getRandomFishable(rand, chance, hasOrbisTerrae ? rand.nextInt(90) : -1, hasPotentia ? 2 : -1); - if (fishStack != null) - { + if (block.isAssociatedBlock(Blocks.water) || block.isAssociatedBlock(Blocks.flowing_water)) { + if (rand.nextInt(9) >= (hasPotentia ? 6 : 8)) { + ItemStack fishStack = FishingHooks.getRandomFishable( + rand, chance, hasOrbisTerrae ? rand.nextInt(90) : -1, hasPotentia ? 2 : -1); + if (fishStack != null) { SpellHelper.insertStackIntoInventory(fishStack, tileEntity, ForgeDirection.DOWN); SoulNetworkHandler.syphonFromNetwork(owner, 500); } @@ -125,14 +106,12 @@ public class RitualEffectFishing extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 1000; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList fishingRitual = new ArrayList(); fishingRitual.add(new RitualComponent(1, 0, 0, RitualComponent.WATER)); fishingRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.WATER)); diff --git a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMidas.java b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMidas.java index fee807c..b0c6e73 100644 --- a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMidas.java +++ b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMidas.java @@ -6,6 +6,9 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Items; @@ -14,23 +17,16 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class RitualEffectMidas extends RitualEffect -{ +public class RitualEffectMidas extends RitualEffect { private static double rand; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); World worldSave = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(owner); worldSave.setItemData(owner, data); } @@ -41,32 +37,28 @@ public class RitualEffectMidas extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < getCostPerRefresh()) - { + if (currentEssence < getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } - else - { - if (ritualStone.getVar1() == 0) - { + } else { + if (ritualStone.getVar1() == 0) { int d0 = 0; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 2), (double) (z + 1)).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + (double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 2), (double) + (z + 1)) + .expand(d0, d0, d0); List list = world.getEntitiesWithinAABB(EntityItem.class, axisalignedbb); Iterator iterator = list.iterator(); EntityItem item; - while (iterator.hasNext()) - { + while (iterator.hasNext()) { item = (EntityItem) iterator.next(); ItemStack itemStack = item.getEntityItem(); - if (itemStack == null) - { + if (itemStack == null) { continue; } - if (itemStack.getItem() == Items.iron_ingot) - { + if (itemStack.getItem() == Items.iron_ingot) { item.setDead(); ritualStone.setVar1(+1); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z)); @@ -74,24 +66,20 @@ public class RitualEffectMidas extends RitualEffect break; } - if (world.rand.nextInt(10) == 0) - { - SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 1, x, y, z); + if (world.rand.nextInt(10) == 0) { + SpellHelper.sendIndexedParticleToAllAround( + world, x, y, z, 20, world.provider.dimensionId, 1, x, y, z); } } data.currentEssence = currentEssence - getCostPerRefresh(); data.markDirty(); - } - else - { + } else { ritualStone.setCooldown(ritualStone.getCooldown() - 1); - if (world.rand.nextInt(20) == 0) - { + if (world.rand.nextInt(20) == 0) { int lightningPoint = world.rand.nextInt(4); - switch (lightningPoint) - { + switch (lightningPoint) { case 0: world.addWeatherEffect(new EntityLightningBolt(world, x + 3, y + 6, z + 3)); break; @@ -110,15 +98,12 @@ public class RitualEffectMidas extends RitualEffect } } - if (ritualStone.getCooldown() <= 0) - { + if (ritualStone.getCooldown() <= 0) { ItemStack spawnedItem = new ItemStack(Items.gold_ingot); rand = Math.random(); - if (rand + 0.5F > 0.6F) - { - if (spawnedItem != null) - { + if (rand + 0.5F > 0.6F) { + if (spawnedItem != null) { EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, spawnedItem.copy()); world.spawnEntityInWorld(newItem); } @@ -130,20 +115,17 @@ public class RitualEffectMidas extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 0; } @Override - public int getInitialCooldown() - { + public int getInitialCooldown() { return 100; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList midasRitual = new ArrayList(); midasRitual.add(new RitualComponent(1, 0, 0, RitualComponent.EARTH)); midasRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.EARTH)); diff --git a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMobDisable.java b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMobDisable.java index 3ad484d..1a1810a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMobDisable.java +++ b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectMobDisable.java @@ -6,6 +6,9 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; @@ -15,15 +18,9 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class RitualEffectMobDisable extends RitualEffect -{ +public class RitualEffectMobDisable extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -40,48 +37,44 @@ public class RitualEffectMobDisable extends RitualEffect int d0 = 10; int vertRange = hasPotentia ? 20 : 10; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + (double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)) + .expand(d0, vertRange, d0); List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); - if (currentEssence < this.getCostPerRefresh() * list.size()) - { + if (currentEssence < this.getCostPerRefresh() * list.size()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } - else - { - for (EntityLivingBase livingEntity : list) - { - if (!livingEntity.isEntityAlive() || livingEntity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(livingEntity.getClass())) - { + } else { + for (EntityLivingBase livingEntity : list) { + if (!livingEntity.isEntityAlive() + || livingEntity instanceof EntityPlayer + || AlchemicalWizardry.wellBlacklist.contains(livingEntity.getClass())) { continue; } Collection potionEffects = livingEntity.getActivePotionEffects(); - if (potionEffects.isEmpty()) - { + if (potionEffects.isEmpty()) { if (hasOffensa) livingEntity.addPotionEffect(new PotionEffect(Potion.weakness.id, 5, 1)); livingEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 9)); livingEntity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 5, 4)); - } - else - { - if (hasOffensa) - { - if (!potionEffects.contains(new PotionEffect(Potion.weakness.id, 5, 1))) livingEntity.addPotionEffect(new PotionEffect(Potion.weakness.id, 5, 1)); + } else { + if (hasOffensa) { + if (!potionEffects.contains(new PotionEffect(Potion.weakness.id, 5, 1))) + livingEntity.addPotionEffect(new PotionEffect(Potion.weakness.id, 5, 1)); } - if (!potionEffects.contains(new PotionEffect(Potion.moveSlowdown.id, 5, 9))) livingEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 9)); - if (!potionEffects.contains(new PotionEffect(Potion.digSlowdown.id, 5, 4))) livingEntity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 5, 4)); + if (!potionEffects.contains(new PotionEffect(Potion.moveSlowdown.id, 5, 9))) + livingEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 9)); + if (!potionEffects.contains(new PotionEffect(Potion.digSlowdown.id, 5, 4))) + livingEntity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 5, 4)); } - if (livingEntity instanceof EntityEnderman) - { - if (!potionEffects.contains(new PotionEffect(AlchemicalWizardry.customPotionPlanarBindingID, 5, 0))) livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBindingID, 5, 0)); - } - else if (livingEntity instanceof EntityCreeper) - { - if (((EntityCreeper) livingEntity).getCreeperState() > -1) - { + if (livingEntity instanceof EntityEnderman) { + if (!potionEffects.contains(new PotionEffect(AlchemicalWizardry.customPotionPlanarBindingID, 5, 0))) + livingEntity.addPotionEffect( + new PotionEffect(AlchemicalWizardry.customPotionPlanarBindingID, 5, 0)); + } else if (livingEntity instanceof EntityCreeper) { + if (((EntityCreeper) livingEntity).getCreeperState() > -1) { ((EntityCreeper) livingEntity).setCreeperState(-1); } } @@ -90,14 +83,12 @@ public class RitualEffectMobDisable extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 2000; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList mobDisableRitual = new ArrayList(); mobDisableRitual.add(new RitualComponent(1, 0, 0, RitualComponent.EARTH)); mobDisableRitual.add(new RitualComponent(0, 0, 1, RitualComponent.EARTH)); diff --git a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectWithering.java b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectWithering.java index 3de3b08..7140520 100644 --- a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectWithering.java +++ b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualEffectWithering.java @@ -7,6 +7,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; @@ -14,24 +16,18 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectWithering extends RitualEffect -{ +public class RitualEffectWithering extends RitualEffect { public static final int reductusDrain = 15; public static final int virtusDrain = 15; public static final int praesidiumDrain = 5; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); World worldSave = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(owner); worldSave.setItemData(owner, data); } @@ -44,8 +40,7 @@ public class RitualEffectWithering extends RitualEffect int timeDelay = 50; - if (world.getWorldTime() % timeDelay != 0) - { + if (world.getWorldTime() % timeDelay != 0) { return; } @@ -54,17 +49,14 @@ public class RitualEffectWithering extends RitualEffect int range = 15 * (hasPraesidium ? 3 : 1); int vertRange = 15 * (hasPraesidium ? 3 : 1); - List list = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, vertRange); + List list = + SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, vertRange); int entityCount = 0; - for(EntityLivingBase livingEntity : list) - { - if (livingEntity instanceof EntityPlayer) - { + for (EntityLivingBase livingEntity : list) { + if (livingEntity instanceof EntityPlayer) { entityCount += 10; - } - else - { + } else { entityCount++; } } @@ -74,55 +66,44 @@ public class RitualEffectWithering extends RitualEffect int cost = getCostPerRefresh() * (hasVirtus ? 3 : 1); int potency = hasVirtus ? 1 : 0; - if (currentEssence < cost * entityCount) - { + if (currentEssence < cost * entityCount) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } - else - { + } else { entityCount = 0; boolean hasReductus = canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - for (EntityLivingBase livingEntity : list) - { - hasReductus = hasReductus && canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - if (hasReductus && !(livingEntity instanceof EntityPlayer)) - { + for (EntityLivingBase livingEntity : list) { + hasReductus = hasReductus + && canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + if (hasReductus && !(livingEntity instanceof EntityPlayer)) { continue; } PotionEffect effect = livingEntity.getActivePotionEffect(Potion.wither); - if (effect == null || (effect != null && effect.getAmplifier() <= potency && effect.getDuration() <= timeDelay)) - { - if (!hasVirtus || (canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false))) - { + if (effect == null + || (effect != null && effect.getAmplifier() <= potency && effect.getDuration() <= timeDelay)) { + if (!hasVirtus + || (canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false))) { livingEntity.addPotionEffect(new PotionEffect(Potion.wither.id, timeDelay + 2, potency)); - if (hasReductus) - { + if (hasReductus) { canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } - if (hasVirtus) - { + if (hasVirtus) { canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); } - if (livingEntity instanceof EntityPlayer) - { + if (livingEntity instanceof EntityPlayer) { entityCount += 10; - } - else - { + } else { entityCount++; } } } } - if(entityCount > 0) - { - if (hasPraesidium) - { + if (entityCount > 0) { + if (hasPraesidium) { canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, true); } data.currentEssence = currentEssence - cost * entityCount; @@ -132,14 +113,12 @@ public class RitualEffectWithering extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 30; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList witherRitual = new ArrayList(); witherRitual.add(new RitualComponent(1, 0, -1, RitualComponent.DUSK)); witherRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK)); diff --git a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualRegistry.java b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualRegistry.java index 1235c07..4b684fe 100644 --- a/src/main/java/com/arc/bloodarsenal/common/rituals/RitualRegistry.java +++ b/src/main/java/com/arc/bloodarsenal/common/rituals/RitualRegistry.java @@ -5,23 +5,41 @@ import WayofTime.alchemicalWizardry.common.renderer.AlchemyCircleRenderer; import com.arc.bloodarsenal.common.BloodArsenalConfig; import net.minecraft.util.ResourceLocation; -public class RitualRegistry -{ - public static void initRituals() - { +public class RitualRegistry { + public static void initRituals() { String resource = "alchemicalwizardry:textures/models/SimpleTransCircle.png"; - Rituals.registerRitual("ARC001Wither", 1, 75000, new RitualEffectWithering(), "Ritual of Withering", new AlchemyCircleRenderer(new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false)); - Rituals.registerRitual("ARC002Midas", 1, 5000, new RitualEffectMidas(), "Midas Touch", new AlchemyCircleRenderer(new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 2.5, false)); - Rituals.registerRitual("ARC003Enchant", 2, 50000, new RitualEffectEnchant(), "The Enchantress's Spell", new AlchemyCircleRenderer(new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false)); + Rituals.registerRitual( + "ARC001Wither", + 1, + 75000, + new RitualEffectWithering(), + "Ritual of Withering", + new AlchemyCircleRenderer( + new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false)); + Rituals.registerRitual( + "ARC002Midas", + 1, + 5000, + new RitualEffectMidas(), + "Midas Touch", + new AlchemyCircleRenderer( + new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 2.5, false)); + Rituals.registerRitual( + "ARC003Enchant", + 2, + 50000, + new RitualEffectEnchant(), + "The Enchantress's Spell", + new AlchemyCircleRenderer( + new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false)); Rituals.registerRitual("ARC004MobDisable", 2, 25000, new RitualEffectMobDisable(), "Ritual of Mob Oppression"); Rituals.registerRitual("ARC005Fisherman", 1, 10000, new RitualEffectFishing(), "Fisherman's Hymn"); blacklistRituals(); } - public static void blacklistRituals() - { + public static void blacklistRituals() { if (BloodArsenalConfig.ritualDisabledWither) r("ARC001Wither"); if (BloodArsenalConfig.ritualDisabledMidas) r("ARC002Midas"); if (BloodArsenalConfig.ritualDisabledEnchantment) r("ARC003Enchant"); @@ -29,8 +47,7 @@ public class RitualRegistry if (BloodArsenalConfig.ritualDisabledFisherman) r("ARC005Fisherman"); } - private static void r(String ritualID) - { + private static void r(String ritualID) { Rituals.ritualMap.remove(ritualID); Rituals.keyList.remove(ritualID); } diff --git a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalResearchItem.java b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalResearchItem.java index 3203c95..daa695d 100644 --- a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalResearchItem.java +++ b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalResearchItem.java @@ -9,32 +9,30 @@ import net.minecraft.util.StatCollector; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.research.ResearchItem; -public class BloodArsenalResearchItem extends ResearchItem -{ +public class BloodArsenalResearchItem extends ResearchItem { String inter = null; public BloodArsenalResearchItem(String par1, String x) { super(par1, x); } - public BloodArsenalResearchItem(String par1, String x, AspectList tags, int y, int z, int par5, ResourceLocation icon) - { + public BloodArsenalResearchItem( + String par1, String x, AspectList tags, int y, int z, int par5, ResourceLocation icon) { super(par1, x, tags, y, z, par5, icon); } - public BloodArsenalResearchItem(String par1, String x, AspectList tags, int y, int z, int par5, ItemStack icon) - { + public BloodArsenalResearchItem(String par1, String x, AspectList tags, int y, int z, int par5, ItemStack icon) { super(par1, x, tags, y, z, par5, icon); } - public BloodArsenalResearchItem(String par1, String x, String mod, AspectList tags, int y, int z, int par5, ResourceLocation icon) - { + public BloodArsenalResearchItem( + String par1, String x, String mod, AspectList tags, int y, int z, int par5, ResourceLocation icon) { super(par1, x, tags, y, z, par5, icon); this.inter = mod; } - public BloodArsenalResearchItem(String par1, String x, String mod, AspectList tags, int y, int z, int par5, ItemStack icon) - { + public BloodArsenalResearchItem( + String par1, String x, String mod, AspectList tags, int y, int z, int par5, ItemStack icon) { super(par1, x, tags, y, z, par5, icon); this.inter = mod; } @@ -47,8 +45,12 @@ public class BloodArsenalResearchItem extends ResearchItem @Override @SideOnly(Side.CLIENT) - public String getText() - { - return BloodArsenalConfig.researchTag ? (this.inter == null ? "[BA] " + StatCollector.translateToLocal("blood_arsenal.research_text." + this.key) : "[BA] " + this.inter + " " + StatCollector.translateToLocal("blood_arsenal.research_text." + this.key)) : StatCollector.translateToLocal("blood_arsenal.research_text." + this.key); + public String getText() { + return BloodArsenalConfig.researchTag + ? (this.inter == null + ? "[BA] " + StatCollector.translateToLocal("blood_arsenal.research_text." + this.key) + : "[BA] " + this.inter + " " + + StatCollector.translateToLocal("blood_arsenal.research_text." + this.key)) + : StatCollector.translateToLocal("blood_arsenal.research_text." + this.key); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalThaumcraft.java b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalThaumcraft.java index 78644df..05840b2 100644 --- a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalThaumcraft.java +++ b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodArsenalThaumcraft.java @@ -2,7 +2,6 @@ * Taken from SpitefulFox's ForbiddenMagic * https://github.com/SpitefulFox/ForbiddenMagic */ - package com.arc.bloodarsenal.common.thaumcraft; import com.arc.bloodarsenal.common.block.ModBlocks; @@ -17,26 +16,121 @@ import thaumcraft.api.wands.StaffRod; import thaumcraft.api.wands.WandCap; import thaumcraft.api.wands.WandRod; -public class BloodArsenalThaumcraft -{ - public static void addResearch() - { +public class BloodArsenalThaumcraft { + public static void addResearch() { final String FORBIDDEN = "FORBIDDEN"; WandRod bloodRod = WandRod.rods.get("blood"); WandCap alchemicalCap = WandCap.caps.get("alchemical"); WandRod bloodStaff = StaffRod.rods.get("blood"); - InfusionRecipe rod_blood_wood = ThaumcraftApi.addInfusionCraftingRecipe("ROD_blood_wood", new ItemStack(ModItems.wandCore, 1, 0), 3, (new AspectList()).add(Aspect.LIFE, 32).add(Aspect.MAGIC, 24).add(Aspect.TOOL, 16), bloodRod.getItem(), new ItemStack[] {new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(ModItems.blood_infused_glowstone_dust)}); - new BloodArsenalResearchItem("ROD_blood_wood", FORBIDDEN, (new AspectList()).add(Aspect.LIFE, 10).add(Aspect.MAGIC, 8).add(Aspect.TOOL, 4), 4, -5, 2, new ItemStack(ModItems.wandCore, 1, 0)).setPages(new ResearchPage("blood_arsenal.research_page.ROD_blood_wood.1"), new ResearchPage("blood_arsenal.research_page.ROD_blood_wood.2"), new ResearchPage(rod_blood_wood)).setParents("ROD_blood").registerResearchItem(); + InfusionRecipe rod_blood_wood = ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_blood_wood", + new ItemStack(ModItems.wandCore, 1, 0), + 3, + (new AspectList()).add(Aspect.LIFE, 32).add(Aspect.MAGIC, 24).add(Aspect.TOOL, 16), + bloodRod.getItem(), + new ItemStack[] { + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModBlocks.blood_infused_wood), + new ItemStack(ModBlocks.blood_infused_wood), + new ItemStack(ModBlocks.blood_infused_wood), + new ItemStack(ModItems.blood_infused_glowstone_dust) + }); + new BloodArsenalResearchItem( + "ROD_blood_wood", + FORBIDDEN, + (new AspectList()) + .add(Aspect.LIFE, 10) + .add(Aspect.MAGIC, 8) + .add(Aspect.TOOL, 4), + 4, + -5, + 2, + new ItemStack(ModItems.wandCore, 1, 0)) + .setPages( + new ResearchPage("blood_arsenal.research_page.ROD_blood_wood.1"), + new ResearchPage("blood_arsenal.research_page.ROD_blood_wood.2"), + new ResearchPage(rod_blood_wood)) + .setParents("ROD_blood") + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ROD_blood_wood", 2); ThaumcraftApi.addWarpToItem(new ItemStack(ModItems.wandCore, 1, 0), 2); - InfusionRecipe cap_blood_iron = ThaumcraftApi.addInfusionCraftingRecipe("CAP_blood_iron", new ItemStack(ModItems.wandCap, 1, 0), 3, (new AspectList()).add(Aspect.LIFE, 24).add(Aspect.WATER, 24).add(Aspect.MAGIC, 20), alchemicalCap.getItem(), new ItemStack[] { new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModItems.blood_infused_iron), new ItemStack(ModItems.blood_infused_iron), new ItemStack(ModItems.blood_infused_iron), new ItemStack(ModItems.blood_infused_glowstone_dust), new ItemStack(ModItems.blood_infused_glowstone_dust) }); - new BloodArsenalResearchItem("CAP_blood_iron", FORBIDDEN, (new AspectList()).add(Aspect.LIFE, 6).add(Aspect.TOOL, 2), 2, -5, 2, new ItemStack(ModItems.wandCap, 1, 0)).setPages(new ResearchPage("blood_arsenal.research_page.CAP_blood_iron.1"), new ResearchPage(cap_blood_iron)).setParents("ROD_blood_wood", "CAP_alchemical").registerResearchItem(); + InfusionRecipe cap_blood_iron = ThaumcraftApi.addInfusionCraftingRecipe( + "CAP_blood_iron", + new ItemStack(ModItems.wandCap, 1, 0), + 3, + (new AspectList()).add(Aspect.LIFE, 24).add(Aspect.WATER, 24).add(Aspect.MAGIC, 20), + alchemicalCap.getItem(), + new ItemStack[] { + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModItems.blood_infused_iron), + new ItemStack(ModItems.blood_infused_iron), + new ItemStack(ModItems.blood_infused_iron), + new ItemStack(ModItems.blood_infused_glowstone_dust), + new ItemStack(ModItems.blood_infused_glowstone_dust) + }); + new BloodArsenalResearchItem( + "CAP_blood_iron", + FORBIDDEN, + (new AspectList()).add(Aspect.LIFE, 6).add(Aspect.TOOL, 2), + 2, + -5, + 2, + new ItemStack(ModItems.wandCap, 1, 0)) + .setPages( + new ResearchPage("blood_arsenal.research_page.CAP_blood_iron.1"), + new ResearchPage(cap_blood_iron)) + .setParents("ROD_blood_wood", "CAP_alchemical") + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("CAP_blood_iron", 1); ThaumcraftApi.addWarpToItem(new ItemStack(ModItems.wandCap), 1); - InfusionRecipe staff_blood_wood = ThaumcraftApi.addInfusionCraftingRecipe("ROD_blood_wood_staff", new ItemStack(ModItems.wandCore, 1, 1), 6, (new AspectList()).add(Aspect.LIFE, 64).add(Aspect.MAGIC, 48).add(Aspect.WATER, 32).add(Aspect.TOOL, 24), bloodStaff.getItem(), new ItemStack[] {new ItemStack(ModItems.wandCore, 1, 0), new ItemStack(ModItems.blood_infused_glowstone_dust), new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModItems.blood_infused_glowstone_dust), new ItemStack(ModItems.wandCore, 1, 0), new ItemStack(ModItems.blood_infused_glowstone_dust), new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(ModBlocks.blood_infused_wood), new ItemStack(ModItems.amorphic_catalyst), new ItemStack(ModItems.blood_infused_glowstone_dust)}); - new BloodArsenalResearchItem("ROD_blood_wood_staff", FORBIDDEN, (new AspectList()).add(Aspect.LIFE, 16).add(Aspect.MAGIC, 12).add(Aspect.TOOL, 8), 5, -3, 3, new ItemStack(ModItems.wandCore, 1, 1)).setPages(new ResearchPage("blood_arsenal.research_page.ROD_blood_wood_staff.1"), new ResearchPage(staff_blood_wood)).setParents("ROD_blood_wood", "ROD_blood_staff").setHidden().setSpecial().registerResearchItem(); + InfusionRecipe staff_blood_wood = ThaumcraftApi.addInfusionCraftingRecipe( + "ROD_blood_wood_staff", + new ItemStack(ModItems.wandCore, 1, 1), + 6, + (new AspectList()) + .add(Aspect.LIFE, 64) + .add(Aspect.MAGIC, 48) + .add(Aspect.WATER, 32) + .add(Aspect.TOOL, 24), + bloodStaff.getItem(), + new ItemStack[] { + new ItemStack(ModItems.wandCore, 1, 0), + new ItemStack(ModItems.blood_infused_glowstone_dust), + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModBlocks.blood_infused_wood), + new ItemStack(ModBlocks.blood_infused_wood), + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModItems.blood_infused_glowstone_dust), + new ItemStack(ModItems.wandCore, 1, 0), + new ItemStack(ModItems.blood_infused_glowstone_dust), + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModBlocks.blood_infused_wood), + new ItemStack(ModBlocks.blood_infused_wood), + new ItemStack(ModItems.amorphic_catalyst), + new ItemStack(ModItems.blood_infused_glowstone_dust) + }); + new BloodArsenalResearchItem( + "ROD_blood_wood_staff", + FORBIDDEN, + (new AspectList()) + .add(Aspect.LIFE, 16) + .add(Aspect.MAGIC, 12) + .add(Aspect.TOOL, 8), + 5, + -3, + 3, + new ItemStack(ModItems.wandCore, 1, 1)) + .setPages( + new ResearchPage("blood_arsenal.research_page.ROD_blood_wood_staff.1"), + new ResearchPage(staff_blood_wood)) + .setParents("ROD_blood_wood", "ROD_blood_staff") + .setHidden() + .setSpecial() + .registerResearchItem(); ThaumcraftApi.addWarpToResearch("ROD_blood_wood_staff", 3); ThaumcraftApi.addWarpToItem(new ItemStack(ModItems.wandCore, 1, 1), 4); } diff --git a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodStaffUpdate.java b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodStaffUpdate.java index 5db6cd0..fd03a03 100644 --- a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodStaffUpdate.java +++ b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodStaffUpdate.java @@ -2,7 +2,6 @@ * Taken from SpitefulFox's ForbiddenMagic * https://github.com/SpitefulFox/ForbiddenMagic */ - package com.arc.bloodarsenal.common.thaumcraft; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; @@ -13,90 +12,71 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; import thaumcraft.common.items.wands.ItemWandCasting; -public class BloodWoodStaffUpdate implements IWandRodOnUpdate -{ - Aspect[] primals = (Aspect[])Aspect.getPrimalAspects().toArray(new Aspect[0]); +public class BloodWoodStaffUpdate implements IWandRodOnUpdate { + Aspect[] primals = (Aspect[]) Aspect.getPrimalAspects().toArray(new Aspect[0]); public BloodWoodStaffUpdate() {} @Override - public void onUpdate(ItemStack itemstack, EntityPlayer player) - { - if (player.ticksExisted % 10 == 0) - { - try - { + public void onUpdate(ItemStack itemstack, EntityPlayer player) { + if (player.ticksExisted % 10 == 0) { + try { if (!checkHotbar(itemstack, player)) return; SoulNetworkHandler.checkAndSetItemOwner(itemstack, player); int cost; - if (((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical")) - { + if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("alchemical")) { cost = 12; - } - else if (((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("blood_iron")) - { + } else if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("blood_iron")) { cost = 10; - } - else - { + } else { cost = 13; } - for (int x = 0; x < primals.length; x++) - { - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]); - if (deficit > 0) - { + for (int x = 0; x < primals.length; x++) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]); + if (deficit > 0) { deficit = Math.min(deficit, 100); - if (player.capabilities.isCreativeMode) - { + if (player.capabilities.isCreativeMode) { ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); - } - else if (SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0) - { + } else if (SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0) { ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); player.attackEntityFrom(DamageSource.starve, 1F); - } - else if (syphonHealth(player)) - { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + } else if (syphonHealth(player)) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true); return; - } - else - { + } else { return; } } } + } catch (Exception e) { } - catch (Exception e) {} } - } - public boolean syphonHealth(EntityPlayer player) - { - if (player.getHealth() > 0) - { + public boolean syphonHealth(EntityPlayer player) { + if (player.getHealth() > 0) { player.setHealth(player.getHealth() - 3); return true; - } - else - { + } else { return false; } } - private boolean checkHotbar(ItemStack stack, EntityPlayer player) - { - for (int x = 0; x < 9; ++x) - { + private boolean checkHotbar(ItemStack stack, EntityPlayer player) { + for (int x = 0; x < 9; ++x) { ItemStack item = player.inventory.getStackInSlot(x); - if (item == stack) - { + if (item == stack) { return true; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodWandUpdate.java b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodWandUpdate.java index 8c9c9d6..558fd85 100644 --- a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodWandUpdate.java +++ b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodWoodWandUpdate.java @@ -2,7 +2,6 @@ * Taken from SpitefulFox's ForbiddenMagic * https://github.com/SpitefulFox/ForbiddenMagic */ - package com.arc.bloodarsenal.common.thaumcraft; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; @@ -12,78 +11,62 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; import thaumcraft.common.items.wands.ItemWandCasting; -public class BloodWoodWandUpdate implements IWandRodOnUpdate -{ - Aspect[] primals = (Aspect[])Aspect.getPrimalAspects().toArray(new Aspect[0]); +public class BloodWoodWandUpdate implements IWandRodOnUpdate { + Aspect[] primals = (Aspect[]) Aspect.getPrimalAspects().toArray(new Aspect[0]); public BloodWoodWandUpdate() {} - public void onUpdate(ItemStack itemstack, EntityPlayer player) - { - if (player.ticksExisted % 50 == 0) - { - try - { + public void onUpdate(ItemStack itemstack, EntityPlayer player) { + if (player.ticksExisted % 50 == 0) { + try { SoulNetworkHandler.checkAndSetItemOwner(itemstack, player); byte e; - if (((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical")) - { + if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("alchemical")) { e = 12; - } - else if (((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("blood_iron")) - { + } else if (((ItemWandCasting) itemstack.getItem()) + .getCap(itemstack) + .getTag() + .equals("blood_iron")) { e = 10; - } - else - { + } else { e = 13; } - for (int x = 0; x < this.primals.length; ++x) - { - int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, this.primals[x]); - if (deficit > 0) - { + for (int x = 0; x < this.primals.length; ++x) { + int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) + - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, this.primals[x]); + if (deficit > 0) { deficit = Math.min(deficit, 100); - if (player.capabilities.isCreativeMode) - { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, this.primals[x], 1, true); - } - else - { - if (SoulNetworkHandler.syphonFromNetwork(itemstack, e * deficit) <= 0) - { - if (this.syphonHealth(player)) - { - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, this.primals[x], 1, true); + if (player.capabilities.isCreativeMode) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, this.primals[x], 1, true); + } else { + if (SoulNetworkHandler.syphonFromNetwork(itemstack, e * deficit) <= 0) { + if (this.syphonHealth(player)) { + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, this.primals[x], 1, true); return; } return; } - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, this.primals[x], 1, true); + ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, this.primals[x], 1, true); } } } - } - catch (Throwable var6) - { + } catch (Throwable var6) { } } - } - public boolean syphonHealth(EntityPlayer player) - { - if (player.getHealth() > 6.0F) - { + public boolean syphonHealth(EntityPlayer player) { + if (player.getHealth() > 6.0F) { player.setHealth(player.getHealth() - 3.0F); return true; - } - else - { + } else { return false; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodyWandCap.java b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodyWandCap.java index 59bd504..f657b79 100644 --- a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodyWandCap.java +++ b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/BloodyWandCap.java @@ -2,24 +2,28 @@ * Taken from SpitefulFox's ForbiddenMagic * https://github.com/SpitefulFox/ForbiddenMagic */ - package com.arc.bloodarsenal.common.thaumcraft; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.WandCap; -import java.util.List; - -public class BloodyWandCap extends WandCap -{ +public class BloodyWandCap extends WandCap { public BloodyWandCap(String tag, float discount, ItemStack item, int craftCost, ResourceLocation skin) { super(tag, discount, item, craftCost); this.setTexture(skin); } - public BloodyWandCap(String tag, float discount, List specialAspects, float discountSpecial, ItemStack item, int craftCost, ResourceLocation skin) { + public BloodyWandCap( + String tag, + float discount, + List specialAspects, + float discountSpecial, + ItemStack item, + int craftCost, + ResourceLocation skin) { super(tag, discount, specialAspects, discountSpecial, item, craftCost); this.setTexture(skin); } diff --git a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCaps.java b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCaps.java index d56685c..62628e7 100644 --- a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCaps.java +++ b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCaps.java @@ -2,27 +2,23 @@ * Taken from SpitefulFox's ForbiddenMagic * https://github.com/SpitefulFox/ForbiddenMagic */ - package com.arc.bloodarsenal.common.thaumcraft; import com.arc.bloodarsenal.common.BloodArsenal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - -public class ItemWandCaps extends Item -{ - public final String[] types = new String[]{"blood_iron"}; +public class ItemWandCaps extends Item { + public final String[] types = new String[] {"blood_iron"}; public IIcon[] icon; - public ItemWandCaps() - { + public ItemWandCaps() { setMaxDamage(0); setHasSubtypes(true); setCreativeTab(BloodArsenal.BA_TAB); @@ -30,36 +26,30 @@ public class ItemWandCaps extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ir) - { + public void registerIcons(IIconRegister ir) { this.icon = new IIcon[this.types.length]; - for (int x = 0; x < this.types.length; ++x) - { + for (int x = 0; x < this.types.length; ++x) { this.icon[x] = ir.registerIcon("BloodArsenal:wand_cap_" + this.types[x]); } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int p_77617_1_) - { + public IIcon getIconFromDamage(int p_77617_1_) { return this.icon[p_77617_1_]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs creativeTabs, List list) - { - for (int wand = 0; wand < this.types.length; ++wand) - { + public void getSubItems(Item item, CreativeTabs creativeTabs, List list) { + for (int wand = 0; wand < this.types.length; ++wand) { list.add(new ItemStack(this, 1, wand)); } } @Override - public String getUnlocalizedName(ItemStack p_77667_1_) - { + public String getUnlocalizedName(ItemStack p_77667_1_) { return super.getUnlocalizedName() + "." + this.types[p_77667_1_.getItemDamage()]; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCores.java b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCores.java index 14542aa..86d4045 100644 --- a/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCores.java +++ b/src/main/java/com/arc/bloodarsenal/common/thaumcraft/ItemWandCores.java @@ -2,12 +2,12 @@ * Taken from SpitefulFox's ForbiddenMagic * https://github.com/SpitefulFox/ForbiddenMagic */ - package com.arc.bloodarsenal.common.thaumcraft; import com.arc.bloodarsenal.common.BloodArsenal; 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; @@ -18,15 +18,11 @@ import thaumcraft.api.wands.WandCap; import thaumcraft.api.wands.WandRod; import thaumcraft.common.items.wands.ItemWandCasting; -import java.util.List; - -public class ItemWandCores extends Item -{ - public final String[] types = new String[]{"blood_wood", "blood_wood_staff"}; +public class ItemWandCores extends Item { + public final String[] types = new String[] {"blood_wood", "blood_wood_staff"}; public IIcon[] icon; - public ItemWandCores() - { + public ItemWandCores() { setMaxDamage(0); setHasSubtypes(true); setCreativeTab(BloodArsenal.BA_TAB); @@ -34,46 +30,40 @@ public class ItemWandCores extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ir) - { + public void registerIcons(IIconRegister ir) { this.icon = new IIcon[this.types.length]; - for (int x = 0; x < this.types.length; ++x) - { + for (int x = 0; x < this.types.length; ++x) { this.icon[x] = ir.registerIcon("BloodArsenal:wand_rod_" + this.types[x]); } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int p_77617_1_) - { + public IIcon getIconFromDamage(int p_77617_1_) { return this.icon[p_77617_1_]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs creativeTabs, List list) - { - for (int wand = 0; wand < this.types.length; ++wand) - { + public void getSubItems(Item item, CreativeTabs creativeTabs, List list) { + for (int wand = 0; wand < this.types.length; ++wand) { list.add(new ItemStack(this, 1, wand)); } ItemStack var5; var5 = ItemApi.getItem("itemWandCasting", 84); ((ItemWandCasting) var5.getItem()).setCap(var5, WandCap.caps.get("blood_iron")); - ((ItemWandCasting)var5.getItem()).setRod(var5, WandRod.rods.get("blood_wood")); + ((ItemWandCasting) var5.getItem()).setRod(var5, WandRod.rods.get("blood_wood")); list.add(var5); var5 = ItemApi.getItem("itemWandCasting", 168); - ((ItemWandCasting)var5.getItem()).setCap(var5, WandCap.caps.get("blood_iron")); - ((ItemWandCasting)var5.getItem()).setRod(var5, WandRod.rods.get("blood_wood_staff")); + ((ItemWandCasting) var5.getItem()).setCap(var5, WandCap.caps.get("blood_iron")); + ((ItemWandCasting) var5.getItem()).setRod(var5, WandRod.rods.get("blood_wood_staff")); list.add(var5); } @Override - public String getUnlocalizedName(ItemStack p_77667_1_) - { + public String getUnlocalizedName(ItemStack p_77667_1_) { return super.getUnlocalizedName() + "." + this.types[p_77667_1_.getItemDamage()]; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/FluidTankRestricted.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/FluidTankRestricted.java index f520b54..b84eee9 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/FluidTankRestricted.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/FluidTankRestricted.java @@ -4,25 +4,19 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -public class FluidTankRestricted extends FluidTank -{ +public class FluidTankRestricted extends FluidTank { String[] name; - public FluidTankRestricted(int capacity, String... name) - { + public FluidTankRestricted(int capacity, String... name) { super(capacity); this.name = name; } - public int fill(FluidStack resource, boolean doFill) - { - if (this.fluid == null) - { + public int fill(FluidStack resource, boolean doFill) { + if (this.fluid == null) { String str = FluidRegistry.getFluidName(resource); - for (String aName : this.name) - { - if (aName.equals(str)) - { + for (String aName : this.name) { + if (aName.equals(str)) { return super.fill(resource, doFill); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/PacketHandler.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/PacketHandler.java index 149c86c..79429a1 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/PacketHandler.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/PacketHandler.java @@ -12,31 +12,26 @@ import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; +import java.util.EnumMap; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.EnumMap; - -public enum PacketHandler -{ +public enum PacketHandler { INSTANCE; private EnumMap channels; - PacketHandler() - { + PacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("BloodArsenal", new BATileCodec()); - if (FMLCommonHandler.instance().getSide() == Side.CLIENT) - { + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { addClientHandler(); } } @SideOnly(Side.CLIENT) - private void addClientHandler() - { + private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String tileCodec = clientChannel.findChannelHandlerNameForType(BATileCodec.class); @@ -45,16 +40,13 @@ public enum PacketHandler clientChannel.pipeline().addAfter(tileCodec, "TileLPMaterializer", new TileLPMaterializerMessageHandler()); } - private static class TilePortableAltarMessageHandler extends SimpleChannelInboundHandler - { + private static class TilePortableAltarMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TilePortableAltarMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TilePortableAltarMessage msg) throws Exception { World world = BloodArsenal.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TilePortableAltar) - { + if (te instanceof TilePortableAltar) { TilePortableAltar altar = (TilePortableAltar) te; altar.handlePacketData(msg.items, msg.fluids, msg.capacity); @@ -62,16 +54,13 @@ public enum PacketHandler } } - private static class TileLifeInfuserMessageHandler extends SimpleChannelInboundHandler - { + private static class TileLifeInfuserMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TileLifeInfuserMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TileLifeInfuserMessage msg) throws Exception { World world = BloodArsenal.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TileLifeInfuser) - { + if (te instanceof TileLifeInfuser) { TileLifeInfuser tile = (TileLifeInfuser) te; tile.handlePacketData(msg.items, msg.fluids, msg.capacity); @@ -79,16 +68,14 @@ public enum PacketHandler } } - private static class TileLPMaterializerMessageHandler extends SimpleChannelInboundHandler - { + private static class TileLPMaterializerMessageHandler + extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TileLPMaterializerMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TileLPMaterializerMessage msg) throws Exception { World world = BloodArsenal.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TileLPMaterializer) - { + if (te instanceof TileLPMaterializer) { TileLPMaterializer tile = (TileLPMaterializer) te; tile.handlePacketData(msg.items, msg.fluids, msg.capacity); @@ -96,13 +83,11 @@ public enum PacketHandler } } - public static class BAMessage - { + public static class BAMessage { int index; } - public static class TilePortableAltarMessage extends BAMessage - { + public static class TilePortableAltarMessage extends BAMessage { int x; int y; int z; @@ -112,8 +97,7 @@ public enum PacketHandler int capacity; } - public static class TileLifeInfuserMessage extends BAMessage - { + public static class TileLifeInfuserMessage extends BAMessage { int x; int y; int z; @@ -123,8 +107,7 @@ public enum PacketHandler int capacity; } - public static class TileLPMaterializerMessage extends BAMessage - { + public static class TileLPMaterializerMessage extends BAMessage { int x; int y; int z; @@ -134,43 +117,34 @@ public enum PacketHandler int capacity; } - private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec - { - public ClientToServerCodec() - { - } + private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec { + public ClientToServerCodec() {} @Override - public void encodeInto(ChannelHandlerContext ctx, BAMessage msg, ByteBuf target) throws Exception - { + public void encodeInto(ChannelHandlerContext ctx, BAMessage msg, ByteBuf target) throws Exception { target.writeInt(msg.index); } @Override - public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, BAMessage msg) - { -// int index = source.readInt(); + public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, BAMessage msg) { + // int index = source.readInt(); System.out.println("Packet is recieved and being decoded"); } } - private class BATileCodec extends FMLIndexedMessageToMessageCodec - { - public BATileCodec() - { + private class BATileCodec extends FMLIndexedMessageToMessageCodec { + public BATileCodec() { addDiscriminator(0, TilePortableAltarMessage.class); addDiscriminator(1, TileLifeInfuserMessage.class); addDiscriminator(2, TileLPMaterializerMessage.class); } @Override - public void encodeInto(ChannelHandlerContext ctx, BAMessage msg, ByteBuf target) throws Exception - { + public void encodeInto(ChannelHandlerContext ctx, BAMessage msg, ByteBuf target) throws Exception { target.writeInt(msg.index); - switch (msg.index) - { + switch (msg.index) { case 0: target.writeInt(((TilePortableAltarMessage) msg).x); target.writeInt(((TilePortableAltarMessage) msg).y); @@ -178,12 +152,10 @@ public enum PacketHandler target.writeBoolean(((TilePortableAltarMessage) msg).items != null); - if (((TilePortableAltarMessage) msg).items != null) - { + if (((TilePortableAltarMessage) msg).items != null) { int[] items = ((TilePortableAltarMessage) msg).items; - for (int j = 0; j < items.length; j++) - { + for (int j = 0; j < items.length; j++) { int i = items[j]; target.writeInt(i); } @@ -191,12 +163,10 @@ public enum PacketHandler target.writeBoolean(((TilePortableAltarMessage) msg).fluids != null); - if (((TilePortableAltarMessage) msg).fluids != null) - { + if (((TilePortableAltarMessage) msg).fluids != null) { int[] fluids = ((TilePortableAltarMessage) msg).fluids; - for (int j = 0; j < fluids.length; j++) - { + for (int j = 0; j < fluids.length; j++) { int i = fluids[j]; target.writeInt(i); } @@ -213,12 +183,10 @@ public enum PacketHandler target.writeBoolean(((TileLifeInfuserMessage) msg).items != null); - if (((TileLifeInfuserMessage) msg).items != null) - { + if (((TileLifeInfuserMessage) msg).items != null) { int[] items = ((TileLifeInfuserMessage) msg).items; - for (int j = 0; j < items.length; j++) - { + for (int j = 0; j < items.length; j++) { int i = items[j]; target.writeInt(i); } @@ -226,12 +194,10 @@ public enum PacketHandler target.writeBoolean(((TileLifeInfuserMessage) msg).fluids != null); - if (((TileLifeInfuserMessage) msg).fluids != null) - { + if (((TileLifeInfuserMessage) msg).fluids != null) { int[] fluids = ((TileLifeInfuserMessage) msg).fluids; - for (int j = 0; j < fluids.length; j++) - { + for (int j = 0; j < fluids.length; j++) { int i = fluids[j]; target.writeInt(i); } @@ -248,12 +214,10 @@ public enum PacketHandler target.writeBoolean(((TileLPMaterializerMessage) msg).items != null); - if (((TileLPMaterializerMessage) msg).items != null) - { + if (((TileLPMaterializerMessage) msg).items != null) { int[] items = ((TileLPMaterializerMessage) msg).items; - for (int j = 0; j < items.length; j++) - { + for (int j = 0; j < items.length; j++) { int i = items[j]; target.writeInt(i); } @@ -261,12 +225,10 @@ public enum PacketHandler target.writeBoolean(((TileLPMaterializerMessage) msg).fluids != null); - if (((TileLPMaterializerMessage) msg).fluids != null) - { + if (((TileLPMaterializerMessage) msg).fluids != null) { int[] fluids = ((TileLPMaterializerMessage) msg).fluids; - for (int j = 0; j < fluids.length; j++) - { + for (int j = 0; j < fluids.length; j++) { int i = fluids[j]; target.writeInt(i); } @@ -279,12 +241,10 @@ public enum PacketHandler } @Override - public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BAMessage msg) - { + public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BAMessage msg) { int index = dat.readInt(); - switch (index) - { + switch (index) { case 0: ((TilePortableAltarMessage) msg).x = dat.readInt(); ((TilePortableAltarMessage) msg).y = dat.readInt(); @@ -293,12 +253,10 @@ public enum PacketHandler ((TilePortableAltarMessage) msg).items = new int[TilePortableAltar.sizeInv * 3]; - if (hasStacks) - { + if (hasStacks) { ((TilePortableAltarMessage) msg).items = new int[TilePortableAltar.sizeInv * 3]; - for (int i = 0; i < ((TilePortableAltarMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TilePortableAltarMessage) msg).items.length; i++) { ((TilePortableAltarMessage) msg).items[i] = dat.readInt(); } } @@ -306,10 +264,8 @@ public enum PacketHandler boolean hasFluids = dat.readBoolean(); ((TilePortableAltarMessage) msg).fluids = new int[6]; - if (hasFluids) - { - for (int i = 0; i < ((TilePortableAltarMessage) msg).fluids.length; i++) - { + if (hasFluids) { + for (int i = 0; i < ((TilePortableAltarMessage) msg).fluids.length; i++) { ((TilePortableAltarMessage) msg).fluids[i] = dat.readInt(); } } @@ -326,12 +282,10 @@ public enum PacketHandler ((TileLifeInfuserMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; - if (hasStacks2) - { + if (hasStacks2) { ((TileLifeInfuserMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; - for (int i = 0; i < ((TileLifeInfuserMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TileLifeInfuserMessage) msg).items.length; i++) { ((TileLifeInfuserMessage) msg).items[i] = dat.readInt(); } } @@ -339,10 +293,8 @@ public enum PacketHandler boolean hasFluids2 = dat.readBoolean(); ((TileLifeInfuserMessage) msg).fluids = new int[4]; - if (hasFluids2) - { - for (int i = 0; i < ((TileLifeInfuserMessage) msg).fluids.length; i++) - { + if (hasFluids2) { + for (int i = 0; i < ((TileLifeInfuserMessage) msg).fluids.length; i++) { ((TileLifeInfuserMessage) msg).fluids[i] = dat.readInt(); } } @@ -359,12 +311,10 @@ public enum PacketHandler ((TileLPMaterializerMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; - if (hasStacks3) - { + if (hasStacks3) { ((TileLPMaterializerMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; - for (int i = 0; i < ((TileLPMaterializerMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TileLPMaterializerMessage) msg).items.length; i++) { ((TileLPMaterializerMessage) msg).items[i] = dat.readInt(); } } @@ -372,10 +322,8 @@ public enum PacketHandler boolean hasFluids3 = dat.readBoolean(); ((TileLPMaterializerMessage) msg).fluids = new int[4]; - if (hasFluids3) - { - for (int i = 0; i < ((TileLPMaterializerMessage) msg).fluids.length; i++) - { + if (hasFluids3) { + for (int i = 0; i < ((TileLPMaterializerMessage) msg).fluids.length; i++) { ((TileLPMaterializerMessage) msg).fluids[i] = dat.readInt(); } } @@ -387,8 +335,7 @@ public enum PacketHandler } } - public static Packet getPacket(TilePortableAltar tile) - { + public static Packet getPacket(TilePortableAltar tile) { TilePortableAltarMessage msg = new TilePortableAltarMessage(); msg.index = 0; msg.x = tile.xCoord; @@ -401,8 +348,7 @@ public enum PacketHandler return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); } - public static Packet getPacket(TileLifeInfuser tile) - { + public static Packet getPacket(TileLifeInfuser tile) { TileLifeInfuserMessage msg = new TileLifeInfuserMessage(); msg.index = 1; msg.x = tile.xCoord; @@ -415,8 +361,7 @@ public enum PacketHandler return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); } - public static Packet getPacket(TileLPMaterializer tile) - { + public static Packet getPacket(TileLPMaterializer tile) { TileLPMaterializerMessage msg = new TileLPMaterializerMessage(); msg.index = 2; msg.x = tile.xCoord; @@ -429,29 +374,46 @@ public enum PacketHandler return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); } - public void sendTo(Packet message, EntityPlayerMP player) - { - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); + public void sendTo(Packet message, EntityPlayerMP player) { + this.channels + .get(Side.SERVER) + .attr(FMLOutboundHandler.FML_MESSAGETARGET) + .set(FMLOutboundHandler.OutboundTarget.PLAYER); + this.channels + .get(Side.SERVER) + .attr(FMLOutboundHandler.FML_MESSAGETARGETARGS) + .set(player); this.channels.get(Side.SERVER).writeAndFlush(message); } - public void sendToAll(Packet message) - { - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); + public void sendToAll(Packet message) { + this.channels + .get(Side.SERVER) + .attr(FMLOutboundHandler.FML_MESSAGETARGET) + .set(FMLOutboundHandler.OutboundTarget.ALL); this.channels.get(Side.SERVER).writeAndFlush(message); } - public void sendToAllAround(Packet message, NetworkRegistry.TargetPoint point) - { - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); - this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); + public void sendToAllAround(Packet message, NetworkRegistry.TargetPoint point) { + this.channels + .get(Side.SERVER) + .attr(FMLOutboundHandler.FML_MESSAGETARGET) + .set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); + this.channels + .get(Side.SERVER) + .attr(FMLOutboundHandler.FML_MESSAGETARGETARGS) + .set(point); this.channels.get(Side.SERVER).writeAndFlush(message); } - public void sendToServer(Packet message) - { - this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); - this.channels.get(Side.CLIENT).writeAndFlush(message).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); + public void sendToServer(Packet message) { + this.channels + .get(Side.CLIENT) + .attr(FMLOutboundHandler.FML_MESSAGETARGET) + .set(FMLOutboundHandler.OutboundTarget.TOSERVER); + this.channels + .get(Side.CLIENT) + .writeAndFlush(message) + .addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompactedMRS.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompactedMRS.java index 982e409..bb5c5f2 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompactedMRS.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompactedMRS.java @@ -11,6 +11,8 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import cpw.mods.fml.common.eventhandler.Event; +import java.util.HashMap; +import java.util.Map; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -26,11 +28,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; -import java.util.Map; - -public class TileCompactedMRS extends TEMasterStone implements IMasterRitualStone -{ +public class TileCompactedMRS extends TEMasterStone implements IMasterRitualStone { private boolean isActive; private String owner; private String varString1; @@ -48,9 +46,10 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton protected ReagentContainer[] tanks; protected Map attunedTankMap; - public TileCompactedMRS() - { - tanks = new ReagentContainer[]{new ReagentContainer(1000), new ReagentContainer(1000), new ReagentContainer(1000)}; + public TileCompactedMRS() { + tanks = new ReagentContainer[] { + new ReagentContainer(1000), new ReagentContainer(1000), new ReagentContainer(1000) + }; this.attunedTankMap = new HashMap(); isActive = false; @@ -66,19 +65,16 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton this.customRitualTag = new NBTTagCompound(); } - public void readNBTOnPlace(NBTTagCompound tag) - { + public void readNBTOnPlace(NBTTagCompound tag) { ritualName = tag.getString("ritualName"); } - public void writeNBTOnHarvest(NBTTagCompound tag) - { + public void writeNBTOnHarvest(NBTTagCompound tag) { tag.setString("ritualName", ritualName); } @Override - public void readClientNBT(NBTTagCompound tag) - { + public void readClientNBT(NBTTagCompound tag) { ritualName = tag.getString("ritualName"); isRunning = tag.getBoolean("isRunning"); runningTime = tag.getInteger("runningTime"); @@ -88,27 +84,23 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton int size = tagList.tagCount(); this.tanks = new ReagentContainer[size]; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { NBTTagCompound savedTag = tagList.getCompoundTagAt(i); this.tanks[i] = ReagentContainer.readFromNBT(savedTag); } } @Override - public void writeClientNBT(NBTTagCompound tag) - { + public void writeClientNBT(NBTTagCompound tag) { tag.setString("ritualName", ritualName); tag.setBoolean("isRunning", isRunning); tag.setInteger("runningTime", runningTime); NBTTagList tagList = new NBTTagList(); - for (int i = 0; i < this.tanks.length; i++) - { + for (int i = 0; i < this.tanks.length; i++) { NBTTagCompound savedTag = new NBTTagCompound(); - if (this.tanks[i] != null) - { + if (this.tanks[i] != null) { this.tanks[i].writeToNBT(savedTag); } tagList.appendTag(savedTag); @@ -118,8 +110,7 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); isActive = tag.getBoolean("isActive"); owner = tag.getString("owner"); @@ -135,16 +126,14 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton int size = tagList.tagCount(); this.tanks = new ReagentContainer[size]; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { NBTTagCompound savedTag = tagList.getCompoundTagAt(i); this.tanks[i] = ReagentContainer.readFromNBT(savedTag); } NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < attunedTagList.tagCount(); i++) - { + for (int i = 0; i < attunedTagList.tagCount(); i++) { NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i); Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent")); this.attunedTankMap.put(reagent, savedTag.getInteger("amount")); @@ -156,8 +145,7 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton NBTTagCompound localStorageTag = tag.getCompoundTag("localStorage"); - if (newStorage != null) - { + if (newStorage != null) { newStorage.readFromNBT(localStorageTag); storage = newStorage; storage.xCoord = xCoord; @@ -167,8 +155,7 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setBoolean("isActive", isActive); tag.setString("owner", owner); @@ -181,11 +168,9 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton NBTTagList tagList = new NBTTagList(); - for (int i = 0; i < this.tanks.length; i++) - { + for (int i = 0; i < this.tanks.length; i++) { NBTTagCompound savedTag = new NBTTagCompound(); - if (this.tanks[i] != null) - { + if (this.tanks[i] != null) { this.tanks[i].writeToNBT(savedTag); } tagList.appendTag(savedTag); @@ -195,8 +180,7 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton NBTTagList attunedTagList = new NBTTagList(); - for (Map.Entry entry : this.attunedTankMap.entrySet()) - { + for (Map.Entry entry : this.attunedTankMap.entrySet()) { NBTTagCompound savedTag = new NBTTagCompound(); savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey())); savedTag.setInteger("amount", entry.getValue()); @@ -207,30 +191,28 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton tag.setTag("customRitualTag", customRitualTag); - if (storage != null) - { + if (storage != null) { NBTTagCompound localStorageTag = new NBTTagCompound(); storage.writeToNBT(localStorageTag); tag.setTag("localStorage", localStorageTag); } - } @Override - public void activateRitual(World world, int crystalLevel, ItemStack activationCrystal, EntityPlayer player, String crystalOwner) - { - if (world.isRemote) - { + public void activateRitual( + World world, int crystalLevel, ItemStack activationCrystal, EntityPlayer player, String crystalOwner) { + if (world.isRemote) { return; } - //TODO - RitualActivatedEvent event = new RitualActivatedEvent(this, crystalOwner, ritualName, player, activationCrystal, crystalLevel); + // TODO + RitualActivatedEvent event = + new RitualActivatedEvent(this, crystalOwner, ritualName, player, activationCrystal, crystalLevel); - if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.somethingstoppedyou"))); + if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) { + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.masterstone.somethingstoppedyou"))); return; } @@ -241,54 +223,59 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton boolean testLevel = Rituals.canCrystalActivate(eventRitualKey, eventCrystalTier); - if (!testLevel) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.crystalvibrates"))); + if (!testLevel) { + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.masterstone.crystalvibrates"))); return; } int currentEssence = SoulNetworkHandler.getCurrentEssence(eventOwnerKey); - if (currentEssence < Rituals.getCostForActivation(ritualName)) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.youfeelapull"))); + if (currentEssence < Rituals.getCostForActivation(ritualName)) { + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.masterstone.youfeelapull"))); return; } - if (!world.isRemote) - { - if (!Rituals.startRitual(this, ritualName, player)) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.ritualresistyou"))); + if (!world.isRemote) { + if (!Rituals.startRitual(this, ritualName, player)) { + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.masterstone.ritualresistyou"))); return; - } - else - { - int drain = SoulNetworkHandler.syphonFromNetwork(eventOwnerKey, Rituals.getCostForActivation(ritualName)); + } else { + int drain = + SoulNetworkHandler.syphonFromNetwork(eventOwnerKey, Rituals.getCostForActivation(ritualName)); - if (drain > 0) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.energyflows"))); + if (drain > 0) { + player.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.masterstone.energyflows"))); - for (int i = 0; i < 12; i++) - { - SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + for (int i = 0; i < 12; i++) { + SpellHelper.sendIndexedParticleToAllAround( + world, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 1, + xCoord, + yCoord, + zCoord); } - } - else - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.masterstone.somethingstoppedyou"))); + } else { + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.masterstone.somethingstoppedyou"))); return; } } } - if (!ritualName.equals("")) - { + if (!ritualName.equals("")) { Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.ACTIVATE); } @@ -304,69 +291,55 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public void setOwner(String owner) - { + public void setOwner(String owner) { this.owner = owner; } @Override - public void useOnRitualBroken() - { + public void useOnRitualBroken() { Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.BREAK_MRS); } @Override - public void useOnRitualBrokenExplosion() - { + public void useOnRitualBrokenExplosion() { Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.EXPLOSION); } @Override - public void updateEntity() - { - if (isRunning && runningTime < 100) - { + public void updateEntity() { + if (isRunning && runningTime < 100) { runningTime++; - } - else if (!isRunning && runningTime > 0) - { + } else if (!isRunning && runningTime > 0) { runningTime--; } - if (!isActive) - { + if (!isActive) { return; } int worldTime = (int) (worldObj.getWorldTime() % 24000); - if (worldObj.isRemote) - { + if (worldObj.isRemote) { return; } - if (worldTime % 100 == 0) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + if (worldTime % 100 == 0) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0) - { - if (isRunning) - { + if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0) { + if (isRunning) { Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.REDSTONE); isRunning = false; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } return; - } - else - { - if (!isRunning) - { + } else { + if (!isRunning) { isRunning = true; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -376,44 +349,37 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public void performRitual(World world, int x, int y, int z, String currentRitualString) - { + public void performRitual(World world, int x, int y, int z, String currentRitualString) { Rituals.performEffect(this, ritualName); } @Override - public String getOwner() - { + public String getOwner() { return owner; } @Override - public void setCooldown(int newCooldown) - { + public void setCooldown(int newCooldown) { this.cooldown = newCooldown; } @Override - public int getCooldown() - { + public int getCooldown() { return this.cooldown; } @Override - public void setVar1(int newVar1) - { + public void setVar1(int newVar1) { this.var1 = newVar1; } @Override - public int getVar1() - { + public int getVar1() { return this.var1; } @Override - public void setActive(boolean active) - { + public void setActive(boolean active) { Rituals.onRitualBroken(this, ritualName, RitualBreakMethod.DEACTIVATE); this.isActive = active; this.isRunning = active; @@ -421,70 +387,65 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public int getDirection() - { + public int getDirection() { return this.direction; } @Override - public World getWorld() - { + public World getWorld() { return this.getWorldObj(); } @Override - public int getXCoord() - { + public int getXCoord() { return xCoord; } @Override - public int getYCoord() - { + public int getYCoord() { return yCoord; } @Override - public int getZCoord() - { + public int getZCoord() { return zCoord; } @Override - public String getCurrentRitual() - { + public String getCurrentRitual() { return ritualName; } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeClientNBT(nbttagcompound); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); } @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) - { + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet); readClientNBT(packet.func_148857_g()); } @Override - public AxisAlignedBB getRenderBoundingBox() - { + public AxisAlignedBB getRenderBoundingBox() { double renderExtention = 1.0d; - AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(xCoord - renderExtention, yCoord - renderExtention, zCoord - renderExtention, xCoord + 1 + renderExtention, yCoord + 1 + renderExtention, zCoord + 1 + renderExtention); + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( + xCoord - renderExtention, + yCoord - renderExtention, + zCoord - renderExtention, + xCoord + 1 + renderExtention, + yCoord + 1 + renderExtention, + zCoord + 1 + renderExtention); return bb; } /* ISegmentedReagentHandler */ @Override - public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) - { - if (doFill) - { + public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) { + if (doFill) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -492,60 +453,50 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton boolean useTankLimit = !this.attunedTankMap.isEmpty(); - if (resource != null) - { + if (resource != null) { int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length; int tanksFilled = 0; int maxFill = resource.amount; - for (int i = this.tanks.length - 1; i >= 0; i--) - { + for (int i = this.tanks.length - 1; i >= 0; i--) { ReagentStack remainingStack = resource.copy(); remainingStack.amount = maxFill - totalFill; - boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack); + boolean doesReagentMatch = tanks[i].getReagent() == null + ? false + : tanks[i].getReagent().isReagentEqual(remainingStack); - if (doesReagentMatch) - { + if (doesReagentMatch) { totalFill += tanks[i].fill(remainingStack, doFill); tanksFilled++; - } - else - { + } else { continue; } - if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) - { + if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) { return totalFill; } } - if (tanksFilled >= totalTanksFillable) - { + if (tanksFilled >= totalTanksFillable) { return totalFill; } - for (int i = this.tanks.length - 1; i >= 0; i--) - { + for (int i = this.tanks.length - 1; i >= 0; i--) { ReagentStack remainingStack = resource.copy(); remainingStack.amount = maxFill - totalFill; boolean isTankEmpty = tanks[i].getReagent() == null; - if (isTankEmpty) - { + if (isTankEmpty) { totalFill += tanks[i].fill(remainingStack, doFill); tanksFilled++; - } - else - { + } else { continue; } - if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) - { + if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) { return totalFill; } } @@ -554,15 +505,12 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) - { - if (resource == null) - { + public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) { + if (resource == null) { return null; } - if (doDrain) - { + if (doDrain) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -570,18 +518,14 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton Reagent reagent = resource.reagent; int drained = 0; - for (int i = 0; i < tanks.length; i++) - { - if (drained >= maxDrain) - { + for (int i = 0; i < tanks.length; i++) { + if (drained >= maxDrain) { break; } - if (resource.isReagentEqual(tanks[i].getReagent())) - { + if (resource.isReagentEqual(tanks[i].getReagent())) { ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain); - if (drainStack != null) - { + if (drainStack != null) { drained += drainStack.amount; } } @@ -592,15 +536,11 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton /* Only returns the amount from the first available tank */ @Override - public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - for (int i = 0; i < tanks.length; i++) - { + public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + for (int i = 0; i < tanks.length; i++) { ReagentStack stack = tanks[i].drain(maxDrain, doDrain); - if (stack != null) - { - if (doDrain) - { + if (stack != null) { + if (doDrain) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -612,49 +552,40 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public boolean canFill(ForgeDirection from, Reagent reagent) - { + public boolean canFill(ForgeDirection from, Reagent reagent) { return true; } @Override - public boolean canDrain(ForgeDirection from, Reagent reagent) - { + public boolean canDrain(ForgeDirection from, Reagent reagent) { return true; } @Override - public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) - { + public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) { ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()]; - for (int i = 0; i < this.getNumberOfTanks(); i++) - { + for (int i = 0; i < this.getNumberOfTanks(); i++) { info[i] = tanks[i].getInfo(); } return info; } @Override - public int getNumberOfTanks() - { + public int getNumberOfTanks() { return tanks.length; } @Override - public int getTanksTunedToReagent(Reagent reagent) - { - if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null) - { + public int getTanksTunedToReagent(Reagent reagent) { + if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null) { return this.attunedTankMap.get(reagent); } return 0; } @Override - public void setTanksTunedToReagent(Reagent reagent, int total) - { - if (total == 0 && this.attunedTankMap.containsKey(reagent)) - { + public void setTanksTunedToReagent(Reagent reagent, int total) { + if (total == 0 && this.attunedTankMap.containsKey(reagent)) { this.attunedTankMap.remove(reagent); return; } @@ -663,18 +594,14 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public Map getAttunedTankMap() - { + public Map getAttunedTankMap() { return this.attunedTankMap; } @Override - public boolean areTanksEmpty() - { - for (int i = 0; i < this.tanks.length; i++) - { - if (tanks[i] != null && tanks[i].getReagent() != null) - { + public boolean areTanksEmpty() { + for (int i = 0; i < this.tanks.length; i++) { + if (tanks[i] != null && tanks[i].getReagent() != null) { return false; } } @@ -683,37 +610,31 @@ public class TileCompactedMRS extends TEMasterStone implements IMasterRitualSton } @Override - public NBTTagCompound getCustomRitualTag() - { + public NBTTagCompound getCustomRitualTag() { return this.customRitualTag; } @Override - public void setCustomRitualTag(NBTTagCompound tag) - { + public void setCustomRitualTag(NBTTagCompound tag) { this.customRitualTag = tag; } @Override - public int getRunningTime() - { + public int getRunningTime() { return this.runningTime; } @Override - public LocalRitualStorage getLocalStorage() - { + public LocalRitualStorage getLocalStorage() { return storage; } @Override - public void setLocalStorage(LocalRitualStorage storage) - { + public void setLocalStorage(LocalRitualStorage storage) { this.storage = storage; } - public void setRitualName(String ritualName) - { + public void setRitualName(String ritualName) { this.ritualName = ritualName; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompacter.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompacter.java index 3acd085..b3f5597 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompacter.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileCompacter.java @@ -2,10 +2,6 @@ package com.arc.bloodarsenal.common.tileentity; import net.minecraft.tileentity.TileEntity; -public class TileCompacter extends TileEntity -{ - public TileCompacter() - { - - } +public class TileCompacter extends TileEntity { + public TileCompacter() {} } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLPMaterializer.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLPMaterializer.java index 05d197e..28d883b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLPMaterializer.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLPMaterializer.java @@ -18,8 +18,7 @@ import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -public class TileLPMaterializer extends TileEntity implements IInventory, IFluidTank, IFluidHandler -{ +public class TileLPMaterializer extends TileEntity implements IInventory, IFluidTank, IFluidHandler { private ItemStack[] inv; protected FluidStack fluid; @@ -29,8 +28,7 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid private int bufferCapacity; - public TileLPMaterializer() - { + public TileLPMaterializer() { this.inv = new ItemStack[1]; fluid = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); fluidOutput = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); @@ -40,35 +38,30 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - { + if (slot >= 0 && slot < inv.length) { inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } - if (!par1NBTTagCompound.hasKey("Empty")) - { + if (!par1NBTTagCompound.hasKey("Empty")) { FluidStack fluid = this.fluid.loadFluidStackFromNBT(par1NBTTagCompound); - if (fluid != null) - { + if (fluid != null) { setMainFluid(fluid); } - FluidStack fluidOut = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("outputAmount")); + FluidStack fluidOut = + new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("outputAmount")); - if (fluidOut != null) - { + if (fluidOut != null) { setOutputFluid(fluidOut); } } @@ -81,15 +74,12 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); NBTTagList itemList = new NBTTagList(); - for (int i = 0; i < inv.length; i++) - { - if (inv[i] != null) - { + for (int i = 0; i < inv.length; i++) { + if (inv[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); inv[i].writeToNBT(tag); @@ -97,17 +87,13 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } } - if (fluid != null) - { + if (fluid != null) { fluid.writeToNBT(par1NBTTagCompound); - } - else - { + } else { par1NBTTagCompound.setString("Empty", ""); } - if (fluidOutput != null) - { + if (fluidOutput != null) { par1NBTTagCompound.setInteger("outputAmount", fluidOutput.amount); } @@ -119,24 +105,20 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid writeCustomNBT(par1NBTTagCompound); } - public void readCustomNBT(NBTTagCompound par1NBTTagCompound) - { + public void readCustomNBT(NBTTagCompound par1NBTTagCompound) { NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); - if (nbttaglist.tagCount() > 0) - { + if (nbttaglist.tagCount() > 0) { NBTTagCompound tagList = nbttaglist.getCompoundTagAt(0); inv[0] = ItemStack.loadItemStackFromNBT(tagList); } } - public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) { NBTTagList nbttaglist = new NBTTagList(); NBTTagCompound tagList = new NBTTagCompound(); - if (inv[0] != null) - { + if (inv[0] != null) { tagList.setByte("Slot", (byte) 0); inv[0].writeToNBT(tagList); nbttaglist.appendTag(tagList); @@ -145,34 +127,26 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public int getSizeInventory() - { + public int getSizeInventory() { return 1; } @Override - public ItemStack getStackInSlot(int slot) - { + public ItemStack getStackInSlot(int slot) { return inv[slot]; } @Override - public ItemStack decrStackSize(int slot, int amt) - { + public ItemStack decrStackSize(int slot, int amt) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { - if (stack.stackSize <= amt) - { + if (stack != null) { + if (stack.stackSize <= amt) { setInventorySlotContents(slot, null); - } - else - { + } else { stack = stack.splitStack(amt); - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { setInventorySlotContents(slot, null); } } @@ -182,12 +156,10 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public ItemStack getStackInSlotOnClosing(int slot) - { + public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { + if (stack != null) { setInventorySlotContents(slot, null); } @@ -195,38 +167,33 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public void setInventorySlotContents(int slot, ItemStack itemStack) - { + public void setInventorySlotContents(int slot, ItemStack itemStack) { inv[slot] = itemStack; - if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { + if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { itemStack.stackSize = getInventoryStackLimit(); } } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TileLPMaterializer"; } @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return false; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } @Override - public boolean isUseableByPlayer(EntityPlayer entityPlayer) - { - return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; + public boolean isUseableByPlayer(EntityPlayer entityPlayer) { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this + && entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; } @Override @@ -236,40 +203,32 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid public void closeInventory() {} @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 0; } - public void sendChatInfoToPlayer(EntityPlayer player) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.tile.contains") + " " + this.getFluidAmount() + "LE")); + public void sendChatInfoToPlayer(EntityPlayer player) { + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.tile.contains") + " " + this.getFluidAmount() + "LE")); } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return PacketHandler.getPacket(this); } - public void handlePacketData(int[] intData, int[] fluidData, int capacity) - { - if (intData == null) - { + public void handlePacketData(int[] intData, int[] fluidData, int capacity) { + if (intData == null) { return; } - if (intData.length == 3) - { - for (int i = 0; i < 1; i++) - { - if (intData[i * 3 + 2] != 0) - { - ItemStack is = new ItemStack(Item.getItemById(intData[i * 3]), intData[i * 3 + 2], intData[i * 3 + 1]); + if (intData.length == 3) { + for (int i = 0; i < 1; i++) { + if (intData[i * 3 + 2] != 0) { + ItemStack is = + new ItemStack(Item.getItemById(intData[i * 3]), intData[i * 3 + 2], intData[i * 3 + 1]); inv[i] = is; - } - else - { + } else { inv[i] = null; } } @@ -284,23 +243,18 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid this.capacity = capacity; } - public int[] buildIntDataList() - { - int[] sortList = new int[3];//3 ints per stack (1 * 3) + public int[] buildIntDataList() { + int[] sortList = new int[3]; // 3 ints per stack (1 * 3) int pos; - for (ItemStack is : inv) - { + for (ItemStack is : inv) { pos = 0; - if (is != null) - { + if (is != null) { sortList[pos++] = Item.getIdFromItem(is.getItem()); sortList[pos++] = is.getItemDamage(); sortList[pos++] = is.stackSize; - } - else - { + } else { sortList[pos++] = 0; sortList[pos++] = 0; sortList[pos++] = 0; @@ -310,46 +264,37 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid return sortList; } - //Actual Stuffs + // Actual Stuffs @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); - if (getTankAbove() != null) - { + if (getTankAbove() != null) { IFluidHandler aboveTank = getTankAbove(); - if (aboveTank.canFill(ForgeDirection.DOWN, fluid.getFluid())) - { + if (aboveTank.canFill(ForgeDirection.DOWN, fluid.getFluid())) { aboveTank.fill(ForgeDirection.DOWN, fluidOutput, true); drain(ForgeDirection.UP, fluidOutput, true); } } - if (getTankBelow() != null) - { + if (getTankBelow() != null) { IFluidHandler belowTank = getTankBelow(); - if (belowTank.canFill(ForgeDirection.UP, fluid.getFluid())) - { + if (belowTank.canFill(ForgeDirection.UP, fluid.getFluid())) { belowTank.fill(ForgeDirection.UP, fluidOutput, true); drain(ForgeDirection.DOWN, fluidOutput, true); } } - if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) - { + if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { materialize(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - else - { + } else { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - if (worldObj.getWorldTime() % 10 == 0) - { + if (worldObj.getWorldTime() % 10 == 0) { int syphonMax = 500; int fluidOutputted; fluidOutputted = Math.min(syphonMax, this.bufferCapacity - this.fluidOutput.amount); @@ -358,76 +303,69 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid this.fluid.amount -= fluidOutputted; } - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } - public void materialize() - { + public void materialize() { ItemStack orb = this.getStackInSlot(0); - if (orb == null) - { + if (orb == null) { return; } - if (fluid.amount <= capacity - 100) - { - if (!SoulNetworkHandler.canSyphonFromOnlyNetwork(orb, BloodArsenalConfig.lpMaterializerCost)) - { + if (fluid.amount <= capacity - 100) { + if (!SoulNetworkHandler.canSyphonFromOnlyNetwork(orb, BloodArsenalConfig.lpMaterializerCost)) { SoulNetworkHandler.causeNauseaToPlayer(orb); return; } - if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(orb, BloodArsenalConfig.lpMaterializerCost)) - { + if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(orb, BloodArsenalConfig.lpMaterializerCost)) { return; } - if (worldObj.getWorldTime() % 4 == 0) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + if (worldObj.getWorldTime() % 4 == 0) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); } fluid.amount += 100; } } - private IFluidHandler getTankAbove() - { - return worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) != null && worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) instanceof IFluidHandler ? (IFluidHandler) worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) : null; + private IFluidHandler getTankAbove() { + return worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) != null + && worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) instanceof IFluidHandler + ? (IFluidHandler) worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) + : null; } - private IFluidHandler getTankBelow() - { - return worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) != null && worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) instanceof IFluidHandler ? (IFluidHandler) worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) : null; + private IFluidHandler getTankBelow() { + return worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) != null + && worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) instanceof IFluidHandler + ? (IFluidHandler) worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) + : null; } - //Fluid Stuffs + // Fluid Stuffs @Override - public int fill(FluidStack resource, boolean doFill) - { + public int fill(FluidStack resource, boolean doFill) { return 0; } @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { return 0; } @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - if (resource == null) - { + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null) { return null; } - if (!resource.isFluidEqual(fluidOutput)) - { + if (!resource.isFluidEqual(fluidOutput)) { return null; } @@ -435,44 +373,37 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public FluidStack drain(int maxDrain, boolean doDrain) - { - if (fluidOutput == null) - { + public FluidStack drain(int maxDrain, boolean doDrain) { + if (fluidOutput == null) { return null; } int drained = maxDrain; - if (fluidOutput.amount < drained) - { + if (fluidOutput.amount < drained) { drained = fluidOutput.amount; } FluidStack stack = new FluidStack(fluidOutput, drained); - if (doDrain) - { + if (doDrain) { fluidOutput.amount -= drained; - if (fluidOutput.amount <= 0) - { + if (fluidOutput.amount <= 0) { fluidOutput = null; } - if (this != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this, 1000)); + if (this != null) { + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent( + fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this, 1000)); } } - if (fluidOutput == null) - { + if (fluidOutput == null) { fluidOutput = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); } - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -480,44 +411,36 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public boolean canFill(ForgeDirection from, Fluid fluid) - { + public boolean canFill(ForgeDirection from, Fluid fluid) { return false; } @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) - { + public boolean canDrain(ForgeDirection from, Fluid fluid) { return this.fluidOutput != null && this.fluid.getFluid().equals(fluidOutput.getFluid()); } @Override - public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) - { + public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) { return this.drain(maxEmpty, doDrain); } - - public void setMainFluid(FluidStack fluid) - { + + public void setMainFluid(FluidStack fluid) { this.fluid = fluid; } - public void setOutputFluid(FluidStack fluid) - { + public void setOutputFluid(FluidStack fluid) { this.fluidOutput = fluid; } @Override - public FluidStack getFluid() - { + public FluidStack getFluid() { return fluid; } @Override - public int getFluidAmount() - { - if (fluid == null) - { + public int getFluidAmount() { + if (fluid == null) { return 0; } @@ -525,47 +448,37 @@ public class TileLPMaterializer extends TileEntity implements IInventory, IFluid } @Override - public int getCapacity() - { + public int getCapacity() { return capacity; } @Override - public FluidTankInfo getInfo() - { + public FluidTankInfo getInfo() { return new FluidTankInfo(this); } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { + public FluidTankInfo[] getTankInfo(ForgeDirection from) { FluidTank compositeTank = new FluidTank(capacity); compositeTank.setFluid(fluid); - return new FluidTankInfo[]{compositeTank.getInfo()}; + return new FluidTankInfo[] {compositeTank.getInfo()}; } - public int[] buildFluidList() - { + public int[] buildFluidList() { int[] sortList = new int[4]; - if (this.fluid == null) - { + if (this.fluid == null) { sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID(); sortList[1] = 0; - } - else - { + } else { sortList[0] = this.fluid.getFluid().getID(); sortList[1] = this.fluid.amount; } - if (this.fluidOutput == null) - { + if (this.fluidOutput == null) { sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID(); sortList[3] = 0; - } - else - { + } else { sortList[2] = this.fluidOutput.getFluid().getID(); sortList[3] = this.fluidOutput.amount; } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLifeInfuser.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLifeInfuser.java index c2b9e1c..9296e25 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLifeInfuser.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/TileLifeInfuser.java @@ -17,8 +17,7 @@ import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTank, IFluidHandler -{ +public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTank, IFluidHandler { private ItemStack[] inv; public static final int sizeInv = 1; public int ticksExisted = 0; @@ -35,8 +34,7 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan public FluidTank[] tanks = {new FluidTankRestricted(FluidContainerRegistry.BUCKET_VOLUME * 20, "Life Essence")}; - public TileLifeInfuser() - { + public TileLifeInfuser() { this.inv = new ItemStack[1]; fluid = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); fluidInput = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); @@ -46,35 +44,30 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - { + if (slot >= 0 && slot < inv.length) { inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } - if (!par1NBTTagCompound.hasKey("Empty")) - { + if (!par1NBTTagCompound.hasKey("Empty")) { FluidStack fluid = this.fluid.loadFluidStackFromNBT(par1NBTTagCompound); - if (fluid != null) - { + if (fluid != null) { setMainFluid(fluid); } - FluidStack fluidIn = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("inputAmount")); + FluidStack fluidIn = + new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("inputAmount")); - if (fluidIn != null) - { + if (fluidIn != null) { setInputFluid(fluidIn); } } @@ -85,15 +78,12 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); NBTTagList itemList = new NBTTagList(); - for (int i = 0; i < inv.length; i++) - { - if (inv[i] != null) - { + for (int i = 0; i < inv.length; i++) { + if (inv[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); inv[i].writeToNBT(tag); @@ -103,17 +93,13 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan par1NBTTagCompound.setTag("Inventory", itemList); - if (fluid != null) - { + if (fluid != null) { fluid.writeToNBT(par1NBTTagCompound); - } - else - { + } else { par1NBTTagCompound.setString("Empty", ""); } - if (fluidInput != null) - { + if (fluidInput != null) { par1NBTTagCompound.setInteger("inputAmount", fluidInput.amount); } @@ -124,34 +110,26 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } @Override - public int getSizeInventory() - { + public int getSizeInventory() { return 1; } @Override - public ItemStack getStackInSlot(int slot) - { + public ItemStack getStackInSlot(int slot) { return inv[slot]; } @Override - public ItemStack decrStackSize(int slot, int amt) - { + public ItemStack decrStackSize(int slot, int amt) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { - if (stack.stackSize <= amt) - { + if (stack != null) { + if (stack.stackSize <= amt) { setInventorySlotContents(slot, null); - } - else - { + } else { stack = stack.splitStack(amt); - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { setInventorySlotContents(slot, null); } } @@ -161,12 +139,10 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } @Override - public ItemStack getStackInSlotOnClosing(int slot) - { + public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { + if (stack != null) { setInventorySlotContents(slot, null); } @@ -174,38 +150,33 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } @Override - public void setInventorySlotContents(int slot, ItemStack itemStack) - { + public void setInventorySlotContents(int slot, ItemStack itemStack) { inv[slot] = itemStack; - if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { + if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { itemStack.stackSize = getInventoryStackLimit(); } } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TileLifeInfuser"; } @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return false; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } @Override - public boolean isUseableByPlayer(EntityPlayer entityPlayer) - { - return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; + public boolean isUseableByPlayer(EntityPlayer entityPlayer) { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this + && entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; } @Override @@ -214,7 +185,7 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan @Override public void closeInventory() {} - //Logic for the actual block is under here + // Logic for the actual block is under here @Override public void updateEntity() { super.updateEntity(); @@ -235,12 +206,25 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan IFillable fillable = (IFillable) inputStack.getItem(); int fillAmount = 200; - if (fillable.getLPStored(inputStack) < fillable.getMaxLP() && !(fillable.getLPStored(inputStack) + fillAmount > fillable.getMaxLP()) && getFluidAmount() >= fillAmount) { + if (fillable.getLPStored(inputStack) < fillable.getMaxLP() + && !(fillable.getLPStored(inputStack) + fillAmount > fillable.getMaxLP()) + && getFluidAmount() >= fillAmount) { fluid.amount = fluid.amount - fillAmount; fillable.incrementLPStored(inputStack, fillAmount); - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + SpellHelper.sendIndexedParticleToAllAround( + worldObj, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 1, + xCoord, + yCoord, + zCoord); } - } else if (inputStack.getItem().isDamageable() && inputStack.getItem().isDamaged(inputStack)) { + } else if (inputStack.getItem().isDamageable() + && inputStack.getItem().isDamaged(inputStack)) { int lpCost = 300; int damage = inputStack.getItemDamage(); @@ -255,8 +239,18 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan markDirty(); if (damageLastTick != 0 && damageLastTick != damage) { - //Insert fancy particles here - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + // Insert fancy particles here + SpellHelper.sendIndexedParticleToAllAround( + worldObj, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 1, + xCoord, + yCoord, + zCoord); tookLastTick = true; } else { tookLastTick = false; @@ -275,47 +269,38 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } @Override - public void markDirty() - { + public void markDirty() { super.markDirty(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 0; } - public void sendChatInfoToPlayer(EntityPlayer player) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.tile.contains") + " " + this.getFluidAmount() + "LE")); + public void sendChatInfoToPlayer(EntityPlayer player) { + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.tile.contains") + " " + this.getFluidAmount() + "LE")); } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return PacketHandler.getPacket(this); } - public void handlePacketData(int[] intData, int[] fluidData, int capacity) - { - if (intData == null) - { + public void handlePacketData(int[] intData, int[] fluidData, int capacity) { + if (intData == null) { return; } - if (intData.length == 3) - { - for (int i = 0; i < 1; i++) - { - if (intData[i * 3 + 2] != 0) - { - ItemStack is = new ItemStack(Item.getItemById(intData[i * 3]), intData[i * 3 + 2], intData[i * 3 + 1]); + if (intData.length == 3) { + for (int i = 0; i < 1; i++) { + if (intData[i * 3 + 2] != 0) { + ItemStack is = + new ItemStack(Item.getItemById(intData[i * 3]), intData[i * 3 + 2], intData[i * 3 + 1]); inv[i] = is; - } - else - { + } else { inv[i] = null; } } @@ -330,23 +315,18 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan this.capacity = capacity; } - public int[] buildIntDataList() - { - int[] sortList = new int[3];//3 ints per stack (1 * 3) + public int[] buildIntDataList() { + int[] sortList = new int[3]; // 3 ints per stack (1 * 3) int pos; - for (ItemStack is : inv) - { + for (ItemStack is : inv) { pos = 0; - if (is != null) - { + if (is != null) { sortList[pos++] = Item.getIdFromItem(is.getItem()); sortList[pos++] = is.getItemDamage(); sortList[pos++] = is.stackSize; - } - else - { + } else { sortList[pos++] = 0; sortList[pos++] = 0; sortList[pos++] = 0; @@ -356,28 +336,24 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan return sortList; } - //Fluid Stuffs - public FluidTank[] getTanks() - { + // Fluid Stuffs + public FluidTank[] getTanks() { return this.tanks; } - public int fillMainTank(int amount) //TODO STUFFS - { + public int fillMainTank(int amount) // TODO STUFFS + { int filledAmount = Math.min(capacity - fluid.amount, amount); fluid.amount += filledAmount; return filledAmount; } - public boolean processInput() - { - for (int i = 0; i < getTanks().length; i++) - { + public boolean processInput() { + for (int i = 0; i < getTanks().length; i++) { int c = fluidAmount(); - if ((c > 0) && (getTanks()[i].getFluidAmount() >= fluidAmount())) - { + if ((c > 0) && (getTanks()[i].getFluidAmount() >= fluidAmount())) { getTanks()[i].drain(fluidAmount(), true); return true; } @@ -385,84 +361,76 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan return false; } - public int fluidAmount() - { + public int fluidAmount() { return fluid.amount; } @Override - public int fill(FluidStack resource, boolean doFill) - { + public int fill(FluidStack resource, boolean doFill) { TileEntity tile = this; - if (resource == null) - { + if (resource == null) { return 0; } - if (resource.getFluid().getID() != (fluidInput).getFluid().getID()) - { + if (resource.getFluid().getID() != (fluidInput).getFluid().getID()) { return 0; } - if (!doFill) - { - if (fluidInput == null) - { + if (!doFill) { + if (fluidInput == null) { return Math.min(bufferCapacity, resource.amount); } - if (!fluidInput.isFluidEqual(resource)) - { + if (!fluidInput.isFluidEqual(resource)) { return 0; } return Math.min(bufferCapacity - fluidInput.amount, resource.amount); } - if (fluidInput == null) - { + if (fluidInput == null) { fluidInput = new FluidStack(resource, resource.amount); - if (tile != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluidInput.amount)); + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent( + fluidInput, + tile.getWorldObj(), + tile.xCoord, + tile.yCoord, + tile.zCoord, + this, + fluidInput.amount)); } return fluidInput.amount; } - if (!fluidInput.isFluidEqual(resource)) - { + if (!fluidInput.isFluidEqual(resource)) { return 0; } int filled = bufferCapacity - fluidInput.amount; - if (resource.amount < filled) - { + if (resource.amount < filled) { fluidInput.amount += resource.amount; filled = resource.amount; - } - else - { + } else { fluidInput.amount = bufferCapacity; } - if (tile != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluidInput.amount)); + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent( + fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluidInput.amount)); } return filled; } @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { - //TODO - if (resource == null) - { + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + // TODO + if (resource == null) { return 0; } @@ -475,101 +443,81 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { return null; } @Override - public FluidStack drain(int maxDrain, boolean doDrain) - { + public FluidStack drain(int maxDrain, boolean doDrain) { return null; } @Override - public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) - { + public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) { return null; } @Override - public boolean canFill(ForgeDirection from, Fluid fluid) - { + public boolean canFill(ForgeDirection from, Fluid fluid) { return this.fluidInput != null && this.fluid.getFluid().equals(fluidInput.getFluid()); } @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) - { + public boolean canDrain(ForgeDirection from, Fluid fluid) { return false; } - public void setMainFluid(FluidStack fluid) - { + public void setMainFluid(FluidStack fluid) { this.fluid = fluid; } - public void setInputFluid(FluidStack fluid) - { + public void setInputFluid(FluidStack fluid) { this.fluidInput = fluid; } - public FluidStack getFluid() - { + public FluidStack getFluid() { return fluid; } - public int getFluidAmount() - { - if (fluid == null) - { + public int getFluidAmount() { + if (fluid == null) { return 0; } return fluid.amount; } - public int getCapacity() - { + public int getCapacity() { return capacity; } @Override - public FluidTankInfo getInfo() - { + public FluidTankInfo getInfo() { return new FluidTankInfo(this); } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { + public FluidTankInfo[] getTankInfo(ForgeDirection from) { FluidTank compositeTank = new FluidTank(capacity); compositeTank.setFluid(fluid); - return new FluidTankInfo[]{compositeTank.getInfo()}; + return new FluidTankInfo[] {compositeTank.getInfo()}; } - public int[] buildFluidList() - { + public int[] buildFluidList() { int[] sortList = new int[4]; - if (this.fluid == null) - { + if (this.fluid == null) { sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID(); sortList[1] = 0; - } - else - { + } else { sortList[0] = this.fluid.getFluid().getID(); sortList[1] = this.fluid.amount; } - if (this.fluidInput == null) - { + if (this.fluidInput == null) { sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID(); sortList[3] = 0; - } - else - { + } else { sortList[2] = this.fluidInput.getFluid().getID(); sortList[3] = this.fluidInput.amount; } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/TilePortableAltar.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/TilePortableAltar.java index a35e90b..648e46a 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/TilePortableAltar.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/TilePortableAltar.java @@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -24,10 +25,7 @@ import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -import java.util.List; - -public class TilePortableAltar extends TileEntity implements IInventory, IFluidTank, IFluidHandler, IBloodAltar -{ +public class TilePortableAltar extends TileEntity implements IInventory, IFluidTank, IFluidHandler, IBloodAltar { public static final int sizeInv = 1; private ItemStack[] inv; private int resultID; @@ -36,7 +34,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT public FluidStack fluid; public int capacity; private boolean isActive; - public int liquidRequired; //mB + public int liquidRequired; // mB private boolean canBeFilled; public int consumptionRate; private int drainRate; @@ -68,8 +66,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT private int lockdownDuration; private int demonBloodDuration; - public TilePortableAltar() - { + public TilePortableAltar() { this.inv = new ItemStack[1]; resultID = 0; resultDamage = 0; @@ -96,36 +93,31 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT * * @return Amount filled */ - public int fillMainTank(int amount) //TODO - { + public int fillMainTank(int amount) // TODO + { int filledAmount = Math.min(capacity - fluid.amount, amount); fluid.amount += filledAmount; return filledAmount; } - public int getRSPowerOutput() - { + public int getRSPowerOutput() { return 5; } - public void addToDemonBloodDuration(int dur) - { + public void addToDemonBloodDuration(int dur) { this.demonBloodDuration++; } - public boolean hasDemonBlood() - { + public boolean hasDemonBlood() { return this.demonBloodDuration > 0; } - public void decrementDemonBlood() - { + public void decrementDemonBlood() { this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1); } - public void readNBTOnPlace(NBTTagCompound tag) - { + public void readNBTOnPlace(NBTTagCompound tag) { fluid.amount = tag.getInteger("currentEssence"); upgradeLevel = tag.getInteger("upgradeLevel"); isActive = tag.getBoolean("isActive"); @@ -151,8 +143,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT cooldownAfterCrafting = tag.getInteger("cooldownAfterCrafting"); } - public void writeNBTOnHarvest(NBTTagCompound tag) - { + public void writeNBTOnHarvest(NBTTagCompound tag) { tag.setInteger("currentEssence", fluid.amount); tag.setInteger("upgradeLevel", upgradeLevel); tag.setBoolean("isActive", isActive); @@ -179,18 +170,15 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - { + if (slot >= 0 && slot < inv.length) { inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } @@ -198,26 +186,24 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT resultID = par1NBTTagCompound.getInteger("resultID"); resultDamage = par1NBTTagCompound.getInteger("resultDamage"); - if (!par1NBTTagCompound.hasKey("Empty")) - { + if (!par1NBTTagCompound.hasKey("Empty")) { FluidStack fluid = this.fluid.loadFluidStackFromNBT(par1NBTTagCompound); - if (fluid != null) - { + if (fluid != null) { setMainFluid(fluid); } - FluidStack fluidOut = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("outputAmount")); + FluidStack fluidOut = + new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("outputAmount")); - if (fluidOut != null) - { + if (fluidOut != null) { setOutputFluid(fluidOut); } - FluidStack fluidIn = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("inputAmount")); + FluidStack fluidIn = + new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("inputAmount")); - if (fluidIn != null) - { + if (fluidIn != null) { setInputFluid(fluidIn); } } @@ -247,31 +233,25 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT cooldownAfterCrafting = par1NBTTagCompound.getInteger("cooldownAfterCrafting"); } - public void setMainFluid(FluidStack fluid) - { + public void setMainFluid(FluidStack fluid) { this.fluid = fluid; } - public void setOutputFluid(FluidStack fluid) - { + public void setOutputFluid(FluidStack fluid) { this.fluidOutput = fluid; } - public void setInputFluid(FluidStack fluid) - { + public void setInputFluid(FluidStack fluid) { this.fluidInput = fluid; } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); NBTTagList itemList = new NBTTagList(); - for (int i = 0; i < inv.length; i++) - { - if (inv[i] != null) - { + for (int i = 0; i < inv.length; i++) { + if (inv[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); inv[i].writeToNBT(tag); @@ -283,22 +263,17 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT par1NBTTagCompound.setInteger("resultDamage", resultDamage); par1NBTTagCompound.setTag("Inventory", itemList); - if (fluid != null) - { + if (fluid != null) { fluid.writeToNBT(par1NBTTagCompound); - } - else - { + } else { par1NBTTagCompound.setString("Empty", ""); } - if (fluidOutput != null) - { + if (fluidOutput != null) { par1NBTTagCompound.setInteger("outputAmount", fluidOutput.amount); } - if (fluidInput != null) - { + if (fluidInput != null) { par1NBTTagCompound.setInteger("inputAmount", fluidInput.amount); } @@ -328,34 +303,26 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public int getSizeInventory() - { + public int getSizeInventory() { return inv.length; } @Override - public ItemStack getStackInSlot(int slot) - { + public ItemStack getStackInSlot(int slot) { return inv[slot]; } @Override - public ItemStack decrStackSize(int slot, int amt) - { + public ItemStack decrStackSize(int slot, int amt) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { - if (stack.stackSize <= amt) - { + if (stack != null) { + if (stack.stackSize <= amt) { setInventorySlotContents(slot, null); - } - else - { + } else { stack = stack.splitStack(amt); - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { setInventorySlotContents(slot, null); } } @@ -365,12 +332,10 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public ItemStack getStackInSlotOnClosing(int slot) - { + public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { + if (stack != null) { setInventorySlotContents(slot, null); } @@ -378,63 +343,51 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public void setInventorySlotContents(int slot, ItemStack itemStack) - { + public void setInventorySlotContents(int slot, ItemStack itemStack) { inv[slot] = itemStack; this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { + if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { itemStack.stackSize = getInventoryStackLimit(); } } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TilePortableAltar"; } @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return false; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 64; } @Override - public boolean isUseableByPlayer(EntityPlayer entityPlayer) - { - return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; + public boolean isUseableByPlayer(EntityPlayer entityPlayer) { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this + && entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; } @Override - public void openInventory() - { - } + public void openInventory() {} @Override - public void closeInventory() - { - } + public void closeInventory() {} - //IFluidTank methods + // IFluidTank methods @Override - public FluidStack getFluid() - { + public FluidStack getFluid() { return fluid; } @Override - public int getFluidAmount() - { - if (fluid == null) - { + public int getFluidAmount() { + if (fluid == null) { return 0; } @@ -442,116 +395,104 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public int getCapacity() - { + public int getCapacity() { return capacity; } - public void setCapacity(int capacity) - { + public void setCapacity(int capacity) { this.capacity = capacity; } @Override - public int getCurrentBlood() - { + public int getCurrentBlood() { return getFluidAmount(); } - public void setCurrentBlood(int amount) - { + public void setCurrentBlood(int amount) { this.fluid.amount = amount; } @Override - public int getTier() - { + public int getTier() { return upgradeLevel; } - public void setTier(int tier) - { + public void setTier(int tier) { this.upgradeLevel = tier; } @Override - public int getProgress() - { + public int getProgress() { return progress; } @Override - public float getSacrificeMultiplier() - { + public float getSacrificeMultiplier() { return sacrificeEfficiencyMultiplier; } - public void setSacrificeMultiplier(float sacrificeMultiplier) - { + public void setSacrificeMultiplier(float sacrificeMultiplier) { this.sacrificeEfficiencyMultiplier = sacrificeMultiplier; } @Override - public float getSelfSacrificeMultiplier() - { + public float getSelfSacrificeMultiplier() { return selfSacrificeEfficiencyMultiplier; } - public void setSelfSacrificeMultiplier(float selfSacrificeMultiplier) - { + public void setSelfSacrificeMultiplier(float selfSacrificeMultiplier) { this.selfSacrificeEfficiencyMultiplier = selfSacrificeMultiplier; } @Override - public float getOrbMultiplier() - { + public float getOrbMultiplier() { return orbCapacityMultiplier; } - public void setOrbMultiplier(float orbMultiplier) - { + public void setOrbMultiplier(float orbMultiplier) { this.orbCapacityMultiplier = orbMultiplier; } @Override - public float getDislocationMultiplier() - { + public float getDislocationMultiplier() { return dislocationMultiplier; } - public void setDislocationMultiplier(float dislocationMultiplier) - { + public void setDislocationMultiplier(float dislocationMultiplier) { this.dislocationMultiplier = dislocationMultiplier; } @Override - public int getBufferCapacity() - { + public int getBufferCapacity() { return bufferCapacity; } - public void setBufferCapacity(int bufferCapacity) - { + public void setBufferCapacity(int bufferCapacity) { this.bufferCapacity = bufferCapacity; } - public void setConsumptionMultiplier(float consumptionMultiplier) - { + public void setConsumptionMultiplier(float consumptionMultiplier) { this.consumptionMultiplier = consumptionMultiplier; } - public void setEfficiencyMultiplier(float efficiencyMultiplier) - { + public void setEfficiencyMultiplier(float efficiencyMultiplier) { this.efficiencyMultiplier = efficiencyMultiplier; } - public void setCapacityMultiplier(float capacityMultiplier) - { + public void setCapacityMultiplier(float capacityMultiplier) { this.capacityMultiplier = capacityMultiplier; } - public void setUpgrades(int speedUpgrades, int efficiencyUpgrades, int sacrificeUpgrades, int selfSacrificeUpgrades, int displacementUpgrades, int altarCapacitiveUpgrades, int orbCapacitiveUpgrades, int betterCapacitiveUpgrades, int accelerationUpgrades) - { + public void setUpgrades( + int speedUpgrades, + int efficiencyUpgrades, + int sacrificeUpgrades, + int selfSacrificeUpgrades, + int displacementUpgrades, + int altarCapacitiveUpgrades, + int orbCapacitiveUpgrades, + int betterCapacitiveUpgrades, + int accelerationUpgrades) { this.speedUpgrades = speedUpgrades; this.efficiencyUpgrades = efficiencyUpgrades; this.sacrificeUpgrades = sacrificeUpgrades; @@ -564,141 +505,128 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public FluidTankInfo getInfo() - { + public FluidTankInfo getInfo() { return new FluidTankInfo(this); } @Override - public int fill(FluidStack resource, boolean doFill) - { + public int fill(FluidStack resource, boolean doFill) { TileEntity tile = this; - if (resource == null) - { + if (resource == null) { return 0; } - if (resource.getFluid().getID() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluid().getID()) - { + if (resource.getFluid().getID() + != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)) + .getFluid() + .getID()) { return 0; } - if (!doFill) - { - if (fluidInput == null) - { + if (!doFill) { + if (fluidInput == null) { return Math.min(bufferCapacity, resource.amount); } - if (!fluidInput.isFluidEqual(resource)) - { + if (!fluidInput.isFluidEqual(resource)) { return 0; } return Math.min(bufferCapacity - fluidInput.amount, resource.amount); } - if (fluidInput == null) - { + if (fluidInput == null) { fluidInput = new FluidStack(resource, Math.min(bufferCapacity, resource.amount)); - if (tile != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluidInput.amount)); + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent( + fluidInput, + tile.getWorldObj(), + tile.xCoord, + tile.yCoord, + tile.zCoord, + this, + fluidInput.amount)); } return fluidInput.amount; } - if (!fluidInput.isFluidEqual(resource)) - { + if (!fluidInput.isFluidEqual(resource)) { return 0; } int filled = bufferCapacity - fluidInput.amount; - if (resource.amount < filled) - { + if (resource.amount < filled) { fluidInput.amount += resource.amount; filled = resource.amount; - } - else - { + } else { fluidInput.amount = bufferCapacity; } - if (tile != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluidInput.amount)); + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent( + fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluidInput.amount)); } return filled; } @Override - public FluidStack drain(int maxDrain, boolean doDrain) - { - if (fluidOutput == null) - { + public FluidStack drain(int maxDrain, boolean doDrain) { + if (fluidOutput == null) { return null; } int drained = maxDrain; - if (fluidOutput.amount < drained) - { + if (fluidOutput.amount < drained) { drained = fluidOutput.amount; } FluidStack stack = new FluidStack(fluidOutput, drained); - if (doDrain) - { + if (doDrain) { fluidOutput.amount -= drained; - if (fluidOutput.amount <= 0) - { + if (fluidOutput.amount <= 0) { fluidOutput = null; } - if (this != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this, fluidOutput.amount)); + if (this != null) { + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent( + fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this, fluidOutput.amount)); } } - if (fluidOutput == null) - { + if (fluidOutput == null) { fluidOutput = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); } - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } return stack; } - //Logic for the actual block is under here + // Logic for the actual block is under here @Override - public void updateEntity() - { + public void updateEntity() { this.decrementDemonBlood(); - if (this.hasDemonBlood() && !worldObj.isRemote) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + if (this.hasDemonBlood() && !worldObj.isRemote) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); } - if (this.lockdownDuration > 0) - { + if (this.lockdownDuration > 0) { this.lockdownDuration--; } - if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0) - { + if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0) { { Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord); block.onNeighborBlockChange(worldObj, xCoord + 1, yCoord, zCoord, block); @@ -714,35 +642,31 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord - 1, block); } - if (AlchemicalWizardry.lockdownAltar) - { - List list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15); - for (EntityPlayer player : list) - { + if (AlchemicalWizardry.lockdownAltar) { + List list = + SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15); + for (EntityPlayer player : list) { PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); - if (regenEffect != null && regenEffect.getAmplifier() >= 2) - { + if (regenEffect != null && regenEffect.getAmplifier() >= 2) { this.lockdownDuration += 20; } } } - if (AlchemicalWizardry.causeHungerWithRegen) - { - List list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15); - for (EntityPlayer player : list) - { + if (AlchemicalWizardry.causeHungerWithRegen) { + List list = + SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15); + for (EntityPlayer player : list) { PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); - if (regenEffect != null && regenEffect.getAmplifier() > 0) - { - player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2)); + if (regenEffect != null && regenEffect.getAmplifier() > 0) { + player.addPotionEffect( + new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2)); } } } } - if (worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) - { + if (worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) { int syphonMax = (int) (20 * this.dislocationMultiplier); int fluidInputted; int fluidOutputted; @@ -756,175 +680,187 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT this.fluid.amount -= fluidOutputted; } - if (worldObj.getWorldTime() % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0)) - { + if (worldObj.getWorldTime() % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0)) { startCycle(); } - if (!isActive) - { - if (cooldownAfterCrafting > 0) - { + if (!isActive) { + if (cooldownAfterCrafting > 0) { cooldownAfterCrafting--; } return; } - if (getStackInSlot(0) == null) - { + if (getStackInSlot(0) == null) { return; } int worldTime = (int) (worldObj.getWorldTime() % 24000); - if (worldObj.isRemote) - { + if (worldObj.isRemote) { return; } - if (worldTime % 1 == 0) - { - if (!canBeFilled) - { - if (fluid != null && fluid.amount >= 1) - { + if (worldTime % 1 == 0) { + if (!canBeFilled) { + if (fluid != null && fluid.amount >= 1) { int stackSize = getStackInSlot(0).stackSize; - int liquidDrained = Math.min((int) (upgradeLevel >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount); + int liquidDrained = Math.min( + (int) (upgradeLevel >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), + fluid.amount); - if (liquidDrained > (liquidRequired * stackSize - progress)) - { + if (liquidDrained > (liquidRequired * stackSize - progress)) { liquidDrained = liquidRequired * stackSize - progress; } fluid.amount = fluid.amount - liquidDrained; progress += liquidDrained; - if (worldTime % 4 == 0) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + if (worldTime % 4 == 0) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 1, + xCoord, + yCoord, + zCoord); } - if (progress >= liquidRequired * stackSize) - { + if (progress >= liquidRequired * stackSize) { ItemStack result; result = AltarRecipeRegistry.getItemForItemAndTier(this.getStackInSlot(0), this.upgradeLevel); - if (result != null) - { + if (result != null) { result.stackSize *= stackSize; } setInventorySlotContents(0, result); progress = 0; - for (int i = 0; i < 8; i++) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 4, xCoord + 0.5f, yCoord + 1.0f, zCoord + 0.5f); + for (int i = 0; i < 8; i++) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 4, + xCoord + 0.5f, + yCoord + 1.0f, + zCoord + 0.5f); } this.isActive = false; } - } - else if (progress > 0) - { + } else if (progress > 0) { progress -= (int) (efficiencyMultiplier * drainRate); - if (worldTime % 2 == 0) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord); + if (worldTime % 2 == 0) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 2, + xCoord, + yCoord, + zCoord); } } - } - else - { + } else { ItemStack returnedItem = getStackInSlot(0); - if (!(returnedItem.getItem() instanceof IBloodOrb)) - { + if (!(returnedItem.getItem() instanceof IBloodOrb)) { return; } IBloodOrb item = (IBloodOrb) (returnedItem.getItem()); NBTTagCompound itemTag = returnedItem.stackTagCompound; - if (itemTag == null) - { + if (itemTag == null) { return; } String ownerName = itemTag.getString("ownerName"); - if (ownerName.equals("")) - { + if (ownerName.equals("")) { return; } - if (fluid != null && fluid.amount >= 1) - { - int liquidDrained = Math.min((int) (upgradeLevel >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount); + if (fluid != null && fluid.amount >= 1) { + int liquidDrained = Math.min( + (int) (upgradeLevel >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), + fluid.amount); - int drain = SoulNetworkHandler.addCurrentEssenceToMaximum(ownerName, liquidDrained, (int) (item.getMaxEssence() * this.orbCapacityMultiplier)); + int drain = SoulNetworkHandler.addCurrentEssenceToMaximum( + ownerName, liquidDrained, (int) (item.getMaxEssence() * this.orbCapacityMultiplier)); fluid.amount = fluid.amount - drain; - if (worldTime % 4 == 0) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 3, xCoord, yCoord, zCoord); + if (worldTime % 4 == 0) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 3, + xCoord, + yCoord, + zCoord); } } } - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } } - public void setActive(boolean active) - { + public void setActive(boolean active) { isActive = active; } - public boolean isActive() - { + public boolean isActive() { return isActive; } - public void sacrificialDaggerCall(int amount, boolean isSacrifice) - { - if (!isSacrifice && this.lockdownDuration > 0) - { - int amt = (int) Math.min(bufferCapacity - fluidInput.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); + public void sacrificialDaggerCall(int amount, boolean isSacrifice) { + if (!isSacrifice && this.lockdownDuration > 0) { + int amt = (int) Math.min( + bufferCapacity - fluidInput.amount, + (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); fluidInput.amount += amt; - } - else - { - fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); + } else { + fluid.amount += Math.min( + capacity - fluid.amount, + (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); } } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return PacketHandler.getPacket(this); } - public void handlePacketData(int[] intData, int[] fluidData, int capacity) - { - if (intData == null) - { + public void handlePacketData(int[] intData, int[] fluidData, int capacity) { + if (intData == null) { return; } - if (intData.length == 3) - { - for (int i = 0; i < 1; i++) - { - if (intData[i * 3 + 2] != 0) - { - ItemStack is = new ItemStack(Item.getItemById(intData[i * 3]), intData[i * 3 + 2], intData[i * 3 + 1]); + if (intData.length == 3) { + for (int i = 0; i < 1; i++) { + if (intData[i * 3 + 2] != 0) { + ItemStack is = + new ItemStack(Item.getItemById(intData[i * 3]), intData[i * 3 + 2], intData[i * 3 + 1]); inv[i] = is; - } - else - { + } else { inv[i] = null; } } @@ -941,21 +877,16 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT this.capacity = capacity; } - public int[] buildIntDataList() - { - int[] sortList = new int[3];//1 * 3 + public int[] buildIntDataList() { + int[] sortList = new int[3]; // 1 * 3 int pos = 0; - for (ItemStack is : inv) - { - if (is != null) - { + for (ItemStack is : inv) { + if (is != null) { sortList[pos++] = Item.getIdFromItem(is.getItem()); sortList[pos++] = is.getItemDamage(); sortList[pos++] = is.stackSize; - } - else - { + } else { sortList[pos++] = 0; sortList[pos++] = 0; sortList[pos++] = 0; @@ -965,32 +896,26 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT return sortList; } - public void startCycle() - { - if (worldObj != null) - { + public void startCycle() { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } this.checkAndSetAltar(); - if (fluid == null || fluid.amount <= 0) - { + if (fluid == null || fluid.amount <= 0) { return; } - if (getStackInSlot(0) == null) - { + if (getStackInSlot(0) == null) { return; } - if (!isActive) - { + if (!isActive) { progress = 0; } - if (AltarRecipeRegistry.isRequiredItemValid(getStackInSlot(0), upgradeLevel)) - { + if (AltarRecipeRegistry.isRequiredItemValid(getStackInSlot(0), upgradeLevel)) { AltarRecipe recipe = AltarRecipeRegistry.getAltarRecipeForItemAndTier(getStackInSlot(0), upgradeLevel); this.isActive = true; this.liquidRequired = recipe.getLiquidRequired(); @@ -1003,20 +928,16 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT isActive = false; } - public void checkAndSetAltar() - { - if (this.fluid.amount > this.capacity) - { + public void checkAndSetAltar() { + if (this.fluid.amount > this.capacity) { this.fluid.amount = this.capacity; } - if (this.fluidOutput.amount > this.bufferCapacity) - { + if (this.fluidOutput.amount > this.bufferCapacity) { this.fluidOutput.amount = this.bufferCapacity; } - if (this.fluidInput.amount > this.bufferCapacity) - { + if (this.fluidInput.amount > this.bufferCapacity) { this.fluidInput.amount = this.bufferCapacity; } @@ -1024,17 +945,14 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 0; } @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { - //TODO - if (resource == null) - { + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + // TODO + if (resource == null) { return 0; } @@ -1048,15 +966,12 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - if (resource == null) - { + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null) { return null; } - if (!resource.isFluidEqual(fluidOutput)) - { + if (!resource.isFluidEqual(fluidOutput)) { return null; } @@ -1064,65 +979,51 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } @Override - public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) - { + public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) { return this.drain(maxEmpty, doDrain); } @Override - public boolean canFill(ForgeDirection from, Fluid fluid) - { - //I changed this, since fluidstack != fluid... :p dunno if it was a accident? so you might wanna check this + public boolean canFill(ForgeDirection from, Fluid fluid) { + // I changed this, since fluidstack != fluid... :p dunno if it was a accident? so you might wanna check this return this.fluidInput != null && this.fluid.getFluid().equals(fluidInput.getFluid()); } @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) - { + public boolean canDrain(ForgeDirection from, Fluid fluid) { return true; } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { + public FluidTankInfo[] getTankInfo(ForgeDirection from) { FluidTank compositeTank = new FluidTank(capacity); compositeTank.setFluid(fluid); - return new FluidTankInfo[]{compositeTank.getInfo()}; + return new FluidTankInfo[] {compositeTank.getInfo()}; } - public int[] buildFluidList() - { + public int[] buildFluidList() { int[] sortList = new int[6]; - if (this.fluid == null) - { + if (this.fluid == null) { sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID(); sortList[1] = 0; - } - else - { + } else { sortList[0] = this.fluid.getFluid().getID(); sortList[1] = this.fluid.amount; } - if (this.fluidInput == null) - { + if (this.fluidInput == null) { sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID(); sortList[3] = 0; - } - else - { + } else { sortList[2] = this.fluidInput.getFluid().getID(); sortList[3] = this.fluidInput.amount; } - if (this.fluidOutput == null) - { + if (this.fluidOutput == null) { sortList[4] = AlchemicalWizardry.lifeEssenceFluid.getID(); sortList[5] = 0; - } - else - { + } else { sortList[4] = this.fluidOutput.getFluid().getID(); sortList[5] = this.fluidOutput.amount; } @@ -1130,31 +1031,34 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT return sortList; } - public void sendChatInfoToPlayer(EntityPlayer player) - { - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altarEssence") + " " + this.fluid.amount + "LP")); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altarCurrentTier") + " " + this.upgradeLevel)); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.capacity") + " " + this.getCapacity() + "LP")); + public void sendChatInfoToPlayer(EntityPlayer player) { + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.altarEssence") + " " + this.fluid.amount + "LP")); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.altarCurrentTier") + " " + this.upgradeLevel)); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.capacity") + " " + this.getCapacity() + "LP")); } - public void sendMoreChatInfoToPlayer(EntityPlayer player) - { - if (getStackInSlot(0) != null) - { + public void sendMoreChatInfoToPlayer(EntityPlayer player) { + if (getStackInSlot(0) != null) { int stackSize = getStackInSlot(0).stackSize; - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altarProgress") + " " + progress + "LP/" + liquidRequired * stackSize + "LP")); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.consumptionRate") + " " + (int) (consumptionRate * (1 + consumptionMultiplier)) + "LP/t")); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altarProgress") + " " + + progress + "LP/" + liquidRequired * stackSize + "LP")); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.consumptionRate") + " " + + (int) (consumptionRate * (1 + consumptionMultiplier)) + "LP/t")); } - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altarEssence") + " " + this.fluid.amount + "LP")); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.inputTank") + " " + this.fluidInput.amount + "LP")); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.outputTank") + " " + this.fluidOutput.amount + "LP")); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.altarEssence") + " " + this.fluid.amount + "LP")); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.inputTank") + " " + this.fluidInput.amount + "LP")); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.outputTank") + " " + this.fluidOutput.amount + "LP")); } @Override - public void requestPauseAfterCrafting(int amount) - { - if (this.isActive) - { + public void requestPauseAfterCrafting(int amount) { + if (this.isActive) { this.cooldownAfterCrafting = amount; } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tileentity/container/ContainerPortableAltar.java b/src/main/java/com/arc/bloodarsenal/common/tileentity/container/ContainerPortableAltar.java index d248877..4ee8b74 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tileentity/container/ContainerPortableAltar.java +++ b/src/main/java/com/arc/bloodarsenal/common/tileentity/container/ContainerPortableAltar.java @@ -7,18 +7,14 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerPortableAltar extends Container -{ +public class ContainerPortableAltar extends Container { protected TilePortableAltar tileEntity; - public ContainerPortableAltar(InventoryPlayer inventoryPlayer, TilePortableAltar te) - { + public ContainerPortableAltar(InventoryPlayer inventoryPlayer, TilePortableAltar te) { tileEntity = te; - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { addSlotToContainer(new Slot(tileEntity, j + i * 3, 62 + j * 18, 17 + i * 18)); } } @@ -27,59 +23,44 @@ public class ContainerPortableAltar extends Container } @Override - public boolean canInteractWith(EntityPlayer entityplayer) - { + public boolean canInteractWith(EntityPlayer entityplayer) { return tileEntity.isUseableByPlayer(entityplayer); } - protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) - { - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 9; j++) - { + protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - for (int i = 0; i < 9; i++) - { + for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); } } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) - { + public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); - if (slotObject != null && slotObject.getHasStack()) - { + if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); - if (slot < 9) - { - if (!this.mergeItemStack(stackInSlot, 0, 35, true)) - { + if (slot < 9) { + if (!this.mergeItemStack(stackInSlot, 0, 35, true)) { return null; } - } - else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) - { + } else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) { return null; } - if (stackInSlot.stackSize == 0) - { + if (stackInSlot.stackSize == 0) { slotObject.putStack(null); - } - else - { + } else { slotObject.onSlotChanged(); } - if (stackInSlot.stackSize == stack.stackSize) - { + if (stackInSlot.stackSize == stack.stackSize) { return null; } diff --git a/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalModifiers.java b/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalModifiers.java index 11ffb85..230ece4 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalModifiers.java +++ b/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalModifiers.java @@ -4,11 +4,10 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import tconstruct.library.crafting.ModifyBuilder; -public class BloodArsenalModifiers -{ - public static void initModifiers() - { - ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, OreDictionary.WILDCARD_VALUE); +public class BloodArsenalModifiers { + public static void initModifiers() { + ItemStack masterOrb = + new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, OreDictionary.WILDCARD_VALUE); ModifyBuilder.registerModifier(new ModSoulbound(new ItemStack[] {masterOrb})); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalTinkers.java b/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalTinkers.java index f06c131..17efa55 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalTinkers.java +++ b/src/main/java/com/arc/bloodarsenal/common/tinkers/BloodArsenalTinkers.java @@ -19,29 +19,24 @@ import tconstruct.library.crafting.FluidType; import tconstruct.library.crafting.Smeltery; import tconstruct.smeltery.TinkerSmeltery; -public class BloodArsenalTinkers -{ - public final static BloodArsenalTinkers INSTANCE = new BloodArsenalTinkers(); +public class BloodArsenalTinkers { + public static final BloodArsenalTinkers INSTANCE = new BloodArsenalTinkers(); public static Fluid bloodInfusedIronFluid; public BloodArsenalTinkers() {} - public void init() - { + public void init() { addBloodInfusedWoodMaterial(); addBloodInfusedIronMaterial(); BloodArsenalModifiers.initModifiers(); } - public void addBloodInfusedWoodMaterial() - { - if (ModBlocks.blood_infused_planks != null) - { + public void addBloodInfusedWoodMaterial() { + if (ModBlocks.blood_infused_planks != null) { int id = BloodArsenalConfig.bloodInfusedWoodID; - if (id > 0) - { + if (id > 0) { NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("Id", id); tag.setString("Name", "BloodInfusedWood"); @@ -78,14 +73,11 @@ public class BloodArsenalTinkers } } - public void addBloodInfusedIronMaterial() - { - if (ModBlocks.blood_infused_iron_block != null && ModItems.blood_infused_iron != null) - { + public void addBloodInfusedIronMaterial() { + if (ModBlocks.blood_infused_iron_block != null && ModItems.blood_infused_iron != null) { int id = BloodArsenalConfig.bloodInfusedIronID; - if (id > 0) - { + if (id > 0) { NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("Id", id); tag.setString("Name", "BloodInfusedIron"); @@ -104,12 +96,40 @@ public class BloodArsenalTinkers tag.setInteger("Color", 16777215); FMLInterModComms.sendMessage("TConstruct", "addMaterial", tag); FluidRegistry.registerFluid(bloodInfusedIronFluid); - FluidType.registerFluidType(bloodInfusedIronFluid.getName(), ModBlocks.blood_infused_iron_block, 0, 850, bloodInfusedIronFluid, true); - Smeltery.addMelting(new ItemStack(ModBlocks.blood_infused_iron_block, 1), ModBlocks.blood_infused_iron_block, 0, 850, new FluidStack(bloodInfusedIronFluid, 1296)); - Smeltery.addMelting(new ItemStack(ModItems.blood_infused_iron, 1, 0), ModBlocks.blood_infused_iron_block, 0, 850, new FluidStack(bloodInfusedIronFluid, 144)); + FluidType.registerFluidType( + bloodInfusedIronFluid.getName(), + ModBlocks.blood_infused_iron_block, + 0, + 850, + bloodInfusedIronFluid, + true); + Smeltery.addMelting( + new ItemStack(ModBlocks.blood_infused_iron_block, 1), + ModBlocks.blood_infused_iron_block, + 0, + 850, + new FluidStack(bloodInfusedIronFluid, 1296)); + Smeltery.addMelting( + new ItemStack(ModItems.blood_infused_iron, 1, 0), + ModBlocks.blood_infused_iron_block, + 0, + 850, + new FluidStack(bloodInfusedIronFluid, 144)); ItemStack ingotcast = new ItemStack(TinkerSmeltery.metalPattern, 1, 0); - TConstructRegistry.getBasinCasting().addCastingRecipe(new ItemStack(ModBlocks.blood_infused_iron_block, 1), new FluidStack(bloodInfusedIronFluid, 1296), null, true, 100); - TConstructRegistry.getTableCasting().addCastingRecipe(new ItemStack(ModItems.blood_infused_iron, 1), new FluidStack(bloodInfusedIronFluid, 144), ingotcast, false, 50); + TConstructRegistry.getBasinCasting() + .addCastingRecipe( + new ItemStack(ModBlocks.blood_infused_iron_block, 1), + new FluidStack(bloodInfusedIronFluid, 1296), + null, + true, + 100); + TConstructRegistry.getTableCasting() + .addCastingRecipe( + new ItemStack(ModItems.blood_infused_iron, 1), + new FluidStack(bloodInfusedIronFluid, 144), + ingotcast, + false, + 50); tag = new NBTTagCompound(); tag.setString("FluidName", bloodInfusedIronFluid.getName()); tag.setInteger("MaterialId", id); @@ -119,11 +139,9 @@ public class BloodArsenalTinkers tag.setTag("Item", (new ItemStack(ModItems.blood_infused_iron, 1, 0)).writeToNBT(new NBTTagCompound())); tag.setInteger("Value", 2); FMLInterModComms.sendMessage("TConstruct", "addMaterialItem", tag); - BloodArsenal.proxy.executeClientCode(new IClientCode() - { + BloodArsenal.proxy.executeClientCode(new IClientCode() { @SideOnly(Side.CLIENT) - public void executeClientCode() - { + public void executeClientCode() { (new TextureResourcePackBloodInfusedIron("BloodInfusedIron")).register(); } }); @@ -131,9 +149,11 @@ public class BloodArsenalTinkers } } - static - { + static { MinecraftForge.EVENT_BUS.register(new TConEvents()); - bloodInfusedIronFluid = new Fluid("molten.blood_infused_iron").setDensity(3000).setViscosity(6000).setTemperature(1400); + bloodInfusedIronFluid = new Fluid("molten.blood_infused_iron") + .setDensity(3000) + .setViscosity(6000) + .setTemperature(1400); } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tinkers/IClientCode.java b/src/main/java/com/arc/bloodarsenal/common/tinkers/IClientCode.java index a79ecf3..86c1ee6 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tinkers/IClientCode.java +++ b/src/main/java/com/arc/bloodarsenal/common/tinkers/IClientCode.java @@ -3,8 +3,7 @@ package com.arc.bloodarsenal.common.tinkers; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public interface IClientCode -{ +public interface IClientCode { @SideOnly(Side.CLIENT) void executeClientCode(); } diff --git a/src/main/java/com/arc/bloodarsenal/common/tinkers/ModSoulbound.java b/src/main/java/com/arc/bloodarsenal/common/tinkers/ModSoulbound.java index d72985c..99a5f55 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tinkers/ModSoulbound.java +++ b/src/main/java/com/arc/bloodarsenal/common/tinkers/ModSoulbound.java @@ -5,72 +5,51 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.oredict.OreDictionary; import tconstruct.library.modifier.IModifyable; -import tconstruct.library.tools.ToolCore; import tconstruct.modifiers.tools.ModBoolean; -import tconstruct.util.config.PHConstruct; -import java.util.ArrayList; - -public class ModSoulbound extends ModBoolean -{ +public class ModSoulbound extends ModBoolean { public int modifiersRequired = 1; private String owner; - public ModSoulbound(ItemStack[] items) - { + public ModSoulbound(ItemStack[] items) { super(items, 30, "Soulbound", EnumChatFormatting.DARK_RED.toString(), "Soulbound"); } @Override - public boolean matches(ItemStack[] input, ItemStack tool) - { + public boolean matches(ItemStack[] input, ItemStack tool) { NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String[] traits = ((IModifyable)tool.getItem()).getTraits(); - for(String trait : traits) - if("ammo".equals(trait)) - return false; + String[] traits = ((IModifyable) tool.getItem()).getTraits(); + for (String trait : traits) if ("ammo".equals(trait)) return false; ItemStack foundOrb = null; - for (ItemStack stack : input) - { - if (stack == null) - continue; - if (!(stack.getItem() instanceof IBloodOrb)) - continue; - if (!(((IBloodOrb) stack.getItem()).getOrbLevel() >= 4)) - continue; - if (SoulNetworkHandler.getOwnerName(stack).equals("")) - continue; - if (foundOrb != null) - return false; + for (ItemStack stack : input) { + if (stack == null) continue; + if (!(stack.getItem() instanceof IBloodOrb)) continue; + if (!(((IBloodOrb) stack.getItem()).getOrbLevel() >= 4)) continue; + if (SoulNetworkHandler.getOwnerName(stack).equals("")) continue; + if (foundOrb != null) return false; foundOrb = stack; } - if (foundOrb == null) - return false; - if (tags.getBoolean(key)) - return false; - // otherwise check if we have enough modfiers - else if (tags.getInteger("Modifiers") < modifiersRequired) - return false; + if (foundOrb == null) return false; + if (tags.getBoolean(key)) return false; + // otherwise check if we have enough modfiers + else if (tags.getInteger("Modifiers") < modifiersRequired) return false; // all requirements satisfied! return true; } @Override - public void modify(ItemStack[] input, ItemStack tool) - { + public void modify(ItemStack[] input, ItemStack tool) { NBTTagCompound tags = tool.getTagCompound(); // update modifiers (only applies if it's not an upgrade) - if (!tags.hasKey(key)) - { + if (!tags.hasKey(key)) { int modifiers = tags.getCompoundTag("InfiTool").getInteger("Modifiers"); modifiers -= modifiersRequired; tags.getCompoundTag("InfiTool").setInteger("Modifiers", modifiers); @@ -82,18 +61,12 @@ public class ModSoulbound extends ModBoolean // find the battery in the input ItemStack inputBattery = null; - for (ItemStack stack : input) - { - if (stack == null) - continue; - if (!(stack.getItem() instanceof IBloodOrb)) - continue; - if (!(((IBloodOrb) stack.getItem()).getOrbLevel() >= 4)) - continue; - if (SoulNetworkHandler.getOwnerName(stack).equals("")) - continue; - if (inputBattery != null) - return; + for (ItemStack stack : input) { + if (stack == null) continue; + if (!(stack.getItem() instanceof IBloodOrb)) continue; + if (!(((IBloodOrb) stack.getItem()).getOrbLevel() >= 4)) continue; + if (SoulNetworkHandler.getOwnerName(stack).equals("")) continue; + if (inputBattery != null) return; this.owner = SoulNetworkHandler.getOwnerName(stack); // we're guaranteed to only find one battery because more are prevented above diff --git a/src/main/java/com/arc/bloodarsenal/common/tinkers/TConEvents.java b/src/main/java/com/arc/bloodarsenal/common/tinkers/TConEvents.java index 1a8458a..b5ad6d0 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tinkers/TConEvents.java +++ b/src/main/java/com/arc/bloodarsenal/common/tinkers/TConEvents.java @@ -5,17 +5,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraftforge.client.event.TextureStitchEvent; -public class TConEvents -{ +public class TConEvents { @SideOnly(Side.CLIENT) @SubscribeEvent - public void handleStich(TextureStitchEvent.Pre event) - { - if (event.map.getTextureType() == 0) - { - if (BloodArsenalTinkers.bloodInfusedIronFluid != null) - { - BloodArsenalTinkers.bloodInfusedIronFluid.setIcons(event.map.registerIcon("BloodArsenal:molten_blood_infused_iron_still"), event.map.registerIcon("BloodArsenal:molten_blood_infused_iron_flow")); + public void handleStich(TextureStitchEvent.Pre event) { + if (event.map.getTextureType() == 0) { + if (BloodArsenalTinkers.bloodInfusedIronFluid != null) { + BloodArsenalTinkers.bloodInfusedIronFluid.setIcons( + event.map.registerIcon("BloodArsenal:molten_blood_infused_iron_still"), + event.map.registerIcon("BloodArsenal:molten_blood_infused_iron_flow")); } } } diff --git a/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBase.java b/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBase.java index 3544316..89e051b 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBase.java +++ b/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBase.java @@ -4,13 +4,6 @@ import com.arc.bloodarsenal.common.BloodArsenal; import com.google.common.base.Throwables; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.ObfuscationReflectionHelper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.*; -import net.minecraft.client.resources.data.IMetadataSection; -import net.minecraft.client.resources.data.IMetadataSerializer; -import net.minecraft.util.ResourceLocation; - -import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.awt.image.DirectColorModel; import java.io.ByteArrayInputStream; @@ -18,9 +11,14 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.*; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.*; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; -public abstract class TextureResourcePackBase implements IResourcePack, IResourceManagerReloadListener -{ +public abstract class TextureResourcePackBase implements IResourcePack, IResourceManagerReloadListener { public static List packs; protected static DirectColorModel rgb = new DirectColorModel(32, 16711680, '\uff00', 255, -16777216); protected final String name; @@ -28,8 +26,7 @@ public abstract class TextureResourcePackBase implements IResourcePack, IResourc protected IResourcePack delegate; protected List resourcePackz = null; - public TextureResourcePackBase(String name) - { + public TextureResourcePackBase(String name) { this.name = name.toLowerCase(); this.delegate = FMLClientHandler.instance().getResourcePackFor("TConstruct"); } @@ -38,66 +35,56 @@ public abstract class TextureResourcePackBase implements IResourcePack, IResourc return this.brightness(rgb.getRed(col), rgb.getGreen(col), rgb.getBlue(col)); } - public int brightness(int r, int g, int b) - { - return (int)((float)r * 0.2126F + (float)g * 0.7152F + (float)b * 0.0722F); + public int brightness(int r, int g, int b) { + return (int) ((float) r * 0.2126F + (float) g * 0.7152F + (float) b * 0.0722F); } - public void register() - { + public void register() { List packs = this.getiResourcePacks(); packs.add(this); - ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(this); - BloodArsenal.logger.info("Registered TCon Resource Pack (" + this.name + ") - " + this.getClass().getSimpleName()); + ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(this); + BloodArsenal.logger.info("Registered TCon Resource Pack (" + this.name + ") - " + + this.getClass().getSimpleName()); } - public List getiResourcePacks() - { + public List getiResourcePacks() { List packs1 = packs; - if(packs1 == null) - { - packs1 = (List)ObfuscationReflectionHelper.getPrivateValue(FMLClientHandler.class, FMLClientHandler.instance(), new String[]{"resourcePackList"}); + if (packs1 == null) { + packs1 = (List) ObfuscationReflectionHelper.getPrivateValue( + FMLClientHandler.class, FMLClientHandler.instance(), new String[] {"resourcePackList"}); } return packs1; } - public InputStream getStream(ResourceLocation location) - { + public InputStream getStream(ResourceLocation location) { InputStream stream = null; Iterator i$ = this.getPacks().iterator(); - while(i$.hasNext()) - { - IResourcePack iResourcePack = (IResourcePack)i$.next(); - if(iResourcePack.resourceExists(location)) - { - try - { + while (i$.hasNext()) { + IResourcePack iResourcePack = (IResourcePack) i$.next(); + if (iResourcePack.resourceExists(location)) { + try { stream = iResourcePack.getInputStream(location); + } catch (IOException var6) { } - catch (IOException var6) {} } } return stream; } - public List getPacks() - { - if(this.resourcePackz == null) - { + public List getPacks() { + if (this.resourcePackz == null) { this.resourcePackz = new ArrayList(); this.resourcePackz.add(this.delegate); List t = Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries(); Iterator i$ = t.iterator(); - while(i$.hasNext()) - { - ResourcePackRepository.Entry entry = (ResourcePackRepository.Entry)i$.next(); + while (i$.hasNext()) { + ResourcePackRepository.Entry entry = (ResourcePackRepository.Entry) i$.next(); IResourcePack resourcePack = entry.getResourcePack(); - if(resourcePack.getResourceDomains().contains("tinker")) - { + if (resourcePack.getResourceDomains().contains("tinker")) { this.resourcePackz.add(resourcePack); } } @@ -106,47 +93,39 @@ public abstract class TextureResourcePackBase implements IResourcePack, IResourc return this.resourcePackz; } - public InputStream getInputStream(ResourceLocation p_110590_1_) throws IOException - { - byte[] bytes = (byte[])this.cachedImages.get(p_110590_1_); - if(bytes == null) - { - ResourceLocation location = new ResourceLocation("tinker", p_110590_1_.getResourcePath().replace(this.name, "")); + public InputStream getInputStream(ResourceLocation p_110590_1_) throws IOException { + byte[] bytes = (byte[]) this.cachedImages.get(p_110590_1_); + if (bytes == null) { + ResourceLocation location = + new ResourceLocation("tinker", p_110590_1_.getResourcePath().replace(this.name, "")); InputStream inputStream = this.getStream(location); - if(inputStream == null) - { - location = new ResourceLocation("tinker", p_110590_1_.getResourcePath().replace(this.name, "iron")); + if (inputStream == null) { + location = new ResourceLocation( + "tinker", p_110590_1_.getResourcePath().replace(this.name, "iron")); inputStream = this.getStream(location); } - if(inputStream == null) - { - location = new ResourceLocation("tinker", p_110590_1_.getResourcePath().replace(this.name, "stone")); + if (inputStream == null) { + location = new ResourceLocation( + "tinker", p_110590_1_.getResourcePath().replace(this.name, "stone")); inputStream = this.getStream(location); } - if(inputStream == null) - { + if (inputStream == null) { return this.delegate.getInputStream(p_110590_1_); } BufferedImage bufferedimage; - try - { + try { bufferedimage = ImageIO.read(inputStream); - } - catch (IOException var9) - { + } catch (IOException var9) { throw Throwables.propagate(var9); } BufferedImage image; - try - { + try { image = this.modifyImage(bufferedimage); - } - catch (Throwable var8) - { + } catch (Throwable var8) { var8.printStackTrace(); return this.delegate.getInputStream(location); } @@ -162,16 +141,23 @@ public abstract class TextureResourcePackBase implements IResourcePack, IResourc public abstract BufferedImage modifyImage(BufferedImage var1); - public boolean resourceExists(ResourceLocation p_110589_1_) - { - if(!"tinker".equals(p_110589_1_.getResourceDomain())) - { + public boolean resourceExists(ResourceLocation p_110589_1_) { + if (!"tinker".equals(p_110589_1_.getResourceDomain())) { return false; - } - else - { + } else { String resourcePath = p_110589_1_.getResourcePath(); - return resourcePath.startsWith("textures/items/") && resourcePath.endsWith(".png")?(this.delegate.resourceExists(p_110589_1_)?false:(!resourcePath.contains(this.name)?false:this.delegate.resourceExists(new ResourceLocation("tinker", resourcePath.replace(this.name, "stone"))) || this.delegate.resourceExists(new ResourceLocation("tinker", resourcePath.replace(this.name, "iron"))) || this.delegate.resourceExists(new ResourceLocation("tinker", resourcePath.replace(this.name, ""))))):false; + return resourcePath.startsWith("textures/items/") && resourcePath.endsWith(".png") + ? (this.delegate.resourceExists(p_110589_1_) + ? false + : (!resourcePath.contains(this.name) + ? false + : this.delegate.resourceExists(new ResourceLocation( + "tinker", resourcePath.replace(this.name, "stone"))) + || this.delegate.resourceExists(new ResourceLocation( + "tinker", resourcePath.replace(this.name, "iron"))) + || this.delegate.resourceExists(new ResourceLocation( + "tinker", resourcePath.replace(this.name, ""))))) + : false; } } @@ -179,13 +165,11 @@ public abstract class TextureResourcePackBase implements IResourcePack, IResourc return this.delegate.getResourceDomains(); } - public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException - { + public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException { return null; } - public BufferedImage getPackImage() throws IOException - { + public BufferedImage getPackImage() throws IOException { return null; } @@ -193,8 +177,7 @@ public abstract class TextureResourcePackBase implements IResourcePack, IResourc return "BA_Delegate_Pack"; } - public void onResourceManagerReload(IResourceManager p_110549_1_) - { + public void onResourceManagerReload(IResourceManager p_110549_1_) { this.cachedImages.clear(); this.resourcePackz = null; } diff --git a/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBloodInfusedIron.java b/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBloodInfusedIron.java index 689659c..a9f2790 100644 --- a/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBloodInfusedIron.java +++ b/src/main/java/com/arc/bloodarsenal/common/tinkers/TextureResourcePackBloodInfusedIron.java @@ -1,20 +1,16 @@ package com.arc.bloodarsenal.common.tinkers; +import java.awt.image.BufferedImage; import net.minecraft.util.MathHelper; -import java.awt.image.BufferedImage; +public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase { + static int[][] offsets = new int[][] {{0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}}; -public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase -{ - static int[][] offsets = new int[][]{{0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}}; - - public TextureResourcePackBloodInfusedIron(String name) - { + public TextureResourcePackBloodInfusedIron(String name) { super(name); } - public BufferedImage modifyImage(BufferedImage image) - { + public BufferedImage modifyImage(BufferedImage image) { int w = image.getWidth(); int h = image.getHeight(); image.getType(); @@ -23,15 +19,12 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase int mean = 0; int div = 0; - for(int n = 0; n < w; ++n) - { - for(int baseSilhouette = 0; baseSilhouette < h; ++baseSilhouette) - { + for (int n = 0; n < w; ++n) { + for (int baseSilhouette = 0; baseSilhouette < h; ++baseSilhouette) { int interior1 = image.getRGB(n, baseSilhouette); pixels[n][baseSilhouette] = this.brightness(interior1); boolean baseCorners = interior1 != 0 && rgb.getAlpha(interior1) > 64; - if(baseCorners) - { + if (baseCorners) { base[n][baseSilhouette] = true; mean += pixels[n][baseSilhouette]; ++div; @@ -41,24 +34,15 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase mean = mean / div * 2 / 4; byte var26; - if(w >= 256) - { + if (w >= 256) { var26 = 5; - } - else if(w >= 128) - { + } else if (w >= 128) { var26 = 4; - } - else if(w >= 64) - { + } else if (w >= 64) { var26 = 3; - } - else if(w >= 32) - { + } else if (w >= 32) { var26 = 2; - } - else - { + } else { var26 = 1; } @@ -67,8 +51,11 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase boolean[][] interior2 = this.contract(var28, 2 * var26); boolean[][] interior3 = this.contract(interior2, var26); boolean[][] interior4 = this.contract(interior3, var26); - boolean[][] interiorCorners = this.multI(this.mult(this.expand(this.getCorners(interior2), var26), interior2), interior3); - boolean[][] interiorCornersShift = this.orwise(this.orwise(this.shift(interiorCorners, -1, 0), this.shift(interiorCorners, 0, -1)), this.shift(interiorCorners, -1, -1)); + boolean[][] interiorCorners = + this.multI(this.mult(this.expand(this.getCorners(interior2), var26), interior2), interior3); + boolean[][] interiorCornersShift = this.orwise( + this.orwise(this.shift(interiorCorners, -1, 0), this.shift(interiorCorners, 0, -1)), + this.shift(interiorCorners, -1, -1)); byte trans = 0; int red = 16752029; int pink_highlight = 16752029; @@ -76,41 +63,25 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase int darkiron = 13592423; int[][] outpixels = new int[w][w]; - for(int x = 0; x < w; ++x) - { - for(int y = 0; y < h; ++y) - { - if(!var27[x][y]) - { - if(base[x][y]) - { + for (int x = 0; x < w; ++x) { + for (int y = 0; y < h; ++y) { + if (!var27[x][y]) { + if (base[x][y]) { outpixels[x][y] = this.multPixel(darkiron, pixels[x][y] / 2); - } - else - { + } else { outpixels[x][y] = trans; } - } - else if(interior2[x][y] && !interior3[x][y]) - { - if(interiorCorners[x][y]) - { - if(interiorCornersShift[x][y]) - { + } else if (interior2[x][y] && !interior3[x][y]) { + if (interiorCorners[x][y]) { + if (interiorCornersShift[x][y]) { outpixels[x][y] = this.multPixel(red, Math.max(pixels[x][y], mean)); - } - else - { + } else { outpixels[x][y] = this.multPixel(pink_highlight, Math.max(pixels[x][y], mean) + 5); } - } - else - { + } else { outpixels[x][y] = this.multPixel(red, pixels[x][y]); } - } - else - { + } else { outpixels[x][y] = this.multPixel(iron, pixels[x][y]); } @@ -121,12 +92,9 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase return image; } - private boolean[][] orwise(boolean[][] a, boolean[][] b) - { - for(int i = 0; i < a.length; ++i) - { - for(int j = 0; j < a[i].length; ++j) - { + private boolean[][] orwise(boolean[][] a, boolean[][] b) { + for (int i = 0; i < a.length; ++i) { + for (int j = 0; j < a[i].length; ++j) { a[i][j] |= b[i][j]; } } @@ -134,12 +102,9 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase return a; } - private boolean[][] mult(boolean[][] a, boolean[][] b) - { - for(int i = 0; i < a.length; ++i) - { - for(int j = 0; j < a[i].length; ++j) - { + private boolean[][] mult(boolean[][] a, boolean[][] b) { + for (int i = 0; i < a.length; ++i) { + for (int j = 0; j < a[i].length; ++j) { a[i][j] &= b[i][j]; } } @@ -147,12 +112,9 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase return a; } - private boolean[][] multI(boolean[][] a, boolean[][] b) - { - for(int i = 0; i < a.length; ++i) - { - for(int j = 0; j < a[i].length; ++j) - { + private boolean[][] multI(boolean[][] a, boolean[][] b) { + for (int i = 0; i < a.length; ++i) { + for (int j = 0; j < a[i].length; ++j) { a[i][j] &= !b[i][j]; } } @@ -160,101 +122,90 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase return a; } - private boolean[][] expand(boolean[][] base, int n) - { + private boolean[][] expand(boolean[][] base, int n) { boolean[][] output = this.expand(base); - for(int i = 0; i < n - 1; ++i) - { + for (int i = 0; i < n - 1; ++i) { output = this.expand(output); } return output; } - private boolean[][] contract(boolean[][] base, int n) - { + private boolean[][] contract(boolean[][] base, int n) { boolean[][] output = this.contract(base); - for(int i = 0; i < n - 1; ++i) - { + for (int i = 0; i < n - 1; ++i) { output = this.contract(output); } return output; } - public int multPixel(int col, int b) - { - return -16777216 | this.clamp(rgb.getRed(col) * b / 255) << 16 | this.clamp(rgb.getGreen(col) * b / 255) << 8 | this.clamp(rgb.getBlue(col) * b / 255); + public int multPixel(int col, int b) { + return -16777216 + | this.clamp(rgb.getRed(col) * b / 255) << 16 + | this.clamp(rgb.getGreen(col) * b / 255) << 8 + | this.clamp(rgb.getBlue(col) * b / 255); } private int clamp(int i) { return MathHelper.clamp_int(i, 0, 255); } - public boolean get(boolean[][] img, int x, int y) - { + public boolean get(boolean[][] img, int x, int y) { return x >= 0 && y >= 0 && x < img.length && y < img[x].length && img[x][y]; } - public boolean[][] shift(boolean[][] img, int dx, int dy) - { + public boolean[][] shift(boolean[][] img, int dx, int dy) { int w = img.length; boolean[][] img2 = new boolean[w][w]; - for(int x = Math.max(-dx, 0); x < Math.min(w, w + dx); ++x) - { - System.arraycopy(img[x + dx], Math.max(-dy, 0) + dy, img2[x], Math.max(-dy, 0), Math.min(w, w + dy) - Math.max(-dy, 0)); + for (int x = Math.max(-dx, 0); x < Math.min(w, w + dx); ++x) { + System.arraycopy( + img[x + dx], + Math.max(-dy, 0) + dy, + img2[x], + Math.max(-dy, 0), + Math.min(w, w + dy) - Math.max(-dy, 0)); } return img2; } - public boolean[][] getCorners(boolean[][] img) - { + public boolean[][] getCorners(boolean[][] img) { int w = img.length; boolean[][] img2 = new boolean[w][w]; - for(int x = 0; x < w; ++x) - { - for(int y = 0; y < w; ++y) - { - if(img[x][y]) { + for (int x = 0; x < w; ++x) { + for (int y = 0; y < w; ++y) { + if (img[x][y]) { int an = -1; int n = 0; int[][] arr$ = offsets; int len$ = arr$.length; - for(int i$ = 0; i$ < len$; ++i$) - { + for (int i$ = 0; i$ < len$; ++i$) { int[] offset = arr$[i$]; - if(this.get(img, x + offset[0], y + offset[1])) - { - if(an == -1) - { + if (this.get(img, x + offset[0], y + offset[1])) { + if (an == -1) { an = n; } n = 0; - } - else - { + } else { ++n; - if(n == 5) - { + if (n == 5) { break; } } } - if(an != -1) - { + if (an != -1) { n += an; } - if(n >= 5) - { + if (n >= 5) { img2[x][y] = true; } } @@ -264,46 +215,35 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase return img2; } - public boolean[][] contract(boolean[][] img) - { + public boolean[][] contract(boolean[][] img) { int w = img.length; boolean[][] img2 = new boolean[w][w]; int x; - for(x = 0; x < w; ++x) - { + for (x = 0; x < w; ++x) { System.arraycopy(img[x], 0, img2[x], 0, w); } - for(x = 0; x < w; ++x) - { - for(int y = 0; y < w; ++y) - { - if(img[x][y]) - { - if(x == 0 || y == 0 || x == w - 1 || y == w - 1) { + for (x = 0; x < w; ++x) { + for (int y = 0; y < w; ++y) { + if (img[x][y]) { + if (x == 0 || y == 0 || x == w - 1 || y == w - 1) { img2[x][y] = false; } - } - else - { - if(x > 0) - { + } else { + if (x > 0) { img2[x - 1][y] = false; } - if(y > 0) - { + if (y > 0) { img2[x][y - 1] = false; } - if(x < w - 1) - { + if (x < w - 1) { img2[x + 1][y] = false; } - if(y < w - 1) - { + if (y < w - 1) { img2[x][y + 1] = false; } } @@ -313,32 +253,26 @@ public class TextureResourcePackBloodInfusedIron extends TextureResourcePackBase return img2; } - public boolean[][] expand(boolean[][] img) - { + public boolean[][] expand(boolean[][] img) { int w = img.length; boolean[][] img2 = new boolean[w][w]; int x; - for(x = 0; x < w; ++x) - { + for (x = 0; x < w; ++x) { System.arraycopy(img[x], 0, img2[x], 0, w); } - for(x = 0; x < w; ++x) - { - for(int y = 0; y < w; ++y) - { - if(img[x][y]) { + for (x = 0; x < w; ++x) { + for (int y = 0; y < w; ++y) { + if (img[x][y]) { int[][] arr$ = offsets; int len$ = arr$.length; - for(int i$ = 0; i$ < len$; ++i$) - { + for (int i$ = 0; i$ < len$; ++i$) { int[] offset = arr$[i$]; int dx = x + offset[0]; int dy = y + offset[1]; - if(dx >= 0 && dy >= 0 && dx < w && dy < w) - { + if (dx >= 0 && dy >= 0 && dx < w && dy < w) { img2[dx][dy] = true; } }