From 2b27b551a311e1df76936b3086d6b998776466e3 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Tue, 8 Nov 2022 19:34:25 +0100 Subject: [PATCH] remove out commentec code run SA --- .../api/IHeatExchangerLogic.java | 7 +- .../pneumaticCraft/api/PneumaticRegistry.java | 19 +- .../api/actuator/IActuator.java | 5 +- .../api/block/BlockSupplier.java | 108 +- .../api/block/IPneumaticWrenchable.java | 2 +- .../api/client/GuiAnimatedStatSupplier.java | 28 +- .../api/client/GuiElementRenderer.java | 43 +- .../api/client/IGuiAnimatedStat.java | 4 +- .../AssemblyRenderOverriding.java | 13 +- .../pneumaticHelmet/IBlockTrackEntry.java | 11 +- .../pneumaticHelmet/IEntityTrackEntry.java | 9 +- .../client/pneumaticHelmet/IGuiScreen.java | 3 +- .../pneumaticHelmet/IHackableBlock.java | 37 +- .../pneumaticHelmet/IHackableEntity.java | 31 +- .../client/pneumaticHelmet/IOptionPage.java | 2 +- .../IUpgradeRenderHandler.java | 6 +- .../RenderHandlerRegistry.java | 2 +- .../api/drone/DroneConstructingEvent.java | 4 +- .../api/drone/IBlockInteractHandler.java | 3 +- .../api/drone/ICustomBlockInteract.java | 8 +- .../java/pneumaticCraft/api/drone/IDrone.java | 4 +- .../api/drone/IPathNavigator.java | 2 +- .../api/drone/IPathfindHandler.java | 2 +- .../drone/SpecialVariableRetrievalEvent.java | 23 +- .../api/item/IInventoryItem.java | 3 +- .../api/item/IPressurizable.java | 8 +- .../api/item/IProgrammable.java | 3 +- .../pneumaticCraft/api/item/ItemSupplier.java | 74 +- .../java/pneumaticCraft/api/package-info.java | 1 - .../api/recipe/AssemblyRecipe.java | 26 +- .../api/recipe/IPressureChamberRecipe.java | 2 +- .../api/recipe/PressureChamberRecipe.java | 6 +- .../api/tileentity/AirHandlerSupplier.java | 26 +- .../api/tileentity/IAirHandler.java | 6 +- .../api/tileentity/IHeatExchanger.java | 3 +- .../api/tileentity/IManoMeasurable.java | 3 +- .../api/tileentity/IPneumaticMachine.java | 10 +- .../api/universalSensor/EntityPollSensor.java | 18 +- .../IBlockAndCoordinateEventSensor.java | 7 +- .../IBlockAndCoordinatePollSensor.java | 8 +- .../universalSensor/IEventSensorSetting.java | 4 +- .../universalSensor/IPollSensorSetting.java | 3 +- .../api/universalSensor/ISensorSetting.java | 8 +- .../universalSensor/PlayerEventSensor.java | 21 +- .../universalSensor/SensorRegistrator.java | 4 +- .../AlchemicalWizardry.java | 4312 +++++++++++++---- .../BloodMagicConfiguration.java | 1352 ++++-- .../alchemicalWizardry/ModBlocks.java | 47 +- .../alchemicalWizardry/ModItems.java | 25 +- .../api/ColourAndCoords.java | 21 +- .../api/ILimitingLogic.java | 5 +- .../alchemicalWizardry/api/Int3.java | 27 +- .../api/RoutingFocusLogic.java | 25 +- .../api/RoutingFocusParadigm.java | 103 +- .../api/RoutingFocusPosAndFacing.java | 32 +- .../alchemicalWizardry/api/Vector3.java | 28 +- .../AlchemicalPotionCreationHandler.java | 51 +- .../AlchemyPotionHandlerComponent.java | 36 +- .../api/alchemy/AlchemyPotionHelper.java | 47 +- .../api/alchemy/AlchemyRecipe.java | 80 +- .../api/alchemy/AlchemyRecipeRegistry.java | 51 +- .../api/alchemy/energy/IAlchemyGoggles.java | 3 +- .../api/alchemy/energy/IReagentContainer.java | 3 +- .../api/alchemy/energy/IReagentHandler.java | 3 +- .../energy/ISegmentedReagentHandler.java | 3 +- .../api/alchemy/energy/Reagent.java | 24 +- .../api/alchemy/energy/ReagentContainer.java | 84 +- .../alchemy/energy/ReagentContainerInfo.java | 9 +- .../api/alchemy/energy/ReagentRegistry.java | 70 +- .../api/alchemy/energy/ReagentStack.java | 27 +- .../alchemy/energy/TileReagentHandler.java | 35 +- .../energy/TileSegmentedReagentHandler.java | 149 +- .../api/altarRecipeRegistry/AltarRecipe.java | 157 +- .../AltarRecipeRegistry.java | 80 +- .../api/altarRecipeRegistry/IFadedRune.java | 5 +- .../api/bindingRegistry/BindingRecipe.java | 15 +- .../api/bindingRegistry/BindingRegistry.java | 42 +- .../api/bindingRegistry/UnbindingRecipe.java | 18 +- .../bindingRegistry/UnbindingRegistry.java | 49 +- .../api/command/SubCommandBase.java | 50 +- .../api/compress/CompressionHandler.java | 15 +- .../api/compress/CompressionRegistry.java | 94 +- .../api/event/AddToNetworkEvent.java | 58 +- .../api/event/ItemBindEvent.java | 26 +- .../api/event/ItemDrainInContainerEvent.java | 17 +- .../api/event/ItemDrainNetworkEvent.java | 44 +- .../api/event/PlayerAddToNetworkEvent.java | 22 +- .../api/event/PlayerDrainNetworkEvent.java | 26 +- .../api/event/RitualActivatedEvent.java | 36 +- .../api/event/RitualEvent.java | 22 +- .../api/event/RitualRunEvent.java | 12 +- .../api/event/RitualStopEvent.java | 17 +- .../api/event/SacrificeKnifeUsedEvent.java | 28 +- .../api/event/SoulNetworkEvent.java | 38 +- .../api/event/TeleposeEvent.java | 90 +- .../api/guide/OrbRecipeRenderer.java | 109 +- .../api/guide/PageAltarRecipe.java | 76 +- .../api/guide/PageMultiBlock.java | 244 +- .../api/guide/PageRitualMultiBlock.java | 168 +- .../api/harvest/HarvestRegistry.java | 20 +- .../api/harvest/IHarvestHandler.java | 3 +- .../api/items/IAltarManipulator.java | 5 +- .../api/items/ItemSpellMultiTool.java | 505 +- .../api/items/ShapedBloodOrbRecipe.java | 179 +- .../api/items/ShapelessBloodOrbRecipe.java | 120 +- .../api/items/interfaces/ArmourUpgrade.java | 5 +- .../api/items/interfaces/IBindable.java | 4 +- .../api/items/interfaces/IBloodOrb.java | 3 +- .../api/items/interfaces/IHolding.java | 5 +- .../api/items/interfaces/ILPGauge.java | 5 +- .../items/interfaces/IReagentManipulator.java | 5 +- .../api/items/interfaces/IRitualDiviner.java | 23 +- .../api/items/interfaces/ISigil.java | 3 +- .../alchemicalWizardry/api/package-info.java | 3 +- .../api/renderer/MRSRenderer.java | 11 +- .../api/rituals/IMasterRitualStone.java | 11 +- .../api/rituals/IRitualStone.java | 25 +- .../api/rituals/ITileRitualStone.java | 3 +- .../api/rituals/LocalRitualStorage.java | 57 +- .../api/rituals/RitualBreakMethod.java | 15 +- .../api/rituals/RitualComponent.java | 70 +- .../api/rituals/RitualEffect.java | 89 +- .../api/rituals/Rituals.java | 286 +- .../api/sacrifice/IIncense.java | 34 +- .../api/sacrifice/PlayerSacrificeHandler.java | 126 +- .../soulNetwork/ComplexNetworkHandler.java | 134 +- .../api/soulNetwork/LifeEssenceNetwork.java | 12 +- .../api/soulNetwork/SoulNetworkHandler.java | 338 +- .../api/spell/APISpellHelper.java | 525 +- .../api/spell/ComplexSpellEffect.java | 168 +- .../api/spell/ComplexSpellModifier.java | 11 +- .../api/spell/ComplexSpellType.java | 11 +- .../api/spell/EntitySpellProjectile.java | 375 +- .../spell/ExtrapolatedMeleeEntityEffect.java | 38 +- .../api/spell/IDigAreaEffect.java | 13 +- .../api/spell/IItemManipulator.java | 6 +- .../api/spell/ILeftClickEffect.java | 3 +- .../api/spell/IMeleeSpellEntityEffect.java | 3 +- .../api/spell/IMeleeSpellWorldEffect.java | 3 +- .../api/spell/IOnBanishTool.java | 3 +- .../api/spell/IOnBreakBlock.java | 14 +- .../api/spell/IOnSummonTool.java | 3 +- .../api/spell/IProjectileImpactEffect.java | 3 +- .../api/spell/IProjectileUpdateEffect.java | 3 +- .../api/spell/IRightClickEffect.java | 5 +- .../api/spell/ISelfSpellEffect.java | 3 +- .../api/spell/ISpecialDamageEffect.java | 3 +- .../api/spell/IToolUpdateEffect.java | 3 +- .../spell/MeleeSpellCenteredWorldEffect.java | 12 +- .../api/spell/MeleeSpellWorldEffect.java | 6 +- .../api/spell/ProjectileImpactEffect.java | 6 +- .../api/spell/ProjectileUpdateEffect.java | 6 +- .../api/spell/SelfSpellEffect.java | 6 +- .../api/spell/SpellEffect.java | 202 +- .../api/spell/SpellEffectRegistry.java | 276 +- .../api/spell/SpellEnhancement.java | 9 +- .../api/spell/SpellEnhancementCost.java | 6 +- .../api/spell/SpellEnhancementPotency.java | 6 +- .../api/spell/SpellEnhancementPower.java | 6 +- .../api/spell/SpellParadigm.java | 81 +- .../api/spell/SpellParadigmMelee.java | 49 +- .../api/spell/SpellParadigmProjectile.java | 53 +- .../api/spell/SpellParadigmSelf.java | 39 +- .../api/spell/SpellParadigmTool.java | 253 +- .../summoningRegistry/SummoningHelper.java | 9 +- .../summoningRegistry/SummoningRegistry.java | 64 +- .../SummoningRegistryComponent.java | 125 +- .../api/tile/IBloodAltar.java | 33 +- .../api/tile/ISpellParadigmTile.java | 5 +- .../api/tile/ISpellTile.java | 11 +- .../client/ClientEventHandler.java | 159 +- .../client/ClientProxy.java | 147 +- .../client/ClientUtils.java | 242 +- .../client/KeyBindings.java | 17 +- .../client/POVArmourModelWrapper.java | 43 +- .../client/gui/ConfigGui.java | 50 +- .../client/gui/ConfigGuiFactory.java | 33 +- .../client/nei/NEIAlchemyRecipeHandler.java | 19 +- .../client/nei/NEIAltarRecipeHandler.java | 192 +- .../client/nei/NEIBindingRitualHandler.java | 72 +- .../client/nei/NEIBloodOrbShapedHandler.java | 208 +- .../nei/NEIBloodOrbShapelessHandler.java | 118 +- .../client/nei/NEIConfig.java | 109 +- .../client/nei/NEIMeteorRecipeHandler.java | 32 +- .../client/nei/TooltipStack.java | 3 +- .../client/renderer/ColourThreshold.java | 29 +- .../client/renderer/HUDElement.java | 98 +- .../client/renderer/HUDUtils.java | 240 +- .../client/renderer/RenderFakeBlocks.java | 27 +- .../client/renderer/RenderHelper.java | 317 +- .../client/renderer/RitualDivinerRender.java | 57 +- .../common/AlchemicalWizardryEventHooks.java | 1654 +++---- .../common/AlchemicalWizardryFuelHandler.java | 30 +- .../common/ArmourComponent.java | 12 +- .../common/ClientToServerPacketHandler.java | 8 +- .../common/CommonProxy.java | 115 +- .../common/CoordAndRange.java | 17 +- .../common/EntityAITargetAggro.java | 9 +- .../common/EntityAITargetAggroCloaking.java | 42 +- .../common/IBindingAgent.java | 3 +- .../alchemicalWizardry/common/ICatalyst.java | 3 +- .../alchemicalWizardry/common/IDemon.java | 7 +- .../common/IFillingAgent.java | 3 +- .../alchemicalWizardry/common/ItemType.java | 66 +- .../common/LifeBucketHandler.java | 25 +- .../common/LifeEssence.java | 12 +- .../common/MessageKeyPressed.java | 57 +- .../common/ModLivingDropsEvent.java | 20 +- .../common/NewPacketHandler.java | 723 ++- .../common/PlinthComponent.java | 18 +- .../achievements/AchievementTrigger.java | 39 +- .../common/achievements/AchievementsMod.java | 17 +- .../achievements/AchievementsRegistry.java | 45 +- .../common/achievements/ModAchievements.java | 17 +- .../alchemy/CombinedPotionComponent.java | 12 +- .../alchemy/CombinedPotionRegistry.java | 108 +- .../alchemy/ICombinationalCatalyst.java | 4 +- .../common/block/ArmourForge.java | 119 +- .../common/block/BlockAlchemicCalcinator.java | 86 +- .../common/block/BlockAltar.java | 159 +- .../common/block/BlockBelljar.java | 126 +- .../common/block/BlockBloodLightSource.java | 52 +- .../common/block/BlockConduit.java | 35 +- .../common/block/BlockCrucible.java | 183 +- .../common/block/BlockCrystal.java | 34 +- .../common/block/BlockDemonPortal.java | 47 +- .../common/block/BlockEnchantmentGlyph.java | 126 +- .../common/block/BlockHomHeart.java | 36 +- .../common/block/BlockMasterStone.java | 48 +- .../common/block/BlockOrientable.java | 48 +- .../common/block/BlockPedestal.java | 85 +- .../common/block/BlockPlinth.java | 85 +- .../common/block/BlockReagentConduit.java | 47 +- .../common/block/BlockSchematicSaver.java | 19 +- .../common/block/BlockSocket.java | 74 +- .../common/block/BlockSpectralContainer.java | 44 +- .../common/block/BlockSpellEffect.java | 34 +- .../common/block/BlockSpellEnhancement.java | 33 +- .../common/block/BlockSpellModifier.java | 33 +- .../common/block/BlockSpellParadigm.java | 40 +- .../common/block/BlockStabilityGlyph.java | 65 +- .../common/block/BlockTeleposer.java | 228 +- .../common/block/BlockWritingTable.java | 89 +- .../common/block/BloodRune.java | 58 +- .../common/block/BloodStoneBrick.java | 9 +- .../common/block/EfficiencyRune.java | 12 +- .../common/block/EmptySocket.java | 12 +- .../common/block/IOrientable.java | 3 +- .../common/block/ImperfectRitualStone.java | 56 +- .../common/block/LargeBloodStoneBrick.java | 9 +- .../common/block/LifeEssenceBlock.java | 18 +- .../common/block/MimicBlock.java | 276 +- .../common/block/RitualStone.java | 53 +- .../common/block/RuneOfSacrifice.java | 12 +- .../common/block/RuneOfSelfSacrifice.java | 12 +- .../common/block/SpectralBlock.java | 63 +- .../common/block/SpeedRune.java | 12 +- .../bloodAltarUpgrade/AltarComponent.java | 27 +- .../AltarUpgradeComponent.java | 68 +- .../bloodAltarUpgrade/CompatChecks.java | 10 +- .../bloodAltarUpgrade/UpgradedAltars.java | 703 ++- .../common/book/BloodMagicGuide.java | 1466 +++--- .../common/commands/CommandBind.java | 46 +- .../common/commands/CommandBloodMagic.java | 13 +- .../common/commands/CommandSN.java | 93 +- .../common/commands/CommandUnbind.java | 29 +- .../common/commands/sub/SubCommandBind.java | 7 +- .../common/commands/sub/SubCommandHelp.java | 12 +- .../commands/sub/SubCommandNetwork.java | 23 +- .../common/commands/sub/SubCommandOrb.java | 16 +- .../compress/AdvancedCompressionHandler.java | 311 +- .../compress/BaseCompressionHandler.java | 189 +- .../compress/StorageBlockCraftingManager.java | 399 +- ...StorageBlockCraftingRecipeAssimilator.java | 342 +- .../common/demonVillage/BlockSet.java | 257 +- .../demonVillage/BuildingSchematic.java | 117 +- .../common/demonVillage/DemonBuilding.java | 55 +- .../common/demonVillage/DemonCrosspath.java | 11 +- .../common/demonVillage/DemonVillagePath.java | 236 +- .../common/demonVillage/GridSpace.java | 36 +- .../common/demonVillage/GridSpaceHolder.java | 177 +- .../common/demonVillage/TileBlockSet.java | 3 +- .../ai/EntityAIOccasionalRangedAttack.java | 117 +- .../ai/EntityDemonAIHurtByTarget.java | 97 +- .../ai/IOccasionalRangedAttackMob.java | 5 +- .../demonHoard/DemonHoardPacket.java | 28 +- .../demonHoard/DemonPacketMinorGrunt.java | 152 +- .../demonHoard/DemonPacketRegistry.java | 160 +- .../demonVillage/demonHoard/DemonType.java | 13 +- .../demon/EntityMinorDemonGrunt.java | 376 +- .../demon/EntityMinorDemonGruntEarth.java | 48 +- .../demon/EntityMinorDemonGruntFire.java | 42 +- .../demon/EntityMinorDemonGruntGuardian.java | 36 +- .../EntityMinorDemonGruntGuardianEarth.java | 50 +- .../EntityMinorDemonGruntGuardianFire.java | 44 +- .../EntityMinorDemonGruntGuardianIce.java | 40 +- .../EntityMinorDemonGruntGuardianWind.java | 66 +- .../demon/EntityMinorDemonGruntIce.java | 38 +- .../demon/EntityMinorDemonGruntWind.java | 74 +- .../demonHoard/demon/IHoardDemon.java | 8 +- .../loot/DemonVillageLootRegistry.java | 71 +- .../tileEntity/BlockDemonChest.java | 61 +- .../tileEntity/IBlockPortalNode.java | 5 +- .../demonVillage/tileEntity/IRoadWard.java | 5 +- .../tileEntity/ITilePortalNode.java | 5 +- .../demonVillage/tileEntity/TEDemonChest.java | 116 +- .../tileEntity/TEDemonPortal.java | 1509 +++--- .../common/entity/mob/BookEntityItem.java | 83 +- .../common/entity/mob/EntityAirElemental.java | 24 +- .../common/entity/mob/EntityBileDemon.java | 205 +- .../common/entity/mob/EntityBoulderFist.java | 217 +- .../common/entity/mob/EntityDemon.java | 116 +- .../entity/mob/EntityEarthElemental.java | 17 +- .../common/entity/mob/EntityElemental.java | 320 +- .../common/entity/mob/EntityFallenAngel.java | 212 +- .../entity/mob/EntityFireElemental.java | 17 +- .../entity/mob/EntityHolyElemental.java | 17 +- .../common/entity/mob/EntityIceDemon.java | 227 +- .../entity/mob/EntityLowerGuardian.java | 203 +- .../common/entity/mob/EntityShade.java | 212 +- .../entity/mob/EntityShadeElemental.java | 17 +- .../entity/mob/EntitySmallEarthGolem.java | 206 +- .../entity/mob/EntityWaterElemental.java | 20 +- .../entity/mob/EntityWingedFireDemon.java | 208 +- .../entity/mob/MailOrderEntityItem.java | 131 +- .../projectile/EnergyBlastProjectile.java | 270 +- .../entity/projectile/EntityBeamParticle.java | 8 +- .../EntityBloodLightProjectile.java | 83 +- .../EntityEnergyBazookaMainProjectile.java | 79 +- ...ntityEnergyBazookaSecondaryProjectile.java | 255 +- .../entity/projectile/EntityMeteor.java | 43 +- .../entity/projectile/EntityParticleBeam.java | 155 +- .../projectile/ExplosionProjectile.java | 85 +- .../entity/projectile/FireProjectile.java | 86 +- .../entity/projectile/HolyProjectile.java | 104 +- .../entity/projectile/IceProjectile.java | 109 +- .../projectile/LightningBoltProjectile.java | 108 +- .../entity/projectile/MudProjectile.java | 110 +- .../entity/projectile/TeleportProjectile.java | 130 +- .../entity/projectile/WaterProjectile.java | 96 +- .../entity/projectile/WindGustProjectile.java | 102 +- .../common/guide/RecipeHolder.java | 427 +- .../harvest/AgriCraftCropHarvestHandler.java | 91 +- .../harvest/BloodMagicHarvestHandler.java | 82 +- .../harvest/CactusReedHarvestHandler.java | 18 +- .../GenericItemStackHarvestHandler.java | 56 +- ...GenericPamSeedlessFruitHarvestHandler.java | 27 +- .../harvest/GenericSeededHarvestHandler.java | 66 +- .../common/harvest/GourdHarvestHandler.java | 14 +- .../harvest/PamHarvestCompatRegistry.java | 21 +- .../common/items/AWBaseItems.java | 27 +- .../common/items/ActivationCrystal.java | 86 +- .../common/items/AirScribeTool.java | 11 +- .../common/items/ApprenticeBloodOrb.java | 9 +- .../common/items/ArchmageBloodOrb.java | 9 +- .../common/items/ArmourInhibitor.java | 84 +- .../common/items/BlankSpell.java | 79 +- .../common/items/BloodShard.java | 34 +- .../common/items/BoundAxe.java | 197 +- .../common/items/BoundPickaxe.java | 226 +- .../common/items/BoundShovel.java | 206 +- .../common/items/CheatyItem.java | 117 +- .../common/items/CreativeDagger.java | 99 +- .../common/items/DaggerOfSacrifice.java | 119 +- .../common/items/DawnScribeTool.java | 11 +- .../common/items/DemonPlacer.java | 186 +- .../items/DemonicTelepositionFocus.java | 30 +- .../common/items/DuskScribeTool.java | 11 +- .../common/items/EarthScribeTool.java | 11 +- .../common/items/EnergyBattery.java | 145 +- .../common/items/EnergyBazooka.java | 148 +- .../common/items/EnergyBlast.java | 137 +- .../common/items/EnergyItems.java | 198 +- .../common/items/EnergySword.java | 170 +- .../items/EnhancedTelepositionFocus.java | 30 +- .../common/items/FireScribeTool.java | 11 +- .../common/items/ItemAlchemyBase.java | 64 +- .../common/items/ItemBlockCrystalBelljar.java | 62 +- .../common/items/ItemBloodLetterPack.java | 180 +- .../common/items/ItemBloodRuneBlock.java | 28 +- .../common/items/ItemComplexSpellCrystal.java | 65 +- .../common/items/ItemComponents.java | 68 +- .../common/items/ItemCrystalBlock.java | 22 +- .../common/items/ItemDiabloKey.java | 67 +- .../items/ItemEnchantmentGlyphBlock.java | 31 +- .../common/items/ItemIncense.java | 308 +- .../common/items/ItemMailOrderCatalogue.java | 47 +- .../common/items/ItemRitualDismantler.java | 68 +- .../common/items/ItemRitualDiviner.java | 584 ++- .../common/items/ItemSpellEffectBlock.java | 21 +- .../items/ItemSpellEnhancementBlock.java | 16 +- .../common/items/ItemSpellModifierBlock.java | 22 +- .../common/items/ItemSpellParadigmBlock.java | 21 +- .../common/items/ItemStabilityGlyphBlock.java | 25 +- .../common/items/LavaCrystal.java | 59 +- .../common/items/LifeBucket.java | 9 +- .../common/items/MagicianBloodOrb.java | 9 +- .../common/items/MasterBloodOrb.java | 9 +- .../common/items/OrbOfTesting.java | 18 +- .../items/ReinforcedTelepositionFocus.java | 30 +- .../common/items/SacrificialDagger.java | 191 +- .../common/items/ScribeTool.java | 30 +- .../common/items/TelepositionFocus.java | 78 +- .../common/items/TranscendentBloodOrb.java | 9 +- .../common/items/WaterScribeTool.java | 9 +- .../common/items/armour/BoundArmour.java | 587 +-- .../common/items/armour/OmegaArmour.java | 777 ++- .../common/items/armour/OmegaArmourEarth.java | 202 +- .../common/items/armour/OmegaArmourFire.java | 262 +- .../common/items/armour/OmegaArmourWater.java | 254 +- .../common/items/armour/OmegaArmourWind.java | 196 +- .../items/energy/ItemAttunedCrystal.java | 217 +- .../items/energy/ItemDestinationClearer.java | 33 +- .../items/energy/ItemTankSegmenter.java | 152 +- .../common/items/forestry/ItemBloodFrame.java | 43 +- .../common/items/potion/AlchemyFlask.java | 252 +- .../common/items/potion/AlchemyReagent.java | 64 +- .../potion/AverageLengtheningCatalyst.java | 11 +- .../items/potion/AveragePowerCatalyst.java | 11 +- .../items/potion/CombinationalCatalyst.java | 9 +- .../items/potion/EnhancedFillingAgent.java | 18 +- .../potion/GreaterLengtheningCatalyst.java | 11 +- .../items/potion/GreaterPowerCatalyst.java | 11 +- .../items/potion/LengtheningCatalyst.java | 37 +- .../potion/MundaneLengtheningCatalyst.java | 9 +- .../items/potion/MundanePowerCatalyst.java | 9 +- .../common/items/potion/PowerCatalyst.java | 38 +- .../items/potion/StandardBindingAgent.java | 37 +- .../items/potion/StandardFillingAgent.java | 18 +- .../common/items/potion/WeakBindingAgent.java | 12 +- .../common/items/potion/WeakFillingAgent.java | 51 +- .../items/routing/ILimitedRoutingFocus.java | 9 +- .../items/routing/InputRoutingFocus.java | 19 +- .../items/routing/OutputRoutingFocus.java | 236 +- .../common/items/routing/RoutingFocus.java | 277 +- .../common/items/sigil/SigilAir.java | 137 +- .../common/items/sigil/SigilBloodLight.java | 109 +- .../common/items/sigil/SigilDivination.java | 105 +- .../common/items/sigil/SigilFluid.java | 427 +- .../common/items/sigil/SigilHarvest.java | 171 +- .../common/items/sigil/SigilLava.java | 172 +- .../items/sigil/SigilOfElementalAffinity.java | 91 +- .../items/sigil/SigilOfEnderSeverance.java | 110 +- .../common/items/sigil/SigilOfGrowth.java | 185 +- .../common/items/sigil/SigilOfHaste.java | 103 +- .../common/items/sigil/SigilOfMagnetism.java | 156 +- .../common/items/sigil/SigilOfSupression.java | 162 +- .../items/sigil/SigilOfTheAssassin.java | 293 +- .../common/items/sigil/SigilOfTheBridge.java | 176 +- .../items/sigil/SigilOfTheFastMiner.java | 101 +- .../common/items/sigil/SigilOfWind.java | 103 +- .../common/items/sigil/SigilPackRat.java | 168 +- .../common/items/sigil/SigilSeer.java | 40 +- .../common/items/sigil/SigilVoid.java | 116 +- .../common/items/sigil/SigilWater.java | 182 +- .../items/sigil/holding/ContainerHolding.java | 135 +- .../items/sigil/holding/GuiHolding.java | 16 +- .../sigil/holding/HoldingPacketHandler.java | 6 +- .../sigil/holding/HoldingPacketProcessor.java | 25 +- .../items/sigil/holding/InventoryHolding.java | 149 +- .../items/sigil/holding/ScrollHelper.java | 18 +- .../items/sigil/holding/SigilOfHolding.java | 213 +- .../items/thaumcraft/ItemSanguineArmour.java | 81 +- .../common/omega/IEnchantmentGlyph.java | 8 +- .../common/omega/IStabilityGlyph.java | 5 +- .../common/omega/OmegaParadigm.java | 322 +- .../common/omega/OmegaParadigmEarth.java | 90 +- .../common/omega/OmegaParadigmFire.java | 111 +- .../common/omega/OmegaParadigmWater.java | 132 +- .../common/omega/OmegaParadigmWind.java | 82 +- .../common/omega/OmegaRegistry.java | 63 +- .../common/omega/OmegaStructureHandler.java | 274 +- .../omega/OmegaStructureParameters.java | 22 +- .../omega/ReagentRegenConfiguration.java | 22 +- .../common/potion/PotionAmphibian.java | 9 +- .../common/potion/PotionBoost.java | 9 +- .../common/potion/PotionDeaf.java | 9 +- .../common/potion/PotionDemonCloak.java | 9 +- .../common/potion/PotionDrowning.java | 9 +- .../common/potion/PotionFeatherFall.java | 9 +- .../common/potion/PotionFireFuse.java | 9 +- .../common/potion/PotionFlameCloak.java | 9 +- .../common/potion/PotionFlight.java | 9 +- .../common/potion/PotionHeavyHeart.java | 9 +- .../common/potion/PotionIceCloak.java | 9 +- .../common/potion/PotionInhibit.java | 9 +- .../common/potion/PotionPlanarBinding.java | 9 +- .../potion/PotionProjectileProtect.java | 9 +- .../common/potion/PotionReciprocation.java | 9 +- .../common/potion/PotionSoulFray.java | 18 +- .../common/potion/PotionSoulHarden.java | 9 +- .../renderer/AlchemyCircleRenderer.java | 51 +- .../common/renderer/BeamRenderer.java | 34 +- .../block/RenderAlchemicCalcinator.java | 180 +- .../common/renderer/block/RenderConduit.java | 22 +- .../renderer/block/RenderCrystalBelljar.java | 31 +- .../renderer/block/RenderMasterStone.java | 14 +- .../common/renderer/block/RenderPedestal.java | 121 +- .../common/renderer/block/RenderPlinth.java | 120 +- .../renderer/block/RenderReagentConduit.java | 21 +- .../block/RenderSpellEffectBlock.java | 25 +- .../block/RenderSpellEnhancementBlock.java | 25 +- .../block/RenderSpellModifierBlock.java | 25 +- .../block/RenderSpellParadigmBlock.java | 25 +- .../renderer/block/RenderWritingTable.java | 152 +- .../renderer/block/TEAltarRenderer.java | 124 +- .../TEAlchemicalCalcinatorItemRenderer.java | 38 +- .../block/itemRender/TEAltarItemRenderer.java | 21 +- .../itemRender/TEBellJarItemRenderer.java | 66 +- .../itemRender/TEConduitItemRenderer.java | 36 +- .../TESpellEffectBlockItemRenderer.java | 40 +- .../TESpellEnhancementBlockItemRenderer.java | 89 +- .../TESpellModifierBlockItemRenderer.java | 40 +- .../TESpellParadigmBlockItemRenderer.java | 40 +- .../TEWritingTableItemRenderer.java | 32 +- .../common/renderer/mob/RenderBileDemon.java | 17 +- .../renderer/mob/RenderBoulderFist.java | 15 +- .../common/renderer/mob/RenderElemental.java | 50 +- .../renderer/mob/RenderFallenAngel.java | 15 +- .../common/renderer/mob/RenderIceDemon.java | 15 +- .../renderer/mob/RenderLowerGuardian.java | 15 +- .../renderer/mob/RenderMinorDemonGrunt.java | 59 +- .../mob/RenderMinorDemonGruntGuardian.java | 59 +- .../common/renderer/mob/RenderShade.java | 17 +- .../renderer/mob/RenderSmallEarthGolem.java | 15 +- .../renderer/mob/RenderWingedFireDemon.java | 15 +- .../model/ModelAlchemicalCalcinator.java | 18 +- .../common/renderer/model/ModelBileDemon.java | 19 +- .../renderer/model/ModelBloodAltar.java | 38 +- .../renderer/model/ModelBoulderFist.java | 19 +- .../common/renderer/model/ModelConduit.java | 44 +- .../renderer/model/ModelCrystalBelljar.java | 27 +- .../common/renderer/model/ModelElemental.java | 20 +- .../ModelEnergyBazookaMainProjectile.java | 19 +- .../renderer/model/ModelFallenAngel.java | 17 +- .../common/renderer/model/ModelIceDemon.java | 17 +- .../renderer/model/ModelLowerGuardian.java | 28 +- .../common/renderer/model/ModelMeteor.java | 17 +- .../renderer/model/ModelMinorDemonGrunt.java | 184 +- .../model/ModelMinorDemonGruntGuardian.java | 311 +- .../renderer/model/ModelOmegaArmour.java | 306 +- .../renderer/model/ModelOmegaEarth.java | 42 +- .../common/renderer/model/ModelOmegaFire.java | 40 +- .../renderer/model/ModelOmegaWater.java | 863 ++-- .../common/renderer/model/ModelOmegaWind.java | 31 +- .../common/renderer/model/ModelPedestal.java | 17 +- .../common/renderer/model/ModelPlinth.java | 17 +- .../common/renderer/model/ModelShade.java | 17 +- .../renderer/model/ModelSmallEarthGolem.java | 19 +- .../renderer/model/ModelSpellEffectBlock.java | 33 +- .../model/ModelSpellEnhancementBlock.java | 34 +- .../model/ModelSpellModifierBlock.java | 35 +- .../model/ModelSpellParadigmBlock.java | 44 +- .../renderer/model/ModelWingedFireDemon.java | 19 +- .../renderer/model/ModelWritingTable.java | 17 +- .../RenderEnergyBazookaMainProjectile.java | 18 +- .../RenderEnergyBlastProjectile.java | 40 +- .../projectile/RenderFireProjectile.java | 68 +- .../renderer/projectile/RenderMeteor.java | 18 +- .../common/rituals/LocalStorageAlphaPact.java | 29 +- .../common/rituals/RitualEffectAlphaPact.java | 174 +- .../rituals/RitualEffectAnimalGrowth.java | 78 +- .../rituals/RitualEffectApiaryOverclock.java | 27 +- .../rituals/RitualEffectAutoAlchemy.java | 283 +- .../common/rituals/RitualEffectBinding.java | 73 +- .../rituals/RitualEffectBiomeChanger.java | 186 +- .../rituals/RitualEffectContainment.java | 63 +- .../common/rituals/RitualEffectCrafting.java | 674 ++- .../common/rituals/RitualEffectCrushing.java | 243 +- .../rituals/RitualEffectDemonPortal.java | 235 +- .../common/rituals/RitualEffectEllipsoid.java | 272 +- .../rituals/RitualEffectEvaporation.java | 122 +- .../common/rituals/RitualEffectExpulsion.java | 196 +- .../rituals/RitualEffectFeatheredEarth.java | 74 +- .../rituals/RitualEffectFeatheredKnife.java | 77 +- .../common/rituals/RitualEffectFlight.java | 56 +- .../rituals/RitualEffectFullStomach.java | 72 +- .../common/rituals/RitualEffectGrowth.java | 108 +- .../common/rituals/RitualEffectHarvest.java | 60 +- .../common/rituals/RitualEffectHealing.java | 88 +- .../rituals/RitualEffectInterdiction.java | 69 +- .../rituals/RitualEffectItemRouting.java | 420 +- .../rituals/RitualEffectItemSuction.java | 77 +- .../common/rituals/RitualEffectJumping.java | 65 +- .../common/rituals/RitualEffectLava.java | 80 +- .../common/rituals/RitualEffectLeap.java | 111 +- .../rituals/RitualEffectLifeConduit.java | 84 +- .../common/rituals/RitualEffectMagnetic.java | 204 +- .../rituals/RitualEffectOmegaStalling.java | 77 +- .../common/rituals/RitualEffectOmegaTest.java | 315 +- .../common/rituals/RitualEffectSpawnWard.java | 49 +- .../rituals/RitualEffectSphereCreator.java | 251 +- .../rituals/RitualEffectSummonMeteor.java | 32 +- .../rituals/RitualEffectSupression.java | 91 +- .../common/rituals/RitualEffectUnbinding.java | 110 +- .../rituals/RitualEffectVeilOfEvil.java | 48 +- .../common/rituals/RitualEffectWater.java | 136 +- .../rituals/RitualEffectWellOfSuffering.java | 71 +- .../routing/RoutingFocusLogicIgnMeta.java | 12 +- .../routing/RoutingFocusLogicLimit.java | 10 +- .../RoutingFocusLogicLimitDefault.java | 37 +- .../routing/RoutingFocusLogicLimitGlobal.java | 50 +- .../RoutingFocusLogicLimitIgnMeta.java | 37 +- .../RoutingFocusLogicLimitMatchNBT.java | 39 +- .../RoutingFocusLogicLimitModItems.java | 39 +- .../routing/RoutingFocusLogicMatchNBT.java | 28 +- .../routing/RoutingFocusLogicModItems.java | 56 +- .../effect/OutputRoutingFocusModItems.java | 21 +- .../spell/complex/effect/SpellHelper.java | 993 ++-- .../cse/earth/CSEMeleeDefaultEarth.java | 62 +- .../cse/earth/CSEMeleeDefensiveEarth.java | 62 +- .../cse/earth/CSEMeleeEnvironmentalEarth.java | 62 +- .../cse/earth/CSEMeleeOffensiveEarth.java | 62 +- .../cse/earth/CSEProjectileDefaultEarth.java | 57 +- .../earth/CSEProjectileDefensiveEarth.java | 64 +- .../CSEProjectileEnvironmentalEarth.java | 63 +- .../earth/CSEProjectileOffensiveEarth.java | 62 +- .../effect/cse/earth/CSESelfDefaultEarth.java | 62 +- .../cse/earth/CSESelfDefensiveEarth.java | 62 +- .../cse/earth/CSESelfEnvironmentalEarth.java | 64 +- .../cse/earth/CSESelfOffensiveEarth.java | 62 +- .../effect/cse/earth/CSEToolDefaultEarth.java | 105 +- .../cse/earth/CSEToolDefensiveEarth.java | 105 +- .../cse/earth/CSEToolEnvironmentalEarth.java | 62 +- .../cse/earth/CSEToolOffensiveEarth.java | 57 +- .../effect/cse/fire/CSEMeleeDefaultFire.java | 63 +- .../cse/fire/CSEMeleeDefensiveFire.java | 61 +- .../cse/fire/CSEMeleeEnvironmentalFire.java | 63 +- .../cse/fire/CSEMeleeOffensiveFire.java | 61 +- .../cse/fire/CSEProjectileDefaultFire.java | 64 +- .../cse/fire/CSEProjectileDefensiveFire.java | 64 +- .../fire/CSEProjectileEnvironmentalFire.java | 64 +- .../cse/fire/CSEProjectileOffensiveFire.java | 64 +- .../effect/cse/fire/CSESelfDefaultFire.java | 63 +- .../effect/cse/fire/CSESelfDefensiveFire.java | 63 +- .../cse/fire/CSESelfEnvironmentalFire.java | 62 +- .../effect/cse/fire/CSESelfOffensiveFire.java | 61 +- .../effect/cse/fire/CSEToolDefaultFire.java | 59 +- .../effect/cse/fire/CSEToolDefensiveFire.java | 68 +- .../cse/fire/CSEToolEnvironmentalFire.java | 65 +- .../effect/cse/fire/CSEToolOffensiveFire.java | 68 +- .../effect/cse/ice/CSEMeleeDefaultIce.java | 59 +- .../effect/cse/ice/CSEMeleeDefensiveIce.java | 65 +- .../cse/ice/CSEMeleeEnvironmentalIce.java | 64 +- .../effect/cse/ice/CSEMeleeOffensiveIce.java | 64 +- .../cse/ice/CSEProjectileDefaultIce.java | 61 +- .../cse/ice/CSEProjectileDefensiveIce.java | 64 +- .../ice/CSEProjectileEnvironmentalIce.java | 64 +- .../cse/ice/CSEProjectileOffensiveIce.java | 64 +- .../effect/cse/ice/CSESelfDefaultIce.java | 59 +- .../effect/cse/ice/CSESelfDefensiveIce.java | 62 +- .../cse/ice/CSESelfEnvironmentalIce.java | 62 +- .../effect/cse/ice/CSESelfOffensiveIce.java | 64 +- .../effect/cse/ice/CSEToolDefaultIce.java | 71 +- .../effect/cse/ice/CSEToolDefensiveIce.java | 64 +- .../cse/ice/CSEToolEnvironmentalIce.java | 62 +- .../effect/cse/ice/CSEToolOffensiveIce.java | 68 +- .../effect/cse/wind/CSEMeleeDefaultWind.java | 62 +- .../cse/wind/CSEMeleeDefensiveWind.java | 64 +- .../cse/wind/CSEMeleeEnvironmentalWind.java | 64 +- .../cse/wind/CSEMeleeOffensiveWind.java | 64 +- .../cse/wind/CSEProjectileDefaultWind.java | 59 +- .../cse/wind/CSEProjectileDefensiveWind.java | 57 +- .../wind/CSEProjectileEnvironmentalWind.java | 62 +- .../cse/wind/CSEProjectileOffensiveWind.java | 64 +- .../effect/cse/wind/CSESelfDefaultWind.java | 59 +- .../effect/cse/wind/CSESelfDefensiveWind.java | 64 +- .../cse/wind/CSESelfEnvironmentalWind.java | 64 +- .../effect/cse/wind/CSESelfOffensiveWind.java | 59 +- .../effect/cse/wind/CSEToolDefaultWind.java | 105 +- .../effect/cse/wind/CSEToolDefensiveWind.java | 68 +- .../cse/wind/CSEToolEnvironmentalWind.java | 59 +- .../effect/cse/wind/CSEToolOffensiveWind.java | 61 +- .../earth/MeleeDefaultEarth.java | 28 +- .../earth/MeleeDefensiveEarth.java | 29 +- .../earth/MeleeEnvironmentalEarth.java | 30 +- .../earth/MeleeOffensiveEarth.java | 18 +- .../earth/ProjectileDefaultEarth.java | 37 +- .../earth/ProjectileDefensiveEarth.java | 38 +- .../earth/ProjectileEnvironmentalEarth.java | 48 +- .../earth/ProjectileOffensiveEarth.java | 36 +- .../impactEffects/earth/SelfDefaultEarth.java | 28 +- .../earth/SelfDefensiveEarth.java | 9 +- .../earth/SelfEnvironmentalEarth.java | 26 +- .../earth/SelfOffensiveEarth.java | 21 +- .../earth/ToolEnvironmentalEarth.java | 32 +- .../earth/ToolOffensiveEarth.java | 35 +- .../impactEffects/fire/MeleeDefaultFire.java | 12 +- .../fire/MeleeDefensiveFire.java | 30 +- .../fire/MeleeEnvironmentalFire.java | 18 +- .../fire/MeleeOffensiveFire.java | 22 +- .../fire/ProjectileDefaultFire.java | 36 +- .../fire/ProjectileDefensiveFire.java | 24 +- .../fire/ProjectileEnvironmentalFire.java | 21 +- .../fire/ProjectileOffensiveFire.java | 25 +- .../impactEffects/fire/SelfDefaultFire.java | 9 +- .../impactEffects/fire/SelfDefensiveFire.java | 21 +- .../fire/SelfEnvironmentalFire.java | 35 +- .../impactEffects/fire/SelfOffensiveFire.java | 14 +- .../impactEffects/fire/ToolDefaultFire.java | 24 +- .../fire/ToolEnvironmentalFire.java | 36 +- .../impactEffects/fire/ToolOffensiveFire.java | 9 +- .../impactEffects/ice/MeleeDefaultIce.java | 12 +- .../impactEffects/ice/MeleeDefensiveIce.java | 18 +- .../ice/MeleeEnvironmentalIce.java | 18 +- .../impactEffects/ice/MeleeOffensiveIce.java | 16 +- .../ice/ProjectileDefaultIce.java | 17 +- .../ice/ProjectileDefensiveIce.java | 27 +- .../ice/ProjectileEnvironmentalIce.java | 18 +- .../ice/ProjectileOffensiveIce.java | 21 +- .../impactEffects/ice/SelfDefaultIce.java | 15 +- .../impactEffects/ice/SelfDefensiveIce.java | 12 +- .../ice/SelfEnvironmentalIce.java | 25 +- .../impactEffects/ice/SelfOffensiveIce.java | 31 +- .../impactEffects/ice/ToolDefaultIce.java | 9 +- .../impactEffects/ice/ToolDefensiveIce.java | 37 +- .../impactEffects/tool/DigAreaEffect.java | 92 +- .../impactEffects/tool/DigAreaTunnel.java | 86 +- .../impactEffects/tool/ItemManipulator.java | 12 +- .../impactEffects/tool/LeftClickEffect.java | 6 +- .../tool/OnBreakBlockEffect.java | 6 +- .../impactEffects/tool/RightClickEffect.java | 6 +- .../impactEffects/tool/RightClickTunnel.java | 80 +- .../impactEffects/tool/SummonToolEffect.java | 6 +- .../impactEffects/wind/MeleeDefaultWind.java | 14 +- .../wind/MeleeDefensiveWind.java | 12 +- .../wind/MeleeEnvironmentalWind.java | 18 +- .../wind/MeleeOffensiveWind.java | 14 +- .../wind/ProjectileDefaultWind.java | 14 +- .../wind/ProjectileEnvironmentalWind.java | 32 +- .../wind/ProjectileOffensiveWind.java | 28 +- .../impactEffects/wind/SelfDefaultWind.java | 9 +- .../impactEffects/wind/SelfDefensiveWind.java | 22 +- .../wind/SelfEnvironmentalWind.java | 20 +- .../impactEffects/wind/SelfOffensiveWind.java | 12 +- .../impactEffects/wind/ToolDefensiveWind.java | 9 +- .../wind/ToolEnvironmentalWind.java | 30 +- .../impactEffects/wind/ToolOffensiveWind.java | 14 +- .../common/spell/simple/HomSpell.java | 99 +- .../spell/simple/HomSpellComponent.java | 12 +- .../common/spell/simple/HomSpellRegistry.java | 41 +- .../common/spell/simple/ISimpleSpell.java | 3 +- .../common/spell/simple/SpellEarthBender.java | 177 +- .../common/spell/simple/SpellExplosions.java | 84 +- .../common/spell/simple/SpellFireBurst.java | 123 +- .../common/spell/simple/SpellFrozenWater.java | 214 +- .../common/spell/simple/SpellHolyBlast.java | 164 +- .../spell/simple/SpellLightningBolt.java | 112 +- .../common/spell/simple/SpellTeleport.java | 204 +- .../common/spell/simple/SpellWateryGrave.java | 156 +- .../common/spell/simple/SpellWindGust.java | 162 +- .../summoning/SummoningFallenAngel.java | 9 +- .../common/summoning/SummoningHelperAW.java | 95 +- .../common/summoning/meteor/Meteor.java | 20 +- .../summoning/meteor/MeteorParadigm.java | 123 +- .../meteor/MeteorParadigmComponent.java | 30 +- .../summoning/meteor/MeteorRegistry.java | 41 +- .../tileEntity/TEAlchemicCalcinator.java | 180 +- .../common/tileEntity/TEAltar.java | 642 ++- .../common/tileEntity/TEBellJar.java | 53 +- .../common/tileEntity/TEConduit.java | 19 +- .../common/tileEntity/TECrucible.java | 402 +- .../common/tileEntity/TEHomHeart.java | 86 +- .../common/tileEntity/TEInventory.java | 85 +- .../common/tileEntity/TEMasterStone.java | 451 +- .../common/tileEntity/TEMimicBlock.java | 197 +- .../common/tileEntity/TEOrientable.java | 43 +- .../common/tileEntity/TEPedestal.java | 88 +- .../common/tileEntity/TEPlinth.java | 357 +- .../common/tileEntity/TEReagentConduit.java | 290 +- .../common/tileEntity/TESchematicSaver.java | 88 +- .../common/tileEntity/TESocket.java | 78 +- .../common/tileEntity/TESpectralBlock.java | 40 +- .../tileEntity/TESpectralContainer.java | 69 +- .../common/tileEntity/TESpellBlock.java | 23 +- .../common/tileEntity/TESpellEffectBlock.java | 18 +- .../tileEntity/TESpellEnhancementBlock.java | 50 +- .../tileEntity/TESpellModifierBlock.java | 18 +- .../tileEntity/TESpellParadigmBlock.java | 42 +- .../common/tileEntity/TETeleposer.java | 222 +- .../common/tileEntity/TEWritingTable.java | 588 ++- .../tileEntity/container/ContainerAltar.java | 55 +- .../container/ContainerTeleposer.java | 60 +- .../container/ContainerWritingTable.java | 53 +- .../common/tileEntity/gui/GuiHandler.java | 44 +- .../common/tileEntity/gui/GuiTeleposer.java | 20 +- .../tileEntity/gui/GuiWritingTable.java | 28 +- .../common/tweaker/Alchemy.java | 79 +- .../common/tweaker/Binding.java | 76 +- .../common/tweaker/BloodAltar.java | 82 +- .../common/tweaker/BloodOrb.java | 71 +- .../common/tweaker/FallingTower.java | 75 +- .../common/tweaker/HarvestMoon.java | 46 +- .../common/tweaker/MTHelper.java | 3 +- .../tweaker/MineTweakerIntegration.java | 16 +- 795 files changed, 33663 insertions(+), 37253 deletions(-) diff --git a/src/api/java/pneumaticCraft/api/IHeatExchangerLogic.java b/src/api/java/pneumaticCraft/api/IHeatExchangerLogic.java index 78f8dbec..30e3ee3e 100644 --- a/src/api/java/pneumaticCraft/api/IHeatExchangerLogic.java +++ b/src/api/java/pneumaticCraft/api/IHeatExchangerLogic.java @@ -9,7 +9,7 @@ import net.minecraftforge.common.util.ForgeDirection; * @author MineMaarten * www.minemaarten.com */ -public interface IHeatExchangerLogic{ +public interface IHeatExchangerLogic { /** * Call this to tick this logic, and make the heat disperse itself. @@ -19,7 +19,7 @@ public interface IHeatExchangerLogic{ /** * When called (preferably on tile entity load and neighbor block/tile entity change) this will add all IHeatExchanger neighbor TileEntities as connected heat exchangers. * It will also take care of blocks like Lava. - * + * * You don't _have_ to call this method, if this heat exchanger is not connected to the outside world (for example the heat of the liquid * plastic in the Plastic Mixer). * @param world @@ -32,7 +32,7 @@ public interface IHeatExchangerLogic{ public void initializeAsHull(World world, int x, int y, int z, ForgeDirection... validSides); /** - * When called, this will connect these two heat exchangers. You should only call this on one of the two heat exchangers. + * When called, this will connect these two heat exchangers. You should only call this on one of the two heat exchangers. * @param exchanger */ public void addConnectedExchanger(IHeatExchangerLogic exchanger); @@ -73,5 +73,4 @@ public interface IHeatExchangerLogic{ * @param amount */ public void addHeat(double amount); - } diff --git a/src/api/java/pneumaticCraft/api/PneumaticRegistry.java b/src/api/java/pneumaticCraft/api/PneumaticRegistry.java index f3254829..996a582d 100644 --- a/src/api/java/pneumaticCraft/api/PneumaticRegistry.java +++ b/src/api/java/pneumaticCraft/api/PneumaticRegistry.java @@ -1,7 +1,6 @@ package pneumaticCraft.api; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCreature; @@ -20,7 +19,7 @@ import pneumaticCraft.api.item.IInventoryItem; /** * This class can be used to register and access various things to and from the mod. */ -public class PneumaticRegistry{ +public class PneumaticRegistry { /** * This field, which is initialized in PneumaticCraft's preInit, will give you access to various registration and access options. * @deprecated This field isn't going to be removed, but it'll be marked private. use getInstance(). @@ -28,15 +27,15 @@ public class PneumaticRegistry{ @Deprecated public static IPneumaticCraftInterface instance; - public static IPneumaticCraftInterface getInstance(){ + public static IPneumaticCraftInterface getInstance() { return instance; } - public static void init(IPneumaticCraftInterface inter){ - if(instance == null) instance = inter;//only allow initialization once; by PneumaticCraft + public static void init(IPneumaticCraftInterface inter) { + if (instance == null) instance = inter; // only allow initialization once; by PneumaticCraft } - public static interface IPneumaticCraftInterface{ + public static interface IPneumaticCraftInterface { /* * ------------- Pneumatic Helmet -------------- @@ -83,10 +82,10 @@ public class PneumaticRegistry{ * y level, and drop the deliveredStacks. When there isn't a clear path for the items to fall these 5 blocks the Drone will deliver at a * y level above the specified y that _is_ clear. If no clear blocks can be found (when there are only solid blocks), the Drone will * drop the items very high up in the air instead, and drop them there. - * + * * When the Drone is tried to be catched by a player (by wrenching it), the drone will only the drop the items that it was delivering (or * none if it dropped those items already). The Drone itself never will be dropped. - * + * * @param x * @param y * @param z @@ -138,7 +137,8 @@ public class PneumaticRegistry{ * @return The amount of Security Stations that disallow interaction for the given player. * This method throws an IllegalArgumentException when tried to be called from the client side! */ - public int getProtectingSecurityStations(World world, int x, int y, int z, EntityPlayer player, boolean showRangeLines); + public int getProtectingSecurityStations( + World world, int x, int y, int z, EntityPlayer player, boolean showRangeLines); /** * Use this to register ISimpleBlockRenderHandler render id's of full blocks, those of which should be able to be used for the Pneumatic Door Base camouflage. @@ -153,6 +153,5 @@ public class PneumaticRegistry{ * @param liquidToPointRatio The amount of liquid (in mB) used to get one XP point. In OpenBlocks this is 20 (mB/point). */ public void registerXPLiquid(Fluid fluid, int liquidToPointRatio); - } } diff --git a/src/api/java/pneumaticCraft/api/actuator/IActuator.java b/src/api/java/pneumaticCraft/api/actuator/IActuator.java index 93ea61a2..56661193 100644 --- a/src/api/java/pneumaticCraft/api/actuator/IActuator.java +++ b/src/api/java/pneumaticCraft/api/actuator/IActuator.java @@ -1,10 +1,9 @@ package pneumaticCraft.api.actuator; import java.util.List; - import net.minecraft.tileentity.TileEntity; -public interface IActuator{ +public interface IActuator { /** * Same as {@link pneumaticCraft.api.universalSensor.ISensorSetting#getSensorPath()} * @return @@ -25,7 +24,7 @@ public interface IActuator{ public List getDescription(); /** - * + * * @param universalActuator */ public void actuate(TileEntity universalActuator); diff --git a/src/api/java/pneumaticCraft/api/block/BlockSupplier.java b/src/api/java/pneumaticCraft/api/block/BlockSupplier.java index 0e35540d..7f870e89 100644 --- a/src/api/java/pneumaticCraft/api/block/BlockSupplier.java +++ b/src/api/java/pneumaticCraft/api/block/BlockSupplier.java @@ -1,16 +1,16 @@ package pneumaticCraft.api.block; -import net.minecraft.block.Block; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; -public class BlockSupplier{ +public class BlockSupplier { // private static Class blockClass; /** * @param blockName * @return */ - public static Block getBlock(String blockName){ + public static Block getBlock(String blockName) { return GameRegistry.findBlock("PneumaticCraft", blockName); /*try { if(blockClass == null) blockClass = Class.forName("pneumaticCraft.common.block.Blockss"); @@ -22,56 +22,56 @@ public class BlockSupplier{ } /* - The following is a list of all the block names that can be passed as argument in getBlock(String) to get a PneumaticCraft block. - - - pressureTube meta = tube type - airCompressor - airCannon - pressureChamberWall meta < 6 ? wall : window - pressureChamberValve - pressureChamberInterface - squidPlant - fireFlower - creeperPlant - slimePlant - rainPlant - enderPlant - lightningPlant - adrenalinePlant - burstPlant - potionPlant - repulsionPlant - heliumPlant - flyingFlower - musicPlant - propulsionPlant - chopperPlant - chargingStation - elevatorBase - elevatorFrame - vacuumPump - pneumaticDoorBase - pneumaticDoor - assemblyPlatform - assemblyIOUnit - assemblyDrill - assemblyLaser - assemblyController - advancedPressureTube meta = tube type (like 'pressureTube') - compressedIron - uvLightBox - etchingAcid - securityStation - universalSensor - pneumaticGenerator - electricCompressor - pneumaticEngine - kineticCompressor - aerialInterface - electrostaticCompressor - aphorismTile - omnidirectionalHopper + The following is a list of all the block names that can be passed as argument in getBlock(String) to get a PneumaticCraft block. - */ + + pressureTube meta = tube type + airCompressor + airCannon + pressureChamberWall meta < 6 ? wall : window + pressureChamberValve + pressureChamberInterface + squidPlant + fireFlower + creeperPlant + slimePlant + rainPlant + enderPlant + lightningPlant + adrenalinePlant + burstPlant + potionPlant + repulsionPlant + heliumPlant + flyingFlower + musicPlant + propulsionPlant + chopperPlant + chargingStation + elevatorBase + elevatorFrame + vacuumPump + pneumaticDoorBase + pneumaticDoor + assemblyPlatform + assemblyIOUnit + assemblyDrill + assemblyLaser + assemblyController + advancedPressureTube meta = tube type (like 'pressureTube') + compressedIron + uvLightBox + etchingAcid + securityStation + universalSensor + pneumaticGenerator + electricCompressor + pneumaticEngine + kineticCompressor + aerialInterface + electrostaticCompressor + aphorismTile + omnidirectionalHopper + + */ } diff --git a/src/api/java/pneumaticCraft/api/block/IPneumaticWrenchable.java b/src/api/java/pneumaticCraft/api/block/IPneumaticWrenchable.java index 5b666d49..6d65c0fa 100644 --- a/src/api/java/pneumaticCraft/api/block/IPneumaticWrenchable.java +++ b/src/api/java/pneumaticCraft/api/block/IPneumaticWrenchable.java @@ -8,7 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection; * Should be implemented by any block that allows to be rotated by a Pneumatic Wrench. It uses almost the same * rotate method as the Vanilla (Forge) method. However it uses energy to rotate (when rotateBlock() return true). */ -public interface IPneumaticWrenchable{ +public interface IPneumaticWrenchable { public boolean rotateBlock(World world, EntityPlayer player, int x, int y, int z, ForgeDirection side); } diff --git a/src/api/java/pneumaticCraft/api/client/GuiAnimatedStatSupplier.java b/src/api/java/pneumaticCraft/api/client/GuiAnimatedStatSupplier.java index 4f88f0f2..1ca8cd84 100644 --- a/src/api/java/pneumaticCraft/api/client/GuiAnimatedStatSupplier.java +++ b/src/api/java/pneumaticCraft/api/client/GuiAnimatedStatSupplier.java @@ -4,15 +4,15 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack; /** - * With this class you can retrieve new instances of the PneumaticCraft's IGuiAnimatedStat implementation. You can use these in Gui's as + * With this class you can retrieve new instances of the PneumaticCraft's IGuiAnimatedStat implementation. You can use these in Gui's as * well as anywhere you like. When you use these in Gui's you need to pass a valid GuiScreen instance, if you don't you can just pass * null. */ -public class GuiAnimatedStatSupplier{ +public class GuiAnimatedStatSupplier { private static Class animatedStatClass; - public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, int backgroundColor){ - return getAnimatedStat(new Class[]{GuiScreen.class, int.class}, gui, backgroundColor); + public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, int backgroundColor) { + return getAnimatedStat(new Class[] {GuiScreen.class, int.class}, gui, backgroundColor); } /** @@ -22,8 +22,9 @@ public class GuiAnimatedStatSupplier{ * @param backgroundColor * @return */ - public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, ItemStack iconStack, int backgroundColor){ - return getAnimatedStat(new Class[]{GuiScreen.class, int.class, ItemStack.class}, gui, backgroundColor, iconStack); + public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, ItemStack iconStack, int backgroundColor) { + return getAnimatedStat( + new Class[] {GuiScreen.class, int.class, ItemStack.class}, gui, backgroundColor, iconStack); } /** @@ -33,15 +34,18 @@ public class GuiAnimatedStatSupplier{ * @param backgroundColor * @return */ - public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, String iconTexture, int backgroundColor){ - return getAnimatedStat(new Class[]{GuiScreen.class, int.class, String.class}, gui, backgroundColor, iconTexture); + public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, String iconTexture, int backgroundColor) { + return getAnimatedStat( + new Class[] {GuiScreen.class, int.class, String.class}, gui, backgroundColor, iconTexture); } - private static IGuiAnimatedStat getAnimatedStat(Class[] constructorClasses, Object... constructorParameters){ + private static IGuiAnimatedStat getAnimatedStat(Class[] constructorClasses, Object... constructorParameters) { try { - if(animatedStatClass == null) animatedStatClass = Class.forName("pneumaticCraft.client.gui.widget.GuiAnimatedStat"); - return (IGuiAnimatedStat)animatedStatClass.getConstructor(constructorClasses).newInstance(constructorParameters); - } catch(Exception e) { + if (animatedStatClass == null) + animatedStatClass = Class.forName("pneumaticCraft.client.gui.widget.GuiAnimatedStat"); + return (IGuiAnimatedStat) + animatedStatClass.getConstructor(constructorClasses).newInstance(constructorParameters); + } catch (Exception e) { System.err.println("Failed to retrieve an GuiAnimatedStat instance from PneumaticCraft."); } return null; diff --git a/src/api/java/pneumaticCraft/api/client/GuiElementRenderer.java b/src/api/java/pneumaticCraft/api/client/GuiElementRenderer.java index ff590de2..e9e7e7c1 100644 --- a/src/api/java/pneumaticCraft/api/client/GuiElementRenderer.java +++ b/src/api/java/pneumaticCraft/api/client/GuiElementRenderer.java @@ -1,10 +1,9 @@ package pneumaticCraft.api.client; import java.lang.reflect.Method; - import net.minecraft.client.gui.FontRenderer; -public class GuiElementRenderer{ +public class GuiElementRenderer { private static Method drawGaugeMethod; /** @@ -19,13 +18,43 @@ public class GuiElementRenderer{ * @param yPos y position of the gauge. * @param zLevel z position of the gauge (Gui#zLevel, -90, for in normal GUI's). */ - public static void drawPressureGauge(FontRenderer fontRenderer, float minPressure, float maxPressure, float dangerPressure, float minWorkingPressure, float currentPressure, int xPos, int yPos, float zLevel){ + public static void drawPressureGauge( + FontRenderer fontRenderer, + float minPressure, + float maxPressure, + float dangerPressure, + float minWorkingPressure, + float currentPressure, + int xPos, + int yPos, + float zLevel) { try { - if(drawGaugeMethod == null) { - drawGaugeMethod = Class.forName("pneumaticCraft.client.gui.GuiUtils").getMethod("drawPressureGauge", FontRenderer.class, float.class, float.class, float.class, float.class, float.class, int.class, int.class, float.class); + if (drawGaugeMethod == null) { + drawGaugeMethod = Class.forName("pneumaticCraft.client.gui.GuiUtils") + .getMethod( + "drawPressureGauge", + FontRenderer.class, + float.class, + float.class, + float.class, + float.class, + float.class, + int.class, + int.class, + float.class); } - drawGaugeMethod.invoke(null, fontRenderer, minPressure, maxPressure, dangerPressure, minWorkingPressure, currentPressure, xPos, yPos, zLevel); - } catch(Exception e) { + drawGaugeMethod.invoke( + null, + fontRenderer, + minPressure, + maxPressure, + dangerPressure, + minWorkingPressure, + currentPressure, + xPos, + yPos, + zLevel); + } catch (Exception e) { System.err.println("Failed to render a Pressure Gauge from PneumaticCraft."); } } diff --git a/src/api/java/pneumaticCraft/api/client/IGuiAnimatedStat.java b/src/api/java/pneumaticCraft/api/client/IGuiAnimatedStat.java index 15d55c71..693b6d89 100644 --- a/src/api/java/pneumaticCraft/api/client/IGuiAnimatedStat.java +++ b/src/api/java/pneumaticCraft/api/client/IGuiAnimatedStat.java @@ -10,8 +10,7 @@ import java.util.List; * animated stats can be implemented as well via this interface, and they will interact with the PneumaticCraft GuiAnimatedStats * if you implement it correctly. */ - -public interface IGuiAnimatedStat{ +public interface IGuiAnimatedStat { /** * When you call this method with a set of coordinates representing the button location and dimensions, you'll get @@ -175,5 +174,4 @@ public interface IGuiAnimatedStat{ * @return */ public boolean isClicked(); - } diff --git a/src/api/java/pneumaticCraft/api/client/assemblymachine/AssemblyRenderOverriding.java b/src/api/java/pneumaticCraft/api/client/assemblymachine/AssemblyRenderOverriding.java index 1816dc5b..d67277de 100644 --- a/src/api/java/pneumaticCraft/api/client/assemblymachine/AssemblyRenderOverriding.java +++ b/src/api/java/pneumaticCraft/api/client/assemblymachine/AssemblyRenderOverriding.java @@ -1,23 +1,23 @@ package pneumaticCraft.api.client.assemblymachine; import java.util.HashMap; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class AssemblyRenderOverriding{ - public static final HashMap renderOverrides = new HashMap(); +public class AssemblyRenderOverriding { + public static final HashMap renderOverrides = + new HashMap(); - public static void addRenderOverride(Block block, IAssemblyRenderOverriding renderOverride){ + public static void addRenderOverride(Block block, IAssemblyRenderOverriding renderOverride) { renderOverrides.put(Block.getIdFromBlock(block), renderOverride); } - public static void addRenderOverride(Item item, IAssemblyRenderOverriding renderOverride){ + public static void addRenderOverride(Item item, IAssemblyRenderOverriding renderOverride) { renderOverrides.put(Item.getIdFromItem(item), renderOverride); } - public static interface IAssemblyRenderOverriding{ + public static interface IAssemblyRenderOverriding { /** * This method will be called just before the IO Unit's held stack is being rendered. You can insert GL11 calls here to * rotate the model for example. push and pop matrices are not needed, this is done for you. @@ -50,6 +50,5 @@ public class AssemblyRenderOverriding{ * @return */ public float getPlatformClawShift(ItemStack renderedStack); - } } diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IBlockTrackEntry.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IBlockTrackEntry.java index 6d9e1fe0..7d145625 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IBlockTrackEntry.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IBlockTrackEntry.java @@ -1,18 +1,17 @@ package pneumaticCraft.api.client.pneumaticHelmet; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public interface IBlockTrackEntry{ +public interface IBlockTrackEntry { /** * This method should return true if the coordinate checked is one that * should be tracked. Most entries will just return true when the blockID is * the one that they track. - * + * * @param world * The world that is examined. * @param x @@ -36,7 +35,7 @@ public interface IBlockTrackEntry{ * Mob Spawners, to get the inventory at the client side and the time to the * next spawn respectively. * @param te The TileEntity at the currently checked location. - * + * * @return true if the Tile Entity should be updated, or false when it * doesn't have to. */ @@ -45,7 +44,7 @@ public interface IBlockTrackEntry{ /** * The return of this method defines at how many tracked blocks of this type * the HUD should stop displaying text at the tracked blocks of this type. - * + * * @return amount of blocks the HUD should stop displaying the block info. */ public int spamThreshold(); @@ -56,7 +55,7 @@ public interface IBlockTrackEntry{ * the Item class. This method only will be called if * shouldTrackWithThisEntry() returned true and the player hovers over the * coordinate. - * + * * @param world * The world the block is in. * @param x diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IEntityTrackEntry.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IEntityTrackEntry.java index 65c2b79e..e7b248a3 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IEntityTrackEntry.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IEntityTrackEntry.java @@ -1,14 +1,13 @@ package pneumaticCraft.api.client.pneumaticHelmet; import java.util.List; - import net.minecraft.entity.Entity; /** * Implement this class and register it by adding it to the entityTrackEntries class. * There needs to be a parameterless constructor. For every entity that's applicable for this definition, an instance is created. */ -public interface IEntityTrackEntry{ +public interface IEntityTrackEntry { /** * Return true if you want to add a tooltip for the given entity. * @param entity @@ -39,11 +38,11 @@ public interface IEntityTrackEntry{ /** * Just a basic implementation class that can be used if an update and render method isn't needed. */ - public static abstract class EntityTrackEntry implements IEntityTrackEntry{ + public abstract static class EntityTrackEntry implements IEntityTrackEntry { @Override - public void update(Entity entity){} + public void update(Entity entity) {} @Override - public void render(Entity entity, float partialTicks){} + public void render(Entity entity, float partialTicks) {} } } diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IGuiScreen.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IGuiScreen.java index 8f98938d..67f13d5b 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IGuiScreen.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IGuiScreen.java @@ -1,14 +1,13 @@ package pneumaticCraft.api.client.pneumaticHelmet; import java.util.List; - import net.minecraft.client.gui.FontRenderer; /** * Just an interface to give access to GuiSreen#buttonList and GuiScreen#fontRenderer. An instance of this class can * safely be casted to GuiSreen if needed. */ -public interface IGuiScreen{ +public interface IGuiScreen { public List getButtonList(); public FontRenderer getFontRenderer(); diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableBlock.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableBlock.java index 9dc7863d..12e86c1a 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableBlock.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableBlock.java @@ -1,37 +1,36 @@ package pneumaticCraft.api.client.pneumaticHelmet; import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; /** -Use this interface to specify any hackable block. When it's your block, you can simply implement this interface in the -block's class. If you don't have access to the class (vanilla blocks), you can implement this interface in a separate class -and register it using PneumaticRegistry.registry.addHackable(blockClass, IHackableBlockClass). With the former way there will be one instance only per type. In the latter, there will -be an IHackableBlock instance for every block. -*/ -public interface IHackableBlock{ + * Use this interface to specify any hackable block. When it's your block, you can simply implement this interface in the + * block's class. If you don't have access to the class (vanilla blocks), you can implement this interface in a separate class + * and register it using PneumaticRegistry.registry.addHackable(blockClass, IHackableBlockClass). With the former way there will be one instance only per type. In the latter, there will + * be an IHackableBlock instance for every block. + */ +public interface IHackableBlock { /** * Should return a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime after a server restart. * Null is a valid return: afterHackTick will not be triggered at all in that case. - * + * * CURRENTLY THIS ISN'T IMPLEMENTED. * @return */ public String getId(); /** - Returning true will allow the player to hack this block. This can be used to only allow hacking on certain conditions. - */ + * Returning true will allow the player to hack this block. This can be used to only allow hacking on certain conditions. + */ public boolean canHack(IBlockAccess world, int x, int y, int z, EntityPlayer player); /** - Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added. - This method is only called when canHack(World, int, int, int) returned true. - The added lines automatically will be tried to get localized. - */ + * Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added. + * This method is only called when canHack(World, int, int, int) returned true. + * The added lines automatically will be tried to get localized. + */ public void addInfo(World world, int x, int y, int z, List curInfo, EntityPlayer player); /** @@ -45,19 +44,19 @@ public interface IHackableBlock{ public void addPostHackInfo(World world, int x, int y, int z, List curInfo, EntityPlayer player); /** - Return the time it takes to hack this block in ticks. For more powerful hacks, a longer required hacking time is adviced. - */ + * Return the time it takes to hack this block in ticks. For more powerful hacks, a longer required hacking time is adviced. + */ public int getHackTime(IBlockAccess world, int x, int y, int z, EntityPlayer player); /** - When the player hacked the block for getHackTime(World, int, int, int) ticks this will be called on both server and client side. - */ + * When the player hacked the block for getHackTime(World, int, int, int) ticks this will be called on both server and client side. + */ public void onHackFinished(World world, int x, int y, int z, EntityPlayer player); /** * Called every tick after the hacking finished (on both server and client side). Returning true will keep this going (for mob spawners, to keep them neutralized), * or false to stop ticking (for door/lever hacking). - * + * * CURRENTLY THIS METHOD WILL STOP GETTING INVOKED AFTER A SERVER RESTART! * @param world * @param x diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableEntity.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableEntity.java index e8aa236c..c574e5df 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableEntity.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableEntity.java @@ -1,16 +1,15 @@ package pneumaticCraft.api.client.pneumaticHelmet; import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; /** -Use this interface to specify any hackable entity. When it's your entity, you can simply implement this interface in the -entity's class. If you don't have access to the class (vanilla entities), you can implement this interface in a separate class -and register it using PneumaticRegistry.registry.addHackable(entityClass, IHackableEntityClass). In both ways there will be an IHackableEntity instance for every entity. -*/ -public interface IHackableEntity{ + * Use this interface to specify any hackable entity. When it's your entity, you can simply implement this interface in the + * entity's class. If you don't have access to the class (vanilla entities), you can implement this interface in a separate class + * and register it using PneumaticRegistry.registry.addHackable(entityClass, IHackableEntityClass). In both ways there will be an IHackableEntity instance for every entity. + */ +public interface IHackableEntity { /** * Should return a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime after a server restart. @@ -20,15 +19,15 @@ public interface IHackableEntity{ public String getId(); /** - Returning true will allow the player to hack this entity. This can be used to only allow hacking on certain conditions. - */ + * Returning true will allow the player to hack this entity. This can be used to only allow hacking on certain conditions. + */ public boolean canHack(Entity entity, EntityPlayer player); /** - Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added. - This method is only called when canHack(Entity) returned true. - The added lines automatically will be tried to get localized. - */ + * Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added. + * This method is only called when canHack(Entity) returned true. + * The added lines automatically will be tried to get localized. + */ public void addInfo(Entity entity, List curInfo, EntityPlayer player); /** @@ -42,13 +41,13 @@ public interface IHackableEntity{ public void addPostHackInfo(Entity entity, List curInfo, EntityPlayer player); /** - Return the time it takes to hack this entity in ticks. For more powerful hacks, a longer required hacking time is adviced. - */ + * Return the time it takes to hack this entity in ticks. For more powerful hacks, a longer required hacking time is adviced. + */ public int getHackTime(Entity entity, EntityPlayer player); /** - When the player hacked the entity for getHackTime(Entity) ticks this will be called on both client and server side. - */ + * When the player hacked the entity for getHackTime(Entity) ticks this will be called on both client and server side. + */ public void onHackFinished(Entity entity, EntityPlayer player); /** diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IOptionPage.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IOptionPage.java index 2212749e..bcfb27b4 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IOptionPage.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IOptionPage.java @@ -7,7 +7,7 @@ import net.minecraft.client.gui.GuiScreen; * The Option Page is the page you see when you press 'F' (by default) with a Pneumatic Helmet equipped. You can register this class * by returning a new instance of this class at {@link IUpgradeRenderHandler#getGuiOptionsPage()} */ -public interface IOptionPage{ +public interface IOptionPage { /** * This string is used in the text of the button of this page. diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IUpgradeRenderHandler.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IUpgradeRenderHandler.java index d273baf3..888aa163 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IUpgradeRenderHandler.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IUpgradeRenderHandler.java @@ -6,12 +6,12 @@ import net.minecraftforge.common.config.Configuration; import pneumaticCraft.api.client.IGuiAnimatedStat; /** - * To add upgrades for in the Pneumatic Helmet implement this interface. You can add members to this class, however these can only + * To add upgrades for in the Pneumatic Helmet implement this interface. You can add members to this class, however these can only * be client sided members as this class will be used as singleton. Therefore, only one of these instances exist at the server side * so any member that is used server side will affect every player. * */ -public interface IUpgradeRenderHandler{ +public interface IUpgradeRenderHandler { /** * Return here the name of the upgrade. This is displayed in the formatting [upgradeName] + " " + "found"/"not found" on @@ -84,7 +84,7 @@ public interface IUpgradeRenderHandler{ /** * When you have some options for your upgrade handler you could return a new instance of an IOptionsPage. - * When you do so, it will automatically get picked up by the options handler, and it will be added to the + * When you do so, it will automatically get picked up by the options handler, and it will be added to the * options GUI when this upgrade returns true when calling isEnabled(). Returning null is valid. * @return */ diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/RenderHandlerRegistry.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/RenderHandlerRegistry.java index acb1cdc5..5aef540d 100644 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/RenderHandlerRegistry.java +++ b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/RenderHandlerRegistry.java @@ -2,7 +2,7 @@ package pneumaticCraft.api.client.pneumaticHelmet; import java.util.List; -public class RenderHandlerRegistry{ +public class RenderHandlerRegistry { /** * With this field you can register your render handlers. This field is initialized in the PreInit phase of PneumaticCraft's loading phase. */ diff --git a/src/api/java/pneumaticCraft/api/drone/DroneConstructingEvent.java b/src/api/java/pneumaticCraft/api/drone/DroneConstructingEvent.java index 801c55a4..10f66543 100644 --- a/src/api/java/pneumaticCraft/api/drone/DroneConstructingEvent.java +++ b/src/api/java/pneumaticCraft/api/drone/DroneConstructingEvent.java @@ -2,10 +2,10 @@ package pneumaticCraft.api.drone; import cpw.mods.fml.common.eventhandler.Event; -public class DroneConstructingEvent extends Event{ +public class DroneConstructingEvent extends Event { public IDrone drone; - public DroneConstructingEvent(IDrone drone){ + public DroneConstructingEvent(IDrone drone) { this.drone = drone; } } diff --git a/src/api/java/pneumaticCraft/api/drone/IBlockInteractHandler.java b/src/api/java/pneumaticCraft/api/drone/IBlockInteractHandler.java index 5e4eb245..81f3de7c 100644 --- a/src/api/java/pneumaticCraft/api/drone/IBlockInteractHandler.java +++ b/src/api/java/pneumaticCraft/api/drone/IBlockInteractHandler.java @@ -3,7 +3,7 @@ package pneumaticCraft.api.drone; /** * DON'T IMPLEMENT, just use */ -public interface IBlockInteractHandler{ +public interface IBlockInteractHandler { /** * Returns a boolean[6] of all sides. when true, this side is accessible @@ -22,5 +22,4 @@ public interface IBlockInteractHandler{ * (It's useless to search any further) */ public void abort(); - } diff --git a/src/api/java/pneumaticCraft/api/drone/ICustomBlockInteract.java b/src/api/java/pneumaticCraft/api/drone/ICustomBlockInteract.java index 2960425e..1d4d4dbc 100644 --- a/src/api/java/pneumaticCraft/api/drone/ICustomBlockInteract.java +++ b/src/api/java/pneumaticCraft/api/drone/ICustomBlockInteract.java @@ -8,7 +8,7 @@ import net.minecraft.world.ChunkPosition; * This will add a puzzle piece that has only a Area white- and blacklist parameter (similar to a GoTo piece). * It will do the specified behaviour. This can be used to create energy import/export widgets. */ -public interface ICustomBlockInteract{ +public interface ICustomBlockInteract { /** * Should return a unique Id, used in NBT saving and localization. @@ -23,12 +23,12 @@ public interface ICustomBlockInteract{ /** * The actual interaction. - * + * * For every position in the selected area the drone will visit every block (ordered from closest to furthest). It will call this method with 'simulate = true'. If this method returns true, the drone will navigate to this location, and call this method again with 'simulate = false' It will keep doing this until this method returns false. - * + * * When interactHandler.useCount() returns true: * In the interface of the puzzle piece users can specify a 'use count' and fill in the maximum count they want to use. When not simulating, you should only import/export up to interactHandler.getRemainingCount(), and you should notify the removed/added count by doing interactHandler.decreaseCount(int count). - * + * * @param pos current visited location * @param drone * @param interactHandler object you can use to use to get accessible sides and give feedback about counts. diff --git a/src/api/java/pneumaticCraft/api/drone/IDrone.java b/src/api/java/pneumaticCraft/api/drone/IDrone.java index 306bc6c0..863a61ed 100644 --- a/src/api/java/pneumaticCraft/api/drone/IDrone.java +++ b/src/api/java/pneumaticCraft/api/drone/IDrone.java @@ -13,9 +13,9 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.IFluidTank; import pneumaticCraft.api.item.IPressurizable; -public interface IDrone extends IPressurizable{ +public interface IDrone extends IPressurizable { /** - * + * * @param upgradeIndex metadata value of the upgrade item * @return amount of inserted upgrades in the drone */ diff --git a/src/api/java/pneumaticCraft/api/drone/IPathNavigator.java b/src/api/java/pneumaticCraft/api/drone/IPathNavigator.java index f089bae5..958b4585 100644 --- a/src/api/java/pneumaticCraft/api/drone/IPathNavigator.java +++ b/src/api/java/pneumaticCraft/api/drone/IPathNavigator.java @@ -2,7 +2,7 @@ package pneumaticCraft.api.drone; import net.minecraft.entity.Entity; -public interface IPathNavigator{ +public interface IPathNavigator { public boolean moveToXYZ(double x, double y, double z); public boolean moveToEntity(Entity entity); diff --git a/src/api/java/pneumaticCraft/api/drone/IPathfindHandler.java b/src/api/java/pneumaticCraft/api/drone/IPathfindHandler.java index a5bcfabb..814067b2 100644 --- a/src/api/java/pneumaticCraft/api/drone/IPathfindHandler.java +++ b/src/api/java/pneumaticCraft/api/drone/IPathfindHandler.java @@ -2,7 +2,7 @@ package pneumaticCraft.api.drone; import net.minecraft.world.World; -public interface IPathfindHandler{ +public interface IPathfindHandler { /** * When returned true, the drone can pathfind through this block. When false it can't. * @param world diff --git a/src/api/java/pneumaticCraft/api/drone/SpecialVariableRetrievalEvent.java b/src/api/java/pneumaticCraft/api/drone/SpecialVariableRetrievalEvent.java index 83581c81..b0ce5001 100644 --- a/src/api/java/pneumaticCraft/api/drone/SpecialVariableRetrievalEvent.java +++ b/src/api/java/pneumaticCraft/api/drone/SpecialVariableRetrievalEvent.java @@ -1,14 +1,14 @@ package pneumaticCraft.api.drone; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.item.ItemStack; import net.minecraft.world.ChunkPosition; -import cpw.mods.fml.common.eventhandler.Event; /** * Fired when a Drone is trying to get a special coordinate, by accessing a variable with '$' prefix. * These event are posted on the MinecraftForge.EVENT_BUS. */ -public abstract class SpecialVariableRetrievalEvent extends Event{ +public abstract class SpecialVariableRetrievalEvent extends Event { /** * The special variable name, with the '$' stripped away. @@ -18,40 +18,39 @@ public abstract class SpecialVariableRetrievalEvent extends Event{ /** * The returning coordinate */ - - public SpecialVariableRetrievalEvent(String specialVarName){ + public SpecialVariableRetrievalEvent(String specialVarName) { this.specialVarName = specialVarName; } - public static abstract class CoordinateVariable extends SpecialVariableRetrievalEvent{ + public abstract static class CoordinateVariable extends SpecialVariableRetrievalEvent { public ChunkPosition coordinate; - public CoordinateVariable(String specialVarName){ + public CoordinateVariable(String specialVarName) { super(specialVarName); } - public static class Drone extends CoordinateVariable{ + public static class Drone extends CoordinateVariable { public final IDrone drone; - public Drone(IDrone drone, String specialVarName){ + public Drone(IDrone drone, String specialVarName) { super(specialVarName); this.drone = drone; } } } - public static abstract class ItemVariable extends SpecialVariableRetrievalEvent{ + public abstract static class ItemVariable extends SpecialVariableRetrievalEvent { public ItemStack item; - public ItemVariable(String specialVarName){ + public ItemVariable(String specialVarName) { super(specialVarName); } - public static class Drone extends ItemVariable{ + public static class Drone extends ItemVariable { public final IDrone drone; - public Drone(IDrone drone, String specialVarName){ + public Drone(IDrone drone, String specialVarName) { super(specialVarName); this.drone = drone; } diff --git a/src/api/java/pneumaticCraft/api/item/IInventoryItem.java b/src/api/java/pneumaticCraft/api/item/IInventoryItem.java index b153e022..152af991 100644 --- a/src/api/java/pneumaticCraft/api/item/IInventoryItem.java +++ b/src/api/java/pneumaticCraft/api/item/IInventoryItem.java @@ -1,7 +1,6 @@ package pneumaticCraft.api.item; import java.util.List; - import net.minecraft.item.ItemStack; /** @@ -10,7 +9,7 @@ import net.minecraft.item.ItemStack; * This will then will be used in the Pneumatic Helmet's item search. * */ -public interface IInventoryItem{ +public interface IInventoryItem { /** * @parm stack: Item that potentially has an inventory. diff --git a/src/api/java/pneumaticCraft/api/item/IPressurizable.java b/src/api/java/pneumaticCraft/api/item/IPressurizable.java index 027aaad1..b81e1fe6 100644 --- a/src/api/java/pneumaticCraft/api/item/IPressurizable.java +++ b/src/api/java/pneumaticCraft/api/item/IPressurizable.java @@ -5,10 +5,10 @@ import net.minecraft.item.ItemStack; /** * Any item implementing this interface will be able to (dis)charge in a Charging Station. */ -public interface IPressurizable{ +public interface IPressurizable { /** * This method should return the current pressure of the ItemStack given. - * + * * @param iStack Stack the pressure is asked from. * @return Pressure in bar. */ @@ -17,7 +17,7 @@ public interface IPressurizable{ /** * this method is used to charge or discharge a pneumatic item. when the * value is negative the item should be discharging - * + * * @param iStack the ItemStack which has to be (dis)charged. * @param amount amount in mL that the item is (dis)charging. */ @@ -27,7 +27,7 @@ public interface IPressurizable{ * This method should return the maximum pressure of a pneumatic item. If it * has reached this maximum, it won't explode, but it wouldn't (try to) * charge either. - * + * * @param iStack the stack from which the maximum pressure is asked. * @return maximum pressure in bar. */ diff --git a/src/api/java/pneumaticCraft/api/item/IProgrammable.java b/src/api/java/pneumaticCraft/api/item/IProgrammable.java index d00d94c3..8e706206 100644 --- a/src/api/java/pneumaticCraft/api/item/IProgrammable.java +++ b/src/api/java/pneumaticCraft/api/item/IProgrammable.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; * For now the only thing you can do with this is make program storages, later more interaction with programming puzzles is planned. * Puzzle pieces will be written onto the implementer's itemstack NBT, using the "progWidget" tag. */ -public interface IProgrammable{ +public interface IProgrammable { /** * When returned true, this stack is allowed to be programmed. @@ -30,5 +30,4 @@ public interface IProgrammable{ * @return */ public boolean showProgramTooltip(); - } diff --git a/src/api/java/pneumaticCraft/api/item/ItemSupplier.java b/src/api/java/pneumaticCraft/api/item/ItemSupplier.java index 93c13fb5..eb59c3ab 100644 --- a/src/api/java/pneumaticCraft/api/item/ItemSupplier.java +++ b/src/api/java/pneumaticCraft/api/item/ItemSupplier.java @@ -1,47 +1,47 @@ package pneumaticCraft.api.item; -import net.minecraft.item.Item; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.Item; -public class ItemSupplier{ - public static Item getItem(String itemName){ +public class ItemSupplier { + public static Item getItem(String itemName) { return GameRegistry.findItem("PneumaticCraft", itemName); } /* - The following is a list of all the item names that can be passed as argument in getItem(String) to get a PneumaticCraft item. - - GPSTool Currently tracked coordinated is stored in NBT, with 'x', 'y', 'z' being the tag names for the x,y and z positions respectively. - machineUpgrade damage value = upgrade type. - ingotIronCompressed - pressureGauge - stoneBase - cannonBarrel - turbineBlade - plasticPlant damage value = plant type. Mapped the same as Vanilla dye in terms of color. - plastic damage value = plastic type. Mapped the same as Vanilla dye in terms of color. - airCanister implements IPressurizable - vortexCannon implements IPressurizable - pneumaticCylinder - pneumaticHelmet implements IPressurizable - manometer implements IPressurizable - turbineRotor - assemblyProgram damage value = program type. - emptyPCB - unassembledPCB - PCBBlueprint - bucketEtchingAcid - transistor - capacitor - printedCircuitBoard - failedPCB - networkComponent damage value = network component type. - stopWorm - nukeVirus - compressedIronGear - pneumaticWrench implements IPressurizable + The following is a list of all the item names that can be passed as argument in getItem(String) to get a PneumaticCraft item. - - - */ + GPSTool Currently tracked coordinated is stored in NBT, with 'x', 'y', 'z' being the tag names for the x,y and z positions respectively. + machineUpgrade damage value = upgrade type. + ingotIronCompressed + pressureGauge + stoneBase + cannonBarrel + turbineBlade + plasticPlant damage value = plant type. Mapped the same as Vanilla dye in terms of color. + plastic damage value = plastic type. Mapped the same as Vanilla dye in terms of color. + airCanister implements IPressurizable + vortexCannon implements IPressurizable + pneumaticCylinder + pneumaticHelmet implements IPressurizable + manometer implements IPressurizable + turbineRotor + assemblyProgram damage value = program type. + emptyPCB + unassembledPCB + PCBBlueprint + bucketEtchingAcid + transistor + capacitor + printedCircuitBoard + failedPCB + networkComponent damage value = network component type. + stopWorm + nukeVirus + compressedIronGear + pneumaticWrench implements IPressurizable + + + + */ } diff --git a/src/api/java/pneumaticCraft/api/package-info.java b/src/api/java/pneumaticCraft/api/package-info.java index 55919456..c037fe26 100644 --- a/src/api/java/pneumaticCraft/api/package-info.java +++ b/src/api/java/pneumaticCraft/api/package-info.java @@ -2,4 +2,3 @@ package pneumaticCraft.api; import cpw.mods.fml.common.API; - diff --git a/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java b/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java index 8c74b4bb..b813e2ed 100644 --- a/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java +++ b/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java @@ -2,12 +2,11 @@ package pneumaticCraft.api.recipe; import java.util.ArrayList; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class AssemblyRecipe{ +public class AssemblyRecipe { public static List drillRecipes = new ArrayList(); public static List laserRecipes = new ArrayList(); public static List drillLaserRecipes = new ArrayList(); @@ -15,35 +14,34 @@ public class AssemblyRecipe{ private final ItemStack input; private final ItemStack output; - public AssemblyRecipe(ItemStack input, ItemStack output){ + public AssemblyRecipe(ItemStack input, ItemStack output) { this.input = input; this.output = output; } - public ItemStack getInput(){ + public ItemStack getInput() { return input; } - public ItemStack getOutput(){ + public ItemStack getOutput() { return output; } - public static void addDrillRecipe(Object input, Object output){ + public static void addDrillRecipe(Object input, Object output) { drillRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); } - public static void addLaserRecipe(Object input, Object output){ + public static void addLaserRecipe(Object input, Object output) { laserRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); } - private static ItemStack getStackFromObject(Object object){ - if(object instanceof Block) { - return new ItemStack((Block)object); - } else if(object instanceof Item) { - return new ItemStack((Item)object); + private static ItemStack getStackFromObject(Object object) { + if (object instanceof Block) { + return new ItemStack((Block) object); + } else if (object instanceof Item) { + return new ItemStack((Item) object); } else { - return (ItemStack)object; + return (ItemStack) object; } } - } diff --git a/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java index 93eba67c..8797da8b 100644 --- a/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java +++ b/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java @@ -2,7 +2,7 @@ package pneumaticCraft.api.recipe; import net.minecraft.item.ItemStack; -public interface IPressureChamberRecipe{ +public interface IPressureChamberRecipe { /** * Returns the threshold which is minimal to craft the recipe. Negative pressures also work. diff --git a/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java index 5d6b29e5..816f2601 100644 --- a/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java +++ b/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java @@ -2,10 +2,9 @@ package pneumaticCraft.api.recipe; import java.util.ArrayList; import java.util.List; - import net.minecraft.item.ItemStack; -public class PressureChamberRecipe{ +public class PressureChamberRecipe { public static List chamberRecipes = new ArrayList(); public static List specialRecipes = new ArrayList(); @@ -14,11 +13,10 @@ public class PressureChamberRecipe{ public final float pressure; public final boolean outputAsBlock; - public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock){ + public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock) { this.input = input; this.output = output; pressure = pressureRequired; this.outputAsBlock = outputAsBlock; } - } diff --git a/src/api/java/pneumaticCraft/api/tileentity/AirHandlerSupplier.java b/src/api/java/pneumaticCraft/api/tileentity/AirHandlerSupplier.java index 1bf1be74..749845a6 100644 --- a/src/api/java/pneumaticCraft/api/tileentity/AirHandlerSupplier.java +++ b/src/api/java/pneumaticCraft/api/tileentity/AirHandlerSupplier.java @@ -2,14 +2,14 @@ package pneumaticCraft.api.tileentity; import java.lang.reflect.Constructor; -public class AirHandlerSupplier{ +public class AirHandlerSupplier { private static Constructor airHandlerConstructor; - public static IAirHandler getTierOneAirHandler(int volume){ + public static IAirHandler getTierOneAirHandler(int volume) { return getAirHandler(5F, 7F, volume); } - public static IAirHandler getTierTwoAirHandler(int volume){ + public static IAirHandler getTierTwoAirHandler(int volume) { return getAirHandler(20F, 25F, volume); } @@ -17,7 +17,7 @@ public class AirHandlerSupplier{ * Returns a new instance of an IAirHandler. This handler handles everything pressurized air related: Air dispersion, * blowing up when the pressure gets too high, providing a method for releasing air into the atmosphere... * PROVIDED THAT THE FOLLOWING METHODS ARE FORWARDED TO THIS INSTANCE: - * {@link net.minecraft.tileentity.TileEntity#updateEntity()}, + * {@link net.minecraft.tileentity.TileEntity#updateEntity()}, * {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)} * {@link net.minecraft.tileentity.TileEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound)} * {@link net.minecraft.tileentity.TileEntity#validate()} @@ -28,13 +28,16 @@ public class AirHandlerSupplier{ * The higher the volume the slower the machine will charge/discharge. * @return */ - public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, int volume){ + public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, int volume) { IAirHandler airHandler = null; try { - if(airHandlerConstructor == null) airHandlerConstructor = Class.forName("pneumaticCraft.common.tileentity.TileEntityPneumaticBase").getConstructor(float.class, float.class, int.class); - airHandler = (IAirHandler)airHandlerConstructor.newInstance(dangerPressure, criticalPressure, volume); - } catch(Exception e) { - System.err.println("[PneumaticCraft API] An error has occured whilst trying to get an AirHandler. Here's a stacktrace:"); + if (airHandlerConstructor == null) + airHandlerConstructor = Class.forName("pneumaticCraft.common.tileentity.TileEntityPneumaticBase") + .getConstructor(float.class, float.class, int.class); + airHandler = (IAirHandler) airHandlerConstructor.newInstance(dangerPressure, criticalPressure, volume); + } catch (Exception e) { + System.err.println( + "[PneumaticCraft API] An error has occured whilst trying to get an AirHandler. Here's a stacktrace:"); e.printStackTrace(); } return airHandler; @@ -44,8 +47,7 @@ public class AirHandlerSupplier{ * Use the version with integer parameters */ @Deprecated - public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, float maxFlow, float volume){ - return getAirHandler(dangerPressure, criticalPressure, (int)volume); + public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, float maxFlow, float volume) { + return getAirHandler(dangerPressure, criticalPressure, (int) volume); } - } diff --git a/src/api/java/pneumaticCraft/api/tileentity/IAirHandler.java b/src/api/java/pneumaticCraft/api/tileentity/IAirHandler.java index 72929e90..28e4c2b8 100644 --- a/src/api/java/pneumaticCraft/api/tileentity/IAirHandler.java +++ b/src/api/java/pneumaticCraft/api/tileentity/IAirHandler.java @@ -1,19 +1,16 @@ package pneumaticCraft.api.tileentity; import java.util.List; - import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; - import org.apache.commons.lang3.tuple.Pair; /** * A way for you to access about everything you need from a pneumatic machine. * DO NOT IMPLEMENT THIS YOURSELF! Use AirHandlerSupplier to get an instance for your TileEntity, and implement IPneumaticMachine instead. */ - -public interface IAirHandler extends IManoMeasurable{ +public interface IAirHandler extends IManoMeasurable { /** * -----------Needs to be forwarded by the implementing TileEntity's updateEntity() method. @@ -110,5 +107,4 @@ public interface IAirHandler extends IManoMeasurable{ * Needs to be forwarded from the implementing _Block_! Forward the Block's "onNeighborChange" method to this handler. */ public void onNeighborChange(); - } diff --git a/src/api/java/pneumaticCraft/api/tileentity/IHeatExchanger.java b/src/api/java/pneumaticCraft/api/tileentity/IHeatExchanger.java index 60df395c..53c68cf5 100644 --- a/src/api/java/pneumaticCraft/api/tileentity/IHeatExchanger.java +++ b/src/api/java/pneumaticCraft/api/tileentity/IHeatExchanger.java @@ -9,7 +9,7 @@ import pneumaticCraft.api.IHeatExchangerLogic; * @author MineMaarten * www.minemaarten.com */ -public interface IHeatExchanger{ +public interface IHeatExchanger { /** * Get an instance of IHeatExchangerLogic from PneumaticRegistry.getInstance().getHeatExchangerLogic() and keep a global reference. @@ -20,5 +20,4 @@ public interface IHeatExchanger{ * @return */ public IHeatExchangerLogic getHeatExchangerLogic(ForgeDirection side); - } diff --git a/src/api/java/pneumaticCraft/api/tileentity/IManoMeasurable.java b/src/api/java/pneumaticCraft/api/tileentity/IManoMeasurable.java index c5178abe..c0db2869 100644 --- a/src/api/java/pneumaticCraft/api/tileentity/IManoMeasurable.java +++ b/src/api/java/pneumaticCraft/api/tileentity/IManoMeasurable.java @@ -1,10 +1,9 @@ package pneumaticCraft.api.tileentity; import java.util.List; - import net.minecraft.entity.player.EntityPlayer; -public interface IManoMeasurable{ +public interface IManoMeasurable { /** * This method is invoked by the Manometer when a player right-clicks a TE or Entity with this interface implemented. * @param player that rightclicks the measurable TE, and therefore needs to get the message diff --git a/src/api/java/pneumaticCraft/api/tileentity/IPneumaticMachine.java b/src/api/java/pneumaticCraft/api/tileentity/IPneumaticMachine.java index 0e283115..a0f4a07a 100644 --- a/src/api/java/pneumaticCraft/api/tileentity/IPneumaticMachine.java +++ b/src/api/java/pneumaticCraft/api/tileentity/IPneumaticMachine.java @@ -2,16 +2,16 @@ package pneumaticCraft.api.tileentity; import net.minecraftforge.common.util.ForgeDirection; -public interface IPneumaticMachine{ +public interface IPneumaticMachine { /** * In your TileEntity class which is implementing this interface you should keep a reference of an IAirHandler. * You can retrieve one by calling {@link AirHandlerSupplier#getAirHandler(net.minecraft.tileentity.TileEntity, float, float, float, float)}. - * Do this when your TileEntity is initialized, i.e. xCoord,yCoord,zCoord and worldObj have a value. + * Do this when your TileEntity is initialized, i.e. xCoord,yCoord,zCoord and worldObj have a value. * In this method you need to return this reference. - * - * IMPORTANT: You need to forward the {@link net.minecraft.tileentity.TileEntity#updateEntity()}, - * {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)} , + * + * IMPORTANT: You need to forward the {@link net.minecraft.tileentity.TileEntity#updateEntity()}, + * {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)} , * {@link net.minecraft.tileentity.TileEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound)} and * {@link net.minecraft.tileentity.TileEntity#validate()} (with the implementing TileEntity as additional parameter) * to the IAirHandler. diff --git a/src/api/java/pneumaticCraft/api/universalSensor/EntityPollSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/EntityPollSensor.java index 0419911f..9ec931cd 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/EntityPollSensor.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/EntityPollSensor.java @@ -1,31 +1,35 @@ package pneumaticCraft.api.universalSensor; import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -public abstract class EntityPollSensor implements IPollSensorSetting{ +public abstract class EntityPollSensor implements IPollSensorSetting { @Override - public String getSensorPath(){ + public String getSensorPath() { return "entityTracker"; } @Override - public int getPollFrequency(){ + public int getPollFrequency() { return 1; } @Override - public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText){ - AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x - sensorRange, y - sensorRange, z - sensorRange, x + 1 + sensorRange, y + 1 + sensorRange, z + 1 + sensorRange); + public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText) { + AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox( + x - sensorRange, + y - sensorRange, + z - sensorRange, + x + 1 + sensorRange, + y + 1 + sensorRange, + z + 1 + sensorRange); return getRedstoneValue(world.getEntitiesWithinAABB(getEntityTracked(), aabb), textBoxText); } public abstract Class getEntityTracked(); public abstract int getRedstoneValue(List entities, String textBoxText); - } diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinateEventSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinateEventSensor.java index 2f225c5a..24da4319 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinateEventSensor.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinateEventSensor.java @@ -1,15 +1,12 @@ package pneumaticCraft.api.universalSensor; +import cpw.mods.fml.common.eventhandler.Event; import java.util.List; - import net.minecraft.client.gui.FontRenderer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.util.Rectangle; -import cpw.mods.fml.common.eventhandler.Event; - -public interface IBlockAndCoordinateEventSensor{ +public interface IBlockAndCoordinateEventSensor { /** * See {@link ISensorSetting#getSensorPath()} * @return diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinatePollSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinatePollSensor.java index e7bc329e..813a58cf 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinatePollSensor.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinatePollSensor.java @@ -1,13 +1,11 @@ package pneumaticCraft.api.universalSensor; import java.util.List; - import net.minecraft.client.gui.FontRenderer; import net.minecraft.world.World; - import org.lwjgl.util.Rectangle; -public interface IBlockAndCoordinatePollSensor{ +public interface IBlockAndCoordinatePollSensor { /** * See {@link ISensorSetting#getSensorPath()} * @return @@ -46,7 +44,8 @@ public interface IBlockAndCoordinatePollSensor{ * @param toolZ * @return */ - public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText, int toolX, int toolY, int toolZ); + public int getRedstoneValue( + World world, int x, int y, int z, int sensorRange, String textBoxText, int toolX, int toolY, int toolZ); /** * See {@link IPollSensorSetting#getPollFrequency()} @@ -59,5 +58,4 @@ public interface IBlockAndCoordinatePollSensor{ * @param fontRenderer */ public void drawAdditionalInfo(FontRenderer fontRenderer); - } diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IEventSensorSetting.java b/src/api/java/pneumaticCraft/api/universalSensor/IEventSensorSetting.java index bce3017a..970ab65b 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/IEventSensorSetting.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/IEventSensorSetting.java @@ -1,9 +1,9 @@ package pneumaticCraft.api.universalSensor; -import net.minecraft.tileentity.TileEntity; import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.tileentity.TileEntity; -public interface IEventSensorSetting extends ISensorSetting{ +public interface IEventSensorSetting extends ISensorSetting { /** * This method is only invoked when a subscribed event is triggered. diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IPollSensorSetting.java b/src/api/java/pneumaticCraft/api/universalSensor/IPollSensorSetting.java index 50cf8305..06467fe3 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/IPollSensorSetting.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/IPollSensorSetting.java @@ -2,7 +2,7 @@ package pneumaticCraft.api.universalSensor; import net.minecraft.world.World; -public interface IPollSensorSetting extends ISensorSetting{ +public interface IPollSensorSetting extends ISensorSetting { /** * The value returned here is the interval between every check in ticks (the interval of calling getRedstoneValue()). @@ -23,5 +23,4 @@ public interface IPollSensorSetting extends ISensorSetting{ * @return */ public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText); - } diff --git a/src/api/java/pneumaticCraft/api/universalSensor/ISensorSetting.java b/src/api/java/pneumaticCraft/api/universalSensor/ISensorSetting.java index bfbf3468..9ad11080 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/ISensorSetting.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/ISensorSetting.java @@ -1,17 +1,15 @@ package pneumaticCraft.api.universalSensor; import java.util.List; - import net.minecraft.client.gui.FontRenderer; - import org.lwjgl.util.Rectangle; -public interface ISensorSetting{ +public interface ISensorSetting { /** * Should return the button path the player has to follow in which this setting is stored. * For instance, when the sensor should be located in player and is called speed, you should return "entityTracker/player/speed". * "entityTracker" indicates that this sensor needs an Entity Tracker upgrade to run. You can choose from the following upgrades: - * + * * -entityTracker * -blockTracker * -gpsTool (so you can use a certain coordinate (within range) to measure on) @@ -23,7 +21,7 @@ public interface ISensorSetting{ * -coordinateTracker * -range * -security - * + * * You can allow only sensors to work by more than one upgrade, by seperating the upgrades with a '_'. For example, * "entityTracker_speed" will only let the sensor be chosen when both an Entity Tracker and a Speed Upgrade are inserted. * @return diff --git a/src/api/java/pneumaticCraft/api/universalSensor/PlayerEventSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/PlayerEventSensor.java index 19bda915..55c6e606 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/PlayerEventSensor.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/PlayerEventSensor.java @@ -1,23 +1,25 @@ package pneumaticCraft.api.universalSensor; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.event.entity.player.PlayerEvent; -import cpw.mods.fml.common.eventhandler.Event; -public abstract class PlayerEventSensor implements IEventSensorSetting{ +public abstract class PlayerEventSensor implements IEventSensorSetting { @Override - public String getSensorPath(){ + public String getSensorPath() { return "entityTracker/Player"; } @Override - public int emitRedstoneOnEvent(Event event, TileEntity sensor, int range, String textboxText){ - if(event instanceof PlayerEvent) { - EntityPlayer player = ((PlayerEvent)event).entityPlayer; - if(Math.abs(player.posX - sensor.xCoord + 0.5D) < range + 0.5D && Math.abs(player.posY - sensor.yCoord + 0.5D) < range + 0.5D && Math.abs(player.posZ - sensor.zCoord + 0.5D) < range + 0.5D) { - return emitRedstoneOnEvent((PlayerEvent)event, sensor, range); + public int emitRedstoneOnEvent(Event event, TileEntity sensor, int range, String textboxText) { + if (event instanceof PlayerEvent) { + EntityPlayer player = ((PlayerEvent) event).entityPlayer; + if (Math.abs(player.posX - sensor.xCoord + 0.5D) < range + 0.5D + && Math.abs(player.posY - sensor.yCoord + 0.5D) < range + 0.5D + && Math.abs(player.posZ - sensor.zCoord + 0.5D) < range + 0.5D) { + return emitRedstoneOnEvent((PlayerEvent) event, sensor, range); } } return 0; @@ -26,8 +28,7 @@ public abstract class PlayerEventSensor implements IEventSensorSetting{ public abstract int emitRedstoneOnEvent(PlayerEvent event, TileEntity sensor, int range); @Override - public int getRedstonePulseLength(){ + public int getRedstonePulseLength() { return 5; } - } diff --git a/src/api/java/pneumaticCraft/api/universalSensor/SensorRegistrator.java b/src/api/java/pneumaticCraft/api/universalSensor/SensorRegistrator.java index f76c0732..1d051a44 100644 --- a/src/api/java/pneumaticCraft/api/universalSensor/SensorRegistrator.java +++ b/src/api/java/pneumaticCraft/api/universalSensor/SensorRegistrator.java @@ -3,7 +3,7 @@ package pneumaticCraft.api.universalSensor; /** * With this class you can register your own sensors. */ -public class SensorRegistrator{ +public class SensorRegistrator { /** * This field will be initialized in the PreInit phase of PneumaticCraft's loading phase. * With this field you can register every Universal Sensor sensor you want. Just pass a new instance @@ -11,7 +11,7 @@ public class SensorRegistrator{ */ public static ISensorRegistrator sensorRegistrator; - public static interface ISensorRegistrator{ + public static interface ISensorRegistrator { /** * Registry for IPollSensorSetting, EntityPollSensor and IEventSensorSetting, and any other instance of ISensorSetting. * @param sensor diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 89444234..266b1277 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -1,20 +1,6 @@ package WayofTime.alchemicalWizardry; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - import WayofTime.alchemicalWizardry.api.BlockStack; -import WayofTime.alchemicalWizardry.client.nei.IMCForNEI; -import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor; import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; @@ -31,6 +17,7 @@ import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.ComplexNetworkHandler; import WayofTime.alchemicalWizardry.api.spell.*; import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry; +import WayofTime.alchemicalWizardry.client.nei.IMCForNEI; import WayofTime.alchemicalWizardry.common.*; import WayofTime.alchemicalWizardry.common.achievements.ModAchievements; import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry; @@ -67,6 +54,7 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.*; import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.*; import WayofTime.alchemicalWizardry.common.spell.simple.*; import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW; +import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor; import WayofTime.alchemicalWizardry.common.tileEntity.*; import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler; import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration; @@ -77,6 +65,17 @@ import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -104,10 +103,13 @@ import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "GRADLETOKEN_VERSION", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory") -public class AlchemicalWizardry -{ - public static boolean parseTextFiles = false; +@Mod( + modid = "AWWayofTime", + name = "AlchemicalWizardry", + version = "GRADLETOKEN_VERSION", + guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory") +public class AlchemicalWizardry { + public static boolean parseTextFiles = false; public static boolean doMeteorsDestroyBlocks = true; public static String[] allowedCrushedOresArray; @@ -148,36 +150,36 @@ public class AlchemicalWizardry public static int customPotionDemonCloakID; public static int customPotionAmphibianID; - public static boolean ritualDisabledWater; - public static boolean ritualDisabledLava; - public static boolean ritualDisabledGreenGrove; - public static boolean ritualDisabledInterdiction; - public static boolean ritualDisabledContainment; - public static boolean ritualDisabledBinding; - public static boolean ritualDisabledUnbinding; - public static boolean ritualDisabledHighJump; - public static boolean ritualDisabledMagnetism; - public static boolean ritualDisabledCrusher; - public static boolean ritualDisabledSpeed; - public static boolean ritualDisabledAnimalGrowth; - public static boolean ritualDisabledSuffering; - public static boolean ritualDisabledRegen; - public static boolean ritualDisabledFeatheredKnife; - public static boolean ritualDisabledFeatheredEarth; - public static boolean ritualDisabledGaia; - public static boolean ritualDisabledCondor; - public static boolean ritualDisabledFallingTower; - public static boolean ritualDisabledBalladOfAlchemy; - public static boolean ritualDisabledExpulsion; - public static boolean ritualDisabledSuppression; - public static boolean ritualDisabledZephyr; - public static boolean ritualDisabledHarvest; - public static boolean ritualDisabledConduit; - public static boolean ritualDisabledEllipsoid; - public static boolean ritualDisabledEvaporation; - public static boolean ritualDisabledSpawnWard; - public static boolean ritualDisabledVeilOfEvil; - public static boolean ritualDisabledFullStomach; + public static boolean ritualDisabledWater; + public static boolean ritualDisabledLava; + public static boolean ritualDisabledGreenGrove; + public static boolean ritualDisabledInterdiction; + public static boolean ritualDisabledContainment; + public static boolean ritualDisabledBinding; + public static boolean ritualDisabledUnbinding; + public static boolean ritualDisabledHighJump; + public static boolean ritualDisabledMagnetism; + public static boolean ritualDisabledCrusher; + public static boolean ritualDisabledSpeed; + public static boolean ritualDisabledAnimalGrowth; + public static boolean ritualDisabledSuffering; + public static boolean ritualDisabledRegen; + public static boolean ritualDisabledFeatheredKnife; + public static boolean ritualDisabledFeatheredEarth; + public static boolean ritualDisabledGaia; + public static boolean ritualDisabledCondor; + public static boolean ritualDisabledFallingTower; + public static boolean ritualDisabledBalladOfAlchemy; + public static boolean ritualDisabledExpulsion; + public static boolean ritualDisabledSuppression; + public static boolean ritualDisabledZephyr; + public static boolean ritualDisabledHarvest; + public static boolean ritualDisabledConduit; + public static boolean ritualDisabledEllipsoid; + public static boolean ritualDisabledEvaporation; + public static boolean ritualDisabledSpawnWard; + public static boolean ritualDisabledVeilOfEvil; + public static boolean ritualDisabledFullStomach; public static boolean ritualDisabledConvocation; public static boolean ritualDisabledSymmetry; public static boolean ritualDisabledStalling; @@ -349,26 +351,25 @@ public class AlchemicalWizardry public static List wellBlacklist; - public static Logger logger = LogManager.getLogger("BloodMagic"); - public static CreativeTabs tabBloodMagic = new CreativeTabs("tabBloodMagic") - { + public static Logger logger = LogManager.getLogger("BloodMagic"); + public static CreativeTabs tabBloodMagic = new CreativeTabs("tabBloodMagic") { @Override - public ItemStack getIconItemStack() - { + public ItemStack getIconItemStack() { return new ItemStack(ModItems.weakBloodOrb, 1, 0); } @Override - public Item getTabIconItem() - { + public Item getTabIconItem() { return ModItems.weakBloodOrb; } }; - public static ToolMaterial bloodBoundToolMaterial = EnumHelper.addToolMaterial("BoundBlood", 4, 1000, 12.0f, 8.0f, 50); - public static ArmorMaterial sanguineArmourArmourMaterial = EnumHelper.addArmorMaterial("SanguineArmour", 33, new int[]{3, 8, 6, 3}, 30); + public static ToolMaterial bloodBoundToolMaterial = + EnumHelper.addToolMaterial("BoundBlood", 4, 1000, 12.0f, 8.0f, 50); + public static ArmorMaterial sanguineArmourArmourMaterial = + EnumHelper.addArmorMaterial("SanguineArmour", 33, new int[] {3, 8, 6, 3}, 30); - //Dungeon loot chances + // Dungeon loot chances public static int standardBindingAgentDungeonChance; public static int mundanePowerCatalystDungeonChance; public static int averagePowerCatalystDungeonChance; @@ -377,7 +378,7 @@ public class AlchemicalWizardry public static int averageLengtheningCatalystDungeonChance; public static int greaterLengtheningCatalystDungeonChance; - //Mob IDs + // Mob IDs public static String entityFallenAngelID = "AW001FallenAngel"; public static String entityLowerGuardianID = "AW002"; public static String entityBileDemonID = "AW003"; @@ -397,14 +398,14 @@ public class AlchemicalWizardry public static String entityMinorDemonGruntWindID = "AW017"; public static String entityMinorDemonGruntIceID = "AW018"; public static String entityMinorDemonGruntEarthID = "AW019"; - public static String entityMinorDemonGruntGuardianID = "AW020"; - public static String entityMinorDemonGruntGuardianFireID = "AW021"; - public static String entityMinorDemonGruntGuardianWindID = "AW022"; - public static String entityMinorDemonGruntGuardianIceID = "AW023"; - public static String entityMinorDemonGruntGuardianEarthID = "AW024"; + public static String entityMinorDemonGruntGuardianID = "AW020"; + public static String entityMinorDemonGruntGuardianFireID = "AW021"; + public static String entityMinorDemonGruntGuardianWindID = "AW022"; + public static String entityMinorDemonGruntGuardianIceID = "AW023"; + public static String entityMinorDemonGruntGuardianEarthID = "AW024"; - public static boolean isDemonRitualCreativeOnly = false; - public static int[] demonRitualDimensionBlacklist = new int[]{0}; + public static boolean isDemonRitualCreativeOnly = false; + public static int[] demonRitualDimensionBlacklist = new int[] {0}; public static Fluid lifeEssenceFluid; @@ -413,48 +414,43 @@ public class AlchemicalWizardry public static AlchemicalWizardry instance; // Says where the client and server 'proxy' code is loaded. - @SidedProxy(clientSide = "WayofTime.alchemicalWizardry.client.ClientProxy", serverSide = "WayofTime.alchemicalWizardry.common.CommonProxy") + @SidedProxy( + clientSide = "WayofTime.alchemicalWizardry.client.ClientProxy", + serverSide = "WayofTime.alchemicalWizardry.common.CommonProxy") public static CommonProxy proxy; public static final HoldingPacketHandler packetPipeline = new HoldingPacketHandler(); @EventHandler - public void preInit(FMLPreInitializationEvent event) - { + public void preInit(FMLPreInitializationEvent event) { File bmDirectory = new File("config/BloodMagic/schematics"); - if (!bmDirectory.exists() && bmDirectory.mkdirs()) - { - try - { - InputStream in = AlchemicalWizardry.class.getResourceAsStream("/assets/alchemicalwizardry/schematics/building/buildings.zip"); + if (!bmDirectory.exists() && bmDirectory.mkdirs()) { + try { + InputStream in = AlchemicalWizardry.class.getResourceAsStream( + "/assets/alchemicalwizardry/schematics/building/buildings.zip"); logger.info("none yet!"); - if (in != null) - { + if (in != null) { logger.info("I have found a zip!"); ZipInputStream zipStream = new ZipInputStream(in); ZipEntry entry; - while ((entry = zipStream.getNextEntry()) != null) - { + while ((entry = zipStream.getNextEntry()) != null) { File file = new File(bmDirectory, entry.getName()); - if (file.exists() && file.length() > 3L) - { + if (file.exists() && file.length() > 3L) { continue; } FileOutputStream out = new FileOutputStream(file); byte[] buffer = new byte[8192]; int len; - while ((len = zipStream.read(buffer)) != -1) - { + while ((len = zipStream.read(buffer)) != -1) { out.write(buffer, 0, len); } out.close(); } } - } catch (Exception e) - { + } catch (Exception e) { } } @@ -465,17 +461,14 @@ public class AlchemicalWizardry MinecraftForge.EVENT_BUS.register(new LifeBucketHandler()); BloodMagicConfiguration.init(new File(event.getModConfigurationDirectory(), "AWWayofTime.cfg")); - //Custom config stuff goes here + // Custom config stuff goes here Potion[] potionTypes; - for (Field f : Potion.class.getDeclaredFields()) - { + for (Field f : Potion.class.getDeclaredFields()) { f.setAccessible(true); - try - { - if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) - { + try { + if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) { Field modfield = Field.class.getDeclaredField("modifiers"); modfield.setAccessible(true); modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL); @@ -484,8 +477,7 @@ public class AlchemicalWizardry System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length); f.set(null, newPotionTypes); } - } catch (Exception e) - { + } catch (Exception e) { System.err.println("Severe error, please report this to the mod author:"); System.err.println(e); } @@ -498,8 +490,13 @@ public class AlchemicalWizardry ModItems.init(); ModItems.registerItems(); - RecipeSorter.register("AWWayofTime:shapedorb", ShapedBloodOrbRecipe.class, Category.SHAPED, "before:minecraft:shapeless"); - RecipeSorter.register("AWWayofTime:shapelessorb", ShapelessBloodOrbRecipe.class, Category.SHAPELESS, "after:minecraft:shapeless"); + RecipeSorter.register( + "AWWayofTime:shapedorb", ShapedBloodOrbRecipe.class, Category.SHAPED, "before:minecraft:shapeless"); + RecipeSorter.register( + "AWWayofTime:shapelessorb", + ShapelessBloodOrbRecipe.class, + Category.SHAPELESS, + "after:minecraft:shapeless"); Object eventHook = new AlchemicalWizardryEventHooks(); FMLCommonHandler.instance().bus().register(eventHook); @@ -511,19 +508,18 @@ public class AlchemicalWizardry } @EventHandler - public void load(FMLInitializationEvent event) - { + public void load(FMLInitializationEvent event) { int craftingConstant = OreDictionary.WILDCARD_VALUE; ModBlocks.registerBlocksInInit(); - //blocks + // blocks proxy.registerRenderers(); proxy.registerEntities(); proxy.registerEntityTrackers(); proxy.registerEvents(); - //ItemStacks used for crafting go here + // ItemStacks used for crafting go here ItemStack lapisStack = new ItemStack(Items.dye, 1, 4); ItemStack lavaBucketStack = new ItemStack(Items.lava_bucket); ItemStack cobblestoneStack = new ItemStack(Blocks.cobblestone, 1, craftingConstant); @@ -613,85 +609,620 @@ public class AlchemicalWizardry ItemStack crystallosStack = new ItemStack(ModItems.crystallos); ItemStack crepitousStack = new ItemStack(ModItems.crepitous); ItemStack magicalesStack = new ItemStack(ModItems.magicales); - //All crafting goes here - GameRegistry.addRecipe(sacrificialDaggerStack, "ggg", " dg", "i g", 'g', glassStack, 'd', goldIngotStack, 'i', ironIngotStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(lavaCrystalStackCrafted, "glg", "lbl", "odo", 'g', glassStack, 'l', lavaBucketStack, 'b', weakBloodOrbStack, 'd', diamondStack, 'o', obsidianStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(waterSigilStackCrafted, "www", "wbw", "wow", 'w', waterBucketStack, 'b', blankSlateStack, 'o', weakBloodOrbStack)); - GameRegistry.addRecipe(lavaSigilStackCrafted, "lml", "lbl", "lcl", 'l', lavaBucketStack, 'b', blankSlateStack, 'm', magmaCreamStack, 'c', lavaCrystalStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(voidSigilStackCrafted, "ese", "ere", "eoe", 'e', emptyBucketStack, 'r', reinforcedSlateStack, 'o', apprenticeBloodOrbStack, 's', stringStack)); - GameRegistry.addRecipe(bloodAltarStack, "s s", "scs", "gdg", 's', stoneStack, 'c', furnaceStack, 'd', diamondStack, 'g', goldIngotStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(bloodRuneCraftedStack, "sss", "ror", "sss", 's', stoneStack, 'o', weakBloodOrbStack, 'r', blankSlateStack)); - GameRegistry.addRecipe(speedRuneStack, "sbs", "uru", "sbs", 'u', sugarStack, 's', stoneStack, 'r', bloodRuneStack, 'b', blankSlateStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 1), "sbs", "bob", "srs", 's', stoneStack, 'o', magicianBloodOrbStack, 'b', emptyBucketStack, 'r', new ItemStack(ModItems.imbuedSlate))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 2), "sbs", "bob", "srs", 's', stoneStack, 'o', magicianBloodOrbStack, 'b', waterBucketStack, 'r', new ItemStack(ModItems.imbuedSlate))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 3), "sws", "ror", "sws", 's', stoneStack, 'o', new ItemStack(ModItems.masterBloodOrb), 'w', weakBloodOrbStack, 'r', new ItemStack(ModItems.demonicSlate))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 4), "srs", "beb", "sos", 's', obsidianStack, 'o', new ItemStack(ModItems.masterBloodOrb), 'r', new ItemStack(ModItems.demonicSlate), 'b', emptyBucketStack, 'e', new ItemStack(ModBlocks.bloodRune, 1, 1))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(airSigilStack, "fgf", "fsf", "fof", 'f', featherStack, 'g', ghastTearStack, 's', reinforcedSlateStack, 'o', apprenticeBloodOrbStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(miningSigilStackCrafted, "sps", "hra", "sos", 'o', apprenticeBloodOrbStack, 's', stoneStack, 'p', ironPickaxeStack, 'h', ironShovelStack, 'a', ironAxeStack, 'r', reinforcedSlateStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', goldIngotStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSelfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', glowstoneDustStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(divinationSigilStackCrafted, "ggg", "gsg", "gog", 'g', glassStack, 's', blankSlateStack, 'o', weakBloodOrbStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(seerSigilStackCrafted, "gbg", "gsg", "gog", 'g', glassStack, 's', divinationSigilStackCrafted, 'o', apprenticeBloodOrbStack, 'b', new ItemStack(ModItems.bucketLife))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(ritualStoneStackCrafted, "srs", "ror", "srs", 's', obsidianStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(masterRitualStoneStack, "brb", "ror", "brb", 'b', obsidianStack, 'o', magicianBloodOrbStack, 'r', ritualStoneStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(imperfectRitualStoneStack, "bsb", "sos", "bsb", 's', stoneStack, 'b', obsidianStack, 'o', weakBloodOrbStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(sigilOfElementalAffinityStackCrafted, "oao", "wsl", "oro", 'o', obsidianStack, 'a', airSigilStack, 'w', waterSigilStack, 'l', lavaSigilStack, 'r', magicianBloodOrbStack, 's', imbuedSlateStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(sigilOfHoldingStack, "asa", "srs", "aoa", 'a', blankSlateStack, 's', stoneStack, 'r', imbuedSlateStack, 'o', magicianBloodOrbStack)); - GameRegistry.addRecipe(emptySocketStack, "bgb", "gdg", "bgb", 'b', weakBloodShardStack, 'g', glassStack, 'd', diamondStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(armourForgeStack, "sfs", "fof", "sfs", 'f', bloodSocketStack, 's', stoneStack, 'o', magicianBloodOrbStack)); + // All crafting goes here + GameRegistry.addRecipe( + sacrificialDaggerStack, "ggg", " dg", "i g", 'g', glassStack, 'd', goldIngotStack, 'i', ironIngotStack); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + lavaCrystalStackCrafted, + "glg", + "lbl", + "odo", + 'g', + glassStack, + 'l', + lavaBucketStack, + 'b', + weakBloodOrbStack, + 'd', + diamondStack, + 'o', + obsidianStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + waterSigilStackCrafted, + "www", + "wbw", + "wow", + 'w', + waterBucketStack, + 'b', + blankSlateStack, + 'o', + weakBloodOrbStack)); + GameRegistry.addRecipe( + lavaSigilStackCrafted, + "lml", + "lbl", + "lcl", + 'l', + lavaBucketStack, + 'b', + blankSlateStack, + 'm', + magmaCreamStack, + 'c', + lavaCrystalStack); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + voidSigilStackCrafted, + "ese", + "ere", + "eoe", + 'e', + emptyBucketStack, + 'r', + reinforcedSlateStack, + 'o', + apprenticeBloodOrbStack, + 's', + stringStack)); + GameRegistry.addRecipe( + bloodAltarStack, + "s s", + "scs", + "gdg", + 's', + stoneStack, + 'c', + furnaceStack, + 'd', + diamondStack, + 'g', + goldIngotStack); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + bloodRuneCraftedStack, + "sss", + "ror", + "sss", + 's', + stoneStack, + 'o', + weakBloodOrbStack, + 'r', + blankSlateStack)); + GameRegistry.addRecipe( + speedRuneStack, + "sbs", + "uru", + "sbs", + 'u', + sugarStack, + 's', + stoneStack, + 'r', + bloodRuneStack, + 'b', + blankSlateStack); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModBlocks.bloodRune, 1, 1), + "sbs", + "bob", + "srs", + 's', + stoneStack, + 'o', + magicianBloodOrbStack, + 'b', + emptyBucketStack, + 'r', + new ItemStack(ModItems.imbuedSlate))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModBlocks.bloodRune, 1, 2), + "sbs", + "bob", + "srs", + 's', + stoneStack, + 'o', + magicianBloodOrbStack, + 'b', + waterBucketStack, + 'r', + new ItemStack(ModItems.imbuedSlate))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModBlocks.bloodRune, 1, 3), + "sws", + "ror", + "sws", + 's', + stoneStack, + 'o', + new ItemStack(ModItems.masterBloodOrb), + 'w', + weakBloodOrbStack, + 'r', + new ItemStack(ModItems.demonicSlate))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModBlocks.bloodRune, 1, 4), + "srs", + "beb", + "sos", + 's', + obsidianStack, + 'o', + new ItemStack(ModItems.masterBloodOrb), + 'r', + new ItemStack(ModItems.demonicSlate), + 'b', + emptyBucketStack, + 'e', + new ItemStack(ModBlocks.bloodRune, 1, 1))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + airSigilStack, + "fgf", + "fsf", + "fof", + 'f', + featherStack, + 'g', + ghastTearStack, + 's', + reinforcedSlateStack, + 'o', + apprenticeBloodOrbStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + miningSigilStackCrafted, + "sps", + "hra", + "sos", + 'o', + apprenticeBloodOrbStack, + 's', + stoneStack, + 'p', + ironPickaxeStack, + 'h', + ironShovelStack, + 'a', + ironAxeStack, + 'r', + reinforcedSlateStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + runeOfSacrificeStack, + "srs", + "gog", + "srs", + 's', + stoneStack, + 'g', + goldIngotStack, + 'o', + apprenticeBloodOrbStack, + 'r', + reinforcedSlateStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + runeOfSelfSacrificeStack, + "srs", + "gog", + "srs", + 's', + stoneStack, + 'g', + glowstoneDustStack, + 'o', + apprenticeBloodOrbStack, + 'r', + reinforcedSlateStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + divinationSigilStackCrafted, + "ggg", + "gsg", + "gog", + 'g', + glassStack, + 's', + blankSlateStack, + 'o', + weakBloodOrbStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + seerSigilStackCrafted, + "gbg", + "gsg", + "gog", + 'g', + glassStack, + 's', + divinationSigilStackCrafted, + 'o', + apprenticeBloodOrbStack, + 'b', + new ItemStack(ModItems.bucketLife))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + ritualStoneStackCrafted, + "srs", + "ror", + "srs", + 's', + obsidianStack, + 'o', + apprenticeBloodOrbStack, + 'r', + reinforcedSlateStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + masterRitualStoneStack, + "brb", + "ror", + "brb", + 'b', + obsidianStack, + 'o', + magicianBloodOrbStack, + 'r', + ritualStoneStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + imperfectRitualStoneStack, + "bsb", + "sos", + "bsb", + 's', + stoneStack, + 'b', + obsidianStack, + 'o', + weakBloodOrbStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + sigilOfElementalAffinityStackCrafted, + "oao", + "wsl", + "oro", + 'o', + obsidianStack, + 'a', + airSigilStack, + 'w', + waterSigilStack, + 'l', + lavaSigilStack, + 'r', + magicianBloodOrbStack, + 's', + imbuedSlateStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + sigilOfHoldingStack, + "asa", + "srs", + "aoa", + 'a', + blankSlateStack, + 's', + stoneStack, + 'r', + imbuedSlateStack, + 'o', + magicianBloodOrbStack)); + GameRegistry.addRecipe( + emptySocketStack, "bgb", "gdg", "bgb", 'b', weakBloodShardStack, 'g', glassStack, 'd', diamondStack); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + armourForgeStack, + "sfs", + "fof", + "sfs", + 'f', + bloodSocketStack, + 's', + stoneStack, + 'o', + magicianBloodOrbStack)); GameRegistry.addShapelessRecipe(largeBloodStoneBrickStackCrafted, weakBloodShardStack, stoneStack); GameRegistry.addRecipe(bloodStoneBrickStackCrafted, "bb", "bb", 'b', largeBloodStoneBrickStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(growthSigilStack, "srs", "rer", "sos", 's', saplingStack, 'r', reedStack, 'o', apprenticeBloodOrbStack, 'e', reinforcedSlateStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(blockHomHeartStack, "www", "srs", "sos", 'w', redWoolStack, 's', stoneStack, 'r', bloodRuneStack, 'o', apprenticeBloodOrbStack)); - GameRegistry.addShapelessRecipe(new ItemStack(Items.skull, 1, 2), new ItemStack(Items.skull, 1, 1), new ItemStack(Items.rotten_flesh), new ItemStack(Items.iron_ingot), new ItemStack(Items.leather)); - GameRegistry.addShapelessRecipe(new ItemStack(Items.skull, 1, 0), new ItemStack(Items.skull, 1, 1), new ItemStack(Items.bow, 1, 0), new ItemStack(Items.arrow, 1, 0), new ItemStack(Items.bone)); - GameRegistry.addShapelessRecipe(new ItemStack(Items.skull, 1, 4), new ItemStack(Items.skull, 1, 1), new ItemStack(Items.gunpowder), new ItemStack(Blocks.dirt), new ItemStack(Blocks.sand)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.blockWritingTable), " s ", "ror", 's', new ItemStack(Items.brewing_stand), 'r', obsidianStack, 'o', weakBloodOrbStack)); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockPedestal), "ooo", " c ", "ooo", 'o', obsidianStack, 'c', weakBloodShardStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockPlinth), "iii", " p ", "iii", 'i', ironBlockStack, 'p', new ItemStack(ModBlocks.blockPedestal)); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemyFlask, 1, 0), new ItemStack(ModItems.alchemyFlask, 1, craftingConstant), new ItemStack(Items.nether_wart), redstoneStack, glowstoneDustStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfHaste), "csc", "sts", "ror", 'c', new ItemStack(Items.cookie), 's', new ItemStack(Items.sugar), 't', ModItems.demonicSlate, 'r', obsidianStack, 'o', new ItemStack(ModItems.masterBloodOrb))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfWind), "faf", "grg", "fof", 'f', featherStack, 'g', ghastTearStack, 'a', new ItemStack(ModItems.airSigil), 'o', new ItemStack(ModItems.masterBloodOrb), 'r', ModItems.demonicSlate)); - GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(ModItems.weakBloodShard, 5, 0), new ItemStack(ModItems.masterBloodOrb), new ItemStack(ModItems.weakBloodShard), imbuedSlateStack)); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockTeleposer), "ggg", "efe", "ggg", 'g', goldIngotStack, 'f', new ItemStack(ModItems.telepositionFocus), 'e', new ItemStack(Items.ender_pearl)); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.reinforcedTelepositionFocus), new ItemStack(ModItems.enhancedTelepositionFocus), new ItemStack(ModItems.weakBloodShard)); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.demonicTelepositionFocus), new ItemStack(ModItems.reinforcedTelepositionFocus), new ItemStack(ModItems.demonBloodShard)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfTheBridge), "nnn", "nsn", "ror", 'n', stoneStack, 'r', new ItemStack(Blocks.soul_sand), 's', imbuedSlateStack, 'o', magicianBloodOrbStack)); - GameRegistry.addRecipe(new ItemStack(ModItems.armourInhibitor), " gg", "gsg", "gg ", 'g', goldIngotStack, 's', new ItemStack(ModItems.weakBloodShard)); - GameRegistry.addRecipe(new ItemStack(ModItems.itemRitualDiviner), "d1d", "2e3", "d4d", '1', new ItemStack(ModItems.airScribeTool), '2', new ItemStack(ModItems.waterScribeTool), '3', new ItemStack(ModItems.fireScribeTool), '4', new ItemStack(ModItems.earthScribeTool), 'd', diamondStack, 'e', new ItemStack(Items.emerald)); - GameRegistry.addRecipe(duskRitualDivinerStack, " d ", "srs", " d ", 'd', new ItemStack(ModItems.duskScribeTool), 's', new ItemStack(ModItems.demonicSlate), 'r', new ItemStack(ModItems.itemRitualDiviner)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfMagnetism), "bgb", "gsg", "bob", 'b', new ItemStack(Blocks.iron_block), 'g', goldIngotStack, 's', new ItemStack(ModItems.imbuedSlate), 'o', magicianBloodOrbStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.energyBazooka), "Ocd", "cb ", "d w", 'O', archmageBloodOrbStack, 'c', crepitousStack, 'b', new ItemStack(ModItems.energyBlaster), 'd', diamondStack, 'w', new ItemStack(ModItems.weakBloodShard))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemBloodLightSigil), "btb", "sss", "bob", 'o', magicianBloodOrbStack, 'b', glowstoneBlockStack, 't', new ItemStack(Blocks.torch), 's', imbuedSlateStack)); - GameRegistry.addRecipe(new ItemStack(ModItems.itemKeyOfDiablo), " gw", "gdg", "wg ", 'w', weakBloodShardStack, 'g', goldIngotStack, 'd', diamondStack); - GameRegistry.addRecipe(new ItemStack(ModItems.itemBloodPack), "gbg","flf","gsg",'s', blankSlateStack,'g', glassStack,'f',new ItemStack(Items.flint,1,craftingConstant),'b', emptyBucketStack, 'l', new ItemStack(Items.leather_chestplate)); - customPotionDrowning = (new PotionDrowning(customPotionDrowningID, true, 0)).setIconIndex(0, 0).setPotionName("Drowning"); - customPotionBoost = (new PotionBoost(customPotionBoostID, false, 0)).setIconIndex(0, 0).setPotionName("Boost"); - customPotionProjProt = (new PotionProjectileProtect(customPotionProjProtID, false, 0)).setIconIndex(0, 0).setPotionName("Whirlwind"); - customPotionInhibit = (new PotionInhibit(customPotionInhibitID, false, 0)).setIconIndex(0, 0).setPotionName("Inhibit"); - customPotionFlight = (new PotionFlight(customPotionFlightID, false, 0)).setIconIndex(0, 0).setPotionName("Flight"); - customPotionReciprocation = (new PotionReciprocation(customPotionReciprocationID, false, 0xFFFFFF)).setIconIndex(0, 0).setPotionName("Reciprocation"); - customPotionFlameCloak = (new PotionFlameCloak(customPotionFlameCloakID, false, 0).setIconIndex(0, 0).setPotionName("Flame Cloak")); - customPotionIceCloak = (new PotionIceCloak(customPotionIceCloakID, false, 0).setIconIndex(0, 0).setPotionName("Ice Cloak")); - customPotionHeavyHeart = (new PotionHeavyHeart(customPotionHeavyHeartID, true, 0).setIconIndex(0, 0).setPotionName("Heavy Heart")); - customPotionFireFuse = (new PotionFireFuse(customPotionFireFuseID, true, 0).setIconIndex(0, 0).setPotionName("Fire Fuse")); - customPotionPlanarBinding = (new PotionPlanarBinding(customPotionPlanarBindingID, true, 0).setIconIndex(0, 0).setPotionName("Planar Binding")); - customPotionSoulFray = (new PotionSoulFray(customPotionSoulFrayID, true, 0).setIconIndex(0, 0).setPotionName("Soul Fray")); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + growthSigilStack, + "srs", + "rer", + "sos", + 's', + saplingStack, + 'r', + reedStack, + 'o', + apprenticeBloodOrbStack, + 'e', + reinforcedSlateStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + blockHomHeartStack, + "www", + "srs", + "sos", + 'w', + redWoolStack, + 's', + stoneStack, + 'r', + bloodRuneStack, + 'o', + apprenticeBloodOrbStack)); + GameRegistry.addShapelessRecipe( + new ItemStack(Items.skull, 1, 2), + new ItemStack(Items.skull, 1, 1), + new ItemStack(Items.rotten_flesh), + new ItemStack(Items.iron_ingot), + new ItemStack(Items.leather)); + GameRegistry.addShapelessRecipe( + new ItemStack(Items.skull, 1, 0), + new ItemStack(Items.skull, 1, 1), + new ItemStack(Items.bow, 1, 0), + new ItemStack(Items.arrow, 1, 0), + new ItemStack(Items.bone)); + GameRegistry.addShapelessRecipe( + new ItemStack(Items.skull, 1, 4), + new ItemStack(Items.skull, 1, 1), + new ItemStack(Items.gunpowder), + new ItemStack(Blocks.dirt), + new ItemStack(Blocks.sand)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModBlocks.blockWritingTable), + " s ", + "ror", + 's', + new ItemStack(Items.brewing_stand), + 'r', + obsidianStack, + 'o', + weakBloodOrbStack)); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockPedestal), + "ooo", + " c ", + "ooo", + 'o', + obsidianStack, + 'c', + weakBloodShardStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockPlinth), + "iii", + " p ", + "iii", + 'i', + ironBlockStack, + 'p', + new ItemStack(ModBlocks.blockPedestal)); + GameRegistry.addShapelessRecipe( + new ItemStack(ModItems.alchemyFlask, 1, 0), + new ItemStack(ModItems.alchemyFlask, 1, craftingConstant), + new ItemStack(Items.nether_wart), + redstoneStack, + glowstoneDustStack); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.sigilOfHaste), + "csc", + "sts", + "ror", + 'c', + new ItemStack(Items.cookie), + 's', + new ItemStack(Items.sugar), + 't', + ModItems.demonicSlate, + 'r', + obsidianStack, + 'o', + new ItemStack(ModItems.masterBloodOrb))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.sigilOfWind), + "faf", + "grg", + "fof", + 'f', + featherStack, + 'g', + ghastTearStack, + 'a', + new ItemStack(ModItems.airSigil), + 'o', + new ItemStack(ModItems.masterBloodOrb), + 'r', + ModItems.demonicSlate)); + GameRegistry.addRecipe(new ShapelessBloodOrbRecipe( + new ItemStack(ModItems.weakBloodShard, 5, 0), + new ItemStack(ModItems.masterBloodOrb), + new ItemStack(ModItems.weakBloodShard), + imbuedSlateStack)); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockTeleposer), + "ggg", + "efe", + "ggg", + 'g', + goldIngotStack, + 'f', + new ItemStack(ModItems.telepositionFocus), + 'e', + new ItemStack(Items.ender_pearl)); + GameRegistry.addShapelessRecipe( + new ItemStack(ModItems.reinforcedTelepositionFocus), + new ItemStack(ModItems.enhancedTelepositionFocus), + new ItemStack(ModItems.weakBloodShard)); + GameRegistry.addShapelessRecipe( + new ItemStack(ModItems.demonicTelepositionFocus), + new ItemStack(ModItems.reinforcedTelepositionFocus), + new ItemStack(ModItems.demonBloodShard)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.sigilOfTheBridge), + "nnn", + "nsn", + "ror", + 'n', + stoneStack, + 'r', + new ItemStack(Blocks.soul_sand), + 's', + imbuedSlateStack, + 'o', + magicianBloodOrbStack)); + GameRegistry.addRecipe( + new ItemStack(ModItems.armourInhibitor), + " gg", + "gsg", + "gg ", + 'g', + goldIngotStack, + 's', + new ItemStack(ModItems.weakBloodShard)); + GameRegistry.addRecipe( + new ItemStack(ModItems.itemRitualDiviner), + "d1d", + "2e3", + "d4d", + '1', + new ItemStack(ModItems.airScribeTool), + '2', + new ItemStack(ModItems.waterScribeTool), + '3', + new ItemStack(ModItems.fireScribeTool), + '4', + new ItemStack(ModItems.earthScribeTool), + 'd', + diamondStack, + 'e', + new ItemStack(Items.emerald)); + GameRegistry.addRecipe( + duskRitualDivinerStack, + " d ", + "srs", + " d ", + 'd', + new ItemStack(ModItems.duskScribeTool), + 's', + new ItemStack(ModItems.demonicSlate), + 'r', + new ItemStack(ModItems.itemRitualDiviner)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.sigilOfMagnetism), + "bgb", + "gsg", + "bob", + 'b', + new ItemStack(Blocks.iron_block), + 'g', + goldIngotStack, + 's', + new ItemStack(ModItems.imbuedSlate), + 'o', + magicianBloodOrbStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.energyBazooka), + "Ocd", + "cb ", + "d w", + 'O', + archmageBloodOrbStack, + 'c', + crepitousStack, + 'b', + new ItemStack(ModItems.energyBlaster), + 'd', + diamondStack, + 'w', + new ItemStack(ModItems.weakBloodShard))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.itemBloodLightSigil), + "btb", + "sss", + "bob", + 'o', + magicianBloodOrbStack, + 'b', + glowstoneBlockStack, + 't', + new ItemStack(Blocks.torch), + 's', + imbuedSlateStack)); + GameRegistry.addRecipe( + new ItemStack(ModItems.itemKeyOfDiablo), + " gw", + "gdg", + "wg ", + 'w', + weakBloodShardStack, + 'g', + goldIngotStack, + 'd', + diamondStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.itemBloodPack), + "gbg", + "flf", + "gsg", + 's', + blankSlateStack, + 'g', + glassStack, + 'f', + new ItemStack(Items.flint, 1, craftingConstant), + 'b', + emptyBucketStack, + 'l', + new ItemStack(Items.leather_chestplate)); + customPotionDrowning = (new PotionDrowning(customPotionDrowningID, true, 0)) + .setIconIndex(0, 0) + .setPotionName("Drowning"); + customPotionBoost = (new PotionBoost(customPotionBoostID, false, 0)) + .setIconIndex(0, 0) + .setPotionName("Boost"); + customPotionProjProt = (new PotionProjectileProtect(customPotionProjProtID, false, 0)) + .setIconIndex(0, 0) + .setPotionName("Whirlwind"); + customPotionInhibit = (new PotionInhibit(customPotionInhibitID, false, 0)) + .setIconIndex(0, 0) + .setPotionName("Inhibit"); + customPotionFlight = (new PotionFlight(customPotionFlightID, false, 0)) + .setIconIndex(0, 0) + .setPotionName("Flight"); + customPotionReciprocation = (new PotionReciprocation(customPotionReciprocationID, false, 0xFFFFFF)) + .setIconIndex(0, 0) + .setPotionName("Reciprocation"); + customPotionFlameCloak = (new PotionFlameCloak(customPotionFlameCloakID, false, 0) + .setIconIndex(0, 0) + .setPotionName("Flame Cloak")); + customPotionIceCloak = (new PotionIceCloak(customPotionIceCloakID, false, 0) + .setIconIndex(0, 0) + .setPotionName("Ice Cloak")); + customPotionHeavyHeart = (new PotionHeavyHeart(customPotionHeavyHeartID, true, 0) + .setIconIndex(0, 0) + .setPotionName("Heavy Heart")); + customPotionFireFuse = (new PotionFireFuse(customPotionFireFuseID, true, 0) + .setIconIndex(0, 0) + .setPotionName("Fire Fuse")); + customPotionPlanarBinding = (new PotionPlanarBinding(customPotionPlanarBindingID, true, 0) + .setIconIndex(0, 0) + .setPotionName("Planar Binding")); + customPotionSoulFray = (new PotionSoulFray(customPotionSoulFrayID, true, 0) + .setIconIndex(0, 0) + .setPotionName("Soul Fray")); PlayerSacrificeHandler.soulFrayId = customPotionSoulFray; - customPotionSoulHarden = (new PotionSoulHarden(customPotionSoulHardenID, false, 0).setIconIndex(0, 0).setPotionName("Soul Harden")); - customPotionDeaf = (new PotionDeaf(customPotionDeafID, true, 0).setIconIndex(0, 0).setPotionName("Deafness")); - customPotionFeatherFall = (new PotionFeatherFall(customPotionFeatherFallID, false, 0).setIconIndex(0, 0).setPotionName("Feather Fall")); - customPotionDemonCloak = (new PotionDemonCloak(customPotionDemonCloakID, false, 0).setIconIndex(0, 0).setPotionName("Demon Cloaking")); - customPotionAmphibian = (new PotionAmphibian(customPotionAmphibianID, false, 0).setIconIndex(0, 0).setPotionName("Amphibian")); + customPotionSoulHarden = (new PotionSoulHarden(customPotionSoulHardenID, false, 0) + .setIconIndex(0, 0) + .setPotionName("Soul Harden")); + customPotionDeaf = + (new PotionDeaf(customPotionDeafID, true, 0).setIconIndex(0, 0).setPotionName("Deafness")); + customPotionFeatherFall = (new PotionFeatherFall(customPotionFeatherFallID, false, 0) + .setIconIndex(0, 0) + .setPotionName("Feather Fall")); + customPotionDemonCloak = (new PotionDemonCloak(customPotionDemonCloakID, false, 0) + .setIconIndex(0, 0) + .setPotionName("Demon Cloaking")); + customPotionAmphibian = (new PotionAmphibian(customPotionAmphibianID, false, 0) + .setIconIndex(0, 0) + .setPotionName("Amphibian")); ItemStack masterBloodOrbStack = new ItemStack(ModItems.masterBloodOrb); ItemStack transcendentBloodOrbStack = new ItemStack(ModItems.transcendentBloodOrb); -// ModBlocks.blockLifeEssence.setUnlocalizedName("lifeEssenceBlock"); - FluidContainerRegistry.registerFluidContainer(lifeEssenceFluid, new ItemStack(ModItems.bucketLife), FluidContainerRegistry.EMPTY_BUCKET); + // ModBlocks.blockLifeEssence.setUnlocalizedName("lifeEssenceBlock"); + FluidContainerRegistry.registerFluidContainer( + lifeEssenceFluid, new ItemStack(ModItems.bucketLife), FluidContainerRegistry.EMPTY_BUCKET); ModBlocks.blockAltar.setHarvestLevel("pickaxe", 1); - //Register Tile Entity + // Register Tile Entity GameRegistry.registerTileEntity(TEAltar.class, "containerAltar"); GameRegistry.registerTileEntity(TEMasterStone.class, "containerMasterStone"); GameRegistry.registerTileEntity(TESocket.class, "containerSocket"); @@ -735,10 +1266,10 @@ public class AlchemicalWizardry ModBlocks.blockPlinth.setHarvestLevel("pickaxe", 2); ModBlocks.blockTeleposer.setHarvestLevel("pickaxe", 2); - //Fuel handler + // Fuel handler GameRegistry.registerFuelHandler(new AlchemicalWizardryFuelHandler()); - //Gui registration + // Gui registration BloodMagicConfiguration.finishLoading(); UpgradedAltars.loadAltars(); ArmourForge.initializeRecipes(); @@ -780,44 +1311,318 @@ public class AlchemicalWizardry ItemStack strengthenedCatalystStackCrafted = new ItemStack(ModItems.baseAlchemyItems, 2, 3); ItemStack fracturedBoneStackCrafted = new ItemStack(ModItems.baseAlchemyItems, 4, 5); - //TODO NEW RECIPES! - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.weakBindingAgent), 10, new ItemStack[]{simpleCatalystStack, simpleCatalystStack, new ItemStack(Items.clay_ball)}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.standardBindingAgent), 15, new ItemStack[]{new ItemStack(ModItems.weakBindingAgent), sanctusStack, new ItemStack(ModItems.crystallos)}, 3); - AlchemyRecipeRegistry.registerRecipe(simpleCatalystStack, 2, new ItemStack[]{sugarStack, redstoneStack, redstoneStack, glowstoneDustStack, new ItemStack(Items.gunpowder)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.incendium), 5, new ItemStack[]{lavaBucketStack, new ItemStack(Items.blaze_powder), new ItemStack(Items.blaze_powder), new ItemStack(Blocks.netherrack), simpleCatalystStack}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.aether), 5, new ItemStack[]{featherStack, featherStack, glowstoneDustStack, ghastTearStack, simpleCatalystStack}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.sanctus), 5, new ItemStack[]{glowstoneDustStack, new ItemStack(Items.gold_nugget), glowstoneDustStack, glassStack, simpleCatalystStack}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.crepitous), 5, new ItemStack[]{new ItemStack(Items.gunpowder), new ItemStack(Items.gunpowder), cobblestoneStack, cobblestoneStack, simpleCatalystStack}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.crystallos), 5, new ItemStack[]{new ItemStack(Blocks.ice), new ItemStack(Blocks.ice), new ItemStack(Blocks.snow), new ItemStack(Blocks.snow), simpleCatalystStack}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.terrae), 5, new ItemStack[]{new ItemStack(Blocks.dirt), new ItemStack(Blocks.sand), obsidianStack, obsidianStack, simpleCatalystStack}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.aquasalus), 5, new ItemStack[]{simpleCatalystStack, new ItemStack(Items.dye, 1, 0), new ItemStack(Items.potionitem, 1, 0), new ItemStack(Items.potionitem, 1, 0), new ItemStack(Items.potionitem, 1, 0)}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.tennebrae), 5, new ItemStack[]{simpleCatalystStack, new ItemStack(Items.coal), new ItemStack(Items.coal), new ItemStack(Blocks.obsidian), new ItemStack(Items.clay_ball)}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.magicales), 5, new ItemStack[]{redstoneStack, simpleCatalystStack, new ItemStack(Items.gunpowder), new ItemStack(Items.glowstone_dust), new ItemStack(Items.glowstone_dust)}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.mundanePowerCatalyst), 10, new ItemStack[]{glowstoneDustStack, glowstoneDustStack, glowstoneDustStack, new ItemStack(ModItems.weakBindingAgent), simpleCatalystStack}, 3); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.mundaneLengtheningCatalyst), 10, new ItemStack[]{redstoneStack, redstoneStack, redstoneStack, new ItemStack(ModItems.weakBindingAgent), simpleCatalystStack}, 3); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.averagePowerCatalyst), 20, new ItemStack[]{new ItemStack(ModItems.mundanePowerCatalyst), new ItemStack(ModItems.mundanePowerCatalyst), new ItemStack(ModItems.standardBindingAgent)}, 4); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.averageLengtheningCatalyst), 20, new ItemStack[]{new ItemStack(ModItems.mundaneLengtheningCatalyst), new ItemStack(ModItems.mundaneLengtheningCatalyst), new ItemStack(ModItems.standardBindingAgent)}, 4); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.greaterPowerCatalyst), 30, new ItemStack[]{new ItemStack(ModItems.averagePowerCatalyst), new ItemStack(ModItems.averagePowerCatalyst), new ItemStack(ModItems.incendium)}, 4); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.greaterLengtheningCatalyst), 30, new ItemStack[]{new ItemStack(ModItems.averageLengtheningCatalyst), new ItemStack(ModItems.averageLengtheningCatalyst), new ItemStack(ModItems.aquasalus)}, 4); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.weakFillingAgent), 5, new ItemStack[]{simpleCatalystStack, new ItemStack(Items.nether_wart), redstoneStack, glowstoneDustStack}, 3); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.standardFillingAgent), 10, new ItemStack[]{new ItemStack(ModItems.weakFillingAgent), new ItemStack(ModItems.terrae)}, 3); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.enhancedFillingAgent), 25, new ItemStack[]{new ItemStack(ModItems.standardFillingAgent), new ItemStack(ModItems.aquasalus), new ItemStack(ModItems.magicales)}, 4); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.activationCrystal, 1, 1), 100, new ItemStack[]{new ItemStack(ModItems.activationCrystal, 1, 0), new ItemStack(ModItems.demonBloodShard), incendiumStack, aquasalusStack, aetherStack}, 4); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.activationCrystal, 1, 1), 100, new ItemStack[]{new ItemStack(ModItems.activationCrystal, 1, 0), new ItemStack(Items.nether_star), incendiumStack, aquasalusStack, aetherStack}, 4); + // TODO NEW RECIPES! + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.weakBindingAgent), + 10, + new ItemStack[] {simpleCatalystStack, simpleCatalystStack, new ItemStack(Items.clay_ball)}, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.standardBindingAgent), + 15, + new ItemStack[] { + new ItemStack(ModItems.weakBindingAgent), sanctusStack, new ItemStack(ModItems.crystallos) + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + simpleCatalystStack, + 2, + new ItemStack[] { + sugarStack, redstoneStack, redstoneStack, glowstoneDustStack, new ItemStack(Items.gunpowder) + }, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.incendium), + 5, + new ItemStack[] { + lavaBucketStack, + new ItemStack(Items.blaze_powder), + new ItemStack(Items.blaze_powder), + new ItemStack(Blocks.netherrack), + simpleCatalystStack + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.aether), + 5, + new ItemStack[] {featherStack, featherStack, glowstoneDustStack, ghastTearStack, simpleCatalystStack}, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.sanctus), + 5, + new ItemStack[] { + glowstoneDustStack, + new ItemStack(Items.gold_nugget), + glowstoneDustStack, + glassStack, + simpleCatalystStack + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.crepitous), + 5, + new ItemStack[] { + new ItemStack(Items.gunpowder), + new ItemStack(Items.gunpowder), + cobblestoneStack, + cobblestoneStack, + simpleCatalystStack + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.crystallos), + 5, + new ItemStack[] { + new ItemStack(Blocks.ice), + new ItemStack(Blocks.ice), + new ItemStack(Blocks.snow), + new ItemStack(Blocks.snow), + simpleCatalystStack + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.terrae), + 5, + new ItemStack[] { + new ItemStack(Blocks.dirt), + new ItemStack(Blocks.sand), + obsidianStack, + obsidianStack, + simpleCatalystStack + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.aquasalus), + 5, + new ItemStack[] { + simpleCatalystStack, + new ItemStack(Items.dye, 1, 0), + new ItemStack(Items.potionitem, 1, 0), + new ItemStack(Items.potionitem, 1, 0), + new ItemStack(Items.potionitem, 1, 0) + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.tennebrae), + 5, + new ItemStack[] { + simpleCatalystStack, + new ItemStack(Items.coal), + new ItemStack(Items.coal), + new ItemStack(Blocks.obsidian), + new ItemStack(Items.clay_ball) + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.magicales), + 5, + new ItemStack[] { + redstoneStack, + simpleCatalystStack, + new ItemStack(Items.gunpowder), + new ItemStack(Items.glowstone_dust), + new ItemStack(Items.glowstone_dust) + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.mundanePowerCatalyst), + 10, + new ItemStack[] { + glowstoneDustStack, + glowstoneDustStack, + glowstoneDustStack, + new ItemStack(ModItems.weakBindingAgent), + simpleCatalystStack + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.mundaneLengtheningCatalyst), + 10, + new ItemStack[] { + redstoneStack, + redstoneStack, + redstoneStack, + new ItemStack(ModItems.weakBindingAgent), + simpleCatalystStack + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.averagePowerCatalyst), + 20, + new ItemStack[] { + new ItemStack(ModItems.mundanePowerCatalyst), + new ItemStack(ModItems.mundanePowerCatalyst), + new ItemStack(ModItems.standardBindingAgent) + }, + 4); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.averageLengtheningCatalyst), + 20, + new ItemStack[] { + new ItemStack(ModItems.mundaneLengtheningCatalyst), + new ItemStack(ModItems.mundaneLengtheningCatalyst), + new ItemStack(ModItems.standardBindingAgent) + }, + 4); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.greaterPowerCatalyst), + 30, + new ItemStack[] { + new ItemStack(ModItems.averagePowerCatalyst), + new ItemStack(ModItems.averagePowerCatalyst), + new ItemStack(ModItems.incendium) + }, + 4); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.greaterLengtheningCatalyst), + 30, + new ItemStack[] { + new ItemStack(ModItems.averageLengtheningCatalyst), + new ItemStack(ModItems.averageLengtheningCatalyst), + new ItemStack(ModItems.aquasalus) + }, + 4); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.weakFillingAgent), + 5, + new ItemStack[] { + simpleCatalystStack, new ItemStack(Items.nether_wart), redstoneStack, glowstoneDustStack + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.standardFillingAgent), + 10, + new ItemStack[] {new ItemStack(ModItems.weakFillingAgent), new ItemStack(ModItems.terrae)}, + 3); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.enhancedFillingAgent), + 25, + new ItemStack[] { + new ItemStack(ModItems.standardFillingAgent), + new ItemStack(ModItems.aquasalus), + new ItemStack(ModItems.magicales) + }, + 4); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.activationCrystal, 1, 1), + 100, + new ItemStack[] { + new ItemStack(ModItems.activationCrystal, 1, 0), + new ItemStack(ModItems.demonBloodShard), + incendiumStack, + aquasalusStack, + aetherStack + }, + 4); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(ModItems.activationCrystal, 1, 1), + 100, + new ItemStack[] { + new ItemStack(ModItems.activationCrystal, 1, 0), + new ItemStack(Items.nether_star), + incendiumStack, + aquasalusStack, + aetherStack + }, + 4); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.web), 2, new ItemStack[]{new ItemStack(Items.string), new ItemStack(Items.string), new ItemStack(Items.string), new ItemStack(Items.string), new ItemStack(Items.string)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.gunpowder, 2, 0), 2, new ItemStack[]{gunpowderStack, new ItemStack(Items.coal), new ItemStack(Blocks.sand)}, 1); - - AlchemyRecipeRegistry.registerRecipe(strengthenedCatalystStackCrafted, 10, new ItemStack[]{simpleCatalystStack, simpleCatalystStack, new ItemStack(Items.dye, 1, 15), new ItemStack(Items.nether_wart)}, 3); - AlchemyRecipeRegistry.registerRecipe(offensaStack, 10, new ItemStack[]{strengthenedCatalystStack, incendiumStack, new ItemStack(Items.arrow), new ItemStack(Items.flint), new ItemStack(Items.arrow)}, 3); - AlchemyRecipeRegistry.registerRecipe(praesidiumStack, 10, new ItemStack[]{strengthenedCatalystStack, tennebraeStack, ironIngotStack, new ItemStack(Blocks.web), redstoneStack}, 3); - AlchemyRecipeRegistry.registerRecipe(orbisTerraeStack, 10, new ItemStack[]{strengthenedCatalystStack, terraeStack, gunpowderStack, new ItemStack(Blocks.netherrack), new ItemStack(Blocks.sand)}, 3); - AlchemyRecipeRegistry.registerRecipe(concentratedCatalystStack, 10, new ItemStack[]{strengthenedCatalystStack, fracturedBoneStack, goldNuggetStack}, 4); - AlchemyRecipeRegistry.registerRecipe(fracturedBoneStackCrafted, 2, new ItemStack[]{new ItemStack(Items.bone), new ItemStack(Items.bone), new ItemStack(Items.bone), new ItemStack(Items.bone), gunpowderStack}, 1); - AlchemyRecipeRegistry.registerRecipe(virtusStack, 20, new ItemStack[]{redstoneStack, new ItemStack(Items.coal), strengthenedCatalystStack, redstoneStack, gunpowderStack}, 3); - AlchemyRecipeRegistry.registerRecipe(reductusStack, 20, new ItemStack[]{redstoneStack, goldIngotStack, strengthenedCatalystStack, new ItemStack(Blocks.soul_sand), new ItemStack(Items.carrot)}, 3); - AlchemyRecipeRegistry.registerRecipe(potentiaStack, 20, new ItemStack[]{glowstoneDustStack, strengthenedCatalystStack, lapisStack, lapisStack, new ItemStack(Items.quartz)}, 3); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.web), + 2, + new ItemStack[] { + new ItemStack(Items.string), + new ItemStack(Items.string), + new ItemStack(Items.string), + new ItemStack(Items.string), + new ItemStack(Items.string) + }, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.gunpowder, 2, 0), + 2, + new ItemStack[] {gunpowderStack, new ItemStack(Items.coal), new ItemStack(Blocks.sand)}, + 1); + AlchemyRecipeRegistry.registerRecipe( + strengthenedCatalystStackCrafted, + 10, + new ItemStack[] { + simpleCatalystStack, + simpleCatalystStack, + new ItemStack(Items.dye, 1, 15), + new ItemStack(Items.nether_wart) + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + offensaStack, + 10, + new ItemStack[] { + strengthenedCatalystStack, + incendiumStack, + new ItemStack(Items.arrow), + new ItemStack(Items.flint), + new ItemStack(Items.arrow) + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + praesidiumStack, + 10, + new ItemStack[] { + strengthenedCatalystStack, tennebraeStack, ironIngotStack, new ItemStack(Blocks.web), redstoneStack + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + orbisTerraeStack, + 10, + new ItemStack[] { + strengthenedCatalystStack, + terraeStack, + gunpowderStack, + new ItemStack(Blocks.netherrack), + new ItemStack(Blocks.sand) + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + concentratedCatalystStack, + 10, + new ItemStack[] {strengthenedCatalystStack, fracturedBoneStack, goldNuggetStack}, + 4); + AlchemyRecipeRegistry.registerRecipe( + fracturedBoneStackCrafted, + 2, + new ItemStack[] { + new ItemStack(Items.bone), + new ItemStack(Items.bone), + new ItemStack(Items.bone), + new ItemStack(Items.bone), + gunpowderStack + }, + 1); + AlchemyRecipeRegistry.registerRecipe( + virtusStack, + 20, + new ItemStack[] { + redstoneStack, new ItemStack(Items.coal), strengthenedCatalystStack, redstoneStack, gunpowderStack + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + reductusStack, + 20, + new ItemStack[] { + redstoneStack, + goldIngotStack, + strengthenedCatalystStack, + new ItemStack(Blocks.soul_sand), + new ItemStack(Items.carrot) + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + potentiaStack, + 20, + new ItemStack[] { + glowstoneDustStack, strengthenedCatalystStack, lapisStack, lapisStack, new ItemStack(Items.quartz) + }, + 3); HomSpellRegistry.registerBasicSpell(new ItemStack(Items.flint_and_steel), new SpellFireBurst()); HomSpellRegistry.registerBasicSpell(new ItemStack(Blocks.ice), new SpellFrozenWater()); @@ -828,23 +1633,161 @@ public class AlchemicalWizardry HomSpellRegistry.registerBasicSpell(new ItemStack(Items.water_bucket), new SpellWateryGrave()); HomSpellRegistry.registerBasicSpell(new ItemStack(Blocks.obsidian), new SpellEarthBender()); HomSpellRegistry.registerBasicSpell(new ItemStack(Items.ender_pearl), new SpellTeleport()); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityFallenAngelID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, aetherStack, tennebraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityLowerGuardianID), new ItemStack[]{cobblestoneStack, cobblestoneStack, terraeStack, tennebraeStack, new ItemStack(Items.iron_ingot), new ItemStack(Items.gold_nugget)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityBileDemonID), new ItemStack[]{new ItemStack(Items.poisonous_potato), tennebraeStack, terraeStack, new ItemStack(Items.porkchop), new ItemStack(Items.egg), new ItemStack(Items.beef)}, new ItemStack[]{crepitousStack, crepitousStack, terraeStack, ironBlockStack, ironBlockStack, diamondStack}, new ItemStack[]{}, 0, 5); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityWingedFireDemonID), new ItemStack[]{aetherStack, incendiumStack, incendiumStack, incendiumStack, tennebraeStack, new ItemStack(Blocks.netherrack)}, new ItemStack[]{diamondStack, new ItemStack(Blocks.gold_block), magicalesStack, magicalesStack, new ItemStack(Items.fire_charge), new ItemStack(Blocks.coal_block)}, new ItemStack[]{}, 0, 5); - SummoningRegistry.registerSummon(new SummoningHelperAW(entitySmallEarthGolemID), new ItemStack[]{new ItemStack(Items.clay_ball), terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityIceDemonID), new ItemStack[]{crystallosStack, crystallosStack, aquasalusStack, crystallosStack, sanctusStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityBoulderFistID), new ItemStack[]{terraeStack, sanctusStack, tennebraeStack, new ItemStack(Items.bone), new ItemStack(Items.cooked_beef), new ItemStack(Items.cooked_beef)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityShadeID), new ItemStack[]{tennebraeStack, tennebraeStack, tennebraeStack, aetherStack, glassStack, new ItemStack(Items.glass_bottle)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityAirElementalID), new ItemStack[]{aetherStack, aetherStack, aetherStack, aetherStack, aetherStack, aetherStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityWaterElementalID), new ItemStack[]{aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityEarthElementalID), new ItemStack[]{terraeStack, terraeStack, terraeStack, terraeStack, terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityFireElementalID), new ItemStack[]{incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityShadeElementalID), new ItemStack[]{tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); - SummoningRegistry.registerSummon(new SummoningHelperAW(entityHolyElementalID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); -// SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityMinorDemonGruntID), new ItemStack[]{incendiumStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityFallenAngelID), + new ItemStack[] {sanctusStack, sanctusStack, sanctusStack, aetherStack, tennebraeStack, terraeStack}, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityLowerGuardianID), + new ItemStack[] { + cobblestoneStack, + cobblestoneStack, + terraeStack, + tennebraeStack, + new ItemStack(Items.iron_ingot), + new ItemStack(Items.gold_nugget) + }, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityBileDemonID), + new ItemStack[] { + new ItemStack(Items.poisonous_potato), + tennebraeStack, + terraeStack, + new ItemStack(Items.porkchop), + new ItemStack(Items.egg), + new ItemStack(Items.beef) + }, + new ItemStack[] { + crepitousStack, crepitousStack, terraeStack, ironBlockStack, ironBlockStack, diamondStack + }, + new ItemStack[] {}, + 0, + 5); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityWingedFireDemonID), + new ItemStack[] { + aetherStack, + incendiumStack, + incendiumStack, + incendiumStack, + tennebraeStack, + new ItemStack(Blocks.netherrack) + }, + new ItemStack[] { + diamondStack, + new ItemStack(Blocks.gold_block), + magicalesStack, + magicalesStack, + new ItemStack(Items.fire_charge), + new ItemStack(Blocks.coal_block) + }, + new ItemStack[] {}, + 0, + 5); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entitySmallEarthGolemID), + new ItemStack[] {new ItemStack(Items.clay_ball), terraeStack, terraeStack}, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityIceDemonID), + new ItemStack[] { + crystallosStack, crystallosStack, aquasalusStack, crystallosStack, sanctusStack, terraeStack + }, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityBoulderFistID), + new ItemStack[] { + terraeStack, + sanctusStack, + tennebraeStack, + new ItemStack(Items.bone), + new ItemStack(Items.cooked_beef), + new ItemStack(Items.cooked_beef) + }, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityShadeID), + new ItemStack[] { + tennebraeStack, + tennebraeStack, + tennebraeStack, + aetherStack, + glassStack, + new ItemStack(Items.glass_bottle) + }, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityAirElementalID), + new ItemStack[] {aetherStack, aetherStack, aetherStack, aetherStack, aetherStack, aetherStack}, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityWaterElementalID), + new ItemStack[] { + aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack + }, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityEarthElementalID), + new ItemStack[] {terraeStack, terraeStack, terraeStack, terraeStack, terraeStack, terraeStack}, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityFireElementalID), + new ItemStack[] { + incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack + }, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityShadeElementalID), + new ItemStack[] { + tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack + }, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + SummoningRegistry.registerSummon( + new SummoningHelperAW(entityHolyElementalID), + new ItemStack[] {sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, + new ItemStack[] {}, + new ItemStack[] {}, + 0, + 4); + // SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityMinorDemonGruntID), new + // ItemStack[]{incendiumStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new + // ItemStack[]{}, new ItemStack[]{}, 0, 4); - //Custom mobs + // Custom mobs EntityRegistry.registerModEntity(EntityFallenAngel.class, "FallenAngel", 20, this, 80, 3, true); EntityRegistry.registerModEntity(EntityLowerGuardian.class, "LowerGuardian", 21, this, 80, 3, true); EntityRegistry.registerModEntity(EntityBileDemon.class, "BileDemon", 22, this, 80, 3, true); @@ -863,29 +1806,68 @@ public class AlchemicalWizardry EntityRegistry.registerModEntity(EntityMinorDemonGruntFire.class, "MinorDemonGruntFire", 35, this, 80, 3, true); EntityRegistry.registerModEntity(EntityMinorDemonGruntWind.class, "MinorDemonGruntWind", 36, this, 80, 3, true); EntityRegistry.registerModEntity(EntityMinorDemonGruntIce.class, "MinorDemonGruntIce", 37, this, 80, 3, true); - EntityRegistry.registerModEntity(EntityMinorDemonGruntEarth.class, "MinorDemonGruntEarth", 38, this, 80, 3, true); - EntityRegistry.registerModEntity(EntityMinorDemonGruntGuardian.class, "MinorDemonGruntGuardian", 39, this, 80, 3, true); - EntityRegistry.registerModEntity(EntityMinorDemonGruntGuardianFire.class, "MinorDemonGruntGuardianFire", 40, this, 80, 3, true); - EntityRegistry.registerModEntity(EntityMinorDemonGruntGuardianWind.class, "MinorDemonGruntGuardianWind", 41, this, 80, 3, true); - EntityRegistry.registerModEntity(EntityMinorDemonGruntGuardianIce.class, "MinorDemonGruntGuardianIce", 42, this, 80, 3, true); - EntityRegistry.registerModEntity(EntityMinorDemonGruntGuardianEarth.class, "MinorDemonGruntGuardianEarth", 43, this, 80, 3, true); + EntityRegistry.registerModEntity( + EntityMinorDemonGruntEarth.class, "MinorDemonGruntEarth", 38, this, 80, 3, true); + EntityRegistry.registerModEntity( + EntityMinorDemonGruntGuardian.class, "MinorDemonGruntGuardian", 39, this, 80, 3, true); + EntityRegistry.registerModEntity( + EntityMinorDemonGruntGuardianFire.class, "MinorDemonGruntGuardianFire", 40, this, 80, 3, true); + EntityRegistry.registerModEntity( + EntityMinorDemonGruntGuardianWind.class, "MinorDemonGruntGuardianWind", 41, this, 80, 3, true); + EntityRegistry.registerModEntity( + EntityMinorDemonGruntGuardianIce.class, "MinorDemonGruntGuardianIce", 42, this, 80, 3, true); + EntityRegistry.registerModEntity( + EntityMinorDemonGruntGuardianEarth.class, "MinorDemonGruntGuardianEarth", 43, this, 80, 3, true); + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST) + .addItem(new WeightedRandomChestContent( + new ItemStack(ModItems.standardBindingAgent), + 1, + 3, + this.standardBindingAgentDungeonChance / 5)); + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST) + .addItem(new WeightedRandomChestContent( + new ItemStack(ModItems.mundanePowerCatalyst), + 1, + 1, + this.mundanePowerCatalystDungeonChance / 5)); + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST) + .addItem(new WeightedRandomChestContent( + new ItemStack(ModItems.mundaneLengtheningCatalyst), + 1, + 1, + this.mundaneLengtheningCatalystDungeonChance / 5)); + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST) + .addItem(new WeightedRandomChestContent( + new ItemStack(ModItems.averagePowerCatalyst), + 1, + 1, + this.averagePowerCatalystDungeonChance / 5)); + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST) + .addItem(new WeightedRandomChestContent( + new ItemStack(ModItems.averageLengtheningCatalyst), + 1, + 1, + this.averageLengtheningCatalystDungeonChance / 5)); + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST) + .addItem(new WeightedRandomChestContent( + new ItemStack(ModItems.greaterPowerCatalyst), + 1, + 1, + this.greaterPowerCatalystDungeonChance / 5)); + ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST) + .addItem(new WeightedRandomChestContent( + new ItemStack(ModItems.greaterLengtheningCatalyst), + 1, + 1, + this.greaterLengtheningCatalystDungeonChance / 5)); - - ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.standardBindingAgent), 1, 3, this.standardBindingAgentDungeonChance / 5)); - ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.mundanePowerCatalyst), 1, 1, this.mundanePowerCatalystDungeonChance / 5)); - ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.mundaneLengtheningCatalyst), 1, 1, this.mundaneLengtheningCatalystDungeonChance / 5)); - ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.averagePowerCatalyst), 1, 1, this.averagePowerCatalystDungeonChance / 5)); - ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.averageLengtheningCatalyst), 1, 1, this.averageLengtheningCatalystDungeonChance / 5)); - ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.greaterPowerCatalyst), 1, 1, this.greaterPowerCatalystDungeonChance / 5)); - ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.greaterLengtheningCatalyst), 1, 1, this.greaterLengtheningCatalystDungeonChance / 5)); - - //Ore Dictionary Registration + // Ore Dictionary Registration OreDictionary.registerOre("oreCoal", Blocks.coal_ore); ItemStack stickStack = new ItemStack(Items.stick, 1, craftingConstant); - //Register spell component recipes + // Register spell component recipes ItemStack complexSpellCrystalStack = new ItemStack(ModItems.itemComplexSpellCrystal); ItemStack quartzRodStack = new ItemStack(ModItems.baseItems, 1, 0); ItemStack emptyCoreStack = new ItemStack(ModItems.baseItems, 1, 1); @@ -922,137 +1904,1161 @@ public class AlchemicalWizardry ItemStack enderShardStack = new ItemStack(ModItems.baseItems, 1, 32); ItemStack enderShardCraftedStack = new ItemStack(ModItems.baseItems, 8, 32); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockCrystal), "lsl", "sls", "lsl", 'l', lifeShardStack, 's', soulShardStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockCrystal, 4, 1), "ss", "ss", 's', new ItemStack(ModBlocks.blockCrystal, 1, 0)); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockCrystal), "lsl", "sls", "lsl", 'l', lifeShardStack, 's', soulShardStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockCrystal, 4, 1), + "ss", + "ss", + 's', + new ItemStack(ModBlocks.blockCrystal, 1, 0)); ItemStack magicalesCraftedCableStack = new ItemStack(ModItems.baseItems, 5, 2); ItemStack crackedRunicPlateStackCrafted = new ItemStack(ModItems.baseItems, 2, 15); GameRegistry.addRecipe(quartzRodStack, "qqq", 'q', new ItemStack(Items.quartz)); - GameRegistry.addRecipe(emptyCoreStack, "gig", "nrn", "gig", 'n', goldIngotStack, 'i', ironIngotStack, 'g', glassStack, 'r', simpleCatalystStack); - GameRegistry.addRecipe(magicalesCraftedCableStack, "sss", "mmm", "sss", 's', new ItemStack(Items.string), 'm', magicalesStack); - GameRegistry.addRecipe(woodBraceStack, " il", "ili", "li ", 'l', new ItemStack(Blocks.log, 1, craftingConstant), 'i', new ItemStack(Items.string)); + GameRegistry.addRecipe( + emptyCoreStack, + "gig", + "nrn", + "gig", + 'n', + goldIngotStack, + 'i', + ironIngotStack, + 'g', + glassStack, + 'r', + simpleCatalystStack); + GameRegistry.addRecipe( + magicalesCraftedCableStack, "sss", "mmm", "sss", 's', new ItemStack(Items.string), 'm', magicalesStack); + GameRegistry.addRecipe( + woodBraceStack, + " il", + "ili", + "li ", + 'l', + new ItemStack(Blocks.log, 1, craftingConstant), + 'i', + new ItemStack(Items.string)); GameRegistry.addRecipe(stoneBraceStack, " is", "isi", "si ", 'i', ironIngotStack, 's', reinforcedSlateStack); - GameRegistry.addRecipe(obsidianBraceStack, " is", "ibi", "si ", 'i', obsidianStack, 's', reinforcedSlateStack, 'b', stoneBraceStack); - GameRegistry.addRecipe(livingBraceStack, " gc", "gog", "sg ", 'g', goldIngotStack, 'o', obsidianBraceStack, 'c', lifeShardStack, 's', demonSlateStack); + GameRegistry.addRecipe( + obsidianBraceStack, + " is", + "ibi", + "si ", + 'i', + obsidianStack, + 's', + reinforcedSlateStack, + 'b', + stoneBraceStack); + GameRegistry.addRecipe( + livingBraceStack, + " gc", + "gog", + "sg ", + 'g', + goldIngotStack, + 'o', + obsidianBraceStack, + 'c', + lifeShardStack, + 's', + demonSlateStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(projectileCoreStack, "mbm", "aca", "mom", 'c', emptyCoreStack, 'b', weakBloodShardStack, 'm', magicalesStack, 'o', magicianBloodOrbStack, 'a', new ItemStack(Items.arrow))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(selfCoreStack, "sbs", "ncn", "sos", 'c', emptyCoreStack, 's', sanctusStack, 'b', weakBloodShardStack, 'o', magicianBloodOrbStack, 'n', glowstoneDustStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(meleeCoreStack, "sbs", "ncn", "sos", 'c', emptyCoreStack, 's', incendiumStack, 'b', weakBloodShardStack, 'o', magicianBloodOrbStack, 'n', new ItemStack(Items.fire_charge))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(toolCoreStack, "sbs", "ncn", "sos", 'c', emptyCoreStack, 's', terraeStack, 'b', weakBloodShardStack, 'o', magicianBloodOrbStack, 'n', new ItemStack(Blocks.obsidian))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + projectileCoreStack, + "mbm", + "aca", + "mom", + 'c', + emptyCoreStack, + 'b', + weakBloodShardStack, + 'm', + magicalesStack, + 'o', + magicianBloodOrbStack, + 'a', + new ItemStack(Items.arrow))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + selfCoreStack, + "sbs", + "ncn", + "sos", + 'c', + emptyCoreStack, + 's', + sanctusStack, + 'b', + weakBloodShardStack, + 'o', + magicianBloodOrbStack, + 'n', + glowstoneDustStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + meleeCoreStack, + "sbs", + "ncn", + "sos", + 'c', + emptyCoreStack, + 's', + incendiumStack, + 'b', + weakBloodShardStack, + 'o', + magicianBloodOrbStack, + 'n', + new ItemStack(Items.fire_charge))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + toolCoreStack, + "sbs", + "ncn", + "sos", + 'c', + emptyCoreStack, + 's', + terraeStack, + 'b', + weakBloodShardStack, + 'o', + magicianBloodOrbStack, + 'n', + new ItemStack(Blocks.obsidian))); - GameRegistry.addRecipe(paradigmBackPlateStack, "isi", "rgr", "isi", 'i', ironIngotStack, 'r', stoneStack, 'g', goldIngotStack, 's', reinforcedSlateStack); - GameRegistry.addRecipe(outputCableStack, " si", "s c", " si", 's', stoneStack, 'i', ironIngotStack, 'c', simpleCatalystStack); + GameRegistry.addRecipe( + paradigmBackPlateStack, + "isi", + "rgr", + "isi", + 'i', + ironIngotStack, + 'r', + stoneStack, + 'g', + goldIngotStack, + 's', + reinforcedSlateStack); + GameRegistry.addRecipe( + outputCableStack, " si", "s c", " si", 's', stoneStack, 'i', ironIngotStack, 'c', simpleCatalystStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(flameCoreStack, "mdm", "scs", "mom", 'm', incendiumStack, 'c', emptyCoreStack, 'o', magicianBloodOrbStack, 'd', diamondStack, 's', weakBloodShardStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(iceCoreStack, "mdm", "scs", "mom", 'm', crystallosStack, 'c', emptyCoreStack, 'o', magicianBloodOrbStack, 'd', diamondStack, 's', weakBloodShardStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(windCoreStack, "mdm", "scs", "mom", 'm', aetherStack, 'c', emptyCoreStack, 'o', magicianBloodOrbStack, 'd', diamondStack, 's', weakBloodShardStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(earthCoreStack, "mdm", "scs", "mom", 'm', terraeStack, 'c', emptyCoreStack, 'o', magicianBloodOrbStack, 'd', diamondStack, 's', weakBloodShardStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + flameCoreStack, + "mdm", + "scs", + "mom", + 'm', + incendiumStack, + 'c', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 'd', + diamondStack, + 's', + weakBloodShardStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + iceCoreStack, + "mdm", + "scs", + "mom", + 'm', + crystallosStack, + 'c', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 'd', + diamondStack, + 's', + weakBloodShardStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + windCoreStack, + "mdm", + "scs", + "mom", + 'm', + aetherStack, + 'c', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 'd', + diamondStack, + 's', + weakBloodShardStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + earthCoreStack, + "mdm", + "scs", + "mom", + 'm', + terraeStack, + 'c', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 'd', + diamondStack, + 's', + weakBloodShardStack)); - GameRegistry.addRecipe(inputCableStack, "ws ", "rcs", "ws ", 'w', blankSlateStack, 's', stoneStack, 'r', imbuedSlateStack, 'c', simpleCatalystStack); + GameRegistry.addRecipe( + inputCableStack, + "ws ", + "rcs", + "ws ", + 'w', + blankSlateStack, + 's', + stoneStack, + 'r', + imbuedSlateStack, + 'c', + simpleCatalystStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(defaultCoreStack, "msm", "geg", "mom", 'm', strengthenedCatalystStack, 'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's', weakBloodShardStack, 'g', goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(offenseCoreStack, "msm", "geg", "mom", 'm', offensaStack, 'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's', weakBloodShardStack, 'g', goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(defensiveCoreStack, "msm", "geg", "mom", 'm', praesidiumStack, 'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's', weakBloodShardStack, 'g', goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(environmentalCoreStack, "msm", "geg", "mom", 'm', orbisTerraeStack, 'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's', weakBloodShardStack, 'g', goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + defaultCoreStack, + "msm", + "geg", + "mom", + 'm', + strengthenedCatalystStack, + 'e', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 's', + weakBloodShardStack, + 'g', + goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + offenseCoreStack, + "msm", + "geg", + "mom", + 'm', + offensaStack, + 'e', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 's', + weakBloodShardStack, + 'g', + goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + defensiveCoreStack, + "msm", + "geg", + "mom", + 'm', + praesidiumStack, + 'e', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 's', + weakBloodShardStack, + 'g', + goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + environmentalCoreStack, + "msm", + "geg", + "mom", + 'm', + orbisTerraeStack, + 'e', + emptyCoreStack, + 'o', + magicianBloodOrbStack, + 's', + weakBloodShardStack, + 'g', + goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(powerCoreStack, "msm", "geg", "mom", 'm', virtusStack, 'e', emptyCoreStack, 'o', masterBloodOrbStack, 's', weakBloodShardStack, 'g', goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(costCoreStack, "msm", "geg", "mom", 'm', reductusStack, 'e', emptyCoreStack, 'o', masterBloodOrbStack, 's', weakBloodShardStack, 'g', goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(potencyCoreStack, "msm", "geg", "mom", 'm', potentiaStack, 'e', emptyCoreStack, 'o', masterBloodOrbStack, 's', weakBloodShardStack, 'g', goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + powerCoreStack, + "msm", + "geg", + "mom", + 'm', + virtusStack, + 'e', + emptyCoreStack, + 'o', + masterBloodOrbStack, + 's', + weakBloodShardStack, + 'g', + goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + costCoreStack, + "msm", + "geg", + "mom", + 'm', + reductusStack, + 'e', + emptyCoreStack, + 'o', + masterBloodOrbStack, + 's', + weakBloodShardStack, + 'g', + goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + potencyCoreStack, + "msm", + "geg", + "mom", + 'm', + potentiaStack, + 'e', + emptyCoreStack, + 'o', + masterBloodOrbStack, + 's', + weakBloodShardStack, + 'g', + goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemHarvestSigil), "mgm", "gsg", "mom", 's', etherealSlateStack, 'o', archmageBloodOrbStack, 'g', new ItemStack(Items.golden_hoe), 'm', new ItemStack(Blocks.dirt))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 5), "bsb", "grg", "bob", 's', etherealSlateStack, 'o', archmageBloodOrbStack, 'r', speedRuneStack, 'b', emptyBucketStack, 'g', goldIngotStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemCompressionSigil), "pop", "csc", "obo", 'b', masterBloodOrbStack, 'p', new ItemStack(Blocks.piston), 'c', new ItemStack(Blocks.crafting_table), 's', demonSlateStack, 'o', obsidianStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.itemHarvestSigil), + "mgm", + "gsg", + "mom", + 's', + etherealSlateStack, + 'o', + archmageBloodOrbStack, + 'g', + new ItemStack(Items.golden_hoe), + 'm', + new ItemStack(Blocks.dirt))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModBlocks.bloodRune, 1, 5), + "bsb", + "grg", + "bob", + 's', + etherealSlateStack, + 'o', + archmageBloodOrbStack, + 'r', + speedRuneStack, + 'b', + emptyBucketStack, + 'g', + goldIngotStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.itemCompressionSigil), + "pop", + "csc", + "obo", + 'b', + masterBloodOrbStack, + 'p', + new ItemStack(Blocks.piston), + 'c', + new ItemStack(Blocks.crafting_table), + 's', + demonSlateStack, + 'o', + obsidianStack)); - AlchemyRecipeRegistry.registerRecipe(crackedRunicPlateStackCrafted, 10, new ItemStack[]{imbuedSlateStack, imbuedSlateStack, concentratedCatalystStack}, 4); - AlchemyRecipeRegistry.registerRecipe(runicPlateStack, 30, new ItemStack[]{crackedRunicPlateStack, terraeStack}, 5); - AlchemyRecipeRegistry.registerRecipe(imbuedRunicPlateStack, 100, new ItemStack[]{magicalesStack, incendiumStack, runicPlateStack, runicPlateStack, aquasalusStack}, 5); - AlchemyRecipeRegistry.registerRecipe(complexSpellCrystalStack, 50, new ItemStack[]{new ItemStack(ModItems.blankSpell), weakBloodShardStack, weakBloodShardStack, diamondStack, goldIngotStack}, 3); - AlchemyRecipeRegistry.registerRecipe(soulRunicPlateStack, 150, new ItemStack[]{imbuedRunicPlateStack, soulShardStack, soulShardStack, weakBloodShardStack, diamondStack}, 6); + AlchemyRecipeRegistry.registerRecipe( + crackedRunicPlateStackCrafted, + 10, + new ItemStack[] {imbuedSlateStack, imbuedSlateStack, concentratedCatalystStack}, + 4); + AlchemyRecipeRegistry.registerRecipe( + runicPlateStack, 30, new ItemStack[] {crackedRunicPlateStack, terraeStack}, 5); + AlchemyRecipeRegistry.registerRecipe( + imbuedRunicPlateStack, + 100, + new ItemStack[] {magicalesStack, incendiumStack, runicPlateStack, runicPlateStack, aquasalusStack}, + 5); + AlchemyRecipeRegistry.registerRecipe( + complexSpellCrystalStack, + 50, + new ItemStack[] { + new ItemStack(ModItems.blankSpell), + weakBloodShardStack, + weakBloodShardStack, + diamondStack, + goldIngotStack + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + soulRunicPlateStack, + 150, + new ItemStack[] { + imbuedRunicPlateStack, soulShardStack, soulShardStack, weakBloodShardStack, diamondStack + }, + 6); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockConduit, 1, 0), "q q", "ccc", "q q", 'q', quartzRodStack, 'c', magicalesCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockConduit, 1, 0), + "q q", + "ccc", + "q q", + 'q', + quartzRodStack, + 'c', + magicalesCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellParadigm, 1, 0), "gb ", "pcw", "gb ", 'p', paradigmBackPlateStack, 'c', projectileCoreStack, 'g', goldIngotStack, 'b', stoneBraceStack, 'w', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellParadigm, 1, 1), "gb ", "pcw", "gb ", 'p', paradigmBackPlateStack, 'c', selfCoreStack, 'g', goldIngotStack, 'b', stoneBraceStack, 'w', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellParadigm, 1, 2), "gb ", "pcw", "gb ", 'p', paradigmBackPlateStack, 'c', meleeCoreStack, 'g', goldIngotStack, 'b', stoneBraceStack, 'w', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellParadigm, 1, 3), "gb ", "pcw", "gb ", 'p', paradigmBackPlateStack, 'c', toolCoreStack, 'g', goldIngotStack, 'b', stoneBraceStack, 'w', outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellParadigm, 1, 0), + "gb ", + "pcw", + "gb ", + 'p', + paradigmBackPlateStack, + 'c', + projectileCoreStack, + 'g', + goldIngotStack, + 'b', + stoneBraceStack, + 'w', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellParadigm, 1, 1), + "gb ", + "pcw", + "gb ", + 'p', + paradigmBackPlateStack, + 'c', + selfCoreStack, + 'g', + goldIngotStack, + 'b', + stoneBraceStack, + 'w', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellParadigm, 1, 2), + "gb ", + "pcw", + "gb ", + 'p', + paradigmBackPlateStack, + 'c', + meleeCoreStack, + 'g', + goldIngotStack, + 'b', + stoneBraceStack, + 'w', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellParadigm, 1, 3), + "gb ", + "pcw", + "gb ", + 'p', + paradigmBackPlateStack, + 'c', + toolCoreStack, + 'g', + goldIngotStack, + 'b', + stoneBraceStack, + 'w', + outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect, 1, 0), "bgb", "ico", "bgb", 'c', flameCoreStack, 'b', stoneBraceStack, 'g', goldIngotStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect, 1, 1), "bgb", "ico", "bgb", 'c', iceCoreStack, 'b', stoneBraceStack, 'g', goldIngotStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect, 1, 2), "bgb", "ico", "bgb", 'c', windCoreStack, 'b', stoneBraceStack, 'g', goldIngotStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect, 1, 3), "bgb", "ico", "bgb", 'c', earthCoreStack, 'b', stoneBraceStack, 'g', goldIngotStack, 'i', inputCableStack, 'o', outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEffect, 1, 0), + "bgb", + "ico", + "bgb", + 'c', + flameCoreStack, + 'b', + stoneBraceStack, + 'g', + goldIngotStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEffect, 1, 1), + "bgb", + "ico", + "bgb", + 'c', + iceCoreStack, + 'b', + stoneBraceStack, + 'g', + goldIngotStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEffect, 1, 2), + "bgb", + "ico", + "bgb", + 'c', + windCoreStack, + 'b', + stoneBraceStack, + 'g', + goldIngotStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEffect, 1, 3), + "bgb", + "ico", + "bgb", + 'c', + earthCoreStack, + 'b', + stoneBraceStack, + 'g', + goldIngotStack, + 'i', + inputCableStack, + 'o', + outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier, 1, 0), "bgb", "ico", "bgb", 'c', defaultCoreStack, 'i', inputCableStack, 'o', outputCableStack, 'b', stoneBraceStack, 'g', ironIngotStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier, 1, 1), "bgb", "ico", "bgb", 'c', offenseCoreStack, 'i', inputCableStack, 'o', outputCableStack, 'b', stoneBraceStack, 'g', ironIngotStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier, 1, 2), "bgb", "ico", "bgb", 'c', defensiveCoreStack, 'i', inputCableStack, 'o', outputCableStack, 'b', stoneBraceStack, 'g', ironIngotStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier, 1, 3), "bgb", "ico", "bgb", 'c', environmentalCoreStack, 'i', inputCableStack, 'o', outputCableStack, 'b', stoneBraceStack, 'g', ironIngotStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellModifier, 1, 0), + "bgb", + "ico", + "bgb", + 'c', + defaultCoreStack, + 'i', + inputCableStack, + 'o', + outputCableStack, + 'b', + stoneBraceStack, + 'g', + ironIngotStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellModifier, 1, 1), + "bgb", + "ico", + "bgb", + 'c', + offenseCoreStack, + 'i', + inputCableStack, + 'o', + outputCableStack, + 'b', + stoneBraceStack, + 'g', + ironIngotStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellModifier, 1, 2), + "bgb", + "ico", + "bgb", + 'c', + defensiveCoreStack, + 'i', + inputCableStack, + 'o', + outputCableStack, + 'b', + stoneBraceStack, + 'g', + ironIngotStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellModifier, 1, 3), + "bgb", + "ico", + "bgb", + 'c', + environmentalCoreStack, + 'i', + inputCableStack, + 'o', + outputCableStack, + 'b', + stoneBraceStack, + 'g', + ironIngotStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 0), "bpb", "ico", "bpb", 'c', powerCoreStack, 'b', woodBraceStack, 'p', crackedRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 1), "bpb", "ico", "bpb", 'c', powerCoreStack, 'b', stoneBraceStack, 'p', runicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 2), "bpb", "ico", "bpb", 'c', powerCoreStack, 'b', obsidianBraceStack, 'p', imbuedRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 3), "bpb", "ico", "bpb", 'c', powerCoreStack, 'b', livingBraceStack, 'p', soulRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 5), "bpb", "ico", "bpb", 'c', costCoreStack, 'b', woodBraceStack, 'p', crackedRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 6), "bpb", "ico", "bpb", 'c', costCoreStack, 'b', stoneBraceStack, 'p', runicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 7), "bpb", "ico", "bpb", 'c', costCoreStack, 'b', obsidianBraceStack, 'p', imbuedRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 8), "bpb", "ico", "bpb", 'c', costCoreStack, 'b', livingBraceStack, 'p', soulRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 10), "bpb", "ico", "bpb", 'c', potencyCoreStack, 'b', woodBraceStack, 'p', crackedRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 11), "bpb", "ico", "bpb", 'c', potencyCoreStack, 'b', stoneBraceStack, 'p', runicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 12), "bpb", "ico", "bpb", 'c', potencyCoreStack, 'b', obsidianBraceStack, 'p', imbuedRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement, 1, 13), "bpb", "ico", "bpb", 'c', potencyCoreStack, 'b', livingBraceStack, 'p', soulRunicPlateStack, 'i', inputCableStack, 'o', outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 0), + "bpb", + "ico", + "bpb", + 'c', + powerCoreStack, + 'b', + woodBraceStack, + 'p', + crackedRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 1), + "bpb", + "ico", + "bpb", + 'c', + powerCoreStack, + 'b', + stoneBraceStack, + 'p', + runicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 2), + "bpb", + "ico", + "bpb", + 'c', + powerCoreStack, + 'b', + obsidianBraceStack, + 'p', + imbuedRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 3), + "bpb", + "ico", + "bpb", + 'c', + powerCoreStack, + 'b', + livingBraceStack, + 'p', + soulRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 5), + "bpb", + "ico", + "bpb", + 'c', + costCoreStack, + 'b', + woodBraceStack, + 'p', + crackedRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 6), + "bpb", + "ico", + "bpb", + 'c', + costCoreStack, + 'b', + stoneBraceStack, + 'p', + runicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 7), + "bpb", + "ico", + "bpb", + 'c', + costCoreStack, + 'b', + obsidianBraceStack, + 'p', + imbuedRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 8), + "bpb", + "ico", + "bpb", + 'c', + costCoreStack, + 'b', + livingBraceStack, + 'p', + soulRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 10), + "bpb", + "ico", + "bpb", + 'c', + potencyCoreStack, + 'b', + woodBraceStack, + 'p', + crackedRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 11), + "bpb", + "ico", + "bpb", + 'c', + potencyCoreStack, + 'b', + stoneBraceStack, + 'p', + runicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 12), + "bpb", + "ico", + "bpb", + 'c', + potencyCoreStack, + 'b', + obsidianBraceStack, + 'p', + imbuedRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockSpellEnhancement, 1, 13), + "bpb", + "ico", + "bpb", + 'c', + potencyCoreStack, + 'b', + livingBraceStack, + 'p', + soulRunicPlateStack, + 'i', + inputCableStack, + 'o', + outputCableStack); - GameRegistry.addRecipe(new ItemStack(ModItems.itemAttunedCrystal), "Sr ", " ar", "s S", 'r', quartzRodStack, 's', new ItemStack(Items.stick, 1, craftingConstant), 'a', strengthenedCatalystStack, 'S', stoneStack); - GameRegistry.addRecipe(new ItemStack(ModItems.itemTankSegmenter), "gqi", " rq", "q g", 'q', quartzRodStack, 'i', ironIngotStack, 'r', strengthenedCatalystStack, 'g', goldIngotStack); - GameRegistry.addRecipe(new ItemStack(ModItems.itemDestinationClearer), "qcq", "c c", "qcq", 'q', quartzRodStack, 'c', simpleCatalystStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.itemAttunedCrystal), + "Sr ", + " ar", + "s S", + 'r', + quartzRodStack, + 's', + new ItemStack(Items.stick, 1, craftingConstant), + 'a', + strengthenedCatalystStack, + 'S', + stoneStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.itemTankSegmenter), + "gqi", + " rq", + "q g", + 'q', + quartzRodStack, + 'i', + ironIngotStack, + 'r', + strengthenedCatalystStack, + 'g', + goldIngotStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.itemDestinationClearer), + "qcq", + "c c", + "qcq", + 'q', + quartzRodStack, + 'c', + simpleCatalystStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockAlchemicCalcinator), "pgp", "gsg", "ccc", 'p', crackedRunicPlateStack, 'g', glassStack, 's', strengthenedCatalystStack, 'c', cobblestoneStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockCrystalBelljar), "GGG", "GcG", "www", 'G', glassStack, 'c', concentratedCatalystStack, 'w', new ItemStack(Blocks.wooden_slab, 1, craftingConstant)); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockReagentConduit), "isi", "scs", "isi", 'c', concentratedCatalystStack, 's', stringStack, 'i', ironIngotStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockAlchemicCalcinator), + "pgp", + "gsg", + "ccc", + 'p', + crackedRunicPlateStack, + 'g', + glassStack, + 's', + strengthenedCatalystStack, + 'c', + cobblestoneStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockCrystalBelljar), + "GGG", + "GcG", + "www", + 'G', + glassStack, + 'c', + concentratedCatalystStack, + 'w', + new ItemStack(Blocks.wooden_slab, 1, craftingConstant)); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockReagentConduit), + "isi", + "scs", + "isi", + 'c', + concentratedCatalystStack, + 's', + stringStack, + 'i', + ironIngotStack); - GameRegistry.addRecipe(new ItemStack(ModItems.ritualDismantler), "a a", " b ", 'a', Blocks.redstone_torch, 'b', ModItems.itemRitualDiviner); + GameRegistry.addRecipe( + new ItemStack(ModItems.ritualDismantler), + "a a", + " b ", + 'a', + Blocks.redstone_torch, + 'b', + ModItems.itemRitualDiviner); GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 5, 15), fracturedBoneStack); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemSigilOfSupression), "wtl", "wvl", "wol", 'v', new ItemStack(ModItems.voidSigil), 't', new ItemStack(ModBlocks.blockTeleposer), 'o', masterBloodOrbStack, 'l', lavaBucketStack, 'w', waterBucketStack)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemSigilOfEnderSeverance), "ptp", "ese", "pop", 's', new ItemStack(ModItems.demonicSlate), 't', weakBloodShardStack, 'o', masterBloodOrbStack, 'e', new ItemStack(Items.ender_eye), 'p', new ItemStack(Items.ender_pearl))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.itemSigilOfSupression), + "wtl", + "wvl", + "wol", + 'v', + new ItemStack(ModItems.voidSigil), + 't', + new ItemStack(ModBlocks.blockTeleposer), + 'o', + masterBloodOrbStack, + 'l', + lavaBucketStack, + 'w', + waterBucketStack)); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe( + new ItemStack(ModItems.itemSigilOfEnderSeverance), + "ptp", + "ese", + "pop", + 's', + new ItemStack(ModItems.demonicSlate), + 't', + weakBloodShardStack, + 'o', + masterBloodOrbStack, + 'e', + new ItemStack(Items.ender_eye), + 'p', + new ItemStack(Items.ender_pearl))); GameRegistry.addShapelessRecipe(enderShardCraftedStack, weakBloodShardStack, new ItemStack(Items.ender_pearl)); - GameRegistry.addRecipe(new ItemStack(ModItems.inputRoutingFocus), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', glassStack); - GameRegistry.addRecipe(new ItemStack(ModItems.outputRoutingFocus, 1, 0), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', stoneStack); - GameRegistry.addRecipe(new ItemStack(ModItems.outputRoutingFocus, 1, 1), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', new ItemStack(Blocks.sandstone)); - GameRegistry.addRecipe(new ItemStack(ModItems.outputRoutingFocus, 1, 2), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', new ItemStack(Items.dye, 1, craftingConstant)); - GameRegistry.addRecipe(new ItemStack(ModItems.outputRoutingFocus, 1, 3), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', obsidianStack); - GameRegistry.addRecipe(new ItemStack(ModItems.outputRoutingFocus, 1, 4), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', stringStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.inputRoutingFocus), + "sgs", + "geg", + "sgs", + 'e', + enderShardStack, + 's', + stickStack, + 'g', + glassStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.outputRoutingFocus, 1, 0), + "sgs", + "geg", + "sgs", + 'e', + enderShardStack, + 's', + stickStack, + 'g', + stoneStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.outputRoutingFocus, 1, 1), + "sgs", + "geg", + "sgs", + 'e', + enderShardStack, + 's', + stickStack, + 'g', + new ItemStack(Blocks.sandstone)); + GameRegistry.addRecipe( + new ItemStack(ModItems.outputRoutingFocus, 1, 2), + "sgs", + "geg", + "sgs", + 'e', + enderShardStack, + 's', + stickStack, + 'g', + new ItemStack(Items.dye, 1, craftingConstant)); + GameRegistry.addRecipe( + new ItemStack(ModItems.outputRoutingFocus, 1, 3), + "sgs", + "geg", + "sgs", + 'e', + enderShardStack, + 's', + stickStack, + 'g', + obsidianStack); + GameRegistry.addRecipe( + new ItemStack(ModItems.outputRoutingFocus, 1, 4), + "sgs", + "geg", + "sgs", + 'e', + enderShardStack, + 's', + stickStack, + 'g', + stringStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockStabilityGlyph), "1s1", "grg", "bob", 'o', transcendentBloodOrbStack, 'r', bloodRuneStack, '1', crepitousStack, 'g', etherealSlateStack, 'b', praesidiumStack, 's', magicalesStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockEnchantmentGlyph, 1, 0), "1s1", "grg", "bob", 'o', transcendentBloodOrbStack, 'r', bloodRuneStack, 'g', etherealSlateStack, 'b', magicalesStack, '1', offensaStack, 's', lifeShardStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockEnchantmentGlyph, 1, 1), "1s1", "grg", "bob", 'o', transcendentBloodOrbStack, 'r', bloodRuneStack, 'g', etherealSlateStack, 'b', magicalesStack, '1', virtusStack, 's', soulShardStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockStabilityGlyph), + "1s1", + "grg", + "bob", + 'o', + transcendentBloodOrbStack, + 'r', + bloodRuneStack, + '1', + crepitousStack, + 'g', + etherealSlateStack, + 'b', + praesidiumStack, + 's', + magicalesStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockEnchantmentGlyph, 1, 0), + "1s1", + "grg", + "bob", + 'o', + transcendentBloodOrbStack, + 'r', + bloodRuneStack, + 'g', + etherealSlateStack, + 'b', + magicalesStack, + '1', + offensaStack, + 's', + lifeShardStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockEnchantmentGlyph, 1, 1), + "1s1", + "grg", + "bob", + 'o', + transcendentBloodOrbStack, + 'r', + bloodRuneStack, + 'g', + etherealSlateStack, + 'b', + magicalesStack, + '1', + virtusStack, + 's', + soulShardStack); - GameRegistry.addRecipe(dawnRitualDivinerStack, " d ", "srs", " d ", 'd', new ItemStack(ModItems.dawnScribeTool), 's', etherealSlateStack, 'r', duskRitualDivinerStack); + GameRegistry.addRecipe( + dawnRitualDivinerStack, + " d ", + "srs", + " d ", + 'd', + new ItemStack(ModItems.dawnScribeTool), + 's', + etherealSlateStack, + 'r', + duskRitualDivinerStack); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.flint, 2, 0), 1, new ItemStack[]{new ItemStack(Blocks.gravel), new ItemStack(Items.flint)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.grass), 2, new ItemStack[]{new ItemStack(Blocks.dirt), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.leather, 3, 0), 2, new ItemStack[]{new ItemStack(Items.rotten_flesh), new ItemStack(Items.rotten_flesh), new ItemStack(Items.rotten_flesh), waterBucketStack, new ItemStack(Items.flint)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.bread), 1, new ItemStack[]{new ItemStack(Items.wheat), new ItemStack(Items.sugar)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.fire_charge, 5, 0), 3, new ItemStack[]{new ItemStack(Items.coal), new ItemStack(Items.blaze_powder), gunpowderStack}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.sand, 2, 0), 1, new ItemStack[]{new ItemStack(Blocks.cobblestone), gunpowderStack}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.clay, 4, 0), 2, new ItemStack[]{new ItemStack(Blocks.hardened_clay, 1, craftingConstant), new ItemStack(Blocks.hardened_clay, 1, craftingConstant), new ItemStack(Blocks.hardened_clay, 1, craftingConstant), new ItemStack(Blocks.hardened_clay, 1, craftingConstant), waterBucketStack}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.string, 4, 0), 1, new ItemStack[]{new ItemStack(Blocks.wool, 1, craftingConstant), new ItemStack(Items.flint)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.gravel, 2, 0), 1, new ItemStack[]{new ItemStack(Blocks.stone), gunpowderStack}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.obsidian), 1, new ItemStack[]{waterBucketStack, lavaBucketStack}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.paper), 1, new ItemStack[]{new ItemStack(Items.reeds)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.soul_sand, 3, 0), 3, new ItemStack[]{new ItemStack(Blocks.sand), new ItemStack(Blocks.sand), new ItemStack(Blocks.sand), waterBucketStack, weakBloodShardStack}, 3); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.mycelium, 1, 0), 5, new ItemStack[]{new ItemStack(Blocks.grass), new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom)}, 2); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.ice), 2, new ItemStack[]{waterBucketStack, new ItemStack(Items.snowball)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.potionitem, 1, 0), 1, new ItemStack[]{new ItemStack(Items.glass_bottle), new ItemStack(Blocks.cactus)}, 1); - AlchemyRecipeRegistry.registerRecipe(waterBucketStack, 1, new ItemStack[]{emptyBucketStack, new ItemStack(Blocks.cactus)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.glass_bottle, 3), 1, new ItemStack[]{glassStack, glassStack, glassStack}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.ghast_tear, 2), 100, new ItemStack[]{ghastTearStack, concentratedCatalystStack, weakBloodShardStack, new ItemStack(Blocks.soul_sand), new ItemStack(Blocks.soul_sand)}, 5); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.coal, 5), 1, new ItemStack[]{new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1)}, 1); - AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.clay_ball, 4), 5, new ItemStack[]{new ItemStack(Blocks.sand), waterBucketStack}, 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.flint, 2, 0), + 1, + new ItemStack[] {new ItemStack(Blocks.gravel), new ItemStack(Items.flint)}, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.grass), + 2, + new ItemStack[] { + new ItemStack(Blocks.dirt), + new ItemStack(Items.dye, 1, 15), + new ItemStack(Items.wheat_seeds), + new ItemStack(Items.wheat_seeds) + }, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.leather, 3, 0), + 2, + new ItemStack[] { + new ItemStack(Items.rotten_flesh), + new ItemStack(Items.rotten_flesh), + new ItemStack(Items.rotten_flesh), + waterBucketStack, + new ItemStack(Items.flint) + }, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.bread), + 1, + new ItemStack[] {new ItemStack(Items.wheat), new ItemStack(Items.sugar)}, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.fire_charge, 5, 0), + 3, + new ItemStack[] {new ItemStack(Items.coal), new ItemStack(Items.blaze_powder), gunpowderStack}, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.sand, 2, 0), + 1, + new ItemStack[] {new ItemStack(Blocks.cobblestone), gunpowderStack}, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.clay, 4, 0), + 2, + new ItemStack[] { + new ItemStack(Blocks.hardened_clay, 1, craftingConstant), + new ItemStack(Blocks.hardened_clay, 1, craftingConstant), + new ItemStack(Blocks.hardened_clay, 1, craftingConstant), + new ItemStack(Blocks.hardened_clay, 1, craftingConstant), + waterBucketStack + }, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.string, 4, 0), + 1, + new ItemStack[] {new ItemStack(Blocks.wool, 1, craftingConstant), new ItemStack(Items.flint)}, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.gravel, 2, 0), + 1, + new ItemStack[] {new ItemStack(Blocks.stone), gunpowderStack}, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.obsidian), 1, new ItemStack[] {waterBucketStack, lavaBucketStack}, 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.paper), 1, new ItemStack[] {new ItemStack(Items.reeds)}, 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.soul_sand, 3, 0), + 3, + new ItemStack[] { + new ItemStack(Blocks.sand), + new ItemStack(Blocks.sand), + new ItemStack(Blocks.sand), + waterBucketStack, + weakBloodShardStack + }, + 3); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.mycelium, 1, 0), + 5, + new ItemStack[] { + new ItemStack(Blocks.grass), + new ItemStack(Blocks.brown_mushroom), + new ItemStack(Blocks.red_mushroom) + }, + 2); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Blocks.ice), 2, new ItemStack[] {waterBucketStack, new ItemStack(Items.snowball)}, 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.potionitem, 1, 0), + 1, + new ItemStack[] {new ItemStack(Items.glass_bottle), new ItemStack(Blocks.cactus)}, + 1); + AlchemyRecipeRegistry.registerRecipe( + waterBucketStack, 1, new ItemStack[] {emptyBucketStack, new ItemStack(Blocks.cactus)}, 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.glass_bottle, 3), 1, new ItemStack[] {glassStack, glassStack, glassStack}, 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.ghast_tear, 2), + 100, + new ItemStack[] { + ghastTearStack, + concentratedCatalystStack, + weakBloodShardStack, + new ItemStack(Blocks.soul_sand), + new ItemStack(Blocks.soul_sand) + }, + 5); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.coal, 5), + 1, + new ItemStack[] { + new ItemStack(Items.coal, 1, 1), + new ItemStack(Items.coal, 1, 1), + new ItemStack(Items.coal, 1, 1), + new ItemStack(Items.coal, 1, 1), + new ItemStack(Items.coal, 1, 1) + }, + 1); + AlchemyRecipeRegistry.registerRecipe( + new ItemStack(Items.clay_ball, 4), + 5, + new ItemStack[] {new ItemStack(Blocks.sand), waterBucketStack}, + 2); ItemIncense.registerIncenseRecipes(); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockCrucible), "i i", "sis", " S ", 's', new ItemStack(Blocks.stone_slab), 'i', ironIngotStack, 'S', stoneStack); + GameRegistry.addRecipe( + new ItemStack(ModBlocks.blockCrucible), + "i i", + "sis", + " S ", + 's', + new ItemStack(Blocks.stone_slab), + 'i', + ironIngotStack, + 'S', + stoneStack); if (Loader.isModLoaded("NotEnoughItems")) { IMCForNEI.IMCSender(); @@ -1060,18 +3066,15 @@ public class AlchemicalWizardry } @EventHandler - public void postInit(FMLPostInitializationEvent event) - { - proxy.registerPostSideObjects(); + public void postInit(FMLPostInitializationEvent event) { + proxy.registerPostSideObjects(); isGregTechLoaded = Loader.isModLoaded("gregtech"); - //TODO Thaumcraft Integration - if (Loader.isModLoaded("Thaumcraft")) - { + // TODO Thaumcraft Integration + if (Loader.isModLoaded("Thaumcraft")) { isThaumcraftLoaded = true; - try - { - //do stuff + try { + // do stuff ModItems.sanguineHelmet = new ItemSanguineArmour(0).setUnlocalizedName("sanguineHelmet"); ModItems.sanguineRobe = new ItemSanguineArmour(1).setUnlocalizedName("sanguineRobe"); ModItems.sanguinePants = new ItemSanguineArmour(2).setUnlocalizedName("sanguinePants"); @@ -1094,85 +3097,81 @@ public class AlchemicalWizardry ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.sanguinePants), aspectList); ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.sanguineBoots), aspectList); - - if (itemGoggles != null) - { + if (itemGoggles != null) { BindingRegistry.registerRecipe(new ItemStack(ModItems.sanguineHelmet), itemGoggles); } - if (itemThaumChest != null) - { + if (itemThaumChest != null) { BindingRegistry.registerRecipe(new ItemStack(ModItems.sanguineRobe), new ItemStack(itemThaumChest)); } - if (itemThaumLeggings != null) - { - BindingRegistry.registerRecipe(new ItemStack(ModItems.sanguinePants), new ItemStack(itemThaumLeggings)); + if (itemThaumLeggings != null) { + BindingRegistry.registerRecipe( + new ItemStack(ModItems.sanguinePants), new ItemStack(itemThaumLeggings)); } - if (itemThaumBoots != null) - { - BindingRegistry.registerRecipe(new ItemStack(ModItems.sanguineBoots), new ItemStack(itemThaumBoots)); + if (itemThaumBoots != null) { + BindingRegistry.registerRecipe( + new ItemStack(ModItems.sanguineBoots), new ItemStack(itemThaumBoots)); } - //LogHelper.log(Level.INFO, "Loaded RP2 World addon"); - } catch (Exception e) - { - //LogHelper.log(Level.SEVERE, "Could not load RP2 World addon"); + // LogHelper.log(Level.INFO, "Loaded RP2 World addon"); + } catch (Exception e) { + // LogHelper.log(Level.SEVERE, "Could not load RP2 World addon"); e.printStackTrace(System.err); } - } else - { + } else { isThaumcraftLoaded = false; } - if(Loader.isModLoaded("guideapi")) - { - long initialTime = System.nanoTime(); - RecipeHolder.init(); - long finalTime = System.nanoTime(); - AlchemicalWizardry.logger.info("Recipe Holder initialized: took " + (finalTime - initialTime)/1000000f + "ms."); + if (Loader.isModLoaded("guideapi")) { + long initialTime = System.nanoTime(); + RecipeHolder.init(); + long finalTime = System.nanoTime(); + AlchemicalWizardry.logger.info( + "Recipe Holder initialized: took " + (finalTime - initialTime) / 1000000f + "ms."); ModItems.itemMailCatalogue = new ItemMailOrderCatalogue().setUnlocalizedName("itemMailCatalogue"); GameRegistry.registerItem(ModItems.itemMailCatalogue, "itemMailCatalogue"); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.itemMailCatalogue), new ItemStack(Items.book), new ItemStack(Items.dye, 1, 0), new ItemStack(Items.feather), new ItemStack(Blocks.glass, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Blocks.glass, 1, OreDictionary.WILDCARD_VALUE)); + GameRegistry.addShapelessRecipe( + new ItemStack(ModItems.itemMailCatalogue), + new ItemStack(Items.book), + new ItemStack(Items.dye, 1, 0), + new ItemStack(Items.feather), + new ItemStack(Blocks.glass, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Blocks.glass, 1, OreDictionary.WILDCARD_VALUE)); - registerBMBook(); + registerBMBook(); } - if (Loader.isModLoaded("Forestry")) - { + if (Loader.isModLoaded("Forestry")) { isForestryLoaded = true; - ModItems.itemBloodFrame = new ItemBloodFrame().setUnlocalizedName("bloodFrame"); + ModItems.itemBloodFrame = new ItemBloodFrame().setUnlocalizedName("bloodFrame"); - ItemStack provenFrame = GameRegistry.findItemStack("Forestry", "frameImpregnated", 1); + ItemStack provenFrame = GameRegistry.findItemStack("Forestry", "frameImpregnated", 1); - if(provenFrame !=null) - { - AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.itemBloodFrame), provenFrame, 3, 30000, 20, 20, false); - } - } else - { + if (provenFrame != null) { + AltarRecipeRegistry.registerAltarRecipe( + new ItemStack(ModItems.itemBloodFrame), provenFrame, 3, 30000, 20, 20, false); + } + } else { isForestryLoaded = false; } - if (Loader.isModLoaded("harvestcraft")) - { + if (Loader.isModLoaded("harvestcraft")) { PamHarvestCompatRegistry.registerPamHandlers(); AlchemicalWizardry.logger.info("Loaded Harvestcraft Handlers!"); } - if(Loader.isModLoaded("MineTweaker3")) - { + if (Loader.isModLoaded("MineTweaker3")) { MineTweakerIntegration.register(); AlchemicalWizardry.logger.info("Loaded MineTweaker 3 Integration"); } - if(Loader.isModLoaded("AgriCraft")) - { - HarvestRegistry.registerHarvestHandler(new AgriCraftCropHarvestHandler()); - AlchemicalWizardry.logger.info("Loaded AgriCraft Handlers!"); + if (Loader.isModLoaded("AgriCraft")) { + HarvestRegistry.registerHarvestHandler(new AgriCraftCropHarvestHandler()); + AlchemicalWizardry.logger.info("Loaded AgriCraft Handlers!"); } isBotaniaLoaded = Loader.isModLoaded("Botania"); @@ -1181,188 +3180,251 @@ public class AlchemicalWizardry isChiselLoaded = Loader.isModLoaded("chisel"); BloodMagicConfiguration.loadBlacklist(); - BloodMagicConfiguration.blacklistRituals(); + BloodMagicConfiguration.blacklistRituals(); BloodMagicConfiguration.loadCustomLPValues(); - DemonVillageLootRegistry.init(); + DemonVillageLootRegistry.init(); Meteor.loadConfig(); this.initCompressionHandlers(); - - -// if(parseTextFiles) -// this.parseTextFile(); - -// this.createItemTextureFiles(); } @Optional.Method(modid = "guideapi") - public static void registerBMBook() - { - BloodMagicGuide.registerGuide(); + public static void registerBMBook() { + BloodMagicGuide.registerGuide(); } - public static void blacklistAccelerators() - { - if (Loader.isModLoaded("Torcherino")) - { + public static void blacklistAccelerators() { + if (Loader.isModLoaded("Torcherino")) { FMLInterModComms.sendMessage("Torcherino", "blacklist-tile", TEAltar.class.getName()); FMLInterModComms.sendMessage("Torcherino", "blacklist-tile", TEMasterStone.class.getName()); } - if (Loader.isModLoaded("ChromatiCraft")) - { - try - { + if (Loader.isModLoaded("ChromatiCraft")) { + try { Class api = Class.forName("Reika.ChromatiCraft.API.AcceleratorBlacklist"); Class reason = Class.forName("Reika.ChromatiCraft.API.AcceleratorBlacklist$BlacklistReason"); - Object exploit = Enum.valueOf(reason,"EXPLOIT"); + Object exploit = Enum.valueOf(reason, "EXPLOIT"); Method add = api.getMethod("addBlacklist", Class.class, String.class, reason); - add.invoke(null, TEAltar.class, TEAltar.class.getSimpleName(),exploit); - add.invoke(null, TEMasterStone.class, TEMasterStone.class.getSimpleName(),exploit); - } catch (Exception e) - { + add.invoke(null, TEAltar.class, TEAltar.class.getSimpleName(), exploit); + add.invoke(null, TEMasterStone.class, TEMasterStone.class.getSimpleName(), exploit); + } catch (Exception e) { logger.log(Level.ERROR, "ChromatiCraft Accelerator Blacklist Failure"); } - } } - public static void blacklistDemons() - { - String[] mobs = new String[]{"FallenAngel","LowerGuardian","BileDemon","WingedFireDemon","SmallEarthGolem","IceDemon","BoulderFist","Shade","AirElemental", - "WaterElemental","EarthElemental","FireElemental","ShadeElemental","HolyElemental","MinorDemonGrunt","MinorDemonGruntFire","MinorDemonGruntWind", - "MinorDemonGruntIce","MinorDemonGruntEarth", "MinorDemonGruntGuardian","MinorDemonGruntGuardianFire","MinorDemonGruntGuardianWind","MinorDemonGruntGuardianIce", - "MinorDemonGruntGuardianEarth"}; - Class[] mobClasses = new Class[]{EntityFallenAngel.class,EntityLowerGuardian.class,EntityBileDemon.class,EntityWingedFireDemon.class,EntitySmallEarthGolem.class,EntityIceDemon.class, - EntityBoulderFist.class,EntityShade.class,EntityAirElemental.class,EntityWaterElemental.class,EntityEarthElemental.class,EntityFireElemental.class,EntityShadeElemental.class, - EntityHolyElemental.class,EntityMinorDemonGrunt.class,EntityMinorDemonGruntFire.class,EntityMinorDemonGruntWind.class,EntityMinorDemonGruntIce.class, - EntityMinorDemonGruntEarth.class,EntityMinorDemonGruntGuardian.class,EntityMinorDemonGruntGuardianFire.class,EntityMinorDemonGruntGuardianWind.class, - EntityMinorDemonGruntGuardianIce.class,EntityMinorDemonGruntGuardianEarth.class}; - if (Loader.isModLoaded("MineFactoryReloaded")) - { + public static void blacklistDemons() { + String[] mobs = new String[] { + "FallenAngel", + "LowerGuardian", + "BileDemon", + "WingedFireDemon", + "SmallEarthGolem", + "IceDemon", + "BoulderFist", + "Shade", + "AirElemental", + "WaterElemental", + "EarthElemental", + "FireElemental", + "ShadeElemental", + "HolyElemental", + "MinorDemonGrunt", + "MinorDemonGruntFire", + "MinorDemonGruntWind", + "MinorDemonGruntIce", + "MinorDemonGruntEarth", + "MinorDemonGruntGuardian", + "MinorDemonGruntGuardianFire", + "MinorDemonGruntGuardianWind", + "MinorDemonGruntGuardianIce", + "MinorDemonGruntGuardianEarth" + }; + Class[] mobClasses = new Class[] { + EntityFallenAngel.class, + EntityLowerGuardian.class, + EntityBileDemon.class, + EntityWingedFireDemon.class, + EntitySmallEarthGolem.class, + EntityIceDemon.class, + EntityBoulderFist.class, + EntityShade.class, + EntityAirElemental.class, + EntityWaterElemental.class, + EntityEarthElemental.class, + EntityFireElemental.class, + EntityShadeElemental.class, + EntityHolyElemental.class, + EntityMinorDemonGrunt.class, + EntityMinorDemonGruntFire.class, + EntityMinorDemonGruntWind.class, + EntityMinorDemonGruntIce.class, + EntityMinorDemonGruntEarth.class, + EntityMinorDemonGruntGuardian.class, + EntityMinorDemonGruntGuardianFire.class, + EntityMinorDemonGruntGuardianWind.class, + EntityMinorDemonGruntGuardianIce.class, + EntityMinorDemonGruntGuardianEarth.class + }; + if (Loader.isModLoaded("MineFactoryReloaded")) { ModContainer bloodMagic = Loader.instance().activeModContainer(); Method method = null; Constructor constructor = null; - try - { + try { constructor = FMLInterModComms.IMCMessage.class.getDeclaredConstructor(String.class, Object.class); constructor.setAccessible(true); - method = FMLInterModComms.class.getDeclaredMethod("enqueueMessage", Object.class, String.class, FMLInterModComms.IMCMessage.class); + method = FMLInterModComms.class.getDeclaredMethod( + "enqueueMessage", Object.class, String.class, FMLInterModComms.IMCMessage.class); method.setAccessible(true); - } - catch(Exception e) - { + } catch (Exception e) { logger.log(Level.ERROR, "Grinder Message reflection failed"); } - for (int i = 0; i maxLines) -// { -// changePage = true; -// } -// if(changePage) //Encode into current entry, then move to next entry -// { -// String[] newStrings = new String[currentPage + 1 + 1]; //Just to show that it is increasing -// for(int i=0; i 3L) -//// { -//// -//// }else -// { -// PrintWriter writer = new PrintWriter(file); -// for(String stri : strings) -// { -// writer.println(stri); -// } -// writer.close(); -// } -// -//// -// } -// -// Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(false); -// -// } catch (FileNotFoundException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (IOException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// } - @Mod.EventHandler - public void initCommands(FMLServerStartingEvent event) - { -// event.registerServerCommand(new CommandBind()); -// event.registerServerCommand(new CommandUnbind()); -// event.registerServerCommand(new CommandSN()); + public void initCommands(FMLServerStartingEvent event) { event.registerServerCommand(new CommandBloodMagic()); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java b/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java index 558270ec..4130db09 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java +++ b/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java @@ -1,11 +1,6 @@ package WayofTime.alchemicalWizardry; -import java.io.File; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; +import static net.minecraft.entity.EntityList.stringToClassMapping; import WayofTime.alchemicalWizardry.api.BlockStack; import WayofTime.alchemicalWizardry.api.rituals.Rituals; @@ -15,11 +10,15 @@ import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks; import WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; -import WayofTime.alchemicalWizardry.common.rituals.RitualEffectDemonPortal; -import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; +import java.io.File; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; import net.minecraft.block.Block; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; @@ -32,573 +31,878 @@ import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.oredict.OreDictionary; -import static net.minecraft.entity.EntityList.stringToClassMapping; - /** * Created with IntelliJ IDEA. * User: Pokefenn * Date: 17/01/14 * Time: 19:50 */ -public class BloodMagicConfiguration -{ - private static final String DEFAULT_COLOR_LIST = "100,f; 80,7; 60,e; 40,6; 25,c; 10,4"; - public static final List colorList = new ArrayList(); +public class BloodMagicConfiguration { + private static final String DEFAULT_COLOR_LIST = "100,f; 80,7; 60,e; 40,6; 25,c; 10,4"; + public static final List colorList = new ArrayList(); - public static Configuration config; + public static Configuration config; public static String[] teleposerBlacklist; public static String[] blacklist = {}; - public static void init(File configFile) - { - for (String s : DEFAULT_COLOR_LIST.split(";")) - { - String[] ct = s.split(","); - colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim())); - } + public static void init(File configFile) { + for (String s : DEFAULT_COLOR_LIST.split(";")) { + String[] ct = s.split(","); + colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim())); + } - config = new Configuration(configFile); + config = new Configuration(configFile); - try - { - config.load(); - syncConfig(); + try { + config.load(); + syncConfig(); - } catch (Exception e) - { - AlchemicalWizardry.logger.error("There has been a problem loading the configuration, go ask on the forums :p"); + } catch (Exception e) { + AlchemicalWizardry.logger.error( + "There has been a problem loading the configuration, go ask on the forums :p"); - } finally - { - config.save(); - } - } + } finally { + config.save(); + } + } - public static void syncConfig() - { - AlchemicalWizardry.standardBindingAgentDungeonChance = config.get("Dungeon Loot Chances", "standardBindingAgent", 30).getInt(); - AlchemicalWizardry.mundanePowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "mundanePowerCatalyst", 20).getInt(); - AlchemicalWizardry.averagePowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "averagePowerCatalyst", 10).getInt(); - AlchemicalWizardry.greaterPowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "greaterPowerCatalyst", 5).getInt(); - AlchemicalWizardry.mundaneLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "mundaneLengtheningCatalyst", 20).getInt(); - AlchemicalWizardry.averageLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "averageLengtheningCatalyst", 10).getInt(); - AlchemicalWizardry.greaterLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "greaterLengtheningCatalyst", 5).getInt(); - AlchemicalWizardry.customPotionDrowningID = config.get("Potion ID", "Drowning", 100).getInt(); - AlchemicalWizardry.customPotionBoostID = config.get("Potion ID", "Boost", 101).getInt(); - AlchemicalWizardry.customPotionProjProtID = config.get("Potion ID", "ProjProt", 102).getInt(); - AlchemicalWizardry.customPotionInhibitID = config.get("Potion ID", "Inhibit", 103).getInt(); - AlchemicalWizardry.customPotionFlightID = config.get("Potion ID", "Flight", 104).getInt(); - AlchemicalWizardry.customPotionReciprocationID = config.get("Potion ID", "Reciprocation", 105).getInt(); - AlchemicalWizardry.customPotionFlameCloakID = config.get("Potion ID", "FlameCloak", 106).getInt(); - AlchemicalWizardry.customPotionIceCloakID = config.get("Potion ID", "IceCloak", 107).getInt(); - AlchemicalWizardry.customPotionHeavyHeartID = config.get("Potion ID", "HeavyHeart", 108).getInt(); - AlchemicalWizardry.customPotionFireFuseID = config.get("Potion ID", "FireFuse", 109).getInt(); - AlchemicalWizardry.customPotionPlanarBindingID = config.get("Potion ID", "PlanarBinding", 110).getInt(); - AlchemicalWizardry.customPotionSoulFrayID = config.get("Potion ID", "SoulFray", 111).getInt(); - AlchemicalWizardry.customPotionSoulHardenID = config.get("Potion ID", "SoulHarden", 112).getInt(); - AlchemicalWizardry.customPotionDeafID = config.get("Potion ID", "Deaf", 113).getInt(); - AlchemicalWizardry.customPotionFeatherFallID = config.get("Potion ID", "FeatherFall", 114).getInt(); - AlchemicalWizardry.customPotionDemonCloakID = config.get("Potion ID", "DemonCloak", 115).getInt(); - AlchemicalWizardry.customPotionAmphibianID = config.get("Potion ID", "Amphibian", 116).getInt(); + public static void syncConfig() { + AlchemicalWizardry.standardBindingAgentDungeonChance = + config.get("Dungeon Loot Chances", "standardBindingAgent", 30).getInt(); + AlchemicalWizardry.mundanePowerCatalystDungeonChance = + config.get("Dungeon Loot Chances", "mundanePowerCatalyst", 20).getInt(); + AlchemicalWizardry.averagePowerCatalystDungeonChance = + config.get("Dungeon Loot Chances", "averagePowerCatalyst", 10).getInt(); + AlchemicalWizardry.greaterPowerCatalystDungeonChance = + config.get("Dungeon Loot Chances", "greaterPowerCatalyst", 5).getInt(); + AlchemicalWizardry.mundaneLengtheningCatalystDungeonChance = config.get( + "Dungeon Loot Chances", "mundaneLengtheningCatalyst", 20) + .getInt(); + AlchemicalWizardry.averageLengtheningCatalystDungeonChance = config.get( + "Dungeon Loot Chances", "averageLengtheningCatalyst", 10) + .getInt(); + AlchemicalWizardry.greaterLengtheningCatalystDungeonChance = config.get( + "Dungeon Loot Chances", "greaterLengtheningCatalyst", 5) + .getInt(); + AlchemicalWizardry.customPotionDrowningID = + config.get("Potion ID", "Drowning", 100).getInt(); + AlchemicalWizardry.customPotionBoostID = + config.get("Potion ID", "Boost", 101).getInt(); + AlchemicalWizardry.customPotionProjProtID = + config.get("Potion ID", "ProjProt", 102).getInt(); + AlchemicalWizardry.customPotionInhibitID = + config.get("Potion ID", "Inhibit", 103).getInt(); + AlchemicalWizardry.customPotionFlightID = + config.get("Potion ID", "Flight", 104).getInt(); + AlchemicalWizardry.customPotionReciprocationID = + config.get("Potion ID", "Reciprocation", 105).getInt(); + AlchemicalWizardry.customPotionFlameCloakID = + config.get("Potion ID", "FlameCloak", 106).getInt(); + AlchemicalWizardry.customPotionIceCloakID = + config.get("Potion ID", "IceCloak", 107).getInt(); + AlchemicalWizardry.customPotionHeavyHeartID = + config.get("Potion ID", "HeavyHeart", 108).getInt(); + AlchemicalWizardry.customPotionFireFuseID = + config.get("Potion ID", "FireFuse", 109).getInt(); + AlchemicalWizardry.customPotionPlanarBindingID = + config.get("Potion ID", "PlanarBinding", 110).getInt(); + AlchemicalWizardry.customPotionSoulFrayID = + config.get("Potion ID", "SoulFray", 111).getInt(); + AlchemicalWizardry.customPotionSoulHardenID = + config.get("Potion ID", "SoulHarden", 112).getInt(); + AlchemicalWizardry.customPotionDeafID = + config.get("Potion ID", "Deaf", 113).getInt(); + AlchemicalWizardry.customPotionFeatherFallID = + config.get("Potion ID", "FeatherFall", 114).getInt(); + AlchemicalWizardry.customPotionDemonCloakID = + config.get("Potion ID", "DemonCloak", 115).getInt(); + AlchemicalWizardry.customPotionAmphibianID = + config.get("Potion ID", "Amphibian", 116).getInt(); - AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true); - AlchemicalWizardry.allowedCrushedOresArray = config.get("oreCrushing", "allowedOres", new String[]{"iron", "gold", "copper", "tin", "lead", "silver", "osmium"}).getStringList(); + AlchemicalWizardry.doMeteorsDestroyBlocks = + config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true); + AlchemicalWizardry.allowedCrushedOresArray = config.get("oreCrushing", "allowedOres", new String[] { + "iron", "gold", "copper", "tin", "lead", "silver", "osmium" + }) + .getStringList(); - AlchemicalWizardry.wimpySettings = config.get("WimpySettings", "IDontLikeFun", false).getBoolean(false); - AlchemicalWizardry.respawnWithDebuff = config.get("WimpySettings", "RespawnWithDebuff", true).getBoolean(); - AlchemicalWizardry.causeHungerWithRegen = config.get("WimpySettings", "causeHungerWithRegen", true).getBoolean(); - AlchemicalWizardry.causeHungerChatMessage = config.get("WimpySettings", "causeHungerChatMessage", true).getBoolean(); -// AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean(); - AlchemicalWizardry.lockdownAltar = false; - AlchemicalWizardry.disableBoundToolsRightClick = config.get("WimpySettings", "disableBoundToolsRightClick", false).getBoolean(false); + AlchemicalWizardry.wimpySettings = + config.get("WimpySettings", "IDontLikeFun", false).getBoolean(false); + AlchemicalWizardry.respawnWithDebuff = + config.get("WimpySettings", "RespawnWithDebuff", true).getBoolean(); + AlchemicalWizardry.causeHungerWithRegen = + config.get("WimpySettings", "causeHungerWithRegen", true).getBoolean(); + AlchemicalWizardry.causeHungerChatMessage = + config.get("WimpySettings", "causeHungerChatMessage", true).getBoolean(); + // AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean(); + AlchemicalWizardry.lockdownAltar = false; + AlchemicalWizardry.disableBoundToolsRightClick = config.get( + "WimpySettings", "disableBoundToolsRightClick", false) + .getBoolean(false); - AlchemicalWizardry.ritualDisabledWater = config.get("Ritual Blacklist", "Ritual of the Full Spring", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledLava = config.get("Ritual Blacklist", "Serenade of the Nether", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledGreenGrove = config.get("Ritual Blacklist", "Ritual of the Green Grove", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledInterdiction = config.get("Ritual Blacklist", "Interdiction Ritual", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledContainment = config.get("Ritual Blacklist", "Ritual of Containment", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledBinding = config.get("Ritual Blacklist", "Ritual of Binding", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledUnbinding = config.get("Ritual Blacklist", "Ritual of Unbinding", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledHighJump = config.get("Ritual Blacklist", "Ritual of the High Jump", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledMagnetism = config.get("Ritual Blacklist", "Ritual of Magnetism", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledCrusher = config.get("Ritual Blacklist", "Ritual of the Crusher", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledSpeed = config.get("Ritual Blacklist", "Ritual of Speed", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledAnimalGrowth = config.get("Ritual Blacklist", "Ritual of the Shepherd", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledSuffering = config.get("Ritual Blacklist", "Well of Suffering", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledRegen = config.get("Ritual Blacklist", "Ritual of Regeneration", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledFeatheredKnife = config.get("Ritual Blacklist", "Ritual of the Feathered Knife", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledFeatheredEarth = config.get("Ritual Blacklist", "Ritual of the Feathered Earth", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledGaia = config.get("Ritual Blacklist", "Ritual of Gaia's Transformation", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledCondor = config.get("Ritual Blacklist", "Reverence of the Condor", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledFallingTower = config.get("Ritual Blacklist", "Mark of the Falling Tower", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledBalladOfAlchemy = config.get("Ritual Blacklist", "Ballad of Alchemy", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledExpulsion = config.get("Ritual Blacklist", "Aura of Expulsion", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledSuppression = config.get("Ritual Blacklist", "Dome of Supression", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledZephyr = config.get("Ritual Blacklist", "Call of the Zephyr", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledHarvest = config.get("Ritual Blacklist", "Reap of the Harvest Moon", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledConduit = config.get("Ritual Blacklist", "Cry of the Eternal Soul", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledEllipsoid = config.get("Ritual Blacklist", "Focus of the Ellipsoid", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledEvaporation = config.get("Ritual Blacklist", "Song of Evaporation", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledSpawnWard = config.get("Ritual Blacklist", "Ward of Sacrosanctity", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledVeilOfEvil = config.get("Ritual Blacklist", "Veil of Evil", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledFullStomach = config.get("Ritual Blacklist", "Requiem of the Satiated Stomach", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledConvocation = config.get("Ritual Blacklist", "Convocation of the Damned", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledSymmetry = config.get("Ritual Blacklist", "Symmetry of the Omega", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledStalling = config.get("Ritual Blacklist", "Duet of the Fused Souls", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledCrafting = config.get("Ritual Blacklist", "Rhythm of the Beating Anvil", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledPhantomHands = config.get("Ritual Blacklist", "Orchestra of the Phantom Hands", false).getBoolean(false); - AlchemicalWizardry.ritualDisabledSphereIsland = config.get("Ritual Blacklist", "Birth of the Bastion", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledWater = config.get("Ritual Blacklist", "Ritual of the Full Spring", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledLava = + config.get("Ritual Blacklist", "Serenade of the Nether", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledGreenGrove = config.get("Ritual Blacklist", "Ritual of the Green Grove", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledInterdiction = + config.get("Ritual Blacklist", "Interdiction Ritual", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledContainment = + config.get("Ritual Blacklist", "Ritual of Containment", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledBinding = + config.get("Ritual Blacklist", "Ritual of Binding", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledUnbinding = + config.get("Ritual Blacklist", "Ritual of Unbinding", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledHighJump = + config.get("Ritual Blacklist", "Ritual of the High Jump", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledMagnetism = + config.get("Ritual Blacklist", "Ritual of Magnetism", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledCrusher = + config.get("Ritual Blacklist", "Ritual of the Crusher", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledSpeed = + config.get("Ritual Blacklist", "Ritual of Speed", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledAnimalGrowth = + config.get("Ritual Blacklist", "Ritual of the Shepherd", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledSuffering = + config.get("Ritual Blacklist", "Well of Suffering", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledRegen = + config.get("Ritual Blacklist", "Ritual of Regeneration", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledFeatheredKnife = config.get( + "Ritual Blacklist", "Ritual of the Feathered Knife", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledFeatheredEarth = config.get( + "Ritual Blacklist", "Ritual of the Feathered Earth", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledGaia = config.get("Ritual Blacklist", "Ritual of Gaia's Transformation", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledCondor = + config.get("Ritual Blacklist", "Reverence of the Condor", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledFallingTower = config.get( + "Ritual Blacklist", "Mark of the Falling Tower", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledBalladOfAlchemy = + config.get("Ritual Blacklist", "Ballad of Alchemy", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledExpulsion = + config.get("Ritual Blacklist", "Aura of Expulsion", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledSuppression = + config.get("Ritual Blacklist", "Dome of Supression", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledZephyr = + config.get("Ritual Blacklist", "Call of the Zephyr", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledHarvest = config.get("Ritual Blacklist", "Reap of the Harvest Moon", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledConduit = + config.get("Ritual Blacklist", "Cry of the Eternal Soul", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledEllipsoid = + config.get("Ritual Blacklist", "Focus of the Ellipsoid", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledEvaporation = + config.get("Ritual Blacklist", "Song of Evaporation", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledSpawnWard = + config.get("Ritual Blacklist", "Ward of Sacrosanctity", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledVeilOfEvil = + config.get("Ritual Blacklist", "Veil of Evil", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledFullStomach = config.get( + "Ritual Blacklist", "Requiem of the Satiated Stomach", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledConvocation = config.get( + "Ritual Blacklist", "Convocation of the Damned", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledSymmetry = + config.get("Ritual Blacklist", "Symmetry of the Omega", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledStalling = + config.get("Ritual Blacklist", "Duet of the Fused Souls", false).getBoolean(false); + AlchemicalWizardry.ritualDisabledCrafting = config.get("Ritual Blacklist", "Rhythm of the Beating Anvil", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledPhantomHands = config.get( + "Ritual Blacklist", "Orchestra of the Phantom Hands", false) + .getBoolean(false); + AlchemicalWizardry.ritualDisabledSphereIsland = + config.get("Ritual Blacklist", "Birth of the Bastion", false).getBoolean(false); - AlchemicalWizardry.ritualWeakDisabledNight = config.get("Ritual Blacklist.Weak", "Night", false).getBoolean(false); - AlchemicalWizardry.ritualWeakDisabledResistance = config.get("Ritual Blacklist.Weak", "Resistance", false).getBoolean(false); - AlchemicalWizardry.ritualWeakDisabledThunderstorm = config.get("Ritual Blacklist.Weak", "Thunderstorm", false).getBoolean(false); - AlchemicalWizardry.ritualWeakDisabledZombie = config.get("Ritual Blacklist.Weak", "Zombie", false).getBoolean(false); + AlchemicalWizardry.ritualWeakDisabledNight = + config.get("Ritual Blacklist.Weak", "Night", false).getBoolean(false); + AlchemicalWizardry.ritualWeakDisabledResistance = + config.get("Ritual Blacklist.Weak", "Resistance", false).getBoolean(false); + AlchemicalWizardry.ritualWeakDisabledThunderstorm = + config.get("Ritual Blacklist.Weak", "Thunderstorm", false).getBoolean(false); + AlchemicalWizardry.ritualWeakDisabledZombie = + config.get("Ritual Blacklist.Weak", "Zombie", false).getBoolean(false); - AlchemicalWizardry.potionDisableRegen = config.get("Alchemy Potion Blacklist", "Regeneration", false).getBoolean(false); - AlchemicalWizardry.potionDisableNightVision = config.get("Alchemy Potion Blacklist", "Night Vision", false).getBoolean(false); - AlchemicalWizardry.potionDisableFireResistance = config.get("Alchemy Potion Blacklist", "Fire Resistance", false).getBoolean(false); - AlchemicalWizardry.potionDisableWaterBreathing = config.get("Alchemy Potion Blacklist", "Water Breathing", false).getBoolean(false); - AlchemicalWizardry.potionDisableMoveSpeed = config.get("Alchemy Potion Blacklist", "Move Speed", false).getBoolean(false); - AlchemicalWizardry.potionDisableInstantHealth = config.get("Alchemy Potion Blacklist", "Instant Health", false).getBoolean(false); - AlchemicalWizardry.potionDisablePoison = config.get("Alchemy Potion Blacklist", "Poison", false).getBoolean(false); - AlchemicalWizardry.potionDisableBlindness = config.get("Alchemy Potion Blacklist", "Blindness", false).getBoolean(false); - AlchemicalWizardry.potionDisableWeakness = config.get("Alchemy Potion Blacklist", "Weakness", false).getBoolean(false); - AlchemicalWizardry.potionDisableStrength = config.get("Alchemy Potion Blacklist", "Strength", false).getBoolean(false); - AlchemicalWizardry.potionDisableJumpBoost = config.get("Alchemy Potion Blacklist", "Jump Boost", false).getBoolean(false); - AlchemicalWizardry.potionDisableSlowness = config.get("Alchemy Potion Blacklist", "Slowness", false).getBoolean(false); - AlchemicalWizardry.potionDisableMining = config.get("Alchemy Potion Blacklist", "Mining Speed", false).getBoolean(false); - AlchemicalWizardry.potionDisableDrowning = config.get("Alchemy Potion Blacklist", "Drowning", false).getBoolean(false); - AlchemicalWizardry.potionDisableInvisibility = config.get("Alchemy Potion Blacklist", "Invisibility", false).getBoolean(false); - AlchemicalWizardry.potionDisableResistance = config.get("Alchemy Potion Blacklist", "Resistance", false).getBoolean(false); - AlchemicalWizardry.potionDisableSaturation = config.get("Alchemy Potion Blacklist", "Saturation", false).getBoolean(false); - AlchemicalWizardry.potionDisableHealthBoost = config.get("Alchemy Potion Blacklist", "Health Boost", false).getBoolean(false); - AlchemicalWizardry.potionDisableAbsorption = config.get("Alchemy Potion Blacklist", "Absorption", false).getBoolean(false); - AlchemicalWizardry.potionDisableBoost = config.get("Alchemy Potion Blacklist", "Boost", false).getBoolean(false); - AlchemicalWizardry.potionDisableFlight = config.get("Alchemy Potion Blacklist", "Flight", false).getBoolean(false); - AlchemicalWizardry.potionDisableReciprocation = config.get("Alchemy Potion Blacklist", "Reciprocation", false).getBoolean(false); - AlchemicalWizardry.potionDisablePlanarBinding = config.get("Alchemy Potion Blacklist", "Planar Binding", false).getBoolean(false); - AlchemicalWizardry.potionDisableSoulFray = config.get("Alchemy Potion Blacklist", "Soul Fray", false).getBoolean(false); - AlchemicalWizardry.potionDisableSoulHarden = config.get("Alchemy Potion Blacklist", "Soul Harden", false).getBoolean(false); - AlchemicalWizardry.potionDisableDeafness = config.get("Alchemy Potion Blacklist", "Deafness", false).getBoolean(false); + AlchemicalWizardry.potionDisableRegen = + config.get("Alchemy Potion Blacklist", "Regeneration", false).getBoolean(false); + AlchemicalWizardry.potionDisableNightVision = + config.get("Alchemy Potion Blacklist", "Night Vision", false).getBoolean(false); + AlchemicalWizardry.potionDisableFireResistance = + config.get("Alchemy Potion Blacklist", "Fire Resistance", false).getBoolean(false); + AlchemicalWizardry.potionDisableWaterBreathing = + config.get("Alchemy Potion Blacklist", "Water Breathing", false).getBoolean(false); + AlchemicalWizardry.potionDisableMoveSpeed = + config.get("Alchemy Potion Blacklist", "Move Speed", false).getBoolean(false); + AlchemicalWizardry.potionDisableInstantHealth = + config.get("Alchemy Potion Blacklist", "Instant Health", false).getBoolean(false); + AlchemicalWizardry.potionDisablePoison = + config.get("Alchemy Potion Blacklist", "Poison", false).getBoolean(false); + AlchemicalWizardry.potionDisableBlindness = + config.get("Alchemy Potion Blacklist", "Blindness", false).getBoolean(false); + AlchemicalWizardry.potionDisableWeakness = + config.get("Alchemy Potion Blacklist", "Weakness", false).getBoolean(false); + AlchemicalWizardry.potionDisableStrength = + config.get("Alchemy Potion Blacklist", "Strength", false).getBoolean(false); + AlchemicalWizardry.potionDisableJumpBoost = + config.get("Alchemy Potion Blacklist", "Jump Boost", false).getBoolean(false); + AlchemicalWizardry.potionDisableSlowness = + config.get("Alchemy Potion Blacklist", "Slowness", false).getBoolean(false); + AlchemicalWizardry.potionDisableMining = + config.get("Alchemy Potion Blacklist", "Mining Speed", false).getBoolean(false); + AlchemicalWizardry.potionDisableDrowning = + config.get("Alchemy Potion Blacklist", "Drowning", false).getBoolean(false); + AlchemicalWizardry.potionDisableInvisibility = + config.get("Alchemy Potion Blacklist", "Invisibility", false).getBoolean(false); + AlchemicalWizardry.potionDisableResistance = + config.get("Alchemy Potion Blacklist", "Resistance", false).getBoolean(false); + AlchemicalWizardry.potionDisableSaturation = + config.get("Alchemy Potion Blacklist", "Saturation", false).getBoolean(false); + AlchemicalWizardry.potionDisableHealthBoost = + config.get("Alchemy Potion Blacklist", "Health Boost", false).getBoolean(false); + AlchemicalWizardry.potionDisableAbsorption = + config.get("Alchemy Potion Blacklist", "Absorption", false).getBoolean(false); + AlchemicalWizardry.potionDisableBoost = + config.get("Alchemy Potion Blacklist", "Boost", false).getBoolean(false); + AlchemicalWizardry.potionDisableFlight = + config.get("Alchemy Potion Blacklist", "Flight", false).getBoolean(false); + AlchemicalWizardry.potionDisableReciprocation = + config.get("Alchemy Potion Blacklist", "Reciprocation", false).getBoolean(false); + AlchemicalWizardry.potionDisablePlanarBinding = + config.get("Alchemy Potion Blacklist", "Planar Binding", false).getBoolean(false); + AlchemicalWizardry.potionDisableSoulFray = + config.get("Alchemy Potion Blacklist", "Soul Fray", false).getBoolean(false); + AlchemicalWizardry.potionDisableSoulHarden = + config.get("Alchemy Potion Blacklist", "Soul Harden", false).getBoolean(false); + AlchemicalWizardry.potionDisableDeafness = + config.get("Alchemy Potion Blacklist", "Deafness", false).getBoolean(false); - teleposerBlacklist = config.get("Teleposer Blacklist", "Blacklist", blacklist, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is: \nmodid:blockname:meta").getStringList(); - buildTeleposerBlacklist(); + teleposerBlacklist = config.get( + "Teleposer Blacklist", + "Blacklist", + blacklist, + "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is: \nmodid:blockname:meta") + .getStringList(); + buildTeleposerBlacklist(); - String tempDemonConfigs = "Demon Configs"; - TEDemonPortal.buildingGridDelay = config.get(tempDemonConfigs, "Building Grid Delay", 25).getInt(); - TEDemonPortal.roadGridDelay = config.get(tempDemonConfigs, "Road Grid Delay", 10).getInt(); - TEDemonPortal.demonHoardDelay = config.get(tempDemonConfigs, "Demon Hoard Delay", 40).getInt(); - TEDemonPortal.demonRoadChance = (float)(config.get(tempDemonConfigs, "Demon Road Chance", 0.3f).getDouble()); - TEDemonPortal.demonHouseChance = (float)(config.get(tempDemonConfigs, "Demon House Chance", 0.6f).getDouble()); - TEDemonPortal.demonPortalChance = (float)(config.get(tempDemonConfigs, "Demon Portal Chance", 0.5f).getDouble()); - TEDemonPortal.demonHoardChance = (float)(config.get(tempDemonConfigs, "Demon Hoard Chance", 0.8f).getDouble()); - TEDemonPortal.portalTickRate = (float)(config.get(tempDemonConfigs, "Portal Tick Rate", 0.1f).getDouble()); + String tempDemonConfigs = "Demon Configs"; + TEDemonPortal.buildingGridDelay = + config.get(tempDemonConfigs, "Building Grid Delay", 25).getInt(); + TEDemonPortal.roadGridDelay = + config.get(tempDemonConfigs, "Road Grid Delay", 10).getInt(); + TEDemonPortal.demonHoardDelay = + config.get(tempDemonConfigs, "Demon Hoard Delay", 40).getInt(); + TEDemonPortal.demonRoadChance = + (float) (config.get(tempDemonConfigs, "Demon Road Chance", 0.3f).getDouble()); + TEDemonPortal.demonHouseChance = (float) + (config.get(tempDemonConfigs, "Demon House Chance", 0.6f).getDouble()); + TEDemonPortal.demonPortalChance = (float) + (config.get(tempDemonConfigs, "Demon Portal Chance", 0.5f).getDouble()); + TEDemonPortal.demonHoardChance = (float) + (config.get(tempDemonConfigs, "Demon Hoard Chance", 0.8f).getDouble()); + TEDemonPortal.portalTickRate = + (float) (config.get(tempDemonConfigs, "Portal Tick Rate", 0.1f).getDouble()); - DemonVillagePath.canGoDown = config.get(tempDemonConfigs, "canRoadGoDown", true).getBoolean(); - DemonVillagePath.tunnelIfObstructed = config.get(tempDemonConfigs, "tunnelIfObstructed", false).getBoolean(); - DemonVillagePath.createBridgeInAirIfObstructed = config.get(tempDemonConfigs, "createBridgeInAirIfObstructed", false).getBoolean(); + DemonVillagePath.canGoDown = + config.get(tempDemonConfigs, "canRoadGoDown", true).getBoolean(); + DemonVillagePath.tunnelIfObstructed = + config.get(tempDemonConfigs, "tunnelIfObstructed", false).getBoolean(); + DemonVillagePath.createBridgeInAirIfObstructed = config.get( + tempDemonConfigs, "createBridgeInAirIfObstructed", false) + .getBoolean(); - TEDemonPortal.limit = config.get(tempDemonConfigs, "demonGridSpaceLimit", 100).getInt(); - TEDemonPortal.demonLimit = config.get(tempDemonConfigs, "demonHoardLimit", 100).getInt(); + TEDemonPortal.limit = + config.get(tempDemonConfigs, "demonGridSpaceLimit", 100).getInt(); + TEDemonPortal.demonLimit = + config.get(tempDemonConfigs, "demonHoardLimit", 100).getInt(); - AlchemicalWizardry.isDemonRitualCreativeOnly = config.get(tempDemonConfigs, "IsDemonRitualCreativeOnly", false).getBoolean(); - AlchemicalWizardry.demonRitualDimensionBlacklist = config.get(tempDemonConfigs, "dimension blacklist for the demon portal activation", new int[]{0}).getIntList(); - BoundArmour.tryComplexRendering = config.get("WimpySettings", "UseFancyBoundArmour", true).getBoolean(true); + AlchemicalWizardry.isDemonRitualCreativeOnly = + config.get(tempDemonConfigs, "IsDemonRitualCreativeOnly", false).getBoolean(); + AlchemicalWizardry.demonRitualDimensionBlacklist = config.get( + tempDemonConfigs, "dimension blacklist for the demon portal activation", new int[] {0}) + .getIntList(); + BoundArmour.tryComplexRendering = + config.get("WimpySettings", "UseFancyBoundArmour", true).getBoolean(true); -// ItemIncense.itemDuration = config.get("TestIncenseSettings", "ItemDuration", 100).getInt(); -// ItemIncense.minValue = config.get("TestIncenseSettings", "MinValue", 0).getInt(); -// ItemIncense.maxValue = config.get("TestIncenseSettings", "MaxValue", 100).getInt(); -// PlayerSacrificeHandler.scalingOfSacrifice = (float) config.get("TestIncenseSettings", "ScalingFactor", 0.0025f).getDouble(); -// PlayerSacrificeHandler.soulFrayDuration = config.get("TestIncenseSettings", "SoulFrayDuration", 400).getInt(); + // ItemIncense.itemDuration = config.get("TestIncenseSettings", "ItemDuration", 100).getInt(); + // ItemIncense.minValue = config.get("TestIncenseSettings", "MinValue", 0).getInt(); + // ItemIncense.maxValue = config.get("TestIncenseSettings", "MaxValue", 100).getInt(); + // PlayerSacrificeHandler.scalingOfSacrifice = (float) config.get("TestIncenseSettings", "ScalingFactor", + // 0.0025f).getDouble(); + // PlayerSacrificeHandler.soulFrayDuration = config.get("TestIncenseSettings", "SoulFrayDuration", + // 400).getInt(); - String lpCosts = "Lp Costs"; - AlchemicalWizardry.sigilAirCost = config.get(lpCosts, "Air Sigil", 50).getInt(); - AlchemicalWizardry.sigilBloodLightCost = config.get(lpCosts, "Sigil of the Blood Lamp", 10).getInt(); - AlchemicalWizardry.sigilHarvestCost = config.get(lpCosts, "Harvest Goddess Sigil", 500).getInt(); - AlchemicalWizardry.sigilLavaCost = config.get(lpCosts, "Lava Sigil", 1000).getInt(); - AlchemicalWizardry.sigilElementalAffinityCost = config.get(lpCosts, "Sigil of Elemental Affinity", 200).getInt(); - AlchemicalWizardry.sigilEnderSeveranceCost = config.get(lpCosts, "Sigil of Ender Severance", 200).getInt(); - AlchemicalWizardry.sigilGrowthCost = config.get(lpCosts, "Sigil of the Green Grove", 150).getInt(); - AlchemicalWizardry.sigilHasteCost = config.get(lpCosts, "Sigil of Haste", 250).getInt(); - AlchemicalWizardry.sigilMagnetismCost = config.get(lpCosts, "Sigil of Magnetism", 50).getInt(); - AlchemicalWizardry.sigilSuppressionCost = config.get(lpCosts, "Sigil of Suppression", 400).getInt(); - AlchemicalWizardry.sigilBridgeCost = config.get(lpCosts, "Sigil of the Phantom Bridge", 100).getInt(); - AlchemicalWizardry.sigilFastMinerCost = config.get(lpCosts, "Sigil of the Fast Miner", 100).getInt(); - AlchemicalWizardry.sigilWhirlwindCost = config.get(lpCosts, "Sigil of the Whirlwind", 250).getInt(); - AlchemicalWizardry.sigilCompressCost = config.get(lpCosts, "Sigil of Compression", 200).getInt(); - AlchemicalWizardry.sigilVoidCost = config.get(lpCosts, "Void Sigil", 50).getInt(); - AlchemicalWizardry.sigilWaterCost = config.get(lpCosts, "Water Sigil", 100).getInt(); + String lpCosts = "Lp Costs"; + AlchemicalWizardry.sigilAirCost = config.get(lpCosts, "Air Sigil", 50).getInt(); + AlchemicalWizardry.sigilBloodLightCost = + config.get(lpCosts, "Sigil of the Blood Lamp", 10).getInt(); + AlchemicalWizardry.sigilHarvestCost = + config.get(lpCosts, "Harvest Goddess Sigil", 500).getInt(); + AlchemicalWizardry.sigilLavaCost = + config.get(lpCosts, "Lava Sigil", 1000).getInt(); + AlchemicalWizardry.sigilElementalAffinityCost = + config.get(lpCosts, "Sigil of Elemental Affinity", 200).getInt(); + AlchemicalWizardry.sigilEnderSeveranceCost = + config.get(lpCosts, "Sigil of Ender Severance", 200).getInt(); + AlchemicalWizardry.sigilGrowthCost = + config.get(lpCosts, "Sigil of the Green Grove", 150).getInt(); + AlchemicalWizardry.sigilHasteCost = + config.get(lpCosts, "Sigil of Haste", 250).getInt(); + AlchemicalWizardry.sigilMagnetismCost = + config.get(lpCosts, "Sigil of Magnetism", 50).getInt(); + AlchemicalWizardry.sigilSuppressionCost = + config.get(lpCosts, "Sigil of Suppression", 400).getInt(); + AlchemicalWizardry.sigilBridgeCost = + config.get(lpCosts, "Sigil of the Phantom Bridge", 100).getInt(); + AlchemicalWizardry.sigilFastMinerCost = + config.get(lpCosts, "Sigil of the Fast Miner", 100).getInt(); + AlchemicalWizardry.sigilWhirlwindCost = + config.get(lpCosts, "Sigil of the Whirlwind", 250).getInt(); + AlchemicalWizardry.sigilCompressCost = + config.get(lpCosts, "Sigil of Compression", 200).getInt(); + AlchemicalWizardry.sigilVoidCost = config.get(lpCosts, "Void Sigil", 50).getInt(); + AlchemicalWizardry.sigilWaterCost = + config.get(lpCosts, "Water Sigil", 100).getInt(); - config.addCustomCategoryComment(lpCosts, "For rituals, the first number indicates the activation cost while the second indicates the refresh cost"); - AlchemicalWizardry.ritualCostWater = config.get(lpCosts, "Ritual of the Full Spring", new int[]{500, 25}).getIntList(); - AlchemicalWizardry.ritualCostLava = config.get(lpCosts, "Serenade of the Nether", new int[]{10000, 500}).getIntList(); - AlchemicalWizardry.ritualCostGreenGrove = config.get(lpCosts, "Ritual of the Green Grove", new int[]{1000, 20}).getIntList(); - AlchemicalWizardry.ritualCostInterdiction = config.get(lpCosts, "Interdiction Ritual", new int[]{1000, 1}).getIntList(); - AlchemicalWizardry.ritualCostContainment = config.get(lpCosts, "Ritual of Containment", new int[]{2000, 1}).getIntList(); - AlchemicalWizardry.ritualCostBinding = config.get(lpCosts, "Ritual of Binding", new int[]{5000, 0}).getIntList(); - AlchemicalWizardry.ritualCostUnbinding = config.get(lpCosts, "Ritual of Unbinding", new int[]{30000, 0}).getIntList(); - AlchemicalWizardry.ritualCostHighJump = config.get(lpCosts, "Ritual of the High Jump", new int[]{1000, 5}).getIntList(); - AlchemicalWizardry.ritualCostMagnetism = config.get(lpCosts, "Ritual of Magnetism", new int[]{5000, 50}).getIntList(); - AlchemicalWizardry.ritualCostCrusher = config.get(lpCosts, "Ritual of the Crusher", new int[]{2500, 7}).getIntList(); - AlchemicalWizardry.ritualCostSpeed = config.get(lpCosts, "Ritual of Speed", new int[]{1000, 5}).getIntList(); - AlchemicalWizardry.ritualCostAnimalGrowth = config.get(lpCosts, "Ritual of the Shepherd", new int[]{10000, 2}).getIntList(); - AlchemicalWizardry.ritualCostSuffering = config.get(lpCosts, "Well of Suffering", new int[]{50000, 2}).getIntList(); - AlchemicalWizardry.ritualCostRegen = config.get(lpCosts, "Ritual of Regeneration", new int[]{25000, 20}).getIntList(); - AlchemicalWizardry.ritualCostFeatheredKnife = config.get(lpCosts, "Ritual of the Feathered Knife", new int[]{50000, 20}).getIntList(); - AlchemicalWizardry.ritualCostFeatheredEarth = config.get(lpCosts, "Ritual of the Feathered Earth", new int[]{100000, 0}).getIntList(); - AlchemicalWizardry.ritualCostGaia = config.get(lpCosts, "Gaia's Transformation", new int[]{1000000, 0}).getIntList(); - AlchemicalWizardry.ritualCostCondor = config.get(lpCosts, "Reverence of the Condor", new int[]{1000000, 0}).getIntList(); - AlchemicalWizardry.ritualCostFallingTower = config.get(lpCosts, "Mark of the Falling Tower", new int[]{100000, 0}).getIntList(); - AlchemicalWizardry.ritualCostBalladOfAlchemy = config.get(lpCosts, "Ballad of Alchemy", new int[]{20000, 10}).getIntList(); - AlchemicalWizardry.ritualCostExpulsion = config.get(lpCosts, "Aura of Expulsion", new int[]{1000000, 1000}).getIntList(); - AlchemicalWizardry.ritualCostSuppression = config.get(lpCosts, "Dome of Suppression", new int[]{10000, 2}).getIntList(); - AlchemicalWizardry.ritualCostZephyr = config.get(lpCosts, "Call of the Zephyr", new int[]{25000, 5}).getIntList(); - AlchemicalWizardry.ritualCostHarvest = config.get(lpCosts, "Reap of the Harvest Moon", new int[]{20000, 20}).getIntList(); - AlchemicalWizardry.ritualCostConduit = config.get(lpCosts, "Cry of the Eternal Soul", new int[]{2000000, 0}).getIntList(); - AlchemicalWizardry.ritualCostEllipsoid = config.get(lpCosts, "Focus of the Ellipsoid", new int[]{25000, 0}).getIntList(); - AlchemicalWizardry.ritualCostEvaporation = config.get(lpCosts, "Song of Evaporation", new int[]{20000, 0}).getIntList(); - AlchemicalWizardry.ritualCostSpawnWard = config.get(lpCosts, "Ward of Sacrosanctity", new int[]{150000, 15}).getIntList(); - AlchemicalWizardry.ritualCostVeilOfEvil = config.get(lpCosts, "Veil of Evil", new int[]{150000, 20}).getIntList(); - AlchemicalWizardry.ritualCostFullStomach = config.get(lpCosts, "Requiem of the Satiated Stomach", new int[]{100000, 100}).getIntList(); - AlchemicalWizardry.ritualCostConvocation = config.get(lpCosts, "Convocation of the Damned", new int[]{15000000, 0}).getIntList(); - AlchemicalWizardry.ritualCostSymmetry = config.get(lpCosts, "Symmetry of the Omega", new int[]{15000000, 0}).getIntList(); - AlchemicalWizardry.ritualCostStalling = config.get(lpCosts, "Duet of the Fused Souls", new int[]{15000000, 5000}).getIntList(); - AlchemicalWizardry.ritualCostCrafting = config.get(lpCosts, "Rhythm of the Beating Anvil", new int[]{15000, 10}).getIntList(); - AlchemicalWizardry.ritualCostPhantomHands = config.get(lpCosts, "Orchestra of the Phantom Hands", new int[]{10000, 0}).getIntList(); - AlchemicalWizardry.ritualCostSphereIsland = config.get(lpCosts, "Blood of the New Moon", new int[]{10000, 0}).getIntList(); + config.addCustomCategoryComment( + lpCosts, + "For rituals, the first number indicates the activation cost while the second indicates the refresh cost"); + AlchemicalWizardry.ritualCostWater = config.get(lpCosts, "Ritual of the Full Spring", new int[] {500, 25}) + .getIntList(); + AlchemicalWizardry.ritualCostLava = config.get(lpCosts, "Serenade of the Nether", new int[] {10000, 500}) + .getIntList(); + AlchemicalWizardry.ritualCostGreenGrove = config.get(lpCosts, "Ritual of the Green Grove", new int[] {1000, 20}) + .getIntList(); + AlchemicalWizardry.ritualCostInterdiction = + config.get(lpCosts, "Interdiction Ritual", new int[] {1000, 1}).getIntList(); + AlchemicalWizardry.ritualCostContainment = config.get(lpCosts, "Ritual of Containment", new int[] {2000, 1}) + .getIntList(); + AlchemicalWizardry.ritualCostBinding = + config.get(lpCosts, "Ritual of Binding", new int[] {5000, 0}).getIntList(); + AlchemicalWizardry.ritualCostUnbinding = + config.get(lpCosts, "Ritual of Unbinding", new int[] {30000, 0}).getIntList(); + AlchemicalWizardry.ritualCostHighJump = config.get(lpCosts, "Ritual of the High Jump", new int[] {1000, 5}) + .getIntList(); + AlchemicalWizardry.ritualCostMagnetism = + config.get(lpCosts, "Ritual of Magnetism", new int[] {5000, 50}).getIntList(); + AlchemicalWizardry.ritualCostCrusher = config.get(lpCosts, "Ritual of the Crusher", new int[] {2500, 7}) + .getIntList(); + AlchemicalWizardry.ritualCostSpeed = + config.get(lpCosts, "Ritual of Speed", new int[] {1000, 5}).getIntList(); + AlchemicalWizardry.ritualCostAnimalGrowth = config.get(lpCosts, "Ritual of the Shepherd", new int[] {10000, 2}) + .getIntList(); + AlchemicalWizardry.ritualCostSuffering = + config.get(lpCosts, "Well of Suffering", new int[] {50000, 2}).getIntList(); + AlchemicalWizardry.ritualCostRegen = config.get(lpCosts, "Ritual of Regeneration", new int[] {25000, 20}) + .getIntList(); + AlchemicalWizardry.ritualCostFeatheredKnife = config.get( + lpCosts, "Ritual of the Feathered Knife", new int[] {50000, 20}) + .getIntList(); + AlchemicalWizardry.ritualCostFeatheredEarth = config.get( + lpCosts, "Ritual of the Feathered Earth", new int[] {100000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostGaia = config.get(lpCosts, "Gaia's Transformation", new int[] {1000000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostCondor = config.get(lpCosts, "Reverence of the Condor", new int[] {1000000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostFallingTower = config.get( + lpCosts, "Mark of the Falling Tower", new int[] {100000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostBalladOfAlchemy = + config.get(lpCosts, "Ballad of Alchemy", new int[] {20000, 10}).getIntList(); + AlchemicalWizardry.ritualCostExpulsion = config.get(lpCosts, "Aura of Expulsion", new int[] {1000000, 1000}) + .getIntList(); + AlchemicalWizardry.ritualCostSuppression = + config.get(lpCosts, "Dome of Suppression", new int[] {10000, 2}).getIntList(); + AlchemicalWizardry.ritualCostZephyr = + config.get(lpCosts, "Call of the Zephyr", new int[] {25000, 5}).getIntList(); + AlchemicalWizardry.ritualCostHarvest = config.get(lpCosts, "Reap of the Harvest Moon", new int[] {20000, 20}) + .getIntList(); + AlchemicalWizardry.ritualCostConduit = config.get(lpCosts, "Cry of the Eternal Soul", new int[] {2000000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostEllipsoid = config.get(lpCosts, "Focus of the Ellipsoid", new int[] {25000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostEvaporation = + config.get(lpCosts, "Song of Evaporation", new int[] {20000, 0}).getIntList(); + AlchemicalWizardry.ritualCostSpawnWard = config.get(lpCosts, "Ward of Sacrosanctity", new int[] {150000, 15}) + .getIntList(); + AlchemicalWizardry.ritualCostVeilOfEvil = + config.get(lpCosts, "Veil of Evil", new int[] {150000, 20}).getIntList(); + AlchemicalWizardry.ritualCostFullStomach = config.get( + lpCosts, "Requiem of the Satiated Stomach", new int[] {100000, 100}) + .getIntList(); + AlchemicalWizardry.ritualCostConvocation = config.get( + lpCosts, "Convocation of the Damned", new int[] {15000000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostSymmetry = config.get(lpCosts, "Symmetry of the Omega", new int[] {15000000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostStalling = config.get( + lpCosts, "Duet of the Fused Souls", new int[] {15000000, 5000}) + .getIntList(); + AlchemicalWizardry.ritualCostCrafting = config.get( + lpCosts, "Rhythm of the Beating Anvil", new int[] {15000, 10}) + .getIntList(); + AlchemicalWizardry.ritualCostPhantomHands = config.get( + lpCosts, "Orchestra of the Phantom Hands", new int[] {10000, 0}) + .getIntList(); + AlchemicalWizardry.ritualCostSphereIsland = config.get(lpCosts, "Blood of the New Moon", new int[] {10000, 0}) + .getIntList(); - AlchemicalWizardry.ritualWeakCostNight = config.get(lpCosts, "[Weak Ritual] Night", 5000).getInt(); - AlchemicalWizardry.ritualWeakCostResistance = config.get(lpCosts, "[Weak Ritual] Resistance", 5000).getInt(); - AlchemicalWizardry.ritualWeakCostThunderstorm = config.get(lpCosts, "[Weak Ritual] Thunderstorm", 5000).getInt(); - AlchemicalWizardry.ritualWeakCostZombie = config.get(lpCosts, "[Weak Ritual] Zombie", 5000).getInt(); + AlchemicalWizardry.ritualWeakCostNight = + config.get(lpCosts, "[Weak Ritual] Night", 5000).getInt(); + AlchemicalWizardry.ritualWeakCostResistance = + config.get(lpCosts, "[Weak Ritual] Resistance", 5000).getInt(); + AlchemicalWizardry.ritualWeakCostThunderstorm = + config.get(lpCosts, "[Weak Ritual] Thunderstorm", 5000).getInt(); + AlchemicalWizardry.ritualWeakCostZombie = + config.get(lpCosts, "[Weak Ritual] Zombie", 5000).getInt(); - AlchemicalWizardry.lpPerSelfSacrifice = config.get("sacrifice", "LP per self-sacrifice", AlchemicalWizardry.lpPerSelfSacrifice).getInt(AlchemicalWizardry.lpPerSelfSacrifice); - AlchemicalWizardry.lpPerSelfSacrificeSoulFray = config.get("sacrifice", "LP per self-sacrifice (when Soul Fray potion is active)", AlchemicalWizardry.lpPerSelfSacrificeSoulFray).getInt(AlchemicalWizardry.lpPerSelfSacrificeSoulFray); - AlchemicalWizardry.lpPerSelfSacrificeFeatheredKnife = config.get("sacrifice", "LP per self-sacrifice with Ritual of Feathered Knife", AlchemicalWizardry.lpPerSelfSacrificeFeatheredKnife).getInt(AlchemicalWizardry.lpPerSelfSacrificeFeatheredKnife); - AlchemicalWizardry.lpPerSacrificeBase = config.get("sacrifice", "LP per sacrifice", AlchemicalWizardry.lpPerSacrificeBase).getInt(AlchemicalWizardry.lpPerSacrificeBase); - AlchemicalWizardry.lpPerSacrificeWellOfSuffering = config.get("sacrifice", "LP per sacrifice with Well of Suffering ritual", AlchemicalWizardry.lpPerSacrificeWellOfSuffering).getInt(AlchemicalWizardry.lpPerSacrificeWellOfSuffering); - AlchemicalWizardry.lpPerSacrificeIncense = config.get("sacrifice", "LP per (self-)sacrifice with incense", AlchemicalWizardry.lpPerSacrificeIncense).getDouble(AlchemicalWizardry.lpPerSacrificeIncense); + AlchemicalWizardry.lpPerSelfSacrifice = config.get( + "sacrifice", "LP per self-sacrifice", AlchemicalWizardry.lpPerSelfSacrifice) + .getInt(AlchemicalWizardry.lpPerSelfSacrifice); + AlchemicalWizardry.lpPerSelfSacrificeSoulFray = config.get( + "sacrifice", + "LP per self-sacrifice (when Soul Fray potion is active)", + AlchemicalWizardry.lpPerSelfSacrificeSoulFray) + .getInt(AlchemicalWizardry.lpPerSelfSacrificeSoulFray); + AlchemicalWizardry.lpPerSelfSacrificeFeatheredKnife = config.get( + "sacrifice", + "LP per self-sacrifice with Ritual of Feathered Knife", + AlchemicalWizardry.lpPerSelfSacrificeFeatheredKnife) + .getInt(AlchemicalWizardry.lpPerSelfSacrificeFeatheredKnife); + AlchemicalWizardry.lpPerSacrificeBase = config.get( + "sacrifice", "LP per sacrifice", AlchemicalWizardry.lpPerSacrificeBase) + .getInt(AlchemicalWizardry.lpPerSacrificeBase); + AlchemicalWizardry.lpPerSacrificeWellOfSuffering = config.get( + "sacrifice", + "LP per sacrifice with Well of Suffering ritual", + AlchemicalWizardry.lpPerSacrificeWellOfSuffering) + .getInt(AlchemicalWizardry.lpPerSacrificeWellOfSuffering); + AlchemicalWizardry.lpPerSacrificeIncense = config.get( + "sacrifice", "LP per (self-)sacrifice with incense", AlchemicalWizardry.lpPerSacrificeIncense) + .getDouble(AlchemicalWizardry.lpPerSacrificeIncense); - AlchemicalWizardry.energyBlastDamage = config.get("energy items", "Energy Blast damage", AlchemicalWizardry.energyBlastDamage).getInt(AlchemicalWizardry.energyBlastDamage); - AlchemicalWizardry.energyBlastLPPerShot = config.get("energy items", "Energy Blast LP per shot", AlchemicalWizardry.energyBlastLPPerShot).getInt(AlchemicalWizardry.energyBlastLPPerShot); - AlchemicalWizardry.energyBlastMaxDelay = config.get("energy items", "Energy Blast maximum delay", AlchemicalWizardry.energyBlastMaxDelay).getInt(AlchemicalWizardry.energyBlastMaxDelay); - AlchemicalWizardry.energyBlastMaxDelayAfterActivation = config.get("energy items", "Energy Blast maximum delay after (re-)activation", AlchemicalWizardry.energyBlastMaxDelayAfterActivation).getInt(AlchemicalWizardry.energyBlastMaxDelayAfterActivation); - AlchemicalWizardry.energyBlastLPPerActivation = config.get("energy items", "Energy Blast LP per activation", AlchemicalWizardry.energyBlastLPPerActivation).getInt(AlchemicalWizardry.energyBlastLPPerActivation); + AlchemicalWizardry.energyBlastDamage = config.get( + "energy items", "Energy Blast damage", AlchemicalWizardry.energyBlastDamage) + .getInt(AlchemicalWizardry.energyBlastDamage); + AlchemicalWizardry.energyBlastLPPerShot = config.get( + "energy items", "Energy Blast LP per shot", AlchemicalWizardry.energyBlastLPPerShot) + .getInt(AlchemicalWizardry.energyBlastLPPerShot); + AlchemicalWizardry.energyBlastMaxDelay = config.get( + "energy items", "Energy Blast maximum delay", AlchemicalWizardry.energyBlastMaxDelay) + .getInt(AlchemicalWizardry.energyBlastMaxDelay); + AlchemicalWizardry.energyBlastMaxDelayAfterActivation = config.get( + "energy items", + "Energy Blast maximum delay after (re-)activation", + AlchemicalWizardry.energyBlastMaxDelayAfterActivation) + .getInt(AlchemicalWizardry.energyBlastMaxDelayAfterActivation); + AlchemicalWizardry.energyBlastLPPerActivation = config.get( + "energy items", "Energy Blast LP per activation", AlchemicalWizardry.energyBlastLPPerActivation) + .getInt(AlchemicalWizardry.energyBlastLPPerActivation); - AlchemicalWizardry.energyBlastSecondTierDamage = config.get("energy items", "Energy Blast Tier II damage", AlchemicalWizardry.energyBlastSecondTierDamage).getInt(AlchemicalWizardry.energyBlastSecondTierDamage); - AlchemicalWizardry.energyBlastSecondTierLPPerShot = config.get("energy items", "Energy Blast Tier II LP per shot", AlchemicalWizardry.energyBlastSecondTierLPPerShot).getInt(AlchemicalWizardry.energyBlastSecondTierLPPerShot); - AlchemicalWizardry.energyBlastSecondTierMaxDelay = config.get("energy items", "Energy Blast Tier II maximum delay", AlchemicalWizardry.energyBlastSecondTierMaxDelay).getInt(AlchemicalWizardry.energyBlastSecondTierMaxDelay); - AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation = config.get("energy items", "Energy Blast Tier II maximum delay after (re-)activation", AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation).getInt(AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation); - AlchemicalWizardry.energyBlastSecondTierLPPerActivation = config.get("energy items", "Energy Blast Tier II LP per activation", AlchemicalWizardry.energyBlastSecondTierLPPerActivation).getInt(AlchemicalWizardry.energyBlastSecondTierLPPerActivation); + AlchemicalWizardry.energyBlastSecondTierDamage = config.get( + "energy items", "Energy Blast Tier II damage", AlchemicalWizardry.energyBlastSecondTierDamage) + .getInt(AlchemicalWizardry.energyBlastSecondTierDamage); + AlchemicalWizardry.energyBlastSecondTierLPPerShot = config.get( + "energy items", + "Energy Blast Tier II LP per shot", + AlchemicalWizardry.energyBlastSecondTierLPPerShot) + .getInt(AlchemicalWizardry.energyBlastSecondTierLPPerShot); + AlchemicalWizardry.energyBlastSecondTierMaxDelay = config.get( + "energy items", + "Energy Blast Tier II maximum delay", + AlchemicalWizardry.energyBlastSecondTierMaxDelay) + .getInt(AlchemicalWizardry.energyBlastSecondTierMaxDelay); + AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation = config.get( + "energy items", + "Energy Blast Tier II maximum delay after (re-)activation", + AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation) + .getInt(AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation); + AlchemicalWizardry.energyBlastSecondTierLPPerActivation = config.get( + "energy items", + "Energy Blast Tier II LP per activation", + AlchemicalWizardry.energyBlastSecondTierLPPerActivation) + .getInt(AlchemicalWizardry.energyBlastSecondTierLPPerActivation); - AlchemicalWizardry.energyBlastThirdTierDamage = config.get("energy items", "Energy Blast Tier III damage", AlchemicalWizardry.energyBlastThirdTierDamage).getInt(AlchemicalWizardry.energyBlastThirdTierDamage); - AlchemicalWizardry.energyBlastThirdTierLPPerShot = config.get("energy items", "Energy Blast Tier III LP per shot", AlchemicalWizardry.energyBlastThirdTierLPPerShot).getInt(AlchemicalWizardry.energyBlastThirdTierLPPerShot); - AlchemicalWizardry.energyBlastThirdTierMaxDelay = config.get("energy items", "Energy Blast Tier III maximum delay", AlchemicalWizardry.energyBlastThirdTierMaxDelay).getInt(AlchemicalWizardry.energyBlastThirdTierMaxDelay); - AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation = config.get("energy items", "Energy Blast Tier III maximum delay after (re-)activation", AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation).getInt(AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation); - AlchemicalWizardry.energyBlastThirdTierLPPerActivation = config.get("energy items", "Energy Blast Tier III LP per activation", AlchemicalWizardry.energyBlastThirdTierLPPerActivation).getInt(AlchemicalWizardry.energyBlastThirdTierLPPerActivation); + AlchemicalWizardry.energyBlastThirdTierDamage = config.get( + "energy items", "Energy Blast Tier III damage", AlchemicalWizardry.energyBlastThirdTierDamage) + .getInt(AlchemicalWizardry.energyBlastThirdTierDamage); + AlchemicalWizardry.energyBlastThirdTierLPPerShot = config.get( + "energy items", + "Energy Blast Tier III LP per shot", + AlchemicalWizardry.energyBlastThirdTierLPPerShot) + .getInt(AlchemicalWizardry.energyBlastThirdTierLPPerShot); + AlchemicalWizardry.energyBlastThirdTierMaxDelay = config.get( + "energy items", + "Energy Blast Tier III maximum delay", + AlchemicalWizardry.energyBlastThirdTierMaxDelay) + .getInt(AlchemicalWizardry.energyBlastThirdTierMaxDelay); + AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation = config.get( + "energy items", + "Energy Blast Tier III maximum delay after (re-)activation", + AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation) + .getInt(AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation); + AlchemicalWizardry.energyBlastThirdTierLPPerActivation = config.get( + "energy items", + "Energy Blast Tier III LP per activation", + AlchemicalWizardry.energyBlastThirdTierLPPerActivation) + .getInt(AlchemicalWizardry.energyBlastThirdTierLPPerActivation); - AlchemicalWizardry.energyBazookaDamage = config.get("energy items", "Energy Bazooka damage", AlchemicalWizardry.energyBazookaDamage).getInt(AlchemicalWizardry.energyBazookaDamage); - AlchemicalWizardry.energyBazookaSecondaryDamage = config.get("energy items", "Energy Bazooka secondary damage", AlchemicalWizardry.energyBazookaSecondaryDamage).getInt(AlchemicalWizardry.energyBazookaSecondaryDamage); - AlchemicalWizardry.energyBazookaLPPerShot = config.get("energy items", "Energy Bazooka LP per shot", AlchemicalWizardry.energyBazookaLPPerShot).getInt(AlchemicalWizardry.energyBazookaLPPerShot); - AlchemicalWizardry.energyBazookaMaxDelay = config.get("energy items", "Energy Bazooka maximum delay", AlchemicalWizardry.energyBazookaMaxDelay).getInt(AlchemicalWizardry.energyBazookaMaxDelay); - AlchemicalWizardry.energyBazookaMaxDelayAfterActivation = config.get("energy items", "Energy Bazooka maximum delay after (re-)activation", AlchemicalWizardry.energyBazookaMaxDelayAfterActivation).getInt(AlchemicalWizardry.energyBazookaMaxDelayAfterActivation); - AlchemicalWizardry.energyBazookaLPPerActivation = config.get("energy items", "Energy Bazooka LP per activation", AlchemicalWizardry.energyBazookaLPPerActivation).getInt(AlchemicalWizardry.energyBazookaLPPerActivation); + AlchemicalWizardry.energyBazookaDamage = config.get( + "energy items", "Energy Bazooka damage", AlchemicalWizardry.energyBazookaDamage) + .getInt(AlchemicalWizardry.energyBazookaDamage); + AlchemicalWizardry.energyBazookaSecondaryDamage = config.get( + "energy items", + "Energy Bazooka secondary damage", + AlchemicalWizardry.energyBazookaSecondaryDamage) + .getInt(AlchemicalWizardry.energyBazookaSecondaryDamage); + AlchemicalWizardry.energyBazookaLPPerShot = config.get( + "energy items", "Energy Bazooka LP per shot", AlchemicalWizardry.energyBazookaLPPerShot) + .getInt(AlchemicalWizardry.energyBazookaLPPerShot); + AlchemicalWizardry.energyBazookaMaxDelay = config.get( + "energy items", "Energy Bazooka maximum delay", AlchemicalWizardry.energyBazookaMaxDelay) + .getInt(AlchemicalWizardry.energyBazookaMaxDelay); + AlchemicalWizardry.energyBazookaMaxDelayAfterActivation = config.get( + "energy items", + "Energy Bazooka maximum delay after (re-)activation", + AlchemicalWizardry.energyBazookaMaxDelayAfterActivation) + .getInt(AlchemicalWizardry.energyBazookaMaxDelayAfterActivation); + AlchemicalWizardry.energyBazookaLPPerActivation = config.get( + "energy items", + "Energy Bazooka LP per activation", + AlchemicalWizardry.energyBazookaLPPerActivation) + .getInt(AlchemicalWizardry.energyBazookaLPPerActivation); - AlchemicalWizardry.energyBazookaSecondTierDamage = config.get("energy items", "Energy Bazooka Tier II damage", AlchemicalWizardry.energyBazookaSecondTierDamage).getInt(AlchemicalWizardry.energyBazookaSecondTierDamage); - AlchemicalWizardry.energyBazookaSecondTierSecondaryDamage = config.get("energy items", "Energy Bazooka Tier II secondary damage", AlchemicalWizardry.energyBazookaSecondTierSecondaryDamage).getInt(AlchemicalWizardry.energyBazookaSecondTierSecondaryDamage); - AlchemicalWizardry.energyBazookaSecondTierLPPerShot = config.get("energy items", "Energy Bazooka Tier II LP per shot", AlchemicalWizardry.energyBazookaSecondTierLPPerShot).getInt(AlchemicalWizardry.energyBazookaSecondTierLPPerShot); - AlchemicalWizardry.energyBazookaSecondTierMaxDelay = config.get("energy items", "Energy Bazooka Tier II maximum delay", AlchemicalWizardry.energyBazookaSecondTierMaxDelay).getInt(AlchemicalWizardry.energyBazookaSecondTierMaxDelay); - AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation = config.get("energy items", "Energy Bazooka Tier II maximum delay after (re-)activation", AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation).getInt(AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation); - AlchemicalWizardry.energyBazookaSecondTierLPPerActivation = config.get("energy items", "Energy Bazooka Tier II LP per activation", AlchemicalWizardry.energyBazookaSecondTierLPPerActivation).getInt(AlchemicalWizardry.energyBazookaSecondTierLPPerActivation); + AlchemicalWizardry.energyBazookaSecondTierDamage = config.get( + "energy items", + "Energy Bazooka Tier II damage", + AlchemicalWizardry.energyBazookaSecondTierDamage) + .getInt(AlchemicalWizardry.energyBazookaSecondTierDamage); + AlchemicalWizardry.energyBazookaSecondTierSecondaryDamage = config.get( + "energy items", + "Energy Bazooka Tier II secondary damage", + AlchemicalWizardry.energyBazookaSecondTierSecondaryDamage) + .getInt(AlchemicalWizardry.energyBazookaSecondTierSecondaryDamage); + AlchemicalWizardry.energyBazookaSecondTierLPPerShot = config.get( + "energy items", + "Energy Bazooka Tier II LP per shot", + AlchemicalWizardry.energyBazookaSecondTierLPPerShot) + .getInt(AlchemicalWizardry.energyBazookaSecondTierLPPerShot); + AlchemicalWizardry.energyBazookaSecondTierMaxDelay = config.get( + "energy items", + "Energy Bazooka Tier II maximum delay", + AlchemicalWizardry.energyBazookaSecondTierMaxDelay) + .getInt(AlchemicalWizardry.energyBazookaSecondTierMaxDelay); + AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation = config.get( + "energy items", + "Energy Bazooka Tier II maximum delay after (re-)activation", + AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation) + .getInt(AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation); + AlchemicalWizardry.energyBazookaSecondTierLPPerActivation = config.get( + "energy items", + "Energy Bazooka Tier II LP per activation", + AlchemicalWizardry.energyBazookaSecondTierLPPerActivation) + .getInt(AlchemicalWizardry.energyBazookaSecondTierLPPerActivation); - AlchemicalWizardry.energyBazookaThirdTierDamage = config.get("energy items", "Energy Bazooka Tier III damage", AlchemicalWizardry.energyBazookaThirdTierDamage).getInt(AlchemicalWizardry.energyBazookaThirdTierDamage); - AlchemicalWizardry.energyBazookaThirdTierSecondaryDamage = config.get("energy items", "Energy Bazooka Tier III secondary damage", AlchemicalWizardry.energyBazookaThirdTierSecondaryDamage).getInt(AlchemicalWizardry.energyBazookaThirdTierSecondaryDamage); - AlchemicalWizardry.energyBazookaThirdTierLPPerShot = config.get("energy items", "Energy Bazooka Tier III LP per shot", AlchemicalWizardry.energyBazookaThirdTierLPPerShot).getInt(AlchemicalWizardry.energyBazookaThirdTierLPPerShot); - AlchemicalWizardry.energyBazookaThirdTierMaxDelay = config.get("energy items", "Energy Bazooka Tier III maximum delay", AlchemicalWizardry.energyBazookaThirdTierMaxDelay).getInt(AlchemicalWizardry.energyBazookaThirdTierMaxDelay); - AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation = config.get("energy items", "Energy Bazooka Tier III maximum delay after (re-)activation", AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation).getInt(AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation); - AlchemicalWizardry.energyBazookaThirdTierLPPerActivation = config.get("energy items", "Energy Bazooka Tier III LP per activation", AlchemicalWizardry.energyBazookaThirdTierLPPerActivation).getInt(AlchemicalWizardry.energyBazookaThirdTierLPPerActivation); + AlchemicalWizardry.energyBazookaThirdTierDamage = config.get( + "energy items", + "Energy Bazooka Tier III damage", + AlchemicalWizardry.energyBazookaThirdTierDamage) + .getInt(AlchemicalWizardry.energyBazookaThirdTierDamage); + AlchemicalWizardry.energyBazookaThirdTierSecondaryDamage = config.get( + "energy items", + "Energy Bazooka Tier III secondary damage", + AlchemicalWizardry.energyBazookaThirdTierSecondaryDamage) + .getInt(AlchemicalWizardry.energyBazookaThirdTierSecondaryDamage); + AlchemicalWizardry.energyBazookaThirdTierLPPerShot = config.get( + "energy items", + "Energy Bazooka Tier III LP per shot", + AlchemicalWizardry.energyBazookaThirdTierLPPerShot) + .getInt(AlchemicalWizardry.energyBazookaThirdTierLPPerShot); + AlchemicalWizardry.energyBazookaThirdTierMaxDelay = config.get( + "energy items", + "Energy Bazooka Tier III maximum delay", + AlchemicalWizardry.energyBazookaThirdTierMaxDelay) + .getInt(AlchemicalWizardry.energyBazookaThirdTierMaxDelay); + AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation = config.get( + "energy items", + "Energy Bazooka Tier III maximum delay after (re-)activation", + AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation) + .getInt(AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation); + AlchemicalWizardry.energyBazookaThirdTierLPPerActivation = config.get( + "energy items", + "Energy Bazooka Tier III LP per activation", + AlchemicalWizardry.energyBazookaThirdTierLPPerActivation) + .getInt(AlchemicalWizardry.energyBazookaThirdTierLPPerActivation); - Side side = FMLCommonHandler.instance().getSide(); - if (side == Side.CLIENT) - { - RenderHelper.xOffset = config.get("ClientSettings", "AlchemyHUDxOffset", 50).getInt(); - RenderHelper.yOffset = config.get("ClientSettings", "AlchemyHUDyOffset", 2).getInt(); - RenderHelper.lpBarX = config.get("ClientSettings", "LPHUDxOffset", 12).getInt(); - RenderHelper.lpBarY = config.get("ClientSettings", "LPHUDyOffset", 75).getInt(); - AlchemicalWizardry.displayRitualAnimation = config.get("ClientSettings", "Display Ritual Animation", true).getBoolean(true); - } + Side side = FMLCommonHandler.instance().getSide(); + if (side == Side.CLIENT) { + RenderHelper.xOffset = + config.get("ClientSettings", "AlchemyHUDxOffset", 50).getInt(); + RenderHelper.yOffset = + config.get("ClientSettings", "AlchemyHUDyOffset", 2).getInt(); + RenderHelper.lpBarX = + config.get("ClientSettings", "LPHUDxOffset", 12).getInt(); + RenderHelper.lpBarY = + config.get("ClientSettings", "LPHUDyOffset", 75).getInt(); + AlchemicalWizardry.displayRitualAnimation = config.get("ClientSettings", "Display Ritual Animation", true) + .getBoolean(true); + } - config.save(); - } + config.save(); + } - public static void finishLoading() - { - AlchemicalWizardry.secondTierRunes = BloodMagicConfiguration.getAltarRunesForTier("secondTier", new BlockStack[] { - new BlockStack(ModBlocks.bloodRune, 0), - new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), - new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), - new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), - new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), - new BlockStack(ModBlocks.bloodRune, 5) - }); - AlchemicalWizardry.thirdTierRunes = BloodMagicConfiguration.getAltarRunesForTier("thirdTier", new BlockStack[] { - new BlockStack(ModBlocks.bloodRune, 0), - new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), - new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), - new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), - new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), - new BlockStack(ModBlocks.bloodRune, 5) - }); - AlchemicalWizardry.fourthTierRunes = BloodMagicConfiguration.getAltarRunesForTier("fourthTier", new BlockStack[] { - new BlockStack(ModBlocks.bloodRune, 0), - new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), - new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), - new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), - new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), - new BlockStack(ModBlocks.bloodRune, 5) - }); - AlchemicalWizardry.fifthTierRunes = BloodMagicConfiguration.getAltarRunesForTier("fifthTier", new BlockStack[] { - new BlockStack(ModBlocks.bloodRune, 0), - new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), - new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), - new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), - new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), - new BlockStack(ModBlocks.bloodRune, 5) - }); - AlchemicalWizardry.sixthTierRunes = BloodMagicConfiguration.getAltarRunesForTier("sixthTier", new BlockStack[] { - new BlockStack(ModBlocks.bloodRune, 0), - new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), - new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), - new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), - new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), - new BlockStack(ModBlocks.bloodRune, 5) - }); - AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier("specialBlocks", new BlockStack[] { - new BlockStack(Blocks.stonebrick, 0), - new BlockStack(Blocks.glowstone, 0), - new BlockStack(Blocks.stonebrick, 0), - new BlockStack(ModBlocks.largeBloodStoneBrick, 0), - new BlockStack(Blocks.beacon, 0), - new BlockStack(Blocks.stonebrick, 0), - new BlockStack(ModBlocks.blockCrystal, 0) - }); - config.save(); - } - public static void loadCustomLPValues() - { - AlchemicalWizardry.lpPerSactificeCustom = new HashMap, Integer>(); - for (Object object : EntityList.stringToClassMapping.entrySet()) - { - Entry entry = (Entry)object; - String entityName = (String) entry.getKey(); - Class entityClass = (Class) entry.getValue(); - if (EntityLivingBase.class.isAssignableFrom(entityClass) && !Modifier.isAbstract(entityClass.getModifiers())) - { - int lpAmount = 500; - if (EntityVillager.class.isAssignableFrom(entityClass)) - { - lpAmount = 2000; - } - if (EntitySlime.class.isAssignableFrom(entityClass)) - { - lpAmount = 150; - } - if (EntityEnderman.class.isAssignableFrom(entityClass)) - { - lpAmount = 200; - } - if (EntityAnimal.class.isAssignableFrom(entityClass)) - { - lpAmount = 250; - } - lpAmount = config.get("sacrifice.custom values", entityName, lpAmount).getInt(lpAmount); - AlchemicalWizardry.lpPerSactificeCustom.put(entityClass, lpAmount); - } - } - config.save(); - } + public static void finishLoading() { + AlchemicalWizardry.secondTierRunes = + BloodMagicConfiguration.getAltarRunesForTier("secondTier", new BlockStack[] { + new BlockStack(ModBlocks.bloodRune, 0), + new BlockStack(ModBlocks.speedRune, 0), + new BlockStack(ModBlocks.efficiencyRune, 0), + new BlockStack(ModBlocks.runeOfSacrifice, 0), + new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), + new BlockStack(ModBlocks.bloodRune, 1), + new BlockStack(ModBlocks.bloodRune, 2), + new BlockStack(ModBlocks.bloodRune, 3), + new BlockStack(ModBlocks.bloodRune, 4), + new BlockStack(ModBlocks.bloodRune, 5) + }); + AlchemicalWizardry.thirdTierRunes = BloodMagicConfiguration.getAltarRunesForTier("thirdTier", new BlockStack[] { + new BlockStack(ModBlocks.bloodRune, 0), + new BlockStack(ModBlocks.speedRune, 0), + new BlockStack(ModBlocks.efficiencyRune, 0), + new BlockStack(ModBlocks.runeOfSacrifice, 0), + new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), + new BlockStack(ModBlocks.bloodRune, 1), + new BlockStack(ModBlocks.bloodRune, 2), + new BlockStack(ModBlocks.bloodRune, 3), + new BlockStack(ModBlocks.bloodRune, 4), + new BlockStack(ModBlocks.bloodRune, 5) + }); + AlchemicalWizardry.fourthTierRunes = + BloodMagicConfiguration.getAltarRunesForTier("fourthTier", new BlockStack[] { + new BlockStack(ModBlocks.bloodRune, 0), + new BlockStack(ModBlocks.speedRune, 0), + new BlockStack(ModBlocks.efficiencyRune, 0), + new BlockStack(ModBlocks.runeOfSacrifice, 0), + new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), + new BlockStack(ModBlocks.bloodRune, 1), + new BlockStack(ModBlocks.bloodRune, 2), + new BlockStack(ModBlocks.bloodRune, 3), + new BlockStack(ModBlocks.bloodRune, 4), + new BlockStack(ModBlocks.bloodRune, 5) + }); + AlchemicalWizardry.fifthTierRunes = BloodMagicConfiguration.getAltarRunesForTier("fifthTier", new BlockStack[] { + new BlockStack(ModBlocks.bloodRune, 0), + new BlockStack(ModBlocks.speedRune, 0), + new BlockStack(ModBlocks.efficiencyRune, 0), + new BlockStack(ModBlocks.runeOfSacrifice, 0), + new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), + new BlockStack(ModBlocks.bloodRune, 1), + new BlockStack(ModBlocks.bloodRune, 2), + new BlockStack(ModBlocks.bloodRune, 3), + new BlockStack(ModBlocks.bloodRune, 4), + new BlockStack(ModBlocks.bloodRune, 5) + }); + AlchemicalWizardry.sixthTierRunes = BloodMagicConfiguration.getAltarRunesForTier("sixthTier", new BlockStack[] { + new BlockStack(ModBlocks.bloodRune, 0), + new BlockStack(ModBlocks.speedRune, 0), + new BlockStack(ModBlocks.efficiencyRune, 0), + new BlockStack(ModBlocks.runeOfSacrifice, 0), + new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), + new BlockStack(ModBlocks.bloodRune, 1), + new BlockStack(ModBlocks.bloodRune, 2), + new BlockStack(ModBlocks.bloodRune, 3), + new BlockStack(ModBlocks.bloodRune, 4), + new BlockStack(ModBlocks.bloodRune, 5) + }); + AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier("specialBlocks", new BlockStack[] { + new BlockStack(Blocks.stonebrick, 0), + new BlockStack(Blocks.glowstone, 0), + new BlockStack(Blocks.stonebrick, 0), + new BlockStack(ModBlocks.largeBloodStoneBrick, 0), + new BlockStack(Blocks.beacon, 0), + new BlockStack(Blocks.stonebrick, 0), + new BlockStack(ModBlocks.blockCrystal, 0) + }); + config.save(); + } - public static void set(String categoryName, String propertyName, String newValue) - { - config.load(); - if (config.getCategoryNames().contains(categoryName)) - { - if (config.getCategory(categoryName).containsKey(propertyName)) - { - config.getCategory(categoryName).get(propertyName).set(newValue); - } - } - config.save(); - } + public static void loadCustomLPValues() { + AlchemicalWizardry.lpPerSactificeCustom = new HashMap, Integer>(); + for (Object object : EntityList.stringToClassMapping.entrySet()) { + Entry entry = (Entry) object; + String entityName = (String) entry.getKey(); + Class entityClass = (Class) entry.getValue(); + if (EntityLivingBase.class.isAssignableFrom(entityClass) + && !Modifier.isAbstract(entityClass.getModifiers())) { + int lpAmount = 500; + if (EntityVillager.class.isAssignableFrom(entityClass)) { + lpAmount = 2000; + } + if (EntitySlime.class.isAssignableFrom(entityClass)) { + lpAmount = 150; + } + if (EntityEnderman.class.isAssignableFrom(entityClass)) { + lpAmount = 200; + } + if (EntityAnimal.class.isAssignableFrom(entityClass)) { + lpAmount = 250; + } + lpAmount = config.get("sacrifice.custom values", entityName, lpAmount) + .getInt(lpAmount); + AlchemicalWizardry.lpPerSactificeCustom.put(entityClass, lpAmount); + } + } + config.save(); + } - public static void loadBlacklist() - { - AlchemicalWizardry.wellBlacklist = new ArrayList(); - for (Object o : stringToClassMapping.entrySet()) - { - Entry entry = (Entry) o; - Class curClass = (Class) entry.getValue(); - boolean valid = EntityLivingBase.class.isAssignableFrom(curClass) && !Modifier.isAbstract(curClass.getModifiers()); - if (valid) - { - boolean blacklisted = config.get("wellOfSufferingBlackList", entry.getKey().toString(), false).getBoolean(); - if (blacklisted) - AlchemicalWizardry.wellBlacklist.add(curClass); - } + public static void set(String categoryName, String propertyName, String newValue) { + config.load(); + if (config.getCategoryNames().contains(categoryName)) { + if (config.getCategory(categoryName).containsKey(propertyName)) { + config.getCategory(categoryName).get(propertyName).set(newValue); + } + } + config.save(); + } - } - config.save(); - } + public static void loadBlacklist() { + AlchemicalWizardry.wellBlacklist = new ArrayList(); + for (Object o : stringToClassMapping.entrySet()) { + Entry entry = (Entry) o; + Class curClass = (Class) entry.getValue(); + boolean valid = + EntityLivingBase.class.isAssignableFrom(curClass) && !Modifier.isAbstract(curClass.getModifiers()); + if (valid) { + boolean blacklisted = config.get( + "wellOfSufferingBlackList", entry.getKey().toString(), false) + .getBoolean(); + if (blacklisted) AlchemicalWizardry.wellBlacklist.add(curClass); + } + } + config.save(); + } - public static void blacklistRituals() - { - if (AlchemicalWizardry.ritualDisabledWater) r("AW001Water"); - if (AlchemicalWizardry.ritualDisabledLava) r("AW002Lava"); - if (AlchemicalWizardry.ritualDisabledGreenGrove) r("AW003GreenGrove"); - if (AlchemicalWizardry.ritualDisabledInterdiction) r("AW004Interdiction"); - if (AlchemicalWizardry.ritualDisabledContainment) r("AW005Containment"); - if (AlchemicalWizardry.ritualDisabledBinding) r("AW006Binding"); - if (AlchemicalWizardry.ritualDisabledUnbinding) r("AW007Unbinding"); // "A medium dry martini, lemon peel. Shaken, not stirred." - if (AlchemicalWizardry.ritualDisabledHighJump) r("AW008HighJump"); - if (AlchemicalWizardry.ritualDisabledMagnetism) r("AW009Magnetism"); - if (AlchemicalWizardry.ritualDisabledCrusher) r("AW010Crusher"); - if (AlchemicalWizardry.ritualDisabledSpeed) r("AW011Speed"); - if (AlchemicalWizardry.ritualDisabledAnimalGrowth) r("AW012AnimalGrowth"); - if (AlchemicalWizardry.ritualDisabledSuffering) r("AW013Suffering"); - if (AlchemicalWizardry.ritualDisabledRegen) r("AW014Regen"); - if (AlchemicalWizardry.ritualDisabledFeatheredKnife) r("AW015FeatheredKnife"); - if (AlchemicalWizardry.ritualDisabledFeatheredEarth) r("AW016FeatheredEarth"); - if (AlchemicalWizardry.ritualDisabledGaia) r("AW017Gaia"); - if (AlchemicalWizardry.ritualDisabledCondor) r("AW018Condor"); - if (AlchemicalWizardry.ritualDisabledFallingTower) r("AW019FallingTower"); - if (AlchemicalWizardry.ritualDisabledBalladOfAlchemy) r("AW020BalladOfAlchemy"); - if (AlchemicalWizardry.ritualDisabledExpulsion) r("AW021Expulsion"); - if (AlchemicalWizardry.ritualDisabledSuppression) r("AW022Suppression"); - if (AlchemicalWizardry.ritualDisabledZephyr) r("AW023Zephyr"); - if (AlchemicalWizardry.ritualDisabledHarvest) r("AW024Harvest"); - if (AlchemicalWizardry.ritualDisabledConduit) r("AW025Conduit"); - if (AlchemicalWizardry.ritualDisabledEllipsoid) r("AW026Ellipsoid"); - if (AlchemicalWizardry.ritualDisabledEvaporation) r("AW027Evaporation"); - if (AlchemicalWizardry.ritualDisabledSpawnWard) r("AW028SpawnWard"); - if (AlchemicalWizardry.ritualDisabledVeilOfEvil) r("AW029VeilOfEvil"); - if (AlchemicalWizardry.ritualDisabledFullStomach) r("AW030FullStomach"); - if (AlchemicalWizardry.ritualDisabledConvocation) r("AW031Convocation"); - if (AlchemicalWizardry.ritualDisabledSymmetry) r("AW032Symmetry"); - if (AlchemicalWizardry.ritualDisabledStalling) r("AW033Stalling"); - if (AlchemicalWizardry.ritualDisabledCrafting) r("AW034Crafting"); - if (AlchemicalWizardry.ritualDisabledPhantomHands) r("AW035PhantomHands"); - if (AlchemicalWizardry.ritualDisabledSphereIsland) r("AW036SphereIsland"); - } + public static void blacklistRituals() { + if (AlchemicalWizardry.ritualDisabledWater) r("AW001Water"); + if (AlchemicalWizardry.ritualDisabledLava) r("AW002Lava"); + if (AlchemicalWizardry.ritualDisabledGreenGrove) r("AW003GreenGrove"); + if (AlchemicalWizardry.ritualDisabledInterdiction) r("AW004Interdiction"); + if (AlchemicalWizardry.ritualDisabledContainment) r("AW005Containment"); + if (AlchemicalWizardry.ritualDisabledBinding) r("AW006Binding"); + if (AlchemicalWizardry.ritualDisabledUnbinding) + r("AW007Unbinding"); // "A medium dry martini, lemon peel. Shaken, not stirred." + if (AlchemicalWizardry.ritualDisabledHighJump) r("AW008HighJump"); + if (AlchemicalWizardry.ritualDisabledMagnetism) r("AW009Magnetism"); + if (AlchemicalWizardry.ritualDisabledCrusher) r("AW010Crusher"); + if (AlchemicalWizardry.ritualDisabledSpeed) r("AW011Speed"); + if (AlchemicalWizardry.ritualDisabledAnimalGrowth) r("AW012AnimalGrowth"); + if (AlchemicalWizardry.ritualDisabledSuffering) r("AW013Suffering"); + if (AlchemicalWizardry.ritualDisabledRegen) r("AW014Regen"); + if (AlchemicalWizardry.ritualDisabledFeatheredKnife) r("AW015FeatheredKnife"); + if (AlchemicalWizardry.ritualDisabledFeatheredEarth) r("AW016FeatheredEarth"); + if (AlchemicalWizardry.ritualDisabledGaia) r("AW017Gaia"); + if (AlchemicalWizardry.ritualDisabledCondor) r("AW018Condor"); + if (AlchemicalWizardry.ritualDisabledFallingTower) r("AW019FallingTower"); + if (AlchemicalWizardry.ritualDisabledBalladOfAlchemy) r("AW020BalladOfAlchemy"); + if (AlchemicalWizardry.ritualDisabledExpulsion) r("AW021Expulsion"); + if (AlchemicalWizardry.ritualDisabledSuppression) r("AW022Suppression"); + if (AlchemicalWizardry.ritualDisabledZephyr) r("AW023Zephyr"); + if (AlchemicalWizardry.ritualDisabledHarvest) r("AW024Harvest"); + if (AlchemicalWizardry.ritualDisabledConduit) r("AW025Conduit"); + if (AlchemicalWizardry.ritualDisabledEllipsoid) r("AW026Ellipsoid"); + if (AlchemicalWizardry.ritualDisabledEvaporation) r("AW027Evaporation"); + if (AlchemicalWizardry.ritualDisabledSpawnWard) r("AW028SpawnWard"); + if (AlchemicalWizardry.ritualDisabledVeilOfEvil) r("AW029VeilOfEvil"); + if (AlchemicalWizardry.ritualDisabledFullStomach) r("AW030FullStomach"); + if (AlchemicalWizardry.ritualDisabledConvocation) r("AW031Convocation"); + if (AlchemicalWizardry.ritualDisabledSymmetry) r("AW032Symmetry"); + if (AlchemicalWizardry.ritualDisabledStalling) r("AW033Stalling"); + if (AlchemicalWizardry.ritualDisabledCrafting) r("AW034Crafting"); + if (AlchemicalWizardry.ritualDisabledPhantomHands) r("AW035PhantomHands"); + if (AlchemicalWizardry.ritualDisabledSphereIsland) r("AW036SphereIsland"); + } - private static void r(String ritualID) - { - Rituals.ritualMap.remove(ritualID); - Rituals.keyList.remove(ritualID); - } + private static void r(String ritualID) { + Rituals.ritualMap.remove(ritualID); + Rituals.keyList.remove(ritualID); + } - private static void buildTeleposerBlacklist() { + private static void buildTeleposerBlacklist() { - // Make sure it's empty before setting the blacklist. - // Otherwise, reloading the config while in-game will duplicate the list. - AlchemicalWizardryEventHooks.teleposerBlacklist.clear(); + // Make sure it's empty before setting the blacklist. + // Otherwise, reloading the config while in-game will duplicate the list. + AlchemicalWizardryEventHooks.teleposerBlacklist.clear(); - for (String blockSet : BloodMagicConfiguration.teleposerBlacklist) { - String[] blockData = blockSet.split(":"); + for (String blockSet : BloodMagicConfiguration.teleposerBlacklist) { + String[] blockData = blockSet.split(":"); - Block block = GameRegistry.findBlock(blockData[0], blockData[1]); - int meta = 0; + Block block = GameRegistry.findBlock(blockData[0], blockData[1]); + int meta = 0; - // If the block follows full syntax: modid:blockname:meta - if (blockData.length == 3) { - // Check if it's an int, if so, parse it. If not, set meta to 0 to avoid crashing. - if (isInteger(blockData[2])) - meta = Integer.parseInt(blockData[2]); - else if (blockData[2].equals("*")) - meta = OreDictionary.WILDCARD_VALUE; - else - meta = 0; - } + // If the block follows full syntax: modid:blockname:meta + if (blockData.length == 3) { + // Check if it's an int, if so, parse it. If not, set meta to 0 to avoid crashing. + if (isInteger(blockData[2])) meta = Integer.parseInt(blockData[2]); + else if (blockData[2].equals("*")) meta = OreDictionary.WILDCARD_VALUE; + else meta = 0; + } - AlchemicalWizardryEventHooks.teleposerBlacklist.add(new BlockStack(block, meta)); - } - } + AlchemicalWizardryEventHooks.teleposerBlacklist.add(new BlockStack(block, meta)); + } + } - private static boolean isInteger(String s) { - try { - Integer.parseInt(s); - } catch(NumberFormatException e) { - return false; - } catch(NullPointerException e) { - return false; - } - // only got here if we didn't return false - return true; - } + private static boolean isInteger(String s) { + try { + Integer.parseInt(s); + } catch (NumberFormatException e) { + return false; + } catch (NullPointerException e) { + return false; + } + // only got here if we didn't return false + return true; + } - private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) - { - String[] defaultNames = new String[defaultValues.length]; - for (int i = 0; i < defaultValues.length; i++) - { - defaultNames[i] = Block.blockRegistry.getNameForObject(defaultValues[i].getBlock()) + ":" + defaultValues[i].getMeta(); - } - Property property = config.get("rune overrides", tierName, defaultNames); - String[] names = property.getStringList(); - if (names.length != defaultNames.length) - { - property.set(defaultNames); - return defaultValues; - } - BlockStack[] blockStacks = new BlockStack[names.length]; - for (int i = 0; i < names.length; i++) - { - String[] parts = names[i].split(":"); - if (parts.length < 2 || parts.length > 3) - { - property.set(defaultNames); - return defaultValues; - } - Block block = GameRegistry.findBlock(parts[0], parts[1]); - int metadata = 0; - if (parts.length == 3) - { - try - { - metadata = Integer.parseInt(parts[2]); - } - catch (NumberFormatException exception) - { - metadata = 0; - } - } - if (block == null) - { - property.set(defaultNames); - return defaultValues; - } - blockStacks[i] = new BlockStack(block, metadata); - } - return blockStacks; - } + private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) { + String[] defaultNames = new String[defaultValues.length]; + for (int i = 0; i < defaultValues.length; i++) { + defaultNames[i] = Block.blockRegistry.getNameForObject(defaultValues[i].getBlock()) + ":" + + defaultValues[i].getMeta(); + } + Property property = config.get("rune overrides", tierName, defaultNames); + String[] names = property.getStringList(); + if (names.length != defaultNames.length) { + property.set(defaultNames); + return defaultValues; + } + BlockStack[] blockStacks = new BlockStack[names.length]; + for (int i = 0; i < names.length; i++) { + String[] parts = names[i].split(":"); + if (parts.length < 2 || parts.length > 3) { + property.set(defaultNames); + return defaultValues; + } + Block block = GameRegistry.findBlock(parts[0], parts[1]); + int metadata = 0; + if (parts.length == 3) { + try { + metadata = Integer.parseInt(parts[2]); + } catch (NumberFormatException exception) { + metadata = 0; + } + } + if (block == null) { + property.set(defaultNames); + return defaultValues; + } + blockStacks[i] = new BlockStack(block, metadata); + } + return blockStacks; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java b/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java index 7cf58421..78366c77 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry; -import net.minecraft.block.Block; import WayofTime.alchemicalWizardry.common.block.ArmourForge; import WayofTime.alchemicalWizardry.common.block.BlockAlchemicCalcinator; import WayofTime.alchemicalWizardry.common.block.BlockAltar; @@ -50,6 +49,7 @@ import WayofTime.alchemicalWizardry.common.items.ItemSpellModifierBlock; import WayofTime.alchemicalWizardry.common.items.ItemSpellParadigmBlock; import WayofTime.alchemicalWizardry.common.items.ItemStabilityGlyphBlock; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; /** * Created with IntelliJ IDEA. @@ -57,8 +57,7 @@ import cpw.mods.fml.common.registry.GameRegistry; * Date: 17/01/14 * Time: 19:48 */ -public class ModBlocks -{ +public class ModBlocks { public static Block bloodStoneBrick; public static Block largeBloodStoneBrick; public static BlockAltar blockAltar; @@ -99,8 +98,7 @@ public class ModBlocks public static Block blockStabilityGlyph; public static Block blockCrucible; - public static void init() - { + public static void init() { blockAltar = new BlockAltar(); bloodRune = new BloodRune(); speedRune = new SpeedRune(); @@ -136,17 +134,19 @@ public class ModBlocks blockDemonChest = new BlockDemonChest(); blockCrystal = new BlockCrystal(); blockMimic = new MimicBlock(); - + blockLifeEssence = new LifeEssenceBlock(); blockEnchantmentGlyph = new BlockEnchantmentGlyph(); blockStabilityGlyph = new BlockStabilityGlyph(); blockCrucible = new BlockCrucible(); } - public static void registerBlocksInPre() - { + public static void registerBlocksInPre() { GameRegistry.registerBlock(ModBlocks.blockAltar, "Altar"); - GameRegistry.registerBlock(ModBlocks.bloodRune, ItemBloodRuneBlock.class, "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5))); + GameRegistry.registerBlock( + ModBlocks.bloodRune, + ItemBloodRuneBlock.class, + "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5))); GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence"); GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune"); GameRegistry.registerBlock(ModBlocks.efficiencyRune, "efficiencyRune"); @@ -170,10 +170,22 @@ public class ModBlocks GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight"); GameRegistry.registerBlock(ModBlocks.blockConduit, "blockConduit"); - GameRegistry.registerBlock(ModBlocks.blockSpellParadigm, ItemSpellParadigmBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellParadigm.getUnlocalizedName())); - GameRegistry.registerBlock(ModBlocks.blockSpellEnhancement, ItemSpellEnhancementBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName())); - GameRegistry.registerBlock(ModBlocks.blockSpellModifier, ItemSpellModifierBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName())); - GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName())); + GameRegistry.registerBlock( + ModBlocks.blockSpellParadigm, + ItemSpellParadigmBlock.class, + "AlchemicalWizardry" + (ModBlocks.blockSpellParadigm.getUnlocalizedName())); + GameRegistry.registerBlock( + ModBlocks.blockSpellEnhancement, + ItemSpellEnhancementBlock.class, + "AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName())); + GameRegistry.registerBlock( + ModBlocks.blockSpellModifier, + ItemSpellModifierBlock.class, + "AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName())); + GameRegistry.registerBlock( + ModBlocks.blockSpellEffect, + ItemSpellEffectBlock.class, + "AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName())); GameRegistry.registerBlock(ModBlocks.blockSpectralContainer, "spectralContainer"); GameRegistry.registerBlock(ModBlocks.blockDemonPortal, "demonPortalMain"); @@ -184,13 +196,12 @@ public class ModBlocks GameRegistry.registerBlock(ModBlocks.blockDemonChest, "blockDemonChest"); GameRegistry.registerBlock(ModBlocks.blockCrystal, ItemCrystalBlock.class, "blockCrystal"); GameRegistry.registerBlock(ModBlocks.blockMimic, "blockMimic"); - GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph"); + GameRegistry.registerBlock( + ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph"); GameRegistry.registerBlock(ModBlocks.blockStabilityGlyph, ItemStabilityGlyphBlock.class, "blockStabilityGlyph"); - + GameRegistry.registerBlock(ModBlocks.blockCrucible, "blockCrucible"); } - public static void registerBlocksInInit() - { - } + public static void registerBlocksInInit() {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java index 000469bd..0bc25fb3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java @@ -1,11 +1,8 @@ package WayofTime.alchemicalWizardry; -import WayofTime.alchemicalWizardry.common.items.*; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; +import WayofTime.alchemicalWizardry.common.items.*; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourEarth; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourFire; @@ -52,6 +49,9 @@ import WayofTime.alchemicalWizardry.common.items.sigil.SigilVoid; import WayofTime.alchemicalWizardry.common.items.sigil.SigilWater; import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; /** * Created with IntelliJ IDEA. @@ -59,8 +59,7 @@ import cpw.mods.fml.common.registry.GameRegistry; * Date: 17/01/14 * Time: 19:48 */ -public class ModItems -{ +public class ModItems { public static Item weakBloodOrb; public static Item apprenticeBloodOrb; public static Item magicianBloodOrb; @@ -207,8 +206,7 @@ public class ModItems public static Item ritualDismantler; - public static void init() - { + public static void init() { weakBloodOrb = new EnergyBattery(5000).setUnlocalizedName("weakBloodOrb"); apprenticeBloodOrb = new ApprenticeBloodOrb(25000).setUnlocalizedName("apprenticeBloodOrb"); magicianBloodOrb = new MagicianBloodOrb(150000).setUnlocalizedName("magicianBloodOrb"); @@ -270,7 +268,8 @@ public class ModItems sigilOfWind = new SigilOfWind().setUnlocalizedName("sigilOfWind"); telepositionFocus = new TelepositionFocus(1).setUnlocalizedName("telepositionFocus"); enhancedTelepositionFocus = new EnhancedTelepositionFocus().setUnlocalizedName("enhancedTelepositionFocus"); - reinforcedTelepositionFocus = new ReinforcedTelepositionFocus().setUnlocalizedName("reinforcedTelepositionFocus"); + reinforcedTelepositionFocus = + new ReinforcedTelepositionFocus().setUnlocalizedName("reinforcedTelepositionFocus"); demonicTelepositionFocus = new DemonicTelepositionFocus().setUnlocalizedName("demonicTelepositionFocus"); imbuedSlate = new AWBaseItems().setUnlocalizedName("imbuedSlate"); demonicSlate = new AWBaseItems().setUnlocalizedName("demonicSlate"); @@ -292,7 +291,10 @@ public class ModItems energyBazookaThirdTier = new EnergyBazooka(3).setUnlocalizedName("energyBazookaThirdTier"); itemBloodLightSigil = new SigilBloodLight().setUnlocalizedName("bloodLightSigil"); itemComplexSpellCrystal = new ItemComplexSpellCrystal().setUnlocalizedName("itemComplexSpellCrystal"); - bucketLife = new LifeBucket(ModBlocks.blockLifeEssence).setUnlocalizedName("bucketLife").setContainerItem(Items.bucket).setCreativeTab(CreativeTabs.tabMisc); + bucketLife = new LifeBucket(ModBlocks.blockLifeEssence) + .setUnlocalizedName("bucketLife") + .setContainerItem(Items.bucket) + .setCreativeTab(CreativeTabs.tabMisc); itemSigilOfEnderSeverance = (new SigilOfEnderSeverance()).setUnlocalizedName("itemSigilOfEnderSeverance"); baseItems = new ItemComponents().setUnlocalizedName("baseItems"); baseAlchemyItems = new ItemAlchemyBase().setUnlocalizedName("baseAlchemyItems"); @@ -343,8 +345,7 @@ public class ModItems ritualDismantler = new ItemRitualDismantler().setUnlocalizedName("ritualDismantler"); } - public static void registerItems() - { + public static void registerItems() { GameRegistry.registerItem(ModItems.weakBloodOrb, "weakBloodOrb"); GameRegistry.registerItem(ModItems.apprenticeBloodOrb, "apprenticeBloodOrb"); GameRegistry.registerItem(ModItems.magicianBloodOrb, "magicianBloodOrb"); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/ColourAndCoords.java b/src/main/java/WayofTime/alchemicalWizardry/api/ColourAndCoords.java index d34dd413..6089c6e3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/ColourAndCoords.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/ColourAndCoords.java @@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.api; import net.minecraft.nbt.NBTTagCompound; -public class ColourAndCoords -{ +public class ColourAndCoords { public int colourRed; public int colourGreen; public int colourBlue; @@ -13,8 +12,7 @@ public class ColourAndCoords public int yCoord; public int zCoord; - public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z) - { + public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z) { this.colourRed = red; this.colourGreen = green; this.colourBlue = blue; @@ -25,13 +23,18 @@ public class ColourAndCoords this.zCoord = z; } - public static ColourAndCoords readFromNBT(NBTTagCompound tag) - { - return new ColourAndCoords(tag.getInteger("colourRed"), tag.getInteger("colourGreen"), tag.getInteger("colourBlue"), tag.getInteger("colourIntensity"), tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord")); + public static ColourAndCoords readFromNBT(NBTTagCompound tag) { + return new ColourAndCoords( + tag.getInteger("colourRed"), + tag.getInteger("colourGreen"), + tag.getInteger("colourBlue"), + tag.getInteger("colourIntensity"), + tag.getInteger("xCoord"), + tag.getInteger("yCoord"), + tag.getInteger("zCoord")); } - public NBTTagCompound writeToNBT(NBTTagCompound tag) - { + public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setInteger("colourRed", colourRed); tag.setInteger("colourGreen", colourGreen); tag.setInteger("colourBlue", colourBlue); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/ILimitingLogic.java b/src/main/java/WayofTime/alchemicalWizardry/api/ILimitingLogic.java index 30ab2ca8..2d76f6f6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/ILimitingLogic.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/ILimitingLogic.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.api; -public interface ILimitingLogic -{ - public int getRoutingLimit(); +public interface ILimitingLogic { + public int getRoutingLimit(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/Int3.java b/src/main/java/WayofTime/alchemicalWizardry/api/Int3.java index 16facc02..57b218ef 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/Int3.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/Int3.java @@ -2,27 +2,22 @@ package WayofTime.alchemicalWizardry.api; import net.minecraft.nbt.NBTTagCompound; - -public class Int3 -{ +public class Int3 { public int xCoord; public int yCoord; public int zCoord; - public Int3(int xCoord, int yCoord, int zCoord) - { + public Int3(int xCoord, int yCoord, int zCoord) { this.xCoord = xCoord; this.yCoord = yCoord; this.zCoord = zCoord; } - public static Int3 readFromNBT(NBTTagCompound tag) - { + public static Int3 readFromNBT(NBTTagCompound tag) { return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord")); } - public NBTTagCompound writeToNBT(NBTTagCompound tag) - { + public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setInteger("xCoord", xCoord); tag.setInteger("yCoord", yCoord); tag.setInteger("zCoord", zCoord); @@ -31,14 +26,16 @@ public class Int3 } @Override - public boolean equals(Object o) - { - return o instanceof Int3 ? ((Int3) o).xCoord == this.xCoord && ((Int3) o).yCoord == this.yCoord && ((Int3) o).zCoord == this.zCoord : false; + public boolean equals(Object o) { + return o instanceof Int3 + ? ((Int3) o).xCoord == this.xCoord + && ((Int3) o).yCoord == this.yCoord + && ((Int3) o).zCoord == this.zCoord + : false; } - + @Override - public int hashCode() - { + public int hashCode() { return this.xCoord + this.yCoord << 8 + this.zCoord << 16; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java index a3f0a3e1..07f63db6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java @@ -2,15 +2,18 @@ package WayofTime.alchemicalWizardry.api; import net.minecraft.item.ItemStack; -public class RoutingFocusLogic -{ - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() && (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage() : true) : false); - } - - public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) - { - return previous || this.getDefaultMatch(keyStack, checkedStack); - } +public class RoutingFocusLogic { + public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) { + return (keyStack != null + ? checkedStack != null + && keyStack.getItem() == checkedStack.getItem() + && (keyStack.getItem().getHasSubtypes() + ? keyStack.getItemDamage() == checkedStack.getItemDamage() + : true) + : false); + } + + public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) { + return previous || this.getDefaultMatch(keyStack, checkedStack); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java index c41cab43..71a5cbd5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java @@ -2,63 +2,52 @@ package WayofTime.alchemicalWizardry.api; import java.util.LinkedList; import java.util.List; - import net.minecraft.item.ItemStack; -public class RoutingFocusParadigm -{ - public List logicList = new LinkedList(); - - public List locationList = new LinkedList(); - - public int maximumAmount = 0; - - public void addRoutingFocusPosAndFacing(RoutingFocusPosAndFacing facing) - { - locationList.add(facing); - } - - public void addLogic(RoutingFocusLogic logic) - { - if(logic instanceof ILimitingLogic) - { - maximumAmount += ((ILimitingLogic)logic).getRoutingLimit(); - } - logicList.add(logic); - } - - public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack) - { - boolean isGood = false; - boolean isFirst = true; - for(RoutingFocusLogic logic : logicList) - { - if(isFirst) - { - isGood = logic.getDefaultMatch(keyStack, checkedStack); - isFirst = false; - continue; - } - isGood = logic.doesItemMatch(isGood, keyStack, checkedStack); - } - - return isGood; - } - - public void clear() - { - logicList.clear(); - locationList.clear(); - maximumAmount = 0; - } - - public void setMaximumAmount(int amt) - { - this.maximumAmount = amt; - } - - public int getMaximumAmount() - { - return this.maximumAmount; - } +public class RoutingFocusParadigm { + public List logicList = new LinkedList(); + + public List locationList = new LinkedList(); + + public int maximumAmount = 0; + + public void addRoutingFocusPosAndFacing(RoutingFocusPosAndFacing facing) { + locationList.add(facing); + } + + public void addLogic(RoutingFocusLogic logic) { + if (logic instanceof ILimitingLogic) { + maximumAmount += ((ILimitingLogic) logic).getRoutingLimit(); + } + logicList.add(logic); + } + + public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack) { + boolean isGood = false; + boolean isFirst = true; + for (RoutingFocusLogic logic : logicList) { + if (isFirst) { + isGood = logic.getDefaultMatch(keyStack, checkedStack); + isFirst = false; + continue; + } + isGood = logic.doesItemMatch(isGood, keyStack, checkedStack); + } + + return isGood; + } + + public void clear() { + logicList.clear(); + locationList.clear(); + maximumAmount = 0; + } + + public void setMaximumAmount(int amt) { + this.maximumAmount = amt; + } + + public int getMaximumAmount() { + return this.maximumAmount; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java index a6ee34a9..cafdfa31 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java @@ -2,20 +2,20 @@ package WayofTime.alchemicalWizardry.api; import net.minecraftforge.common.util.ForgeDirection; -public class RoutingFocusPosAndFacing -{ - public Int3 location; - public ForgeDirection facing; - - public RoutingFocusPosAndFacing(Int3 location, ForgeDirection facing) - { - this.location = location; - this.facing = facing; - } - - @Override - public boolean equals(Object obj) - { - return obj instanceof RoutingFocusPosAndFacing ? facing.equals(((RoutingFocusPosAndFacing)obj).facing) && location.equals(((RoutingFocusPosAndFacing)obj).location) : false; - } +public class RoutingFocusPosAndFacing { + public Int3 location; + public ForgeDirection facing; + + public RoutingFocusPosAndFacing(Int3 location, ForgeDirection facing) { + this.location = location; + this.facing = facing; + } + + @Override + public boolean equals(Object obj) { + return obj instanceof RoutingFocusPosAndFacing + ? facing.equals(((RoutingFocusPosAndFacing) obj).facing) + && location.equals(((RoutingFocusPosAndFacing) obj).location) + : false; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/Vector3.java b/src/main/java/WayofTime/alchemicalWizardry/api/Vector3.java index 645d97e6..2cf06243 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/Vector3.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/Vector3.java @@ -4,42 +4,40 @@ package WayofTime.alchemicalWizardry.api; * Created in Scala by Alex-Hawks * Translated and implemented by Arcaratus */ -public class Vector3 -{ +public class Vector3 { public int x, y, z; - public Vector3(int x, int y, int z) - { + public Vector3(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } - public Vector3 add(Vector3 vec1) - { + public Vector3 add(Vector3 vec1) { return new Vector3(this.x + vec1.x, this.y + vec1.y, this.z + vec1.z); } @Override - public String toString() - { + public String toString() { return "V3(" + x + "}, " + y + "}," + z + "})"; } - private boolean canEqual(Object object) - { + private boolean canEqual(Object object) { return object instanceof Vector3; } @Override - public boolean equals(Object object) - { - return object == this || object instanceof Vector3 && canEqual(this) && this.x == ((Vector3) object).x && this.y == ((Vector3) object).y && this.z == ((Vector3) object).z; + public boolean equals(Object object) { + return object == this + || object instanceof Vector3 + && canEqual(this) + && this.x == ((Vector3) object).x + && this.y == ((Vector3) object).y + && this.z == ((Vector3) object).z; } @Override - public int hashCode() - { + public int hashCode() { return 48131 * x - 95021 * y + z; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemicalPotionCreationHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemicalPotionCreationHandler.java index 6af04910..56ce8cf9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemicalPotionCreationHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemicalPotionCreationHandler.java @@ -1,24 +1,18 @@ package WayofTime.alchemicalWizardry.api.alchemy; +import java.util.ArrayList; import net.minecraft.item.ItemStack; -import java.util.ArrayList; - -public class AlchemicalPotionCreationHandler -{ +public class AlchemicalPotionCreationHandler { public static ArrayList registeredPotionEffects = new ArrayList(); - public static void addPotion(ItemStack itemStack, int potionID, int tickDuration) - { + public static void addPotion(ItemStack itemStack, int potionID, int tickDuration) { registeredPotionEffects.add(new AlchemyPotionHandlerComponent(itemStack, potionID, tickDuration)); } - public static int getPotionIDForStack(ItemStack itemStack) - { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(itemStack)) - { + public static int getPotionIDForStack(ItemStack itemStack) { + for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) { + if (aphc.compareItemStack(itemStack)) { return aphc.getPotionID(); } } @@ -26,13 +20,10 @@ public class AlchemicalPotionCreationHandler return -1; } - public static int getPotionTickDurationForStack(ItemStack itemStack) - { + public static int getPotionTickDurationForStack(ItemStack itemStack) { { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(itemStack)) - { + for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) { + if (aphc.compareItemStack(itemStack)) { return aphc.getTickDuration(); } } @@ -41,14 +32,10 @@ public class AlchemicalPotionCreationHandler } } - public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList) - { - for (ItemStack is : stackList) - { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(is)) - { + public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList) { + for (ItemStack is : stackList) { + for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) { + if (aphc.compareItemStack(is)) { return true; } } @@ -57,16 +44,12 @@ public class AlchemicalPotionCreationHandler return false; } - public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList) - { + public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList) { int i = 0; - for (ItemStack is : stackList) - { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(is)) - { + for (ItemStack is : stackList) { + for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) { + if (aphc.compareItemStack(is)) { return i; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHandlerComponent.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHandlerComponent.java index 6f0d461d..3ad5a48b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHandlerComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHandlerComponent.java @@ -3,50 +3,42 @@ package WayofTime.alchemicalWizardry.api.alchemy; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class AlchemyPotionHandlerComponent -{ +public class AlchemyPotionHandlerComponent { private ItemStack itemStack; private int potionID; private int tickDuration; - public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration) - { + public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration) { this.itemStack = itemStack; this.potionID = potionID; this.tickDuration = tickDuration; } - public boolean compareItemStack(ItemStack comparedStack) - { - if (comparedStack != null && itemStack != null) - { - if (comparedStack.getItem() instanceof ItemBlock) - { - if (itemStack.getItem() instanceof ItemBlock) - { - return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage(); + public boolean compareItemStack(ItemStack comparedStack) { + if (comparedStack != null && itemStack != null) { + if (comparedStack.getItem() instanceof ItemBlock) { + if (itemStack.getItem() instanceof ItemBlock) { + return comparedStack.getItem().equals(itemStack.getItem()) + && comparedStack.getItemDamage() == itemStack.getItemDamage(); } - } else if (!(itemStack.getItem() instanceof ItemBlock)) - { - return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage(); + } else if (!(itemStack.getItem() instanceof ItemBlock)) { + return comparedStack.getItem().equals(itemStack.getItem()) + && comparedStack.getItemDamage() == itemStack.getItemDamage(); } } return false; } - public ItemStack getItemStack() - { + public ItemStack getItemStack() { return itemStack; } - public int getPotionID() - { + public int getPotionID() { return this.potionID; } - public int getTickDuration() - { + public int getTickDuration() { return this.tickDuration; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHelper.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHelper.java index d3462552..a2ca5c5b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHelper.java @@ -4,68 +4,63 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -public class AlchemyPotionHelper -{ +public class AlchemyPotionHelper { private int potionID; private int tickDuration; private int concentration; private int durationFactor; - public AlchemyPotionHelper(int potionID, int tickDuration, int concentration, int durationFactor) - { + public AlchemyPotionHelper(int potionID, int tickDuration, int concentration, int durationFactor) { this.potionID = potionID; this.tickDuration = tickDuration; this.concentration = concentration; this.durationFactor = durationFactor; } - public void setConcentration(int concentration) - { + public void setConcentration(int concentration) { this.concentration = concentration; } - public void setDurationFactor(int durationFactor) - { + public void setDurationFactor(int durationFactor) { this.durationFactor = durationFactor; } - public int getPotionID() - { + public int getPotionID() { return this.potionID; } - public int getTickDuration() - { + public int getTickDuration() { return this.tickDuration; } - public int getConcentration() - { + public int getConcentration() { return this.concentration; } - public int getdurationFactor() - { + public int getdurationFactor() { return this.durationFactor; } - public PotionEffect getPotionEffect() - { - if (potionID == Potion.heal.id || potionID == Potion.harm.id) - { + public PotionEffect getPotionEffect() { + if (potionID == Potion.heal.id || potionID == Potion.harm.id) { return (new PotionEffect(potionID, 1, concentration)); } - return (new PotionEffect(potionID, (int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)), concentration)); + return (new PotionEffect( + potionID, + (int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)), + concentration)); } - public static AlchemyPotionHelper readEffectFromNBT(NBTTagCompound tagCompound) - { - return new AlchemyPotionHelper(tagCompound.getInteger("potionID"), tagCompound.getInteger("tickDuration"), tagCompound.getInteger("concentration"), tagCompound.getInteger("durationFactor")); + public static AlchemyPotionHelper readEffectFromNBT(NBTTagCompound tagCompound) { + return new AlchemyPotionHelper( + tagCompound.getInteger("potionID"), + tagCompound.getInteger("tickDuration"), + tagCompound.getInteger("concentration"), + tagCompound.getInteger("durationFactor")); } - public static NBTTagCompound setEffectToNBT(AlchemyPotionHelper aph) - { + public static NBTTagCompound setEffectToNBT(AlchemyPotionHelper aph) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setInteger("potionID", aph.getPotionID()); tagCompound.setInteger("tickDuration", aph.getTickDuration()); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipe.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipe.java index 17465b72..7403546e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipe.java @@ -4,116 +4,96 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class AlchemyRecipe -{ +public class AlchemyRecipe { private ItemStack output; private ItemStack[] recipe; private int bloodOrbLevel; private int amountNeeded; - public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) - { + public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) { this.output = output; this.recipe = recipe; this.amountNeeded = amountNeeded; this.bloodOrbLevel = bloodOrbLevel; } - public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel) - { - if (slottedBloodOrbLevel < bloodOrbLevel) - { + public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel) { + if (slottedBloodOrbLevel < bloodOrbLevel) { return false; } ItemStack[] recipe; - if (items.length < 5) - { + if (items.length < 5) { return false; } - if (this.recipe.length != 5) - { + if (this.recipe.length != 5) { ItemStack[] newRecipe = new ItemStack[5]; - for (int i = 0; i < 5; i++) - { - if (i + 1 > this.recipe.length) - { + for (int i = 0; i < 5; i++) { + if (i + 1 > this.recipe.length) { newRecipe[i] = null; - } else - { + } else { newRecipe[i] = this.recipe[i]; } } recipe = newRecipe; - } else - { + } else { recipe = this.recipe; } boolean[] checkList = new boolean[5]; - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { checkList[i] = false; } - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { ItemStack recipeItemStack = recipe[i]; - if (recipeItemStack == null) - { + if (recipeItemStack == null) { continue; } boolean test = false; - for (int j = 0; j < 5; j++) - { - if (checkList[j]) - { + for (int j = 0; j < 5; j++) { + if (checkList[j]) { continue; } ItemStack checkedItemStack = items[j]; - if (checkedItemStack == null) - { + if (checkedItemStack == null) { continue; } boolean quickTest = false; - if (recipeItemStack.getItem() instanceof ItemBlock) - { - if (checkedItemStack.getItem() instanceof ItemBlock) - { + if (recipeItemStack.getItem() instanceof ItemBlock) { + if (checkedItemStack.getItem() instanceof ItemBlock) { quickTest = true; } - } else if (!(checkedItemStack.getItem() instanceof ItemBlock)) - { + } else if (!(checkedItemStack.getItem() instanceof ItemBlock)) { quickTest = true; } - if (!quickTest) - { + if (!quickTest) { continue; } - if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem()) - { + if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() + || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) + && checkedItemStack.getItem() == recipeItemStack.getItem()) { test = true; checkList[j] = true; break; } } - if (!test) - { + if (!test) { return false; } } @@ -121,23 +101,19 @@ public class AlchemyRecipe return true; } - public ItemStack getResult() - { + public ItemStack getResult() { return output.copy(); } - public int getAmountNeeded() - { + public int getAmountNeeded() { return this.amountNeeded; } - public ItemStack[] getRecipe() - { + public ItemStack[] getRecipe() { return this.recipe; } - public int getOrbLevel() - { + public int getOrbLevel() { return this.bloodOrbLevel; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipeRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipeRegistry.java index dfb24596..1b59c443 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipeRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipeRegistry.java @@ -1,38 +1,30 @@ package WayofTime.alchemicalWizardry.api.alchemy; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; -import net.minecraft.item.ItemStack; - import java.util.ArrayList; import java.util.List; +import net.minecraft.item.ItemStack; -public class AlchemyRecipeRegistry -{ +public class AlchemyRecipeRegistry { public static List recipes = new ArrayList(); - public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) - { + public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) { recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel)); } - public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb) - { - if (bloodOrb == null) - { + public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb) { + if (bloodOrb == null) { return null; } - if (!(bloodOrb.getItem() instanceof IBloodOrb)) - { + if (!(bloodOrb.getItem() instanceof IBloodOrb)) { return null; } int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel(); - for (AlchemyRecipe ar : recipes) - { - if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) - { + for (AlchemyRecipe ar : recipes) { + if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) { return (ar.getResult()); } } @@ -40,24 +32,19 @@ public class AlchemyRecipeRegistry return null; } - public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb) - { - if (bloodOrb == null) - { + public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb) { + if (bloodOrb == null) { return 0; } - if (!(bloodOrb.getItem() instanceof IBloodOrb)) - { + if (!(bloodOrb.getItem() instanceof IBloodOrb)) { return 0; } int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel(); - for (AlchemyRecipe ar : recipes) - { - if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) - { + for (AlchemyRecipe ar : recipes) { + if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) { return (ar.getAmountNeeded()); } } @@ -65,16 +52,12 @@ public class AlchemyRecipeRegistry return 0; } - public static ItemStack[] getRecipeForItemStack(ItemStack itemStack) - { - for (AlchemyRecipe ar : recipes) - { + public static ItemStack[] getRecipeForItemStack(ItemStack itemStack) { + for (AlchemyRecipe ar : recipes) { ItemStack result = ar.getResult(); - if (result != null) - { - if (result.isItemEqual(itemStack)) - { + if (result != null) { + if (result.isItemEqual(itemStack)) { return ar.getRecipe(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IAlchemyGoggles.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IAlchemyGoggles.java index 3d6ca980..e19554b7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IAlchemyGoggles.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IAlchemyGoggles.java @@ -4,7 +4,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IAlchemyGoggles -{ +public interface IAlchemyGoggles { boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentContainer.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentContainer.java index e4d4d9dc..a807a687 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentContainer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentContainer.java @@ -1,7 +1,6 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy; -public interface IReagentContainer -{ +public interface IReagentContainer { ReagentStack getReagent(); int getReagentStackAmount(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentHandler.java index 165e9ab3..ba410c89 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentHandler.java @@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy; import net.minecraftforge.common.util.ForgeDirection; -public interface IReagentHandler -{ +public interface IReagentHandler { int fill(ForgeDirection from, ReagentStack resource, boolean doFill); ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ISegmentedReagentHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ISegmentedReagentHandler.java index 52be7b9f..15463b96 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ISegmentedReagentHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ISegmentedReagentHandler.java @@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy; import java.util.Map; -public interface ISegmentedReagentHandler extends IReagentHandler -{ +public interface ISegmentedReagentHandler extends IReagentHandler { int getNumberOfTanks(); int getTanksTunedToReagent(Reagent reagent); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/Reagent.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/Reagent.java index 4cc88bcb..b2aa1575 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/Reagent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/Reagent.java @@ -1,7 +1,6 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy; -public class Reagent -{ +public class Reagent { public final String name; public static final int REAGENT_SIZE = 1000; @@ -11,42 +10,35 @@ public class Reagent private int colourBlue = 0; private int colourIntensity = 255; - public Reagent(String name) - { + public Reagent(String name) { this.name = name; } - public void setColour(int red, int green, int blue, int intensity) - { + public void setColour(int red, int green, int blue, int intensity) { this.colourRed = red; this.colourGreen = green; this.colourBlue = blue; this.colourIntensity = intensity; } - public int getColourRed() - { + public int getColourRed() { return colourRed; } - public int getColourGreen() - { + public int getColourGreen() { return colourGreen; } - public int getColourBlue() - { + public int getColourBlue() { return colourBlue; } - public int getColourIntensity() - { + public int getColourIntensity() { return colourIntensity; } @Override - public boolean equals(Object o) - { + public boolean equals(Object o) { return o instanceof Reagent && this == o && name.equals(((Reagent) o).name); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainer.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainer.java index c1352746..202aad1f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainer.java @@ -2,45 +2,36 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy; import net.minecraft.nbt.NBTTagCompound; -public class ReagentContainer implements IReagentContainer -{ +public class ReagentContainer implements IReagentContainer { protected ReagentStack reagentStack; protected int capacity; - public ReagentContainer(int capacity) - { + public ReagentContainer(int capacity) { this(null, capacity); } - public ReagentContainer(ReagentStack stack, int capacity) - { + public ReagentContainer(ReagentStack stack, int capacity) { this.reagentStack = stack; this.capacity = capacity; } - public ReagentContainer(Reagent reagent, int amount, int capacity) - { + public ReagentContainer(Reagent reagent, int amount, int capacity) { this(new ReagentStack(reagent, amount), capacity); } - public static ReagentContainer readFromNBT(NBTTagCompound nbt) - { + public static ReagentContainer readFromNBT(NBTTagCompound nbt) { ReagentStack reagent = ReagentStack.loadReagentStackFromNBT(nbt); int capacity = nbt.getInteger("capacity"); - if (reagent != null) - { + if (reagent != null) { return new ReagentContainer(reagent, capacity); - } else - { + } else { return new ReagentContainer(null, capacity); } } - public NBTTagCompound writeToNBT(NBTTagCompound nbt) - { - if (reagentStack != null) - { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + if (reagentStack != null) { reagentStack.writeToNBT(nbt); } @@ -50,69 +41,56 @@ public class ReagentContainer implements IReagentContainer } @Override - public ReagentStack getReagent() - { + public ReagentStack getReagent() { return reagentStack; } @Override - public int getReagentStackAmount() - { - if (reagentStack == null) - { + public int getReagentStackAmount() { + if (reagentStack == null) { return 0; } return reagentStack.amount; } @Override - public int getCapacity() - { + public int getCapacity() { return capacity; } @Override - public int fill(ReagentStack resource, boolean doFill) - { - if (resource == null) - { + public int fill(ReagentStack resource, boolean doFill) { + if (resource == null) { return 0; } - if (!doFill) - { - if (reagentStack == null) - { + if (!doFill) { + if (reagentStack == null) { return Math.min(capacity, resource.amount); } - if (!reagentStack.isReagentEqual(resource)) - { + if (!reagentStack.isReagentEqual(resource)) { return 0; } return Math.min(capacity - reagentStack.amount, resource.amount); } - if (reagentStack == null) - { + if (reagentStack == null) { reagentStack = new ReagentStack(resource, Math.min(capacity, resource.amount)); return reagentStack.amount; } - if (!reagentStack.isReagentEqual(resource)) - { + if (!reagentStack.isReagentEqual(resource)) { return 0; } int filled = capacity - reagentStack.amount; - if (resource.amount < filled) - { + if (resource.amount < filled) { reagentStack.amount += resource.amount; filled = resource.amount; - } else - { + } else { reagentStack.amount = capacity; } @@ -120,25 +98,20 @@ public class ReagentContainer implements IReagentContainer } @Override - public ReagentStack drain(int maxDrain, boolean doDrain) - { - if (reagentStack == null) - { + public ReagentStack drain(int maxDrain, boolean doDrain) { + if (reagentStack == null) { return null; } int drained = maxDrain; - if (reagentStack.amount < drained) - { + if (reagentStack.amount < drained) { drained = reagentStack.amount; } ReagentStack stack = new ReagentStack(reagentStack, drained); - if (doDrain) - { + if (doDrain) { reagentStack.amount -= drained; - if (reagentStack.amount <= 0) - { + if (reagentStack.amount <= 0) { reagentStack = null; } } @@ -146,8 +119,7 @@ public class ReagentContainer implements IReagentContainer } @Override - public ReagentContainerInfo getInfo() - { + public ReagentContainerInfo getInfo() { return new ReagentContainerInfo(this); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainerInfo.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainerInfo.java index 99521dce..5acf144e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainerInfo.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainerInfo.java @@ -1,18 +1,15 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy; -public final class ReagentContainerInfo -{ +public final class ReagentContainerInfo { public final ReagentStack reagent; public final int capacity; - public ReagentContainerInfo(ReagentStack reagent, int capacity) - { + public ReagentContainerInfo(ReagentStack reagent, int capacity) { this.reagent = reagent; this.capacity = capacity; } - public ReagentContainerInfo(IReagentContainer tank) - { + public ReagentContainerInfo(IReagentContainer tank) { this.reagent = tank.getReagent(); this.capacity = tank.getCapacity(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java index 20b43931..fdc33f4c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java @@ -4,11 +4,9 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; - import net.minecraft.item.ItemStack; -public class ReagentRegistry -{ +public class ReagentRegistry { public static Map reagentList = new HashMap(); public static Map itemToReagentMap = new HashMap(); @@ -29,8 +27,7 @@ public class ReagentRegistry public static Reagent reductusReagent; public static Reagent potentiaReagent; - public static void initReagents() - { + public static void initReagents() { sanctusReagent = new Reagent("sanctus"); incendiumReagent = new Reagent("incendium"); aquasalusReagent = new Reagent("aquasalus"); @@ -80,10 +77,8 @@ public class ReagentRegistry registerReagent("potentia", potentiaReagent); } - public static boolean registerReagent(String key, Reagent reagent) - { - if (reagentList.containsKey(key) || reagent == null) - { + public static boolean registerReagent(String key, Reagent reagent) { + if (reagentList.containsKey(key) || reagent == null) { return false; } @@ -92,25 +87,19 @@ public class ReagentRegistry return true; } - public static Reagent getReagentForKey(String key) - { - if (reagentList.containsKey(key)) - { + public static Reagent getReagentForKey(String key) { + if (reagentList.containsKey(key)) { return reagentList.get(key); } return null; } - public static String getKeyForReagent(Reagent reagent) - { - if (reagentList.containsValue(reagent)) - { + public static String getKeyForReagent(Reagent reagent) { + if (reagentList.containsValue(reagent)) { Set> set = reagentList.entrySet(); - for (Entry entry : set) - { - if (entry.getValue().equals(reagent)) - { + for (Entry entry : set) { + if (entry.getValue().equals(reagent)) { return entry.getKey(); } } @@ -119,27 +108,20 @@ public class ReagentRegistry return ""; } - public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack) - { + public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack) { itemToReagentMap.put(stack, reagentStack); } - public static ReagentStack getReagentStackForItem(ItemStack stack) - { - if (stack == null) - { + public static ReagentStack getReagentStackForItem(ItemStack stack) { + if (stack == null) { return null; } - for (Entry entry : itemToReagentMap.entrySet()) - { - if (entry.getKey() != null && entry.getKey().isItemEqual(stack)) - { - if (entry.getValue() == null) - { + for (Entry entry : itemToReagentMap.entrySet()) { + if (entry.getKey() != null && entry.getKey().isItemEqual(stack)) { + if (entry.getValue() == null) { return null; - } else - { + } else { return entry.getValue().copy(); } } @@ -148,22 +130,16 @@ public class ReagentRegistry return null; } - public static ItemStack getItemForReagent(Reagent reagent) - { - if (reagent == null) - { + public static ItemStack getItemForReagent(Reagent reagent) { + if (reagent == null) { return null; } - for (Entry entry : itemToReagentMap.entrySet()) - { - if (entry.getValue() != null && entry.getValue().reagent == reagent) - { - if (entry.getKey() == null) - { + for (Entry entry : itemToReagentMap.entrySet()) { + if (entry.getValue() != null && entry.getValue().reagent == reagent) { + if (entry.getKey() == null) { return null; - } else - { + } else { return entry.getKey().copy(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java index f8583970..c801ce41 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java @@ -2,28 +2,23 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy; import net.minecraft.nbt.NBTTagCompound; -public class ReagentStack -{ +public class ReagentStack { public Reagent reagent; public int amount; - public ReagentStack(Reagent reagent, int amount) - { + public ReagentStack(Reagent reagent, int amount) { this.reagent = reagent; this.amount = amount; } - public ReagentStack(ReagentStack reagentStack, int amount) - { + public ReagentStack(ReagentStack reagentStack, int amount) { this(reagentStack.reagent, amount); } - public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag) - { + public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag) { Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent")); - if (reagent == null) - { + if (reagent == null) { return null; } @@ -33,16 +28,14 @@ public class ReagentStack return stack; } - public NBTTagCompound writeToNBT(NBTTagCompound tag) - { + public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent)); tag.setInteger("amount", this.amount); return tag; } - public ReagentStack splitStack(int amount) - { + public ReagentStack splitStack(int amount) { ReagentStack copyStack = this.copy(); int splitAmount = Math.min(amount, this.amount); copyStack.amount = splitAmount; @@ -51,13 +44,11 @@ public class ReagentStack return copyStack; } - public ReagentStack copy() - { + public ReagentStack copy() { return new ReagentStack(this.reagent, this.amount); } - public boolean isReagentEqual(ReagentStack other) - { + public boolean isReagentEqual(ReagentStack other) { return other != null && this.reagent == other.reagent; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileReagentHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileReagentHandler.java index 3e754648..da3f296b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileReagentHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileReagentHandler.java @@ -1,66 +1,55 @@ - package WayofTime.alchemicalWizardry.api.alchemy.energy; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TileReagentHandler extends TileEntity implements IReagentHandler -{ +public class TileReagentHandler extends TileEntity implements IReagentHandler { protected ReagentContainer tank = new ReagentContainer(4000); @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); tank.readFromNBT(tag); } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tank.writeToNBT(tag); } /* IReagentHandler */ @Override - public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) - { + public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) { return tank.fill(resource, doFill); } @Override - public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) - { - if (resource == null || !resource.isReagentEqual(tank.getReagent())) - { + public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) { + if (resource == null || !resource.isReagentEqual(tank.getReagent())) { return null; } return tank.drain(resource.amount, doDrain); } @Override - public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { + public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { return tank.drain(maxDrain, doDrain); } @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) - { - return new ReagentContainerInfo[]{tank.getInfo()}; + public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) { + return new ReagentContainerInfo[] {tank.getInfo()}; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileSegmentedReagentHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileSegmentedReagentHandler.java index d1f2427f..ecd11942 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileSegmentedReagentHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileSegmentedReagentHandler.java @@ -1,46 +1,38 @@ - package WayofTime.alchemicalWizardry.api.alchemy.energy; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler -{ +public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler { protected ReagentContainer[] tanks; protected Map attunedTankMap; - public TileSegmentedReagentHandler() - { + public TileSegmentedReagentHandler() { this(1); } - public TileSegmentedReagentHandler(int numberOfTanks) - { + public TileSegmentedReagentHandler(int numberOfTanks) { this(numberOfTanks, 1000); } - public TileSegmentedReagentHandler(int numberOfTanks, int tankSize) - { + public TileSegmentedReagentHandler(int numberOfTanks, int tankSize) { super(); this.attunedTankMap = new HashMap(); this.tanks = new ReagentContainer[numberOfTanks]; - for (int i = 0; i < numberOfTanks; i++) - { + for (int i = 0; i < numberOfTanks; i++) { this.tanks[i] = new ReagentContainer(tankSize); } } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND); @@ -48,16 +40,14 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente 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")); @@ -65,17 +55,14 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); 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); @@ -85,8 +72,7 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente NBTTagList attunedTagList = new NBTTagList(); - for (Entry entry : this.attunedTankMap.entrySet()) - { + for (Entry entry : this.attunedTankMap.entrySet()) { NBTTagCompound savedTag = new NBTTagCompound(); savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey())); savedTag.setInteger("amount", entry.getValue()); @@ -98,64 +84,55 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente /* ISegmentedReagentHandler */ @Override - public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) - { + public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) { int totalFill = 0; 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; } } @@ -164,10 +141,8 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente } @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; } @@ -175,18 +150,14 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente 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; } } @@ -197,13 +168,10 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente /* 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 (stack != null) { return stack; } } @@ -212,49 +180,40 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente } @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; } @@ -263,21 +222,17 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente } @Override - public Map getAttunedTankMap() - { + public Map getAttunedTankMap() { return this.attunedTankMap; } - public boolean areTanksEmpty() - { - for (int i = 0; i < this.tanks.length; i++) - { - if (tanks[i] != null && tanks[i].reagentStack != null) - { + public boolean areTanksEmpty() { + for (int i = 0; i < this.tanks.length; i++) { + if (tanks[i] != null && tanks[i].reagentStack != null) { return false; } } return true; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipe.java b/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipe.java index 7e6af770..cdcf7240 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipe.java @@ -2,16 +2,14 @@ package WayofTime.alchemicalWizardry.api.altarRecipeRegistry; import java.util.ArrayList; import java.util.Set; - import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -public class AltarRecipe -{ +public class AltarRecipe { public int minTier; public int liquidRequired; - public boolean canBeFilled; //Tells the system that the item is an orb + public boolean canBeFilled; // Tells the system that the item is an orb public int consumptionRate; public int drainRate; public ItemStack requiredItem; @@ -19,14 +17,27 @@ public class AltarRecipe public boolean useTag; public ArrayList input = new ArrayList(); - public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) - { + public AltarRecipe( + ItemStack result, + ItemStack requiredItem, + int minTier, + int liquidRequired, + int consumptionRate, + int drainRate, + boolean canBeFilled) { this(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, false); } - - public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled, boolean useTag) - { - this.result = result; + + public AltarRecipe( + ItemStack result, + ItemStack requiredItem, + int minTier, + int liquidRequired, + int consumptionRate, + int drainRate, + boolean canBeFilled, + boolean useTag) { + this.result = result; this.requiredItem = requiredItem; this.minTier = minTier; this.liquidRequired = liquidRequired; @@ -36,101 +47,83 @@ public class AltarRecipe this.useTag = useTag; } - public ItemStack getResult() - { + public ItemStack getResult() { return this.result; } - public ItemStack getRequiredItem() - { + public ItemStack getRequiredItem() { return this.requiredItem; } - public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck) - { - if (comparedStack == null || this.requiredItem == null) - { + public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck) { + if (comparedStack == null || this.requiredItem == null) { return false; } - return tierCheck >= minTier && this.requiredItem.isItemEqual(comparedStack) && (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true); - } - - public boolean areRequiredTagsEqual(ItemStack comparedStack) - { - if(requiredItem.hasTagCompound()) - { - NBTTagCompound tag = requiredItem.getTagCompound(); - if(!comparedStack.hasTagCompound()) - { - return false; - } - - NBTTagCompound comparedTag = comparedStack.getTagCompound(); - - return this.areTagsEqual(tag, comparedTag); - } - - return true; - } - - protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag) - { - Set set = tag.func_150296_c(); - - for(Object obj : set) - { - if(obj instanceof String) - { - String str = (String)obj; - - NBTBase baseTag = comparedTag.getTag(str); - - if(baseTag instanceof NBTTagCompound) - { - NBTBase comparedBaseTag = comparedTag.getTag(str); - if(comparedBaseTag instanceof NBTTagCompound) - { - if(!this.areTagsEqual(tag, comparedTag)) - { - return false; - } - } - }else - { - if(baseTag != null && !baseTag.equals(comparedTag.getTag(str))) - { - return false; - } - } - } - } - - return true; + return tierCheck >= minTier + && this.requiredItem.isItemEqual(comparedStack) + && (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true); } - public int getMinTier() - { + public boolean areRequiredTagsEqual(ItemStack comparedStack) { + if (requiredItem.hasTagCompound()) { + NBTTagCompound tag = requiredItem.getTagCompound(); + if (!comparedStack.hasTagCompound()) { + return false; + } + + NBTTagCompound comparedTag = comparedStack.getTagCompound(); + + return this.areTagsEqual(tag, comparedTag); + } + + return true; + } + + protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag) { + Set set = tag.func_150296_c(); + + for (Object obj : set) { + if (obj instanceof String) { + String str = (String) obj; + + NBTBase baseTag = comparedTag.getTag(str); + + if (baseTag instanceof NBTTagCompound) { + NBTBase comparedBaseTag = comparedTag.getTag(str); + if (comparedBaseTag instanceof NBTTagCompound) { + if (!this.areTagsEqual(tag, comparedTag)) { + return false; + } + } + } else { + if (baseTag != null && !baseTag.equals(comparedTag.getTag(str))) { + return false; + } + } + } + } + + return true; + } + + public int getMinTier() { return this.minTier; } - public int getLiquidRequired() - { + public int getLiquidRequired() { return this.liquidRequired; } - public int getConsumptionRate() - { + public int getConsumptionRate() { return this.consumptionRate; } - public int getDrainRate() - { + public int getDrainRate() { return this.drainRate; } - public boolean getCanBeFilled() - { + public boolean getCanBeFilled() { return this.canBeFilled; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java index 68f9666d..ece00b43 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java @@ -4,44 +4,50 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; - import net.minecraft.item.ItemStack; -public class AltarRecipeRegistry -{ +public class AltarRecipeRegistry { public static List altarRecipes = new LinkedList<>(); public static Map orbMap = new HashMap<>(); - public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) - { - altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled)); - } - - public static void registerNBTAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) - { - altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, true)); + public static void registerAltarRecipe( + ItemStack result, + ItemStack requiredItem, + int minTier, + int liquidRequired, + int consumptionRate, + int drainRate, + boolean canBeFilled) { + altarRecipes.add(new AltarRecipe( + result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled)); } - public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate) - { - if(!orbMap.containsKey(minTier)) - { - orbMap.put(minTier, orbStack); - } + public static void registerNBTAltarRecipe( + ItemStack result, + ItemStack requiredItem, + int minTier, + int liquidRequired, + int consumptionRate, + int drainRate, + boolean canBeFilled) { + altarRecipes.add(new AltarRecipe( + result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, true)); + } + + public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate) { + if (!orbMap.containsKey(minTier)) { + orbMap.put(minTier, orbStack); + } registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true); } - public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar) - { - if(testItem == null) - { - return false; - } - - for (AltarRecipe recipe : altarRecipes) - { - if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) - { + public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar) { + if (testItem == null) { + return false; + } + + for (AltarRecipe recipe : altarRecipes) { + if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) { return true; } } @@ -49,12 +55,9 @@ public class AltarRecipeRegistry return false; } - public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar) - { - for (AltarRecipe recipe : altarRecipes) - { - if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) - { + public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar) { + for (AltarRecipe recipe : altarRecipes) { + if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) { return ItemStack.copyItemStack(recipe.getResult()); } } @@ -62,12 +65,9 @@ public class AltarRecipeRegistry return null; } - public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar) - { - for (AltarRecipe recipe : altarRecipes) - { - if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) - { + public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar) { + for (AltarRecipe recipe : altarRecipes) { + if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) { return recipe; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java b/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java index 39d71675..f0826e7d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.api.altarRecipeRegistry; -public interface IFadedRune -{ - int getAltarTierLimit(int meta); +public interface IFadedRune { + int getAltarTierLimit(int meta); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRecipe.java b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRecipe.java index 8d2da96d..6ba10ab4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRecipe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRecipe.java @@ -2,29 +2,24 @@ package WayofTime.alchemicalWizardry.api.bindingRegistry; import net.minecraft.item.ItemStack; -public class BindingRecipe -{ +public class BindingRecipe { public ItemStack requiredItem; public ItemStack outputItem; - public BindingRecipe(ItemStack outputItem, ItemStack requiredItem) - { + public BindingRecipe(ItemStack outputItem, ItemStack requiredItem) { this.requiredItem = requiredItem; this.outputItem = outputItem; } - public boolean doesRequiredItemMatch(ItemStack testStack) - { + public boolean doesRequiredItemMatch(ItemStack testStack) { return !(testStack == null || this.requiredItem == null) && this.requiredItem.isItemEqual(testStack); } - public ItemStack getResult(ItemStack inputItem) - { + public ItemStack getResult(ItemStack inputItem) { return this.getResult(); } - public ItemStack getResult() - { + public ItemStack getResult() { return this.outputItem; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRegistry.java index ba069118..330079ab 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRegistry.java @@ -1,25 +1,19 @@ package WayofTime.alchemicalWizardry.api.bindingRegistry; -import net.minecraft.item.ItemStack; - import java.util.LinkedList; import java.util.List; +import net.minecraft.item.ItemStack; -public class BindingRegistry -{ +public class BindingRegistry { public static List bindingRecipes = new LinkedList(); - public static void registerRecipe(ItemStack output, ItemStack input) - { + public static void registerRecipe(ItemStack output, ItemStack input) { bindingRecipes.add(new BindingRecipe(output, input)); } - public static boolean isRequiredItemValid(ItemStack testItem) - { - for (BindingRecipe recipe : bindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { + public static boolean isRequiredItemValid(ItemStack testItem) { + for (BindingRecipe recipe : bindingRecipes) { + if (recipe.doesRequiredItemMatch(testItem)) { return true; } } @@ -27,12 +21,9 @@ public class BindingRegistry return false; } - public static ItemStack getItemForItemAndTier(ItemStack testItem) - { - for (BindingRecipe recipe : bindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { + public static ItemStack getItemForItemAndTier(ItemStack testItem) { + for (BindingRecipe recipe : bindingRecipes) { + if (recipe.doesRequiredItemMatch(testItem)) { return recipe.getResult(testItem).copy(); } } @@ -40,13 +31,10 @@ public class BindingRegistry return null; } - public static int getIndexForItem(ItemStack testItem) - { + public static int getIndexForItem(ItemStack testItem) { int i = 0; - for (BindingRecipe recipe : bindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { + for (BindingRecipe recipe : bindingRecipes) { + if (recipe.doesRequiredItemMatch(testItem)) { return i; } i++; @@ -55,10 +43,8 @@ public class BindingRegistry return -1; } - public static ItemStack getOutputForIndex(int index) - { - if (bindingRecipes.size() <= index) - { + public static ItemStack getOutputForIndex(int index) { + if (bindingRecipes.size() <= index) { return null; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRecipe.java b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRecipe.java index a9649d50..0d553516 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRecipe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRecipe.java @@ -1,36 +1,30 @@ package WayofTime.alchemicalWizardry.api.bindingRegistry; -import net.minecraft.item.ItemStack; - import java.util.ArrayList; import java.util.List; +import net.minecraft.item.ItemStack; -public class UnbindingRecipe -{ +public class UnbindingRecipe { public ItemStack requiredItem; public List outputItem; - public UnbindingRecipe(ItemStack inputItem, List outputItem) - { + public UnbindingRecipe(ItemStack inputItem, List outputItem) { this.requiredItem = inputItem; this.outputItem = outputItem; } - public UnbindingRecipe(ItemStack inputItem, ItemStack outputItem) - { + public UnbindingRecipe(ItemStack inputItem, ItemStack outputItem) { this.requiredItem = inputItem; List newList = new ArrayList(); newList.add(outputItem); this.outputItem = newList; } - public boolean doesRequiredItemMatch(ItemStack testStack) - { + public boolean doesRequiredItemMatch(ItemStack testStack) { return !(testStack == null || this.requiredItem == null) && this.requiredItem.isItemEqual(testStack); } - public List getResult() - { + public List getResult() { return this.outputItem; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRegistry.java index 62aaff3d..63217772 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/bindingRegistry/UnbindingRegistry.java @@ -1,48 +1,38 @@ package WayofTime.alchemicalWizardry.api.bindingRegistry; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; -public class UnbindingRegistry -{ +public class UnbindingRegistry { public static List unbindingRecipes = new LinkedList(); - public static void addAllUnbindingRecipesFromBinding() - { - for (BindingRecipe bindingRecipe : BindingRegistry.bindingRecipes) - { + public static void addAllUnbindingRecipesFromBinding() { + for (BindingRecipe bindingRecipe : BindingRegistry.bindingRecipes) { List subList = new ArrayList(); subList.add(bindingRecipe.requiredItem); unbindingRecipes.add(new UnbindingRecipe(bindingRecipe.outputItem, subList)); } } - public static void registerRecipe(ItemStack input, List output) - { + public static void registerRecipe(ItemStack input, List output) { unbindingRecipes.add(new UnbindingRecipe(input, output)); } - public static void registerRecipe(Item input, List output) - { + public static void registerRecipe(Item input, List output) { unbindingRecipes.add(new UnbindingRecipe(new ItemStack(input), output)); } - public static void registerRecipe(Block input, List output) - { + public static void registerRecipe(Block input, List output) { unbindingRecipes.add(new UnbindingRecipe(new ItemStack(input), output)); } - public static boolean isRequiredItemValid(ItemStack testItem) - { - for (UnbindingRecipe recipe : unbindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { + public static boolean isRequiredItemValid(ItemStack testItem) { + for (UnbindingRecipe recipe : unbindingRecipes) { + if (recipe.doesRequiredItemMatch(testItem)) { return true; } } @@ -50,13 +40,10 @@ public class UnbindingRegistry return false; } - public static int getIndexForItem(ItemStack testItem) - { + public static int getIndexForItem(ItemStack testItem) { int i = 0; - for (UnbindingRecipe recipe : unbindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { + for (UnbindingRecipe recipe : unbindingRecipes) { + if (recipe.doesRequiredItemMatch(testItem)) { return i; } i++; @@ -65,10 +52,8 @@ public class UnbindingRegistry return -1; } - public static List getOutputForIndex(int index) - { - if (unbindingRecipes.size() <= index) - { + public static List getOutputForIndex(int index) { + if (unbindingRecipes.size() <= index) { return null; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/command/SubCommandBase.java b/src/main/java/WayofTime/alchemicalWizardry/api/command/SubCommandBase.java index c9968cca..793fdcf3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/command/SubCommandBase.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/command/SubCommandBase.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.api.command; +import java.util.Locale; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.command.PlayerNotFoundException; @@ -11,8 +12,6 @@ import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import java.util.Locale; - public abstract class SubCommandBase implements ISubCommand { private ICommand parent; @@ -42,31 +41,37 @@ public abstract class SubCommandBase implements ISubCommand { public void processSubCommand(ICommandSender commandSender, String[] args) { if (args.length == 0 && !getSubCommandName().equals("help")) - displayErrorString(commandSender, String.format(StatCollector.translateToLocal("commands.format.error"), capitalizeFirstLetter(getSubCommandName()), getArgUsage(commandSender))); + displayErrorString( + commandSender, + String.format( + StatCollector.translateToLocal("commands.format.error"), + capitalizeFirstLetter(getSubCommandName()), + getArgUsage(commandSender))); if (isBounded(0, 2, args.length) && args[0].equals("help")) - displayHelpString(commandSender, String.format(StatCollector.translateToLocal("commands.format.help"), capitalizeFirstLetter(getSubCommandName()), getHelpText())); + displayHelpString( + commandSender, + String.format( + StatCollector.translateToLocal("commands.format.help"), + capitalizeFirstLetter(getSubCommandName()), + getHelpText())); } protected EntityPlayerMP getCommandSenderAsPlayer(ICommandSender commandSender) { - if (commandSender instanceof EntityPlayerMP) - return (EntityPlayerMP)commandSender; - else - throw new PlayerNotFoundException(StatCollector.translateToLocal("commands.error.arg.player.missing")); + if (commandSender instanceof EntityPlayerMP) return (EntityPlayerMP) commandSender; + else throw new PlayerNotFoundException(StatCollector.translateToLocal("commands.error.arg.player.missing")); } protected EntityPlayerMP getPlayer(ICommandSender commandSender, String playerName) { EntityPlayerMP entityplayermp = PlayerSelector.matchOnePlayer(commandSender, playerName); - if (entityplayermp != null) - return entityplayermp; + if (entityplayermp != null) return entityplayermp; else { - entityplayermp = MinecraftServer.getServer().getConfigurationManager().func_152612_a(playerName); + entityplayermp = + MinecraftServer.getServer().getConfigurationManager().func_152612_a(playerName); - if (entityplayermp == null) - throw new PlayerNotFoundException(); - else - return entityplayermp; + if (entityplayermp == null) throw new PlayerNotFoundException(); + else return entityplayermp; } } @@ -78,15 +83,18 @@ public abstract class SubCommandBase implements ISubCommand { return given > low && given < high; } - protected void displayHelpString(ICommandSender commandSender, String display, Object ... info) { - commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN))); + protected void displayHelpString(ICommandSender commandSender, String display, Object... info) { + commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)) + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN))); } - protected void displayErrorString(ICommandSender commandSender, String display, Object ... info) { - commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + protected void displayErrorString(ICommandSender commandSender, String display, Object... info) { + commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)) + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); } - protected void displaySuccessString(ICommandSender commandSender, String display, Object ... info) { - commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE))); + protected void displaySuccessString(ICommandSender commandSender, String display, Object... info) { + commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(display, info)) + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE))); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java index a05c7003..863accd7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java @@ -3,12 +3,11 @@ package WayofTime.alchemicalWizardry.api.compress; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public abstract class CompressionHandler -{ - /** - * Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not. - * @param inv The inventory iterated through - * @return The result of the compression - */ - public abstract ItemStack compressInventory(ItemStack[] inv, World world); +public abstract class CompressionHandler { + /** + * Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not. + * @param inv The inventory iterated through + * @return The result of the compression + */ + public abstract ItemStack compressInventory(ItemStack[] inv, World world); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java index 689b022a..8a438a3c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java @@ -5,7 +5,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; - import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -13,55 +12,48 @@ import net.minecraft.world.World; * A registry aimed to help compress items in an inventory into its compressible form. * */ -public class CompressionRegistry -{ - public static List compressionRegistry = new ArrayList(); - public static Map thresholdMap = new HashMap(); - - public static void registerHandler(CompressionHandler handler) - { - compressionRegistry.add(handler); - } - - /** - * Registers an item so that it only compresses while above this threshold - * @param stack - * @param threshold - */ - public static void registerItemThreshold(ItemStack stack, int threshold) - { - thresholdMap.put(stack, threshold); - } - - public static ItemStack compressInventory(ItemStack[] inv, World world) - { - for(CompressionHandler handler : compressionRegistry) - { - ItemStack stack = handler.compressInventory(inv, world); - if(stack != null) - { - return stack; - } - } - - return null; - } - - public static int getItemThreshold(ItemStack stack) - { - for(Entry entry : thresholdMap.entrySet()) - { - if(areItemStacksEqual(entry.getKey(), stack)) - { - return entry.getValue(); - } - } - - return 0; - } - - public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) - { - return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound())); +public class CompressionRegistry { + public static List compressionRegistry = new ArrayList(); + public static Map thresholdMap = new HashMap(); + + public static void registerHandler(CompressionHandler handler) { + compressionRegistry.add(handler); + } + + /** + * Registers an item so that it only compresses while above this threshold + * @param stack + * @param threshold + */ + public static void registerItemThreshold(ItemStack stack, int threshold) { + thresholdMap.put(stack, threshold); + } + + public static ItemStack compressInventory(ItemStack[] inv, World world) { + for (CompressionHandler handler : compressionRegistry) { + ItemStack stack = handler.compressInventory(inv, world); + if (stack != null) { + return stack; + } + } + + return null; + } + + public static int getItemThreshold(ItemStack stack) { + for (Entry entry : thresholdMap.entrySet()) { + if (areItemStacksEqual(entry.getKey(), stack)) { + return entry.getValue(); + } + } + + return 0; + } + + public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) { + return stack.isItemEqual(compressedStack) + && (stack.getTagCompound() == null + ? compressedStack.getTagCompound() == null + : stack.getTagCompound().equals(compressedStack.getTagCompound())); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/AddToNetworkEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/AddToNetworkEvent.java index ddcc3b01..d483cfe9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/AddToNetworkEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/AddToNetworkEvent.java @@ -4,35 +4,31 @@ import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; @Cancelable -public class AddToNetworkEvent extends Event -{ - public String ownerNetwork; - public int addedAmount; - public int maximum; - - /** - * This event is called whenever the network is added to. If cancelled, no LP will be drained from the source. If result is set to Result.DENY, - * the LP will still be drained but the soul network will not be added to. - * - * @param ownerNetwork Key used for the soul network - * @param addedAmount Amount added - * @param maximum Ceiling that the network can add to - */ - public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum) - { - super(); - this.ownerNetwork = ownerNetwork; - this.addedAmount = addedAmount; - this.maximum = maximum; - } - - public String getOwnerNetwork() - { - return this.ownerNetwork; - } - - public int getAddedAmount() - { - return this.addedAmount; - } +public class AddToNetworkEvent extends Event { + public String ownerNetwork; + public int addedAmount; + public int maximum; + + /** + * This event is called whenever the network is added to. If cancelled, no LP will be drained from the source. If result is set to Result.DENY, + * the LP will still be drained but the soul network will not be added to. + * + * @param ownerNetwork Key used for the soul network + * @param addedAmount Amount added + * @param maximum Ceiling that the network can add to + */ + public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum) { + super(); + this.ownerNetwork = ownerNetwork; + this.addedAmount = addedAmount; + this.maximum = maximum; + } + + public String getOwnerNetwork() { + return this.ownerNetwork; + } + + public int getAddedAmount() { + return this.addedAmount; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java index 95e15da4..ad12fe20 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java @@ -1,22 +1,20 @@ package WayofTime.alchemicalWizardry.api.event; import cpw.mods.fml.common.eventhandler.Cancelable; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Event; @Cancelable -public class ItemBindEvent extends Event -{ - public final EntityPlayer player; - public String key; - public ItemStack itemStack; - - public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack) - { - super(); - this.player = player; - this.key = key; - this.itemStack = itemStack; - } +public class ItemBindEvent extends Event { + public final EntityPlayer player; + public String key; + public ItemStack itemStack; + + public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack) { + super(); + this.player = player; + this.key = key; + this.itemStack = itemStack; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java index 5a81c1d2..54b8c0d6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java @@ -1,15 +1,14 @@ package WayofTime.alchemicalWizardry.api.event; -import net.minecraft.item.ItemStack; import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraft.item.ItemStack; @Cancelable -public class ItemDrainInContainerEvent extends SoulNetworkEvent -{ - public ItemStack stack; - public ItemDrainInContainerEvent(ItemStack stack, String ownerNetwork, int drainAmount) - { - super(ownerNetwork, drainAmount); - this.stack = stack; - } +public class ItemDrainInContainerEvent extends SoulNetworkEvent { + public ItemStack stack; + + public ItemDrainInContainerEvent(ItemStack stack, String ownerNetwork, int drainAmount) { + super(ownerNetwork, drainAmount); + this.stack = stack; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainNetworkEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainNetworkEvent.java index d75fd7dc..4ae55a00 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainNetworkEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/ItemDrainNetworkEvent.java @@ -1,29 +1,27 @@ package WayofTime.alchemicalWizardry.api.event; +import cpw.mods.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Cancelable; @Cancelable -public class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent -{ - public final ItemStack itemStack; - public boolean shouldDamage; //If true, will damage regardless of if the network had enough inside it - public float damageAmount; //Amount of damage that would incur if the network could not drain properly - - /** - * Set result to deny the action i.e. damage/drain anyways. Cancelling event prevents action without penalties - * - * @param player Player using the item - * @param ownerNetwork Network that the item is tied to - * @param itemStack Item used - * @param drainAmount Original drain amount - change to alter cost - */ - public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount) - { - super(player, ownerNetwork, drainAmount); - this.itemStack = itemStack; - this.shouldDamage = false; - this.damageAmount = (float)(drainAmount) / 100.0f; - } -} \ No newline at end of file +public class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent { + public final ItemStack itemStack; + public boolean shouldDamage; // If true, will damage regardless of if the network had enough inside it + public float damageAmount; // Amount of damage that would incur if the network could not drain properly + + /** + * Set result to deny the action i.e. damage/drain anyways. Cancelling event prevents action without penalties + * + * @param player Player using the item + * @param ownerNetwork Network that the item is tied to + * @param itemStack Item used + * @param drainAmount Original drain amount - change to alter cost + */ + public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount) { + super(player, ownerNetwork, drainAmount); + this.itemStack = itemStack; + this.shouldDamage = false; + this.damageAmount = (float) (drainAmount) / 100.0f; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerAddToNetworkEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerAddToNetworkEvent.java index f7522557..bc8ba425 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerAddToNetworkEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerAddToNetworkEvent.java @@ -1,18 +1,18 @@ package WayofTime.alchemicalWizardry.api.event; +import cpw.mods.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Cancelable; @Cancelable -public class PlayerAddToNetworkEvent extends AddToNetworkEvent -{ - public final EntityPlayer player; - public ItemStack itemStack; - public PlayerAddToNetworkEvent(EntityPlayer player, ItemStack itemStack, String ownerNetwork, int addedAmount, int maximum) - { - super(ownerNetwork, addedAmount, maximum); - this.player = player; - this.itemStack = itemStack; - } +public class PlayerAddToNetworkEvent extends AddToNetworkEvent { + public final EntityPlayer player; + public ItemStack itemStack; + + public PlayerAddToNetworkEvent( + EntityPlayer player, ItemStack itemStack, String ownerNetwork, int addedAmount, int maximum) { + super(ownerNetwork, addedAmount, maximum); + this.player = player; + this.itemStack = itemStack; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerDrainNetworkEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerDrainNetworkEvent.java index dacb26d8..be5c73a3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerDrainNetworkEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/PlayerDrainNetworkEvent.java @@ -1,20 +1,18 @@ package WayofTime.alchemicalWizardry.api.event; -import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraft.entity.player.EntityPlayer; @Cancelable -public class PlayerDrainNetworkEvent extends SoulNetworkEvent -{ - public final EntityPlayer player; //Player that activated the event - public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount) - { - super(ownerNetwork, drainAmount); - this.player = player; - } - - public EntityPlayer getPlayer() - { - return player; - } +public class PlayerDrainNetworkEvent extends SoulNetworkEvent { + public final EntityPlayer player; // Player that activated the event + + public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount) { + super(ownerNetwork, drainAmount); + this.player = player; + } + + public EntityPlayer getPlayer() { + return player; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java index 83c10c05..ebec3aa2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java @@ -1,23 +1,27 @@ package WayofTime.alchemicalWizardry.api.event; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; @Cancelable -public class RitualActivatedEvent extends RitualEvent -{ - public final EntityPlayer player; - public final ItemStack crystalStack; - public int crystalTier; - - public RitualActivatedEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, EntityPlayer player, ItemStack activationCrystal, int crystalTier) - { - super(mrs, ownerKey, ritualKey); - - this.player = player; - this.crystalStack = activationCrystal; - this.crystalTier = crystalTier; - } +public class RitualActivatedEvent extends RitualEvent { + public final EntityPlayer player; + public final ItemStack crystalStack; + public int crystalTier; + + public RitualActivatedEvent( + IMasterRitualStone mrs, + String ownerKey, + String ritualKey, + EntityPlayer player, + ItemStack activationCrystal, + int crystalTier) { + super(mrs, ownerKey, ritualKey); + + this.player = player; + this.crystalStack = activationCrystal; + this.crystalTier = crystalTier; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java index fbe1649c..79afb86c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java @@ -3,16 +3,14 @@ package WayofTime.alchemicalWizardry.api.event; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import cpw.mods.fml.common.eventhandler.Event; -public class RitualEvent extends Event -{ - public final IMasterRitualStone mrs; - public String ownerKey; - public final String ritualKey; - - public RitualEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) - { - this.mrs = mrs; - this.ownerKey = ownerKey; - this.ritualKey = ritualKey; - } +public class RitualEvent extends Event { + public final IMasterRitualStone mrs; + public String ownerKey; + public final String ritualKey; + + public RitualEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) { + this.mrs = mrs; + this.ownerKey = ownerKey; + this.ritualKey = ritualKey; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualRunEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualRunEvent.java index 4bcf075f..2038d867 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualRunEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualRunEvent.java @@ -4,13 +4,9 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import cpw.mods.fml.common.eventhandler.Cancelable; @Cancelable -public class RitualRunEvent extends RitualEvent -{ - - - public RitualRunEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) - { - super(mrs, ownerKey, ritualKey); - } +public class RitualRunEvent extends RitualEvent { + public RitualRunEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) { + super(mrs, ownerKey, ritualKey); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualStopEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualStopEvent.java index 4fc998f0..fd8456e8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualStopEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/RitualStopEvent.java @@ -3,13 +3,12 @@ package WayofTime.alchemicalWizardry.api.event; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod; -public class RitualStopEvent extends RitualEvent -{ - public final RitualBreakMethod method; - public RitualStopEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, RitualBreakMethod method) - { - super(mrs, ownerKey, ritualKey); - - this.method = method; - } +public class RitualStopEvent extends RitualEvent { + public final RitualBreakMethod method; + + public RitualStopEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, RitualBreakMethod method) { + super(mrs, ownerKey, ritualKey); + + this.method = method; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/SacrificeKnifeUsedEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/SacrificeKnifeUsedEvent.java index 04acf352..45ce2b08 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/SacrificeKnifeUsedEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/SacrificeKnifeUsedEvent.java @@ -1,22 +1,20 @@ package WayofTime.alchemicalWizardry.api.event; -import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.eventhandler.Cancelable; import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.entity.player.EntityPlayer; @Cancelable -public class SacrificeKnifeUsedEvent extends Event -{ - public final EntityPlayer player; - public boolean shouldDrainHealth; - public boolean shouldFillAltar; - public final int healthDrained; - - public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp) - { - this.player = player; - this.shouldDrainHealth = shouldDrainHealth; - this.shouldFillAltar = shouldFillAltar; - this.healthDrained = hp; - } +public class SacrificeKnifeUsedEvent extends Event { + public final EntityPlayer player; + public boolean shouldDrainHealth; + public boolean shouldFillAltar; + public final int healthDrained; + + public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp) { + this.player = player; + this.shouldDrainHealth = shouldDrainHealth; + this.shouldFillAltar = shouldFillAltar; + this.healthDrained = hp; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/SoulNetworkEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/SoulNetworkEvent.java index bf47a136..3afc9dde 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/SoulNetworkEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/SoulNetworkEvent.java @@ -2,25 +2,21 @@ package WayofTime.alchemicalWizardry.api.event; import cpw.mods.fml.common.eventhandler.Event; -public class SoulNetworkEvent extends Event -{ - public String ownerNetwork; - public int drainAmount; - - public SoulNetworkEvent(String ownerNetwork, int drainAmount) - { - super(); - this.ownerNetwork = ownerNetwork; - this.drainAmount = drainAmount; - } - - public String getOwnerNetwork() - { - return this.ownerNetwork; - } - - public int getDrainAmount() - { - return this.drainAmount; - } +public class SoulNetworkEvent extends Event { + public String ownerNetwork; + public int drainAmount; + + public SoulNetworkEvent(String ownerNetwork, int drainAmount) { + super(); + this.ownerNetwork = ownerNetwork; + this.drainAmount = drainAmount; + } + + public String getOwnerNetwork() { + return this.ownerNetwork; + } + + public int getDrainAmount() { + return this.drainAmount; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java b/src/main/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java index 40c3170e..289a699f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java @@ -1,56 +1,56 @@ package WayofTime.alchemicalWizardry.api.event; +import cpw.mods.fml.common.eventhandler.Cancelable; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; /** Fired when a teleposer attempts to transpose two blocks. Use this to perform special cleanup or compensation, -or cancel it entirely to prevent the transposition. */ + * or cancel it entirely to prevent the transposition. */ @Cancelable public class TeleposeEvent extends Event { - - public final World initialWorld; - public final int initialX; - public final int initialY; - public final int initialZ; - - public final Block initialBlock; - public final int initialMetadata; - - public final World finalWorld; - public final int finalX; - public final int finalY; - public final int finalZ; - - public final Block finalBlock; - public final int finalMetadata; - - public TeleposeEvent(World wi, int xi, int yi, int zi, Block bi, int mi, World wf, int xf, int yf, int zf, Block bf, int mf) { - initialWorld = wi; - initialX = xi; - initialY = yi; - initialZ = zi; - - initialBlock = bi; - initialMetadata = mi; - - finalWorld = wf; - finalX = xf; - finalY = yf; - finalZ = zf; - - finalBlock = bf; - finalMetadata = mf; - } - - public TileEntity getInitialTile() { - return initialWorld.getTileEntity(initialX, initialY, initialZ); - } - - public TileEntity getFinalTile() { - return finalWorld.getTileEntity(finalX, finalY, finalZ); - } + public final World initialWorld; + public final int initialX; + public final int initialY; + public final int initialZ; + + public final Block initialBlock; + public final int initialMetadata; + + public final World finalWorld; + public final int finalX; + public final int finalY; + public final int finalZ; + + public final Block finalBlock; + public final int finalMetadata; + + public TeleposeEvent( + World wi, int xi, int yi, int zi, Block bi, int mi, World wf, int xf, int yf, int zf, Block bf, int mf) { + initialWorld = wi; + initialX = xi; + initialY = yi; + initialZ = zi; + + initialBlock = bi; + initialMetadata = mi; + + finalWorld = wf; + finalX = xf; + finalY = yf; + finalZ = zf; + + finalBlock = bf; + finalMetadata = mf; + } + + public TileEntity getInitialTile() { + return initialWorld.getTileEntity(initialX, initialY, initialZ); + } + + public TileEntity getFinalTile() { + return finalWorld.getTileEntity(finalX, finalY, finalZ); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/guide/OrbRecipeRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/api/guide/OrbRecipeRenderer.java index e4926e1e..58682e0a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/guide/OrbRecipeRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/guide/OrbRecipeRenderer.java @@ -1,14 +1,5 @@ package WayofTime.alchemicalWizardry.api.guide; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe; import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe; import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; @@ -20,41 +11,59 @@ import amerifrance.guideapi.api.base.Book; import amerifrance.guideapi.api.util.GuiHelper; import amerifrance.guideapi.gui.GuiBase; import cpw.mods.fml.relauncher.ReflectionHelper; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; -public class OrbRecipeRenderer implements IRecipeRenderer -{ - public IRecipe recipe; - - public OrbRecipeRenderer(IRecipe recipe) - { - this.recipe = recipe; - } - - @Override - public void draw(Book book, CategoryAbstract category, EntryAbstract entry, - int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, - FontRenderer fontRenderer) { - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(ModInformation.GUITEXLOC + "recipe_elements.png")); +public class OrbRecipeRenderer implements IRecipeRenderer { + public IRecipe recipe; + + public OrbRecipeRenderer(IRecipe recipe) { + this.recipe = recipe; + } + + @Override + public void draw( + Book book, + CategoryAbstract category, + EntryAbstract entry, + int guiLeft, + int guiTop, + int mouseX, + int mouseY, + GuiBase guiBase, + FontRenderer fontRenderer) { + Minecraft.getMinecraft() + .getTextureManager() + .bindTexture(new ResourceLocation(ModInformation.GUITEXLOC + "recipe_elements.png")); guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 0, 105, 65); - guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.shapedOrb"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0); - if(recipe instanceof ShapelessBloodOrbRecipe) - { - ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe; - List list = shapelessBloodOrbRecipe.getInput(); - + guiBase.drawCenteredString( + fontRenderer, + StatCollector.translateToLocal("text.recipe.shapedOrb"), + guiLeft + guiBase.xSize / 2, + guiTop + 12, + 0); + if (recipe instanceof ShapelessBloodOrbRecipe) { + ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe; + List list = shapelessBloodOrbRecipe.getInput(); + int width = 3; int height = 3; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - if(list.size() - 1 < y * width + x) - { - continue; + if (list.size() - 1 < y * width + x) { + continue; } - + int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7); int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5); - + Object component = list.get(y * width + x); if (component != null) { if (component instanceof ItemStack) { @@ -65,7 +74,8 @@ public class OrbRecipeRenderer implements IRecipeRenderer } else if (component instanceof Integer) { GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY); if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) { - guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY); + guiBase.renderToolTip( + APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY); } } else { if (((ArrayList) component).isEmpty()) return; @@ -83,8 +93,7 @@ public class OrbRecipeRenderer implements IRecipeRenderer if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) { guiBase.renderToolTip(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY); } - }else - { + } else { ShapedBloodOrbRecipe shapedBloodOrbRecipe = (ShapedBloodOrbRecipe) recipe; int width = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 4); int height = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 5); @@ -102,7 +111,8 @@ public class OrbRecipeRenderer implements IRecipeRenderer } else if (component instanceof Integer) { GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY); if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) { - guiBase.renderToolTip(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY); + guiBase.renderToolTip( + APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY); } } else { if (((ArrayList) component).isEmpty()) return; @@ -121,15 +131,20 @@ public class OrbRecipeRenderer implements IRecipeRenderer guiBase.renderToolTip(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY); } } - - } + } - @Override - public void drawExtras(Book book, CategoryAbstract category, - EntryAbstract entry, int guiLeft, int guiTop, int mouseX, - int mouseY, GuiBase guiBase, FontRenderer fontRenderer) { - // TODO Auto-generated method stub - - } + @Override + public void drawExtras( + Book book, + CategoryAbstract category, + EntryAbstract entry, + int guiLeft, + int guiTop, + int mouseX, + int mouseY, + GuiBase guiBase, + FontRenderer fontRenderer) { + // TODO Auto-generated method stub + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageAltarRecipe.java b/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageAltarRecipe.java index cbad2be3..919b7da9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageAltarRecipe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageAltarRecipe.java @@ -1,13 +1,5 @@ package WayofTime.alchemicalWizardry.api.guide; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; import amerifrance.guideapi.api.abstraction.CategoryAbstract; import amerifrance.guideapi.api.abstraction.EntryAbstract; @@ -17,6 +9,13 @@ import amerifrance.guideapi.api.util.GuiHelper; import amerifrance.guideapi.gui.GuiBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; public class PageAltarRecipe extends PageBase { @@ -34,15 +33,31 @@ public class PageAltarRecipe extends PageBase { @Override @SideOnly(Side.CLIENT) - public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer) { + public void draw( + Book book, + CategoryAbstract category, + EntryAbstract entry, + int guiLeft, + int guiTop, + int mouseX, + int mouseY, + GuiBase guiBase, + FontRenderer fontRenderer) { - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("alchemicalwizardry" + ":textures/gui/guide/altar.png")); + Minecraft.getMinecraft() + .getTextureManager() + .bindTexture(new ResourceLocation("alchemicalwizardry" + ":textures/gui/guide/altar.png")); guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 87, 146, 104); - guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.recipe.altar"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0); + guiBase.drawCenteredString( + fontRenderer, + StatCollector.translateToLocal("text.recipe.altar"), + guiLeft + guiBase.xSize / 2, + guiTop + 12, + 0); int inputX = (1 + 1) * 20 + (guiLeft + guiBase.xSize / 7) + 1; - int inputY = (20) + (guiTop + guiBase.ySize / 5) - 1; //1 * 20 + int inputY = (20) + (guiTop + guiBase.ySize / 5) - 1; // 1 * 20 GuiHelper.drawItemStack(input, inputX, inputY); if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15)) { guiBase.renderToolTip(input, mouseX, mouseY); @@ -59,11 +74,38 @@ public class PageAltarRecipe extends PageBase { } if (output.getItem() == Item.getItemFromBlock(Blocks.fire)) { - guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("text.furnace.error"), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0xED073D); - guiBase.drawCenteredString(fontRenderer, StatCollector.translateToLocal("bm.string.tier") + ": " + String.valueOf(tier), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0); - guiBase.drawCenteredString(fontRenderer, "LP: " + String.valueOf(bloodRequired), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 30, 0); + guiBase.drawCenteredString( + fontRenderer, + StatCollector.translateToLocal("text.furnace.error"), + guiLeft + guiBase.xSize / 2, + guiTop + 4 * guiBase.ySize / 6, + 0xED073D); + guiBase.drawCenteredString( + fontRenderer, + StatCollector.translateToLocal("bm.string.tier") + ": " + String.valueOf(tier), + guiLeft + guiBase.xSize / 2, + guiTop + 4 * guiBase.ySize / 6 + 15, + 0); + guiBase.drawCenteredString( + fontRenderer, + "LP: " + String.valueOf(bloodRequired), + guiLeft + guiBase.xSize / 2, + guiTop + 4 * guiBase.ySize / 6 + 30, + 0); } - guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.tier"), String.valueOf(tier)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0); - guiBase.drawCenteredString(fontRenderer, String.format(StatCollector.translateToLocal("text.recipe.altar.bloodRequired"), String.valueOf(bloodRequired)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0); + guiBase.drawCenteredString( + fontRenderer, + String.format(StatCollector.translateToLocal("text.recipe.altar.tier"), String.valueOf(tier)), + guiLeft + guiBase.xSize / 2, + guiTop + 4 * guiBase.ySize / 6, + 0); + guiBase.drawCenteredString( + fontRenderer, + String.format( + StatCollector.translateToLocal("text.recipe.altar.bloodRequired"), + String.valueOf(bloodRequired)), + guiLeft + guiBase.xSize / 2, + guiTop + 4 * guiBase.ySize / 6 + 15, + 0); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageMultiBlock.java b/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageMultiBlock.java index 09f510c2..4847ee76 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageMultiBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageMultiBlock.java @@ -1,14 +1,5 @@ package WayofTime.alchemicalWizardry.api.guide; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import amerifrance.guideapi.api.abstraction.CategoryAbstract; import amerifrance.guideapi.api.abstraction.EntryAbstract; import amerifrance.guideapi.api.base.Book; @@ -16,130 +7,131 @@ import amerifrance.guideapi.api.base.PageBase; import amerifrance.guideapi.gui.GuiBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; -public class PageMultiBlock extends PageBase -{ - ItemStack[][][] structure; - boolean canTick = false; - int tick = 0; - int showLayer = -1; - float scaleFactor = 1; - - boolean renderMouseOver = true; - - public PageMultiBlock(ItemStack[][][] structure) - { - this.structure = structure; - initPage(structure); +public class PageMultiBlock extends PageBase { + ItemStack[][][] structure; + boolean canTick = false; + int tick = 0; + int showLayer = -1; + float scaleFactor = 1; + + boolean renderMouseOver = true; + + public PageMultiBlock(ItemStack[][][] structure) { + this.structure = structure; + initPage(structure); + } + + int blockCount = 0; + int[] countPerLevel; + int structureHeight = 0; + int structureLength = 0; + int structureWidth = 0; + + public void initPage(ItemStack[][][] structure) { + structureHeight = structure.length; + structureWidth = 0; + structureLength = 0; + countPerLevel = new int[structureHeight]; + blockCount = 0; + for (int h = 0; h < structure.length; h++) { + if (structure[h].length - 1 > structureLength) structureLength = structure[h].length - 1; + int perLvl = 0; + for (int l = 0; l < structure[h].length; l++) { + if (structure[h][l].length - 1 > structureWidth) structureWidth = structure[h][l].length - 1; + for (ItemStack ss : structure[h][l]) if (ss != null) perLvl++; + } + countPerLevel[h] = perLvl; + blockCount += perLvl; + } + tick = (showLayer == -1 ? blockCount : countPerLevel[showLayer]) * 40; + // int yOff = (structureHeight-1)*12+structureWidth*5+structureLength*5+16; + // pageButtons.add(new GuiButtonManualNavigation(gui, 100, x+4,y+yOff/2-5, 10,10, 4)); + // pageButtons.add(new GuiButtonManualNavigation(gui, 101, x+4,y+yOff/2-8-16, 10,16, 3)); + // pageButtons.add(new GuiButtonManualNavigation(gui, 102, x+4,y+yOff/2+8, 10,16, 2)); } - - int blockCount=0; - int[] countPerLevel; - int structureHeight = 0; - int structureLength = 0; - int structureWidth = 0; - public void initPage(ItemStack[][][] structure) - { - structureHeight = structure.length; - structureWidth=0; - structureLength=0; - countPerLevel = new int[structureHeight]; - blockCount=0; - for(int h=0; hstructureLength) - structureLength = structure[h].length-1; - int perLvl=0; - for(int l=0; lstructureWidth) - structureWidth = structure[h][l].length-1; - for(ItemStack ss : structure[h][l]) - if(ss!=null) - perLvl++; - } - countPerLevel[h] = perLvl; - blockCount += perLvl; - } - tick= (showLayer==-1?blockCount:countPerLevel[showLayer])*40; -// int yOff = (structureHeight-1)*12+structureWidth*5+structureLength*5+16; -// pageButtons.add(new GuiButtonManualNavigation(gui, 100, x+4,y+yOff/2-5, 10,10, 4)); -// pageButtons.add(new GuiButtonManualNavigation(gui, 101, x+4,y+yOff/2-8-16, 10,16, 3)); -// pageButtons.add(new GuiButtonManualNavigation(gui, 102, x+4,y+yOff/2+8, 10,16, 2)); - } - @Override @SideOnly(Side.CLIENT) - public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer) - { -// if(multiblock.getStructureManual()!=null) - Minecraft mc = Minecraft.getMinecraft(); - - int x = guiLeft + 32; - int y = guiTop + 30; - { - if(canTick) - tick++; + public void draw( + Book book, + CategoryAbstract category, + EntryAbstract entry, + int guiLeft, + int guiTop, + int mouseX, + int mouseY, + GuiBase guiBase, + FontRenderer fontRenderer) { + // if(multiblock.getStructureManual()!=null) + Minecraft mc = Minecraft.getMinecraft(); - int prevLayers = 0; - if(showLayer!=-1) - for(int ll=0; ll=0; l--) - { - ItemStack[] row = level[l]; - for(int w=row.length-1; w>=0; w--) - { - int xx = 60 +xHalf -10*w +10*l -7; - int yy = yOffPartial - 5*w - 5*l -12*h; - GL11.glTranslated(0, 0, 1); - if(row[w]!=null && i<=limiter) - { - i++; - RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, row[w], x+xx, y+yy); - if(mouseX>=x+xx&&mouseX=y+yy&&mouseY= 0; l--) { + ItemStack[] row = level[l]; + for (int w = row.length - 1; w >= 0; w--) { + int xx = 60 + xHalf - 10 * w + 10 * l - 7; + int yy = yOffPartial - 5 * w - 5 * l - 12 * h; + GL11.glTranslated(0, 0, 1); + if (row[w] != null && i <= limiter) { + i++; + RenderItem.getInstance() + .renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, row[w], x + xx, y + yy); + if (mouseX >= x + xx + && mouseX < x + xx + 16 + && mouseY >= y + yy + && mouseY < y + yy + 16) highlighted = row[w]; + } + } + } + } + GL11.glTranslated(0, 0, -i); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_DEPTH_TEST); + + mc.fontRenderer.setUnicodeFlag(false); + if (highlighted != null && renderMouseOver) guiBase.renderToolTip(highlighted, mouseX, mouseY); + RenderHelper.disableStandardItemLighting(); + + // mc.fontRenderer.setUnicodeFlag(true); + // if(localizedText!=null&&!localizedText.isEmpty()) + // manual.fontRenderer.drawSplitString(localizedText, x,y+yOffTotal, 120, manual.getTextColour()); + } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageRitualMultiBlock.java b/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageRitualMultiBlock.java index 2de3bf4c..5da5945c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageRitualMultiBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/guide/PageRitualMultiBlock.java @@ -1,95 +1,89 @@ package WayofTime.alchemicalWizardry.api.guide; -import java.util.List; - -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.Rituals; +import java.util.List; +import net.minecraft.item.ItemStack; -public class PageRitualMultiBlock extends PageMultiBlock -{ - private static ItemStack blankStone; - private static ItemStack waterStone; - private static ItemStack fireStone; - private static ItemStack earthStone; - private static ItemStack airStone; - private static ItemStack duskStone; - private static ItemStack dawnStone; - static - { -// blankStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.BLANK); -// waterStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.WATER); -// fireStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.FIRE); -// earthStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.EARTH); -// airStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.AIR); -// duskStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DUSK); -// dawnStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DAWN); - } - - private PageRitualMultiBlock(ItemStack[][][] structure) - { - super(structure); - } - - public static PageRitualMultiBlock getPageForRitual(String ritualID) - { - return getPageForRitual(Rituals.getRitualList(ritualID)); - } - - public static PageRitualMultiBlock getPageForRitual(List ritualComponents) - { - int minX = 0; - int minY = 0; - int minZ = 0; - - int maxX = 0; - int maxY = 0; - int maxZ = 0; - - for(RitualComponent comp : ritualComponents) - { - minX = Math.min(comp.getX(), minX); - minY = Math.min(comp.getY(), minY); - minZ = Math.min(comp.getZ(), minZ); +public class PageRitualMultiBlock extends PageMultiBlock { + private static ItemStack blankStone; + private static ItemStack waterStone; + private static ItemStack fireStone; + private static ItemStack earthStone; + private static ItemStack airStone; + private static ItemStack duskStone; + private static ItemStack dawnStone; - maxX = Math.max(comp.getX(), maxX); - maxY = Math.max(comp.getY(), maxY); - maxZ = Math.max(comp.getZ(), maxZ); - } - - System.out.println("Min: (" + minX + ", " + minY + ", " + minZ + "), Max: (" + maxX + ", " + maxY + ", " + maxZ + ")"); - - ItemStack[][][] tempStructure = new ItemStack[maxY-minY+1][maxX-minX+1][maxZ-minZ+1]; //First value is vertical, second is down to the left, third is down to the right - - for(RitualComponent comp : ritualComponents) - { - tempStructure[comp.getY() - minY][comp.getX() - minX][comp.getZ() - minZ] = getStackForRitualStone(comp.getStoneType()); - } - -// tempStructure[-minY][-minX][-minZ] = new ItemStack(ModBlocks.blockMasterStone); + static { + // blankStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.BLANK); + // waterStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.WATER); + // fireStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.FIRE); + // earthStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.EARTH); + // airStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.AIR); + // duskStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DUSK); + // dawnStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DAWN); + } - return new PageRitualMultiBlock(tempStructure); - } - - private static ItemStack getStackForRitualStone(int type) - { - switch(type) - { - case RitualComponent.BLANK: - return blankStone; - case RitualComponent.WATER: - return waterStone; - case RitualComponent.FIRE: - return fireStone; - case RitualComponent.EARTH: - return earthStone; - case RitualComponent.AIR: - return airStone; - case RitualComponent.DUSK: - return duskStone; - case RitualComponent.DAWN: - return dawnStone; - } - return blankStone; - } + private PageRitualMultiBlock(ItemStack[][][] structure) { + super(structure); + } + + public static PageRitualMultiBlock getPageForRitual(String ritualID) { + return getPageForRitual(Rituals.getRitualList(ritualID)); + } + + public static PageRitualMultiBlock getPageForRitual(List ritualComponents) { + int minX = 0; + int minY = 0; + int minZ = 0; + + int maxX = 0; + int maxY = 0; + int maxZ = 0; + + for (RitualComponent comp : ritualComponents) { + minX = Math.min(comp.getX(), minX); + minY = Math.min(comp.getY(), minY); + minZ = Math.min(comp.getZ(), minZ); + + maxX = Math.max(comp.getX(), maxX); + maxY = Math.max(comp.getY(), maxY); + maxZ = Math.max(comp.getZ(), maxZ); + } + + System.out.println( + "Min: (" + minX + ", " + minY + ", " + minZ + "), Max: (" + maxX + ", " + maxY + ", " + maxZ + ")"); + + ItemStack[][][] tempStructure = new ItemStack[maxY - minY + 1][maxX - minX + 1] + [maxZ - minZ + 1]; // First value is vertical, second is down to the left, third is down to the right + + for (RitualComponent comp : ritualComponents) { + tempStructure[comp.getY() - minY][comp.getX() - minX][comp.getZ() - minZ] = + getStackForRitualStone(comp.getStoneType()); + } + + // tempStructure[-minY][-minX][-minZ] = new ItemStack(ModBlocks.blockMasterStone); + + return new PageRitualMultiBlock(tempStructure); + } + + private static ItemStack getStackForRitualStone(int type) { + switch (type) { + case RitualComponent.BLANK: + return blankStone; + case RitualComponent.WATER: + return waterStone; + case RitualComponent.FIRE: + return fireStone; + case RitualComponent.EARTH: + return earthStone; + case RitualComponent.AIR: + return airStone; + case RitualComponent.DUSK: + return duskStone; + case RitualComponent.DAWN: + return dawnStone; + } + return blankStone; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java index aac57f57..8a633be7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java @@ -1,29 +1,23 @@ package WayofTime.alchemicalWizardry.api.harvest; -import net.minecraft.block.Block; -import net.minecraft.world.World; - import java.util.ArrayList; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.world.World; -public class HarvestRegistry -{ +public class HarvestRegistry { public static List handlerList = new ArrayList(); - public static void registerHarvestHandler(IHarvestHandler handler) - { + public static void registerHarvestHandler(IHarvestHandler handler) { handlerList.add(handler); } - public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord) - { + public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord) { Block block = world.getBlock(xCoord, yCoord, zCoord); int meta = world.getBlockMetadata(xCoord, yCoord, zCoord); - for (IHarvestHandler handler : handlerList) - { - if (handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta)) - { + for (IHarvestHandler handler : handlerList) { + if (handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta)) { return true; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java index 0d5fb32b..ebdd14ca 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java @@ -3,8 +3,7 @@ package WayofTime.alchemicalWizardry.api.harvest; import net.minecraft.block.Block; import net.minecraft.world.World; -public interface IHarvestHandler -{ +public interface IHarvestHandler { /** * A handler that is used to harvest and replant the block at the specified location * diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/IAltarManipulator.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/IAltarManipulator.java index b84f95cc..ed997a28 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/IAltarManipulator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/IAltarManipulator.java @@ -1,6 +1,3 @@ package WayofTime.alchemicalWizardry.api.items; -public interface IAltarManipulator -{ - -} +public interface IAltarManipulator {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java index 2d7325ca..14c9befe 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java @@ -1,11 +1,14 @@ package WayofTime.alchemicalWizardry.api.items; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.api.spell.SpellEffect; +import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Random; import java.util.Set; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -24,20 +27,14 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.api.spell.SpellEffect; -import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; -public class ItemSpellMultiTool extends Item -{ +public class ItemSpellMultiTool extends Item { private static final String harvestLevelSuffix = "harvestLvl"; private static final String digLevelSuffix = "digLvl"; private static final String tagName = "BloodMagicTool"; private Random rand = new Random(); - public ItemSpellMultiTool() - { + public ItemSpellMultiTool() { super(); this.setMaxDamage(0); this.setMaxStackSize(1); @@ -45,39 +42,37 @@ public class ItemSpellMultiTool extends Item } @Override - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundTool"); } - + @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { float damage = this.getCustomItemAttack(par1ItemStack); - - float f = (float)par3EntityLivingBase.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); - + + float f = (float) par3EntityLivingBase + .getEntityAttribute(SharedMonsterAttributes.attackDamage) + .getAttributeValue(); + SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack); - if (parad != null) - { + if (parad != null) { parad.onLeftClickEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase); } damage += parad.getAddedDamageForEntity(par2EntityLivingBase); - if (rand.nextFloat() < this.getCritChance(par1ItemStack)) - { + if (rand.nextFloat() < this.getCritChance(par1ItemStack)) { damage *= 1.75f; } damage *= f; - - if (par3EntityLivingBase instanceof EntityPlayer) - { - par2EntityLivingBase.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) par3EntityLivingBase), damage); - } else - { + + if (par3EntityLivingBase instanceof EntityPlayer) { + par2EntityLivingBase.attackEntityFrom( + DamageSource.causePlayerDamage((EntityPlayer) par3EntityLivingBase), damage); + } else { par2EntityLivingBase.attackEntityFrom(DamageSource.causeMobDamage(par3EntityLivingBase), damage); } @@ -85,12 +80,10 @@ public class ItemSpellMultiTool extends Item } @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { SpellParadigmTool parad = this.loadParadigmFromStack(stack); - if (parad != null && entity instanceof EntityLivingBase) - { + if (parad != null && entity instanceof EntityLivingBase) { parad.onLeftClickEntity(stack, (EntityLivingBase) entity, player); } @@ -98,21 +91,17 @@ public class ItemSpellMultiTool extends Item } @Override - public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) - { - if (player.worldObj.isRemote) - { + public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { + if (player.worldObj.isRemote) { return false; } - if (!stack.hasTagCompound()) - return false; + if (!stack.hasTagCompound()) return false; World world = player.worldObj; Block block = player.worldObj.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); - if (block == null || block == Blocks.air) - return false; + if (block == null || block == Blocks.air) return false; int hlvl = -1; float blockHardness = block.getBlockHardness(world, x, y, z); @@ -121,54 +110,51 @@ public class ItemSpellMultiTool extends Item Block localBlock = world.getBlock(x, y, z); int localMeta = world.getBlockMetadata(x, y, z); String toolClass = block.getHarvestTool(meta); - if (toolClass != null && this.getHarvestLevel(stack, toolClass) != -1) - hlvl = block.getHarvestLevel(meta); + if (toolClass != null && this.getHarvestLevel(stack, toolClass) != -1) hlvl = block.getHarvestLevel(meta); int toolLevel = this.getHarvestLevel(stack, toolClass); float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z); - if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness) - { + if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness) { boolean cancelHarvest = false; - if (!cancelHarvest) - { - if (localBlock != null && !(localHardness < 0)) - { + if (!cancelHarvest) { + if (localBlock != null && !(localHardness < 0)) { boolean isEffective = false; String localToolClass = this.getToolClassForMaterial(localBlock.getMaterial()); - if (localToolClass != null && this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localMeta)) - { + if (localToolClass != null + && this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localMeta)) { isEffective = true; } - - if (localBlock.getMaterial().isToolNotRequired()) - { + if (localBlock.getMaterial().isToolNotRequired()) { isEffective = true; } - if (!player.capabilities.isCreativeMode) - { - if (isEffective) - { - if (localBlock.removedByPlayer(world, player, x, y, z, true)) - { + if (!player.capabilities.isCreativeMode) { + if (isEffective) { + if (localBlock.removedByPlayer(world, player, x, y, z, true)) { localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta); } localBlock.onBlockHarvested(world, x, y, z, localMeta, player); - if (blockHardness > 0f) - onBlockDestroyed(stack, world, localBlock, x, y, z, player); + if (blockHardness > 0f) onBlockDestroyed(stack, world, localBlock, x, y, z, player); - List items = APISpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, this.getSilkTouch(stack), this.getFortuneLevel(stack)); + List items = APISpellHelper.getItemsFromBlock( + world, + localBlock, + x, + y, + z, + localMeta, + this.getSilkTouch(stack), + this.getFortuneLevel(stack)); SpellParadigmTool parad = this.loadParadigmFromStack(stack); List newItems = parad.handleItemList(stack, items); - if (!world.isRemote) - { + if (!world.isRemote) { APISpellHelper.spawnItemListInWorld(newItems, world, x + 0.5f, y + 0.5f, z + 0.5f); } @@ -176,22 +162,29 @@ public class ItemSpellMultiTool extends Item int cost = 0; - cost += parad.digSurroundingArea(stack, world, player, mop, localToolClass, localHardness, toolLevel, this); + cost += parad.digSurroundingArea( + stack, world, player, mop, localToolClass, localHardness, toolLevel, this); - cost += parad.onBreakBlock(stack, world, player, localBlock, localMeta, x, y, z, ForgeDirection.getOrientation(mop.sideHit)); + cost += parad.onBreakBlock( + stack, + world, + player, + localBlock, + localMeta, + x, + y, + z, + ForgeDirection.getOrientation(mop.sideHit)); - if (cost > 0) - { - SoulNetworkHandler.syphonAndDamageFromNetwork(stack, player, cost); + if (cost > 0) { + SoulNetworkHandler.syphonAndDamageFromNetwork(stack, player, cost); } - } else - { + } else { world.setBlockToAir(x, y, z); world.func_147479_m(x, y, z); } - } else - { + } else { world.setBlockToAir(x, y, z); world.func_147479_m(x, y, z); } @@ -199,56 +192,54 @@ public class ItemSpellMultiTool extends Item } } -// if (!world.isRemote) -// world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); + // if (!world.isRemote) + // world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); return true; - } - public Material[] getMaterialsForToolclass(String toolClass) - { - if ("pickaxe".equals(toolClass)) - { - return new Material[]{Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.circuits}; - } else if ("shovel".equals(toolClass)) - { - return new Material[]{Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay}; - } else if ("axe".equals(toolClass)) - { - return new Material[]{Material.wood, Material.vine, Material.circuits, Material.cactus}; + public Material[] getMaterialsForToolclass(String toolClass) { + if ("pickaxe".equals(toolClass)) { + return new Material[] { + Material.rock, + Material.iron, + Material.ice, + Material.glass, + Material.piston, + Material.anvil, + Material.circuits + }; + } else if ("shovel".equals(toolClass)) { + return new Material[] { + Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay + }; + } else if ("axe".equals(toolClass)) { + return new Material[] {Material.wood, Material.vine, Material.circuits, Material.cactus}; } return new Material[0]; } - public String getToolClassForMaterial(Material mat) - { + public String getToolClassForMaterial(Material mat) { String testString = "pickaxe"; Material[] matList = this.getMaterialsForToolclass(testString); - for (int i = 0; i < matList.length; i++) - { - if (matList[i] == mat) - { + for (int i = 0; i < matList.length; i++) { + if (matList[i] == mat) { return testString; } } testString = "shovel"; matList = this.getMaterialsForToolclass(testString); - for (int i = 0; i < matList.length; i++) - { - if (matList[i] == mat) - { + for (int i = 0; i < matList.length; i++) { + if (matList[i] == mat) { return testString; } } testString = "axe"; matList = this.getMaterialsForToolclass(testString); - for (int i = 0; i < matList.length; i++) - { - if (matList[i] == mat) - { + for (int i = 0; i < matList.length; i++) { + if (matList[i] == mat) { return testString; } } @@ -256,22 +247,18 @@ public class ItemSpellMultiTool extends Item return null; } - public Set getToolClasses(ItemStack stack) - { + public Set getToolClasses(ItemStack stack) { Set set = new HashSet(); - if (this.getHarvestLevel(stack, "pickaxe") > -1) - { + if (this.getHarvestLevel(stack, "pickaxe") > -1) { set.add("pickaxe"); } - if (this.getHarvestLevel(stack, "axe") > -1) - { + if (this.getHarvestLevel(stack, "axe") > -1) { set.add("axe"); } - if (this.getHarvestLevel(stack, "shovel") > -1) - { + if (this.getHarvestLevel(stack, "shovel") > -1) { set.add("shovel"); } @@ -279,70 +266,56 @@ public class ItemSpellMultiTool extends Item } @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { + public float getDigSpeed(ItemStack stack, Block block, int meta) { String toolClass = block.getHarvestTool(meta); - if (toolClass == null || toolClass.equals("")) - { - toolClass = getToolClassOfMaterial(block.getMaterial()); - - if(toolClass == "") - { + if (toolClass == null || toolClass.equals("")) { + toolClass = getToolClassOfMaterial(block.getMaterial()); + + if (toolClass == "") { return 1.0f; - } + } } { - if (stack.hasTagCompound()) - { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); return tag.getFloat(digLevelSuffix + toolClass); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); } } return 1.0f; } - - public String getToolClassOfMaterial(Material mat) - { - if(mat == Material.iron || mat == Material.anvil || mat == Material.rock) - { - return "pickaxe"; + + public String getToolClassOfMaterial(Material mat) { + if (mat == Material.iron || mat == Material.anvil || mat == Material.rock) { + return "pickaxe"; } - if(mat == Material.wood || mat == Material.plants || mat == Material.vine) - { - return "axe"; + if (mat == Material.wood || mat == Material.plants || mat == Material.vine) { + return "axe"; } - - if(mat == Material.ground || mat == Material.grass) - { - return "shovel"; + + if (mat == Material.ground || mat == Material.grass) { + return "shovel"; } - - return ""; + + return ""; } @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - if (stack.hasTagCompound()) - { + public int getHarvestLevel(ItemStack stack, String toolClass) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - if (tag.hasKey(harvestLevelSuffix + toolClass)) - { + if (tag.hasKey(harvestLevelSuffix + toolClass)) { return tag.getInteger(harvestLevelSuffix + toolClass); - } else - { + } else { return -1; } - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); } @@ -350,23 +323,19 @@ public class ItemSpellMultiTool extends Item } @Override - public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) - { + public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) { return true; } @Override - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) - { + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return false; } @Override - public void onUpdate(ItemStack toolStack, World world, Entity par3Entity, int par4, boolean par5) - { - if (world.isRemote) - { + public void onUpdate(ItemStack toolStack, World world, Entity par3Entity, int par4, boolean par5) { + if (world.isRemote) { return; } @@ -378,8 +347,7 @@ public class ItemSpellMultiTool extends Item int duration = Math.max(this.getDuration(toolStack, world), 0); - if (duration <= 0 && par3Entity instanceof EntityPlayer) - { + if (duration <= 0 && par3Entity instanceof EntityPlayer) { int banishCost = parad.onBanishTool(toolStack, world, par3Entity, par4, par5); SoulNetworkHandler.syphonAndDamageFromNetwork(toolStack, (EntityPlayer) par3Entity, banishCost); ((EntityPlayer) par3Entity).inventory.mainInventory[par4] = this.getContainedCrystal(toolStack); @@ -387,10 +355,8 @@ public class ItemSpellMultiTool extends Item } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (par3EntityPlayer.isSneaking()) { par3EntityPlayer.setCurrentItemOrArmor(0, this.getContainedCrystal(par1ItemStack)); return par1ItemStack; } @@ -401,36 +367,29 @@ public class ItemSpellMultiTool extends Item int cost = 0; - if (mop != null && mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) - { + if (mop != null && mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) { cost = parad.onRightClickBlock(par1ItemStack, par3EntityPlayer, par2World, mop); - } else - { + } else { cost = parad.onRightClickAir(par1ItemStack, par2World, par3EntityPlayer); } - if (cost > 0) - { - SoulNetworkHandler.syphonAndDamageFromNetwork(par1ItemStack, par3EntityPlayer, cost); + if (cost > 0) { + SoulNetworkHandler.syphonAndDamageFromNetwork(par1ItemStack, par3EntityPlayer, cost); } return par1ItemStack; } @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("A mace filled with ancient alchemy"); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { par3List.add("Current owner: " + par1ItemStack.getTagCompound().getString("ownerName")); } - for (String str : this.getToolListString(par1ItemStack)) - { + for (String str : this.getToolListString(par1ItemStack)) { par3List.add(str); } @@ -442,19 +401,16 @@ public class ItemSpellMultiTool extends Item } } - //--------------Custom methods--------------// + // --------------Custom methods--------------// - public void setHarvestLevel(ItemStack stack, String toolClass, int harvestLevel) - { - if (stack.hasTagCompound()) - { + public void setHarvestLevel(ItemStack stack, String toolClass, int harvestLevel) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); tag.setInteger(harvestLevelSuffix + toolClass, Math.max(-1, harvestLevel)); stack.getTagCompound().setTag(tagName, tag); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); @@ -465,17 +421,14 @@ public class ItemSpellMultiTool extends Item } } - public void setDigSpeed(ItemStack stack, String toolClass, float digSpeed) - { - if (stack.hasTagCompound()) - { + public void setDigSpeed(ItemStack stack, String toolClass, float digSpeed) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); tag.setFloat(digLevelSuffix + toolClass, digSpeed); stack.getTagCompound().setTag(tagName, tag); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); @@ -486,32 +439,26 @@ public class ItemSpellMultiTool extends Item } } - public float getDigSpeed(ItemStack stack, String toolClass) - { - if (stack.hasTagCompound()) - { + public float getDigSpeed(ItemStack stack, String toolClass) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); return tag.getFloat(digLevelSuffix + toolClass); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); return 0.0f; } } - public void setItemAttack(ItemStack stack, float damage) - { - if (stack.hasTagCompound()) - { + public void setItemAttack(ItemStack stack, float damage) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); tag.setFloat("itemAttack", Math.max(damage, 0.0f)); stack.getTagCompound().setTag(tagName, tag); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); @@ -522,40 +469,33 @@ public class ItemSpellMultiTool extends Item } } - public float getCustomItemAttack(ItemStack stack) - { - if (stack.hasTagCompound()) - { + public float getCustomItemAttack(ItemStack stack) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); return tag.getFloat("itemAttack"); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); return 0.0f; } } - public ItemStack getContainedCrystal(ItemStack container) - { - if (container.hasTagCompound()) - { - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName).getCompoundTag("heldItem"); + public ItemStack getContainedCrystal(ItemStack container) { + if (container.hasTagCompound()) { + NBTTagCompound tag = + container.getTagCompound().getCompoundTag(tagName).getCompoundTag("heldItem"); return ItemStack.loadItemStackFromNBT(tag); - } else - { + } else { container.setTagCompound(new NBTTagCompound()); return null; } } - public void setContainedCrystal(ItemStack container, ItemStack crystal) - { - if (container.hasTagCompound()) - { + public void setContainedCrystal(ItemStack container, ItemStack crystal) { + if (container.hasTagCompound()) { NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName); NBTTagCompound tag = compTag.getCompoundTag("heldItem"); @@ -563,8 +503,7 @@ public class ItemSpellMultiTool extends Item compTag.setTag("heldItem", tag); container.getTagCompound().setTag(tagName, compTag); - } else - { + } else { container.setTagCompound(new NBTTagCompound()); NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName); @@ -577,25 +516,20 @@ public class ItemSpellMultiTool extends Item } } - public void setDuration(ItemStack container, World world, int duration) - { - if (world.isRemote) - { + public void setDuration(ItemStack container, World world, int duration) { + if (world.isRemote) { return; - } else - { + } else { World overWorld = DimensionManager.getWorld(0); long worldtime = overWorld.getTotalWorldTime(); - if (container.hasTagCompound()) - { + if (container.hasTagCompound()) { NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); tag.setLong("duration", Math.max(duration + worldtime, worldtime)); container.getTagCompound().setTag(tagName, tag); - } else - { + } else { container.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); @@ -607,23 +541,18 @@ public class ItemSpellMultiTool extends Item } } - public int getDuration(ItemStack container, World world) - { - if (world.isRemote) - { + public int getDuration(ItemStack container, World world) { + if (world.isRemote) { return 0; - } else - { + } else { World overWorld = DimensionManager.getWorld(0); long worldtime = overWorld.getTotalWorldTime(); - if (container.hasTagCompound()) - { + if (container.hasTagCompound()) { NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); return (int) (tag.getLong("duration") - worldtime); - } else - { + } else { container.setTagCompound(new NBTTagCompound()); return 0; @@ -631,10 +560,8 @@ public class ItemSpellMultiTool extends Item } } - public void loadParadigmIntoStack(ItemStack container, List list) - { - if (!container.hasTagCompound()) - { + public void loadParadigmIntoStack(ItemStack container, List list) { + if (!container.hasTagCompound()) { container.setTagCompound(new NBTTagCompound()); } @@ -642,8 +569,7 @@ public class ItemSpellMultiTool extends Item NBTTagList effectList = new NBTTagList(); - for (SpellEffect eff : list) - { + for (SpellEffect eff : list) { effectList.appendTag(eff.getTag()); } @@ -652,10 +578,8 @@ public class ItemSpellMultiTool extends Item container.getTagCompound().setTag(tagName, tagiest); } - public SpellParadigmTool loadParadigmFromStack(ItemStack container) - { - if (!container.hasTagCompound()) - { + public SpellParadigmTool loadParadigmFromStack(ItemStack container) { + if (!container.hasTagCompound()) { container.setTagCompound(new NBTTagCompound()); } NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName); @@ -663,13 +587,11 @@ public class ItemSpellMultiTool extends Item NBTTagList tagList = tagiest.getTagList("Effects", Constants.NBT.TAG_COMPOUND); List spellEffectList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); SpellEffect eff = SpellEffect.getEffectFromTag(tag); - if (eff != null) - { + if (eff != null) { spellEffectList.add(eff); } } @@ -677,17 +599,14 @@ public class ItemSpellMultiTool extends Item return SpellParadigmTool.getParadigmForEffectArray(spellEffectList); } - public void setSilkTouch(ItemStack stack, boolean silkTouch) - { - if (stack.hasTagCompound()) - { + public void setSilkTouch(ItemStack stack, boolean silkTouch) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); tag.setBoolean("silkTouch", silkTouch); stack.getTagCompound().setTag(tagName, tag); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); @@ -698,32 +617,26 @@ public class ItemSpellMultiTool extends Item } } - public boolean getSilkTouch(ItemStack stack) - { - if (stack.hasTagCompound()) - { + public boolean getSilkTouch(ItemStack stack) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); return tag.getBoolean("silkTouch"); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); return false; } } - public void setFortuneLevel(ItemStack stack, int fortune) - { - if (stack.hasTagCompound()) - { + public void setFortuneLevel(ItemStack stack, int fortune) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); tag.setInteger("fortuneLevel", Math.max(fortune, 0)); stack.getTagCompound().setTag(tagName, tag); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); @@ -734,25 +647,20 @@ public class ItemSpellMultiTool extends Item } } - public int getFortuneLevel(ItemStack stack) - { - if (stack.hasTagCompound()) - { + public int getFortuneLevel(ItemStack stack) { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); return tag.getInteger("fortuneLevel"); - } else - { + } else { stack.setTagCompound(new NBTTagCompound()); return 0; } } - public List getToolListString(ItemStack container) - { - if (!container.hasTagCompound()) - { + public List getToolListString(ItemStack container) { + if (!container.hasTagCompound()) { container.setTagCompound(new NBTTagCompound()); } NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName); @@ -760,13 +668,11 @@ public class ItemSpellMultiTool extends Item NBTTagList tagList = tagiest.getTagList("ToolTips", Constants.NBT.TAG_COMPOUND); List toolTipList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); String str = tag.getString("tip"); - if (str != null) - { + if (str != null) { toolTipList.add(str); } } @@ -774,10 +680,8 @@ public class ItemSpellMultiTool extends Item return toolTipList; } - public void setToolListString(ItemStack container, List toolTipString) - { - if (!container.hasTagCompound()) - { + public void setToolListString(ItemStack container, List toolTipString) { + if (!container.hasTagCompound()) { container.setTagCompound(new NBTTagCompound()); } @@ -785,8 +689,7 @@ public class ItemSpellMultiTool extends Item NBTTagList stringList = new NBTTagList(); - for (String str : toolTipString) - { + for (String str : toolTipString) { NBTTagCompound tag = new NBTTagCompound(); tag.setString("tip", str); @@ -798,17 +701,14 @@ public class ItemSpellMultiTool extends Item container.getTagCompound().setTag(tagName, tagiest); } - public void setCritChance(ItemStack container, float chance) - { - if (container.hasTagCompound()) - { + public void setCritChance(ItemStack container, float chance) { + if (container.hasTagCompound()) { NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); tag.setFloat("critChance", Math.max(chance, 0)); container.getTagCompound().setTag(tagName, tag); - } else - { + } else { container.setTagCompound(new NBTTagCompound()); NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); @@ -819,18 +719,15 @@ public class ItemSpellMultiTool extends Item } } - public float getCritChance(ItemStack container) - { - if (container.hasTagCompound()) - { + public float getCritChance(ItemStack container) { + if (container.hasTagCompound()) { NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); return tag.getFloat("critChance"); - } else - { + } else { container.setTagCompound(new NBTTagCompound()); return 0; } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapedBloodOrbRecipe.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapedBloodOrbRecipe.java index 83461f3f..901b2295 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapedBloodOrbRecipe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapedBloodOrbRecipe.java @@ -1,6 +1,11 @@ package WayofTime.alchemicalWizardry.api.items; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -10,17 +15,10 @@ import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - /** * Shaped Blood Orb Recipe Handler by joshie * */ -public class ShapedBloodOrbRecipe implements IRecipe -{ +public class ShapedBloodOrbRecipe implements IRecipe { private static final int MAX_CRAFT_GRID_WIDTH = 3; private static final int MAX_CRAFT_GRID_HEIGHT = 3; @@ -30,50 +28,40 @@ public class ShapedBloodOrbRecipe implements IRecipe public int height = 0; private boolean mirrored = true; - public ShapedBloodOrbRecipe(Block result, Object... recipe) - { + public ShapedBloodOrbRecipe(Block result, Object... recipe) { this(new ItemStack(result), recipe); } - public ShapedBloodOrbRecipe(Item result, Object... recipe) - { + public ShapedBloodOrbRecipe(Item result, Object... recipe) { this(new ItemStack(result), recipe); } - public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) - { + public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) { output = result.copy(); String shape = ""; int idx = 0; - if (recipe[idx] instanceof Boolean) - { + if (recipe[idx] instanceof Boolean) { mirrored = (Boolean) recipe[idx]; - if (recipe[idx + 1] instanceof Object[]) - { + if (recipe[idx + 1] instanceof Object[]) { recipe = (Object[]) recipe[idx + 1]; - } else - { + } else { idx = 1; } } - if (recipe[idx] instanceof String[]) - { + if (recipe[idx] instanceof String[]) { String[] parts = ((String[]) recipe[idx++]); - for (String s : parts) - { + for (String s : parts) { width = s.length(); shape += s; } height = parts.length; - } else - { - while (recipe[idx] instanceof String) - { + } else { + while (recipe[idx] instanceof String) { String s = (String) recipe[idx++]; shape += s; width = s.length(); @@ -81,11 +69,9 @@ public class ShapedBloodOrbRecipe implements IRecipe } } - if (width * height != shape.length()) - { + if (width * height != shape.length()) { String ret = "Invalid shaped ore recipe: "; - for (Object tmp : recipe) - { + for (Object tmp : recipe) { ret += tmp + ", "; } ret += output; @@ -94,33 +80,29 @@ public class ShapedBloodOrbRecipe implements IRecipe HashMap itemMap = new HashMap(); - for (; idx < recipe.length; idx += 2) - { + for (; idx < recipe.length; idx += 2) { Character chr = (Character) recipe[idx]; Object in = recipe[idx + 1]; - if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb)) - { //If the item is an instanceof IBloodOrb then save the level of the orb - if (in instanceof ItemStack) - itemMap.put(chr, ((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel()); + if (in instanceof IBloodOrb + || (in instanceof ItemStack + && ((ItemStack) in).getItem() + instanceof + IBloodOrb)) { // If the item is an instanceof IBloodOrb then save the level of the + // orb + if (in instanceof ItemStack) itemMap.put(chr, ((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel()); else itemMap.put(chr, ((IBloodOrb) in).getOrbLevel()); - } else if (in instanceof ItemStack) - { + } else if (in instanceof ItemStack) { itemMap.put(chr, ((ItemStack) in).copy()); - } else if (in instanceof Item) - { + } else if (in instanceof Item) { itemMap.put(chr, new ItemStack((Item) in)); - } else if (in instanceof Block) - { + } else if (in instanceof Block) { itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE)); - } else if (in instanceof String) - { + } else if (in instanceof String) { itemMap.put(chr, OreDictionary.getOres((String) in)); - } else - { + } else { String ret = "Invalid shaped ore recipe: "; - for (Object tmp : recipe) - { + for (Object tmp : recipe) { ret += tmp + ", "; } ret += output; @@ -130,33 +112,27 @@ public class ShapedBloodOrbRecipe implements IRecipe input = new Object[width * height]; int x = 0; - for (char chr : shape.toCharArray()) - { + for (char chr : shape.toCharArray()) { input[x++] = itemMap.get(chr); } } - ShapedBloodOrbRecipe(ShapedRecipes recipe, Map replacements) - { + ShapedBloodOrbRecipe(ShapedRecipes recipe, Map replacements) { output = recipe.getRecipeOutput(); width = recipe.recipeWidth; height = recipe.recipeHeight; input = new Object[recipe.recipeItems.length]; - for (int i = 0; i < input.length; i++) - { + for (int i = 0; i < input.length; i++) { ItemStack ingred = recipe.recipeItems[i]; - if (ingred == null) - continue; + if (ingred == null) continue; input[i] = recipe.recipeItems[i]; - for (Entry replace : replacements.entrySet()) - { - if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) - { + for (Entry replace : replacements.entrySet()) { + if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) { input[i] = OreDictionary.getOres(replace.getValue()); break; } @@ -165,37 +141,29 @@ public class ShapedBloodOrbRecipe implements IRecipe } @Override - public ItemStack getCraftingResult(InventoryCrafting var1) - { + public ItemStack getCraftingResult(InventoryCrafting var1) { return output.copy(); } @Override - public int getRecipeSize() - { + public int getRecipeSize() { return input.length; } @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return output; } @Override - public boolean matches(InventoryCrafting inv, World world) - { - for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) - { - for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) - { - if (checkMatch(inv, x, y, false)) - { + public boolean matches(InventoryCrafting inv, World world) { + for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) { + for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) { + if (checkMatch(inv, x, y, false)) { return true; } - if (mirrored && checkMatch(inv, x, y, true)) - { + if (mirrored && checkMatch(inv, x, y, true)) { return true; } } @@ -205,61 +173,46 @@ public class ShapedBloodOrbRecipe implements IRecipe } @SuppressWarnings("unchecked") - private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) - { - for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) - { - for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) - { + private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) { + for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) { + for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) { int subX = x - startX; int subY = y - startY; Object target = null; - if (subX >= 0 && subY >= 0 && subX < width && subY < height) - { - if (mirror) - { + if (subX >= 0 && subY >= 0 && subX < width && subY < height) { + if (mirror) { target = input[width - subX - 1 + subY * width]; - } else - { + } else { target = input[subX + subY * width]; } } ItemStack slot = inv.getStackInRowAndColumn(x, y); - //If target is integer, then we should be check the blood orb value of the item instead - if (target instanceof Integer) - { - if (slot != null && slot.getItem() instanceof IBloodOrb) - { + // If target is integer, then we should be check the blood orb value of the item instead + if (target instanceof Integer) { + if (slot != null && slot.getItem() instanceof IBloodOrb) { IBloodOrb orb = (IBloodOrb) slot.getItem(); - if (orb.getOrbLevel() < (Integer) target) - { + if (orb.getOrbLevel() < (Integer) target) { return false; } } else return false; - } else if (target instanceof ItemStack) - { - if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) - { + } else if (target instanceof ItemStack) { + if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) { return false; } - } else if (target instanceof ArrayList) - { + } else if (target instanceof ArrayList) { boolean matched = false; Iterator itr = ((ArrayList) target).iterator(); - while (itr.hasNext() && !matched) - { + while (itr.hasNext() && !matched) { matched = OreDictionary.itemMatches(itr.next(), slot, false); } - if (!matched) - { + if (!matched) { return false; } - } else if (target == null && slot != null) - { + } else if (target == null && slot != null) { return false; } } @@ -268,14 +221,12 @@ public class ShapedBloodOrbRecipe implements IRecipe return true; } - public ShapedBloodOrbRecipe setMirrored(boolean mirror) - { + public ShapedBloodOrbRecipe setMirrored(boolean mirror) { mirrored = mirror; return this; } - public Object[] getInput() - { + public Object[] getInput() { return this.input; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java index 80662b3b..cfc2262c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java @@ -1,6 +1,11 @@ package WayofTime.alchemicalWizardry.api.items; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -10,60 +15,39 @@ import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - /** * Shapeless Blood Orb Recipe Handler by joshie * */ -public class ShapelessBloodOrbRecipe implements IRecipe -{ +public class ShapelessBloodOrbRecipe implements IRecipe { private ItemStack output = null; private ArrayList input = new ArrayList(); - public ShapelessBloodOrbRecipe(Block result, Object... recipe) - { + public ShapelessBloodOrbRecipe(Block result, Object... recipe) { this(new ItemStack(result), recipe); } - public ShapelessBloodOrbRecipe(Item result, Object... recipe) - { + public ShapelessBloodOrbRecipe(Item result, Object... recipe) { this(new ItemStack(result), recipe); } - public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) - { + public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) { output = result.copy(); - for (Object in : recipe) - { - if (in instanceof IBloodOrb) - { //If the item is an instanceof IBloodOrb then save the level of the orb + for (Object in : recipe) { + if (in instanceof IBloodOrb) { // If the item is an instanceof IBloodOrb then save the level of the orb input.add(((IBloodOrb) in).getOrbLevel()); - } - else if (in instanceof ItemStack) - { - if (((ItemStack)in).getItem() instanceof IBloodOrb) - { - input.add(((IBloodOrb) ((ItemStack)in).getItem()).getOrbLevel()); - } - else input.add(((ItemStack) in).copy()); - } else if (in instanceof Item) - { + } else if (in instanceof ItemStack) { + if (((ItemStack) in).getItem() instanceof IBloodOrb) { + input.add(((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel()); + } else input.add(((ItemStack) in).copy()); + } else if (in instanceof Item) { input.add(new ItemStack((Item) in)); - } else if (in instanceof Block) - { + } else if (in instanceof Block) { input.add(new ItemStack((Block) in)); - } else if (in instanceof String) - { + } else if (in instanceof String) { input.add(OreDictionary.getOres((String) in)); - } else - { + } else { String ret = "Invalid shapeless ore recipe: "; - for (Object tmp : recipe) - { + for (Object tmp : recipe) { ret += tmp + ", "; } ret += output; @@ -73,17 +57,13 @@ public class ShapelessBloodOrbRecipe implements IRecipe } @SuppressWarnings("unchecked") - ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map replacements) - { + ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map replacements) { output = recipe.getRecipeOutput(); - for (ItemStack ingred : ((List) recipe.recipeItems)) - { + for (ItemStack ingred : ((List) recipe.recipeItems)) { Object finalObj = ingred; - for (Entry replace : replacements.entrySet()) - { - if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) - { + for (Entry replace : replacements.entrySet()) { + if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) { finalObj = OreDictionary.getOres(replace.getValue()); break; } @@ -93,78 +73,63 @@ public class ShapelessBloodOrbRecipe implements IRecipe } @Override - public int getRecipeSize() - { + public int getRecipeSize() { return input.size(); } @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return output; } @Override - public ItemStack getCraftingResult(InventoryCrafting var1) - { + public ItemStack getCraftingResult(InventoryCrafting var1) { return output.copy(); } @SuppressWarnings("unchecked") @Override - public boolean matches(InventoryCrafting var1, World world) - { + public boolean matches(InventoryCrafting var1, World world) { ArrayList required = new ArrayList(input); - for (int x = 0; x < var1.getSizeInventory(); x++) - { + for (int x = 0; x < var1.getSizeInventory(); x++) { ItemStack slot = var1.getStackInSlot(x); - if (slot != null) - { + if (slot != null) { boolean inRecipe = false; Iterator req = required.iterator(); - while (req.hasNext()) - { + while (req.hasNext()) { boolean match = false; Object next = req.next(); - //If target is integer, then we should be check the blood orb value of the item instead - if (next instanceof Integer) - { - if (slot != null && slot.getItem() instanceof IBloodOrb) - { + // If target is integer, then we should be check the blood orb value of the item instead + if (next instanceof Integer) { + if (slot != null && slot.getItem() instanceof IBloodOrb) { IBloodOrb orb = (IBloodOrb) slot.getItem(); - if (orb.getOrbLevel() < (Integer) next) - { + if (orb.getOrbLevel() < (Integer) next) { return false; } } else return false; match = true; - } else if (next instanceof ItemStack) - { + } else if (next instanceof ItemStack) { match = OreDictionary.itemMatches((ItemStack) next, slot, false); - } else if (next instanceof ArrayList) - { + } else if (next instanceof ArrayList) { Iterator itr = ((ArrayList) next).iterator(); - while (itr.hasNext() && !match) - { + while (itr.hasNext() && !match) { match = OreDictionary.itemMatches(itr.next(), slot, false); } } - if (match) - { + if (match) { inRecipe = true; required.remove(next); break; } } - if (!inRecipe) - { + if (!inRecipe) { return false; } } @@ -173,8 +138,7 @@ public class ShapelessBloodOrbRecipe implements IRecipe return required.isEmpty(); } - public ArrayList getInput() - { + public ArrayList getInput() { return this.input; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ArmourUpgrade.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ArmourUpgrade.java index ff4cec00..52c26c27 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ArmourUpgrade.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ArmourUpgrade.java @@ -4,9 +4,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface ArmourUpgrade -{ - //Called when the armour ticks +public interface ArmourUpgrade { + // Called when the armour ticks void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack); boolean isUpgrade(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBindable.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBindable.java index 46a79939..1b97df2e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBindable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBindable.java @@ -1,5 +1,3 @@ package WayofTime.alchemicalWizardry.api.items.interfaces; -public interface IBindable -{ -} +public interface IBindable {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBloodOrb.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBloodOrb.java index c38ea2f1..50d3d64f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBloodOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBloodOrb.java @@ -1,7 +1,6 @@ package WayofTime.alchemicalWizardry.api.items.interfaces; -public interface IBloodOrb -{ +public interface IBloodOrb { int getMaxEssence(); int getOrbLevel(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IHolding.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IHolding.java index 4150abe2..2e2f9782 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IHolding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IHolding.java @@ -1,6 +1,3 @@ package WayofTime.alchemicalWizardry.api.items.interfaces; -public interface IHolding -{ - -} +public interface IHolding {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java index b75815ca..0e84364f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java @@ -2,7 +2,6 @@ package WayofTime.alchemicalWizardry.api.items.interfaces; import net.minecraft.item.ItemStack; -public interface ILPGauge -{ - boolean canSeeLPBar(ItemStack itemStack); +public interface ILPGauge { + boolean canSeeLPBar(ItemStack itemStack); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IReagentManipulator.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IReagentManipulator.java index 23ac7809..0ac27ade 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IReagentManipulator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IReagentManipulator.java @@ -3,7 +3,4 @@ package WayofTime.alchemicalWizardry.api.items.interfaces; /** * Implement this interface to have reagent blocks return false on activating them, to allow manipulation of said block */ -public interface IReagentManipulator -{ - -} +public interface IReagentManipulator {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java index 03094a88..3fe07978 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java @@ -3,12 +3,19 @@ package WayofTime.alchemicalWizardry.api.items.interfaces; import net.minecraft.item.ItemStack; public interface IRitualDiviner { - int cycleDirection(ItemStack stack); - String getCurrentRitual(ItemStack stack); - int getDirection(ItemStack stack); - int getMaxRuneDisplacement(ItemStack stack); - String getNameForDirection(int direction); - void setCurrentRitual(ItemStack stack, String ritualID); - void setDirection(ItemStack stack, int direction); - void setMaxRuneDisplacement(ItemStack stack, int displacement); + int cycleDirection(ItemStack stack); + + String getCurrentRitual(ItemStack stack); + + int getDirection(ItemStack stack); + + int getMaxRuneDisplacement(ItemStack stack); + + String getNameForDirection(int direction); + + void setCurrentRitual(ItemStack stack, String ritualID); + + void setDirection(ItemStack stack, int direction); + + void setMaxRuneDisplacement(ItemStack stack, int displacement); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ISigil.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ISigil.java index d610c211..56713a23 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ISigil.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ISigil.java @@ -1,4 +1,3 @@ package WayofTime.alchemicalWizardry.api.items.interfaces; -public interface ISigil { -} +public interface ISigil {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/package-info.java b/src/main/java/WayofTime/alchemicalWizardry/api/package-info.java index 789c37f5..ab61dbdb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/package-info.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/package-info.java @@ -1,3 +1,4 @@ @API(owner = "BloodMagic", apiVersion = "1.3.3-13", provides = "BloodMagicAPI") package WayofTime.alchemicalWizardry.api; -import cpw.mods.fml.common.API; \ No newline at end of file + +import cpw.mods.fml.common.API; diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java index 7eea34c1..fc713316 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java @@ -1,20 +1,17 @@ package WayofTime.alchemicalWizardry.api.renderer; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.ResourceLocation; -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -public abstract class MRSRenderer -{ +public abstract class MRSRenderer { public abstract void renderAt(IMasterRitualStone tile, double x, double y, double z); - protected void bindTexture(ResourceLocation p_147499_1_) - { + protected void bindTexture(ResourceLocation p_147499_1_) { TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; - if (texturemanager != null) - { + if (texturemanager != null) { texturemanager.bindTexture(p_147499_1_); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java index 3577ad47..12137738 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java @@ -4,8 +4,7 @@ import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public interface IMasterRitualStone extends ISegmentedReagentHandler -{ +public interface IMasterRitualStone extends ISegmentedReagentHandler { void performRitual(World world, int x, int y, int z, String ritualID); String getOwner(); @@ -33,12 +32,12 @@ public interface IMasterRitualStone extends ISegmentedReagentHandler NBTTagCompound getCustomRitualTag(); void setCustomRitualTag(NBTTagCompound tag); - + boolean areTanksEmpty(); - + int getRunningTime(); - + LocalRitualStorage getLocalStorage(); - + void setLocalStorage(LocalRitualStorage storage); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java index 3ea6d90e..e71a01b7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java @@ -2,17 +2,16 @@ package WayofTime.alchemicalWizardry.api.rituals; import net.minecraft.world.World; -public interface IRitualStone -{ - /** - * x, y, and z give the position of the Ritual Stone - * @param world - * @param x - * @param y - * @param z - * @param meta - * @param runeType - * @return - */ - boolean isRuneType(World world, int x, int y, int z, int meta, int runeType); +public interface IRitualStone { + /** + * x, y, and z give the position of the Ritual Stone + * @param world + * @param x + * @param y + * @param z + * @param meta + * @param runeType + * @return + */ + boolean isRuneType(World world, int x, int y, int z, int meta, int runeType); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java index 68a0a24e..234cd98d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.api.rituals; -public interface ITileRitualStone -{ +public interface ITileRitualStone { boolean isRuneType(int runeType); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java index e5a3241b..bfcf9acb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java @@ -1,42 +1,37 @@ package WayofTime.alchemicalWizardry.api.rituals; -import net.minecraft.nbt.NBTTagCompound; import WayofTime.alchemicalWizardry.api.Int3; +import net.minecraft.nbt.NBTTagCompound; /** * This class is used to pass ritual-specific data into the RitualEffect from the containing Master Ritual Stone. This is basically used as auxillarary storage, * for when simply storing to NBT becomes... difficult. * */ -public class LocalRitualStorage -{ - public int xCoord; - public int yCoord; - public int zCoord; - - public void writeToNBT(NBTTagCompound tag) - { - tag.setInteger("xCoord", xCoord); - tag.setInteger("yCoord", yCoord); - tag.setInteger("zCoord", zCoord); - } +public class LocalRitualStorage { + public int xCoord; + public int yCoord; + public int zCoord; - public void readFromNBT(NBTTagCompound tag) - { - this.xCoord = tag.getInteger("xCoord"); - this.yCoord = tag.getInteger("yCoord"); - this.zCoord = tag.getInteger("zCoord"); - } - - public Int3 getLocation() - { - return new Int3(xCoord, yCoord, zCoord); - } - - public void setLocation(Int3 location) - { - this.xCoord = location.xCoord; - this.yCoord = location.yCoord; - this.zCoord = location.zCoord; - } + public void writeToNBT(NBTTagCompound tag) { + tag.setInteger("xCoord", xCoord); + tag.setInteger("yCoord", yCoord); + tag.setInteger("zCoord", zCoord); + } + + public void readFromNBT(NBTTagCompound tag) { + this.xCoord = tag.getInteger("xCoord"); + this.yCoord = tag.getInteger("yCoord"); + this.zCoord = tag.getInteger("zCoord"); + } + + public Int3 getLocation() { + return new Int3(xCoord, yCoord, zCoord); + } + + public void setLocation(Int3 location) { + this.xCoord = location.xCoord; + this.yCoord = location.yCoord; + this.zCoord = location.zCoord; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualBreakMethod.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualBreakMethod.java index a705056a..f68bf12d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualBreakMethod.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualBreakMethod.java @@ -1,11 +1,10 @@ package WayofTime.alchemicalWizardry.api.rituals; -public enum RitualBreakMethod -{ - REDSTONE, - BREAK_MRS, - BREAK_STONE, - ACTIVATE, //When an activation crystal activates the MRS, overwriting the current ritual - DEACTIVATE, - EXPLOSION, //When the MRS is destroyed by an explosion +public enum RitualBreakMethod { + REDSTONE, + BREAK_MRS, + BREAK_STONE, + ACTIVATE, // When an activation crystal activates the MRS, overwriting the current ritual + DEACTIVATE, + EXPLOSION, // When the MRS is destroyed by an explosion } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualComponent.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualComponent.java index 1efc368f..1862068e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualComponent.java @@ -1,7 +1,6 @@ package WayofTime.alchemicalWizardry.api.rituals; -public class RitualComponent -{ +public class RitualComponent { private int x; private int y; private int z; @@ -14,59 +13,52 @@ public class RitualComponent public static final int DUSK = 5; public static final int DAWN = 6; - public RitualComponent(int x, int y, int z, int stoneType) - { + public RitualComponent(int x, int y, int z, int stoneType) { this.x = x; this.y = y; this.z = z; this.stoneType = stoneType; } - public int getX() - { + public int getX() { return this.x; } - public int getY() - { + public int getY() { return this.y; } - public int getZ() - { + public int getZ() { return this.z; } - - public int getX(int direction) - { - switch(direction) - { - case 2: - return -this.getZ(); - case 3: - return -this.getX(); - case 4: - return this.getZ(); - default: return this.getX(); - } - } - - public int getZ(int direction) - { - switch(direction) - { - case 2: - return this.getX(); - case 3: - return -this.getZ(); - case 4: - return -this.getX(); - default: return this.getZ(); + + public int getX(int direction) { + switch (direction) { + case 2: + return -this.getZ(); + case 3: + return -this.getX(); + case 4: + return this.getZ(); + default: + return this.getX(); } } - public int getStoneType() - { + public int getZ(int direction) { + switch (direction) { + case 2: + return this.getX(); + case 3: + return -this.getZ(); + case 4: + return -this.getX(); + default: + return this.getZ(); + } + } + + public int getStoneType() { return this.stoneType; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java index 85f291c7..39dfa912 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java @@ -1,40 +1,31 @@ package WayofTime.alchemicalWizardry.api.rituals; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; -public abstract class RitualEffect -{ +public abstract class RitualEffect { public abstract void performEffect(IMasterRitualStone ritualStone); - public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player) - { + public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player) { return true; } - public void onRitualBroken(IMasterRitualStone ritualStone, RitualBreakMethod method) - { - - } + public void onRitualBroken(IMasterRitualStone ritualStone, RitualBreakMethod method) {} public abstract int getCostPerRefresh(); - public int getInitialCooldown() - { + public int getInitialCooldown() { return 0; } public abstract List getRitualComponentList(); - public boolean canDrainReagent(IMasterRitualStone ritualStone, Reagent reagent, int amount, boolean doDrain) - { - if (ritualStone == null || reagent == null || amount == 0) - { + public boolean canDrainReagent(IMasterRitualStone ritualStone, Reagent reagent, int amount, boolean doDrain) { + if (ritualStone == null || reagent == null || amount == 0) { return false; } @@ -42,10 +33,8 @@ public abstract class RitualEffect ReagentStack stack = ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, false); - if (stack != null && stack.amount >= amount) - { - if (doDrain) - { + if (stack != null && stack.amount >= amount) { + if (doDrain) { ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true); } @@ -54,37 +43,33 @@ public abstract class RitualEffect return false; } - - public LocalRitualStorage getNewLocalStorage() - { - return new LocalRitualStorage(); + + public LocalRitualStorage getNewLocalStorage() { + return new LocalRitualStorage(); } - - public void addOffsetRunes(ArrayList ritualList, int off1, int off2, int y, int rune) - { - ritualList.add(new RitualComponent(off1, y, off2, rune)); - ritualList.add(new RitualComponent(off2, y, off1, rune)); - ritualList.add(new RitualComponent(off1, y, -off2, rune)); - ritualList.add(new RitualComponent(-off2, y, off1, rune)); - ritualList.add(new RitualComponent(-off1, y, off2, rune)); - ritualList.add(new RitualComponent(off2, y, -off1, rune)); - ritualList.add(new RitualComponent(-off1, y, -off2, rune)); - ritualList.add(new RitualComponent(-off2, y, -off1, rune)); + + public void addOffsetRunes(ArrayList ritualList, int off1, int off2, int y, int rune) { + ritualList.add(new RitualComponent(off1, y, off2, rune)); + ritualList.add(new RitualComponent(off2, y, off1, rune)); + ritualList.add(new RitualComponent(off1, y, -off2, rune)); + ritualList.add(new RitualComponent(-off2, y, off1, rune)); + ritualList.add(new RitualComponent(-off1, y, off2, rune)); + ritualList.add(new RitualComponent(off2, y, -off1, rune)); + ritualList.add(new RitualComponent(-off1, y, -off2, rune)); + ritualList.add(new RitualComponent(-off2, y, -off1, rune)); } - - public void addCornerRunes(ArrayList ritualList, int off1, int y, int rune) - { - ritualList.add(new RitualComponent(off1, y, off1, rune)); - ritualList.add(new RitualComponent(off1, y, -off1, rune)); - ritualList.add(new RitualComponent(-off1, y, -off1, rune)); - ritualList.add(new RitualComponent(-off1, y, off1, rune)); + + public void addCornerRunes(ArrayList ritualList, int off1, int y, int rune) { + ritualList.add(new RitualComponent(off1, y, off1, rune)); + ritualList.add(new RitualComponent(off1, y, -off1, rune)); + ritualList.add(new RitualComponent(-off1, y, -off1, rune)); + ritualList.add(new RitualComponent(-off1, y, off1, rune)); } - - public void addParallelRunes(ArrayList ritualList, int off1, int y, int rune) - { - ritualList.add(new RitualComponent(off1, y, 0, rune)); - ritualList.add(new RitualComponent(-off1, y, 0, rune)); - ritualList.add(new RitualComponent(0, y, -off1, rune)); - ritualList.add(new RitualComponent(0, y, off1, rune)); + + public void addParallelRunes(ArrayList ritualList, int off1, int y, int rune) { + ritualList.add(new RitualComponent(off1, y, 0, rune)); + ritualList.add(new RitualComponent(-off1, y, 0, rune)); + ritualList.add(new RitualComponent(0, y, -off1, rune)); + ritualList.add(new RitualComponent(0, y, off1, rune)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java index d634e8a4..0f8bfece 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java @@ -1,24 +1,22 @@ package WayofTime.alchemicalWizardry.api.rituals; +import WayofTime.alchemicalWizardry.api.event.RitualRunEvent; +import WayofTime.alchemicalWizardry.api.event.RitualStopEvent; +import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer; +import cpw.mods.fml.common.eventhandler.Event; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; -import WayofTime.alchemicalWizardry.api.event.RitualRunEvent; -import WayofTime.alchemicalWizardry.api.event.RitualStopEvent; -import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer; -import cpw.mods.fml.common.eventhandler.Event; -public class Rituals -{ - public final int crystalLevel; +public class Rituals { + public final int crystalLevel; public final int actCost; public final RitualEffect effect; public final String name; @@ -29,8 +27,7 @@ public class Rituals public static Map ritualMap = new HashMap(); public static List keyList = new LinkedList(); - public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) - { + public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) { this.crystalLevel = crystalLevel; this.actCost = actCost; this.effect = effect; @@ -40,8 +37,7 @@ public class Rituals this.customRenderer = renderer; } - public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name) - { + public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name) { this(crystalLevel, actCost, effect, name, null); } @@ -55,13 +51,11 @@ public class Rituals * @param name The name of the ritual * @return Returns true if properly registered, or false if the key is already used */ - public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) - { - if (ritualMap.containsKey(key)) - { + public static boolean registerRitual( + String key, int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) { + if (ritualMap.containsKey(key)) { return false; - } else - { + } else { Rituals ritual = new Rituals(crystalLevel, actCost, effect, name, renderer); ritual.removeRitualFromList(); ritualMap.put(key, ritual); @@ -71,13 +65,10 @@ public class Rituals } } - public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name) - { - if (ritualMap.containsKey(key)) - { + public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name) { + if (ritualMap.containsKey(key)) { return false; - } else - { + } else { Rituals ritual = new Rituals(crystalLevel, actCost, effect, name); ritual.removeRitualFromList(); ritualMap.put(key, ritual); @@ -87,24 +78,18 @@ public class Rituals } } - public void removeRitualFromList() - { - if (ritualMap.containsValue(this)) - { + public void removeRitualFromList() { + if (ritualMap.containsValue(this)) { ritualMap.remove(ritualMap.remove(this.name)); } - if (keyList.contains(this.name)) - { + if (keyList.contains(this.name)) { keyList.remove(this.name); } } - public static String checkValidRitual(World world, int x, int y, int z) - { - for (String key : ritualMap.keySet()) - { - if (checkRitualIsValid(world, x, y, z, key)) - { + public static String checkValidRitual(World world, int x, int y, int z) { + for (String key : ritualMap.keySet()) { + if (checkRitualIsValid(world, x, y, z, key)) { return key; } } @@ -112,13 +97,10 @@ public class Rituals return ""; } - public static boolean canCrystalActivate(String ritualID, int crystalLevel) - { - if (ritualMap.containsKey(ritualID)) - { + public static boolean canCrystalActivate(String ritualID, int crystalLevel) { + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { + if (ritual != null) { return ritual.getCrystalLevel() <= crystalLevel; } } @@ -126,8 +108,7 @@ public class Rituals return false; } - public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID) - { + public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID) { int direction = Rituals.getDirectionOfRitual(world, x, y, z, ritualID); return direction != -1; @@ -139,26 +120,32 @@ public class Rituals * 3 - SOUTH * 4 - WEST */ - public static boolean checkDirectionOfRitualValid(World world, int x, int y, int z, String ritualID, int direction) - { + public static boolean checkDirectionOfRitualValid( + World world, int x, int y, int z, String ritualID, int direction) { List ritual = Rituals.getRitualList(ritualID); - if (ritual == null) - { + if (ritual == null) { return false; } Block test; TileEntity te; - for (RitualComponent rc : ritual) - { + for (RitualComponent rc : ritual) { test = world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); te = world.getTileEntity(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); - if (!(test instanceof IRitualStone && ((IRitualStone)test).isRuneType(world, x + rc.getX(direction), y, z+ rc.getZ(direction), world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)), rc.getStoneType())) - && !(te instanceof ITileRitualStone && ((ITileRitualStone)te).isRuneType(rc.getStoneType()))) - { + if (!(test instanceof IRitualStone + && ((IRitualStone) test) + .isRuneType( + world, + x + rc.getX(direction), + y, + z + rc.getZ(direction), + world.getBlockMetadata( + x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)), + rc.getStoneType())) + && !(te instanceof ITileRitualStone && ((ITileRitualStone) te).isRuneType(rc.getStoneType()))) { return false; } } @@ -166,12 +153,9 @@ public class Rituals return true; } - public static int getDirectionOfRitual(World world, int x, int y, int z, String ritualID) - { - for (int i = 1; i <= 4; i++) - { - if (Rituals.checkDirectionOfRitualValid(world, x, y, z, ritualID, i)) - { + public static int getDirectionOfRitual(World world, int x, int y, int z, String ritualID) { + for (int i = 1; i <= 4; i++) { + if (Rituals.checkDirectionOfRitualValid(world, x, y, z, ritualID, i)) { return i; } } @@ -179,13 +163,10 @@ public class Rituals return -1; } - public static int getCostForActivation(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { + public static int getCostForActivation(String ritualID) { + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { + if (ritual != null) { return ritual.actCost; } } @@ -193,13 +174,10 @@ public class Rituals return 0; } - public static int getInitialCooldown(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { + public static int getInitialCooldown(String ritualID) { + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null && ritual.effect != null) - { + if (ritual != null && ritual.effect != null) { return ritual.effect.getInitialCooldown(); } } @@ -207,67 +185,52 @@ public class Rituals return 0; } - public static List getRitualList(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { + public static List getRitualList(String ritualID) { + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { + if (ritual != null) { return ritual.obtainComponents(); - } else - { + } else { return null; } - } else - { + } else { return null; } } - private List obtainComponents() - { + private List obtainComponents() { return this.effect.getRitualComponentList(); } - private int getCrystalLevel() - { + private int getCrystalLevel() { return this.crystalLevel; } - private MRSRenderer getRenderer() - { + private MRSRenderer getRenderer() { return this.customRenderer; } - public static void performEffect(IMasterRitualStone ritualStone, String ritualID) - { - String ownerName = ritualStone.getOwner(); - - RitualRunEvent event = new RitualRunEvent(ritualStone, ownerName, ritualID); - - if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) - { - return; - } - - if (ritualMap.containsKey(event.ritualKey)) - { + public static void performEffect(IMasterRitualStone ritualStone, String ritualID) { + String ownerName = ritualStone.getOwner(); + + RitualRunEvent event = new RitualRunEvent(ritualStone, ownerName, ritualID); + + if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) { + return; + } + + if (ritualMap.containsKey(event.ritualKey)) { Rituals ritual = ritualMap.get(event.ritualKey); - if (ritual != null && ritual.effect != null) - { + if (ritual != null && ritual.effect != null) { ritual.effect.performEffect(ritualStone); } } } - public static boolean startRitual(IMasterRitualStone ritualStone, String ritualID, EntityPlayer player) - { - if (ritualMap.containsKey(ritualID)) - { + public static boolean startRitual(IMasterRitualStone ritualStone, String ritualID, EntityPlayer player) { + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null && ritual.effect != null) - { + if (ritual != null && ritual.effect != null) { return ritual.effect.startRitual(ritualStone, player); } } @@ -275,57 +238,46 @@ public class Rituals return false; } - public static void onRitualBroken(IMasterRitualStone ritualStone, String ritualID, RitualBreakMethod method) - { - String ownerName = ritualStone.getOwner(); - RitualStopEvent event = new RitualStopEvent(ritualStone, ownerName, ritualID, method); - MinecraftForge.EVENT_BUS.post(event); - - if (ritualMap.containsKey(ritualID)) - { + public static void onRitualBroken(IMasterRitualStone ritualStone, String ritualID, RitualBreakMethod method) { + String ownerName = ritualStone.getOwner(); + RitualStopEvent event = new RitualStopEvent(ritualStone, ownerName, ritualID, method); + MinecraftForge.EVENT_BUS.post(event); + + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null && ritual.effect != null) - { + if (ritual != null && ritual.effect != null) { ritual.effect.onRitualBroken(ritualStone, method); } - } + } } - public String getRitualName() - { + public String getRitualName() { return this.name; } - - public void setRitualLocalizedName(String localizedName) - { + + public void setRitualLocalizedName(String localizedName) { this.localizedName = localizedName; } - public String getRitualLocalizedName() - { + + public String getRitualLocalizedName() { return localizedName.isEmpty() ? this.name : localizedName; } - public static String getNameOfRitual(String id) - { - if (ritualMap.containsKey(id)) - { + public static String getNameOfRitual(String id) { + if (ritualMap.containsKey(id)) { Rituals ritual = ritualMap.get(id); - if (ritual != null) - { + if (ritual != null) { return ritual.getRitualName(); } } return ""; } - - public static String getLocalizedNameOfRitual(String id) - { - if (ritualMap.containsKey(id)) - { + + public static String getLocalizedNameOfRitual(String id) { + if (ritualMap.containsKey(id)) { Rituals ritual = ritualMap.get(id); - if (ritual != null) - { + if (ritual != null) { return ritual.getRitualLocalizedName(); } } @@ -333,23 +285,18 @@ public class Rituals return ""; } - public static String getNextRitualKey(String key) - { + public static String getNextRitualKey(String key) { boolean hasSpotted = false; String firstKey = ""; - for (String str : keyList) - { - if (firstKey.equals("")) - { + for (String str : keyList) { + if (firstKey.equals("")) { firstKey = str; } - if (hasSpotted) - { + if (hasSpotted) { return str; } - if (str.equals(key)) - { + if (str.equals(key)) { hasSpotted = true; } } @@ -357,19 +304,15 @@ public class Rituals return firstKey; } - public static String getPreviousRitualKey(String key) - { + public static String getPreviousRitualKey(String key) { boolean hasSpotted = false; String lastKey = keyList.get(keyList.size() - 1); - for (String str : keyList) - { - if (str.equals(key)) - { + for (String str : keyList) { + if (str.equals(key)) { hasSpotted = true; } - if (hasSpotted) - { + if (hasSpotted) { return lastKey; } lastKey = str; @@ -378,35 +321,28 @@ public class Rituals return lastKey; } - public static MRSRenderer getRendererForKey(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { + public static MRSRenderer getRendererForKey(String ritualID) { + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { + if (ritual != null) { return ritual.getRenderer(); } } return null; } - - public static LocalRitualStorage getLocalStorage(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { + + public static LocalRitualStorage getLocalStorage(String ritualID) { + if (ritualMap.containsKey(ritualID)) { Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { + if (ritual != null) { RitualEffect eff = ritual.effect; - if(eff != null) - { - return eff.getNewLocalStorage(); + if (eff != null) { + return eff.getNewLocalStorage(); } } } - - return null; + + return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/IIncense.java b/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/IIncense.java index 46b04a00..3bb42028 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/IIncense.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/IIncense.java @@ -2,20 +2,22 @@ package WayofTime.alchemicalWizardry.api.sacrifice; import net.minecraft.item.ItemStack; -public interface IIncense -{ - int getMinLevel(ItemStack stack); - - int getMaxLevel(ItemStack stack); - - int getIncenseDuration(ItemStack stack); - - /** - * @param stack - * @return a float from 0 to 1 - */ - float getRedColour(ItemStack stack); - float getGreenColour(ItemStack stack); - float getBlueColour(ItemStack stack); - float getTickRate(ItemStack stack); +public interface IIncense { + int getMinLevel(ItemStack stack); + + int getMaxLevel(ItemStack stack); + + int getIncenseDuration(ItemStack stack); + + /** + * @param stack + * @return a float from 0 to 1 + */ + float getRedColour(ItemStack stack); + + float getGreenColour(ItemStack stack); + + float getBlueColour(ItemStack stack); + + float getTickRate(ItemStack stack); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/PlayerSacrificeHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/PlayerSacrificeHandler.java index 83069e08..39bda704 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/PlayerSacrificeHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/sacrifice/PlayerSacrificeHandler.java @@ -1,91 +1,80 @@ package WayofTime.alchemicalWizardry.api.sacrifice; import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; -public class PlayerSacrificeHandler -{ - public static float scalingOfSacrifice = 0.001f; - public static int soulFrayDuration = 400; - public static Potion soulFrayId; - public static float getPlayerIncense(EntityPlayer player) - { - return APISpellHelper.getCurrentIncense(player); - } +public class PlayerSacrificeHandler { + public static float scalingOfSacrifice = 0.001f; + public static int soulFrayDuration = 400; + public static Potion soulFrayId; - public static void setPlayerIncense(EntityPlayer player, float amount) - { - APISpellHelper.setCurrentIncense(player, amount); - } + public static float getPlayerIncense(EntityPlayer player) { + return APISpellHelper.getCurrentIncense(player); + } - public static boolean incrementIncense(EntityPlayer player, float min, float max, float increment) - { - float amount = getPlayerIncense(player); - if(amount < min || amount >= max) - { - return false; - } + public static void setPlayerIncense(EntityPlayer player, float amount) { + APISpellHelper.setCurrentIncense(player, amount); + } - amount = amount + Math.min(increment, max - amount); - setPlayerIncense(player, amount); + public static boolean incrementIncense(EntityPlayer player, float min, float max, float increment) { + float amount = getPlayerIncense(player); + if (amount < min || amount >= max) { + return false; + } -// System.out.println("Amount of incense: " + amount + ", Increment: " + increment); + amount = amount + Math.min(increment, max - amount); + setPlayerIncense(player, amount); - return true; - } + // System.out.println("Amount of incense: " + amount + ", Increment: " + increment); - public static boolean sacrificePlayerHealth(EntityPlayer player) - { - if(player.isPotionActive(soulFrayId)) - { - return false; - } + return true; + } - float amount = getPlayerIncense(player); + public static boolean sacrificePlayerHealth(EntityPlayer player) { + if (player.isPotionActive(soulFrayId)) { + return false; + } - if(amount >= 0) - { - float health = player.getHealth(); - float maxHealth = player.getMaxHealth(); + float amount = getPlayerIncense(player); - if(health > maxHealth/10.0) - { - float sacrificedHealth = health - maxHealth/10.0f; + if (amount >= 0) { + float health = player.getHealth(); + float maxHealth = player.getMaxHealth(); - if(findAndFillAltar(player.getEntityWorld(), player, (int)(sacrificedHealth * AlchemicalWizardry.lpPerSacrificeIncense * getModifier(amount)))) - { - player.setHealth(maxHealth/10.0f); - setPlayerIncense(player, 0); - player.addPotionEffect(new PotionEffect(soulFrayId.id, soulFrayDuration)); + if (health > maxHealth / 10.0) { + float sacrificedHealth = health - maxHealth / 10.0f; - return true; - } - } - } + if (findAndFillAltar(player.getEntityWorld(), player, (int) + (sacrificedHealth * AlchemicalWizardry.lpPerSacrificeIncense * getModifier(amount)))) { + player.setHealth(maxHealth / 10.0f); + setPlayerIncense(player, 0); + player.addPotionEffect(new PotionEffect(soulFrayId.id, soulFrayDuration)); - return false; - } + return true; + } + } + } - public static float getModifier(float amount) - { - return 1 + amount*scalingOfSacrifice; - } + return false; + } - public static boolean findAndFillAltar(World world, EntityPlayer player, int amount) - { + public static float getModifier(float amount) { + return 1 + amount * scalingOfSacrifice; + } + + public static boolean 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 false; } @@ -95,21 +84,16 @@ public class PlayerSacrificeHandler return true; } - public static IBloodAltar getAltar(World world, int x, int y, int z) - { + public static 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) - { - return (IBloodAltar)tileEntity; + if (tileEntity instanceof IBloodAltar) { + return (IBloodAltar) tileEntity; } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java index c9b69311..ba3c9603 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java @@ -1,5 +1,8 @@ package WayofTime.alchemicalWizardry.api.soulNetwork; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.mojang.authlib.GameProfile; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; @@ -10,117 +13,94 @@ import java.io.Writer; import java.util.HashMap; import java.util.Map.Entry; import java.util.UUID; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mojang.authlib.GameProfile; - - /** - * Temporary class to hash-out how to create a network not completely tied to the player. + * Temporary class to hash-out how to create a network not completely tied to the player. */ -public class ComplexNetworkHandler -{ - public static String fileName = "config/BloodMagic/soulnetworkKeys"; - static HashMap keyMap = new HashMap(); - public static UUID getUUIDFromPlayer(EntityPlayer player) - { +public class ComplexNetworkHandler { + public static String fileName = "config/BloodMagic/soulnetworkKeys"; + static HashMap keyMap = new HashMap(); + + public static UUID getUUIDFromPlayer(EntityPlayer player) { return player.getPersistentID(); } - public static EntityPlayer getPlayerFromUUID(UUID uuid) - { + public static EntityPlayer getPlayerFromUUID(UUID uuid) { MinecraftServer server = MinecraftServer.getServer(); GameProfile gameProfile; gameProfile = server.func_152358_ax().func_152652_a(uuid); String str = uuid.toString(); - //TODO ServerConfigurationManager d.createPlayerForUser + // TODO ServerConfigurationManager d.createPlayerForUser UUID.fromString(str); return null; } - - public static String getKeyForPlayer(EntityPlayer player) - { - return ""; + + public static String getKeyForPlayer(EntityPlayer player) { + return ""; } - - public static UUID getUUIDForKey(String key) - { -// if (MinecraftServer.getServer() == null) -// { -// return null; -// } -// -// World world = MinecraftServer.getServer().worldServers[0]; -// UUIDKeyMap data = (UUIDKeyMap) world.loadItemData(UUIDKeyMap.class, key); -// -// if (data == null) -// { -// data = new UUIDKeyMap(key); -// world.setItemData(key, data); -// } - return null; + + public static UUID getUUIDForKey(String key) { + // if (MinecraftServer.getServer() == null) + // { + // return null; + // } + // + // World world = MinecraftServer.getServer().worldServers[0]; + // UUIDKeyMap data = (UUIDKeyMap) world.loadItemData(UUIDKeyMap.class, key); + // + // if (data == null) + // { + // data = new UUIDKeyMap(key); + // world.setItemData(key, data); + // } + return null; } - - public static String assignKeyToPlayer(EntityPlayer player) - { - return ""; + + public static String assignKeyToPlayer(EntityPlayer player) { + return ""; } - - public static void save() - { - keyMap.put(new UUID(0, 0), "test"); - - Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + public static void save() { + keyMap.put(new UUID(0, 0), "test"); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(keyMap); Writer writer; - try - { + try { writer = new FileWriter(fileName + ".json"); writer.write(json); writer.close(); - } catch (IOException e) - { + } catch (IOException e) { e.printStackTrace(); } } - - public static void load() - { - File save = new File(fileName + ".json"); - - if(save.canRead()) - { - Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + public static void load() { + File save = new File(fileName + ".json"); + + if (save.canRead()) { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); BufferedReader br; - try - { + try { br = new BufferedReader(new FileReader(save)); HashMap schema = gson.fromJson(br, keyMap.getClass()); - + keyMap = schema; - - if(keyMap != null) - { - for(Entry entry : keyMap.entrySet()) - { - System.out.println("" + entry.getValue() + " gave: "+ entry.getKey()); - } + + if (keyMap != null) { + for (Entry entry : keyMap.entrySet()) { + System.out.println("" + entry.getValue() + " gave: " + entry.getKey()); + } } - } catch (FileNotFoundException e) - { + } catch (FileNotFoundException e) { e.printStackTrace(); } - } - - else - { - keyMap = null; - } + } else { + keyMap = null; + } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java index 91bcdafa..318e46fd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java @@ -2,28 +2,24 @@ package WayofTime.alchemicalWizardry.api.soulNetwork; import net.minecraft.nbt.NBTTagCompound; -public class LifeEssenceNetwork extends net.minecraft.world.WorldSavedData -{ +public class LifeEssenceNetwork extends net.minecraft.world.WorldSavedData { public int currentEssence; public int maxOrb; - public LifeEssenceNetwork(String par1Str) - { + public LifeEssenceNetwork(String par1Str) { super(par1Str); currentEssence = 0; maxOrb = 0; } @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { + public void readFromNBT(NBTTagCompound nbttagcompound) { currentEssence = nbttagcompound.getInteger("currentEssence"); maxOrb = nbttagcompound.getInteger("maxOrb"); } @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { + public void writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setInteger("currentEssence", currentEssence); nbttagcompound.setInteger("maxOrb", maxOrb); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java index d9f30f41..fe4cb6c9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java @@ -1,5 +1,11 @@ package WayofTime.alchemicalWizardry.api.soulNetwork; +import WayofTime.alchemicalWizardry.api.event.AddToNetworkEvent; +import WayofTime.alchemicalWizardry.api.event.ItemBindEvent; +import WayofTime.alchemicalWizardry.api.event.ItemDrainInContainerEvent; +import WayofTime.alchemicalWizardry.api.event.ItemDrainNetworkEvent; +import cpw.mods.fml.common.eventhandler.Event; +import cpw.mods.fml.common.eventhandler.Event.Result; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -9,98 +15,79 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; -import WayofTime.alchemicalWizardry.api.event.AddToNetworkEvent; -import WayofTime.alchemicalWizardry.api.event.ItemBindEvent; -import WayofTime.alchemicalWizardry.api.event.ItemDrainInContainerEvent; -import WayofTime.alchemicalWizardry.api.event.ItemDrainNetworkEvent; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.Event.Result; - -public class SoulNetworkHandler -{ - public static boolean syphonFromNetworkWhileInContainer(ItemStack ist, int damageToBeDone) - { - String ownerName = ""; - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { +public class SoulNetworkHandler { + public static boolean syphonFromNetworkWhileInContainer(ItemStack ist, int damageToBeDone) { + String ownerName = ""; + if (ist.getTagCompound() != null + && !(ist.getTagCompound().getString("ownerName").equals(""))) { ownerName = ist.getTagCompound().getString("ownerName"); } - - ItemDrainInContainerEvent event = new ItemDrainInContainerEvent(ist, ownerName, damageToBeDone); - - if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Result.DENY) - { - return false; - } - - return syphonFromNetwork(event.ownerNetwork, event.drainAmount) >= damageToBeDone; + + ItemDrainInContainerEvent event = new ItemDrainInContainerEvent(ist, ownerName, damageToBeDone); + + if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Result.DENY) { + return false; + } + + return syphonFromNetwork(event.ownerNetwork, event.drainAmount) >= damageToBeDone; } - - public static int getCurrentMaxOrb(String ownerName) - { - if (MinecraftServer.getServer() == null) - { + + public static int getCurrentMaxOrb(String ownerName) { + if (MinecraftServer.getServer() == null) { return 0; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } return data.maxOrb; } - - public static void setMaxOrbToMax(String ownerName, int maxOrb) - { - if (MinecraftServer.getServer() == null) - { + + public static void setMaxOrbToMax(String ownerName, int maxOrb) { + if (MinecraftServer.getServer() == null) { return; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } - + data.maxOrb = Math.max(maxOrb, data.maxOrb); data.markDirty(); } - - public static int getMaximumForOrbTier(int maxOrb) - { - switch(maxOrb) - { - case 1: - return 5000; - case 2: - return 25000; - case 3: - return 150000; - case 4: - return 1000000; - case 5: - return 10000000; - case 6: - return 30000000; - default: - return 1; - } + + public static int getMaximumForOrbTier(int maxOrb) { + switch (maxOrb) { + case 1: + return 5000; + case 2: + return 25000; + case 3: + return 150000; + case 4: + return 1000000; + case 5: + return 10000000; + case 6: + return 30000000; + default: + return 1; + } } - public static int syphonFromNetwork(ItemStack ist, int damageToBeDone) - { - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { + public static int syphonFromNetwork(ItemStack ist, int damageToBeDone) { + if (ist.getTagCompound() != null + && !(ist.getTagCompound().getString("ownerName").equals(""))) { String ownerName = ist.getTagCompound().getString("ownerName"); return syphonFromNetwork(ownerName, damageToBeDone); @@ -108,24 +95,20 @@ public class SoulNetworkHandler return 0; } - public static int syphonFromNetwork(String ownerName, int damageToBeDone) - { - if (MinecraftServer.getServer() == null) - { + public static int syphonFromNetwork(String ownerName, int damageToBeDone) { + if (MinecraftServer.getServer() == null) { return 0; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } - if (data.currentEssence >= damageToBeDone) - { + if (data.currentEssence >= damageToBeDone) { data.currentEssence -= damageToBeDone; data.markDirty(); return damageToBeDone; @@ -143,31 +126,30 @@ public class SoulNetworkHandler * @param drain * @return True if the action should be executed and false if it should not. Always returns false if client-sided. */ - public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int drain) - { - if (player.worldObj.isRemote) - { + public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int drain) { + if (player.worldObj.isRemote) { return false; } - - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { + + if (ist.getTagCompound() != null + && !(ist.getTagCompound().getString("ownerName").equals(""))) { String ownerName = ist.getTagCompound().getString("ownerName"); - + ItemDrainNetworkEvent event = new ItemDrainNetworkEvent(player, ownerName, ist, drain); - - if(MinecraftForge.EVENT_BUS.post(event)) - { - return false; + + if (MinecraftForge.EVENT_BUS.post(event)) { + return false; } - + int drainAmount = syphonFromNetwork(event.ownerNetwork, event.drainAmount); - if(drainAmount == 0 || event.shouldDamage) - { - hurtPlayer(player, event.damageAmount); + if (drainAmount == 0 || event.shouldDamage) { + hurtPlayer(player, event.damageAmount); } - - return (event.getResult() != Event.Result.DENY); //The event has been told to prevent the action but allow all repercussions of using the item. + + return (event.getResult() + != Event.Result + .DENY); // The event has been told to prevent the action but allow all repercussions of + // using the item. } int amount = SoulNetworkHandler.syphonFromNetwork(ist, drain); @@ -176,20 +158,23 @@ public class SoulNetworkHandler return true; } - - public static boolean syphonAndDamageFromNetwork(String ownerName, EntityPlayer player, int damageToBeDone) - { - if (player.worldObj.isRemote) - { + + public static boolean syphonAndDamageFromNetwork(String ownerName, EntityPlayer player, int damageToBeDone) { + if (player.worldObj.isRemote) { return false; } World world = player.worldObj; - if (world != null) - { - world.playSoundEffect((double) ((float) player.posX + 0.5F), (double) ((float) player.posY + 0.5F), (double) ((float) player.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); + if (world != null) { + world.playSoundEffect( + (double) ((float) player.posX + 0.5F), + (double) ((float) player.posY + 0.5F), + (double) ((float) player.posZ + 0.5F), + "random.fizz", + 0.5F, + 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); } - + int amount = SoulNetworkHandler.syphonFromNetwork(ownerName, damageToBeDone); hurtPlayer(player, damageToBeDone - amount); @@ -197,10 +182,9 @@ public class SoulNetworkHandler return true; } - public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone) - { - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { + public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone) { + if (ist.getTagCompound() != null + && !(ist.getTagCompound().getString("ownerName").equals(""))) { String ownerName = ist.getTagCompound().getString("ownerName"); return canSyphonFromOnlyNetwork(ownerName, damageToBeDone); @@ -209,18 +193,15 @@ public class SoulNetworkHandler return false; } - public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone) - { - if (MinecraftServer.getServer() == null) - { + public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone) { + if (MinecraftServer.getServer() == null) { return false; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } @@ -228,18 +209,15 @@ public class SoulNetworkHandler return data.currentEssence >= damageToBeDone; } - public static int getCurrentEssence(String ownerName) - { - if (MinecraftServer.getServer() == null) - { + public static int getCurrentEssence(String ownerName) { + if (MinecraftServer.getServer() == null) { return 0; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } @@ -247,18 +225,15 @@ public class SoulNetworkHandler return data.currentEssence; } - public static void setCurrentEssence(String ownerName, int essence) - { - if (MinecraftServer.getServer() == null) - { + public static void setCurrentEssence(String ownerName, int essence) { + if (MinecraftServer.getServer() == null) { return; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } @@ -275,68 +250,54 @@ public class SoulNetworkHandler * @param maximum * @return amount added to the network */ - public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum) - { - AddToNetworkEvent event = new AddToNetworkEvent(ownerName, addedEssence, maximum); - - if(MinecraftForge.EVENT_BUS.post(event)) - { - return 0; - } - - if (MinecraftServer.getServer() == null) - { + public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum) { + AddToNetworkEvent event = new AddToNetworkEvent(ownerName, addedEssence, maximum); + + if (MinecraftForge.EVENT_BUS.post(event)) { + return 0; + } + + if (MinecraftServer.getServer() == null) { return 0; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, event.ownerNetwork); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(event.ownerNetwork); world.setItemData(event.ownerNetwork, data); } int currEss = data.currentEssence; - if (currEss >= event.maximum) - { + if (currEss >= event.maximum) { return 0; } int newEss = Math.min(event.maximum, currEss + event.addedAmount); - if(event.getResult() != Event.Result.DENY) - { + if (event.getResult() != Event.Result.DENY) { data.currentEssence = newEss; } return newEss - currEss; } - public static void hurtPlayer(EntityPlayer user, int energySyphoned) - { - if (energySyphoned < 100 && energySyphoned > 0) - { - if (!user.capabilities.isCreativeMode) - { + public static void hurtPlayer(EntityPlayer user, int energySyphoned) { + if (energySyphoned < 100 && energySyphoned > 0) { + if (!user.capabilities.isCreativeMode) { user.setHealth((user.getHealth() - 1)); - if (user.getHealth() <= 0.0005f) - { + if (user.getHealth() <= 0.0005f) { user.onDeath(DamageSource.generic); } } - } else if (energySyphoned >= 100) - { - if (!user.capabilities.isCreativeMode) - { - for (int i = 0; i < ((energySyphoned + 99) / 100); i++) - { + } else if (energySyphoned >= 100) { + if (!user.capabilities.isCreativeMode) { + for (int i = 0; i < ((energySyphoned + 99) / 100); i++) { user.setHealth((user.getHealth() - 1)); - if (user.getHealth() <= 0.0005f) - { + if (user.getHealth() <= 0.0005f) { user.onDeath(DamageSource.generic); break; } @@ -344,35 +305,29 @@ public class SoulNetworkHandler } } } - - public static void hurtPlayer(EntityPlayer user, float damage) - { - if (!user.capabilities.isCreativeMode) - { - user.setHealth((user.getHealth() - damage)); - - if (user.getHealth() <= 0.0005f) - { - user.onDeath(DamageSource.generic); - } + + public static void hurtPlayer(EntityPlayer user, float damage) { + if (!user.capabilities.isCreativeMode) { + user.setHealth((user.getHealth() - damage)); + + if (user.getHealth() <= 0.0005f) { + user.onDeath(DamageSource.generic); + } } } - public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player) - { + public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player) { checkAndSetItemPlayer(item, player); } - public static boolean checkAndSetItemPlayer(ItemStack item, EntityPlayer player) - { - if (item.hasTagCompound() && !item.getTagCompound().getString("ownerName").equals("")) return true; + public static boolean checkAndSetItemPlayer(ItemStack item, EntityPlayer player) { + if (item.hasTagCompound() + && !item.getTagCompound().getString("ownerName").equals("")) return true; ItemBindEvent event = new ItemBindEvent(player, SoulNetworkHandler.getUsername(player), item); - if(!MinecraftForge.EVENT_BUS.post(event)) - { - if (!item.hasTagCompound()) - { + if (!MinecraftForge.EVENT_BUS.post(event)) { + if (!item.hasTagCompound()) { item.setTagCompound(new NBTTagCompound()); } item.getTagCompound().setString("ownerName", event.key); @@ -381,59 +336,48 @@ public class SoulNetworkHandler return false; } - public static void checkAndSetItemOwner(ItemStack item, String ownerName) - { - if (item.getTagCompound() == null) - { + public static void checkAndSetItemOwner(ItemStack item, String ownerName) { + if (item.getTagCompound() == null) { item.setTagCompound(new NBTTagCompound()); } - if (item.getTagCompound().getString("ownerName").equals("")) - { + if (item.getTagCompound().getString("ownerName").equals("")) { item.getTagCompound().setString("ownerName", ownerName); } } - public static String getUsername(EntityPlayer player) - { + public static String getUsername(EntityPlayer player) { return player.getCommandSenderName(); } - public static EntityPlayer getPlayerForUsername(String str) - { - if (MinecraftServer.getServer() == null) - { + public static EntityPlayer getPlayerForUsername(String str) { + if (MinecraftServer.getServer() == null) { return null; } return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str); } - public static void causeNauseaToPlayer(ItemStack stack) - { - if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals(""))) - { + public static void causeNauseaToPlayer(ItemStack stack) { + if (stack.getTagCompound() != null + && !(stack.getTagCompound().getString("ownerName").equals(""))) { String ownerName = stack.getTagCompound().getString("ownerName"); SoulNetworkHandler.causeNauseaToPlayer(ownerName); } } - public static void causeNauseaToPlayer(String ownerName) - { + public static void causeNauseaToPlayer(String ownerName) { EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName); - if (entityOwner == null) - { + if (entityOwner == null) { return; } entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); } - - public static String getOwnerName(ItemStack item) - { - if (item.getTagCompound() == null) - { + + public static String getOwnerName(ItemStack item) { + if (item.getTagCompound() == null) { item.setTagCompound(new NBTTagCompound()); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java index ed3f65ad..7e931580 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java @@ -1,8 +1,11 @@ package WayofTime.alchemicalWizardry.api.spell; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import cpw.mods.fml.common.registry.GameRegistry; import java.util.ArrayList; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -17,218 +20,181 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import cpw.mods.fml.common.registry.GameRegistry; -public class APISpellHelper -{ - /** - * Thanks Kihira! <3 - * @param player - * @return persistent data tag - */ - private static NBTTagCompound getPersistentDataTag(EntityPlayer player) - { - NBTTagCompound forgeData = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - NBTTagCompound beaconData = forgeData.getCompoundTag("BloodMagic"); +public class APISpellHelper { + /** + * Thanks Kihira! <3 + * @param player + * @return persistent data tag + */ + private static NBTTagCompound getPersistentDataTag(EntityPlayer player) { + NBTTagCompound forgeData = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); + NBTTagCompound beaconData = forgeData.getCompoundTag("BloodMagic"); - //Creates/sets the tags if they don't exist - if (!forgeData.hasKey("BloodMagic")) forgeData.setTag("BloodMagic", beaconData); - if (!player.getEntityData().hasKey(EntityPlayer.PERSISTED_NBT_TAG)) player.getEntityData().setTag(EntityPlayer.PERSISTED_NBT_TAG, forgeData); + // Creates/sets the tags if they don't exist + if (!forgeData.hasKey("BloodMagic")) forgeData.setTag("BloodMagic", beaconData); + if (!player.getEntityData().hasKey(EntityPlayer.PERSISTED_NBT_TAG)) + player.getEntityData().setTag(EntityPlayer.PERSISTED_NBT_TAG, forgeData); - return beaconData; - } - - public static float getCurrentIncense(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:CurrentIncense")) - { - return data.getFloat("BM:CurrentIncense"); - } - - return 0; - } - - public static void setCurrentIncense(EntityPlayer player, float amount) - { - NBTTagCompound data = player.getEntityData(); - data.setFloat("BM:CurrentIncense", amount); - } - - public static int getPlayerLPTag(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:StoredLP")) - { - return data.getInteger("BM:StoredLP"); - } - - return 0; - } - - public static void setPlayerLPTag(EntityPlayer player, int amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setInteger("BM:StoredLP", amount); - } - - public static int getPlayerMaxLPTag(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:MaxStoredLP")) - { - return data.getInteger("BM:MaxStoredLP"); - } - - return 0; - } - - public static void setPlayerMaxLPTag(EntityPlayer player, int amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setInteger("BM:MaxStoredLP", amount); - } - - public static float getPlayerCurrentReagentAmount(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:StoredReagentAmount")) - { - return data.getFloat("BM:StoredReagentAmount"); - } - - return 0; - } - - public static void setPlayerCurrentReagentAmount(EntityPlayer player, float amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setFloat("BM:StoredReagentAmount", amount); - } - - public static float getPlayerMaxReagentAmount(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:MaxReagentAmount")) - { - return data.getFloat("BM:MaxReagentAmount"); - } - - return 0; - } - - public static void setPlayerMaxReagentAmount(EntityPlayer player, float amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setFloat("BM:MaxReagentAmount", amount); - } - - public static Reagent getPlayerReagentType(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:ReagentType")) - { - return ReagentRegistry.getReagentForKey(data.getString("BM:ReagentType")); - } - - return null; - } - - public static void setPlayerReagentType(EntityPlayer player, String str) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setString("BM:ReagentType", str); - } - - public static void setPlayerReagentType(EntityPlayer player, Reagent reagent) - { - setPlayerReagentType(player, ReagentRegistry.getKeyForReagent(reagent)); - } - - public static float getCurrentAdditionalHP(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:CurrentAddedHP")) - { - return data.getFloat("BM:CurrentAddedHP"); - } - - return 0; - } - - public static void setCurrentAdditionalHP(EntityPlayer player, float amount) - { - NBTTagCompound data = player.getEntityData(); - data.setFloat("BM:CurrentAddedHP", amount); - } - - public static float getCurrentAdditionalMaxHP(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:MaxAddedHP")) - { - return data.getFloat("BM:MaxAddedHP"); - } - - return 0; - } - - public static void setCurrentAdditionalMaxHP(EntityPlayer player, float maxHP) - { - NBTTagCompound data = player.getEntityData(); - data.setFloat("BM:MaxAddedHP", maxHP); - } - - public static int getPlayerReagentRegenCooldownTag(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:ReagentRegenCooldown")) - { - return data.getInteger("BM:ReagentRegenCooldown"); - } - - return 0; - } - - public static void setPlayerReagentRegenCooldownTag(EntityPlayer player, int amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setInteger("BM:ReagentRegenCooldown", amount); - } - - public static ItemStack getOrbForLevel(int level) - { - switch(level) - { - case 1: - return new ItemStack(ModItems.weakBloodOrb); - case 2: - return new ItemStack(ModItems.apprenticeBloodOrb); - case 3: - return new ItemStack(ModItems.magicianBloodOrb); - case 4: - return new ItemStack(ModItems.masterBloodOrb); - case 5: - return new ItemStack(ModItems.archmageBloodOrb); - case 6: - return new ItemStack(ModItems.transcendentBloodOrb); - default: - return new ItemStack(Blocks.fire); - } - } - - public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) - { + return beaconData; + } + + public static float getCurrentIncense(EntityPlayer player) { + NBTTagCompound data = player.getEntityData(); + if (data.hasKey("BM:CurrentIncense")) { + return data.getFloat("BM:CurrentIncense"); + } + + return 0; + } + + public static void setCurrentIncense(EntityPlayer player, float amount) { + NBTTagCompound data = player.getEntityData(); + data.setFloat("BM:CurrentIncense", amount); + } + + public static int getPlayerLPTag(EntityPlayer player) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + if (data.hasKey("BM:StoredLP")) { + return data.getInteger("BM:StoredLP"); + } + + return 0; + } + + public static void setPlayerLPTag(EntityPlayer player, int amount) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + data.setInteger("BM:StoredLP", amount); + } + + public static int getPlayerMaxLPTag(EntityPlayer player) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + if (data.hasKey("BM:MaxStoredLP")) { + return data.getInteger("BM:MaxStoredLP"); + } + + return 0; + } + + public static void setPlayerMaxLPTag(EntityPlayer player, int amount) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + data.setInteger("BM:MaxStoredLP", amount); + } + + public static float getPlayerCurrentReagentAmount(EntityPlayer player) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + if (data.hasKey("BM:StoredReagentAmount")) { + return data.getFloat("BM:StoredReagentAmount"); + } + + return 0; + } + + public static void setPlayerCurrentReagentAmount(EntityPlayer player, float amount) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + data.setFloat("BM:StoredReagentAmount", amount); + } + + public static float getPlayerMaxReagentAmount(EntityPlayer player) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + if (data.hasKey("BM:MaxReagentAmount")) { + return data.getFloat("BM:MaxReagentAmount"); + } + + return 0; + } + + public static void setPlayerMaxReagentAmount(EntityPlayer player, float amount) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + data.setFloat("BM:MaxReagentAmount", amount); + } + + public static Reagent getPlayerReagentType(EntityPlayer player) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + if (data.hasKey("BM:ReagentType")) { + return ReagentRegistry.getReagentForKey(data.getString("BM:ReagentType")); + } + + return null; + } + + public static void setPlayerReagentType(EntityPlayer player, String str) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + data.setString("BM:ReagentType", str); + } + + public static void setPlayerReagentType(EntityPlayer player, Reagent reagent) { + setPlayerReagentType(player, ReagentRegistry.getKeyForReagent(reagent)); + } + + public static float getCurrentAdditionalHP(EntityPlayer player) { + NBTTagCompound data = player.getEntityData(); + if (data.hasKey("BM:CurrentAddedHP")) { + return data.getFloat("BM:CurrentAddedHP"); + } + + return 0; + } + + public static void setCurrentAdditionalHP(EntityPlayer player, float amount) { + NBTTagCompound data = player.getEntityData(); + data.setFloat("BM:CurrentAddedHP", amount); + } + + public static float getCurrentAdditionalMaxHP(EntityPlayer player) { + NBTTagCompound data = player.getEntityData(); + if (data.hasKey("BM:MaxAddedHP")) { + return data.getFloat("BM:MaxAddedHP"); + } + + return 0; + } + + public static void setCurrentAdditionalMaxHP(EntityPlayer player, float maxHP) { + NBTTagCompound data = player.getEntityData(); + data.setFloat("BM:MaxAddedHP", maxHP); + } + + public static int getPlayerReagentRegenCooldownTag(EntityPlayer player) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + if (data.hasKey("BM:ReagentRegenCooldown")) { + return data.getInteger("BM:ReagentRegenCooldown"); + } + + return 0; + } + + public static void setPlayerReagentRegenCooldownTag(EntityPlayer player, int amount) { + NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); + data.setInteger("BM:ReagentRegenCooldown", amount); + } + + public static ItemStack getOrbForLevel(int level) { + switch (level) { + case 1: + return new ItemStack(ModItems.weakBloodOrb); + case 2: + return new ItemStack(ModItems.apprenticeBloodOrb); + case 3: + return new ItemStack(ModItems.magicianBloodOrb); + case 4: + return new ItemStack(ModItems.masterBloodOrb); + case 5: + return new ItemStack(ModItems.archmageBloodOrb); + case 6: + return new ItemStack(ModItems.transcendentBloodOrb); + default: + return new ItemStack(Blocks.fire); + } + } + + 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) * (double) f; double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f; - if (!world.isRemote && player instanceof EntityPlayer) - d1 += 1.62D; + if (!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D; double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; Vec3 vec3 = APISpellHelper.createVec3(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); @@ -237,69 +203,59 @@ public class APISpellHelper float f6 = MathHelper.sin(-f1 * 0.017453292F); float f7 = f4 * f5; float f8 = f3 * f5; -// if (player instanceof EntityPlayerMP) + // if (player instanceof EntityPlayerMP) { -// d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); + // d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); } Vec3 vec31 = vec3.addVector((double) f7 * range, (double) f6 * range, (double) f8 * range); return world.func_147447_a(vec3, vec31, par3, !par3, par3); } - - public static Vec3 createVec3(double x, double y, double z) - { - return Vec3.createVectorHelper(x, y, z); - } - - public static List getItemsFromBlock(World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune) - { + + public static Vec3 createVec3(double x, double y, double z) { + return Vec3.createVectorHelper(x, y, z); + } + + public static List getItemsFromBlock( + World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune) { boolean canSilk = block.canSilkHarvest(world, null, x, y, z, meta); - if (canSilk && silkTouch) - { + if (canSilk && silkTouch) { ArrayList items = new ArrayList(); ItemStack item = createStackedBlock(block, meta); - + items.add(item); return items; - } else - { + } else { return block.getDrops(world, x, y, z, meta, fortune); } } - - public static ItemStack createStackedBlock(Block block, int meta) - { + + public static ItemStack createStackedBlock(Block block, int meta) { int j = 0; - if(block == Blocks.lit_redstone_ore) - { - block = Blocks.redstone_ore; + if (block == Blocks.lit_redstone_ore) { + block = Blocks.redstone_ore; } - + Item item = Item.getItemFromBlock(block); - if (item != null && item.getHasSubtypes()) - { + if (item != null && item.getHasSubtypes()) { j = meta; } return new ItemStack(item, 1, j); } - - public static void spawnItemListInWorld(List items, World world, float x, float y, float z) - { - for (ItemStack stack : items) - { + + public static void spawnItemListInWorld(List items, World world, float x, float y, float z) { + for (ItemStack stack : items) { EntityItem itemEntity = new EntityItem(world, x, y, z, stack); itemEntity.delayBeforeCanPickup = 10; world.spawnEntityInWorld(itemEntity); } } - - public static String getNumeralForInt(int num) - { - switch (num) - { + + public static String getNumeralForInt(int num) { + switch (num) { case 1: return "I"; case 2: @@ -324,75 +280,66 @@ public class APISpellHelper return ""; } } - - public static Block getBlockForString(String str) - { + + public static Block getBlockForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findBlock(modId, name); } - public static Item getItemForString(String str) - { + public static Item getItemForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findItem(modId, name); } - - public static ItemStack getItemStackForString(String str) - { - String[] parts = str.split(":"); - int meta = 0; - if(parts.length >= 3) - { - meta = Integer.decode(parts[2]); - }else if(parts.length < 2) - { - return null; - } + + public static ItemStack getItemStackForString(String str) { + String[] parts = str.split(":"); + int meta = 0; + if (parts.length >= 3) { + meta = Integer.decode(parts[2]); + } else if (parts.length < 2) { + return null; + } String modId = parts[0]; String name = parts[1]; - + String itemString = modId + ":" + name; Item item = APISpellHelper.getItemForString(itemString); - if(item != null) - { - return new ItemStack(item, 1, meta); + if (item != null) { + return new ItemStack(item, 1, meta); } - + Block block = APISpellHelper.getBlockForString(itemString); - if(block != null) - { - return new ItemStack(block, 1, meta); + if (block != null) { + return new ItemStack(block, 1, meta); } - + return null; } - - public static IRecipe getRecipeForItemStack(ItemStack reqStack) //Does not match NBT. Durrr! -smack- - { - if(reqStack == null) - { - return null; //Why are you even doing this to yourself!? You know this can't be healthy! - } - List craftingList = CraftingManager.getInstance().getRecipeList(); - for(Object posRecipe : craftingList) - { - if(posRecipe instanceof IRecipe) - { - ItemStack outputStack = ((IRecipe) posRecipe).getRecipeOutput(); - if(outputStack != null) - { - if(outputStack.getItem() == reqStack.getItem() && (outputStack.getItem().getHasSubtypes() ? outputStack.getItemDamage() == reqStack.getItemDamage() : true)) - { - return (IRecipe)posRecipe; - } - } - } - } - - return null; + + public static IRecipe getRecipeForItemStack(ItemStack reqStack) // Does not match NBT. Durrr! -smack- + { + if (reqStack == null) { + return null; // Why are you even doing this to yourself!? You know this can't be healthy! + } + List craftingList = CraftingManager.getInstance().getRecipeList(); + for (Object posRecipe : craftingList) { + if (posRecipe instanceof IRecipe) { + ItemStack outputStack = ((IRecipe) posRecipe).getRecipeOutput(); + if (outputStack != null) { + if (outputStack.getItem() == reqStack.getItem() + && (outputStack.getItem().getHasSubtypes() + ? outputStack.getItemDamage() == reqStack.getItemDamage() + : true)) { + return (IRecipe) posRecipe; + } + } + } + } + + return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellEffect.java index 26bcfc25..57d643d5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellEffect.java @@ -1,92 +1,86 @@ package WayofTime.alchemicalWizardry.api.spell; +public abstract class ComplexSpellEffect { + public final ComplexSpellType type; + public final ComplexSpellModifier modifier; -public abstract class ComplexSpellEffect -{ - public final ComplexSpellType type; - public final ComplexSpellModifier modifier; - - protected int powerEnhancement; + protected int powerEnhancement; protected int costEnhancement; protected int potencyEnhancement; - - public ComplexSpellEffect(ComplexSpellType type, ComplexSpellModifier modifier) - { - this.type = type; - this.modifier = modifier; - } - - public ComplexSpellEffect(ComplexSpellType type, ComplexSpellModifier modifier, int power, int cost, int potency) - { - this(type, modifier); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } - - public abstract void modifyParadigm(SpellParadigm parad); - - public ComplexSpellType getType() - { - return this.type; - } - - public ComplexSpellModifier getModifier() - { - return this.modifier; - } - - public abstract ComplexSpellEffect copy(int power, int cost, int potency); - - public abstract int getCostOfEffect(); - -// public NBTTagCompound getTag() -// { -// NBTTagCompound tag = new NBTTagCompound(); -// -// tag.setString("Class", this.getClass().getName()); -// tag.setInteger("modifier", modifierState); -// tag.setInteger("power", powerEnhancement); -// tag.setInteger("cost", costEnhancement); -// tag.setInteger("potency", potencyEnhancement); -// -// return tag; -// } -// -// public static SpellEffect getEffectFromTag(NBTTagCompound tag) -// { -// try -// { -// Class clazz = Class.forName(tag.getString("Class")); -// if (clazz != null) -// { -// try -// { -// Object obj = clazz.newInstance(); -// if (obj instanceof SpellEffect) -// { -// SpellEffect eff = (SpellEffect) obj; -// -// eff.modifierState = tag.getInteger("modifier"); -// eff.powerEnhancement = tag.getInteger("power"); -// eff.costEnhancement = tag.getInteger("cost"); -// eff.potencyEnhancement = tag.getInteger("potency"); -// -// return eff; -// } -// } catch (InstantiationException e) -// { -// e.printStackTrace(); -// } catch (IllegalAccessException e) -// { -// e.printStackTrace(); -// } -// } -// } catch (ClassNotFoundException e) -// { -// e.printStackTrace(); -// } -// return null; -// } -} \ No newline at end of file + + public ComplexSpellEffect(ComplexSpellType type, ComplexSpellModifier modifier) { + this.type = type; + this.modifier = modifier; + } + + public ComplexSpellEffect(ComplexSpellType type, ComplexSpellModifier modifier, int power, int cost, int potency) { + this(type, modifier); + + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } + + public abstract void modifyParadigm(SpellParadigm parad); + + public ComplexSpellType getType() { + return this.type; + } + + public ComplexSpellModifier getModifier() { + return this.modifier; + } + + public abstract ComplexSpellEffect copy(int power, int cost, int potency); + + public abstract int getCostOfEffect(); + + // public NBTTagCompound getTag() + // { + // NBTTagCompound tag = new NBTTagCompound(); + // + // tag.setString("Class", this.getClass().getName()); + // tag.setInteger("modifier", modifierState); + // tag.setInteger("power", powerEnhancement); + // tag.setInteger("cost", costEnhancement); + // tag.setInteger("potency", potencyEnhancement); + // + // return tag; + // } + // + // public static SpellEffect getEffectFromTag(NBTTagCompound tag) + // { + // try + // { + // Class clazz = Class.forName(tag.getString("Class")); + // if (clazz != null) + // { + // try + // { + // Object obj = clazz.newInstance(); + // if (obj instanceof SpellEffect) + // { + // SpellEffect eff = (SpellEffect) obj; + // + // eff.modifierState = tag.getInteger("modifier"); + // eff.powerEnhancement = tag.getInteger("power"); + // eff.costEnhancement = tag.getInteger("cost"); + // eff.potencyEnhancement = tag.getInteger("potency"); + // + // return eff; + // } + // } catch (InstantiationException e) + // { + // e.printStackTrace(); + // } catch (IllegalAccessException e) + // { + // e.printStackTrace(); + // } + // } + // } catch (ClassNotFoundException e) + // { + // e.printStackTrace(); + // } + // return null; + // } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellModifier.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellModifier.java index 537a5e2b..7551afc8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellModifier.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellModifier.java @@ -1,9 +1,8 @@ package WayofTime.alchemicalWizardry.api.spell; -public class ComplexSpellModifier -{ - public static ComplexSpellModifier DEFAULT = new ComplexSpellModifier(); - public static ComplexSpellModifier OFFENSIVE = new ComplexSpellModifier(); - public static ComplexSpellModifier DEFENSIVE = new ComplexSpellModifier(); - public static ComplexSpellModifier ENVIRONMENTAL = new ComplexSpellModifier(); +public class ComplexSpellModifier { + public static ComplexSpellModifier DEFAULT = new ComplexSpellModifier(); + public static ComplexSpellModifier OFFENSIVE = new ComplexSpellModifier(); + public static ComplexSpellModifier DEFENSIVE = new ComplexSpellModifier(); + public static ComplexSpellModifier ENVIRONMENTAL = new ComplexSpellModifier(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellType.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellType.java index 1c308a81..6a802bc5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellType.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellType.java @@ -1,9 +1,8 @@ package WayofTime.alchemicalWizardry.api.spell; -public class ComplexSpellType -{ - public static ComplexSpellType FIRE = new ComplexSpellType(); - public static ComplexSpellType ICE = new ComplexSpellType(); - public static ComplexSpellType EARTH = new ComplexSpellType(); - public static ComplexSpellType WIND = new ComplexSpellType(); +public class ComplexSpellType { + public static ComplexSpellType FIRE = new ComplexSpellType(); + public static ComplexSpellType ICE = new ComplexSpellType(); + public static ComplexSpellType EARTH = new ComplexSpellType(); + public static ComplexSpellType WIND = new ComplexSpellType(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java index 51657249..08680221 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java @@ -1,10 +1,11 @@ package WayofTime.alchemicalWizardry.api.spell; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.IProjectile; @@ -18,11 +19,8 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class EntitySpellProjectile extends Entity implements IProjectile -{ +public class EntitySpellProjectile extends Entity implements IProjectile { private int xTile = -1; private int yTile = -1; private int zTile = -1; @@ -33,12 +31,13 @@ public class EntitySpellProjectile extends Entity implements IProjectile * The owner of this arrow. */ public EntityPlayer shootingEntity; + private int ticksInAir = 0; private int ricochetCounter = 0; private boolean scheduledForDeath = false; private boolean isSilkTouch = false; - //Custom variables + // Custom variables private int maxRicochet = 0; private float damage = 1; public List impactList = new ArrayList(); @@ -47,42 +46,44 @@ public class EntitySpellProjectile extends Entity implements IProjectile public List spellEffectList = new LinkedList(); private int blocksBroken = 0; - public EntitySpellProjectile(World par1World) - { + public EntitySpellProjectile(World par1World) { super(par1World); this.setSize(0.5F, 0.5F); } - public EntitySpellProjectile(World par1World, double par2, double par4, double par6) - { + public EntitySpellProjectile(World par1World, double par2, double par4, double par6) { super(par1World); this.setSize(0.5F, 0.5F); this.setPosition(par2, par4, par6); yOffset = 0.0F; } - public EntitySpellProjectile(World par1World, EntityPlayer par2EntityPlayer) - { + public EntitySpellProjectile(World par1World, EntityPlayer par2EntityPlayer) { super(par1World); shootingEntity = par2EntityPlayer; float par3 = 0.8F; this.setSize(0.1F, 0.1F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); + this.setLocationAndAngles( + par2EntityPlayer.posX, + par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), + par2EntityPlayer.posZ, + par2EntityPlayer.rotationYaw, + par2EntityPlayer.rotationPitch); posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; posY -= 0.2D; posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(posX, posY, posZ); yOffset = 0.0F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); - } @Override - protected void entityInit() - { + protected void entityInit() { dataWatcher.addObject(16, 0); } @@ -91,8 +92,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile * direction. */ @Override - public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) - { + public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) { float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); var1 /= var9; var3 /= var9; @@ -117,8 +117,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) - { + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { this.setPosition(par1, par3, par5); this.setRotation(par7, par8); } @@ -128,13 +127,11 @@ public class EntitySpellProjectile extends Entity implements IProjectile /** * Sets the velocity to the args. Args: x, y, z */ - public void setVelocity(double par1, double par3, double par5) - { + public void setVelocity(double par1, double par3, double par5) { motionX = par1; motionY = par3; motionZ = par5; - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { + if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI); @@ -148,72 +145,62 @@ public class EntitySpellProjectile extends Entity implements IProjectile * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); this.performUpdateEffects(); - if (ticksInAir > 600) - { + if (ticksInAir > 600) { this.setDead(); } - if (shootingEntity == null) - { - List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)); + if (shootingEntity == null) { + List players = worldObj.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)); Iterator i = players.iterator(); double closestDistance = Double.MAX_VALUE; EntityPlayer closestPlayer = null; - while (i.hasNext()) - { + while (i.hasNext()) { EntityPlayer e = (EntityPlayer) i.next(); double distance = e.getDistanceToEntity(this); - if (distance < closestDistance) - { + if (distance < closestDistance) { closestPlayer = e; } } - if (closestPlayer != null) - { + if (closestPlayer != null) { shootingEntity = closestPlayer; } } - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { + if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI); } Block var16 = worldObj.getBlock(xTile, yTile, zTile); - if (var16 != null) - { + if (var16 != null) { var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - if (var2 != null && var2.isVecInside(APISpellHelper.createVec3(posX, posY, posZ))) - { + if (var2 != null && var2.isVecInside(APISpellHelper.createVec3(posX, posY, posZ))) { inGround = true; } } - if (inGround) - { + if (inGround) { Block var18 = worldObj.getBlock(xTile, yTile, zTile); int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile); -// if (var18.equals(Block.getBlockById(inTile)) && var19 == inData) + // if (var18.equals(Block.getBlockById(inTile)) && var19 == inData) { // this.groundImpact(); // this.setDead(); } - } else - { + } else { ++ticksInAir; - if (ticksInAir > 1 && ticksInAir < 3) - { - //worldObj.spawnParticle("flame", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0D, 0D, 0D); - for (int particles = 0; particles < 3; particles++) - { + if (ticksInAir > 1 && ticksInAir < 3) { + // worldObj.spawnParticle("flame", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + + // smallGauss(0.1D), 0D, 0D, 0D); + for (int particles = 0; particles < 3; particles++) { this.doFiringParticles(); } } @@ -224,33 +211,29 @@ public class EntitySpellProjectile extends Entity implements IProjectile var17 = APISpellHelper.createVec3(posX, posY, posZ); var3 = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); - if (var4 != null) - { + if (var4 != null) { var3 = APISpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); } Entity var5 = null; - List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); + List var6 = worldObj.getEntitiesWithinAABBExcludingEntity( + this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); double var7 = 0.0D; Iterator var9 = var6.iterator(); float var11; - while (var9.hasNext()) - { + while (var9.hasNext()) { Entity var10 = (Entity) var9.next(); - if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) - { + if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) { var11 = 0.3F; AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11); MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); - if (var13 != null) - { + if (var13 != null) { double var14 = var17.distanceTo(var13.hitVec); - if (var14 < var7 || var7 == 0.0D) - { + if (var14 < var7 || var7 == 0.0D) { var5 = var10; var7 = var14; } @@ -258,17 +241,14 @@ public class EntitySpellProjectile extends Entity implements IProjectile } } - if (var5 != null) - { + if (var5 != null) { var4 = new MovingObjectPosition(var5); } - if (var4 != null) - { + if (var4 != null) { this.onImpact(var4); - if (scheduledForDeath) - { + if (scheduledForDeath) { this.setDead(); } } @@ -278,22 +258,26 @@ public class EntitySpellProjectile extends Entity implements IProjectile posZ += motionZ; MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); this.setPosition(posX, posY, posZ); - //this.doBlockCollisions(); + // this.doBlockCollisions(); } } - private void doFlightParticles() - { - if (ticksInAir % 3 == 0) - { + private void doFlightParticles() { + if (ticksInAir % 3 == 0) { double gauss = gaussian(1.0F); worldObj.spawnParticle("mobSpell", posX, posY, posZ, gauss, gauss, 0.0F); } } - private void doFiringParticles() - { - worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + private void doFiringParticles() { + worldObj.spawnParticle( + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); } @@ -301,8 +285,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short) xTile); par1NBTTagCompound.setShort("yTile", (short) yTile); par1NBTTagCompound.setShort("zTile", (short) zTile); @@ -312,21 +295,20 @@ public class EntitySpellProjectile extends Entity implements IProjectile NBTTagList effectList = new NBTTagList(); - for (SpellEffect eff : spellEffectList) - { + for (SpellEffect eff : spellEffectList) { effectList.appendTag(eff.getTag()); } -// for (String str : this.effectList) -// { -// if (str != null) -// { -// NBTTagCompound tag = new NBTTagCompound(); -// -// tag.setString("Class", str); -// effectList.appendTag(tag); -// } -// } + // for (String str : this.effectList) + // { + // if (str != null) + // { + // NBTTagCompound tag = new NBTTagCompound(); + // + // tag.setString("Class", str); + // effectList.appendTag(tag); + // } + // } par1NBTTagCompound.setTag("Effects", effectList); par1NBTTagCompound.setInteger("blocksBroken", blocksBroken); @@ -337,8 +319,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { xTile = par1NBTTagCompound.getShort("xTile"); yTile = par1NBTTagCompound.getShort("yTile"); zTile = par1NBTTagCompound.getShort("zTile"); @@ -351,28 +332,25 @@ public class EntitySpellProjectile extends Entity implements IProjectile NBTTagList tagList = par1NBTTagCompound.getTagList("Effects", Constants.NBT.TAG_COMPOUND); List spellEffectList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); SpellEffect eff = SpellEffect.getEffectFromTag(tag); - if (eff != null) - { + if (eff != null) { spellEffectList.add(eff); } } this.spellEffectList = spellEffectList; + // this.effectList = new LinkedList(); + // for (int i = 0; i < tagList.tagCount(); i++) + // { + // NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); + // + // this.effectList.add(tag.getString("Class")); + // } -// this.effectList = new LinkedList(); -// for (int i = 0; i < tagList.tagCount(); i++) -// { -// NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); -// -// this.effectList.add(tag.getString("Class")); -// } - - //SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList); + // SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList); SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForEffectArray(spellEffectList); parad.applyAllSpellEffects(); parad.prepareProjectile(this); @@ -383,31 +361,26 @@ public class EntitySpellProjectile extends Entity implements IProjectile * walk on. used for spiders and wolves to prevent them from trampling crops */ @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } @Override @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 0.0F; } /** * Sets the amount of knockback the arrow applies when it hits a mob. */ - public void setKnockbackStrength(int par1) - { - } + public void setKnockbackStrength(int par1) {} /** * If returns false, the item will not inflict any damage against entities. */ @Override - public boolean canAttackWithItem() - { + public boolean canAttackWithItem() { return false; } @@ -415,14 +388,11 @@ public class EntitySpellProjectile extends Entity implements IProjectile * Whether the arrow has a stream of critical hit particles flying behind * it. */ - public void setIsCritical(boolean par1) - { + public void setIsCritical(boolean par1) { byte var2 = dataWatcher.getWatchableObjectByte(16); - if (par1) - { + if (par1) { dataWatcher.updateObject(16, var2 | 1); - } else - { + } else { dataWatcher.updateObject(16, var2 & -2); } } @@ -431,86 +401,75 @@ public class EntitySpellProjectile extends Entity implements IProjectile * Whether the arrow has a stream of critical hit particles flying behind * it. */ - public boolean getIsCritical() - { + public boolean getIsCritical() { byte var1 = dataWatcher.getWatchableObjectByte(16); return (var1 & 1) != 0; } - private void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { + private void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { if (mop.entityHit == shootingEntity) return; this.onImpact(mop.entityHit); this.performEntityImpactEffects(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - if (!this.penetration) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if (!this.penetration) { this.groundImpact(mop.sideHit); this.performTileImpactEffects(mop); } } } - private void onImpact(Entity mop) //TODO - { - if (mop == shootingEntity && ticksInAir > 3) - { + private void onImpact(Entity mop) // TODO + { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1); this.setDead(); - } else - { + } else { doDamage(this.damage, mop); } spawnHitParticles("exorcism", 8); this.setDead(); } - - private void spawnHitParticles(String string, int i) - { - for (int particles = 0; particles < i; particles++) - { - worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), posGauss(1.0F), posGauss(1.0F), 0.0F); + private void spawnHitParticles(String string, int i) { + for (int particles = 0; particles < i; particles++) { + worldObj.spawnParticle( + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + posGauss(1.0F), + posGauss(1.0F), + 0.0F); } } - private void doDamage(float f, Entity mop) - { + private void doDamage(float f, Entity mop) { mop.attackEntityFrom(this.getDamageSource(), f); } - private DamageSource getDamageSource() - { + private DamageSource getDamageSource() { return DamageSource.causePlayerDamage(shootingEntity); } - private void groundImpact(int sideHit) - { + private void groundImpact(int sideHit) { this.ricochet(sideHit); } - private double smallGauss(double d) - { + private double smallGauss(double d) { return (worldObj.rand.nextFloat() - 0.5D) * d; } - private double posGauss(double d) - { + private double posGauss(double d) { return rand.nextFloat() * 0.5D * d; } - private double gaussian(double d) - { + private double gaussian(double d) { return d + d * ((rand.nextFloat() - 0.5D) / 4); } - private void ricochet(int sideHit) - { - switch (sideHit) - { + private void ricochet(int sideHit) { + switch (sideHit) { case 0: case 1: // topHit, bottomHit, reflect Y @@ -528,127 +487,109 @@ public class EntitySpellProjectile extends Entity implements IProjectile break; } ricochetCounter++; - if (ricochetCounter > this.getRicochetMax()) - { + if (ricochetCounter > this.getRicochetMax()) { scheduledForDeath = true; - for (int particles = 0; particles < 4; particles++) - { - switch (sideHit) - { + for (int particles = 0; particles < 4; particles++) { + switch (sideHit) { case 0: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D)); break; case 1: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; case 2: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D)); break; case 3: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; case 4: - worldObj.spawnParticle("smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; case 5: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; } } } } - //Custom stuff - public int getRicochetMax() - { + // Custom stuff + public int getRicochetMax() { return this.maxRicochet; } - public void setRicochetMax(int ricochet) - { + public void setRicochetMax(int ricochet) { this.maxRicochet = ricochet; } - public void setImpactList(List list) - { + public void setImpactList(List list) { this.impactList = list; } - public void setUpdateEffectList(List list) - { + public void setUpdateEffectList(List list) { this.updateEffectList = list; } - private void performEntityImpactEffects(Entity mop) - { - if (impactList != null) - { - for (IProjectileImpactEffect impactEffect : impactList) - { + private void performEntityImpactEffects(Entity mop) { + if (impactList != null) { + for (IProjectileImpactEffect impactEffect : impactList) { impactEffect.onEntityImpact(mop, this); } } } - private void performTileImpactEffects(MovingObjectPosition mop) - { - if (impactList != null) - { - for (IProjectileImpactEffect impactEffect : impactList) - { + private void performTileImpactEffects(MovingObjectPosition mop) { + if (impactList != null) { + for (IProjectileImpactEffect impactEffect : impactList) { impactEffect.onTileImpact(worldObj, mop); } } } - private void performUpdateEffects() - { - if (updateEffectList != null) - { - for (IProjectileUpdateEffect updateEffect : updateEffectList) - { + private void performUpdateEffects() { + if (updateEffectList != null) { + for (IProjectileUpdateEffect updateEffect : updateEffectList) { updateEffect.onUpdateEffect(this); } } } - public void setPenetration(boolean penetration) - { + public void setPenetration(boolean penetration) { this.penetration = penetration; } - public float getDamage() - { + public float getDamage() { return this.damage; } - public void setDamage(float damage) - { + public void setDamage(float damage) { this.damage = damage; } - public void setSpellEffectList(List list) - { + public void setSpellEffectList(List list) { this.spellEffectList = list; } - public int getBlocksBroken() - { + public int getBlocksBroken() { return this.blocksBroken; } - public void setBlocksBroken(int blocksBroken) - { + public void setBlocksBroken(int blocksBroken) { this.blocksBroken = blocksBroken; } - public boolean getIsSilkTouch() - { + public boolean getIsSilkTouch() { return this.isSilkTouch; } - public void setIsSilkTouch(boolean bool) - { + public void setIsSilkTouch(boolean bool) { this.isSilkTouch = bool; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ExtrapolatedMeleeEntityEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ExtrapolatedMeleeEntityEffect.java index 03929374..fdfb04ee 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ExtrapolatedMeleeEntityEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ExtrapolatedMeleeEntityEffect.java @@ -1,15 +1,13 @@ package WayofTime.alchemicalWizardry.api.spell; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import java.util.List; - -public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntityEffect -{ +public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntityEffect { protected float range; protected float radius; protected int powerUpgrades; @@ -17,8 +15,7 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity protected int costUpgrades; protected int maxHit; - public ExtrapolatedMeleeEntityEffect(int power, int potency, int cost) - { + public ExtrapolatedMeleeEntityEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; @@ -28,24 +25,22 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity } @Override - public void onEntityImpact(World world, EntityPlayer entityPlayer) - { + public void onEntityImpact(World world, EntityPlayer entityPlayer) { Vec3 lookVec = entityPlayer.getLook(range); double x = entityPlayer.posX + lookVec.xCoord; double y = entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord; double z = entityPlayer.posZ + lookVec.zCoord; - List entities = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x - 0.5f, y - 0.5f, z - 0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius)); + List entities = world.getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox(x - 0.5f, y - 0.5f, z - 0.5f, x + 0.5f, y + 0.5f, z + 0.5f) + .expand(radius, radius, radius)); int hit = 0; - if (entities != null) - { - for (Entity entity : entities) - { - if (hit < maxHit && !entity.equals(entityPlayer)) - { - if (this.entityEffect(world, entity, entityPlayer)) - { + if (entities != null) { + for (Entity entity : entities) { + if (hit < maxHit && !entity.equals(entityPlayer)) { + if (this.entityEffect(world, entity, entityPlayer)) { hit++; } } @@ -55,18 +50,15 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity protected abstract boolean entityEffect(World world, Entity entity, EntityPlayer player); - public void setRange(float range) - { + public void setRange(float range) { this.range = range; } - public void setRadius(float radius) - { + public void setRadius(float radius) { this.radius = radius; } - public void setMaxNumberHit(int maxHit) - { + public void setMaxNumberHit(int maxHit) { this.maxHit = maxHit; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java index 07939312..1a4ab312 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java @@ -6,7 +6,14 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public interface IDigAreaEffect -{ - int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool); +public interface IDigAreaEffect { + int digSurroundingArea( + ItemStack container, + World world, + EntityPlayer player, + MovingObjectPosition blockPos, + String usedToolClass, + float blockHardness, + int harvestLvl, + ItemSpellMultiTool itemTool); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java index eb9b766b..1afcce16 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java @@ -1,10 +1,8 @@ package WayofTime.alchemicalWizardry.api.spell; +import java.util.List; import net.minecraft.item.ItemStack; -import java.util.List; - -public interface IItemManipulator -{ +public interface IItemManipulator { public List handleItemsOnBlockBroken(ItemStack toolStack, List itemList); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java index 5683998b..407684d7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java @@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface ILeftClickEffect -{ +public interface ILeftClickEffect { int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellEntityEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellEntityEffect.java index 4e1608cc..a10ee975 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellEntityEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellEntityEffect.java @@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public interface IMeleeSpellEntityEffect -{ +public interface IMeleeSpellEntityEffect { void onEntityImpact(World world, EntityPlayer entityPlayer); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellWorldEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellWorldEffect.java index 9be8966b..4ef5193c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellWorldEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellWorldEffect.java @@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public interface IMeleeSpellWorldEffect -{ +public interface IMeleeSpellWorldEffect { void onWorldEffect(World world, EntityPlayer entityPlayer); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java index d69396ba..e8e7205d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java @@ -4,7 +4,6 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IOnBanishTool -{ +public interface IOnBanishTool { int onBanishTool(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java index 6c10f6c3..3b40fbb4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java @@ -6,7 +6,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public interface IOnBreakBlock -{ - int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken); +public interface IOnBreakBlock { + int onBlockBroken( + ItemStack container, + World world, + EntityPlayer player, + Block block, + int meta, + int x, + int y, + int z, + ForgeDirection sideBroken); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java index e1a599a7..6880c05f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java @@ -4,7 +4,6 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IOnSummonTool -{ +public interface IOnSummonTool { int onSummonTool(ItemStack toolStack, World world, Entity entity); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileImpactEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileImpactEffect.java index 93215506..31cc9210 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileImpactEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileImpactEffect.java @@ -4,8 +4,7 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public interface IProjectileImpactEffect -{ +public interface IProjectileImpactEffect { void onEntityImpact(Entity mop, Entity projectile); void onTileImpact(World world, MovingObjectPosition mop); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileUpdateEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileUpdateEffect.java index 958a83e7..4b16a24c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileUpdateEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IProjectileUpdateEffect.java @@ -2,7 +2,6 @@ package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.Entity; -public interface IProjectileUpdateEffect -{ +public interface IProjectileUpdateEffect { void onUpdateEffect(Entity projectile); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java index b779b110..f0011a45 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java @@ -5,9 +5,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public interface IRightClickEffect -{ - //public abstract int onRightClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder); +public interface IRightClickEffect { + // public abstract int onRightClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder); int onRightClickBlock(ItemStack stack, EntityLivingBase weilder, World world, MovingObjectPosition mop); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISelfSpellEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISelfSpellEffect.java index 5bb25de3..9e12858e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISelfSpellEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISelfSpellEffect.java @@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public interface ISelfSpellEffect -{ +public interface ISelfSpellEffect { void onSelfUse(World world, EntityPlayer player); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java index f60024b2..4c362875 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java @@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.Entity; -public interface ISpecialDamageEffect -{ +public interface ISpecialDamageEffect { float getDamageForEntity(Entity entity); String getKey(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java index 92b7745a..b6c9b522 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java @@ -4,7 +4,6 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IToolUpdateEffect -{ +public interface IToolUpdateEffect { int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellCenteredWorldEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellCenteredWorldEffect.java index 68ec0133..d7b5881e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellCenteredWorldEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellCenteredWorldEffect.java @@ -4,18 +4,15 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public abstract class MeleeSpellCenteredWorldEffect extends MeleeSpellWorldEffect -{ +public abstract class MeleeSpellCenteredWorldEffect extends MeleeSpellWorldEffect { protected float range; - public MeleeSpellCenteredWorldEffect(int power, int potency, int cost) - { + public MeleeSpellCenteredWorldEffect(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onWorldEffect(World world, EntityPlayer entityPlayer) - { + public void onWorldEffect(World world, EntityPlayer entityPlayer) { Vec3 lookVec = entityPlayer.getLook(range).normalize(); int x = (int) (entityPlayer.posX + lookVec.xCoord * range); int y = (int) (entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord * range); @@ -24,8 +21,7 @@ public abstract class MeleeSpellCenteredWorldEffect extends MeleeSpellWorldEffec this.onCenteredWorldEffect(entityPlayer, world, x, y, z); } - public void setRange(float range) - { + public void setRange(float range) { this.range = range; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellWorldEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellWorldEffect.java index 844b5400..c1d33667 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellWorldEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellWorldEffect.java @@ -3,14 +3,12 @@ package WayofTime.alchemicalWizardry.api.spell; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public abstract class MeleeSpellWorldEffect implements IMeleeSpellWorldEffect -{ +public abstract class MeleeSpellWorldEffect implements IMeleeSpellWorldEffect { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public MeleeSpellWorldEffect(int power, int potency, int cost) - { + public MeleeSpellWorldEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileImpactEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileImpactEffect.java index 22ef5db8..db78fa64 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileImpactEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileImpactEffect.java @@ -1,13 +1,11 @@ package WayofTime.alchemicalWizardry.api.spell; -public abstract class ProjectileImpactEffect implements IProjectileImpactEffect -{ +public abstract class ProjectileImpactEffect implements IProjectileImpactEffect { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public ProjectileImpactEffect(int power, int potency, int cost) - { + public ProjectileImpactEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileUpdateEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileUpdateEffect.java index 500e7cfb..dbe6d016 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileUpdateEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/ProjectileUpdateEffect.java @@ -1,13 +1,11 @@ package WayofTime.alchemicalWizardry.api.spell; -public abstract class ProjectileUpdateEffect implements IProjectileUpdateEffect -{ +public abstract class ProjectileUpdateEffect implements IProjectileUpdateEffect { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public ProjectileUpdateEffect(int power, int potency, int cost) - { + public ProjectileUpdateEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SelfSpellEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SelfSpellEffect.java index 5e9e356d..aa92707d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SelfSpellEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SelfSpellEffect.java @@ -1,13 +1,11 @@ package WayofTime.alchemicalWizardry.api.spell; -public abstract class SelfSpellEffect implements ISelfSpellEffect -{ +public abstract class SelfSpellEffect implements ISelfSpellEffect { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public SelfSpellEffect(int power, int potency, int cost) - { + public SelfSpellEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffect.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffect.java index 1ae52ba6..debc5bea 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffect.java @@ -5,41 +5,34 @@ import net.minecraft.nbt.NBTTagCompound; /** * New wrapper class to enclose the ComplexSpellEffect */ -public class SpellEffect -{ - public ComplexSpellType type; - public ComplexSpellModifier modifier; - - protected int powerEnhancement; +public class SpellEffect { + public ComplexSpellType type; + public ComplexSpellModifier modifier; + + protected int powerEnhancement; protected int costEnhancement; protected int potencyEnhancement; - - public SpellEffect() - { - this(ComplexSpellType.FIRE); + + public SpellEffect() { + this(ComplexSpellType.FIRE); } - - public SpellEffect(ComplexSpellType type) - { - this(type, ComplexSpellModifier.DEFAULT); + + public SpellEffect(ComplexSpellType type) { + this(type, ComplexSpellModifier.DEFAULT); } - - public SpellEffect(ComplexSpellType type, ComplexSpellModifier modifier) - { - this.type = type; - this.modifier = modifier; - - this.powerEnhancement = 0; - this.potencyEnhancement = 0; - this.costEnhancement = 0; + + public SpellEffect(ComplexSpellType type, ComplexSpellModifier modifier) { + this.type = type; + this.modifier = modifier; + + this.powerEnhancement = 0; + this.potencyEnhancement = 0; + this.costEnhancement = 0; } - - public void enhanceEffect(SpellEnhancement enh) - { - if (enh != null) - { - switch (enh.getState()) - { + + public void enhanceEffect(SpellEnhancement enh) { + if (enh != null) { + switch (enh.getState()) { case SpellEnhancement.POWER: this.powerEnhancement++; break; @@ -52,53 +45,48 @@ public class SpellEffect } } } - - public void modifyEffect(ComplexSpellModifier mod) - { - if(mod != null) - { - this.modifier = mod; - } - } - - public void modifyParadigm(SpellParadigm parad) //When modifying the paradigm it will instead get the class name and ask the registry - { - if(parad == null) - { - return; - } - - Class paraClass = parad.getClass(); - - ComplexSpellEffect effect = SpellEffectRegistry.getSpellEffect(paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement); - - if(effect != null) - { - effect.modifyParadigm(parad); + + public void modifyEffect(ComplexSpellModifier mod) { + if (mod != null) { + this.modifier = mod; } } - - public int getCostOfEffect(SpellParadigm parad) - { - if(parad == null) - { - return 0; - } - + + public void modifyParadigm( + SpellParadigm parad) // When modifying the paradigm it will instead get the class name and ask the registry + { + if (parad == null) { + return; + } + Class paraClass = parad.getClass(); - - ComplexSpellEffect effect = SpellEffectRegistry.getSpellEffect(paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement); - - if(effect == null) - { - return 0; - } - - return effect.getCostOfEffect(); + + ComplexSpellEffect effect = SpellEffectRegistry.getSpellEffect( + paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement); + + if (effect != null) { + effect.modifyParadigm(parad); + } } - - public NBTTagCompound getTag() - { + + public int getCostOfEffect(SpellParadigm parad) { + if (parad == null) { + return 0; + } + + Class paraClass = parad.getClass(); + + ComplexSpellEffect effect = SpellEffectRegistry.getSpellEffect( + paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement); + + if (effect == null) { + return 0; + } + + return effect.getCostOfEffect(); + } + + public NBTTagCompound getTag() { NBTTagCompound tag = new NBTTagCompound(); tag.setString("Class", this.getClass().getName()); @@ -111,18 +99,13 @@ public class SpellEffect return tag; } - public static SpellEffect getEffectFromTag(NBTTagCompound tag) - { - try - { + public static SpellEffect getEffectFromTag(NBTTagCompound tag) { + try { Class clazz = Class.forName(tag.getString("Class")); - if (clazz != null) - { - try - { + if (clazz != null) { + try { Object obj = clazz.newInstance(); - if (obj instanceof SpellEffect) - { + if (obj instanceof SpellEffect) { SpellEffect eff = (SpellEffect) obj; eff.type = SpellEffectRegistry.getTypeForKey(tag.getString("type")); @@ -130,48 +113,42 @@ public class SpellEffect eff.powerEnhancement = tag.getInteger("power"); eff.costEnhancement = tag.getInteger("cost"); eff.potencyEnhancement = tag.getInteger("potency"); - + return eff; } - } catch (InstantiationException e) - { + } catch (InstantiationException e) { e.printStackTrace(); - } catch (IllegalAccessException e) - { + } catch (IllegalAccessException e) { e.printStackTrace(); } } - } catch (ClassNotFoundException e) - { + } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; } - public int getPowerEnhancements() - { - return this.powerEnhancement; - } - - public int getPotencyEnhancements() - { - return this.potencyEnhancement; - } - - public int getCostEnhancements() - { - return this.costEnhancement; - } + public int getPowerEnhancements() { + return this.powerEnhancement; + } + + public int getPotencyEnhancements() { + return this.potencyEnhancement; + } + + public int getCostEnhancements() { + return this.costEnhancement; + } } -//package WayofTime.alchemicalWizardry.common.spell.complex.effect; +// package WayofTime.alchemicalWizardry.common.spell.complex.effect; // -//import WayofTime.alchemicalWizardry.common.spell.complex.*; -//import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement; -//import net.minecraft.nbt.NBTTagCompound; +// import WayofTime.alchemicalWizardry.common.spell.complex.*; +// import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement; +// import net.minecraft.nbt.NBTTagCompound; // -//public abstract class SpellEffect -//{ +// public abstract class SpellEffect +// { // protected int modifierState; // protected int powerEnhancement; // protected int costEnhancement; @@ -210,7 +187,8 @@ public class SpellEffect // modifierState = mod.getModifier(); // } // -// public void modifyParadigm(SpellParadigm parad) //When modifying the paradigm it will instead get the class name and ask the registry +// public void modifyParadigm(SpellParadigm parad) //When modifying the paradigm it will instead get the class name +// and ask the registry // { // if (parad instanceof SpellParadigmProjectile) // { @@ -497,4 +475,4 @@ public class SpellEffect // } // return null; // } -//} +// } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java index f217b12a..95b235cd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java @@ -6,152 +6,132 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -public class SpellEffectRegistry -{ - public static Map, List> effectRegistry = new HashMap(); - public static Map typeRegistry = new HashMap(); - public static Map modifierRegistry = new HashMap(); - - public static void registerSpellEffect(Class paraClass, ComplexSpellEffect effect) - { - if(paraClass == null || effect == null) - { - return; - } - - if(effectRegistry.containsKey(paraClass)) - { - List effectList = effectRegistry.get(paraClass); - ComplexSpellType type = effect.getType(); - ComplexSpellModifier modifier = effect.getModifier(); - - if(type == null || modifier == null) - { - return; - } - - for(ComplexSpellEffect eff : effectList) - { - if(type.equals(eff.getType()) && modifier.equals(eff.getModifier())) - { - effectList.remove(eff); - effectList.add(effect); - return; - } - } - - effectList.add(effect); - }else - { - List effectList = new LinkedList(); - effectList.add(effect); - effectRegistry.put(paraClass, effectList); - } - } - - /** - * - * @param paraClass - * @param type - * @param mod - * @return A copy of the spell effect - */ - public static ComplexSpellEffect getSpellEffect(Class paraClass, ComplexSpellType type, ComplexSpellModifier mod) - { - return SpellEffectRegistry.getSpellEffect(paraClass, type, mod, 0, 0, 0); - } - - public static ComplexSpellEffect getSpellEffect(Class paraClass, ComplexSpellType type, ComplexSpellModifier mod, int power, int potency, int cost) - { - if(paraClass == null || type == null || mod == null) - { - return null; - } - - List list = effectRegistry.get(paraClass); - - if(list == null || list.isEmpty()) - { - return null; - } - - for(ComplexSpellEffect effect : list) - { - if(effect != null && type.equals(effect.type) && mod.equals(effect.modifier)) - { - return effect.copy(power, cost, potency); - } - } - - return null; - } - - public static void registerSpellType(String key, ComplexSpellType type) - { - typeRegistry.put(key, type); - } - - public static void registerSpellModifier(String key, ComplexSpellModifier modifier) - { - modifierRegistry.put(key, modifier); - } - - public static ComplexSpellType getTypeForKey(String key) - { - return typeRegistry.get(key); - } - - public static String getKeyForType(ComplexSpellType type) - { - if(type == null) - { - return ""; - } - - for(Entry entry : typeRegistry.entrySet()) - { - if(type.equals(entry.getValue())) - { - return entry.getKey(); - } - } - - return ""; - } - - public static ComplexSpellModifier getModifierForKey(String key) - { - return modifierRegistry.get(key); - } - - public static String getKeyForModifier(ComplexSpellModifier modifier) - { - if(modifier == null) - { - return ""; - } - - for(Entry entry : modifierRegistry.entrySet()) - { - if(modifier.equals(entry.getValue())) - { - return entry.getKey(); - } - } - - return ""; - } - - public static void initiateRegistry() - { - SpellEffectRegistry.registerSpellType("FIRE", ComplexSpellType.FIRE); - SpellEffectRegistry.registerSpellType("ICE", ComplexSpellType.ICE); - SpellEffectRegistry.registerSpellType("EARTH", ComplexSpellType.EARTH); - SpellEffectRegistry.registerSpellType("WIND", ComplexSpellType.WIND); +public class SpellEffectRegistry { + public static Map, List> effectRegistry = new HashMap(); + public static Map typeRegistry = new HashMap(); + public static Map modifierRegistry = new HashMap(); - SpellEffectRegistry.registerSpellModifier("DEFAULT", ComplexSpellModifier.DEFAULT); - SpellEffectRegistry.registerSpellModifier("OFFENSIVE", ComplexSpellModifier.OFFENSIVE); - SpellEffectRegistry.registerSpellModifier("DEFENSIVE", ComplexSpellModifier.DEFENSIVE); - SpellEffectRegistry.registerSpellModifier("ENVIRONMENTAL", ComplexSpellModifier.ENVIRONMENTAL); - } -} \ No newline at end of file + public static void registerSpellEffect(Class paraClass, ComplexSpellEffect effect) { + if (paraClass == null || effect == null) { + return; + } + + if (effectRegistry.containsKey(paraClass)) { + List effectList = effectRegistry.get(paraClass); + ComplexSpellType type = effect.getType(); + ComplexSpellModifier modifier = effect.getModifier(); + + if (type == null || modifier == null) { + return; + } + + for (ComplexSpellEffect eff : effectList) { + if (type.equals(eff.getType()) && modifier.equals(eff.getModifier())) { + effectList.remove(eff); + effectList.add(effect); + return; + } + } + + effectList.add(effect); + } else { + List effectList = new LinkedList(); + effectList.add(effect); + effectRegistry.put(paraClass, effectList); + } + } + + /** + * + * @param paraClass + * @param type + * @param mod + * @return A copy of the spell effect + */ + public static ComplexSpellEffect getSpellEffect( + Class paraClass, ComplexSpellType type, ComplexSpellModifier mod) { + return SpellEffectRegistry.getSpellEffect(paraClass, type, mod, 0, 0, 0); + } + + public static ComplexSpellEffect getSpellEffect( + Class paraClass, + ComplexSpellType type, + ComplexSpellModifier mod, + int power, + int potency, + int cost) { + if (paraClass == null || type == null || mod == null) { + return null; + } + + List list = effectRegistry.get(paraClass); + + if (list == null || list.isEmpty()) { + return null; + } + + for (ComplexSpellEffect effect : list) { + if (effect != null && type.equals(effect.type) && mod.equals(effect.modifier)) { + return effect.copy(power, cost, potency); + } + } + + return null; + } + + public static void registerSpellType(String key, ComplexSpellType type) { + typeRegistry.put(key, type); + } + + public static void registerSpellModifier(String key, ComplexSpellModifier modifier) { + modifierRegistry.put(key, modifier); + } + + public static ComplexSpellType getTypeForKey(String key) { + return typeRegistry.get(key); + } + + public static String getKeyForType(ComplexSpellType type) { + if (type == null) { + return ""; + } + + for (Entry entry : typeRegistry.entrySet()) { + if (type.equals(entry.getValue())) { + return entry.getKey(); + } + } + + return ""; + } + + public static ComplexSpellModifier getModifierForKey(String key) { + return modifierRegistry.get(key); + } + + public static String getKeyForModifier(ComplexSpellModifier modifier) { + if (modifier == null) { + return ""; + } + + for (Entry entry : modifierRegistry.entrySet()) { + if (modifier.equals(entry.getValue())) { + return entry.getKey(); + } + } + + return ""; + } + + public static void initiateRegistry() { + SpellEffectRegistry.registerSpellType("FIRE", ComplexSpellType.FIRE); + SpellEffectRegistry.registerSpellType("ICE", ComplexSpellType.ICE); + SpellEffectRegistry.registerSpellType("EARTH", ComplexSpellType.EARTH); + SpellEffectRegistry.registerSpellType("WIND", ComplexSpellType.WIND); + + SpellEffectRegistry.registerSpellModifier("DEFAULT", ComplexSpellModifier.DEFAULT); + SpellEffectRegistry.registerSpellModifier("OFFENSIVE", ComplexSpellModifier.OFFENSIVE); + SpellEffectRegistry.registerSpellModifier("DEFENSIVE", ComplexSpellModifier.DEFENSIVE); + SpellEffectRegistry.registerSpellModifier("ENVIRONMENTAL", ComplexSpellModifier.ENVIRONMENTAL); + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancement.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancement.java index a7cb6b40..58f54834 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancement.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancement.java @@ -1,20 +1,17 @@ package WayofTime.alchemicalWizardry.api.spell; -public class SpellEnhancement -{ +public class SpellEnhancement { public static final int POWER = 0; public static final int EFFICIENCY = 1; public static final int POTENCY = 2; private int state = POWER; - protected SpellEnhancement(int state) - { + protected SpellEnhancement(int state) { this.state = state; } - public int getState() - { + public int getState() { return this.state; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementCost.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementCost.java index a5ea252d..79d7e573 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementCost.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementCost.java @@ -1,9 +1,7 @@ package WayofTime.alchemicalWizardry.api.spell; -public class SpellEnhancementCost extends SpellEnhancement -{ - public SpellEnhancementCost() - { +public class SpellEnhancementCost extends SpellEnhancement { + public SpellEnhancementCost() { super(SpellEnhancement.EFFICIENCY); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPotency.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPotency.java index 00ffc98f..5eebc4d4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPotency.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPotency.java @@ -1,9 +1,7 @@ package WayofTime.alchemicalWizardry.api.spell; -public class SpellEnhancementPotency extends SpellEnhancement -{ - public SpellEnhancementPotency() - { +public class SpellEnhancementPotency extends SpellEnhancement { + public SpellEnhancementPotency() { super(SpellEnhancement.POTENCY); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPower.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPower.java index d6e27d20..f522da12 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPower.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPower.java @@ -1,9 +1,7 @@ package WayofTime.alchemicalWizardry.api.spell; -public class SpellEnhancementPower extends SpellEnhancement -{ - public SpellEnhancementPower() - { +public class SpellEnhancementPower extends SpellEnhancement { + public SpellEnhancementPower() { super(SpellEnhancement.POWER); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigm.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigm.java index 5423cb4f..75b4b199 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigm.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigm.java @@ -2,88 +2,67 @@ package WayofTime.alchemicalWizardry.api.spell; import java.util.LinkedList; import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public abstract class SpellParadigm -{ +public abstract class SpellParadigm { protected List bufferedEffectList = new LinkedList(); - public void addBufferedEffect(SpellEffect effect) - { - if (effect != null) - { + public void addBufferedEffect(SpellEffect effect) { + if (effect != null) { this.bufferedEffectList.add(effect); } } - public void modifyBufferedEffect(ComplexSpellModifier modifier) - { + public void modifyBufferedEffect(ComplexSpellModifier modifier) { SpellEffect effect = this.getBufferedEffect(); - if (effect != null) - { + if (effect != null) { effect.modifyEffect(modifier); } } - public void applyEnhancement(SpellEnhancement enh) - { - if (enh != null) - { - if (bufferedEffectList.isEmpty()) - { + public void applyEnhancement(SpellEnhancement enh) { + if (enh != null) { + if (bufferedEffectList.isEmpty()) { this.enhanceParadigm(enh); - } else - { + } else { SpellEffect effect = this.getBufferedEffect(); - if (effect != null) - { + if (effect != null) { effect.enhanceEffect(enh); } } } - } public abstract void enhanceParadigm(SpellEnhancement enh); public abstract void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack); - public void applySpellEffect(SpellEffect effect) - { + public void applySpellEffect(SpellEffect effect) { effect.modifyParadigm(this); } - public void applyAllSpellEffects() - { - for (SpellEffect effect : bufferedEffectList) - { + public void applyAllSpellEffects() { + for (SpellEffect effect : bufferedEffectList) { this.applySpellEffect(effect); } } - public SpellEffect getBufferedEffect() - { - if (bufferedEffectList.isEmpty()) - { + public SpellEffect getBufferedEffect() { + if (bufferedEffectList.isEmpty()) { return null; - } else - { + } else { return bufferedEffectList.get(bufferedEffectList.size() - 1); } } - public int getTotalCost() - { + public int getTotalCost() { int cost = 0; - if (this.bufferedEffectList != null && !this.bufferedEffectList.isEmpty()) - { - for(SpellEffect effect : bufferedEffectList) - { - cost += effect.getCostOfEffect(this); - } + if (this.bufferedEffectList != null && !this.bufferedEffectList.isEmpty()) { + for (SpellEffect effect : bufferedEffectList) { + cost += effect.getCostOfEffect(this); + } return (int) (cost * Math.sqrt(this.bufferedEffectList.size())); } @@ -93,36 +72,30 @@ public abstract class SpellParadigm public abstract int getDefaultCost(); - public int getBufferedEffectPower() - { + public int getBufferedEffectPower() { SpellEffect eff = this.getBufferedEffect(); - if (eff != null) - { + if (eff != null) { return eff.getPowerEnhancements(); } return 0; } - public int getBufferedEffectCost() - { + public int getBufferedEffectCost() { SpellEffect eff = this.getBufferedEffect(); - if (eff != null) - { + if (eff != null) { return eff.getCostEnhancements(); } return 0; } - public int getBufferedEffectPotency() - { + public int getBufferedEffectPotency() { SpellEffect eff = this.getBufferedEffect(); - if (eff != null) - { + if (eff != null) { return eff.getPotencyEnhancements(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java index 629f7dba..dc0fe2f1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java @@ -1,70 +1,55 @@ package WayofTime.alchemicalWizardry.api.spell; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import java.util.ArrayList; import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -public class SpellParadigmMelee extends SpellParadigm -{ +public class SpellParadigmMelee extends SpellParadigm { private List entityEffectList; private List worldEffectList; - public SpellParadigmMelee() - { + public SpellParadigmMelee() { this.entityEffectList = new ArrayList(); this.worldEffectList = new ArrayList(); } @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } + public void enhanceParadigm(SpellEnhancement enh) {} @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) - { - int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) - { - return; + public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) { + int cost = this.getTotalCost(); + + if (!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) { + return; } - - for (IMeleeSpellEntityEffect effect : entityEffectList) - { + + for (IMeleeSpellEntityEffect effect : entityEffectList) { effect.onEntityImpact(world, entityPlayer); } - for (IMeleeSpellWorldEffect effect : worldEffectList) - { + for (IMeleeSpellWorldEffect effect : worldEffectList) { effect.onWorldEffect(world, entityPlayer); } } - public void addEntityEffect(IMeleeSpellEntityEffect eff) - { - if (eff != null) - { + public void addEntityEffect(IMeleeSpellEntityEffect eff) { + if (eff != null) { this.entityEffectList.add(eff); } } - public void addWorldEffect(IMeleeSpellWorldEffect eff) - { - if (eff != null) - { + public void addWorldEffect(IMeleeSpellWorldEffect eff) { + if (eff != null) { this.worldEffectList.add(eff); } } @Override - public int getDefaultCost() - { + public int getDefaultCost() { return 0; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java index 8b6f6a31..bc2cb40c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java @@ -1,16 +1,14 @@ package WayofTime.alchemicalWizardry.api.spell; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import java.util.ArrayList; import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -public class SpellParadigmProjectile extends SpellParadigm -{ +public class SpellParadigmProjectile extends SpellParadigm { public DamageSource damageSource; public float damage; public int cost; @@ -20,8 +18,7 @@ public class SpellParadigmProjectile extends SpellParadigm public int ricochetMax; public boolean isSilkTouch; - public SpellParadigmProjectile() - { + public SpellParadigmProjectile() { this.damageSource = DamageSource.generic; this.damage = 1; this.cost = 0; @@ -33,40 +30,32 @@ public class SpellParadigmProjectile extends SpellParadigm } @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } + public void enhanceParadigm(SpellEnhancement enh) {} @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) - { - int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) - { - return; + public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) { + int cost = this.getTotalCost(); + + if (!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) { + return; } - + EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer); this.prepareProjectile(proj); world.spawnEntityInWorld(proj); } - public static SpellParadigmProjectile getParadigmForEffectArray(List effectList) - { + public static SpellParadigmProjectile getParadigmForEffectArray(List effectList) { SpellParadigmProjectile parad = new SpellParadigmProjectile(); - for (SpellEffect eff : effectList) - { + for (SpellEffect eff : effectList) { parad.addBufferedEffect(eff); } return parad; } - public void prepareProjectile(EntitySpellProjectile proj) - { + public void prepareProjectile(EntitySpellProjectile proj) { proj.setDamage(damage); proj.setImpactList(impactList); proj.setUpdateEffectList(updateEffectList); @@ -76,26 +65,20 @@ public class SpellParadigmProjectile extends SpellParadigm proj.setSpellEffectList(bufferedEffectList); } - public void addImpactEffect(IProjectileImpactEffect eff) - { - if (eff != null) - { + public void addImpactEffect(IProjectileImpactEffect eff) { + if (eff != null) { this.impactList.add(eff); } } - public void addUpdateEffect(IProjectileUpdateEffect eff) - { - if (eff != null) - { + public void addUpdateEffect(IProjectileUpdateEffect eff) { + if (eff != null) { this.updateEffectList.add(eff); } } @Override - public int getDefaultCost() - { + public int getDefaultCost() { return 50; } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java index 89cffe07..4890c770 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java @@ -1,58 +1,45 @@ package WayofTime.alchemicalWizardry.api.spell; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import java.util.ArrayList; import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -public class SpellParadigmSelf extends SpellParadigm -{ +public class SpellParadigmSelf extends SpellParadigm { public List selfSpellEffectList; - public SpellParadigmSelf() - { + public SpellParadigmSelf() { selfSpellEffectList = new ArrayList(); } @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } + public void enhanceParadigm(SpellEnhancement enh) {} @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) - { + public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) { this.applyAllSpellEffects(); - + int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) - { - return; + + if (!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) { + return; } - for (ISelfSpellEffect eff : selfSpellEffectList) - { + for (ISelfSpellEffect eff : selfSpellEffectList) { eff.onSelfUse(world, entityPlayer); } } - public void addSelfSpellEffect(ISelfSpellEffect eff) - { - if (eff != null) - { + public void addSelfSpellEffect(ISelfSpellEffect eff) { + if (eff != null) { this.selfSpellEffectList.add(eff); } } @Override - public int getDefaultCost() - { + public int getDefaultCost() { return 100; } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java index e407ef24..a3cd777c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java @@ -1,11 +1,12 @@ package WayofTime.alchemicalWizardry.api.spell; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map.Entry; import java.util.Set; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -15,11 +16,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -public class SpellParadigmTool extends SpellParadigm -{ +public class SpellParadigmTool extends SpellParadigm { private List leftClickEffectList; private List rightClickEffectList; private List toolUpdateEffectList; @@ -42,11 +40,10 @@ public class SpellParadigmTool extends SpellParadigm private boolean silkTouch; private int duration; - + public static Item customTool; - public SpellParadigmTool() - { + public SpellParadigmTool() { this.leftClickEffectList = new LinkedList(); this.rightClickEffectList = new LinkedList(); this.toolUpdateEffectList = new LinkedList(); @@ -81,24 +78,18 @@ public class SpellParadigmTool extends SpellParadigm } @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } + public void enhanceParadigm(SpellEnhancement enh) {} @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack crystal) - { - if (entityPlayer.worldObj.isRemote) - { + public void castSpell(World world, EntityPlayer entityPlayer, ItemStack crystal) { + if (entityPlayer.worldObj.isRemote) { return; } int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(crystal, entityPlayer, cost)) - { - return; + + if (!SoulNetworkHandler.syphonAndDamageFromNetwork(crystal, entityPlayer, cost)) { + return; } ItemStack toolStack = this.prepareTool(crystal, world); @@ -112,8 +103,7 @@ public class SpellParadigmTool extends SpellParadigm * @param crystalStack * @return stack containing the new multitool */ - public ItemStack prepareTool(ItemStack crystalStack, World world) - { + public ItemStack prepareTool(ItemStack crystalStack, World world) { ItemStack toolStack = new ItemStack(customTool, 1); ItemSpellMultiTool itemTool = (ItemSpellMultiTool) customTool; @@ -122,8 +112,7 @@ public class SpellParadigmTool extends SpellParadigm Set> harvestLevelSet = this.harvestLevel.entrySet(); - for (Entry testMap : harvestLevelSet) - { + for (Entry testMap : harvestLevelSet) { String tool = testMap.getKey(); int level = testMap.getValue(); @@ -132,8 +121,7 @@ public class SpellParadigmTool extends SpellParadigm Set> digSpeedSet = this.digSpeed.entrySet(); - for (Entry testMap : digSpeedSet) - { + for (Entry testMap : digSpeedSet) { String tool = testMap.getKey(); float speed = testMap.getValue(); @@ -143,13 +131,11 @@ public class SpellParadigmTool extends SpellParadigm itemTool.setFortuneLevel(toolStack, getFortuneLevel()); itemTool.setSilkTouch(toolStack, this.getSilkTouch()); - if (this.getSilkTouch()) - { + if (this.getSilkTouch()) { this.addToolString("SilkTouch", "Silk Touch" + " " + APISpellHelper.getNumeralForInt(1)); } - if (this.getFortuneLevel() > 0) - { + if (this.getFortuneLevel() > 0) { this.addToolString("Fortune", "Fortune" + " " + APISpellHelper.getNumeralForInt(this.getFortuneLevel())); } @@ -157,15 +143,13 @@ public class SpellParadigmTool extends SpellParadigm List toolStringList = new LinkedList(); - for (String str : this.toolInfoString.values()) - { + for (String str : this.toolInfoString.values()) { toolStringList.add(str); } itemTool.setToolListString(toolStack, toolStringList); - for (Integer integ : this.durationHash.values()) - { + for (Integer integ : this.durationHash.values()) { this.duration += integ; } @@ -180,17 +164,14 @@ public class SpellParadigmTool extends SpellParadigm } @Override - public int getDefaultCost() - { + public int getDefaultCost() { return 100; } - public static SpellParadigmTool getParadigmForEffectArray(List effectList) - { + public static SpellParadigmTool getParadigmForEffectArray(List effectList) { SpellParadigmTool parad = new SpellParadigmTool(); - for (SpellEffect eff : effectList) - { + for (SpellEffect eff : effectList) { parad.addBufferedEffect(eff); } @@ -199,161 +180,136 @@ public class SpellParadigmTool extends SpellParadigm return parad; } - public void addLeftClickEffect(ILeftClickEffect eff) - { - if (eff != null) - { + public void addLeftClickEffect(ILeftClickEffect eff) { + if (eff != null) { this.leftClickEffectList.add(eff); } } - public void addRightClickEffect(IRightClickEffect eff) - { - if (eff != null) - { + public void addRightClickEffect(IRightClickEffect eff) { + if (eff != null) { this.rightClickEffectList.add(eff); } } - public void addUpdateEffect(IToolUpdateEffect eff) - { - if (eff != null) - { + public void addUpdateEffect(IToolUpdateEffect eff) { + if (eff != null) { this.toolUpdateEffectList.add(eff); } } - public void addToolSummonEffect(IOnSummonTool eff) - { - if (eff != null) - { + public void addToolSummonEffect(IOnSummonTool eff) { + if (eff != null) { this.toolSummonEffectList.add(eff); } } - public void addToolBanishEffect(IOnBanishTool eff) - { - if (eff != null) - { + public void addToolBanishEffect(IOnBanishTool eff) { + if (eff != null) { this.toolBanishEffectList.add(eff); } } - public void addBlockBreakEffect(IOnBreakBlock eff) - { - if (eff != null) - { + public void addBlockBreakEffect(IOnBreakBlock eff) { + if (eff != null) { this.breakBlockEffectList.add(eff); } } - public void addItemManipulatorEffect(IItemManipulator eff) - { - if (eff != null) - { + public void addItemManipulatorEffect(IItemManipulator eff) { + if (eff != null) { this.itemManipulatorEffectList.add(eff); } } - public void addDigAreaEffect(IDigAreaEffect eff) - { - if (eff != null) - { + public void addDigAreaEffect(IDigAreaEffect eff) { + if (eff != null) { this.digAreaEffectList.add(eff); } } - public void addSpecialDamageEffect(ISpecialDamageEffect eff) - { - if (eff != null) - { + public void addSpecialDamageEffect(ISpecialDamageEffect eff) { + if (eff != null) { this.specialDamageEffectList.add(eff); } } - public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) - { + public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) { int total = 0; - for (ILeftClickEffect effect : this.leftClickEffectList) - { + for (ILeftClickEffect effect : this.leftClickEffectList) { total += effect.onLeftClickEntity(stack, attacked, weilder); } return total; } - public int onRightClickBlock(ItemStack toolStack, EntityLivingBase weilder, World world, MovingObjectPosition mop) - { + public int onRightClickBlock(ItemStack toolStack, EntityLivingBase weilder, World world, MovingObjectPosition mop) { int total = 0; - for (IRightClickEffect effect : this.rightClickEffectList) - { + for (IRightClickEffect effect : this.rightClickEffectList) { total += effect.onRightClickBlock(toolStack, weilder, world, mop); } return total; } - public int onRightClickAir(ItemStack toolStack, World world, EntityPlayer player) - { + public int onRightClickAir(ItemStack toolStack, World world, EntityPlayer player) { int total = 0; - for (IRightClickEffect effect : this.rightClickEffectList) - { + for (IRightClickEffect effect : this.rightClickEffectList) { total += effect.onRightClickAir(toolStack, player); } return total; } - public int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand) - { + public int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand) { int total = 0; - for (IToolUpdateEffect effect : this.toolUpdateEffectList) - { + for (IToolUpdateEffect effect : this.toolUpdateEffectList) { total += effect.onUpdate(toolStack, world, par3Entity, invSlot, inHand); } return total; } - public int onSummonTool(ItemStack toolStack, World world, Entity entity) - { + public int onSummonTool(ItemStack toolStack, World world, Entity entity) { int total = 0; - for (IOnSummonTool effect : this.toolSummonEffectList) - { + for (IOnSummonTool effect : this.toolSummonEffectList) { total += effect.onSummonTool(toolStack, world, entity); } return total; } - public int onBanishTool(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand) - { + public int onBanishTool(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand) { int total = 0; - for (IOnBanishTool effect : this.toolBanishEffectList) - { + for (IOnBanishTool effect : this.toolBanishEffectList) { total += effect.onBanishTool(toolStack, world, entity, invSlot, inHand); } return total; } - public int onBreakBlock(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken) - { + public int onBreakBlock( + ItemStack container, + World world, + EntityPlayer player, + Block block, + int meta, + int x, + int y, + int z, + ForgeDirection sideBroken) { int total = 0; - for (IOnBreakBlock effect : this.breakBlockEffectList) - { + for (IOnBreakBlock effect : this.breakBlockEffectList) { total += effect.onBlockBroken(container, world, player, block, meta, x, y, z, sideBroken); } return total; } - public List handleItemList(ItemStack toolStack, List items) - { + public List handleItemList(ItemStack toolStack, List items) { List heldList = items; - for (IItemManipulator eff : this.itemManipulatorEffectList) - { + for (IItemManipulator eff : this.itemManipulatorEffectList) { List newHeldList = eff.handleItemsOnBlockBroken(toolStack, heldList); heldList = newHeldList; } @@ -361,122 +317,109 @@ public class SpellParadigmTool extends SpellParadigm return heldList; } - public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool) - { + public int digSurroundingArea( + ItemStack container, + World world, + EntityPlayer player, + MovingObjectPosition blockPos, + String usedToolClass, + float blockHardness, + int harvestLvl, + ItemSpellMultiTool itemTool) { int cost = 0; - for (IDigAreaEffect effect : this.digAreaEffectList) - { - cost += effect.digSurroundingArea(container, world, player, blockPos, usedToolClass, blockHardness, harvestLvl, itemTool); + for (IDigAreaEffect effect : this.digAreaEffectList) { + cost += effect.digSurroundingArea( + container, world, player, blockPos, usedToolClass, blockHardness, harvestLvl, itemTool); } return cost; } - public int getFortuneLevel() - { + public int getFortuneLevel() { return this.fortuneLevel; } - public void setFortuneLevel(int fortuneLevel) - { + public void setFortuneLevel(int fortuneLevel) { this.fortuneLevel = fortuneLevel; } - public boolean getSilkTouch() - { + public boolean getSilkTouch() { return this.silkTouch; } - public void setSilkTouch(boolean silkTouch) - { + public void setSilkTouch(boolean silkTouch) { this.silkTouch = silkTouch; } - public int getDuration() - { + public int getDuration() { return this.duration; } - public void setDuration(int duration) - { + public void setDuration(int duration) { this.duration = duration; } - public void setDigSpeed(String toolClass, float digSpeed) - { + public void setDigSpeed(String toolClass, float digSpeed) { this.digSpeed.put(toolClass, digSpeed); } - public void setHarvestLevel(String toolClass, int hlvl) - { + public void setHarvestLevel(String toolClass, int hlvl) { this.harvestLevel.put(toolClass, hlvl); } - public float composeMaxDamageFromHash() - { + public float composeMaxDamageFromHash() { float damage = 0.0f; - for (float f : this.maxDamageHash.values()) - { + for (float f : this.maxDamageHash.values()) { damage += f; } return damage; } - public void addDamageToHash(String key, float dmg) - { + public void addDamageToHash(String key, float dmg) { this.maxDamageHash.put(key, dmg); } - public void addToolString(String key, String str) - { - if (str != null && key != null) - { + public void addToolString(String key, String str) { + if (str != null && key != null) { this.toolInfoString.put(key, str); } } - public void addCritChance(String key, float chance) - { - //Chance is in percentage chance i.e. chance = 1.0 means 1.0% + public void addCritChance(String key, float chance) { + // Chance is in percentage chance i.e. chance = 1.0 means 1.0% this.critChanceHash.put(key, chance); } - public void addDuration(String key, int dur) - { + public void addDuration(String key, int dur) { this.durationHash.put(key, dur); } - public float getCritChance() - { + public float getCritChance() { float chance = 0.0f; - for (float fl : this.critChanceHash.values()) - { + for (float fl : this.critChanceHash.values()) { chance += fl; } return chance; } - public float getAddedDamageForEntity(Entity entity) - { + public float getAddedDamageForEntity(Entity entity) { HashMap hash = new HashMap(); - for (ISpecialDamageEffect effect : this.specialDamageEffectList) - { + for (ISpecialDamageEffect effect : this.specialDamageEffectList) { hash.put(effect.getKey(), effect.getDamageForEntity(entity)); } float addedDmg = 0.0f; - for (float fl : hash.values()) - { + for (float fl : hash.values()) { addedDmg += fl; } return addedDmg; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningHelper.java b/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningHelper.java index 84c4d3a7..c8265564 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningHelper.java @@ -3,19 +3,16 @@ package WayofTime.alchemicalWizardry.api.summoningRegistry; import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; -public abstract class SummoningHelper -{ +public abstract class SummoningHelper { protected String id; - public SummoningHelper(String id) - { + public SummoningHelper(String id) { this.id = id; } public abstract EntityLivingBase getEntity(World worldObj); - public String getSummoningHelperID() - { + public String getSummoningHelperID() { return id; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistry.java index 18180d8c..a6c53f7d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistry.java @@ -1,27 +1,30 @@ package WayofTime.alchemicalWizardry.api.summoningRegistry; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class SummoningRegistry -{ +public class SummoningRegistry { public static List summoningList = new ArrayList(); - public static void registerSummon(SummoningHelper s, ItemStack[] ring1, ItemStack[] ring2, ItemStack[] ring3, int amountUsed, int bloodOrbLevel) - { + public static void registerSummon( + SummoningHelper s, + ItemStack[] ring1, + ItemStack[] ring2, + ItemStack[] ring3, + int amountUsed, + int bloodOrbLevel) { summoningList.add(new SummoningRegistryComponent(s, ring1, ring2, ring3, amountUsed, bloodOrbLevel)); } - public static boolean isRecipeValid(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3)) - { + public static boolean isRecipeValid(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) { + for (SummoningRegistryComponent src : summoningList) { + if (src.getBloodOrbLevel() <= bloodOrbLevel + && src.compareRing(1, test1) + && src.compareRing(2, test2) + && src.compareRing(3, test3)) { return true; } } @@ -29,12 +32,13 @@ public class SummoningRegistry return false; } - public static SummoningRegistryComponent getRegistryComponent(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3)) - { + public static SummoningRegistryComponent getRegistryComponent( + int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) { + for (SummoningRegistryComponent src : summoningList) { + if (src.getBloodOrbLevel() <= bloodOrbLevel + && src.compareRing(1, test1) + && src.compareRing(2, test2) + && src.compareRing(3, test3)) { return src; } } @@ -42,12 +46,13 @@ public class SummoningRegistry return null; } - public static EntityLivingBase getEntity(World worldObj, int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3)) - { + public static EntityLivingBase getEntity( + World worldObj, int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) { + for (SummoningRegistryComponent src : summoningList) { + if (src.getBloodOrbLevel() <= bloodOrbLevel + && src.compareRing(1, test1) + && src.compareRing(2, test2) + && src.compareRing(3, test3)) { return src.getEntity(worldObj); } } @@ -55,12 +60,9 @@ public class SummoningRegistry return null; } - public static EntityLivingBase getEntityWithID(World worldObj, String id) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getSummoningHelperID().equals(id)) - { + public static EntityLivingBase getEntityWithID(World worldObj, String id) { + for (SummoningRegistryComponent src : summoningList) { + if (src.getSummoningHelperID().equals(id)) { return src.getEntity(worldObj); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistryComponent.java b/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistryComponent.java index 72dbd838..5066a120 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistryComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistryComponent.java @@ -6,8 +6,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -public class SummoningRegistryComponent -{ +public class SummoningRegistryComponent { public ItemStack[] ring1 = new ItemStack[6]; public ItemStack[] ring2 = new ItemStack[6]; public ItemStack[] ring3 = new ItemStack[6]; @@ -15,8 +14,13 @@ public class SummoningRegistryComponent public int summoningCost; public int bloodOrbLevel; - public SummoningRegistryComponent(SummoningHelper s, ItemStack[] newRing1, ItemStack[] newRing2, ItemStack[] newRing3, int amount, int bloodOrbLevel) - { + public SummoningRegistryComponent( + SummoningHelper s, + ItemStack[] newRing1, + ItemStack[] newRing2, + ItemStack[] newRing3, + int amount, + int bloodOrbLevel) { this.summoningHelper = s; this.ring1 = newRing1; this.ring2 = newRing2; @@ -24,17 +28,13 @@ public class SummoningRegistryComponent this.summoningCost = amount; this.bloodOrbLevel = bloodOrbLevel; - if (this.ring1.length != 6) - { + if (this.ring1.length != 6) { ItemStack[] newRecipe = new ItemStack[6]; - for (int i = 0; i < 6; i++) - { - if (i + 1 > this.ring1.length) - { + for (int i = 0; i < 6; i++) { + if (i + 1 > this.ring1.length) { newRecipe[i] = null; - } else - { + } else { newRecipe[i] = this.ring1[i]; } } @@ -42,17 +42,13 @@ public class SummoningRegistryComponent this.ring1 = newRecipe; } - if (this.ring2.length != 6) - { + if (this.ring2.length != 6) { ItemStack[] newRecipe = new ItemStack[6]; - for (int i = 0; i < 6; i++) - { - if (i + 1 > this.ring2.length) - { + for (int i = 0; i < 6; i++) { + if (i + 1 > this.ring2.length) { newRecipe[i] = null; - } else - { + } else { newRecipe[i] = this.ring2[i]; } } @@ -60,17 +56,13 @@ public class SummoningRegistryComponent this.ring2 = newRecipe; } - if (this.ring3.length != 6) - { + if (this.ring3.length != 6) { ItemStack[] newRecipe = new ItemStack[6]; - for (int i = 0; i < 6; i++) - { - if (i + 1 > this.ring3.length) - { + for (int i = 0; i < 6; i++) { + if (i + 1 > this.ring3.length) { newRecipe[i] = null; - } else - { + } else { newRecipe[i] = this.ring3[i]; } } @@ -79,17 +71,14 @@ public class SummoningRegistryComponent } } - public boolean compareRing(int ring, ItemStack[] checkedRingRecipe) - { + public boolean compareRing(int ring, ItemStack[] checkedRingRecipe) { ItemStack[] recipe; - if (checkedRingRecipe.length < 6) - { + if (checkedRingRecipe.length < 6) { return false; } - switch (ring) - { + switch (ring) { case 1: recipe = ring1; break; @@ -106,17 +95,13 @@ public class SummoningRegistryComponent recipe = ring1; } - if (recipe.length != 6) - { + if (recipe.length != 6) { ItemStack[] newRecipe = new ItemStack[6]; - for (int i = 0; i < 6; i++) - { - if (i + 1 > recipe.length) - { + for (int i = 0; i < 6; i++) { + if (i + 1 > recipe.length) { newRecipe[i] = null; - } else - { + } else { newRecipe[i] = recipe[i]; } } @@ -126,64 +111,54 @@ public class SummoningRegistryComponent boolean[] checkList = new boolean[6]; - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { checkList[i] = false; } - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { ItemStack recipeItemStack = recipe[i]; - if (recipeItemStack == null) - { + if (recipeItemStack == null) { continue; } boolean test = false; - for (int j = 0; j < 6; j++) - { - if (checkList[j]) - { + for (int j = 0; j < 6; j++) { + if (checkList[j]) { continue; } ItemStack checkedItemStack = checkedRingRecipe[j]; - if (checkedItemStack == null) - { + if (checkedItemStack == null) { continue; } boolean quickTest = false; - if (recipeItemStack.getItem() instanceof ItemBlock) - { - if (checkedItemStack.getItem() instanceof ItemBlock) - { + if (recipeItemStack.getItem() instanceof ItemBlock) { + if (checkedItemStack.getItem() instanceof ItemBlock) { quickTest = true; } - } else if (!(checkedItemStack.getItem() instanceof ItemBlock)) - { + } else if (!(checkedItemStack.getItem() instanceof ItemBlock)) { quickTest = true; } - if (!quickTest) - { + if (!quickTest) { continue; } - if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem()) - { + if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() + || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) + && checkedItemStack.getItem() == recipeItemStack.getItem()) { test = true; checkList[j] = true; break; } } - if (!test) - { + if (!test) { return false; } } @@ -191,25 +166,20 @@ public class SummoningRegistryComponent return true; } - public int getSummoningCost() - { + public int getSummoningCost() { return summoningCost; } - public EntityLivingBase getEntity(World world) - { + public EntityLivingBase getEntity(World world) { return this.summoningHelper.getEntity(world); } - public int getBloodOrbLevel() - { + public int getBloodOrbLevel() { return this.bloodOrbLevel; } - public ItemStack[] getRingRecipeForRing(int ring) - { - switch (ring) - { + public ItemStack[] getRingRecipeForRing(int ring) { + switch (ring) { case 1: return ring1; @@ -224,8 +194,7 @@ public class SummoningRegistryComponent } } - public String getSummoningHelperID() - { + public String getSummoningHelperID() { return this.summoningHelper.getSummoningHelperID(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/tile/IBloodAltar.java b/src/main/java/WayofTime/alchemicalWizardry/api/tile/IBloodAltar.java index eaee5700..10c3dc89 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/tile/IBloodAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/tile/IBloodAltar.java @@ -3,8 +3,7 @@ package WayofTime.alchemicalWizardry.api.tile; /** * Created by Pokefenn. */ -public interface IBloodAltar -{ +public interface IBloodAltar { int getCapacity(); int getCurrentBlood(); @@ -23,20 +22,20 @@ public interface IBloodAltar int getBufferCapacity(); - void sacrificialDaggerCall(int amount, boolean b); + void sacrificialDaggerCall(int amount, boolean b); - void startCycle(); - - /** - * Will set the altar to initiate a cooldown cycle after it crafts before starting to craft again, giving the user time to interact with the altar. - * This can only be set while the altar is not active. - * @param amount - */ - void requestPauseAfterCrafting(int amount); - - void addToDemonBloodDuration(int dur); - - boolean hasDemonBlood(); - - void decrementDemonBlood(); + void startCycle(); + + /** + * Will set the altar to initiate a cooldown cycle after it crafts before starting to craft again, giving the user time to interact with the altar. + * This can only be set while the altar is not active. + * @param amount + */ + void requestPauseAfterCrafting(int amount); + + void addToDemonBloodDuration(int dur); + + boolean hasDemonBlood(); + + void decrementDemonBlood(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellParadigmTile.java b/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellParadigmTile.java index 97af71d2..59210cc5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellParadigmTile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellParadigmTile.java @@ -4,7 +4,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface ISpellParadigmTile extends ISpellTile -{ - void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack); +public interface ISpellParadigmTile extends ISpellTile { + void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellTile.java b/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellTile.java index c5d868e0..b7b2c642 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellTile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/tile/ISpellTile.java @@ -1,11 +1,10 @@ package WayofTime.alchemicalWizardry.api.tile; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; +import net.minecraftforge.common.util.ForgeDirection; -public interface ISpellTile -{ - void modifySpellParadigm(SpellParadigm parad); - - boolean canInputRecieveOutput(ForgeDirection output); +public interface ISpellTile { + void modifySpellParadigm(SpellParadigm parad); + + boolean canInputRecieveOutput(ForgeDirection output); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/ClientEventHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/ClientEventHandler.java index 71e6d416..e90cd8cb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/ClientEventHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/ClientEventHandler.java @@ -1,10 +1,5 @@ package WayofTime.alchemicalWizardry.client; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.RenderBlockOverlayEvent; -import net.minecraftforge.client.event.sound.SoundEvent; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.client.renderer.RenderHelper; @@ -14,101 +9,99 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.RenderBlockOverlayEvent; +import net.minecraftforge.client.event.sound.SoundEvent; -public class ClientEventHandler -{ +public class ClientEventHandler { private Minecraft mc = FMLClientHandler.instance().getClient(); - + public static ResourceLocation currentPlayerTexture = null; -// @SideOnly(Side.CLIENT) -// @SubscribeEvent -// public void renderPOVArmour(RenderHandEvent event) -// { -// if (this.mc.thePlayer.worldObj.isRemote && this.mc.gameSettings.thirdPersonView == 0 && !this.mc.renderViewEntity.isPlayerSleeping() && !this.mc.gameSettings.hideGUI && !this.mc.playerController.enableEverythingIsScrewedUpMode()) -// { -// currentPlayerTexture = ((AbstractClientPlayer) mc.thePlayer).getLocationSkin(); -// -// ClientUtils.renderPlayerArmourInPOV(mc.thePlayer, event.partialTicks); -// event.setCanceled(true); -// } -// } - -// @SubscribeEvent(priority = EventPriority.LOWEST) -// public void onPlayerRenderTick(RenderPlayerEvent.Pre event) -// { -// ModelBiped model = ((BoundArmour)ModItems.boundPlate).getArmorModel(event.entityPlayer, new ItemStack(ModItems.boundPlate), 2); -// String texture = ((BoundArmour)ModItems.boundPlate).getArmorTexture(new ItemStack(ModItems.boundPlate), event.entityPlayer, 2, ""); -// -// ResourceLocation resourcelocation = new ResourceLocation(texture); -// event.renderer.modelBipedMain.bipedBody.addChild(model.bipedBody); -// Minecraft.getMinecraft().renderEngine.bindTexture(resourcelocation); -// -// } - + // @SideOnly(Side.CLIENT) + // @SubscribeEvent + // public void renderPOVArmour(RenderHandEvent event) + // { + // if (this.mc.thePlayer.worldObj.isRemote && this.mc.gameSettings.thirdPersonView == 0 && + // !this.mc.renderViewEntity.isPlayerSleeping() && !this.mc.gameSettings.hideGUI && + // !this.mc.playerController.enableEverythingIsScrewedUpMode()) + // { + // currentPlayerTexture = ((AbstractClientPlayer) mc.thePlayer).getLocationSkin(); + // + // ClientUtils.renderPlayerArmourInPOV(mc.thePlayer, event.partialTicks); + // event.setCanceled(true); + // } + // } + + // @SubscribeEvent(priority = EventPriority.LOWEST) + // public void onPlayerRenderTick(RenderPlayerEvent.Pre event) + // { + // ModelBiped model = ((BoundArmour)ModItems.boundPlate).getArmorModel(event.entityPlayer, new + // ItemStack(ModItems.boundPlate), 2); + // String texture = ((BoundArmour)ModItems.boundPlate).getArmorTexture(new ItemStack(ModItems.boundPlate), + // event.entityPlayer, 2, ""); + // + // ResourceLocation resourcelocation = new ResourceLocation(texture); + // event.renderer.modelBipedMain.bipedBody.addChild(model.bipedBody); + // Minecraft.getMinecraft().renderEngine.bindTexture(resourcelocation); + // + // } + @SubscribeEvent - public void onKeyInput(InputEvent.KeyInputEvent event) - { -// if(KeyBindings.omegaTest.isPressed()) -// { -// System.out.println("ping"); -//// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2)); -// ClientToServerPacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE)); -// } + public void onKeyInput(InputEvent.KeyInputEvent event) { + // if(KeyBindings.omegaTest.isPressed()) + // { + // System.out.println("ping"); + //// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2)); + // ClientToServerPacketHandler.INSTANCE.sendToServer(new + // MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE)); + // } } - + @SubscribeEvent - public void onPlayerSoundEvent(SoundEvent event) - { - if (Minecraft.getMinecraft() != null) - { + public void onPlayerSoundEvent(SoundEvent event) { + if (Minecraft.getMinecraft() != null) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf)) - { + if (player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf)) { event.setResult(Result.DENY); - if(event.isCancelable()) - event.setCanceled(true); + if (event.isCancelable()) event.setCanceled(true); } } } - - @SubscribeEvent - public void onOverlayEvent(RenderBlockOverlayEvent event) - { - if(event.overlayType == RenderBlockOverlayEvent.OverlayType.WATER && event.player.isPotionActive(AlchemicalWizardry.customPotionAmphibian.id))//TODO Placeholder for new potion effect - if(event.isCancelable()) - { - event.setCanceled(true); - } - - if(event.blockForOverlay == ModBlocks.blockMimic && event.isCancelable()) - { - event.setCanceled(true); - } - } @SubscribeEvent - public void onTick(RenderTickEvent event) - { - if (event.phase.equals(Phase.START)) - return; - - if (!RenderHelper.onTickInGame(mc)) - { + public void onOverlayEvent(RenderBlockOverlayEvent event) { + if (event.overlayType == RenderBlockOverlayEvent.OverlayType.WATER + && event.player.isPotionActive( + AlchemicalWizardry.customPotionAmphibian.id)) // TODO Placeholder for new potion effect + if (event.isCancelable()) { + event.setCanceled(true); + } + if (event.blockForOverlay == ModBlocks.blockMimic && event.isCancelable()) { + event.setCanceled(true); } } -// @SubscribeEvent -// public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event) -// { -// GL11.glDisable(2929); -// } -// -// @SubscribeEvent -// public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event) -// { -// GL11.glEnable(2929); -// } + @SubscribeEvent + public void onTick(RenderTickEvent event) { + if (event.phase.equals(Phase.START)) return; + + if (!RenderHelper.onTickInGame(mc)) {} + } + + // @SubscribeEvent + // public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event) + // { + // GL11.glDisable(2929); + // } + // + // @SubscribeEvent + // public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event) + // { + // GL11.glEnable(2929); + // } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java b/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java index db2fb9d6..e9b26fd1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java @@ -1,9 +1,5 @@ package WayofTime.alchemicalWizardry.client; -import net.minecraft.item.ItemBlock; -import net.minecraft.world.World; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.common.MinecraftForge; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile; @@ -101,50 +97,82 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; +import net.minecraft.item.ItemBlock; +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 { public static int renderPass; @Override - public void registerPostSideObjects() - { -// BUEntries entries = new BUEntries(); -// entries.postInit(); + public void registerPostSideObjects() { + // BUEntries entries = new BUEntries(); + // entries.postInit(); } - + @Override - public void registerRenderers() - { - RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile()); - RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile()); - RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile()); + public void registerRenderers() { + RenderingRegistry.registerEntityRenderingHandler( + EnergyBlastProjectile.class, new RenderEnergyBlastProjectile()); + RenderingRegistry.registerEntityRenderingHandler( + EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile()); + RenderingRegistry.registerEntityRenderingHandler( + EntitySpellProjectile.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityParticleBeam.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor()); - RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityLowerGuardian.class, new RenderLowerGuardian(new ModelLowerGuardian(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityBileDemon.class, new RenderBileDemon(new ModelBileDemon(), 1.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityWingedFireDemon.class, new RenderWingedFireDemon(new ModelWingedFireDemon(), 1.0F)); - RenderingRegistry.registerEntityRenderingHandler(EntitySmallEarthGolem.class, new RenderSmallEarthGolem(new ModelSmallEarthGolem(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityIceDemon.class, new RenderIceDemon(new ModelIceDemon(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityBoulderFist.class, new RenderBoulderFist(new ModelBoulderFist(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityLowerGuardian.class, new RenderLowerGuardian(new ModelLowerGuardian(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityBileDemon.class, new RenderBileDemon(new ModelBileDemon(), 1.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityWingedFireDemon.class, new RenderWingedFireDemon(new ModelWingedFireDemon(), 1.0F)); + RenderingRegistry.registerEntityRenderingHandler( + EntitySmallEarthGolem.class, new RenderSmallEarthGolem(new ModelSmallEarthGolem(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityIceDemon.class, new RenderIceDemon(new ModelIceDemon(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityBoulderFist.class, new RenderBoulderFist(new ModelBoulderFist(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityShade.class, new RenderShade(new ModelShade(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityAirElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityWaterElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityEarthElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGrunt.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntFire.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntIce.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntWind.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntEarth.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardian.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianFire.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianIce.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianEarth.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianWind.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityAirElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityWaterElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityEarthElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGrunt.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntFire.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntIce.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntWind.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntEarth.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntGuardian.class, + new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntGuardianFire.class, + new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntGuardianIce.class, + new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntGuardianEarth.class, + new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); + RenderingRegistry.registerEntityRenderingHandler( + EntityMinorDemonGruntGuardianWind.class, + new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F)); MinecraftForge.EVENT_BUS.register(new RitualDivinerRender()); @@ -158,39 +186,44 @@ public class ClientProxy extends CommonProxy ClientRegistry.bindTileEntitySpecialRenderer(TESpellParadigmBlock.class, new RenderSpellParadigmBlock()); ClientRegistry.bindTileEntitySpecialRenderer(TESpellModifierBlock.class, new RenderSpellModifierBlock()); ClientRegistry.bindTileEntitySpecialRenderer(TEReagentConduit.class, new RenderReagentConduit()); - if (AlchemicalWizardry.displayRitualAnimation) - { + if (AlchemicalWizardry.displayRitualAnimation) { ClientRegistry.bindTileEntitySpecialRenderer(TEMasterStone.class, new RenderMasterStone()); } ClientRegistry.bindTileEntitySpecialRenderer(TEAlchemicCalcinator.class, new RenderAlchemicCalcinator()); ClientRegistry.bindTileEntitySpecialRenderer(TEBellJar.class, new RenderCrystalBelljar()); - //Item Renderer stuff - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockConduit), new TEConduitItemRenderer()); - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellEffect), new TESpellEffectBlockItemRenderer()); - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellEnhancement), new TESpellEnhancementBlockItemRenderer()); - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellParadigm), new TESpellParadigmBlockItemRenderer()); - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer()); - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAlchemicCalcinator), new TEAlchemicalCalcinatorItemRenderer()); - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer()); + // Item Renderer stuff + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockConduit), new TEConduitItemRenderer()); + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockSpellEffect), new TESpellEffectBlockItemRenderer()); + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockSpellEnhancement), new TESpellEnhancementBlockItemRenderer()); + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockSpellParadigm), new TESpellParadigmBlockItemRenderer()); + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer()); + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockAlchemicCalcinator), + new TEAlchemicalCalcinatorItemRenderer()); + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer()); } @Override - public World getClientWorld() - { + public World getClientWorld() { return FMLClientHandler.instance().getClient().theWorld; } @Override - public void InitRendering() - { - MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer()); + public void InitRendering() { + MinecraftForgeClient.registerItemRenderer( + ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer()); } @Override - public void registerEvents() - { - Object ob = new ClientEventHandler(); + public void registerEvents() { + Object ob = new ClientEventHandler(); FMLCommonHandler.instance().bus().register(ob); MinecraftForge.EVENT_BUS.register(ob); KeyBindings.init(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/ClientUtils.java b/src/main/java/WayofTime/alchemicalWizardry/client/ClientUtils.java index b7474db3..cd0b9522 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/ClientUtils.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/ClientUtils.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.client; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.FIRST_PERSON_MAP; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.entity.EntityPlayerSP; @@ -22,59 +23,67 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.storage.MapData; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -public class ClientUtils -{ - public static Minecraft mc = Minecraft.getMinecraft(); - - private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); - - public static void renderPlayerArmourInPOV(EntityPlayer player, float partialTickTime) - { - GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); - float f1 = 1.0f;//this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTickTime; +public class ClientUtils { + public static Minecraft mc = Minecraft.getMinecraft(); + + private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); + + public static void renderPlayerArmourInPOV(EntityPlayer player, float partialTickTime) { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + float f1 = 1.0f; // this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * + // partialTickTime; EntityClientPlayerMP entityclientplayermp = mc.thePlayer; - float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTickTime; -// GL11.glPushMatrix(); - GL11.glRotatef(180 - (entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * partialTickTime), 0.0F, 1.0F, 0.0F); + float f2 = entityclientplayermp.prevRotationPitch + + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTickTime; + // GL11.glPushMatrix(); + GL11.glRotatef( + 180 + - (entityclientplayermp.prevRotationYaw + + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) + * partialTickTime), + 0.0F, + 1.0F, + 0.0F); GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); -// GL11.glPopMatrix(); - EntityPlayerSP entityplayersp = (EntityPlayerSP)entityclientplayermp; - float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTickTime; - float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTickTime; + // GL11.glPopMatrix(); + EntityPlayerSP entityplayersp = (EntityPlayerSP) entityclientplayermp; + float f3 = entityplayersp.prevRenderArmPitch + + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTickTime; + float f4 = entityplayersp.prevRenderArmYaw + + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTickTime; GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F); GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F); ItemStack itemstack = player.getCurrentEquippedItem(); - if (itemstack != null && itemstack.getItem() instanceof ItemCloth) - { + if (itemstack != null && itemstack.getItem() instanceof ItemCloth) { GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); } - int i = mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0); + int i = mc.theWorld.getLightBrightnessForSkyBlocks( + MathHelper.floor_double(entityclientplayermp.posX), + MathHelper.floor_double(entityclientplayermp.posY), + MathHelper.floor_double(entityclientplayermp.posZ), + 0); int j = i % 65536; int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float f5; float f6; float f7; - if (itemstack != null) - { + if (itemstack != null) { int l = itemstack.getItem().getColorFromItemStack(itemstack, 0); - f5 = (float)(l >> 16 & 255) / 255.0F; - f6 = (float)(l >> 8 & 255) / 255.0F; - f7 = (float)(l & 255) / 255.0F; + f5 = (float) (l >> 16 & 255) / 255.0F; + f6 = (float) (l >> 8 & 255) / 255.0F; + f7 = (float) (l & 255) / 255.0F; GL11.glColor4f(f5, f6, f7, 1.0F); - } - else - { + } else { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } @@ -85,45 +94,41 @@ public class ClientUtils Render render; RenderPlayer renderplayer; - - if (itemstack != null && itemstack.getItem() instanceof ItemMap) - { + if (itemstack != null && itemstack.getItem() instanceof ItemMap) { GL11.glPushMatrix(); f13 = 0.8F; f5 = entityclientplayermp.getSwingProgress(partialTickTime); - f6 = MathHelper.sin(f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F); + f6 = MathHelper.sin(f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glTranslatef( + -f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F, -f6 * 0.2F); f5 = 1.0F - f2 / 45.0F + 0.1F; - if (f5 < 0.0F) - { + if (f5 < 0.0F) { f5 = 0.0F; } - if (f5 > 1.0F) - { + if (f5 > 1.0F) { f5 = 1.0F; } - f5 = -MathHelper.cos(f5 * (float)Math.PI) * 0.5F + 0.5F; + f5 = -MathHelper.cos(f5 * (float) Math.PI) * 0.5F + 0.5F; GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - f5 * 0.5F + 0.04F, -0.9F * f13); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(f5 * -85.0F, 0.0F, 0.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin()); - for (int i1 = 0; i1 < 2; ++i1) - { + for (int i1 = 0; i1 < 2; ++i1) { int j1 = i1 * 2 - 1; GL11.glPushMatrix(); - GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)j1); - GL11.glRotatef((float)(-45 * j1), 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) j1); + GL11.glRotatef((float) (-45 * j1), 1.0F, 0.0F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef((float)(-65 * j1), 0.0F, 1.0F, 0.0F); + GL11.glRotatef((float) (-65 * j1), 0.0F, 1.0F, 0.0F); render = RenderManager.instance.getEntityRenderObject(mc.thePlayer); - renderplayer = (RenderPlayer)render; + renderplayer = (RenderPlayer) render; f10 = 1.0F; GL11.glScalef(f10, f10, f10); renderFirstPersonArm(renderplayer, mc.thePlayer); @@ -131,8 +136,8 @@ public class ClientUtils } f6 = entityclientplayermp.getSwingProgress(partialTickTime); - f7 = MathHelper.sin(f6 * f6 * (float)Math.PI); - f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI); + f7 = MathHelper.sin(f6 * f6 * (float) Math.PI); + f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float) Math.PI); GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F); @@ -148,68 +153,65 @@ public class ClientUtils GL11.glNormal3f(0.0F, 0.0F, -1.0F); tessellator.startDrawingQuads(); byte b0 = 7; - tessellator.addVertexWithUV((double)(0 - b0), (double)(128 + b0), 0.0D, 0.0D, 1.0D); - tessellator.addVertexWithUV((double)(128 + b0), (double)(128 + b0), 0.0D, 1.0D, 1.0D); - tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D); - tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D); + tessellator.addVertexWithUV((double) (0 - b0), (double) (128 + b0), 0.0D, 0.0D, 1.0D); + tessellator.addVertexWithUV((double) (128 + b0), (double) (128 + b0), 0.0D, 1.0D, 1.0D); + tessellator.addVertexWithUV((double) (128 + b0), (double) (0 - b0), 0.0D, 1.0D, 0.0D); + tessellator.addVertexWithUV((double) (0 - b0), (double) (0 - b0), 0.0D, 0.0D, 0.0D); tessellator.draw(); IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); - MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, mc.theWorld); + MapData mapdata = ((ItemMap) itemstack.getItem()).getMapData(itemstack, mc.theWorld); - if (custom == null) - { - if (mapdata != null) - { + if (custom == null) { + if (mapdata != null) { mc.entityRenderer.getMapItemRenderer().func_148250_a(mapdata, false); } - } - else - { + } else { custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata); } GL11.glPopMatrix(); - } - else if (itemstack != null) - { + } else if (itemstack != null) { GL11.glPushMatrix(); f13 = 0.8F; - if (entityclientplayermp.getItemInUseCount() > 0) - { + if (entityclientplayermp.getItemInUseCount() > 0) { EnumAction enumaction = itemstack.getItemUseAction(); - if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) - { - f6 = (float)entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F; - f7 = 1.0F - f6 / (float)itemstack.getMaxItemUseDuration(); + if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) { + f6 = (float) entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F; + f7 = 1.0F - f6 / (float) itemstack.getMaxItemUseDuration(); f8 = 1.0F - f7; f8 = f8 * f8 * f8; f8 = f8 * f8 * f8; f8 = f8 * f8 * f8; f9 = 1.0F - f8; - GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float)Math.PI) * 0.1F) * (float)((double)f7 > 0.2D ? 1 : 0), 0.0F); + GL11.glTranslatef( + 0.0F, + MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float) Math.PI) * 0.1F) + * (float) ((double) f7 > 0.2D ? 1 : 0), + 0.0F); GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F); GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F); } - } - else - { + } else { f5 = entityclientplayermp.getSwingProgress(partialTickTime); - f6 = MathHelper.sin(f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F); + f6 = MathHelper.sin(f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glTranslatef( + -f7 * 0.4F, + MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F, + -f6 * 0.2F); } GL11.glTranslatef(0.7F * f13, -0.65F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); f5 = entityclientplayermp.getSwingProgress(partialTickTime); - f6 = MathHelper.sin(f5 * f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); + f6 = MathHelper.sin(f5 * f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-f7 * 20.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-f7 * 80.0F, 1.0F, 0.0F, 0.0F); @@ -218,34 +220,29 @@ public class ClientUtils float f11; float f12; - if (entityclientplayermp.getItemInUseCount() > 0) - { + if (entityclientplayermp.getItemInUseCount() > 0) { EnumAction enumaction1 = itemstack.getItemUseAction(); - if (enumaction1 == EnumAction.block) - { + if (enumaction1 == EnumAction.block) { GL11.glTranslatef(-0.5F, 0.2F, 0.0F); GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); - } - else if (enumaction1 == EnumAction.bow) - { + } else if (enumaction1 == EnumAction.bow) { GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(-0.9F, 0.2F, 0.0F); - f10 = (float)itemstack.getMaxItemUseDuration() - ((float)entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F); + f10 = (float) itemstack.getMaxItemUseDuration() + - ((float) entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F); f11 = f10 / 20.0F; f11 = (f11 * f11 + f11 * 2.0F) / 3.0F; - if (f11 > 1.0F) - { + if (f11 > 1.0F) { f11 = 1.0F; } - if (f11 > 0.1F) - { + if (f11 > 0.1F) { GL11.glTranslatef(0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F); } @@ -261,45 +258,42 @@ public class ClientUtils } } - if (itemstack.getItem().shouldRotateAroundWhenRendering()) - { + if (itemstack.getItem().shouldRotateAroundWhenRendering()) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } - if (itemstack.getItem().requiresMultipleRenderPasses()) - { - RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); - for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) - { + if (itemstack.getItem().requiresMultipleRenderPasses()) { + RenderManager.instance.itemRenderer.renderItem( + entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); + for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) { int k1 = itemstack.getItem().getColorFromItemStack(itemstack, x); - f10 = (float)(k1 >> 16 & 255) / 255.0F; - f11 = (float)(k1 >> 8 & 255) / 255.0F; - f12 = (float)(k1 & 255) / 255.0F; + f10 = (float) (k1 >> 16 & 255) / 255.0F; + f11 = (float) (k1 >> 8 & 255) / 255.0F; + f12 = (float) (k1 & 255) / 255.0F; GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F); - RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON); + RenderManager.instance.itemRenderer.renderItem( + entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON); } - } - else - { - RenderManager.instance.itemRenderer.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); + } else { + RenderManager.instance.itemRenderer.renderItem( + entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); } GL11.glPopMatrix(); - } - else if (!entityclientplayermp.isInvisible()) - { + } else if (!entityclientplayermp.isInvisible()) { GL11.glPushMatrix(); f13 = 0.8F; f5 = entityclientplayermp.getSwingProgress(partialTickTime); - f6 = MathHelper.sin(f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glTranslatef(-f7 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.4F, -f6 * 0.4F); + f6 = MathHelper.sin(f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glTranslatef( + -f7 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.4F, -f6 * 0.4F); GL11.glTranslatef(0.8F * f13, -0.75F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); f5 = entityclientplayermp.getSwingProgress(partialTickTime); - f6 = MathHelper.sin(f5 * f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); + f6 = MathHelper.sin(f5 * f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); GL11.glRotatef(f7 * 70.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F); mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin()); @@ -310,33 +304,31 @@ public class ClientUtils GL11.glScalef(1.0F, 1.0F, 1.0F); GL11.glTranslatef(5.6F, 0.0F, 0.0F); render = RenderManager.instance.getEntityRenderObject(mc.thePlayer); - renderplayer = (RenderPlayer)render; + renderplayer = (RenderPlayer) render; f10 = 1.0F; GL11.glScalef(f10, f10, f10); renderFirstPersonArm(renderplayer, mc.thePlayer); GL11.glPopMatrix(); } - if (itemstack != null && itemstack.getItem() instanceof ItemCloth) - { + if (itemstack != null && itemstack.getItem() instanceof ItemCloth) { GL11.glDisable(GL11.GL_BLEND); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); - } - - public static void renderFirstPersonArm(RenderPlayer renderer, EntityPlayer player) - { - float f = 1.0F; + } + + public static void renderFirstPersonArm(RenderPlayer renderer, EntityPlayer player) { + float f = 1.0F; GL11.glColor3f(f, f, f); - + GL11.glPushMatrix(); ModelRenderer mRenderer = new POVArmourModelWrapper(renderer.modelBipedMain); renderer.modelBipedMain.onGround = 0.0F; renderer.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player); renderer.modelBipedMain.bipedRightArm.render(0.0625F); - + GL11.glPushMatrix(); mRenderer.rotateAngleX = renderer.modelBipedMain.bipedRightArm.rotateAngleX; mRenderer.rotateAngleY = renderer.modelBipedMain.bipedRightArm.rotateAngleY; @@ -344,5 +336,5 @@ public class ClientUtils mRenderer.render(0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/KeyBindings.java b/src/main/java/WayofTime/alchemicalWizardry/client/KeyBindings.java index b381ed70..1953d640 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/KeyBindings.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/KeyBindings.java @@ -1,14 +1,11 @@ package WayofTime.alchemicalWizardry.client; +public class KeyBindings { + // public static KeyBinding omegaTest; -public class KeyBindings -{ -// public static KeyBinding omegaTest; - - public static void init() - { -// omegaTest = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.alchemicalwizardry"); -// -// ClientRegistry.registerKeyBinding(omegaTest); - } + public static void init() { + // omegaTest = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.alchemicalwizardry"); + // + // ClientRegistry.registerKeyBinding(omegaTest); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/POVArmourModelWrapper.java b/src/main/java/WayofTime/alchemicalWizardry/client/POVArmourModelWrapper.java index 1355fdac..749cd723 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/POVArmourModelWrapper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/POVArmourModelWrapper.java @@ -1,47 +1,46 @@ package WayofTime.alchemicalWizardry.client; -import org.lwjgl.opengl.GL11; - +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class POVArmourModelWrapper extends ModelRenderer -{ +public class POVArmourModelWrapper extends ModelRenderer { private final ModelRenderer armModel; private final ResourceLocation resource; - public POVArmourModelWrapper(ModelBase model) - { + public POVArmourModelWrapper(ModelBase model) { super(model); ItemStack plateStack = new ItemStack(ModItems.boundPlateFire); - ModelBiped bipedModel = ((BoundArmour)ModItems.boundPlateFire).getArmorModel(Minecraft.getMinecraft().thePlayer, plateStack, 1); + ModelBiped bipedModel = ((BoundArmour) ModItems.boundPlateFire) + .getArmorModel(Minecraft.getMinecraft().thePlayer, plateStack, 1); armModel = bipedModel.bipedRightArm; - resource = new ResourceLocation(((BoundArmour)ModItems.boundPlateFire).getArmorTexture(plateStack, Minecraft.getMinecraft().thePlayer, 1, "POV")); - addBox(0, 0, 0, 0, 0, 0); //Adds in a blank box as it's required in certain cases such as rendering arrows in entities + resource = new ResourceLocation(((BoundArmour) ModItems.boundPlateFire) + .getArmorTexture(plateStack, Minecraft.getMinecraft().thePlayer, 1, "POV")); + addBox( + 0, 0, 0, 0, 0, + 0); // Adds in a blank box as it's required in certain cases such as rendering arrows in entities } @Override - public void render(float partialTicks) - { - GL11.glPushMatrix(); -// GL11.glTranslated(0.3, -.1, 0); - Minecraft.getMinecraft().renderEngine.bindTexture(resource); - armModel.rotateAngleX = this.rotateAngleX; - armModel.rotateAngleY = this.rotateAngleY; - armModel.rotateAngleZ = this.rotateAngleZ; + public void render(float partialTicks) { + GL11.glPushMatrix(); + // GL11.glTranslated(0.3, -.1, 0); + Minecraft.getMinecraft().renderEngine.bindTexture(resource); + armModel.rotateAngleX = this.rotateAngleX; + armModel.rotateAngleY = this.rotateAngleY; + armModel.rotateAngleZ = this.rotateAngleZ; armModel.render(partialTicks); GL11.glPopMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(ClientEventHandler.currentPlayerTexture); - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGui.java b/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGui.java index 7ae09370..730847d4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGui.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGui.java @@ -1,39 +1,39 @@ package WayofTime.alchemicalWizardry.client.gui; +import static WayofTime.alchemicalWizardry.BloodMagicConfiguration.config; + import cpw.mods.fml.client.config.GuiConfig; import cpw.mods.fml.client.config.IConfigElement; +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; - -import static WayofTime.alchemicalWizardry.BloodMagicConfiguration.config; - public class ConfigGui extends GuiConfig { - public ConfigGui(GuiScreen parentScreen) { - super(parentScreen, getConfigElements(parentScreen), "AWWayofTime", false, false, "Blood Magic Configuration"); - } + public ConfigGui(GuiScreen parentScreen) { + super(parentScreen, getConfigElements(parentScreen), "AWWayofTime", false, false, "Blood Magic Configuration"); + } - @SuppressWarnings("rawtypes") - private static List getConfigElements(GuiScreen parent) { - List list = new ArrayList(); + @SuppressWarnings("rawtypes") + private static List getConfigElements(GuiScreen parent) { + List list = new ArrayList(); - // adds sections declared in ConfigHandler. toLowerCase() is used because the configuration class automatically does this, so must we. - list.add(new ConfigElement(config.getCategory("clientsettings".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("dungeon loot chances".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("meteor".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("orecrushing".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("potion id".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("wellofsufferingblacklist".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("wimpysettings".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("ritual blacklist".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("teleposer blacklist".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("demon configs".toLowerCase()))); - list.add(new ConfigElement(config.getCategory("lp costs".toLowerCase()))); + // adds sections declared in ConfigHandler. toLowerCase() is used because the configuration class automatically + // does this, so must we. + list.add(new ConfigElement(config.getCategory("clientsettings".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("dungeon loot chances".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("meteor".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("orecrushing".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("potion id".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("wellofsufferingblacklist".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("wimpysettings".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("ritual blacklist".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("teleposer blacklist".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("demon configs".toLowerCase()))); + list.add(new ConfigElement(config.getCategory("lp costs".toLowerCase()))); - return list; - } + return list; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGuiFactory.java b/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGuiFactory.java index e4705728..da955883 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGuiFactory.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/gui/ConfigGuiFactory.java @@ -1,30 +1,27 @@ package WayofTime.alchemicalWizardry.client.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) { + @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/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java index 9be4f374..6ebf7d3e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java @@ -2,16 +2,6 @@ package WayofTime.alchemicalWizardry.client.nei; import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; @@ -19,6 +9,15 @@ import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; /** * NEI Alchemy Recipe Handler by joshie * diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAltarRecipeHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAltarRecipeHandler.java index b5cc7772..2c22f449 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAltarRecipeHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAltarRecipeHandler.java @@ -1,9 +1,5 @@ package WayofTime.alchemicalWizardry.client.nei; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.List; - import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; import codechicken.lib.gui.GuiDraw; @@ -11,6 +7,9 @@ import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -20,101 +19,104 @@ import net.minecraft.util.StatCollector; * NEI Altar Recipe Handler by joshie * */ public class NEIAltarRecipeHandler extends TemplateRecipeHandler { - public class CachedAltarRecipe extends CachedRecipe { - PositionedStack input; -// PositionedStack inputItems; - PositionedStack output; - int tier, lp_amount, consumption, drain; - - public CachedAltarRecipe(AltarRecipe recipe) { -// inputItems = new PositionedStack(recipe.input, 38, 2, false); - input = new PositionedStack(recipe.requiredItem, 38, 2, false); - output = new PositionedStack(recipe.result, 132, 32, false); - tier = recipe.minTier; - lp_amount = recipe.liquidRequired; - consumption = recipe.consumptionRate; - drain = recipe.drainRate; - } - - @Override - public PositionedStack getIngredient() { + public class CachedAltarRecipe extends CachedRecipe { + PositionedStack input; + // PositionedStack inputItems; + PositionedStack output; + int tier, lp_amount, consumption, drain; + + public CachedAltarRecipe(AltarRecipe recipe) { + // inputItems = new PositionedStack(recipe.input, 38, 2, false); + input = new PositionedStack(recipe.requiredItem, 38, 2, false); + output = new PositionedStack(recipe.result, 132, 32, false); + tier = recipe.minTier; + lp_amount = recipe.liquidRequired; + consumption = recipe.consumptionRate; + drain = recipe.drainRate; + } + + @Override + public PositionedStack getIngredient() { return input; } - - @Override - public PositionedStack getResult() { - return output; - } - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) { - for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) { - if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe)); - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) { - if(NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.result, result)) { - if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe)); - } - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) { - if(NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.requiredItem, ingredient)) { - if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe)); - } - } + + @Override + public PositionedStack getResult() { + return output; + } } - - @Override - public void drawExtras(int id) { - CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id); - Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier, 78, 5, 0); - Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0); - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int id) { - super.handleTooltip(gui, currenttip, id); - Point mouse = GuiDraw.getMousePosition(); - Point root = gui.getRecipePosition(id); - int offsetX = gui.guiLeft + root.x; - int offsetY = gui.guiTop + root.y; - if(mouse.x >= 14 + offsetX && mouse.x <= 75 + offsetX && mouse.y >= 22 + offsetY && mouse.y <= 56 + offsetY) { - CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id); + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) { + for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) { + if (recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) { + if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.result, result)) { + if (recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe)); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) { + if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.requiredItem, ingredient)) { + if (recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe)); + } + } + } + + @Override + public void drawExtras(int id) { + CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id); + Minecraft.getMinecraft() + .fontRenderer + .drawString( + "\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier, 78, 5, 0); + Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0); + } + + @Override + public List handleTooltip(GuiRecipe gui, List currenttip, int id) { + super.handleTooltip(gui, currenttip, id); + Point mouse = GuiDraw.getMousePosition(); + Point root = gui.getRecipePosition(id); + int offsetX = gui.guiLeft + root.x; + int offsetY = gui.guiTop + root.y; + if (mouse.x >= 14 + offsetX && mouse.x <= 75 + offsetX && mouse.y >= 22 + offsetY && mouse.y <= 56 + offsetY) { + CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id); currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t"); currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t"); - } - return currenttip; - } - - @Override - public String getOverlayIdentifier() { - return "altarrecipes"; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar")); - } - - @Override - public String getRecipeName() { - return " " + StatCollector.translateToLocal("tile.bloodAltar.name"); - } + } + return currenttip; + } - @Override - public String getGuiTexture() { - return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString(); - } + @Override + public String getOverlayIdentifier() { + return "altarrecipes"; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar")); + } + + @Override + public String getRecipeName() { + return " " + StatCollector.translateToLocal("tile.bloodAltar.name"); + } + + @Override + public String getGuiTexture() { + return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString(); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBindingRitualHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBindingRitualHandler.java index 46b2632d..4f818f7c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBindingRitualHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBindingRitualHandler.java @@ -1,71 +1,55 @@ package WayofTime.alchemicalWizardry.client.nei; -import java.awt.Rectangle; - import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe; import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import java.awt.Rectangle; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; /** * Binding Ritual Handler by Arcaratus */ -public class NEIBindingRitualHandler extends TemplateRecipeHandler -{ - public class CachedBindingRecipe extends CachedRecipe - { +public class NEIBindingRitualHandler extends TemplateRecipeHandler { + public class CachedBindingRecipe extends CachedRecipe { PositionedStack input, output; - public CachedBindingRecipe(BindingRecipe recipe) - { + public CachedBindingRecipe(BindingRecipe recipe) { input = new PositionedStack(recipe.requiredItem, 37, 21, false); output = new PositionedStack(recipe.outputItem, 110, 21, false); } @Override - public PositionedStack getIngredient() - { + public PositionedStack getIngredient() { return input; } @Override - public PositionedStack getResult() - { + public PositionedStack getResult() { return output; } } @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class) - { - for (BindingRecipe recipe : BindingRegistry.bindingRecipes) - { - if (recipe != null && recipe.outputItem != null) - { + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class) { + for (BindingRecipe recipe : BindingRegistry.bindingRecipes) { + if (recipe != null && recipe.outputItem != null) { arecipes.add(new CachedBindingRecipe(recipe)); } } - } - else - { + } else { super.loadCraftingRecipes(outputId, results); } } @Override - public void loadCraftingRecipes(ItemStack result) - { - for (BindingRecipe recipe: BindingRegistry.bindingRecipes) - { - if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.outputItem, result)) - { - if (recipe != null && recipe.outputItem != null) - { + public void loadCraftingRecipes(ItemStack result) { + for (BindingRecipe recipe : BindingRegistry.bindingRecipes) { + if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.outputItem, result)) { + if (recipe != null && recipe.outputItem != null) { arecipes.add(new CachedBindingRecipe(recipe)); } } @@ -73,14 +57,10 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler } @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for (BindingRecipe recipe: BindingRegistry.bindingRecipes) - { - if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.requiredItem, ingredient)) - { - if (recipe != null && recipe.outputItem != null) - { + public void loadUsageRecipes(ItemStack ingredient) { + for (BindingRecipe recipe : BindingRegistry.bindingRecipes) { + if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.requiredItem, ingredient)) { + if (recipe != null && recipe.outputItem != null) { arecipes.add(new CachedBindingRecipe(recipe)); } } @@ -88,26 +68,22 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler } @Override - public String getOverlayIdentifier() - { + public String getOverlayIdentifier() { return "alchemicalwizardry.bindingritual"; } @Override - public void loadTransferRects() - { + public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 16), "alchemicalwizardry.bindingritual")); } @Override - public String getRecipeName() - { + public String getRecipeName() { return "Binding Ritual"; } @Override - public String getGuiTexture() - { + public String getGuiTexture() { return new ResourceLocation("alchemicalwizardry", "gui/nei/bindingRitual.png").toString(); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapedHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapedHandler.java index af0da7a3..ea02c69c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapedHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapedHandler.java @@ -2,15 +2,14 @@ package WayofTime.alchemicalWizardry.client.nei; import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.ShapedRecipeHandler; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; @@ -21,126 +20,121 @@ import net.minecraft.util.StatCollector; * NEI Blood Orb Shaped Recipe Handler by joshie * */ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler { - public class CachedBloodOrbRecipe extends CachedShapedRecipe { - public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) { - super(width, height, items, out); - } + public class CachedBloodOrbRecipe extends CachedShapedRecipe { + public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) { + super(width, height, items, out); + } - @Override - public void setIngredients(int width, int height, Object[] items) { - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - if (items[y * width + x] == null) - continue; + @Override + public void setIngredients(int width, int height, Object[] items) { + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + if (items[y * width + x] == null) continue; - Object o = items[y * width + x]; - if (o instanceof ItemStack) { - PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false); - stack.setMaxSize(1); - ingredients.add(stack); - } else if (o instanceof Integer) { - ArrayList orbs = new ArrayList<>(); - for (Item item : getBloodOrbs()) { - if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) { - orbs.add(new ItemStack(item)); - } - } - PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false); - stack.setMaxSize(1); - ingredients.add(stack); - } else if(o instanceof List) { - PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false); - stack.setMaxSize(1); - ingredients.add(stack); - } - } - } - } - } + Object o = items[y * width + x]; + if (o instanceof ItemStack) { + PositionedStack stack = + new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false); + stack.setMaxSize(1); + ingredients.add(stack); + } else if (o instanceof Integer) { + ArrayList orbs = new ArrayList<>(); + for (Item item : getBloodOrbs()) { + if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) { + orbs.add(new ItemStack(item)); + } + } + PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false); + stack.setMaxSize(1); + ingredients.add(stack); + } else if (o instanceof List) { + PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false); + stack.setMaxSize(1); + ingredients.add(stack); + } + } + } + } + } - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) { - for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { - if (irecipe instanceof ShapedBloodOrbRecipe) { - CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe); - if (recipe == null) - continue; + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) { + for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { + if (irecipe instanceof ShapedBloodOrbRecipe) { + CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe); + if (recipe == null) continue; - recipe.computeVisuals(); - arecipes.add(recipe); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } + recipe.computeVisuals(); + arecipes.add(recipe); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") @Override - public void loadCraftingRecipes(ItemStack result) { - for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { - if (irecipe instanceof ShapedBloodOrbRecipe) { - CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe); - if (recipe == null || !NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.result.item, result)) - continue; + public void loadCraftingRecipes(ItemStack result) { + for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { + if (irecipe instanceof ShapedBloodOrbRecipe) { + CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe); + if (recipe == null || !NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.result.item, result)) + continue; - recipe.computeVisuals(); - arecipes.add(recipe); - } - } - } + recipe.computeVisuals(); + arecipes.add(recipe); + } + } + } - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") @Override - public void loadUsageRecipes(ItemStack ingredient) { - for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { - CachedShapedRecipe recipe = null; - if (irecipe instanceof ShapedBloodOrbRecipe) - recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe); + public void loadUsageRecipes(ItemStack ingredient) { + for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { + CachedShapedRecipe recipe = null; + if (irecipe instanceof ShapedBloodOrbRecipe) recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe); - if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) - continue; + if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) continue; - recipe.computeVisuals(); - if (recipe.contains(recipe.ingredients, ingredient)) { - recipe.setIngredientPermutation(recipe.ingredients, ingredient); - arecipes.add(recipe); - } - } - } + recipe.computeVisuals(); + if (recipe.contains(recipe.ingredients, ingredient)) { + recipe.setIngredientPermutation(recipe.ingredients, ingredient); + arecipes.add(recipe); + } + } + } - private CachedBloodOrbRecipe forgeShapedRecipe(ShapedBloodOrbRecipe recipe) { - int width; - int height; - try { - width = recipe.width; - height = recipe.height; - } catch (Exception e) { - e.printStackTrace(); - return null; - } + private CachedBloodOrbRecipe forgeShapedRecipe(ShapedBloodOrbRecipe recipe) { + int width; + int height; + try { + width = recipe.width; + height = recipe.height; + } catch (Exception e) { + e.printStackTrace(); + return null; + } - Object[] items = recipe.getInput(); - for (Object item : items) - if (item instanceof List && ((List) item).isEmpty())// ore - // handler, - // no ores - return null; + Object[] items = recipe.getInput(); + for (Object item : items) + if (item instanceof List && ((List) item).isEmpty()) // ore + // handler, + // no ores + return null; - return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput()); - } - - @Override + return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput()); + } + + @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting")); } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("bm.string.crafting.orb.shaped"); - - } + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("bm.string.crafting.orb.shaped"); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapelessHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapelessHandler.java index c85a1bb6..f413194f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapelessHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapelessHandler.java @@ -1,14 +1,13 @@ package WayofTime.alchemicalWizardry.client.nei; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.ShapelessRecipeHandler; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; @@ -19,53 +18,54 @@ import net.minecraft.util.StatCollector; * NEI Blood Orb Shapeless Recipe Handler by joshie * */ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler { - public class CachedBloodOrbRecipe extends CachedShapelessRecipe { - public CachedBloodOrbRecipe(ArrayList items, ItemStack recipeOutput) { - super(items, recipeOutput); - } + public class CachedBloodOrbRecipe extends CachedShapelessRecipe { + public CachedBloodOrbRecipe(ArrayList items, ItemStack recipeOutput) { + super(items, recipeOutput); + } - @Override - public void setIngredients(List items) { + @Override + public void setIngredients(List items) { ingredients.clear(); for (int ingred = 0; ingred < items.size(); ingred++) { Object o = items.get(ingred); - if (o instanceof ItemStack) { - PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18); - stack.setMaxSize(1); - ingredients.add(stack); - } else if (o instanceof Integer) { - ArrayList orbs = new ArrayList<>(); - for (Item item : NEIConfig.getBloodOrbs()) { - if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) { - orbs.add(new ItemStack(item)); - } - } + if (o instanceof ItemStack) { + PositionedStack stack = new PositionedStack( + items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18); + stack.setMaxSize(1); + ingredients.add(stack); + } else if (o instanceof Integer) { + ArrayList orbs = new ArrayList<>(); + for (Item item : NEIConfig.getBloodOrbs()) { + if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) { + orbs.add(new ItemStack(item)); + } + } - PositionedStack stack = new PositionedStack(orbs, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18); - stack.setMaxSize(1); - ingredients.add(stack); - }else if(o instanceof List) - { - PositionedStack stack = new PositionedStack(o, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18); - stack.setMaxSize(1); - ingredients.add(stack); - } + PositionedStack stack = + new PositionedStack(orbs, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18); + stack.setMaxSize(1); + ingredients.add(stack); + } else if (o instanceof List) { + PositionedStack stack = + new PositionedStack(o, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18); + stack.setMaxSize(1); + ingredients.add(stack); + } } } - } - - @SuppressWarnings("unchecked") + } + + @SuppressWarnings("unchecked") @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) { List allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { - CachedBloodOrbRecipe recipe = null; + CachedBloodOrbRecipe recipe = null; if (irecipe instanceof ShapelessBloodOrbRecipe) recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe); - if (recipe == null) - continue; + if (recipe == null) continue; arecipes.add(recipe); } @@ -73,36 +73,34 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler { super.loadCraftingRecipes(outputId, results); } } - - @SuppressWarnings("unchecked") + + @SuppressWarnings("unchecked") @Override public void loadCraftingRecipes(ItemStack result) { List allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(irecipe.getRecipeOutput(), result)) { - CachedBloodOrbRecipe recipe = null; + CachedBloodOrbRecipe recipe = null; if (irecipe instanceof ShapelessBloodOrbRecipe) recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe); - if (recipe == null) - continue; + if (recipe == null) continue; arecipes.add(recipe); } } } - - @SuppressWarnings("unchecked") + + @SuppressWarnings("unchecked") @Override public void loadUsageRecipes(ItemStack ingredient) { List allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { - CachedBloodOrbRecipe recipe = null; + CachedBloodOrbRecipe recipe = null; if (irecipe instanceof ShapelessBloodOrbRecipe) recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe); - if (recipe == null) - continue; + if (recipe == null) continue; if (recipe.contains(recipe.ingredients, ingredient)) { recipe.setIngredientPermutation(recipe.ingredients, ingredient); @@ -110,29 +108,29 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler { } } } - - public CachedBloodOrbRecipe forgeShapelessRecipe(ShapelessBloodOrbRecipe recipe) { + + public CachedBloodOrbRecipe forgeShapelessRecipe(ShapelessBloodOrbRecipe recipe) { ArrayList items = recipe.getInput(); for (Object item : items) - if (item instanceof List && ((List) item).isEmpty())//ore handler, no ores - return null; + if (item instanceof List && ((List) item).isEmpty()) // ore handler, no ores + return null; return new CachedBloodOrbRecipe(items, recipe.getRecipeOutput()); } - - @Override + + @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting")); } - @Override - public String getOverlayIdentifier() { - return "crafting"; - } + @Override + public String getOverlayIdentifier() { + return "crafting"; + } - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless"); - } + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless"); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIConfig.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIConfig.java index 802a0f8e..97ca5fad 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIConfig.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIConfig.java @@ -1,70 +1,69 @@ package WayofTime.alchemicalWizardry.client.nei; -import java.util.ArrayList; - import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import codechicken.nei.ItemList; -import net.minecraft.item.Item; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; +import java.util.ArrayList; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class NEIConfig implements IConfigureNEI { - private static ArrayList bloodOrbs = null; + private static ArrayList bloodOrbs = null; - public static ArrayList getBloodOrbs() { - if (bloodOrbs == null) { - synchronized (NEIConfig.class) { - if (bloodOrbs == null) { - bloodOrbs = collectAllBloodOrbs(); - } - } - } - return bloodOrbs; - } + public static ArrayList getBloodOrbs() { + if (bloodOrbs == null) { + synchronized (NEIConfig.class) { + if (bloodOrbs == null) { + bloodOrbs = collectAllBloodOrbs(); + } + } + } + return bloodOrbs; + } - private static ArrayList collectAllBloodOrbs() { - ArrayList bloodOrbsTemp = new ArrayList<>(); - for (ItemStack item : ItemList.items) { - if (item != null && item.getItem() instanceof IBloodOrb) { - bloodOrbsTemp.add(item.getItem()); - } - } - if (bloodOrbsTemp.isEmpty()) { - // If there is NEI no cache - go to item registry - for (Object anItemRegistry : Item.itemRegistry) { - Item item = (Item) anItemRegistry; - if (item instanceof IBloodOrb) { - bloodOrbsTemp.add(item); - } - } - } - return bloodOrbsTemp; - } + private static ArrayList collectAllBloodOrbs() { + ArrayList bloodOrbsTemp = new ArrayList<>(); + for (ItemStack item : ItemList.items) { + if (item != null && item.getItem() instanceof IBloodOrb) { + bloodOrbsTemp.add(item.getItem()); + } + } + if (bloodOrbsTemp.isEmpty()) { + // If there is NEI no cache - go to item registry + for (Object anItemRegistry : Item.itemRegistry) { + Item item = (Item) anItemRegistry; + if (item instanceof IBloodOrb) { + bloodOrbsTemp.add(item); + } + } + } + return bloodOrbsTemp; + } - @Override - public void loadConfig() { - API.registerRecipeHandler(new NEIAlchemyRecipeHandler()); - API.registerUsageHandler(new NEIAlchemyRecipeHandler()); - API.registerRecipeHandler(new NEIAltarRecipeHandler()); - API.registerUsageHandler(new NEIAltarRecipeHandler()); - API.registerRecipeHandler(new NEIBloodOrbShapedHandler()); - API.registerUsageHandler(new NEIBloodOrbShapedHandler()); - API.registerRecipeHandler(new NEIBloodOrbShapelessHandler()); - API.registerUsageHandler(new NEIBloodOrbShapelessHandler()); - API.registerRecipeHandler(new NEIBindingRitualHandler()); - API.registerUsageHandler(new NEIBindingRitualHandler()); - API.registerRecipeHandler(new NEIMeteorRecipeHandler()); - API.registerUsageHandler(new NEIMeteorRecipeHandler()); - } + @Override + public void loadConfig() { + API.registerRecipeHandler(new NEIAlchemyRecipeHandler()); + API.registerUsageHandler(new NEIAlchemyRecipeHandler()); + API.registerRecipeHandler(new NEIAltarRecipeHandler()); + API.registerUsageHandler(new NEIAltarRecipeHandler()); + API.registerRecipeHandler(new NEIBloodOrbShapedHandler()); + API.registerUsageHandler(new NEIBloodOrbShapedHandler()); + API.registerRecipeHandler(new NEIBloodOrbShapelessHandler()); + API.registerUsageHandler(new NEIBloodOrbShapelessHandler()); + API.registerRecipeHandler(new NEIBindingRitualHandler()); + API.registerUsageHandler(new NEIBindingRitualHandler()); + API.registerRecipeHandler(new NEIMeteorRecipeHandler()); + API.registerUsageHandler(new NEIMeteorRecipeHandler()); + } - @Override - public String getName() { - return "Blood Magic NEI"; - } + @Override + public String getName() { + return "Blood Magic NEI"; + } - @Override - public String getVersion() { - return "1.3"; - } + @Override + public String getVersion() { + return "1.3"; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java index ebd07a83..beca43ed 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java @@ -8,13 +8,6 @@ import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - import java.awt.*; import java.text.DecimalFormat; import java.util.ArrayList; @@ -22,6 +15,12 @@ import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; public class NEIMeteorRecipeHandler extends TemplateRecipeHandler { public class CachedMeteorRecipe extends CachedRecipe { @@ -36,7 +35,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler { this.input.add(new PositionedStack(meteor.focusStack, 74, 4)); int row = 0; int col = 0; - + float totalMeteorWeight = meteor.getTotalMeteorWeight(); List sortedComponents = new ArrayList<>(meteor.componentList); sortedComponents.sort(Comparator.comparingInt(c -> -c.chance)); @@ -135,7 +134,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler { } // ignore ore variants (like basalt ore) if (compared.getUnlocalizedName().startsWith("gt.blockores") - && compareTo.getUnlocalizedName().startsWith("gt.blockores")) { + && compareTo.getUnlocalizedName().startsWith("gt.blockores")) { return compared.getItemDamage() % 1000 == compareTo.getItemDamage() % 1000; } return false; @@ -156,8 +155,12 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler { CachedMeteorRecipe meteorRecipe = (CachedMeteorRecipe) this.arecipes.get(recipe); int cost = meteorRecipe.getCost(); int radius = meteorRecipe.getRadius(); - Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("nei.recipe.meteor.cost", String.format("%,d", cost)), 2, 168, 0x000000); - Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("nei.recipe.meteor.radius", radius), 2, 179, 0x000000); + Minecraft.getMinecraft() + .fontRenderer + .drawString(I18n.format("nei.recipe.meteor.cost", String.format("%,d", cost)), 2, 168, 0x000000); + Minecraft.getMinecraft() + .fontRenderer + .drawString(I18n.format("nei.recipe.meteor.radius", radius), 2, 179, 0x000000); } @Override @@ -195,10 +198,9 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler { } private List getSortedMeteors() { - return MeteorRegistry.paradigmList - .stream() - .sorted(Comparator.comparing(m -> m.cost)) - .collect(Collectors.toList()); + return MeteorRegistry.paradigmList.stream() + .sorted(Comparator.comparing(m -> m.cost)) + .collect(Collectors.toList()); } private String getFormattedChance(float chance) { diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/TooltipStack.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/TooltipStack.java index a0771528..992cd744 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/TooltipStack.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/TooltipStack.java @@ -1,8 +1,7 @@ package WayofTime.alchemicalWizardry.client.nei; -import java.util.List; - import codechicken.nei.PositionedStack; +import java.util.List; public class TooltipStack extends PositionedStack { diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/ColourThreshold.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/ColourThreshold.java index 1719b4f6..3fcf6b22 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/ColourThreshold.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/ColourThreshold.java @@ -6,45 +6,34 @@ import java.util.List; * This class is a utility class that was created by bspkrs. * https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/ColorThreshold.java */ -public class ColourThreshold implements Comparable -{ +public class ColourThreshold implements Comparable { public int threshold; public String colorCode; - public ColourThreshold(int t, String c) - { + public ColourThreshold(int t, String c) { threshold = t; colorCode = c; } @Override - public String toString() - { + public String toString() { return String.valueOf(threshold) + ", " + colorCode; } @Override - public int compareTo(ColourThreshold o) - { - if (this.threshold > o.threshold) - return 1; - else if (this.threshold < o.threshold) - return -1; - else - return 0; + public int compareTo(ColourThreshold o) { + if (this.threshold > o.threshold) return 1; + else if (this.threshold < o.threshold) return -1; + else return 0; } /** * Returns the colorCode attached to the first threshold in the list that is * greater than or equal to the value. Expects that the list has been sorted by threshold ascending. */ - public static String getColorCode(List colorList, int value) - { - for (ColourThreshold ct : colorList) - if (value <= ct.threshold) - return ct.colorCode; + public static String getColorCode(List colorList, int value) { + for (ColourThreshold ct : colorList) if (value <= ct.threshold) return ct.colorCode; return "f"; } } - diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDElement.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDElement.java index f3f97f01..2d6b48e2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDElement.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDElement.java @@ -7,8 +7,7 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; -public class HUDElement -{ +public class HUDElement { public final ItemStack itemStack; public final int iconW; public final int iconH; @@ -31,8 +30,7 @@ public class HUDElement static RenderItem itemRenderer = new RenderItem(); - public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value) - { + public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value) { this.itemStack = itemStack; this.iconW = iconW; this.iconH = iconH; @@ -42,28 +40,24 @@ public class HUDElement initSize(); } - public int width() - { + public int width() { return elementW; } - public int height() - { + public int height() { return elementH; } - private void initSize() - { - elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) : - Math.max(mc.fontRenderer.FONT_HEIGHT, iconH); + private void initSize() { + elementH = enableItemName + ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) + : Math.max(mc.fontRenderer.FONT_HEIGHT, iconH); - if (itemStack != null) - { + if (itemStack != null) { int damage; int maxDamage; - if (showValue) - { + if (showValue) { maxDamage = itemStack.getMaxDamage() + 1; damage = maxDamage - itemStack.getItemDamageForDisplay(); @@ -74,58 +68,69 @@ public class HUDElement boolean showMaxDamage = true; boolean thresholdPercent = true; - if (showSpecialValue) - { - itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList, - (thresholdPercent ? damage * 100 / maxDamage : damage)) + this.value; + if (showSpecialValue) { + itemDamage = "\247" + + ColourThreshold.getColorCode( + BloodMagicConfiguration.colorList, + (thresholdPercent ? damage * 100 / maxDamage : damage)) + + this.value; } else if (showValue) - itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList, - (thresholdPercent ? damage * 100 / maxDamage : damage)) + damage + - (showMaxDamage ? "/" + maxDamage : ""); + itemDamage = "\247" + + ColourThreshold.getColorCode( + BloodMagicConfiguration.colorList, + (thresholdPercent ? damage * 100 / maxDamage : damage)) + + damage + (showMaxDamage ? "/" + maxDamage : ""); else if (showPercent) - itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList, - (thresholdPercent ? damage * 100 / maxDamage : damage)) + - (damage * 100 / maxDamage) + "%"; + itemDamage = "\247" + + ColourThreshold.getColorCode( + BloodMagicConfiguration.colorList, + (thresholdPercent ? damage * 100 / maxDamage : damage)) + + (damage * 100 / maxDamage) + + "%"; } itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage)); elementW = padW + iconW + padW + itemDamageW + offset; - if (enableItemName) - { + if (enableItemName) { itemName = itemStack.getDisplayName(); - elementW = padW + iconW + padW + - Math.max(mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW); + elementW = padW + + iconW + + padW + + Math.max(mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW); } itemNameW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)); } } - public void renderToHud(int x, int y) - { + public void renderToHud(int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */); RenderHelper.enableStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting(); itemRenderer.zLevel = 200.0F; - //if (ArmorStatusHUD.alignMode.toLowerCase().contains("right")) + // if (ArmorStatusHUD.alignMode.toLowerCase().contains("right")) boolean toRight = true; - if (toRight) - { - itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y); - HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount); + if (toRight) { + itemRenderer.renderItemAndEffectIntoGUI( + mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y); + HUDUtils.renderItemOverlayIntoGUI( + mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount); RenderHelper.disableStandardItemLighting(); GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */); GL11.glDisable(GL11.GL_BLEND); - mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff); - mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW, - y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff); - } else - { + mc.fontRenderer.drawStringWithShadow( + itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff); + mc.fontRenderer.drawStringWithShadow( + itemDamage + "\247r", + x - (padW + iconW + padW) - itemDamageW, + y + (enableItemName ? elementH / 2 : elementH / 4), + 0xffffff); + } else { itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y); HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount); @@ -134,9 +139,12 @@ public class HUDElement GL11.glDisable(GL11.GL_BLEND); mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x + iconW + padW, y, 0xffffff); - mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x + iconW + padW, - y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff); + mc.fontRenderer.drawStringWithShadow( + itemDamage + "\247r", + x + iconW + padW, + y + (enableItemName ? elementH / 2 : elementH / 4), + 0xffffff); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDUtils.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDUtils.java index 2c42afea..8abae7ed 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDUtils.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/HUDUtils.java @@ -15,13 +15,14 @@ import org.lwjgl.opengl.GL11; * This class is a utility class that was created by bspkrs. * https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/HUDUtils.java */ -public final class HUDUtils -{ - private static int[] colorCodes = new int[]{0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215, - 0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959}; +public final class HUDUtils { + private static int[] colorCodes = new int[] { + 0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, + 16733695, 16777045, 16777215, 0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, + 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 + }; - public static int getColorCode(char c, boolean isLighter) - { + public static int getColorCode(char c, boolean isLighter) { return colorCodes[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16]; } @@ -41,10 +42,31 @@ public final class HUDUtils * @param borderSize the size of the box's borders * @param zLevel the zLevel to draw at */ - public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, - int borderSize, float zLevel) - { - drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); + public static void drawContinuousTexturedBox( + int x, + int y, + int u, + int v, + int width, + int height, + int textureWidth, + int textureHeight, + int borderSize, + float zLevel) { + drawContinuousTexturedBox( + x, + y, + u, + v, + width, + height, + textureWidth, + textureHeight, + borderSize, + borderSize, + borderSize, + borderSize, + zLevel); } /** @@ -64,10 +86,33 @@ public final class HUDUtils * @param borderSize the size of the box's borders * @param zLevel the zLevel to draw at */ - public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, - int borderSize, float zLevel) - { - drawContinuousTexturedBox(res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); + public static void drawContinuousTexturedBox( + ResourceLocation res, + int x, + int y, + int u, + int v, + int width, + int height, + int textureWidth, + int textureHeight, + int borderSize, + float zLevel) { + drawContinuousTexturedBox( + res, + x, + y, + u, + v, + width, + height, + textureWidth, + textureHeight, + borderSize, + borderSize, + borderSize, + borderSize, + zLevel); } /** @@ -90,11 +135,36 @@ public final class HUDUtils * @param rightBorder the size of the box's right border * @param zLevel the zLevel to draw at */ - public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, - int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) - { + public static void drawContinuousTexturedBox( + ResourceLocation res, + int x, + int y, + int u, + int v, + int width, + int height, + int textureWidth, + int textureHeight, + int topBorder, + int bottomBorder, + int leftBorder, + int rightBorder, + float zLevel) { Minecraft.getMinecraft().getTextureManager().bindTexture(res); - drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel); + drawContinuousTexturedBox( + x, + y, + u, + v, + width, + height, + textureWidth, + textureHeight, + topBorder, + bottomBorder, + leftBorder, + rightBorder, + zLevel); } /** @@ -116,9 +186,20 @@ public final class HUDUtils * @param rightBorder the size of the box's right border * @param zLevel the zLevel to draw at */ - public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, - int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) - { + public static void drawContinuousTexturedBox( + int x, + int y, + int u, + int v, + int width, + int height, + int textureWidth, + int textureHeight, + int topBorder, + int bottomBorder, + int leftBorder, + int rightBorder, + float zLevel) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); @@ -137,36 +218,77 @@ public final class HUDUtils // Top Left drawTexturedModalRect(x, y, u, v, leftBorder, topBorder, zLevel); // Top Right - drawTexturedModalRect(x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel); + drawTexturedModalRect( + x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel); // Bottom Left - drawTexturedModalRect(x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel); + drawTexturedModalRect( + x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel); // Bottom Right - drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel); + drawTexturedModalRect( + x + leftBorder + canvasWidth, + y + topBorder + canvasHeight, + u + leftBorder + fillerWidth, + v + topBorder + fillerHeight, + rightBorder, + bottomBorder, + zLevel); - for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++) - { + for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++) { // Top Border - drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel); + drawTexturedModalRect( + x + leftBorder + (i * fillerWidth), + y, + u + leftBorder, + v, + (i == xPasses ? remainderWidth : fillerWidth), + topBorder, + zLevel); // Bottom Border - drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel); + drawTexturedModalRect( + x + leftBorder + (i * fillerWidth), + y + topBorder + canvasHeight, + u + leftBorder, + v + topBorder + fillerHeight, + (i == xPasses ? remainderWidth : fillerWidth), + bottomBorder, + zLevel); // Throw in some filler for good measure for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) - drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel); + drawTexturedModalRect( + x + leftBorder + (i * fillerWidth), + y + topBorder + (j * fillerHeight), + u + leftBorder, + v + topBorder, + (i == xPasses ? remainderWidth : fillerWidth), + (j == yPasses ? remainderHeight : fillerHeight), + zLevel); } // Side Borders - for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) - { + for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) { // Left Border - drawTexturedModalRect(x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel); + drawTexturedModalRect( + x, + y + topBorder + (j * fillerHeight), + u, + v + topBorder, + leftBorder, + (j == yPasses ? remainderHeight : fillerHeight), + zLevel); // Right Border - drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel); + drawTexturedModalRect( + x + leftBorder + canvasWidth, + y + topBorder + (j * fillerHeight), + u + leftBorder + fillerWidth, + v + topBorder, + rightBorder, + (j == yPasses ? remainderHeight : fillerHeight), + zLevel); } } - public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) - { + public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) { float var7 = 0.00390625F; float var8 = 0.00390625F; Tessellator tessellator = Tessellator.instance; @@ -181,22 +303,21 @@ public final class HUDUtils /** * Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position. */ - public static void renderItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y) - { + public static void renderItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y) { renderItemOverlayIntoGUI(fontRenderer, itemStack, x, y, true, true); } /** * Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position. */ - public static void renderItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y, boolean showDamageBar, boolean showCount) - { - if (itemStack != null && (showDamageBar || showCount)) - { - if (itemStack.isItemDamaged() && showDamageBar) - { - int var11 = (int) Math.round(13.0D - itemStack.getItemDamageForDisplay() * 13.0D / itemStack.getMaxDamage()); - int var7 = (int) Math.round(255.0D - itemStack.getItemDamageForDisplay() * 255.0D / itemStack.getMaxDamage()); + public static void renderItemOverlayIntoGUI( + FontRenderer fontRenderer, ItemStack itemStack, int x, int y, boolean showDamageBar, boolean showCount) { + if (itemStack != null && (showDamageBar || showCount)) { + if (itemStack.isItemDamaged() && showDamageBar) { + int var11 = (int) + Math.round(13.0D - itemStack.getItemDamageForDisplay() * 13.0D / itemStack.getMaxDamage()); + int var7 = (int) + Math.round(255.0D - itemStack.getItemDamageForDisplay() * 255.0D / itemStack.getMaxDamage()); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); @@ -212,21 +333,21 @@ public final class HUDUtils GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } - if (showCount) - { + if (showCount) { int count = 0; if (itemStack.getMaxStackSize() > 1) - count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, itemStack.getItem(), itemStack.getItemDamage()); + count = HUDUtils.countInInventory( + Minecraft.getMinecraft().thePlayer, itemStack.getItem(), itemStack.getItemDamage()); else if (itemStack.getItem().equals(Items.bow)) count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, Items.arrow); - if (count > 1) - { + if (count > 1) { String var6 = "" + count; GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); - fontRenderer.drawStringWithShadow(var6, x + 19 - 2 - fontRenderer.getStringWidth(var6), y + 6 + 3, 16777215); + fontRenderer.drawStringWithShadow( + var6, x + 19 - 2 - fontRenderer.getStringWidth(var6), y + 6 + 3, 16777215); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); } @@ -238,8 +359,7 @@ public final class HUDUtils * Adds a quad to the tesselator at the specified position with the set width and height and color. Args: tessellator, x, y, width, * height, color */ - public static void renderQuad(Tessellator tessellator, int x, int y, int width, int height, int color) - { + public static void renderQuad(Tessellator tessellator, int x, int y, int width, int height, int color) { tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(color); tessellator.addVertex((x + 0), (y + 0), 0.0D); @@ -249,23 +369,21 @@ public final class HUDUtils tessellator.draw(); } - public static int countInInventory(EntityPlayer player, Item item) - { + public static int countInInventory(EntityPlayer player, Item item) { return countInInventory(player, item, -1); } - public static int countInInventory(EntityPlayer player, Item item, int md) - { + public static int countInInventory(EntityPlayer player, Item item, int md) { int count = 0; for (int i = 0; i < player.inventory.mainInventory.length; i++) - if (player.inventory.mainInventory[i] != null && item.equals(player.inventory.mainInventory[i].getItem()) && (md == -1 || player.inventory.mainInventory[i].getItemDamage() == md)) + if (player.inventory.mainInventory[i] != null + && item.equals(player.inventory.mainInventory[i].getItem()) + && (md == -1 || player.inventory.mainInventory[i].getItemDamage() == md)) count += player.inventory.mainInventory[i].stackSize; return count; } - public static String stripCtrl(String s) - { + public static String stripCtrl(String s) { return s.replaceAll("(?i)\247[0-9a-fklmnor]", ""); } } - diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderFakeBlocks.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderFakeBlocks.java index 1ddd11d2..5fe58dc2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderFakeBlocks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderFakeBlocks.java @@ -9,15 +9,20 @@ import net.minecraft.world.World; * Created in Scala by Alex-Hawks * Translated and implemented by Arcaratus */ -public class RenderFakeBlocks -{ - public static void drawFakeBlock(WayofTime.alchemicalWizardry.api.Vector3 vector3, Block block, int meta, double minX, double minY, double minZ, World world) - { +public class RenderFakeBlocks { + public static void drawFakeBlock( + WayofTime.alchemicalWizardry.api.Vector3 vector3, + Block block, + int meta, + double minX, + double minY, + double minZ, + World world) { double maxX = minX + 1; double maxY = minY + 1; double maxZ = minZ + 1; Tessellator tessellator = Tessellator.instance; - + tessellator.startDrawingQuads(); tessellator.setColorRGBA(255, 255, 255, 200); @@ -80,26 +85,22 @@ public class RenderFakeBlocks tessellator.draw(); } - private static float getMinU(Block block, int meta, int side) - { + private static float getMinU(Block block, int meta, int side) { IIcon icon = block.getIcon(side, meta); return icon.getMinU(); } - private static float getMaxU(Block block, int meta, int side) - { + private static float getMaxU(Block block, int meta, int side) { IIcon icon = block.getIcon(side, meta); return icon.getMaxU(); } - private static float getMinV(Block block, int meta, int side) - { + private static float getMinV(Block block, int meta, int side) { IIcon icon = block.getIcon(side, meta); return icon.getMinV(); } - private static float getMaxV(Block block, int meta, int side) - { + private static float getMaxV(Block block, int meta, int side) { IIcon icon = block.getIcon(side, meta); return icon.getMaxV(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java index 964feb72..9ae0220c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java @@ -1,8 +1,15 @@ package WayofTime.alchemicalWizardry.client.renderer; +import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.ArrayList; import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.ScaledResolution; @@ -15,27 +22,16 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; - -public class RenderHelper -{ +public class RenderHelper { public static boolean enableItemName = false; public static boolean enabled = true; public static boolean showInChat = true; - + public static int lpBarX = 12; public static int lpBarY = 75; - + public static int zLevel = 0; private static int xOffsetDefault = +50; @@ -54,159 +50,142 @@ public class RenderHelper private static ScaledResolution scaledResolution; - public static boolean onTickInGame(Minecraft mc) - { - if (enabled && (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat && showInChat)) - && !mc.gameSettings.showDebugInfo) - { + public static boolean onTickInGame(Minecraft mc) { + if (enabled + && (mc.inGameHasFocus + || mc.currentScreen == null + || (mc.currentScreen instanceof GuiChat && showInChat)) + && !mc.gameSettings.showDebugInfo) { EntityPlayer player = mc.thePlayer; player.getEntityData(); - if (SpellHelper.canPlayerSeeAlchemy(player)) - { + if (SpellHelper.canPlayerSeeAlchemy(player)) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); displayArmorStatus(mc); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } - + ItemStack stack = player.inventory.armorItemInSlot(2); - if(stack != null && stack.getItem() instanceof OmegaArmour) - { + if (stack != null && stack.getItem() instanceof OmegaArmour) { int maxAmount = (int) APISpellHelper.getPlayerMaxReagentAmount(player); - - if(maxAmount > 0) - { - float val = APISpellHelper.getPlayerCurrentReagentAmount(player); - ReagentStack reagentStack = new ReagentStack(APISpellHelper.getPlayerReagentType(player), (int) val); - - if(reagentStack != null && reagentStack.amount > 0) - { + + if (maxAmount > 0) { + float val = APISpellHelper.getPlayerCurrentReagentAmount(player); + ReagentStack reagentStack = + new ReagentStack(APISpellHelper.getPlayerReagentType(player), (int) val); + + if (reagentStack != null && reagentStack.amount > 0) { renderTestHUD(mc, reagentStack, maxAmount); } - } + } } - - if(SpellHelper.canPlayerSeeLPBar(player)) - { + + if (SpellHelper.canPlayerSeeLPBar(player)) { int max = APISpellHelper.getPlayerMaxLPTag(player); - - if(max > 1) - { + + if (max > 1) { renderLPHUD(mc, APISpellHelper.getPlayerLPTag(player), max); } } - + float maxHP = APISpellHelper.getCurrentAdditionalMaxHP(player); -// System.out.println("MaxHP: " + maxHP); - if(maxHP > 0) - { + // System.out.println("MaxHP: " + maxHP); + if (maxHP > 0) { renderHPHUD(mc, APISpellHelper.getCurrentAdditionalHP(player), maxHP); } } return true; } - - private static void renderLPHUD(Minecraft mc, int lpAmount, int maxAmount) - { - GL11.glPushMatrix(); - int xSize = 32; - int ySize = 32; - - int amount = Math.max((int) (256 * ((double)(maxAmount - lpAmount) / maxAmount)), 0); - - int x = (lpBarX - xSize / 2) * 8; + + private static void renderLPHUD(Minecraft mc, int lpAmount, int maxAmount) { + GL11.glPushMatrix(); + int xSize = 32; + int ySize = 32; + + int amount = Math.max((int) (256 * ((double) (maxAmount - lpAmount) / maxAmount)), 0); + + int x = (lpBarX - xSize / 2) * 8; int y = (lpBarY - ySize / 2) * 8; - + ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png"); GL11.glColor4f(1, 0, 0, 1.0F); mc.getTextureManager().bindTexture(test2); - - GL11.glScalef(1f/8f, 1f/8f, 1f/8f); - + + GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f); + drawTexturedModalRect(x, y + amount, 0, amount, 256, 256 - amount); - + ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/lpVial.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(test); - drawTexturedModalRect(x, y, 0, 0, 256, 256); - + GL11.glPopMatrix(); } - - private static void renderHPHUD(Minecraft mc, float hpAmount, float maxAmount) - { - GL11.glPushMatrix(); - int xSize = 32; - int ySize = 32; - - int amount = Math.max((int) (256 * ((double)(hpAmount) / maxAmount)), 0); - - int x = (lpBarX + 8 - xSize / 2) * 8; + + private static void renderHPHUD(Minecraft mc, float hpAmount, float maxAmount) { + GL11.glPushMatrix(); + int xSize = 32; + int ySize = 32; + + int amount = Math.max((int) (256 * ((double) (hpAmount) / maxAmount)), 0); + + int x = (lpBarX + 8 - xSize / 2) * 8; int y = (lpBarY + 32 - ySize / 2) * 8; - + ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/HPBar2.png"); GL11.glColor4f(1, 0, 0, 1.0F); mc.getTextureManager().bindTexture(test2); - - GL11.glScalef(1f/8f, 1f/8f, 1f/8f); - + + GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f); + drawTexturedModalRect(x, y, amount, 0, amount, 256); - + ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/HPBar1.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(test); - drawTexturedModalRect(x, y, 0, 0, 256, 256); - + GL11.glPopMatrix(); } - private static List getHUDElements(Minecraft mc) - { + private static List getHUDElements(Minecraft mc) { List elements = new ArrayList(); MovingObjectPosition movingobjectposition = mc.objectMouseOver; World world = mc.theWorld; - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return elements; - } 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 IReagentHandler)) - { + if (!(tile instanceof IReagentHandler)) { return elements; } IReagentHandler relay = (IReagentHandler) tile; - ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit)); + ReagentContainerInfo[] infos = + relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit)); - if (infos != null) - { - for (ReagentContainerInfo info : infos) - { - if (info == null || info.reagent == null || info.reagent.reagent == null) - { + if (infos != null) { + for (ReagentContainerInfo info : infos) { + if (info == null || info.reagent == null || info.reagent.reagent == null) { continue; } ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent); - if (itemStack != null) - elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount)); + if (itemStack != null) elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount)); } } } @@ -215,123 +194,143 @@ public class RenderHelper return elements; } - private static int getX(int width) - { + private static int getX(int width) { if (alignMode.toLowerCase().contains("center")) return scaledResolution.getScaledWidth() / 2 - width / 2 + (applyXOffsetToCenter ? xOffset : 0); - else if (alignMode.toLowerCase().contains("right")) - return scaledResolution.getScaledWidth() - width - xOffset; - else - return xOffset; + else if (alignMode.toLowerCase().contains("right")) return scaledResolution.getScaledWidth() - width - xOffset; + else return xOffset; } - private static int getY(int rowCount, int height) - { + private static int getY(int rowCount, int height) { if (alignMode.toLowerCase().contains("middle")) - return (scaledResolution.getScaledHeight() / 2) - ((rowCount * height) / 2) + (applyYOffsetToMiddle ? yOffset : 0); + return (scaledResolution.getScaledHeight() / 2) + - ((rowCount * height) / 2) + + (applyYOffsetToMiddle ? yOffset : 0); else if (alignMode.equalsIgnoreCase("bottomleft") || alignMode.equalsIgnoreCase("bottomright")) return scaledResolution.getScaledHeight() - (rowCount * height) - yOffset; else if (alignMode.equalsIgnoreCase("bottomcenter")) return scaledResolution.getScaledHeight() - (rowCount * height) - yOffsetBottomCenter; - else - return yOffset; + else return yOffset; } - private static int getElementsWidth(List elements) - { + private static int getElementsWidth(List elements) { int r = 0; - for (HUDElement he : elements) - r += he.width(); + for (HUDElement he : elements) r += he.width(); return r; } - - public static void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, double p_73729_5_, double p_73729_6_) - { + + public static void drawTexturedModalRect( + int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, double p_73729_5_, double p_73729_6_) { float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); - tessellator.addVertexWithUV((double)p_73729_1_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ * f), (p_73729_4_ + p_73729_6_) * f1); - tessellator.addVertexWithUV(p_73729_1_ + p_73729_5_, p_73729_2_ + p_73729_6_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, (p_73729_4_ + p_73729_6_) * f1); - tessellator.addVertexWithUV(p_73729_1_ + p_73729_5_, (double)p_73729_2_, (double)zLevel, (p_73729_3_ + p_73729_5_) * f, p_73729_4_ * f1); - tessellator.addVertexWithUV((double)p_73729_1_, (double)p_73729_2_, (double)zLevel, (double)(p_73729_3_ * f), p_73729_4_ * f1); + tessellator.addVertexWithUV( + (double) p_73729_1_, + p_73729_2_ + p_73729_6_, + (double) zLevel, + (p_73729_3_ * f), + (p_73729_4_ + p_73729_6_) * f1); + tessellator.addVertexWithUV( + p_73729_1_ + p_73729_5_, + p_73729_2_ + p_73729_6_, + (double) zLevel, + (p_73729_3_ + p_73729_5_) * f, + (p_73729_4_ + p_73729_6_) * f1); + tessellator.addVertexWithUV( + p_73729_1_ + p_73729_5_, + (double) p_73729_2_, + (double) zLevel, + (p_73729_3_ + p_73729_5_) * f, + p_73729_4_ * f1); + tessellator.addVertexWithUV( + (double) p_73729_1_, (double) p_73729_2_, (double) zLevel, (double) (p_73729_3_ * f), p_73729_4_ * f1); tessellator.draw(); } - - private static void renderTestHUD(Minecraft mc, ReagentStack reagentStack, int maxAmount) - { - GL11.glPushMatrix(); - Reagent reagent = reagentStack.reagent; - int xSize = 32; - int ySize = 32; - - int amount = Math.max((int) (256 * ((double)(maxAmount - reagentStack.amount) / maxAmount)), 0); - - int x = (lpBarX + 16 - xSize / 2) * 8; + + private static void renderTestHUD(Minecraft mc, ReagentStack reagentStack, int maxAmount) { + GL11.glPushMatrix(); + Reagent reagent = reagentStack.reagent; + int xSize = 32; + int ySize = 32; + + int amount = Math.max((int) (256 * ((double) (maxAmount - reagentStack.amount) / maxAmount)), 0); + + int x = (lpBarX + 16 - xSize / 2) * 8; int y = (lpBarY - ySize / 2) * 8; - - GL11.glScalef(1f/8f, 1f/8f, 1f/8f); - + + GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f); + ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png"); - GL11.glColor4f(reagent.getColourRed() / 255f, reagent.getColourGreen() / 255f, reagent.getColourBlue() / 255f, 1.0F); + GL11.glColor4f( + reagent.getColourRed() / 255f, reagent.getColourGreen() / 255f, reagent.getColourBlue() / 255f, 1.0F); mc.getTextureManager().bindTexture(test2); - + drawTexturedModalRect(x, y + amount, 0, amount, 256, 256 - amount); - + ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/container.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(test); - drawTexturedModalRect(x, y, 0, 0, 256, 256); - + GL11.glPopMatrix(); } - - public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_) - { + + public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); - tessellator.addVertexWithUV((double)p_94149_1_, (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMaxV()); - tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMaxV()); - tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)p_94149_2_, (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMinV()); - tessellator.addVertexWithUV((double)p_94149_1_, (double)p_94149_2_, (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMinV()); + tessellator.addVertexWithUV( + (double) p_94149_1_, + (double) (p_94149_2_ + p_94149_5_), + (double) zLevel, + (double) p_94149_3_.getMinU(), + (double) p_94149_3_.getMaxV()); + tessellator.addVertexWithUV( + (double) (p_94149_1_ + p_94149_4_), + (double) (p_94149_2_ + p_94149_5_), + (double) zLevel, + (double) p_94149_3_.getMaxU(), + (double) p_94149_3_.getMaxV()); + tessellator.addVertexWithUV( + (double) (p_94149_1_ + p_94149_4_), + (double) p_94149_2_, + (double) zLevel, + (double) p_94149_3_.getMaxU(), + (double) p_94149_3_.getMinV()); + tessellator.addVertexWithUV( + (double) p_94149_1_, (double) p_94149_2_, (double) zLevel, (double) p_94149_3_.getMinU(), (double) + p_94149_3_.getMinV()); tessellator.draw(); } - private static void displayArmorStatus(Minecraft mc) - { + private static void displayArmorStatus(Minecraft mc) { List elements = getHUDElements(mc); - if (elements.size() > 0) - { + if (elements.size() > 0) { int yOffset = enableItemName ? 18 : 16; - if (listMode.equalsIgnoreCase("vertical")) - { + if (listMode.equalsIgnoreCase("vertical")) { int yBase = getY(elements.size(), yOffset); - for (HUDElement e : elements) - { + for (HUDElement e : elements) { e.renderToHud((alignMode.toLowerCase().contains("right") ? getX(0) : getX(e.width())), yBase); yBase += yOffset; } - } else if (listMode.equalsIgnoreCase("horizontal")) - { + } else if (listMode.equalsIgnoreCase("horizontal")) { int totalWidth = getElementsWidth(elements); int yBase = getY(1, yOffset); int xBase = getX(totalWidth); int prevX = 0; - for (HUDElement e : elements) - { + for (HUDElement e : elements) { e.renderToHud(xBase + prevX + (alignMode.toLowerCase().contains("right") ? e.width() : 0), yBase); prevX += (e.width()); } - } //else if (listMode.equalsIgnoreCase("compound")) + } // else if (listMode.equalsIgnoreCase("compound")) { - //TODO + // TODO } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java index 94b0cfc1..3ad72cba 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java @@ -1,9 +1,5 @@ package WayofTime.alchemicalWizardry.client.renderer; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; - import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.api.Vector3; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; @@ -12,80 +8,81 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.rituals.Rituals; import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderWorldLastEvent; +import org.lwjgl.opengl.GL11; /* * Created in Scala by Alex-Hawks * Translated and implemented by Arcaratus */ @SideOnly(Side.CLIENT) -public class RitualDivinerRender -{ +public class RitualDivinerRender { @SubscribeEvent - public void render(RenderWorldLastEvent event) - { + public void render(RenderWorldLastEvent event) { Minecraft minecraft = Minecraft.getMinecraft(); EntityClientPlayerMP player = minecraft.thePlayer; World world = player.worldObj; - if (minecraft.objectMouseOver == null || minecraft.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) - { + if (minecraft.objectMouseOver == null + || minecraft.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { return; } - TileEntity tileEntity = world.getTileEntity(minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ); + TileEntity tileEntity = world.getTileEntity( + minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ); - if (!(tileEntity instanceof IMasterRitualStone)) - { + if (!(tileEntity instanceof IMasterRitualStone)) { return; } - Vector3 vec3 = new Vector3(minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ); + Vector3 vec3 = new Vector3( + minecraft.objectMouseOver.blockX, minecraft.objectMouseOver.blockY, minecraft.objectMouseOver.blockZ); double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.partialTicks; double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.partialTicks; double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.partialTicks; - if (player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemRitualDiviner) - { - ItemRitualDiviner ritualDiviner = (ItemRitualDiviner) player.inventory.getCurrentItem().getItem(); + if (player.inventory.getCurrentItem() != null + && player.inventory.getCurrentItem().getItem() instanceof ItemRitualDiviner) { + ItemRitualDiviner ritualDiviner = + (ItemRitualDiviner) player.inventory.getCurrentItem().getItem(); int direction = ritualDiviner.getDirection(player.inventory.getCurrentItem()); - RitualEffect ritualEffect = getEffectFromString(ritualDiviner.getCurrentRitual(player.inventory.getCurrentItem())); + RitualEffect ritualEffect = + getEffectFromString(ritualDiviner.getCurrentRitual(player.inventory.getCurrentItem())); - if (ritualEffect == null) - { + if (ritualEffect == null) { return; } GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - for (RitualComponent ritualComponent : ritualEffect.getRitualComponentList()) - { - Vector3 vX = vec3.add(new Vector3(ritualComponent.getX(direction), ritualComponent.getY(), ritualComponent.getZ(direction))); + for (RitualComponent ritualComponent : ritualEffect.getRitualComponentList()) { + Vector3 vX = vec3.add(new Vector3( + ritualComponent.getX(direction), ritualComponent.getY(), ritualComponent.getZ(direction))); double minX = vX.x - posX; double minY = vX.y - posY; double minZ = vX.z - posZ; - if (!world.getBlock(vX.x, vX.y, vX.z).isOpaqueCube()) - { - RenderFakeBlocks.drawFakeBlock(vX, ModBlocks.ritualStone, ritualComponent.getStoneType(), minX, minY, minZ, world); + if (!world.getBlock(vX.x, vX.y, vX.z).isOpaqueCube()) { + RenderFakeBlocks.drawFakeBlock( + vX, ModBlocks.ritualStone, ritualComponent.getStoneType(), minX, minY, minZ, world); } } GL11.glPopMatrix(); } } - public static RitualEffect getEffectFromString(String name) - { + public static RitualEffect getEffectFromString(String name) { Rituals ritual = Rituals.ritualMap.get(name); - if (ritual == null) - return null; + if (ritual == null) return null; return ritual.effect; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index 9bd1b978..88d2e9d0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -1,12 +1,35 @@ package WayofTime.alchemicalWizardry.common; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.BloodMagicConfiguration; +import WayofTime.alchemicalWizardry.api.BlockStack; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.event.TeleposeEvent; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.common.achievements.ModAchievements; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon; +import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; +import WayofTime.alchemicalWizardry.common.items.EnergySword; +import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; +import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; +import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; +import WayofTime.alchemicalWizardry.common.omega.ReagentRegenConfiguration; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import cpw.mods.fml.client.event.ConfigChangedEvent; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; @@ -34,834 +57,815 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import net.minecraftforge.event.entity.player.EntityInteractEvent; import vazkii.botania.api.internal.IManaBurst; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.BloodMagicConfiguration; -import WayofTime.alchemicalWizardry.api.BlockStack; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.event.TeleposeEvent; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.common.achievements.ModAchievements; -import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon; -import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; -import WayofTime.alchemicalWizardry.common.items.EnergySword; -import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; -import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; -import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; -import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; -import WayofTime.alchemicalWizardry.common.omega.ReagentRegenConfiguration; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; -import cpw.mods.fml.client.event.ConfigChangedEvent; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; - -public class AlchemicalWizardryEventHooks -{ - public static Map playerFlightBuff = new HashMap(); - public static List playersWith1Step = new ArrayList(); - - public static Map> respawnMap = new HashMap(); - public static Map> forceSpawnMap = new HashMap(); - public static ArrayList teleposerBlacklist = new ArrayList(); - - public static Random rand = new Random(); - - @SubscribeEvent - public void onEntityInteractEvent(EntityInteractEvent event) - { - EntityPlayer player = event.entityPlayer; - OmegaParadigm parad = OmegaRegistry.getOmegaParadigmOfWeilder(player); - if(parad == null) - { - return; - } - ItemStack heldItem = player.getHeldItem(); - if(heldItem == null) - { - parad.onEmptyHandEntityInteract(player, event.target); - }else - { - if(heldItem.getItem() instanceof EnergySword) - { - parad.onBoundSwordInteractWithEntity(player, event.target); - } - } - } - - @SubscribeEvent - public void onAnvilUpdateEvent(AnvilUpdateEvent event) - { - if(event.isCancelable() && event.left != null && event.right != null && (event.left.getItem() instanceof BoundArmour || event.right.getItem() instanceof BoundArmour)) - { - event.setCanceled(true); - } - } - - @SubscribeEvent(priority=EventPriority.HIGHEST) - public void onLivingHurtEvent(LivingHurtEvent event) - { - if(!event.isCanceled() && event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.isRemote) - { - EntityPlayer player = (EntityPlayer)event.entityLiving; - - if(APISpellHelper.getCurrentAdditionalMaxHP(player) > 0) - { - APISpellHelper.setPlayerReagentRegenCooldownTag(player, 20 * 20); - } - - float prevHp = APISpellHelper.getCurrentAdditionalHP((EntityPlayer)event.entityLiving); - if(prevHp > 0) - { - float recalculatedAmount = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, event.source, event.ammount); - if (recalculatedAmount <= 0) return; - recalculatedAmount = SpellHelper.applyPotionDamageCalculations(player, event.source, recalculatedAmount); //Recalculated damage - - float ratio = recalculatedAmount / event.ammount; - - float f1 = recalculatedAmount; - recalculatedAmount = Math.max(recalculatedAmount - player.getAbsorptionAmount(), 0.0F); - player.setAbsorptionAmount(player.getAbsorptionAmount() - (f1 - recalculatedAmount)); - - if(prevHp > recalculatedAmount) - { - float hp = (prevHp - recalculatedAmount); //New HP - this is obviously > 0... - -// event.setCanceled(true); - event.ammount = 0; - Reagent reagent = APISpellHelper.getPlayerReagentType(player); - OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent); - if(paradigm != null) - { - ItemStack chestStack = player.inventory.armorInventory[2]; - - if(chestStack != null && chestStack.getItem() instanceof OmegaArmour) - { - if(((OmegaArmour)chestStack.getItem()).paradigm == paradigm) - { - paradigm.onHPBarDepleted(player, chestStack); - } - } - } - - APISpellHelper.setCurrentAdditionalHP(player, hp); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(hp, APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP)player); - -// if(event.ammount <= 0.3) -// { -// event.ammount++; -// } - }else - { - APISpellHelper.setCurrentAdditionalHP(player, 0); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP)player); - - event.ammount -= prevHp / ratio; - if(event.ammount < 0) - { - event.ammount = 0; - } - } - } - } - } - - @SubscribeEvent - public void omegaUpdateReagentAndHpEvent(LivingUpdateEvent event) - { - if(event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.isRemote) - { - EntityPlayer player = (EntityPlayer)event.entityLiving; - Reagent reagent = APISpellHelper.getPlayerReagentType(player); - float reagentAmount = APISpellHelper.getPlayerCurrentReagentAmount(player); - - boolean hasReagentChanged = false; - - if(reagentAmount > 0 && OmegaRegistry.hasParadigm(reagent)) - { - int cooldown = APISpellHelper.getPlayerReagentRegenCooldownTag(player); - boolean canHealHPBar = true; - if(cooldown > 0) - { - float extra = 0; - if(player.isPotionActive(AlchemicalWizardry.customPotionSoulHarden)) - { - extra += 0.25f * (1 + player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulHarden).getAmplifier()); - } - - if(player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) - { - extra -= 0.25f * (1 + player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray).getAmplifier()); - } - - int deduction = - 1 - (extra >= 0 ? (rand.nextFloat() < extra ? 1 : 0) : (rand.nextFloat() < -extra/2 ? -1 : 0)); - - APISpellHelper.setPlayerReagentRegenCooldownTag(player, Math.max(cooldown + deduction, 0)); - canHealHPBar = false; - } - - OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent); - ReagentRegenConfiguration config = parad.getRegenConfig(player); - - if(parad.isPlayerWearingFullSet(player)) - { - if(canHealHPBar) - { - int tickRate = config.tickRate; - - if(player.isPotionActive(Potion.regeneration)) - { - int i = player.getActivePotionEffect(Potion.regeneration).getAmplifier(); - double factor = Math.pow(1.5, i+1); - tickRate = Math.max((int)(tickRate / factor), 1); - } - - if(event.entityLiving.worldObj.getWorldTime() % tickRate == 0) - { - boolean hasHealthChanged = false; - int maxHealth = parad.getMaxAdditionalHealth(); - - float health = APISpellHelper.getCurrentAdditionalHP(player); - - if(health > maxHealth) - { - health = maxHealth; - hasHealthChanged = true; - }else if(health < maxHealth) - { - float addedAmount = Math.min(Math.min((reagentAmount / config.costPerPoint), config.healPerTick), maxHealth - health); - float drain = addedAmount * config.costPerPoint; - - reagentAmount -= drain; - hasReagentChanged = true; - - health += addedAmount; - - hasHealthChanged = true; - } - - if(player instanceof EntityPlayerMP) - { - if(hasHealthChanged) - { - APISpellHelper.setCurrentAdditionalHP(player, health); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(health, maxHealth), (EntityPlayerMP)player); - } - } - } - } - - }else - { - reagentAmount = 0; - APISpellHelper.setPlayerMaxReagentAmount(player, 0); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(null, 0, 0), (EntityPlayerMP)player); - APISpellHelper.setCurrentAdditionalHP(player, 0); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, 0), (EntityPlayerMP)player); - } - //Consumes the amount - float costPerTick = parad.getCostPerTickOfUse(player); - if(parad.doDrainReagent(player)) - { - if(reagentAmount > costPerTick) - { - hasReagentChanged = true; - reagentAmount = Math.max(0, reagentAmount - costPerTick); - }else - { - hasReagentChanged = true; - reagentAmount = 0; - } - } - - - hasReagentChanged = true; - } - - if(reagentAmount <= 0) - { - boolean hasRevertedArmour = false; - ItemStack[] armourInventory = player.inventory.armorInventory; - for(ItemStack stack : armourInventory) - { - if(stack != null && stack.getItem() instanceof OmegaArmour) - { - ((OmegaArmour)stack.getItem()).revertArmour(player, stack); - hasRevertedArmour = true; - } - } - - if(hasRevertedArmour) - { - APISpellHelper.setCurrentAdditionalHP(player, 0); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, 0), (EntityPlayerMP)player); - } - } - - if(player instanceof EntityPlayerMP) - { - if(hasReagentChanged) - { - APISpellHelper.setPlayerCurrentReagentAmount(player, reagentAmount); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(reagent, reagentAmount, APISpellHelper.getPlayerMaxReagentAmount(player)), (EntityPlayerMP)player); - } - } - } - } - - @SubscribeEvent(priority=EventPriority.HIGHEST) - public void onPlayerDamageEvent(LivingAttackEvent event) - { - if (event.source.isProjectile()) - { - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt) && event.isCancelable()) - { - event.setCanceled(true); - } - } - } - - @SubscribeEvent - public void onLivingSpawnEvent(CheckSpawn event) - { - if (!(event.entityLiving instanceof EntityMob)) - { - return; - } - - String respawnRitual = "AW028SpawnWard"; - - int dimension = event.world.provider.dimensionId; - if (respawnMap.containsKey(dimension)) - { - List list = respawnMap.get(dimension); - - if (list != null) - { - for (CoordAndRange coords : list) - { - TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord); - - if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual)) - { - if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius) - { - switch (event.getResult()) - { - case ALLOW: - event.setResult(Result.DEFAULT); - break; - case DEFAULT: - event.setResult(Result.DENY); - break; - case DENY: - break; - default: - break; - } - break; - } - } else - { - list.remove(coords); - } - } - } - } - - if (event.entityLiving instanceof EntityCreeper) - { - return; - } - - String forceSpawnRitual = "AW029VeilOfEvil"; - - if (forceSpawnMap.containsKey(dimension)) - { - List list = forceSpawnMap.get(dimension); - - if (list != null) - { - for (CoordAndRange coords : list) - { - TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord); - - if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual)) - { - if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius) - { - switch (event.getResult()) - { - case ALLOW: - break; - case DEFAULT: - event.setResult(Result.ALLOW); - break; - case DENY: - event.setResult(Result.DEFAULT); - break; - default: - break; - } - break; - } - } else - { - list.remove(coords); - } - } - } - } - } - - @SubscribeEvent - public void onPlayerRespawnEvent(PlayerRespawnEvent event) - { - if (AlchemicalWizardry.respawnWithDebuff && event.player != null) - { - event.player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, 20 * 60 * 5, 0)); - } - } - - @SubscribeEvent - public void onLivingJumpEvent(LivingJumpEvent event) - { -// event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).removeModifier(new AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0)); - //event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0)); - - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost)) - { - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier(); - event.entityLiving.motionY += (0.1f) * (2 + i); - } - - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart)) - { - event.entityLiving.motionY = 0; - } - } - - @SubscribeEvent - public void onEndermanTeleportEvent(EnderTeleportEvent event) - { - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable()) - { - event.setCanceled(true); - } - } - - @SubscribeEvent - public void onEntityDamaged(LivingAttackEvent event) - { - EntityLivingBase entityAttacked = event.entityLiving; - - if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionReciprocation)) - { - Entity entityAttacking = event.source.getSourceOfDamage(); - - if (entityAttacking != null && entityAttacking instanceof EntityLivingBase) - { - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionReciprocation).getAmplifier(); - float damageRecieve = event.ammount / 2 * (i + 1); - entityAttacking.attackEntityFrom(DamageSource.generic, damageRecieve); - } - } - - if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) - { - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier(); - - Entity entityAttacking = event.source.getSourceOfDamage(); - - if (entityAttacking != null && entityAttacking instanceof EntityLivingBase && !entityAttacking.isImmuneToFire() && !((EntityLivingBase) entityAttacking).isPotionActive(Potion.fireResistance)) - { - entityAttacking.attackEntityFrom(DamageSource.inFire, 2 * i + 2); - entityAttacking.setFire(3); - } - } - } - - -// @SubscribeEvent -// public void onFOVUpdate(FOVUpdateEvent event) -// { -// event.setResult(Result.DENY); -// } - // @SubscribeEvent - // public void onPlayerTickEnd(PlayerTickEvent event) - // { - // if(event.type.equals(Type.PLAYER) && event.phase.equals(TickEvent.Phase.END)) - // { - // ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"}); - // } - // } - - @SubscribeEvent - public void onEntityUpdate(LivingUpdateEvent event) - { - EntityLivingBase entityLiving = event.entityLiving; - double x = entityLiving.posX; - double y = entityLiving.posY; - double z = entityLiving.posZ; - - Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving); - int xPos = (int) (blockVector.xCoord); - int yPos = (int) (blockVector.yCoord); - int zPos = (int) (blockVector.zCoord); - - if (entityLiving instanceof EntityPlayer) - { - if(!entityLiving.worldObj.isRemote && entityLiving.worldObj.getTotalWorldTime() % 20 == 0) - { - if(entityLiving instanceof EntityPlayerMP) - { - String ownerName = SoulNetworkHandler.getUsername((EntityPlayer)entityLiving); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getLPPacket(SoulNetworkHandler.getCurrentEssence(ownerName), SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(ownerName))), (EntityPlayerMP)entityLiving); - } - } -// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer) event.entityLiving).capabilities, 0.1F, "walkSpeed", "g", "field_75097_g"); - } - - if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote) - { - EntityPlayer entityPlayer = (EntityPlayer) entityLiving; - boolean highStepListed = playersWith1Step.contains(entityPlayer.getDisplayName()); - boolean hasHighStep = entityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost); - - if (hasHighStep && !highStepListed) - { - playersWith1Step.add(SpellHelper.getUsername(entityPlayer)); - } - - if (!hasHighStep && highStepListed) - { - playersWith1Step.remove(SpellHelper.getUsername(entityPlayer)); - entityPlayer.stepHeight = 0.5F; - } - } - - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) - { - event.entityLiving.fallDistance = 0; - } - - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning) && ! event.entityLiving.isPotionActive(Potion.waterBreathing)) - { - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier(); - - if (event.entityLiving.worldObj.getWorldTime() % (20 / (i + 1)) == 0) - { - event.entityLiving.attackEntityFrom(DamageSource.drown, 2); - event.entityLiving.hurtResistantTime = Math.min(event.entityLiving.hurtResistantTime, 20 / (i + 1)); - } - } - -// event.entityLiving.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeAllModifiers(); - - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost)) - { - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier(); - //if(!entity.isSneaking()) - { - float percentIncrease = (i + 1) * 0.05f; - -// AttributeModifier speedModifier = new AttributeModifier(new UUID(213241, 3), "Potion Boost", percentIncrease, 0); -// -// event.entityLiving.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(speedModifier); - - if (event.entityLiving instanceof EntityPlayer) - { - EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving; - entityPlayer.stepHeight = 1.0f; - - if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F) - entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease); - } - } - } - - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt)) - { - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionProjProt).getAmplifier(); - EntityLivingBase entity = event.entityLiving; - int posX = (int) Math.round(entity.posX - 0.5f); - int posY = (int) Math.round(entity.posY); - int posZ = (int) Math.round(entity.posZ - 0.5f); - int d0 = (int) ((i + 1) * 2.5); - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0); - List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb); - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) - { - Entity projectile = (Entity) iterator.next(); - - if (projectile == null) - { - continue; - } - - if (!(projectile instanceof IProjectile) || (AlchemicalWizardry.isBotaniaLoaded && isManaBurst(projectile))) - { - continue; - } - - Entity throwingEntity = null; - - if (projectile instanceof EntityArrow) - { - throwingEntity = ((EntityArrow) projectile).shootingEntity; - } else if (projectile instanceof EnergyBlastProjectile) - { - throwingEntity = ((EnergyBlastProjectile) projectile).shootingEntity; - } else if (projectile instanceof EntityThrowable) - { - throwingEntity = ((EntityThrowable) projectile).getThrower(); - } - - if (throwingEntity != null && throwingEntity.equals(entity)) - { - continue; - } - - double delX = projectile.posX - entity.posX; - double delY = projectile.posY - entity.posY; - double delZ = projectile.posZ - entity.posZ; - - double angle = (delX*projectile.motionX + delY*projectile.motionY + delZ*projectile.motionZ)/ - (Math.sqrt(delX * delX + delY * delY + delZ * delZ)*Math.sqrt(projectile.motionX*projectile.motionX + projectile.motionY* projectile.motionY + projectile.motionZ*projectile.motionZ)); - angle = Math.acos(angle); - if (angle < 3*(Math.PI/4)) { - //angle is < 135 degrees - continue; - } - - if (throwingEntity != null) - { - delX = -projectile.posX + throwingEntity.posX; - delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight()); - delZ = -projectile.posZ + throwingEntity.posZ; - } - - double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ); - - delX /= curVel; - delY /= curVel; - delZ /= curVel; - double newVel = Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ); - projectile.motionX = newVel * delX; - projectile.motionY = newVel * delY; - projectile.motionZ = newVel * delZ; - //TODO make this not affect player's projectiles - } - } - - if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlight)) - { - if (event.entityLiving instanceof EntityPlayer) - { - EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving; - String ownerName = SpellHelper.getUsername(entityPlayer); - playerFlightBuff.put(ownerName, true); - entityPlayer.capabilities.allowFlying = true; - } - } else - { - if (event.entityLiving instanceof EntityPlayer) - { - EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving; - String ownerName = SpellHelper.getUsername(entityPlayer); - - if (!playerFlightBuff.containsKey(ownerName)) - { - playerFlightBuff.put(ownerName, false); - } - - if (playerFlightBuff.get(ownerName)) - { - playerFlightBuff.put(ownerName, false); - - if (!entityPlayer.capabilities.isCreativeMode) - { - entityPlayer.capabilities.allowFlying = false; - entityPlayer.capabilities.isFlying = false; - entityPlayer.sendPlayerAbilities(); - } - } - } - } - - if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) - { - entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0); - - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier(); - double range = i * 0.5; - - List entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range); - if (entities != null) - { - for (Entity entity : entities) - { - if (!entity.equals(entityLiving) && !entity.isImmuneToFire() && !(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(Potion.fireResistance))) - { - entity.setFire(3); - } - } - } - } - - if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak)) - { - if (entityLiving.worldObj.getWorldTime() % 2 == 0) - entityLiving.worldObj.spawnParticle("reddust", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0x74, 0xbb, 0xfb); - - int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier(); - int horizRange = r + 1; - int vertRange = 1; - - if (!entityLiving.worldObj.isRemote) - { - for (int i = -horizRange; i <= horizRange; i++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - for (int j = -vertRange - 1; j <= vertRange - 1; j++) - { - SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos + i, yPos + j, zPos + k); - } - } - } - } - } - - if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart)) - { - entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0); - - int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier(); - double decrease = 0.025 * (i + 1); - - if (entityLiving.motionY > -0.9) - { - entityLiving.motionY -= decrease; - } - - if(entityLiving instanceof EntityPlayer) - { - SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityLiving, entityLiving.motionX, entityLiving.motionY - decrease, entityLiving.motionZ); - } - } - - if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse)) - { - entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0); - - int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier(); - int radius = r + 1; - - if (entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration() <= 2) - { - entityLiving.worldObj.createExplosion(null, x, y, z, radius, false); - } - } - } - -// @SubscribeEvent(priority = EventPriority.LOWEST) -// public void onTelepose(TeleposeEvent event) { -// -// AlchemicalWizardry.logger.info(event.initialBlock + ":" + event.initialMetadata); -// AlchemicalWizardry.logger.info(event.finalBlock + ":" + event.finalMetadata); -// -// for (int i = 0; i < BloodMagicConfiguration.teleposerBlacklist.length; i++) { -// String[] blockData = BloodMagicConfiguration.teleposerBlacklist[i].split(":"); -// -// // If the block follows full syntax: modid:blockname:meta -// if (blockData.length == 3) { -// -// Block block = GameRegistry.findBlock(blockData[0], blockData[1]); -// int meta; -// -// // Check if it's an int, if so, parse it. If not, set meta to 0 to avoid crashing. -// if (isInteger(blockData[2])) -// meta = Integer.parseInt(blockData[2]); -// else if (blockData[2].equals("*")) -// meta = OreDictionary.WILDCARD_VALUE; -// else -// meta = 0; -// -// AlchemicalWizardry.logger.info(block + ":" + meta); -// -// if (block != null) { -// if ((block == event.initialBlock || block == event.finalBlock) && (meta == event.initialMetadata || meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE)) { -// event.setCanceled(true); -// return; -// } -// } -// -// // If the block uses shorthand syntax: modid:blockname -// } else if (blockData.length == 2) { -// -// Block block = GameRegistry.findBlock(blockData[0], blockData[1]); -// int meta = 0; -// -// if (block != null) { -// if ((block == event.initialBlock && (meta == event.initialMetadata || meta == OreDictionary.WILDCARD_VALUE)) || (block == event.finalBlock && (meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE))) { -// event.setCanceled(true); -// return; -// } -// } -// } -// } -// } - - @SubscribeEvent - public void onTelepose(TeleposeEvent event) { - BlockStack initialBlock = new BlockStack(event.initialBlock, event.initialMetadata); - BlockStack finalBlock = new BlockStack(event.finalBlock, event.finalMetadata); - - if (teleposerBlacklist.contains(initialBlock) || teleposerBlacklist.contains(finalBlock)) - event.setCanceled(true); - } - - @SubscribeEvent - public void onEntityDeath(LivingDeathEvent event) - { - EntityLivingBase entityLiving = event.entityLiving; - - if (entityLiving instanceof IDemon && event.source.getEntity() instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer) event.source.getEntity(); - - player.addStat(ModAchievements.demonSpawn, 1); - } - if (entityLiving instanceof IHoardDemon && event.source.getEntity() instanceof EntityPlayer) - { + +public class AlchemicalWizardryEventHooks { + public static Map playerFlightBuff = new HashMap(); + public static List playersWith1Step = new ArrayList(); + + public static Map> respawnMap = new HashMap(); + public static Map> forceSpawnMap = new HashMap(); + public static ArrayList teleposerBlacklist = new ArrayList(); + + public static Random rand = new Random(); + + @SubscribeEvent + public void onEntityInteractEvent(EntityInteractEvent event) { + EntityPlayer player = event.entityPlayer; + OmegaParadigm parad = OmegaRegistry.getOmegaParadigmOfWeilder(player); + if (parad == null) { + return; + } + ItemStack heldItem = player.getHeldItem(); + if (heldItem == null) { + parad.onEmptyHandEntityInteract(player, event.target); + } else { + if (heldItem.getItem() instanceof EnergySword) { + parad.onBoundSwordInteractWithEntity(player, event.target); + } + } + } + + @SubscribeEvent + public void onAnvilUpdateEvent(AnvilUpdateEvent event) { + if (event.isCancelable() + && event.left != null + && event.right != null + && (event.left.getItem() instanceof BoundArmour || event.right.getItem() instanceof BoundArmour)) { + event.setCanceled(true); + } + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onLivingHurtEvent(LivingHurtEvent event) { + if (!event.isCanceled() + && event.entityLiving instanceof EntityPlayer + && !event.entityLiving.worldObj.isRemote) { + EntityPlayer player = (EntityPlayer) event.entityLiving; + + if (APISpellHelper.getCurrentAdditionalMaxHP(player) > 0) { + APISpellHelper.setPlayerReagentRegenCooldownTag(player, 20 * 20); + } + + float prevHp = APISpellHelper.getCurrentAdditionalHP((EntityPlayer) event.entityLiving); + if (prevHp > 0) { + float recalculatedAmount = ArmorProperties.ApplyArmor( + player, player.inventory.armorInventory, event.source, event.ammount); + if (recalculatedAmount <= 0) return; + recalculatedAmount = SpellHelper.applyPotionDamageCalculations( + player, event.source, recalculatedAmount); // Recalculated damage + + float ratio = recalculatedAmount / event.ammount; + + float f1 = recalculatedAmount; + recalculatedAmount = Math.max(recalculatedAmount - player.getAbsorptionAmount(), 0.0F); + player.setAbsorptionAmount(player.getAbsorptionAmount() - (f1 - recalculatedAmount)); + + if (prevHp > recalculatedAmount) { + float hp = (prevHp - recalculatedAmount); // New HP - this is obviously > 0... + + // event.setCanceled(true); + event.ammount = 0; + Reagent reagent = APISpellHelper.getPlayerReagentType(player); + OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent); + if (paradigm != null) { + ItemStack chestStack = player.inventory.armorInventory[2]; + + if (chestStack != null && chestStack.getItem() instanceof OmegaArmour) { + if (((OmegaArmour) chestStack.getItem()).paradigm == paradigm) { + paradigm.onHPBarDepleted(player, chestStack); + } + } + } + + APISpellHelper.setCurrentAdditionalHP(player, hp); + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getAddedHPPacket(hp, APISpellHelper.getCurrentAdditionalMaxHP(player)), + (EntityPlayerMP) player); + + // if(event.ammount <= 0.3) + // { + // event.ammount++; + // } + } else { + APISpellHelper.setCurrentAdditionalHP(player, 0); + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getAddedHPPacket(0, APISpellHelper.getCurrentAdditionalMaxHP(player)), + (EntityPlayerMP) player); + + event.ammount -= prevHp / ratio; + if (event.ammount < 0) { + event.ammount = 0; + } + } + } + } + } + + @SubscribeEvent + public void omegaUpdateReagentAndHpEvent(LivingUpdateEvent event) { + if (event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.isRemote) { + EntityPlayer player = (EntityPlayer) event.entityLiving; + Reagent reagent = APISpellHelper.getPlayerReagentType(player); + float reagentAmount = APISpellHelper.getPlayerCurrentReagentAmount(player); + + boolean hasReagentChanged = false; + + if (reagentAmount > 0 && OmegaRegistry.hasParadigm(reagent)) { + int cooldown = APISpellHelper.getPlayerReagentRegenCooldownTag(player); + boolean canHealHPBar = true; + if (cooldown > 0) { + float extra = 0; + if (player.isPotionActive(AlchemicalWizardry.customPotionSoulHarden)) { + extra += 0.25f + * (1 + + player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulHarden) + .getAmplifier()); + } + + if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) { + extra -= 0.25f + * (1 + + player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray) + .getAmplifier()); + } + + int deduction = -1 + - (extra >= 0 + ? (rand.nextFloat() < extra ? 1 : 0) + : (rand.nextFloat() < -extra / 2 ? -1 : 0)); + + APISpellHelper.setPlayerReagentRegenCooldownTag(player, Math.max(cooldown + deduction, 0)); + canHealHPBar = false; + } + + OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent); + ReagentRegenConfiguration config = parad.getRegenConfig(player); + + if (parad.isPlayerWearingFullSet(player)) { + if (canHealHPBar) { + int tickRate = config.tickRate; + + if (player.isPotionActive(Potion.regeneration)) { + int i = player.getActivePotionEffect(Potion.regeneration) + .getAmplifier(); + double factor = Math.pow(1.5, i + 1); + tickRate = Math.max((int) (tickRate / factor), 1); + } + + if (event.entityLiving.worldObj.getWorldTime() % tickRate == 0) { + boolean hasHealthChanged = false; + int maxHealth = parad.getMaxAdditionalHealth(); + + float health = APISpellHelper.getCurrentAdditionalHP(player); + + if (health > maxHealth) { + health = maxHealth; + hasHealthChanged = true; + } else if (health < maxHealth) { + float addedAmount = Math.min( + Math.min((reagentAmount / config.costPerPoint), config.healPerTick), + maxHealth - health); + float drain = addedAmount * config.costPerPoint; + + reagentAmount -= drain; + hasReagentChanged = true; + + health += addedAmount; + + hasHealthChanged = true; + } + + if (player instanceof EntityPlayerMP) { + if (hasHealthChanged) { + APISpellHelper.setCurrentAdditionalHP(player, health); + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getAddedHPPacket(health, maxHealth), + (EntityPlayerMP) player); + } + } + } + } + + } else { + reagentAmount = 0; + APISpellHelper.setPlayerMaxReagentAmount(player, 0); + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getReagentBarPacket(null, 0, 0), (EntityPlayerMP) player); + APISpellHelper.setCurrentAdditionalHP(player, 0); + NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, 0), (EntityPlayerMP) player); + } + // Consumes the amount + float costPerTick = parad.getCostPerTickOfUse(player); + if (parad.doDrainReagent(player)) { + if (reagentAmount > costPerTick) { + hasReagentChanged = true; + reagentAmount = Math.max(0, reagentAmount - costPerTick); + } else { + hasReagentChanged = true; + reagentAmount = 0; + } + } + + hasReagentChanged = true; + } + + if (reagentAmount <= 0) { + boolean hasRevertedArmour = false; + ItemStack[] armourInventory = player.inventory.armorInventory; + for (ItemStack stack : armourInventory) { + if (stack != null && stack.getItem() instanceof OmegaArmour) { + ((OmegaArmour) stack.getItem()).revertArmour(player, stack); + hasRevertedArmour = true; + } + } + + if (hasRevertedArmour) { + APISpellHelper.setCurrentAdditionalHP(player, 0); + NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, 0), (EntityPlayerMP) player); + } + } + + if (player instanceof EntityPlayerMP) { + if (hasReagentChanged) { + APISpellHelper.setPlayerCurrentReagentAmount(player, reagentAmount); + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getReagentBarPacket( + reagent, reagentAmount, APISpellHelper.getPlayerMaxReagentAmount(player)), + (EntityPlayerMP) player); + } + } + } + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onPlayerDamageEvent(LivingAttackEvent event) { + if (event.source.isProjectile()) { + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt) && event.isCancelable()) { + event.setCanceled(true); + } + } + } + + @SubscribeEvent + public void onLivingSpawnEvent(CheckSpawn event) { + if (!(event.entityLiving instanceof EntityMob)) { + return; + } + + String respawnRitual = "AW028SpawnWard"; + + int dimension = event.world.provider.dimensionId; + if (respawnMap.containsKey(dimension)) { + List list = respawnMap.get(dimension); + + if (list != null) { + for (CoordAndRange coords : list) { + TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord); + + if (tile instanceof TEMasterStone + && ((TEMasterStone) tile).isRunning + && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual)) { + if (event.x > coords.xCoord - coords.horizRadius + && event.x < coords.xCoord + coords.horizRadius + && event.z > coords.zCoord - coords.horizRadius + && event.z < coords.zCoord + coords.horizRadius + && event.y > coords.yCoord - coords.vertRadius + && event.y < coords.yCoord + coords.vertRadius) { + switch (event.getResult()) { + case ALLOW: + event.setResult(Result.DEFAULT); + break; + case DEFAULT: + event.setResult(Result.DENY); + break; + case DENY: + break; + default: + break; + } + break; + } + } else { + list.remove(coords); + } + } + } + } + + if (event.entityLiving instanceof EntityCreeper) { + return; + } + + String forceSpawnRitual = "AW029VeilOfEvil"; + + if (forceSpawnMap.containsKey(dimension)) { + List list = forceSpawnMap.get(dimension); + + if (list != null) { + for (CoordAndRange coords : list) { + TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord); + + if (tile instanceof TEMasterStone + && ((TEMasterStone) tile).isRunning + && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual)) { + if (event.x > coords.xCoord - coords.horizRadius + && event.x < coords.xCoord + coords.horizRadius + && event.z > coords.zCoord - coords.horizRadius + && event.z < coords.zCoord + coords.horizRadius + && event.y > coords.yCoord - coords.vertRadius + && event.y < coords.yCoord + coords.vertRadius) { + switch (event.getResult()) { + case ALLOW: + break; + case DEFAULT: + event.setResult(Result.ALLOW); + break; + case DENY: + event.setResult(Result.DEFAULT); + break; + default: + break; + } + break; + } + } else { + list.remove(coords); + } + } + } + } + } + + @SubscribeEvent + public void onPlayerRespawnEvent(PlayerRespawnEvent event) { + if (AlchemicalWizardry.respawnWithDebuff && event.player != null) { + event.player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, 20 * 60 * 5, 0)); + } + } + + @SubscribeEvent + public void onLivingJumpEvent(LivingJumpEvent event) { + // event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).removeModifier(new + // AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0)); + // event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new + // AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0)); + + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost)) { + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionBoost) + .getAmplifier(); + event.entityLiving.motionY += (0.1f) * (2 + i); + } + + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart)) { + event.entityLiving.motionY = 0; + } + } + + @SubscribeEvent + public void onEndermanTeleportEvent(EnderTeleportEvent event) { + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable()) { + event.setCanceled(true); + } + } + + @SubscribeEvent + public void onEntityDamaged(LivingAttackEvent event) { + EntityLivingBase entityAttacked = event.entityLiving; + + if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionReciprocation)) { + Entity entityAttacking = event.source.getSourceOfDamage(); + + if (entityAttacking != null && entityAttacking instanceof EntityLivingBase) { + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionReciprocation) + .getAmplifier(); + float damageRecieve = event.ammount / 2 * (i + 1); + entityAttacking.attackEntityFrom(DamageSource.generic, damageRecieve); + } + } + + if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) { + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak) + .getAmplifier(); + + Entity entityAttacking = event.source.getSourceOfDamage(); + + if (entityAttacking != null + && entityAttacking instanceof EntityLivingBase + && !entityAttacking.isImmuneToFire() + && !((EntityLivingBase) entityAttacking).isPotionActive(Potion.fireResistance)) { + entityAttacking.attackEntityFrom(DamageSource.inFire, 2 * i + 2); + entityAttacking.setFire(3); + } + } + } + + // @SubscribeEvent + // public void onFOVUpdate(FOVUpdateEvent event) + // { + // event.setResult(Result.DENY); + // } + // @SubscribeEvent + // public void onPlayerTickEnd(PlayerTickEvent event) + // { + // if(event.type.equals(Type.PLAYER) && event.phase.equals(TickEvent.Phase.END)) + // { + // ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities, + // Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"}); + // } + // } + + @SubscribeEvent + public void onEntityUpdate(LivingUpdateEvent event) { + EntityLivingBase entityLiving = event.entityLiving; + double x = entityLiving.posX; + double y = entityLiving.posY; + double z = entityLiving.posZ; + + Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving); + int xPos = (int) (blockVector.xCoord); + int yPos = (int) (blockVector.yCoord); + int zPos = (int) (blockVector.zCoord); + + if (entityLiving instanceof EntityPlayer) { + if (!entityLiving.worldObj.isRemote && entityLiving.worldObj.getTotalWorldTime() % 20 == 0) { + if (entityLiving instanceof EntityPlayerMP) { + String ownerName = SoulNetworkHandler.getUsername((EntityPlayer) entityLiving); + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getLPPacket( + SoulNetworkHandler.getCurrentEssence(ownerName), + SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(ownerName))), + (EntityPlayerMP) entityLiving); + } + } + // ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer) + // event.entityLiving).capabilities, 0.1F, "walkSpeed", "g", "field_75097_g"); + } + + if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote) { + EntityPlayer entityPlayer = (EntityPlayer) entityLiving; + boolean highStepListed = playersWith1Step.contains(entityPlayer.getDisplayName()); + boolean hasHighStep = entityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost); + + if (hasHighStep && !highStepListed) { + playersWith1Step.add(SpellHelper.getUsername(entityPlayer)); + } + + if (!hasHighStep && highStepListed) { + playersWith1Step.remove(SpellHelper.getUsername(entityPlayer)); + entityPlayer.stepHeight = 0.5F; + } + } + + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) { + event.entityLiving.fallDistance = 0; + } + + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning) + && !event.entityLiving.isPotionActive(Potion.waterBreathing)) { + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionDrowning) + .getAmplifier(); + + if (event.entityLiving.worldObj.getWorldTime() % (20 / (i + 1)) == 0) { + event.entityLiving.attackEntityFrom(DamageSource.drown, 2); + event.entityLiving.hurtResistantTime = Math.min(event.entityLiving.hurtResistantTime, 20 / (i + 1)); + } + } + + // event.entityLiving.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeAllModifiers(); + + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost)) { + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionBoost) + .getAmplifier(); + // if(!entity.isSneaking()) + { + float percentIncrease = (i + 1) * 0.05f; + + // AttributeModifier speedModifier = new AttributeModifier(new UUID(213241, 3), "Potion Boost", + // percentIncrease, 0); + // + // + // event.entityLiving.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(speedModifier); + + if (event.entityLiving instanceof EntityPlayer) { + EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving; + entityPlayer.stepHeight = 1.0f; + + if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F) + entityPlayer.moveFlying( + 0F, + 1F, + entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease); + } + } + } + + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt)) { + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionProjProt) + .getAmplifier(); + EntityLivingBase entity = event.entityLiving; + int posX = (int) Math.round(entity.posX - 0.5f); + int posY = (int) Math.round(entity.posY); + int posZ = (int) Math.round(entity.posZ - 0.5f); + int d0 = (int) ((i + 1) * 2.5); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5) + .expand(d0, d0, d0); + List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + Entity projectile = (Entity) iterator.next(); + + if (projectile == null) { + continue; + } + + if (!(projectile instanceof IProjectile) + || (AlchemicalWizardry.isBotaniaLoaded && isManaBurst(projectile))) { + continue; + } + + Entity throwingEntity = null; + + if (projectile instanceof EntityArrow) { + throwingEntity = ((EntityArrow) projectile).shootingEntity; + } else if (projectile instanceof EnergyBlastProjectile) { + throwingEntity = ((EnergyBlastProjectile) projectile).shootingEntity; + } else if (projectile instanceof EntityThrowable) { + throwingEntity = ((EntityThrowable) projectile).getThrower(); + } + + if (throwingEntity != null && throwingEntity.equals(entity)) { + continue; + } + + double delX = projectile.posX - entity.posX; + double delY = projectile.posY - entity.posY; + double delZ = projectile.posZ - entity.posZ; + + double angle = (delX * projectile.motionX + delY * projectile.motionY + delZ * projectile.motionZ) + / (Math.sqrt(delX * delX + delY * delY + delZ * delZ) + * Math.sqrt(projectile.motionX * projectile.motionX + + projectile.motionY * projectile.motionY + + projectile.motionZ * projectile.motionZ)); + angle = Math.acos(angle); + if (angle < 3 * (Math.PI / 4)) { + // angle is < 135 degrees + continue; + } + + if (throwingEntity != null) { + delX = -projectile.posX + throwingEntity.posX; + delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight()); + delZ = -projectile.posZ + throwingEntity.posZ; + } + + double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ); + + delX /= curVel; + delY /= curVel; + delZ /= curVel; + double newVel = Math.sqrt(projectile.motionX * projectile.motionX + + projectile.motionY * projectile.motionY + + projectile.motionZ * projectile.motionZ); + projectile.motionX = newVel * delX; + projectile.motionY = newVel * delY; + projectile.motionZ = newVel * delZ; + // TODO make this not affect player's projectiles + } + } + + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlight)) { + if (event.entityLiving instanceof EntityPlayer) { + EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving; + String ownerName = SpellHelper.getUsername(entityPlayer); + playerFlightBuff.put(ownerName, true); + entityPlayer.capabilities.allowFlying = true; + } + } else { + if (event.entityLiving instanceof EntityPlayer) { + EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving; + String ownerName = SpellHelper.getUsername(entityPlayer); + + if (!playerFlightBuff.containsKey(ownerName)) { + playerFlightBuff.put(ownerName, false); + } + + if (playerFlightBuff.get(ownerName)) { + playerFlightBuff.put(ownerName, false); + + if (!entityPlayer.capabilities.isCreativeMode) { + entityPlayer.capabilities.allowFlying = false; + entityPlayer.capabilities.isFlying = false; + entityPlayer.sendPlayerAbilities(); + } + } + } + } + + if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) { + entityLiving.worldObj.spawnParticle( + "flame", + x + SpellHelper.gaussian(1), + y - 1.3 + SpellHelper.gaussian(0.3), + z + SpellHelper.gaussian(1), + 0, + 0.06d, + 0); + + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak) + .getAmplifier(); + double range = i * 0.5; + + List entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range); + if (entities != null) { + for (Entity entity : entities) { + if (!entity.equals(entityLiving) + && !entity.isImmuneToFire() + && !(entity instanceof EntityLivingBase + && ((EntityLivingBase) entity).isPotionActive(Potion.fireResistance))) { + entity.setFire(3); + } + } + } + } + + if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak)) { + if (entityLiving.worldObj.getWorldTime() % 2 == 0) + entityLiving.worldObj.spawnParticle( + "reddust", + x + SpellHelper.gaussian(1), + y - 1.3 + SpellHelper.gaussian(0.3), + z + SpellHelper.gaussian(1), + 0x74, + 0xbb, + 0xfb); + + int r = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak) + .getAmplifier(); + int horizRange = r + 1; + int vertRange = 1; + + if (!entityLiving.worldObj.isRemote) { + for (int i = -horizRange; i <= horizRange; i++) { + for (int k = -horizRange; k <= horizRange; k++) { + for (int j = -vertRange - 1; j <= vertRange - 1; j++) { + SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos + i, yPos + j, zPos + k); + } + } + } + } + } + + if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart)) { + entityLiving.worldObj.spawnParticle( + "flame", + x + SpellHelper.gaussian(1), + y - 1.3 + SpellHelper.gaussian(0.3), + z + SpellHelper.gaussian(1), + 0, + 0.06d, + 0); + + int i = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart) + .getAmplifier(); + double decrease = 0.025 * (i + 1); + + if (entityLiving.motionY > -0.9) { + entityLiving.motionY -= decrease; + } + + if (entityLiving instanceof EntityPlayer) { + SpellHelper.setPlayerSpeedFromServer( + (EntityPlayer) entityLiving, + entityLiving.motionX, + entityLiving.motionY - decrease, + entityLiving.motionZ); + } + } + + if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse)) { + entityLiving.worldObj.spawnParticle( + "flame", + x + SpellHelper.gaussian(1), + y - 1.3 + SpellHelper.gaussian(0.3), + z + SpellHelper.gaussian(1), + 0, + 0.06d, + 0); + + int r = event.entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse) + .getAmplifier(); + int radius = r + 1; + + if (entityLiving + .getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse) + .getDuration() + <= 2) { + entityLiving.worldObj.createExplosion(null, x, y, z, radius, false); + } + } + } + + // @SubscribeEvent(priority = EventPriority.LOWEST) + // public void onTelepose(TeleposeEvent event) { + // + // AlchemicalWizardry.logger.info(event.initialBlock + ":" + event.initialMetadata); + // AlchemicalWizardry.logger.info(event.finalBlock + ":" + event.finalMetadata); + // + // for (int i = 0; i < BloodMagicConfiguration.teleposerBlacklist.length; i++) { + // String[] blockData = BloodMagicConfiguration.teleposerBlacklist[i].split(":"); + // + // // If the block follows full syntax: modid:blockname:meta + // if (blockData.length == 3) { + // + // Block block = GameRegistry.findBlock(blockData[0], blockData[1]); + // int meta; + // + // // Check if it's an int, if so, parse it. If not, set meta to 0 to avoid crashing. + // if (isInteger(blockData[2])) + // meta = Integer.parseInt(blockData[2]); + // else if (blockData[2].equals("*")) + // meta = OreDictionary.WILDCARD_VALUE; + // else + // meta = 0; + // + // AlchemicalWizardry.logger.info(block + ":" + meta); + // + // if (block != null) { + // if ((block == event.initialBlock || block == event.finalBlock) && (meta == event.initialMetadata || meta == + // event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE)) { + // event.setCanceled(true); + // return; + // } + // } + // + // // If the block uses shorthand syntax: modid:blockname + // } else if (blockData.length == 2) { + // + // Block block = GameRegistry.findBlock(blockData[0], blockData[1]); + // int meta = 0; + // + // if (block != null) { + // if ((block == event.initialBlock && (meta == event.initialMetadata || meta == OreDictionary.WILDCARD_VALUE)) + // || (block == event.finalBlock && (meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE))) { + // event.setCanceled(true); + // return; + // } + // } + // } + // } + // } + + @SubscribeEvent + public void onTelepose(TeleposeEvent event) { + BlockStack initialBlock = new BlockStack(event.initialBlock, event.initialMetadata); + BlockStack finalBlock = new BlockStack(event.finalBlock, event.finalMetadata); + + if (teleposerBlacklist.contains(initialBlock) || teleposerBlacklist.contains(finalBlock)) + event.setCanceled(true); + } + + @SubscribeEvent + public void onEntityDeath(LivingDeathEvent event) { + EntityLivingBase entityLiving = event.entityLiving; + + if (entityLiving instanceof IDemon && event.source.getEntity() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.source.getEntity(); + + player.addStat(ModAchievements.demonSpawn, 1); + } + if (entityLiving instanceof IHoardDemon && event.source.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.source.getEntity(); player.addStat(ModAchievements.demons, 1); } - } + } - @SubscribeEvent - public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { - if (event.modID.equals("AWWayofTime")) { - BloodMagicConfiguration.syncConfig(); - AlchemicalWizardry.logger.info("Refreshing configuration file."); - } - } - - @Optional.Method(modid = "Botania") - private boolean isManaBurst(Entity entity) - { - if(entity instanceof IManaBurst) { - ItemStack lens = ((IManaBurst)entity).getSourceLens(); - return !(lens.getItemDamage()!=8 && lens.getItemDamage()!=11); + @SubscribeEvent + public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { + if (event.modID.equals("AWWayofTime")) { + BloodMagicConfiguration.syncConfig(); + AlchemicalWizardry.logger.info("Refreshing configuration file."); } - else - return false; - } + } + + @Optional.Method(modid = "Botania") + private boolean isManaBurst(Entity entity) { + if (entity instanceof IManaBurst) { + ItemStack lens = ((IManaBurst) entity).getSourceLens(); + return !(lens.getItemDamage() != 8 && lens.getItemDamage() != 11); + } else return false; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryFuelHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryFuelHandler.java index 5a09d2b2..c61ebaaf 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryFuelHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryFuelHandler.java @@ -12,48 +12,38 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; -public class AlchemicalWizardryFuelHandler implements IFuelHandler -{ +public class AlchemicalWizardryFuelHandler implements IFuelHandler { @Override - public int getBurnTime(ItemStack fuel) - { - if (fuel == null) - { + public int getBurnTime(ItemStack fuel) { + if (fuel == null) { return 0; } Item fuelItem = fuel.getItem(); - if (fuelItem.equals(ModItems.lavaCrystal)) - { + if (fuelItem.equals(ModItems.lavaCrystal)) { LavaCrystal item = (LavaCrystal) fuel.getItem(); - if (item.hasEnoughEssence(fuel)) - { + if (item.hasEnoughEssence(fuel)) { return 200; - } else - { + } else { NBTTagCompound tag = fuel.getTagCompound(); - if (tag == null) - { + if (tag == null) { return 0; } - if (MinecraftServer.getServer() == null) - { + if (MinecraftServer.getServer() == null) { return 0; } - if (MinecraftServer.getServer().getConfigurationManager() == null) - { + if (MinecraftServer.getServer().getConfigurationManager() == null) { return 0; } EntityPlayer owner = SpellHelper.getPlayerForUsername(tag.getString("ownerName")); - if (owner == null) - { + if (owner == null) { return 0; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/ArmourComponent.java b/src/main/java/WayofTime/alchemicalWizardry/common/ArmourComponent.java index fb4f155b..8fe970c7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/ArmourComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/ArmourComponent.java @@ -1,23 +1,19 @@ package WayofTime.alchemicalWizardry.common; -public class ArmourComponent -{ +public class ArmourComponent { private int xOff; private int zOff; - public ArmourComponent(int xOff, int zOff) - { + public ArmourComponent(int xOff, int zOff) { this.xOff = xOff; this.zOff = zOff; } - public int getXOff() - { + public int getXOff() { return xOff; } - public int getZOff() - { + public int getZOff() { return zOff; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/ClientToServerPacketHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/ClientToServerPacketHandler.java index 077bf2c4..0b5d88f8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/ClientToServerPacketHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/ClientToServerPacketHandler.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 ClientToServerPacketHandler -{ +public class ClientToServerPacketHandler { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("alchemicalwizardry"); - public static void init() - { + public static void init() { INSTANCE.registerMessage(MessageKeyPressed.class, MessageKeyPressed.class, 0, Side.SERVER); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/CommonProxy.java b/src/main/java/WayofTime/alchemicalWizardry/common/CommonProxy.java index ee1a7d93..de087e3e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/CommonProxy.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/CommonProxy.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.common; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile; import WayofTime.alchemicalWizardry.common.entity.mob.BookEntityItem; @@ -24,76 +23,94 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.world.World; -public class CommonProxy -{ +public class CommonProxy { // Client stuff - public void registerRenderers() - { + public void registerRenderers() { // Nothing here as the server doesn't render graphics! } - - public void registerPostSideObjects() - { - - } - public void registerEntities() - { - } + public void registerPostSideObjects() {} - public World getClientWorld() - { + public void registerEntities() {} + + public World getClientWorld() { return null; } - public void registerActions() - { - } + public void registerActions() {} - public void registerEvents() - { - } + public void registerEvents() {} - public void registerSoundHandler() - { + public void registerSoundHandler() { // Nothing here as this is a server side proxy } - public void registerTileEntities() - { + public void registerTileEntities() { GameRegistry.registerTileEntity(TEAltar.class, "containerAltar"); GameRegistry.registerTileEntity(TEMasterStone.class, "containerMasterStone"); } - public void registerEntityTrackers() - { - EntityRegistry.registerModEntity(EnergyBlastProjectile.class, "energyBlastProjectile", 0, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(FireProjectile.class, "fireProjectile", 1, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(IceProjectile.class, "iceProjectile", 2, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(ExplosionProjectile.class, "explosionProjectile", 3, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(HolyProjectile.class, "holyProjectile", 4, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(WindGustProjectile.class, "windGustProjectile", 5, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(LightningBoltProjectile.class, "lightningBoltProjectile", 6, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(WaterProjectile.class, "waterProjectile", 7, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(MudProjectile.class, "mudProjectile", 8, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(TeleportProjectile.class, "teleportProjectile", 9, AlchemicalWizardry.instance, 128, 5, true); - EntityRegistry.registerModEntity(EntityEnergyBazookaMainProjectile.class, "energyBazookaMain", 10, AlchemicalWizardry.instance, 128, 3, true); - EntityRegistry.registerModEntity(EntityEnergyBazookaSecondaryProjectile.class, "energyBazookaSecondary", 11, AlchemicalWizardry.instance, 128, 3, true); - EntityRegistry.registerModEntity(EntityBloodLightProjectile.class, "bloodLightProjectile", 12, AlchemicalWizardry.instance, 128, 3, true); + public void registerEntityTrackers() { + EntityRegistry.registerModEntity( + EnergyBlastProjectile.class, "energyBlastProjectile", 0, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + FireProjectile.class, "fireProjectile", 1, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + IceProjectile.class, "iceProjectile", 2, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + ExplosionProjectile.class, "explosionProjectile", 3, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + HolyProjectile.class, "holyProjectile", 4, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + WindGustProjectile.class, "windGustProjectile", 5, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + LightningBoltProjectile.class, "lightningBoltProjectile", 6, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + WaterProjectile.class, "waterProjectile", 7, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + MudProjectile.class, "mudProjectile", 8, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + TeleportProjectile.class, "teleportProjectile", 9, AlchemicalWizardry.instance, 128, 5, true); + EntityRegistry.registerModEntity( + EntityEnergyBazookaMainProjectile.class, + "energyBazookaMain", + 10, + AlchemicalWizardry.instance, + 128, + 3, + true); + EntityRegistry.registerModEntity( + EntityEnergyBazookaSecondaryProjectile.class, + "energyBazookaSecondary", + 11, + AlchemicalWizardry.instance, + 128, + 3, + true); + EntityRegistry.registerModEntity( + EntityBloodLightProjectile.class, + "bloodLightProjectile", + 12, + AlchemicalWizardry.instance, + 128, + 3, + true); EntityRegistry.registerModEntity(EntityMeteor.class, "meteor", 13, AlchemicalWizardry.instance, 120, 3, true); - EntityRegistry.registerModEntity(EntitySpellProjectile.class, "spellProjectile", 14, AlchemicalWizardry.instance, 128, 3, true); - EntityRegistry.registerModEntity(EntityParticleBeam.class, "particleBeam", 15, AlchemicalWizardry.instance, 120, 3, true); - EntityRegistry.registerModEntity(MailOrderEntityItem.class, "catalogueEntityItem", 16, AlchemicalWizardry.instance, 120, 3, true); - EntityRegistry.registerModEntity(BookEntityItem.class, "bookEntityItem", 17, AlchemicalWizardry.instance, 120, 3, true); + EntityRegistry.registerModEntity( + EntitySpellProjectile.class, "spellProjectile", 14, AlchemicalWizardry.instance, 128, 3, true); + EntityRegistry.registerModEntity( + EntityParticleBeam.class, "particleBeam", 15, AlchemicalWizardry.instance, 120, 3, true); + EntityRegistry.registerModEntity( + MailOrderEntityItem.class, "catalogueEntityItem", 16, AlchemicalWizardry.instance, 120, 3, true); + EntityRegistry.registerModEntity( + BookEntityItem.class, "bookEntityItem", 17, AlchemicalWizardry.instance, 120, 3, true); } - public void registerTickHandlers() - { - } + public void registerTickHandlers() {} - public void InitRendering() - { + public void InitRendering() { // TODO Auto-generated method stub } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/CoordAndRange.java b/src/main/java/WayofTime/alchemicalWizardry/common/CoordAndRange.java index f4a89a65..cd36c0dd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/CoordAndRange.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/CoordAndRange.java @@ -1,15 +1,13 @@ package WayofTime.alchemicalWizardry.common; -public class CoordAndRange -{ +public class CoordAndRange { public int xCoord; public int yCoord; public int zCoord; public int horizRadius; public int vertRadius; - public CoordAndRange(int x, int y, int z, int horiz, int vert) - { + public CoordAndRange(int x, int y, int z, int horiz, int vert) { this.xCoord = x; this.yCoord = y; this.zCoord = z; @@ -18,8 +16,13 @@ public class CoordAndRange } @Override - public boolean equals(Object o) - { - return o instanceof CoordAndRange ? ((CoordAndRange) o).xCoord == this.xCoord && ((CoordAndRange) o).yCoord == this.yCoord && ((CoordAndRange) o).zCoord == this.zCoord && ((CoordAndRange) o).horizRadius == this.horizRadius && ((CoordAndRange) o).vertRadius == this.vertRadius : false; + public boolean equals(Object o) { + return o instanceof CoordAndRange + ? ((CoordAndRange) o).xCoord == this.xCoord + && ((CoordAndRange) o).yCoord == this.yCoord + && ((CoordAndRange) o).zCoord == this.zCoord + && ((CoordAndRange) o).horizRadius == this.horizRadius + && ((CoordAndRange) o).vertRadius == this.vertRadius + : false; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggro.java b/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggro.java index 2b6fb25a..9c138c1d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggro.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggro.java @@ -3,12 +3,10 @@ package WayofTime.alchemicalWizardry.common; import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; -public class EntityAITargetAggro extends EntityAINearestAttackableTarget -{ +public class EntityAITargetAggro extends EntityAINearestAttackableTarget { private EntityDemon theCreature; - public EntityAITargetAggro(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4) - { + public EntityAITargetAggro(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4) { super(par1EntityDemon, par2Class, par3, par4); this.theCreature = par1EntityDemon; } @@ -17,8 +15,7 @@ public class EntityAITargetAggro extends EntityAINearestAttackableTarget * Returns whether the EntityAIBase should begin execution. */ @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { return theCreature.isAggro() && super.shouldExecute(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggroCloaking.java b/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggroCloaking.java index 53de1ddd..6751b97a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggroCloaking.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/EntityAITargetAggroCloaking.java @@ -1,29 +1,29 @@ package WayofTime.alchemicalWizardry.common; -import net.minecraft.entity.EntityLivingBase; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon; +import net.minecraft.entity.EntityLivingBase; + +public class EntityAITargetAggroCloaking extends EntityAITargetAggro { + int cloakLevel; // Level of cloaking that the owner demon is fooled by + + public EntityAITargetAggroCloaking( + EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4, int cloak) { + super(par1EntityDemon, par2Class, par3, par4); + this.cloakLevel = cloak; + } + + @Override + public boolean shouldExecute() { + EntityLivingBase target = this.taskOwner.getAITarget(); + boolean cloakActive = false; + + if (target != null && target.isPotionActive(AlchemicalWizardry.customPotionBoost.id)) { + cloakActive = target.getActivePotionEffect(AlchemicalWizardry.customPotionBoost) + .getAmplifier() + >= cloakLevel; + } -public class EntityAITargetAggroCloaking extends EntityAITargetAggro -{ - int cloakLevel; //Level of cloaking that the owner demon is fooled by - public EntityAITargetAggroCloaking(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4, int cloak) - { - super(par1EntityDemon, par2Class, par3, par4); - this.cloakLevel = cloak; - } - - @Override - public boolean shouldExecute() - { - EntityLivingBase target = this.taskOwner.getAITarget(); - boolean cloakActive = false; - - if(target != null && target.isPotionActive(AlchemicalWizardry.customPotionBoost.id)) - { - cloakActive = target.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier() >= cloakLevel; - } - return !cloakActive && super.shouldExecute(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/IBindingAgent.java b/src/main/java/WayofTime/alchemicalWizardry/common/IBindingAgent.java index f2dcdc7d..e8e160b7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/IBindingAgent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/IBindingAgent.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.common; -public interface IBindingAgent -{ +public interface IBindingAgent { float getSuccessRateForPotionNumber(int potionEffects); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/ICatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/ICatalyst.java index c3677580..446bff08 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/ICatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/ICatalyst.java @@ -1,7 +1,6 @@ package WayofTime.alchemicalWizardry.common; -public interface ICatalyst -{ +public interface ICatalyst { int getCatalystLevel(); boolean isConcentration(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/IDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/IDemon.java index e1d9cfdd..f11e4776 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/IDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/IDemon.java @@ -1,14 +1,13 @@ package WayofTime.alchemicalWizardry.common; -public interface IDemon -{ +public interface IDemon { void setSummonedConditions(); boolean isAggro(); void setAggro(boolean aggro); - + boolean getDoesDropCrystal(); - + void setDropCrystal(boolean crystal); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/IFillingAgent.java b/src/main/java/WayofTime/alchemicalWizardry/common/IFillingAgent.java index df415cbf..a199ae9e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/IFillingAgent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/IFillingAgent.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.common; -public interface IFillingAgent -{ +public interface IFillingAgent { int getFilledAmountForPotionNumber(int potionEffects); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/ItemType.java b/src/main/java/WayofTime/alchemicalWizardry/common/ItemType.java index e71dabe0..2e9dc979 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/ItemType.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/ItemType.java @@ -1,7 +1,6 @@ package WayofTime.alchemicalWizardry.common; import java.util.Objects; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -9,68 +8,56 @@ import net.minecraft.nbt.NBTTagCompound; /** * Represents an item together with metadata and NBT tag. - * + * * @author ljfa-ag */ -public class ItemType -{ +public class ItemType { public final Item item; public final int meta; public final NBTTagCompound nbtTag; - - public ItemType(Item item, int meta, NBTTagCompound nbtTag) - { + + public ItemType(Item item, int meta, NBTTagCompound nbtTag) { this.item = Objects.requireNonNull(item); this.meta = meta; this.nbtTag = nbtTag; } - - public ItemType(Item item, int meta) - { + + public ItemType(Item item, int meta) { this(item, meta, null); } - - public ItemType(Item item) - { + + public ItemType(Item item) { this(item, 0, null); } - - public ItemType(Block block, int meta, NBTTagCompound nbtTag) - { + + public ItemType(Block block, int meta, NBTTagCompound nbtTag) { this(Item.getItemFromBlock(block), meta, nbtTag); } - - public ItemType(Block block, int meta) - { + + public ItemType(Block block, int meta) { this(block, meta, null); } - - public ItemType(Block block) - { + + public ItemType(Block block) { this(block, 0, null); } - - public ItemStack createStack(int count) - { + + public ItemStack createStack(int count) { ItemStack result = new ItemStack(item, count, meta); result.stackTagCompound = nbtTag; return result; } - + @Override - public boolean equals(Object obj) - { - if (this == obj) - return true; - if (obj == null || getClass() != obj.getClass()) - return false; + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; ItemType other = (ItemType) obj; return item == other.item && meta == other.meta && Objects.equals(nbtTag, other.nbtTag); } @Override - public int hashCode() - { + public int hashCode() { final int prime = 31; int result = 1; result = prime * result + item.hashCode(); @@ -78,16 +65,13 @@ public class ItemType result = prime * result + ((nbtTag == null) ? 0 : nbtTag.hashCode()); return result; } - + @Override - public String toString() - { + public String toString() { return item.getUnlocalizedName() + "@" + meta; } - - public static ItemType fromStack(ItemStack stack) - { + + public static ItemType fromStack(ItemStack stack) { return new ItemType(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound); } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/LifeBucketHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/LifeBucketHandler.java index 773437d5..a2759e56 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/LifeBucketHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/LifeBucketHandler.java @@ -11,34 +11,29 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.FillBucketEvent; -public class LifeBucketHandler -{ +public class LifeBucketHandler { @SubscribeEvent - public void onBucketFill(FillBucketEvent event) - { - if (event.current.getItem() != Items.bucket) - return; + public void onBucketFill(FillBucketEvent event) { + if (event.current.getItem() != Items.bucket) return; ItemStack result = fillCustomBucket(event.world, event.target); - if (result == null) - return; + if (result == null) return; event.result = result; event.setResult(Result.ALLOW); } - public ItemStack fillCustomBucket(World world, MovingObjectPosition pos) - { + public ItemStack fillCustomBucket(World world, MovingObjectPosition pos) { Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); - if (block != null && (block.equals(ModBlocks.blockLifeEssence)) && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) - { + if (block != null + && (block.equals(ModBlocks.blockLifeEssence)) + && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) { world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ); return new ItemStack(ModItems.bucketLife); - } else - { + } else { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/LifeEssence.java b/src/main/java/WayofTime/alchemicalWizardry/common/LifeEssence.java index 1892168e..6370a458 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/LifeEssence.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/LifeEssence.java @@ -3,24 +3,20 @@ package WayofTime.alchemicalWizardry.common; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -public class LifeEssence extends Fluid -{ - public LifeEssence(String fluidName) - { +public class LifeEssence extends Fluid { + public LifeEssence(String fluidName) { super(fluidName); this.setDensity(2000); this.setViscosity(2000); } @Override - public int getColor() - { + public int getColor() { return 0xEEEEEE; } @Override - public String getLocalizedName(FluidStack fluidStack) - { + public String getLocalizedName(FluidStack fluidStack) { return "Life Essence"; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/MessageKeyPressed.java b/src/main/java/WayofTime/alchemicalWizardry/common/MessageKeyPressed.java index ae4377f8..f2a0649d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/MessageKeyPressed.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/MessageKeyPressed.java @@ -1,67 +1,54 @@ package WayofTime.alchemicalWizardry.common; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; -public class MessageKeyPressed implements IMessage, IMessageHandler -{ +public class MessageKeyPressed implements IMessage, IMessageHandler { private byte keyPressed; - public MessageKeyPressed() - { - } + public MessageKeyPressed() {} - public MessageKeyPressed(Key key) - { - if (key == Key.OMEGA_ACTIVE) - { + public MessageKeyPressed(Key key) { + if (key == Key.OMEGA_ACTIVE) { this.keyPressed = (byte) Key.OMEGA_ACTIVE.ordinal(); } } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.keyPressed = buf.readByte(); } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeByte(keyPressed); } @Override - public IMessage onMessage(MessageKeyPressed message, MessageContext ctx) - { + public IMessage onMessage(MessageKeyPressed message, MessageContext ctx) { EntityPlayer entityPlayer = ctx.getServerHandler().playerEntity; - if(message.keyPressed == Key.OMEGA_ACTIVE.ordinal()) - { - if(entityPlayer != null) - { - ItemStack[] armourInventory = entityPlayer.inventory.armorInventory; - if(armourInventory[2] != null) - { - ItemStack chestStack = armourInventory[2]; - if(chestStack.getItem() instanceof OmegaArmour) - { - ((OmegaArmour)chestStack.getItem()).onOmegaKeyPressed(entityPlayer, chestStack); - } - } + if (message.keyPressed == Key.OMEGA_ACTIVE.ordinal()) { + if (entityPlayer != null) { + ItemStack[] armourInventory = entityPlayer.inventory.armorInventory; + if (armourInventory[2] != null) { + ItemStack chestStack = armourInventory[2]; + if (chestStack.getItem() instanceof OmegaArmour) { + ((OmegaArmour) chestStack.getItem()).onOmegaKeyPressed(entityPlayer, chestStack); + } + } } } return null; } - - public enum Key - { - OMEGA_ACTIVE + + public enum Key { + OMEGA_ACTIVE } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/ModLivingDropsEvent.java b/src/main/java/WayofTime/alchemicalWizardry/common/ModLivingDropsEvent.java index 663c52c0..dc8afa0c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/ModLivingDropsEvent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/ModLivingDropsEvent.java @@ -7,30 +7,24 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraftforge.event.entity.living.LivingDropsEvent; -public class ModLivingDropsEvent -{ +public class ModLivingDropsEvent { public static double rand; @SubscribeEvent - public void onEntityDrop(LivingDropsEvent event) - { - if (event.source.getDamageType().equals("player")) - { + public void onEntityDrop(LivingDropsEvent event) { + if (event.source.getDamageType().equals("player")) { rand = Math.random(); - if (!(event.entityLiving instanceof EntityAnimal)) - { + if (!(event.entityLiving instanceof EntityAnimal)) { PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness); - if (effect != null) - { + if (effect != null) { if (effect.getAmplifier() >= 2) - if (rand < 0.50d) - { + if (rand < 0.50d) { event.entityLiving.dropItem(ModItems.weakBloodShard, 1); } } } } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java index 5bdc65e4..56b481d6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java @@ -1,21 +1,5 @@ package WayofTime.alchemicalWizardry.common; -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 java.util.LinkedList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.ColourAndCoords; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; @@ -37,30 +21,39 @@ import cpw.mods.fml.common.network.FMLOutboundHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +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 java.util.LinkedList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.Packet; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public enum NewPacketHandler -{ +public enum NewPacketHandler { INSTANCE; private EnumMap channels; - NewPacketHandler() - { + NewPacketHandler() { this.channels = NetworkRegistry.INSTANCE.newChannel("BloodMagic", new TEAltarCodec()); - if (FMLCommonHandler.instance().getSide() == Side.CLIENT) - { + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { addClientHandler(); } - if(FMLCommonHandler.instance().getSide() == Side.SERVER) - { - System.out.println("Server sided~"); - addServerHandler(); + if (FMLCommonHandler.instance().getSide() == Side.SERVER) { + System.out.println("Server sided~"); + addServerHandler(); } } @SideOnly(Side.CLIENT) - private void addClientHandler() - { + private void addClientHandler() { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); String tileAltarCodec = clientChannel.findChannelHandlerNameForType(TEAltarCodec.class); @@ -74,30 +67,32 @@ public enum NewPacketHandler clientChannel.pipeline().addAfter(tileAltarCodec, "ParticleHandler", new ParticleMessageHandler()); clientChannel.pipeline().addAfter(tileAltarCodec, "VelocityHandler", new VelocityMessageHandler()); clientChannel.pipeline().addAfter(tileAltarCodec, "TEMasterStoneHandler", new TEMasterStoneMessageHandler()); - clientChannel.pipeline().addAfter(tileAltarCodec, "TEReagentConduitHandler", new TEReagentConduitMessageHandler()); + clientChannel + .pipeline() + .addAfter(tileAltarCodec, "TEReagentConduitHandler", new TEReagentConduitMessageHandler()); clientChannel.pipeline().addAfter(tileAltarCodec, "CurrentLPMessageHandler", new CurrentLPMessageHandler()); - clientChannel.pipeline().addAfter(tileAltarCodec, "CurrentReagentBarMessageHandler", new CurrentReagentBarMessageHandler()); - clientChannel.pipeline().addAfter(tileAltarCodec, "CurrentAddedHPMessageHandler", new CurrentAddedHPMessageHandler()); + clientChannel + .pipeline() + .addAfter(tileAltarCodec, "CurrentReagentBarMessageHandler", new CurrentReagentBarMessageHandler()); + clientChannel + .pipeline() + .addAfter(tileAltarCodec, "CurrentAddedHPMessageHandler", new CurrentAddedHPMessageHandler()); } - + @SideOnly(Side.SERVER) - private void addServerHandler() - { + private void addServerHandler() { FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); - String messageCodec = serverChannel.findChannelHandlerNameForType(TEAltarCodec.class); - serverChannel.pipeline().addAfter(messageCodec, "KeyboardMessageHandler", new KeyboardMessageHandler()); - } + String messageCodec = serverChannel.findChannelHandlerNameForType(TEAltarCodec.class); + serverChannel.pipeline().addAfter(messageCodec, "KeyboardMessageHandler", new KeyboardMessageHandler()); + } - private static class TEAltarMessageHandler extends SimpleChannelInboundHandler - { + private static class TEAltarMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TEAltar) - { + if (te instanceof TEAltar) { TEAltar altar = (TEAltar) te; altar.handlePacketData(msg.items, msg.fluids, msg.capacity); @@ -105,30 +100,24 @@ public enum NewPacketHandler } } - private static class TEOrientableMessageHandler extends SimpleChannelInboundHandler - { + private static class TEOrientableMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TEOrientable) - { + if (te instanceof TEOrientable) { ((TEOrientable) te).setInputDirection(ForgeDirection.getOrientation(msg.input)); ((TEOrientable) te).setOutputDirection(ForgeDirection.getOrientation(msg.output)); } } } - private static class TEPedestalMessageHandler extends SimpleChannelInboundHandler - { + private static class TEPedestalMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TEPedestal) - { + if (te instanceof TEPedestal) { TEPedestal pedestal = (TEPedestal) te; pedestal.handlePacketData(msg.items); @@ -136,15 +125,12 @@ public enum NewPacketHandler } } - private static class TEPlinthMessageHandler extends SimpleChannelInboundHandler - { + private static class TEPlinthMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TEPlinth) - { + if (te instanceof TEPlinth) { TEPlinth Plinth = (TEPlinth) te; Plinth.handlePacketData(msg.items); @@ -152,15 +138,12 @@ public enum NewPacketHandler } } - private static class TESocketMessageHandler extends SimpleChannelInboundHandler - { + private static class TESocketMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TESocket) - { + if (te instanceof TESocket) { TESocket Socket = (TESocket) te; Socket.handlePacketData(msg.items); @@ -168,15 +151,12 @@ public enum NewPacketHandler } } - private static class TETeleposerMessageHandler extends SimpleChannelInboundHandler - { + private static class TETeleposerMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TETeleposer) - { + if (te instanceof TETeleposer) { TETeleposer Teleposer = (TETeleposer) te; Teleposer.handlePacketData(msg.items); @@ -184,15 +164,12 @@ public enum NewPacketHandler } } - private static class TEWritingTableMessageHandler extends SimpleChannelInboundHandler - { + private static class TEWritingTableMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TEWritingTable) - { + if (te instanceof TEWritingTable) { TEWritingTable WritingTable = (TEWritingTable) te; WritingTable.handlePacketData(msg.items); @@ -200,26 +177,21 @@ public enum NewPacketHandler } } - private static class ParticleMessageHandler extends SimpleChannelInboundHandler - { + private static class ParticleMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, ParticleMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, ParticleMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); world.spawnParticle(msg.particle, msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel); } } - private static class VelocityMessageHandler extends SimpleChannelInboundHandler - { + private static class VelocityMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, VelocityMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, VelocityMessage msg) throws Exception { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (player != null) - { + if (player != null) { player.motionX = msg.xVel; player.motionY = msg.yVel; player.motionZ = msg.zVel; @@ -227,15 +199,12 @@ public enum NewPacketHandler } } - private static class TEMasterStoneMessageHandler extends SimpleChannelInboundHandler - { + private static class TEMasterStoneMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TEMasterStone) - { + if (te instanceof TEMasterStone) { TEMasterStone masterStone = (TEMasterStone) te; masterStone.setCurrentRitual(msg.ritual); @@ -244,80 +213,66 @@ public enum NewPacketHandler } } - private static class TEReagentConduitMessageHandler extends SimpleChannelInboundHandler - { + private static class TEReagentConduitMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) throws Exception { World world = AlchemicalWizardry.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); - if (te instanceof TEReagentConduit) - { + if (te instanceof TEReagentConduit) { TEReagentConduit reagentConduit = (TEReagentConduit) te; reagentConduit.destinationList = msg.destinationList; } } } - - private static class CurrentLPMessageHandler extends SimpleChannelInboundHandler - { + + private static class CurrentLPMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, CurrentLPMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, CurrentLPMessage msg) throws Exception { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + APISpellHelper.setPlayerLPTag(player, msg.currentLP); APISpellHelper.setPlayerMaxLPTag(player, msg.maxLP); } } - - private static class CurrentReagentBarMessageHandler extends SimpleChannelInboundHandler - { + + private static class CurrentReagentBarMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, CurrentReagentBarMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, CurrentReagentBarMessage msg) throws Exception { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + APISpellHelper.setPlayerReagentType(player, msg.reagent); APISpellHelper.setPlayerCurrentReagentAmount(player, msg.currentAR); APISpellHelper.setPlayerMaxReagentAmount(player, msg.maxAR); } } - - private static class CurrentAddedHPMessageHandler extends SimpleChannelInboundHandler - { + + private static class CurrentAddedHPMessageHandler extends SimpleChannelInboundHandler { @Override - protected void channelRead0(ChannelHandlerContext ctx, CurrentAddedHPMessage msg) throws Exception - { + protected void channelRead0(ChannelHandlerContext ctx, CurrentAddedHPMessage msg) throws Exception { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + APISpellHelper.setCurrentAdditionalHP(player, msg.currentHP); APISpellHelper.setCurrentAdditionalMaxHP(player, msg.maxHP); } } - - private static class KeyboardMessageHandler extends SimpleChannelInboundHandler - { - public KeyboardMessageHandler() - { - System.out.println("I am being created"); - } - @Override - protected void channelRead0(ChannelHandlerContext ctx, KeyboardMessage msg) throws Exception - { - System.out.println("Hmmm"); - + + private static class KeyboardMessageHandler extends SimpleChannelInboundHandler { + public KeyboardMessageHandler() { + System.out.println("I am being created"); + } + + @Override + protected void channelRead0(ChannelHandlerContext ctx, KeyboardMessage msg) throws Exception { + System.out.println("Hmmm"); } } - public static class BMMessage - { + public static class BMMessage { int index; } - public static class TEAltarMessage extends BMMessage - { + public static class TEAltarMessage extends BMMessage { int x; int y; int z; @@ -327,8 +282,7 @@ public enum NewPacketHandler int capacity; } - public static class TEOrientableMessage extends BMMessage - { + public static class TEOrientableMessage extends BMMessage { int x; int y; int z; @@ -337,8 +291,7 @@ public enum NewPacketHandler int output; } - public static class TEPedestalMessage extends BMMessage - { + public static class TEPedestalMessage extends BMMessage { int x; int y; int z; @@ -346,8 +299,7 @@ public enum NewPacketHandler int[] items; } - public static class TEPlinthMessage extends BMMessage - { + public static class TEPlinthMessage extends BMMessage { int x; int y; int z; @@ -355,8 +307,7 @@ public enum NewPacketHandler int[] items; } - public static class TESocketMessage extends BMMessage - { + public static class TESocketMessage extends BMMessage { int x; int y; int z; @@ -364,8 +315,7 @@ public enum NewPacketHandler int[] items; } - public static class TETeleposerMessage extends BMMessage - { + public static class TETeleposerMessage extends BMMessage { int x; int y; int z; @@ -373,8 +323,7 @@ public enum NewPacketHandler int[] items; } - public static class TEWritingTableMessage extends BMMessage - { + public static class TEWritingTableMessage extends BMMessage { int x; int y; int z; @@ -382,8 +331,7 @@ public enum NewPacketHandler int[] items; } - public static class ParticleMessage extends BMMessage - { + public static class ParticleMessage extends BMMessage { String particle; double xCoord; @@ -395,15 +343,13 @@ public enum NewPacketHandler double zVel; } - public static class VelocityMessage extends BMMessage - { + public static class VelocityMessage extends BMMessage { double xVel; double yVel; double zVel; } - public static class TEMasterStoneMessage extends BMMessage - { + public static class TEMasterStoneMessage extends BMMessage { int x; int y; int z; @@ -412,75 +358,60 @@ public enum NewPacketHandler boolean isRunning; } - public static class TEReagentConduitMessage extends BMMessage - { + public static class TEReagentConduitMessage extends BMMessage { int x; int y; int z; List destinationList; } - - public static class CurrentLPMessage extends BMMessage - { - int currentLP; - int maxLP; - } - - public static class CurrentReagentBarMessage extends BMMessage - { - String reagent; - float currentAR; - float maxAR; - } - - public static class CurrentAddedHPMessage extends BMMessage - { - float currentHP; - float maxHP; - } - - public static class KeyboardMessage extends BMMessage - { - byte keyPressed; - } - - private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec - { - public ClientToServerCodec() - { - } - - @Override - public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception - { - target.writeInt(msg.index); - - -// switch(msg.index) - { - - } - } - @Override - public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, BMMessage msg) - { - int index = source.readInt(); - - System.out.println("Packet is recieved and being decoded"); - -// switch(index) - { - - } - } + public static class CurrentLPMessage extends BMMessage { + int currentLP; + int maxLP; } - private class TEAltarCodec extends FMLIndexedMessageToMessageCodec - { - public TEAltarCodec() - { + public static class CurrentReagentBarMessage extends BMMessage { + String reagent; + float currentAR; + float maxAR; + } + + public static class CurrentAddedHPMessage extends BMMessage { + float currentHP; + float maxHP; + } + + public static class KeyboardMessage extends BMMessage { + byte keyPressed; + } + + private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec { + public ClientToServerCodec() {} + + @Override + public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception { + target.writeInt(msg.index); + + // switch(msg.index) + { + } + } + + @Override + public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, BMMessage msg) { + int index = source.readInt(); + + System.out.println("Packet is recieved and being decoded"); + + // switch(index) + { + } + } + } + + private class TEAltarCodec extends FMLIndexedMessageToMessageCodec { + public TEAltarCodec() { addDiscriminator(0, TEAltarMessage.class); addDiscriminator(1, TEOrientableMessage.class); addDiscriminator(2, TEPedestalMessage.class); @@ -499,34 +430,28 @@ public enum NewPacketHandler } @Override - public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception - { + public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception { target.writeInt(msg.index); - switch (msg.index) - { + switch (msg.index) { case 0: target.writeInt(((TEAltarMessage) msg).x); target.writeInt(((TEAltarMessage) msg).y); target.writeInt(((TEAltarMessage) msg).z); target.writeBoolean(((TEAltarMessage) msg).items != null); - if (((TEAltarMessage) msg).items != null) - { + if (((TEAltarMessage) msg).items != null) { int[] items = ((TEAltarMessage) 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); } } target.writeBoolean(((TEAltarMessage) msg).fluids != null); - if (((TEAltarMessage) msg).fluids != null) - { + if (((TEAltarMessage) msg).fluids != null) { int[] fluids = ((TEAltarMessage) 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); } @@ -552,11 +477,9 @@ public enum NewPacketHandler target.writeInt(((TEPedestalMessage) msg).z); target.writeBoolean(((TEPedestalMessage) msg).items != null); - if (((TEPedestalMessage) msg).items != null) - { + if (((TEPedestalMessage) msg).items != null) { int[] items = ((TEPedestalMessage) 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); } @@ -570,11 +493,9 @@ public enum NewPacketHandler target.writeInt(((TEPlinthMessage) msg).z); target.writeBoolean(((TEPlinthMessage) msg).items != null); - if (((TEPlinthMessage) msg).items != null) - { + if (((TEPlinthMessage) msg).items != null) { int[] items = ((TEPlinthMessage) 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); } @@ -588,11 +509,9 @@ public enum NewPacketHandler target.writeInt(((TESocketMessage) msg).z); target.writeBoolean(((TESocketMessage) msg).items != null); - if (((TESocketMessage) msg).items != null) - { + if (((TESocketMessage) msg).items != null) { int[] items = ((TESocketMessage) 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); } @@ -606,11 +525,9 @@ public enum NewPacketHandler target.writeInt(((TETeleposerMessage) msg).z); target.writeBoolean(((TETeleposerMessage) msg).items != null); - if (((TETeleposerMessage) msg).items != null) - { + if (((TETeleposerMessage) msg).items != null) { int[] items = ((TETeleposerMessage) 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); } @@ -624,11 +541,9 @@ public enum NewPacketHandler target.writeInt(((TEWritingTableMessage) msg).z); target.writeBoolean(((TEWritingTableMessage) msg).items != null); - if (((TEWritingTableMessage) msg).items != null) - { + if (((TEWritingTableMessage) msg).items != null) { int[] items = ((TEWritingTableMessage) 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); } @@ -639,8 +554,7 @@ public enum NewPacketHandler case 7: String str = ((ParticleMessage) msg).particle; target.writeInt(str.length()); - for (int i = 0; i < str.length(); i++) - { + for (int i = 0; i < str.length(); i++) { target.writeChar(str.charAt(i)); } @@ -668,8 +582,7 @@ public enum NewPacketHandler String ritual = ((TEMasterStoneMessage) msg).ritual; target.writeInt(ritual.length()); - for (int i = 0; i < ritual.length(); i++) - { + for (int i = 0; i < ritual.length(); i++) { target.writeChar(ritual.charAt(i)); } @@ -685,8 +598,7 @@ public enum NewPacketHandler List list = ((TEReagentConduitMessage) msg).destinationList; target.writeInt(list.size()); - for (ColourAndCoords colourSet : list) - { + for (ColourAndCoords colourSet : list) { target.writeInt(colourSet.colourRed); target.writeInt(colourSet.colourGreen); target.writeInt(colourSet.colourBlue); @@ -697,47 +609,43 @@ public enum NewPacketHandler } break; - - case 11: - target.writeInt(((CurrentLPMessage) msg).currentLP); - target.writeInt(((CurrentLPMessage) msg).maxLP); - - break; - - case 12: - char[] charSet = ((CurrentReagentBarMessage)msg).reagent.toCharArray(); - target.writeInt(charSet.length); - for(char cha : charSet) - { - target.writeChar(cha); - } - target.writeFloat(((CurrentReagentBarMessage)msg).currentAR); - target.writeFloat(((CurrentReagentBarMessage)msg).maxAR); - - break; - - case 13: - target.writeFloat(((CurrentAddedHPMessage) msg).currentHP); - target.writeFloat(((CurrentAddedHPMessage) msg).maxHP); - - break; - - case 14: - System.out.println("Packet is being encoded"); - target.writeByte(((KeyboardMessage)msg).keyPressed); - break; + case 11: + target.writeInt(((CurrentLPMessage) msg).currentLP); + target.writeInt(((CurrentLPMessage) msg).maxLP); + + break; + + case 12: + char[] charSet = ((CurrentReagentBarMessage) msg).reagent.toCharArray(); + target.writeInt(charSet.length); + for (char cha : charSet) { + target.writeChar(cha); + } + target.writeFloat(((CurrentReagentBarMessage) msg).currentAR); + target.writeFloat(((CurrentReagentBarMessage) msg).maxAR); + + break; + + case 13: + target.writeFloat(((CurrentAddedHPMessage) msg).currentHP); + target.writeFloat(((CurrentAddedHPMessage) msg).maxHP); + + break; + + case 14: + System.out.println("Packet is being encoded"); + + target.writeByte(((KeyboardMessage) msg).keyPressed); + break; } } - @Override - public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg) - { + public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg) { int index = dat.readInt(); - switch (index) - { + switch (index) { case 0: ((TEAltarMessage) msg).x = dat.readInt(); ((TEAltarMessage) msg).y = dat.readInt(); @@ -745,11 +653,9 @@ public enum NewPacketHandler boolean hasStacks = dat.readBoolean(); ((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3]; - if (hasStacks) - { + if (hasStacks) { ((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3]; - for (int i = 0; i < ((TEAltarMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TEAltarMessage) msg).items.length; i++) { ((TEAltarMessage) msg).items[i] = dat.readInt(); } } @@ -757,8 +663,7 @@ public enum NewPacketHandler boolean hasFluids = dat.readBoolean(); ((TEAltarMessage) msg).fluids = new int[6]; if (hasFluids) - for (int i = 0; i < ((TEAltarMessage) msg).fluids.length; i++) - { + for (int i = 0; i < ((TEAltarMessage) msg).fluids.length; i++) { ((TEAltarMessage) msg).fluids[i] = dat.readInt(); } @@ -784,11 +689,9 @@ public enum NewPacketHandler boolean hasStacks1 = dat.readBoolean(); ((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3]; - if (hasStacks1) - { + if (hasStacks1) { ((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3]; - for (int i = 0; i < ((TEPedestalMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TEPedestalMessage) msg).items.length; i++) { ((TEPedestalMessage) msg).items[i] = dat.readInt(); } } @@ -803,11 +706,9 @@ public enum NewPacketHandler boolean hasStacks2 = dat.readBoolean(); ((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3]; - if (hasStacks2) - { + if (hasStacks2) { ((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3]; - for (int i = 0; i < ((TEPlinthMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TEPlinthMessage) msg).items.length; i++) { ((TEPlinthMessage) msg).items[i] = dat.readInt(); } } @@ -822,11 +723,9 @@ public enum NewPacketHandler boolean hasStacks3 = dat.readBoolean(); ((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3]; - if (hasStacks3) - { + if (hasStacks3) { ((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3]; - for (int i = 0; i < ((TESocketMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TESocketMessage) msg).items.length; i++) { ((TESocketMessage) msg).items[i] = dat.readInt(); } } @@ -841,11 +740,9 @@ public enum NewPacketHandler boolean hasStacks4 = dat.readBoolean(); ((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3]; - if (hasStacks4) - { + if (hasStacks4) { ((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3]; - for (int i = 0; i < ((TETeleposerMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TETeleposerMessage) msg).items.length; i++) { ((TETeleposerMessage) msg).items[i] = dat.readInt(); } } @@ -860,11 +757,9 @@ public enum NewPacketHandler boolean hasStacks5 = dat.readBoolean(); ((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3]; - if (hasStacks5) - { + if (hasStacks5) { ((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3]; - for (int i = 0; i < ((TEWritingTableMessage) msg).items.length; i++) - { + for (int i = 0; i < ((TEWritingTableMessage) msg).items.length; i++) { ((TEWritingTableMessage) msg).items[i] = dat.readInt(); } } @@ -875,8 +770,7 @@ public enum NewPacketHandler int size = dat.readInt(); String str = ""; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { str = str + dat.readChar(); } @@ -907,8 +801,7 @@ public enum NewPacketHandler int ritualStrSize = dat.readInt(); String ritual = ""; - for (int i = 0; i < ritualStrSize; i++) - { + for (int i = 0; i < ritualStrSize; i++) { ritual = ritual + dat.readChar(); } @@ -926,52 +819,56 @@ public enum NewPacketHandler List list = new LinkedList(); - for (int i = 0; i < listSize; i++) - { - list.add(new ColourAndCoords(dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt())); + for (int i = 0; i < listSize; i++) { + list.add(new ColourAndCoords( + dat.readInt(), + dat.readInt(), + dat.readInt(), + dat.readInt(), + dat.readInt(), + dat.readInt(), + dat.readInt())); } ((TEReagentConduitMessage) msg).destinationList = list; break; - + case 11: - ((CurrentLPMessage) msg).currentLP = dat.readInt(); - ((CurrentLPMessage) msg).maxLP = dat.readInt(); + ((CurrentLPMessage) msg).currentLP = dat.readInt(); + ((CurrentLPMessage) msg).maxLP = dat.readInt(); + + break; - break; - case 12: - int size1 = dat.readInt(); - String str1 = ""; - for(int i=0; i achievements = new ArrayList(); - public AchievementsMod(String name, int x, int y, ItemStack icon, Achievement parent) - { + public AchievementsMod(String name, int x, int y, ItemStack icon, Achievement parent) { super("achievement.alchemicalwizardry:" + name, "alchemicalwizardry:" + name, x, y, icon, parent); achievements.add(this); registerStat(); } - public AchievementsMod(String name, int x, int y, Item icon, Achievement parent) - { + public AchievementsMod(String name, int x, int y, Item icon, Achievement parent) { this(name, x, y, new ItemStack(icon), parent); } - public AchievementsMod(String name, int x, int y, Block icon, Achievement parent) - { + public AchievementsMod(String name, int x, int y, Block icon, Achievement parent) { this(name, x, y, new ItemStack(icon), parent); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/achievements/AchievementsRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/achievements/AchievementsRegistry.java index 02e15ac6..772bf7c1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/achievements/AchievementsRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/achievements/AchievementsRegistry.java @@ -4,30 +4,26 @@ import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; -import net.minecraft.item.Item; -import net.minecraft.block.Block; -import net.minecraft.stats.Achievement; - import java.util.ArrayList; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.stats.Achievement; -public class AchievementsRegistry -{ - public final static List craftinglist = new ArrayList(); - public final static List pickupList = new ArrayList(); - public final static List blockCraftingList = new ArrayList(); -// public final static List blockPickupList = new ArrayList(); +public class AchievementsRegistry { + public static final List craftinglist = new ArrayList(); + public static final List pickupList = new ArrayList(); + public static final List blockCraftingList = new ArrayList(); + // public final static List blockPickupList = new ArrayList(); - public static void init() - { + public static void init() { addItemsToCraftingList(); addBlocksToCraftingList(); addItemsToPickupList(); -// addBlocksToPickupList(); + // addBlocksToPickupList(); } - public static void addItemsToCraftingList() - { + public static void addItemsToCraftingList() { craftinglist.add(ModItems.sacrificialDagger); craftinglist.add(ModItems.itemBloodPack); craftinglist.add(ModItems.waterSigil); @@ -39,15 +35,13 @@ public class AchievementsRegistry craftinglist.add(ModItems.energyBazooka); } - public static void addBlocksToCraftingList() - { + public static void addBlocksToCraftingList() { blockCraftingList.add(ModBlocks.bloodRune); blockCraftingList.add(ModBlocks.blockWritingTable); blockCraftingList.add(ModBlocks.blockTeleposer); } - public static void addItemsToPickupList() - { + public static void addItemsToPickupList() { pickupList.add(ModItems.weakBloodOrb); pickupList.add(ModItems.apprenticeBloodOrb); pickupList.add(ModItems.daggerOfSacrifice); @@ -63,13 +57,9 @@ public class AchievementsRegistry pickupList.add(ModItems.transcendentBloodOrb); } - public static void addBlocksToPickupList() - { + public static void addBlocksToPickupList() {} - } - - public static Achievement getAchievementForItem(Item item) - { + public static Achievement getAchievementForItem(Item item) { if (item == ModItems.sacrificialDagger) return ModAchievements.firstPrick; if (item == ModItems.weakBloodOrb) return ModAchievements.weakOrb; if (item == ModItems.itemBloodPack) return ModAchievements.bloodLettersPack; @@ -92,9 +82,8 @@ public class AchievementsRegistry return null; } - - public static Achievement getAchievementForBlock(Block block) - { + + public static Achievement getAchievementForBlock(Block block) { if (block == ModBlocks.bloodRune) return ModAchievements.blankRunes; if (block == ModBlocks.blockWritingTable) return ModAchievements.brewingPotions; if (block == ModBlocks.blockTeleposer) return ModAchievements.teleposer; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/achievements/ModAchievements.java b/src/main/java/WayofTime/alchemicalWizardry/common/achievements/ModAchievements.java index da29820f..1b18dd75 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/achievements/ModAchievements.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/achievements/ModAchievements.java @@ -1,14 +1,13 @@ package WayofTime.alchemicalWizardry.common.achievements; import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.ModItems; +import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; import net.minecraftforge.common.AchievementPage; -import WayofTime.alchemicalWizardry.ModItems; -import cpw.mods.fml.common.FMLCommonHandler; -public class ModAchievements -{ +public class ModAchievements { public static AchievementPage alchemicalWizardryPage; public static Achievement firstPrick; @@ -36,8 +35,7 @@ public class ModAchievements public static Achievement demons; public static Achievement transcendentOrb; - public static void init() - { + public static void init() { firstPrick = new AchievementsMod("firstPrick", 0, 0, ModItems.sacrificialDagger, null).setSpecial(); weakOrb = new AchievementsMod("weakOrb", 3, 0, ModItems.weakBloodOrb, firstPrick); bloodLettersPack = new AchievementsMod("bloodLettersPack", 3, 2, ModItems.itemBloodPack, weakOrb); @@ -60,10 +58,13 @@ public class ModAchievements suppressionSigil = new AchievementsMod("suppressionSigil", 6, -2, ModItems.itemSigilOfSupression, masterOrb); archmageOrb = new AchievementsMod("archmageOrb", -1, 2, ModItems.archmageBloodOrb, masterOrb); energyBazooka = new AchievementsMod("energyBazooka", -3, 2, ModItems.energyBazooka, archmageOrb); - demons = new AchievementsMod("demons", 0, 3, new ItemStack(ModItems.baseItems, 1, 29), archmageOrb).setSpecial(); + demons = + new AchievementsMod("demons", 0, 3, new ItemStack(ModItems.baseItems, 1, 29), archmageOrb).setSpecial(); transcendentOrb = new AchievementsMod("trancsendentOrb", 0, 5, ModItems.transcendentBloodOrb, demons); - alchemicalWizardryPage = new AchievementPage("Blood Magic", AchievementsMod.achievements.toArray(new Achievement[AchievementsMod.achievements.size()])); + alchemicalWizardryPage = new AchievementPage( + "Blood Magic", + AchievementsMod.achievements.toArray(new Achievement[AchievementsMod.achievements.size()])); AchievementPage.registerAchievementPage(alchemicalWizardryPage); AchievementsRegistry.init(); FMLCommonHandler.instance().bus().register(new AchievementTrigger()); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionComponent.java b/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionComponent.java index 72c5d5c9..a57dd42e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionComponent.java @@ -2,26 +2,22 @@ package WayofTime.alchemicalWizardry.common.alchemy; import net.minecraft.potion.Potion; -public class CombinedPotionComponent -{ +public class CombinedPotionComponent { public Potion result; public Potion pot1; public Potion pot2; - public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2) - { + public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2) { this.result = result; this.pot1 = pot1; this.pot2 = pot2; } - public boolean isRecipeValid(Potion test1, Potion test2) - { + public boolean isRecipeValid(Potion test1, Potion test2) { return (test1 == pot1 && test2 == pot2) || (test1 == pot2 && test2 == pot1); } - public boolean isRecipeValid(int test1, int test2) - { + public boolean isRecipeValid(int test1, int test2) { return (test1 == pot1.id && test2 == pot2.id) || (test1 == pot2.id && test2 == pot1.id); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionRegistry.java index 0ac3bf52..89db6267 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/CombinedPotionRegistry.java @@ -2,28 +2,22 @@ package WayofTime.alchemicalWizardry.common.alchemy; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper; import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask; +import java.util.ArrayList; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import java.util.ArrayList; -import java.util.List; - -public class CombinedPotionRegistry -{ +public class CombinedPotionRegistry { public static List potionList = new ArrayList(); - public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2) - { + public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2) { potionList.add(new CombinedPotionComponent(result, pot1, pot2)); } - public static boolean isRecipeValid(Potion pot1, Potion pot2) - { - for (CombinedPotionComponent recipe : potionList) - { - if (recipe.isRecipeValid(pot1, pot2)) - { + public static boolean isRecipeValid(Potion pot1, Potion pot2) { + for (CombinedPotionComponent recipe : potionList) { + if (recipe.isRecipeValid(pot1, pot2)) { return true; } } @@ -31,12 +25,9 @@ public class CombinedPotionRegistry return false; } - public static boolean isRecipeValid(int pot1, int pot2) - { - for (CombinedPotionComponent recipe : potionList) - { - if (recipe.isRecipeValid(pot1, pot2)) - { + public static boolean isRecipeValid(int pot1, int pot2) { + for (CombinedPotionComponent recipe : potionList) { + if (recipe.isRecipeValid(pot1, pot2)) { return true; } } @@ -44,12 +35,9 @@ public class CombinedPotionRegistry return false; } - public static Potion getPotion(Potion pot1, Potion pot2) - { - for (CombinedPotionComponent recipe : potionList) - { - if (recipe.isRecipeValid(pot1, pot2)) - { + public static Potion getPotion(Potion pot1, Potion pot2) { + for (CombinedPotionComponent recipe : potionList) { + if (recipe.isRecipeValid(pot1, pot2)) { return recipe.result; } } @@ -57,12 +45,9 @@ public class CombinedPotionRegistry return null; } - public static Potion getPotion(int pot1, int pot2) - { - for (CombinedPotionComponent recipe : potionList) - { - if (recipe.isRecipeValid(pot1, pot2)) - { + public static Potion getPotion(int pot1, int pot2) { + for (CombinedPotionComponent recipe : potionList) { + if (recipe.isRecipeValid(pot1, pot2)) { return recipe.result; } } @@ -70,32 +55,25 @@ public class CombinedPotionRegistry return null; } - public static ItemStack applyPotionEffect(ItemStack stack) - { - if (stack == null || !(stack.getItem() instanceof AlchemyFlask)) - { + public static ItemStack applyPotionEffect(ItemStack stack) { + if (stack == null || !(stack.getItem() instanceof AlchemyFlask)) { return null; } List list = AlchemyFlask.getEffects(stack); - if (list == null) - { + if (list == null) { return stack; } boolean isDone = false; - for (AlchemyPotionHelper helper1 : list) - { - if (isDone) - { + for (AlchemyPotionHelper helper1 : list) { + if (isDone) { continue; } - for (int i = 0; i < list.size(); i++) - { - if (isDone) - { + for (int i = 0; i < list.size(); i++) { + if (isDone) { continue; } @@ -103,9 +81,9 @@ public class CombinedPotionRegistry PotionEffect potEffect = getResultantPotion(helper1, helper2); - if (potEffect != null) - { - AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier()); + if (potEffect != null) { + AlchemyPotionHelper potHelper = new AlchemyPotionHelper( + potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier()); list.remove(helper1); list.remove(helper2); @@ -117,8 +95,7 @@ public class CombinedPotionRegistry } } - if (isDone) - { + if (isDone) { AlchemyFlask.setEffects(stack, list); return stack; @@ -127,28 +104,22 @@ public class CombinedPotionRegistry return null; } - public static boolean hasCombinablePotionEffect(ItemStack stack) - { - if (stack == null || !(stack.getItem() instanceof AlchemyFlask)) - { + public static boolean hasCombinablePotionEffect(ItemStack stack) { + if (stack == null || !(stack.getItem() instanceof AlchemyFlask)) { return false; } List list = AlchemyFlask.getEffects(stack); - if (list == null) - { + if (list == null) { return false; } - for (AlchemyPotionHelper helper1 : list) - { - for (AlchemyPotionHelper helper2 : list) - { + for (AlchemyPotionHelper helper1 : list) { + for (AlchemyPotionHelper helper2 : list) { int pot1 = helper1.getPotionID(); int pot2 = helper2.getPotionID(); - if (isRecipeValid(pot1, pot2)) - { + if (isRecipeValid(pot1, pot2)) { return true; } } @@ -157,19 +128,18 @@ public class CombinedPotionRegistry return false; } - public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2) - { - if (potE1 == null || potE2 == null) - { + public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2) { + if (potE1 == null || potE2 == null) { return null; } int pot1 = potE1.getPotionID(); int pot2 = potE2.getPotionID(); - if (isRecipeValid(pot1, pot2)) - { - int duration = (int) ((potE1.getTickDuration() * Math.pow(8.0f / 3.0f, potE1.getdurationFactor()) + potE2.getdurationFactor() * Math.pow(8.0f / 3.0f, potE2.getdurationFactor())) / 2.0); + if (isRecipeValid(pot1, pot2)) { + int duration = (int) ((potE1.getTickDuration() * Math.pow(8.0f / 3.0f, potE1.getdurationFactor()) + + potE2.getdurationFactor() * Math.pow(8.0f / 3.0f, potE2.getdurationFactor())) + / 2.0); int amplifier = (potE1.getConcentration() + potE2.getConcentration()) / 2; Potion pot = getPotion(pot1, pot2); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/ICombinationalCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/ICombinationalCatalyst.java index 22d02030..5a6d0096 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/ICombinationalCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/alchemy/ICombinationalCatalyst.java @@ -1,5 +1,3 @@ package WayofTime.alchemicalWizardry.common.alchemy; -public interface ICombinationalCatalyst -{ -} +public interface ICombinationalCatalyst {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/ArmourForge.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/ArmourForge.java index e9f8eee9..942c5aac 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/ArmourForge.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/ArmourForge.java @@ -9,6 +9,8 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.tileEntity.TESocket; 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.client.renderer.texture.IIconRegister; @@ -21,18 +23,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class ArmourForge extends Block -{ +public class ArmourForge extends Block { public static List helmetList = new ArrayList(); public static List plateList = new ArrayList(); public static List leggingsList = new ArrayList(); public static List bootsList = new ArrayList(); - public ArmourForge() - { + public ArmourForge() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -42,38 +39,33 @@ public class ArmourForge extends Block @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SoulForge"); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { - if (world.isRemote) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { + if (world.isRemote) { return false; } int armourType = getArmourType(world, x, y, z); - if (armourType == -1) - { + if (armourType == -1) { return false; } int direction = getDirectionForArmourType(world, x, y, z, armourType); - if (!isParadigmValid(armourType, direction, world, x, y, z)) - { + if (!isParadigmValid(armourType, direction, world, x, y, z)) { return false; } List list = null; ItemStack armourPiece = null; - switch (armourType) - { + switch (armourType) { case 0: list = plateList; armourPiece = new ItemStack(ModItems.boundPlate, 1, 0); @@ -95,29 +87,24 @@ public class ArmourForge extends Block break; } - if (list == null) - { + if (list == null) { return false; } - if (armourPiece == null) - { + if (armourPiece == null) { return false; } - if (armourPiece.getTagCompound() == null) - { + if (armourPiece.getTagCompound() == null) { armourPiece.setTagCompound(new NBTTagCompound()); } - for (ArmourComponent ac : list) - { + for (ArmourComponent ac : list) { int xOff = ac.getXOff(); int zOff = ac.getZOff(); TileEntity tileEntity; - switch (direction) - { + switch (direction) { case 1: tileEntity = world.getTileEntity(x + xOff, y, z - zOff); break; @@ -146,8 +133,7 @@ public class ArmourForge extends Block tileEntity = null; } - if (tileEntity instanceof TESocket) - { + if (tileEntity instanceof TESocket) { ItemStack itemStack = ((TESocket) tileEntity).getStackInSlot(0); int xCoord = tileEntity.xCoord; int yCoord = tileEntity.yCoord; @@ -155,17 +141,15 @@ public class ArmourForge extends Block ((TESocket) tileEntity).setInventorySlotContents(0, null); world.setBlockToAir(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); - for (int i = 0; i < 8; i++) - { - SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord); + for (int i = 0; i < 8; i++) { + SpellHelper.sendIndexedParticleToAllAround( + world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord); } - if (itemStack != null) - { + if (itemStack != null) { Item item = itemStack.getItem(); - if (item instanceof ArmourUpgrade) - { + if (item instanceof ArmourUpgrade) { ((BoundArmour) armourPiece.getItem()).hasAddedToInventory(armourPiece, itemStack.copy()); ((TESocket) tileEntity).setInventorySlotContents(0, null); } @@ -173,8 +157,7 @@ public class ArmourForge extends Block } } - if (armourPiece != null) - { + if (armourPiece != null) { int xOff = (world.rand.nextInt(11) - 5); int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2); world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff)); @@ -184,13 +167,10 @@ public class ArmourForge extends Block return true; } - //0 for plate, 1 for leggings, 2 for helmet, 3 for boots - public int getArmourType(World world, int x, int y, int z) - { - for (int i = 0; i <= 3; i++) - { - if (getDirectionForArmourType(world, x, y, z, i) != -1) - { + // 0 for plate, 1 for leggings, 2 for helmet, 3 for boots + public int getArmourType(World world, int x, int y, int z) { + for (int i = 0; i <= 3; i++) { + if (getDirectionForArmourType(world, x, y, z, i) != -1) { return i; } } @@ -198,12 +178,9 @@ public class ArmourForge extends Block return -1; } - public int getDirectionForArmourType(World world, int x, int y, int z, int armourType) - { - for (int i = 1; i <= 6; i++) - { - if (isParadigmValid(armourType, i, world, x, y, z)) - { + public int getDirectionForArmourType(World world, int x, int y, int z, int armourType) { + for (int i = 1; i <= 6; i++) { + if (isParadigmValid(armourType, i, world, x, y, z)) { return i; } } @@ -211,12 +188,10 @@ public class ArmourForge extends Block return -1; } - public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z) - { + public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z) { List list = null; - switch (armourType) - { + switch (armourType) { case 0: list = plateList; break; @@ -234,61 +209,52 @@ public class ArmourForge extends Block break; } - if (list == null) - { + if (list == null) { return false; } - for (ArmourComponent ac : list) - { + for (ArmourComponent ac : list) { int xOff = ac.getXOff(); int zOff = ac.getZOff(); - switch (direction) - { + switch (direction) { case 1: - if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket)) - { + if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket)) { return false; } break; case 2: - if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket)) - { + if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket)) { return false; } break; case 3: - if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket)) - { + if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket)) { return false; } break; case 4: - if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket)) - { + if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket)) { return false; } break; case 5: - if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket)) - { + if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket)) { return false; } break; case 6: - if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket)) - { + if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket)) { return false; } @@ -302,8 +268,7 @@ public class ArmourForge extends Block return true; } - public static void initializeRecipes() - { + public static void initializeRecipes() { helmetList.add(new ArmourComponent(-1, 1)); helmetList.add(new ArmourComponent(0, 1)); helmetList.add(new ArmourComponent(1, 1)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java index e9e98e44..5d058bc0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -15,12 +16,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.Random; - -public class BlockAlchemicCalcinator extends BlockContainer -{ - public BlockAlchemicCalcinator() - { +public class BlockAlchemicCalcinator extends BlockContainer { + public BlockAlchemicCalcinator() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); @@ -29,76 +26,68 @@ public class BlockAlchemicCalcinator extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TEAlchemicCalcinator(); } @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 boolean canProvidePower() - { + public boolean canProvidePower() { return true; } @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; @@ -112,49 +101,40 @@ public class BlockAlchemicCalcinator 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) { TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) 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() instanceof IReagentManipulator) - { + if (playerItem != null) { + if (playerItem.getItem() instanceof IReagentManipulator) { return false; } - if (playerItem.getItem() instanceof IBloodOrb) - { - if (tileEntity.getStackInSlot(0) == null) - { + if (playerItem.getItem() instanceof IBloodOrb) { + if (tileEntity.getStackInSlot(0) == null) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(0, newItem); } - } else if (tileEntity.getStackInSlot(1) == null) - { + } else if (tileEntity.getStackInSlot(1) == null) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(1, newItem); } - } else - { - if (tileEntity.getStackInSlot(1) != null) - { + } else { + if (tileEntity.getStackInSlot(1) != null) { player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1)); tileEntity.setInventorySlotContents(1, null); - } else if (tileEntity.getStackInSlot(0) != null) - { + } else if (tileEntity.getStackInSlot(0) != null) { player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); tileEntity.setInventorySlotContents(0, null); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAltar.java index 1b425496..3989a68a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAltar.java @@ -1,7 +1,14 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +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 WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +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; @@ -14,26 +21,18 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -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 WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockAltar extends BlockContainer -{ +public class BlockAltar extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockAltar() - { + public BlockAltar() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); @@ -43,8 +42,7 @@ public class BlockAltar extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom"); @@ -52,10 +50,8 @@ public class BlockAltar 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: @@ -66,22 +62,18 @@ public class BlockAltar 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 TEAltar) - { + if (tile instanceof TEAltar) { ItemStack stack = ((TEAltar) 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); @@ -94,67 +86,50 @@ public class BlockAltar 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) { TEAltar tileEntity = (TEAltar) 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) - { - return false; - } - else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) - { + } else if (playerItem.getItem() instanceof IAltarManipulator) { + return false; + } else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) { ItemStack item = SigilOfHolding.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); } @@ -163,15 +138,13 @@ public class BlockAltar 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(); @@ -181,40 +154,38 @@ public class BlockAltar 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; @@ -228,48 +199,40 @@ public class BlockAltar 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 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) { TEAltar tileEntity = (TEAltar) 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 TEAltar(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBelljar.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBelljar.java index e04354f3..47735a73 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBelljar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBelljar.java @@ -1,8 +1,15 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; - import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -14,19 +21,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockBelljar extends BlockContainer -{ - public BlockBelljar() - { +public class BlockBelljar extends BlockContainer { + public BlockBelljar() { super(Material.glass); setHardness(2.0F); setResistance(5.0F); @@ -34,122 +31,101 @@ public class BlockBelljar extends BlockContainer this.setBlockName("crystalBelljar"); } - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.blockCrystalBelljar)) - { - par3List.add(new ItemStack(par1, 1, 0)); - - for(Reagent reagent : ReagentRegistry.reagentList.values()) - { - ItemStack stack = new ItemStack(par1, 1, 0); - NBTTagCompound tag = new NBTTagCompound(); - - ReagentContainer[] tanks = new ReagentContainer[1]; - tanks[0] = new ReagentContainer(reagent, 16000, 16000); - - NBTTagList tagList = new NBTTagList(); - - NBTTagCompound savedTag = new NBTTagCompound(); - if (tanks[0] != null) - { - tanks[0].writeToNBT(savedTag); - } - tagList.appendTag(savedTag); - - - tag.setTag("reagentTanks", tagList); - - stack.setTagCompound(tag); - - par3List.add(stack); - } - } else - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.blockCrystalBelljar)) { + par3List.add(new ItemStack(par1, 1, 0)); + + for (Reagent reagent : ReagentRegistry.reagentList.values()) { + ItemStack stack = new ItemStack(par1, 1, 0); + NBTTagCompound tag = new NBTTagCompound(); + + ReagentContainer[] tanks = new ReagentContainer[1]; + tanks[0] = new ReagentContainer(reagent, 16000, 16000); + + NBTTagList tagList = new NBTTagList(); + + NBTTagCompound savedTag = new NBTTagCompound(); + if (tanks[0] != null) { + tanks[0].writeToNBT(savedTag); + } + tagList.appendTag(savedTag); + + tag.setTag("reagentTanks", tagList); + + stack.setTagCompound(tag); + + par3List.add(stack); + } + } 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 TEBellJar) - { + if (tile instanceof TEBellJar) { NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) - { + if (tag != null) { ((TEBellJar) tile).readTankNBTOnPlace(tag); } } } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TEBellJar(); } @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 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 TEBellJar) - { + if (tile instanceof TEBellJar) { return ((TEBellJar) tile).getRSPowerOutput(); } return 15; } @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) { this.dropBlockAsItem(world, x, y, z, meta, 0); super.onBlockHarvested(world, x, y, z, meta, player); } @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 TEBellJar) - { + if (tile instanceof TEBellJar) { ItemStack drop = new ItemStack(this); NBTTagCompound tag = new NBTTagCompound(); ((TEBellJar) tile).writeTankNBT(tag); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBloodLightSource.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBloodLightSource.java index 4b0dfb9a..ff1201ed 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBloodLightSource.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockBloodLightSource.java @@ -2,6 +2,8 @@ package WayofTime.alchemicalWizardry.common.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -10,64 +12,64 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - -public class BlockBloodLightSource extends Block -{ - public BlockBloodLightSource() - { +public class BlockBloodLightSource extends Block { + public BlockBloodLightSource() { super(Material.cloth); this.setBlockName("blockBloodLightSource"); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight"); } @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) - { + public int getLightValue(IBlockAccess world, int x, int y, int z) { return 15; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { - if (rand.nextInt(3) != 0) - { + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { + if (rand.nextInt(3) != 0) { 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; - world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, f1, f2, f3); + world.spawnParticle( + "reddust", + x + 0.5D + rand.nextGaussian() / 8, + y + 0.5D, + z + 0.5D + rand.nextGaussian() / 8, + f1, + f2, + f3); } } @Override - - public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) - { + public void addCollisionBoxesToList( + World par1World, + int par2, + int par3, + int par4, + AxisAlignedBB par5AxisAlignedBB, + List par6List, + Entity par7Entity) { this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F); } - public int quantityDropped(Random par1Random) - { + public int quantityDropped(Random par1Random) { return 0; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockConduit.java index 8be5b305..9f56663e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockConduit.java @@ -10,17 +10,17 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockConduit extends BlockOrientable -{ +public class BlockConduit extends BlockOrientable { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockConduit() - { + public BlockConduit() { super(); setHardness(2.0F); setResistance(5.0F); @@ -30,8 +30,7 @@ public class BlockConduit extends BlockOrientable @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom"); @@ -39,10 +38,8 @@ public class BlockConduit extends BlockOrientable @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: @@ -53,38 +50,32 @@ public class BlockConduit extends BlockOrientable } @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) { super.breakBlock(world, x, y, z, par5, par6); } @Override - public TileEntity createNewTileEntity(World world, int noClue) - { + public TileEntity createNewTileEntity(World world, int noClue) { return new TEConduit(); } @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; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrucible.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrucible.java index 195375ed..3021627b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrucible.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrucible.java @@ -1,7 +1,11 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.sacrifice.IIncense; +import WayofTime.alchemicalWizardry.common.tileEntity.TECrucible; +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; @@ -15,62 +19,54 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.sacrifice.IIncense; -import WayofTime.alchemicalWizardry.common.tileEntity.TECrucible; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockCrucible extends BlockContainer -{ - @SideOnly(Side.CLIENT) +public class BlockCrucible extends BlockContainer { + @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - - public BlockCrucible() - { - super(Material.anvil); - this.setHardness(2.0f); - this.setResistance(1.5f); - this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); - this.setBlockName("blockCrucible"); - this.setBlockBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.625F, 0.6875F); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { + + public BlockCrucible() { + super(Material.anvil); + this.setHardness(2.0f); + this.setResistance(1.5f); + this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); + this.setBlockName("blockCrucible"); + this.setBlockBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.625F, 0.6875F); + } + + @Override + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { TECrucible tileEntity = (TECrucible) world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) - { + if (tileEntity == null || player.isSneaking()) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); - if (tileEntity.getStackInSlot(0) == null && playerItem != null && playerItem.getItem() instanceof IIncense) - { + if (tileEntity.getStackInSlot(0) == null && playerItem != null && playerItem.getItem() instanceof IIncense) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(0, newItem); -// } else if (tileEntity.getStackInSlot(0) != null && playerItem == null) //Disabled currently -// { -// player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); -// tileEntity.setInventorySlotContents(0, null); + // } else if (tileEntity.getStackInSlot(0) != null && playerItem == null) //Disabled currently + // { + // player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); + // tileEntity.setInventorySlotContents(0, null); } world.markBlockForUpdate(x, y, z); return true; } - - @Override + + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Crucible_Top"); this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:Crucible_Side"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Crucible_Bottom"); @@ -78,10 +74,8 @@ public class BlockCrucible 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: @@ -90,99 +84,88 @@ public class BlockCrucible extends BlockContainer return sideIcon; } } - -// @Override -// public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) -// { -// return null; -// } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) - { - this.setBlockBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.625F, 0.6875F); - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TECrucible(); - } - - @Override - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { - if (rand.nextInt(3) != 0) - { - TECrucible tile = (TECrucible)world.getTileEntity(x, y, z); + // @Override + // public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + // { + // return null; + // } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { + this.setBlockBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.625F, 0.6875F); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TECrucible(); + } + + @Override + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { + if (rand.nextInt(3) != 0) { + TECrucible tile = (TECrucible) world.getTileEntity(x, y, z); tile.spawnClientParticle(world, x, y, z, rand); } } - - @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) - { + + @Override + 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); } - - @Override - public boolean hasComparatorInputOverride() - { + + @Override + 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 TECrucible) - { + if (tile instanceof TECrucible) { return ((TECrucible) tile).getRSPowerOutput(); } return 15; } - 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; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrystal.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrystal.java index 57184a4f..ce82533a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrystal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrystal.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModBlocks; 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; @@ -12,19 +13,15 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - -public class BlockCrystal extends Block -{ - //private Icon bloodRuneIcon; +public class BlockCrystal extends Block { + // private Icon bloodRuneIcon; @SideOnly(Side.CLIENT) private IIcon fullIcon; + @SideOnly(Side.CLIENT) private IIcon brickIcon; - - public BlockCrystal() - { + public BlockCrystal() { super(Material.iron); this.setBlockName("crystalBlock"); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -34,8 +31,7 @@ public class BlockCrystal extends Block @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune"); this.fullIcon = iconRegister.registerIcon("AlchemicalWizardry:ShardCluster"); this.brickIcon = iconRegister.registerIcon("AlchemicalWizardry:ShardClusterBrick"); @@ -46,24 +42,19 @@ public class BlockCrystal extends Block /** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) */ - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.blockCrystal)) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.blockCrystal)) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); - } else - { + } else { super.getSubBlocks(par1, 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 fullIcon; @@ -76,8 +67,7 @@ public class BlockCrystal extends Block } @Override - public int damageDropped(int metadata) - { + public int damageDropped(int metadata) { return metadata; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockDemonPortal.java index eb3ab934..7044db5c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockDemonPortal.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; @@ -8,50 +10,41 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; -public class BlockDemonPortal extends BlockContainer -{ - public BlockDemonPortal() - { +public class BlockDemonPortal extends BlockContainer { + public BlockDemonPortal() { super(Material.rock); setHardness(1000); setResistance(10000); setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setBlockName("demonPortal"); } - + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonPortal"); } - - @Override - 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 TEDemonPortal) - { - ((TEDemonPortal) tile).notifyPortalOfBreak(); - } - - super.onBlockHarvested(world, x, y, z, meta, player); - } @Override - public TileEntity createNewTileEntity(World var1, int var2) - { + 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 TEDemonPortal) { + ((TEDemonPortal) tile).notifyPortalOfBreak(); + } + + super.onBlockHarvested(world, x, y, z, meta, player); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { return new TEDemonPortal(); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) - { - if (world.isRemote) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) { + if (world.isRemote) { return false; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockEnchantmentGlyph.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockEnchantmentGlyph.java index 9cd21a37..11df4f3c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockEnchantmentGlyph.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockEnchantmentGlyph.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.omega.IEnchantmentGlyph; +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,20 +13,15 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.omega.IEnchantmentGlyph; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph -{ - @SideOnly(Side.CLIENT) - private IIcon enchantability; - @SideOnly(Side.CLIENT) - private IIcon enchantmentLevel; - - public BlockEnchantmentGlyph() - { +public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph { + @SideOnly(Side.CLIENT) + private IIcon enchantability; + + @SideOnly(Side.CLIENT) + private IIcon enchantmentLevel; + + public BlockEnchantmentGlyph() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -33,19 +31,16 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick"); this.enchantability = iconRegister.registerIcon("AlchemicalWizardry:GlyphEnchantability"); this.enchantmentLevel = iconRegister.registerIcon("AlchemicalWizardry:GlyphEnchantmentLevel"); } - + @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 enchantability; case 1: @@ -55,56 +50,47 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph } } - @Override - public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount) - { - switch(meta) - { - case 0: - return -faceCount * 10; - case 1: - return -faceCount * 20; - default: - return -faceCount * 20; - } - } - - @Override - public int getEnchantability(World world, int x, int y, int z, int meta) - { - switch(meta) - { - case 0: - return 1; - default: - return 0; - } - } - - @Override - public int getEnchantmentLevel(World world, int x, int y, int z, int meta) - { - switch(meta) - { - case 1: - return 1; - default: - return 0; - } - } - - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for(int i=0; i<2; i++) - { - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount) { + switch (meta) { + case 0: + return -faceCount * 10; + case 1: + return -faceCount * 20; + default: + return -faceCount * 20; + } } - - @Override - public int damageDropped(int metadata) - { + + @Override + public int getEnchantability(World world, int x, int y, int z, int meta) { + switch (meta) { + case 0: + return 1; + default: + return 0; + } + } + + @Override + public int getEnchantmentLevel(World world, int x, int y, int z, int meta) { + switch (meta) { + case 1: + return 1; + default: + return 0; + } + } + + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < 2; i++) { + par3List.add(new ItemStack(par1, 1, i)); + } + } + + @Override + public int damageDropped(int metadata) { return metadata; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockHomHeart.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockHomHeart.java index f1ba267a..f0a44392 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockHomHeart.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockHomHeart.java @@ -15,17 +15,17 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockHomHeart extends BlockContainer -{ +public class BlockHomHeart extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon bottomIcon; + @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon; - public BlockHomHeart() - { + public BlockHomHeart() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); @@ -35,8 +35,7 @@ public class BlockHomHeart extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_top"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_bottom"); this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_side"); @@ -44,10 +43,8 @@ public class BlockHomHeart 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: @@ -58,23 +55,19 @@ public class BlockHomHeart 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) { TEHomHeart tileEntity = (TEHomHeart) 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() instanceof BlankSpell) - { - if (playerItem.getTagCompound() == null) - { + if (playerItem != null) { + if (playerItem.getItem() instanceof BlankSpell) { + if (playerItem.getTagCompound() == null) { playerItem.setTagCompound(new NBTTagCompound()); } @@ -91,8 +84,7 @@ public class BlockHomHeart extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int metaMaybe) - { + public TileEntity createNewTileEntity(World world, int metaMaybe) { return new TEHomHeart(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java index 096dc60e..7bf662d6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockMasterStone.java @@ -15,10 +15,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.Explosion; import net.minecraft.world.World; -public class BlockMasterStone extends BlockContainer -{ - public BlockMasterStone() - { +public class BlockMasterStone extends BlockContainer { + public BlockMasterStone() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -28,68 +26,60 @@ public class BlockMasterStone extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterStone"); } @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 TEMasterStone) - { + if (tile instanceof TEMasterStone) { ((TEMasterStone) tile).useOnRitualBroken(); } super.onBlockHarvested(world, x, y, z, meta, player); } - + @Override - 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 TEMasterStone) - { + 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 TEMasterStone) { ((TEMasterStone) 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) { TEMasterStone tileEntity = (TEMasterStone) 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 == null) { return false; } Item item = playerItem.getItem(); - if (!(item instanceof ActivationCrystal)) - { + if (!(item instanceof ActivationCrystal)) { return false; } ActivationCrystal acItem = (ActivationCrystal) item; -// tileEntity.setOwner(acItem.getOwnerName(playerItem)); - tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, acItem.getOwnerName(playerItem)); + // tileEntity.setOwner(acItem.getOwnerName(playerItem)); + tileEntity.activateRitual( + world, acItem.getCrystalLevel(playerItem), playerItem, player, acItem.getOwnerName(playerItem)); world.markBlockForUpdate(x, y, z); return true; } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TEMasterStone(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java index 6836b7ff..bfe1beeb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java @@ -9,10 +9,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class BlockOrientable extends BlockContainer -{ - public BlockOrientable() - { +public class BlockOrientable extends BlockContainer { + public BlockOrientable() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); @@ -20,56 +18,45 @@ public class BlockOrientable extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int dunno) - { + public TileEntity createNewTileEntity(World world, int dunno) { return new TEOrientable(); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) - { - //Right-click orients the output face. Shift-right-click orients the input face. - if (world.isRemote) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) { + // Right-click orients the output face. Shift-right-click orients the input face. + if (world.isRemote) { return false; } TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TEOrientable) - { + if (tile instanceof TEOrientable) { TEOrientable newTile = (TEOrientable) tile; - if (player.isSneaking()) - { + if (player.isSneaking()) { int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection()) + 1; - if (nextSide > 5) - { + if (nextSide > 5) { nextSide = 0; } - if (ForgeDirection.getOrientation(nextSide) == newTile.getOutputDirection()) - { + if (ForgeDirection.getOrientation(nextSide) == newTile.getOutputDirection()) { nextSide++; - if (nextSide > 5) - { + if (nextSide > 5) { nextSide = 0; } } newTile.setInputDirection(ForgeDirection.getOrientation(nextSide)); - } else - { + } else { int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection()) + 1; - if (nextSide > 5) - { + if (nextSide > 5) { nextSide = 0; } - if (ForgeDirection.getOrientation(nextSide) == newTile.getInputDirection()) - { + if (ForgeDirection.getOrientation(nextSide) == newTile.getInputDirection()) { nextSide++; - if (nextSide > 5) - { + if (nextSide > 5) { nextSide = 0; } } @@ -83,8 +70,7 @@ public class BlockOrientable extends BlockContainer } @Override - public int damageDropped(int metadata) - { + public int damageDropped(int metadata) { return metadata; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPedestal.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPedestal.java index d057b4a3..4c7e4a6a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPedestal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPedestal.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; +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; @@ -14,22 +17,18 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockPedestal extends BlockContainer -{ +public class BlockPedestal extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockPedestal() - { + public BlockPedestal() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); @@ -41,8 +40,7 @@ public class BlockPedestal extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePedestal"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket"); @@ -50,10 +48,8 @@ public class BlockPedestal 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: @@ -64,25 +60,22 @@ public class BlockPedestal 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) { TEPedestal tileEntity = (TEPedestal) world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) - { + if (tileEntity == null || player.isSneaking()) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); - 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); - } 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(); @@ -92,38 +85,38 @@ public class BlockPedestal 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; @@ -137,33 +130,27 @@ public class BlockPedestal extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TEPedestal(); } @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; } - -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPlinth.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPlinth.java index 56d47c64..653abb39 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPlinth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockPlinth.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; +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; @@ -14,22 +17,18 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockPlinth extends BlockContainer -{ +public class BlockPlinth extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockPlinth() - { + public BlockPlinth() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); @@ -41,8 +40,7 @@ public class BlockPlinth extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePlinth"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket"); @@ -50,10 +48,8 @@ public class BlockPlinth 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: @@ -64,25 +60,22 @@ public class BlockPlinth 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) { TEPlinth tileEntity = (TEPlinth) world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) - { + if (tileEntity == null || player.isSneaking()) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); - 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); - } 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(); @@ -92,38 +85,38 @@ public class BlockPlinth 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; @@ -137,33 +130,27 @@ public class BlockPlinth extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TEPlinth(); } @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; } - -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java index eeae6acc..38030c78 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java @@ -1,20 +1,18 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockReagentConduit extends BlockContainer -{ - public BlockReagentConduit() - { +public class BlockReagentConduit extends BlockContainer { + public BlockReagentConduit() { super(Material.cloth); setHardness(2.0F); setResistance(5.0F); @@ -24,50 +22,45 @@ public class BlockReagentConduit extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle"); } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TEReagentConduit(); } @Override - public boolean canProvidePower() - { + public boolean canProvidePower() { return true; } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) { return super.onBlockActivated(world, x, y, z, player, side, what, these, are); } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public int getRenderType() - { + public int getRenderType() { return -1; } -// @Override -// public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) -// { -// return null; -// } + // @Override + // public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int + // p_149668_4_) + // { + // return null; + // } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSchematicSaver.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSchematicSaver.java index 813e00ad..59cc37f0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSchematicSaver.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSchematicSaver.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.common.block; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -8,28 +7,24 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class BlockSchematicSaver extends BlockContainer -{ - public BlockSchematicSaver() - { +public class BlockSchematicSaver extends BlockContainer { + public BlockSchematicSaver() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); -// setCreativeTab(AlchemicalWizardry.tabBloodMagic); + // setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setBlockName("schematicSaver"); } @Override - public TileEntity createNewTileEntity(World var1, int var2) - { + public TileEntity createNewTileEntity(World var1, int var2) { return new TESchematicSaver(); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) - { - if (world.isRemote) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) { + if (world.isRemote) { return false; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSocket.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSocket.java index 9cfd5bcd..84af885b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSocket.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSocket.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.common.tileEntity.TESocket; 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; @@ -18,31 +19,28 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.Random; - -public class BlockSocket extends BlockContainer -{ +public class BlockSocket extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockSocket() - { + public BlockSocket() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setBlockName("bloodSocket"); - //func_111022_d("AlchemicalWizardry:blocks"); + // func_111022_d("AlchemicalWizardry:blocks"); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket"); @@ -50,10 +48,8 @@ public class BlockSocket 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: @@ -64,33 +60,26 @@ public class BlockSocket 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) { TESocket tileEntity = (TESocket) world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) - { + if (tileEntity == null || player.isSneaking()) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); - if (tileEntity.getStackInSlot(0) == null && playerItem != null) - { - if (playerItem.getItem() instanceof ArmourUpgrade) - { + if (tileEntity.getStackInSlot(0) == null && playerItem != null) { + if (playerItem.getItem() instanceof ArmourUpgrade) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(0, newItem); return true; - } - else - { + } else { return false; } - } - 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(); @@ -101,38 +90,38 @@ public class BlockSocket 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; @@ -146,8 +135,7 @@ public class BlockSocket extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TESocket(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpectralContainer.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpectralContainer.java index adf845bb..ce68ac85 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpectralContainer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpectralContainer.java @@ -3,6 +3,8 @@ package WayofTime.alchemicalWizardry.common.block; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -12,13 +14,8 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - -public class BlockSpectralContainer extends BlockContainer -{ - public BlockSpectralContainer() - { +public class BlockSpectralContainer extends BlockContainer { + public BlockSpectralContainer() { super(Material.cloth); this.setBlockName("blockSpectralContainer"); this.setBlockBounds(0, 0, 0, 0, 0, 0); @@ -26,49 +23,46 @@ public class BlockSpectralContainer extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight"); } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) - { + public void addCollisionBoxesToList( + World par1World, + int par2, + int par3, + int par4, + AxisAlignedBB par5AxisAlignedBB, + List par6List, + Entity par7Entity) {} - } - - public int quantityDropped(Random par1Random) - { + public int quantityDropped(Random par1Random) { return 0; } @Override - public boolean isReplaceable(IBlockAccess world, int x, int y, int z) - { + public boolean isReplaceable(IBlockAccess world, int x, int y, int z) { return true; } @Override - public boolean isAir(IBlockAccess world, int x, int y, int z) - { + public boolean isAir(IBlockAccess world, int x, int y, int z) { return true; } @Override - public TileEntity createNewTileEntity(World var1, int var2) - { + public TileEntity createNewTileEntity(World var1, int var2) { return new TESpectralContainer(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEffect.java index 18e6d1bb..36527d44 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEffect.java @@ -4,58 +4,46 @@ import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.List; - - -public class BlockSpellEffect extends BlockOrientable -{ - public BlockSpellEffect() - { +public class BlockSpellEffect extends BlockOrientable { + public BlockSpellEffect() { super(); this.setBlockName("blockSpellEffect"); } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TESpellEffectBlock(); } @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; } @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.blockSpellEffect)) - { - for (int i = 0; i < 4; i++) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.blockSpellEffect)) { + for (int i = 0; i < 4; i++) { par3List.add(new ItemStack(par1, 1, i)); } - } else - { + } else { super.getSubBlocks(par1, par2CreativeTabs, par3List); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEnhancement.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEnhancement.java index b58d36c0..c277fe21 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEnhancement.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellEnhancement.java @@ -4,57 +4,46 @@ import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.List; - -public class BlockSpellEnhancement extends BlockOrientable -{ - public BlockSpellEnhancement() - { +public class BlockSpellEnhancement extends BlockOrientable { + public BlockSpellEnhancement() { super(); this.setBlockName("blockSpellEnhancement"); } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TESpellEnhancementBlock(); } @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; } @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.blockSpellEnhancement)) - { - for (int i = 0; i < 15; i++) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.blockSpellEnhancement)) { + for (int i = 0; i < 15; i++) { par3List.add(new ItemStack(par1, 1, i)); } - } else - { + } else { super.getSubBlocks(par1, par2CreativeTabs, par3List); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellModifier.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellModifier.java index 80c384cc..caab7826 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellModifier.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellModifier.java @@ -4,58 +4,47 @@ import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.List; - -public class BlockSpellModifier extends BlockOrientable -{ - public BlockSpellModifier() - { +public class BlockSpellModifier extends BlockOrientable { + public BlockSpellModifier() { super(); this.setBlockName("blockSpellModifier"); } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TESpellModifierBlock(); } @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.blockSpellModifier)) - { - for (int i = 0; i < 4; i++) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.blockSpellModifier)) { + for (int i = 0; i < 4; i++) { par3List.add(new ItemStack(par1, 1, i)); } - } else - { + } else { super.getSubBlocks(par1, par2CreativeTabs, par3List); } } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public int getRenderType() - { + public int getRenderType() { return -1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java index e510791c..e6c64488 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -13,19 +14,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.List; - -public class BlockSpellParadigm extends BlockOrientable -{ - public BlockSpellParadigm() - { +public class BlockSpellParadigm extends BlockOrientable { + public BlockSpellParadigm() { super(); this.setBlockName("blockSpellParadigm"); } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TESpellParadigmBlock(); } @@ -34,29 +30,24 @@ public class BlockSpellParadigm extends BlockOrientable /** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) */ - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.blockSpellParadigm)) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.blockSpellParadigm)) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); par3List.add(new ItemStack(par1, 1, 2)); par3List.add(new ItemStack(par1, 1, 3)); - } else - { + } else { super.getSubBlocks(par1, par2CreativeTabs, par3List); } } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) { ItemStack stack = player.getCurrentEquippedItem(); - if (stack != null && stack.getItem() instanceof ItemComplexSpellCrystal) - { - if (stack.getTagCompound() == null) - { + if (stack != null && stack.getItem() instanceof ItemComplexSpellCrystal) { + if (stack.getTagCompound() == null) { stack.setTagCompound(new NBTTagCompound()); } @@ -72,20 +63,17 @@ public class BlockSpellParadigm extends BlockOrientable } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public int getRenderType() - { + public int getRenderType() { return -1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockStabilityGlyph.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockStabilityGlyph.java index 50cddbf5..a57257cb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockStabilityGlyph.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockStabilityGlyph.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.omega.IStabilityGlyph; +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 +13,12 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.omega.IStabilityGlyph; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockStabilityGlyph extends Block implements IStabilityGlyph -{ +public class BlockStabilityGlyph extends Block implements IStabilityGlyph { @SideOnly(Side.CLIENT) - private IIcon stability1; - - public BlockStabilityGlyph() - { + private IIcon stability1; + + public BlockStabilityGlyph() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -31,18 +28,15 @@ public class BlockStabilityGlyph extends Block implements IStabilityGlyph @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick"); this.stability1 = iconRegister.registerIcon("AlchemicalWizardry:GlyphStability1"); } - + @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 stability1; default: @@ -50,25 +44,20 @@ public class BlockStabilityGlyph extends Block implements IStabilityGlyph } } - @Override - public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount) - { - switch(meta) - { - case 0: - return faceCount * 2; - default: - return faceCount; - } - } - - - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for(int i=0; i<1; i++) - { - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount) { + switch (meta) { + case 0: + return faceCount * 2; + default: + return faceCount; + } + } + + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < 1; i++) { + par3List.add(new ItemStack(par1, 1, i)); + } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java index 97dea481..0eb0b5c1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java @@ -1,7 +1,17 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.event.TeleposeEvent; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; +import WayofTime.alchemicalWizardry.common.items.TelepositionFocus; +import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer; +import codechicken.multipart.MultipartHelper; +import codechicken.multipart.TileMultipart; +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.BlockContainer; import net.minecraft.block.BlockMobSpawner; @@ -18,29 +28,18 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.event.TeleposeEvent; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; -import WayofTime.alchemicalWizardry.common.items.TelepositionFocus; -import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer; -import codechicken.multipart.MultipartHelper; -import codechicken.multipart.TileMultipart; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockTeleposer extends BlockContainer -{ +public class BlockTeleposer extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockTeleposer() - { + public BlockTeleposer() { super(Material.rock); setHardness(2.0F); setResistance(5.0F); @@ -50,8 +49,7 @@ public class BlockTeleposer extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side"); @@ -59,10 +57,8 @@ public class BlockTeleposer 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: @@ -73,18 +69,15 @@ public class BlockTeleposer 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) { ItemStack playerItem = player.getCurrentEquippedItem(); - if (playerItem != null) - { - if (playerItem.getItem() instanceof TelepositionFocus) - { - SoulNetworkHandler.checkAndSetItemPlayer(playerItem, player); - - if (playerItem.getTagCompound() == null) - { + if (playerItem != null) { + if (playerItem.getItem() instanceof TelepositionFocus) { + SoulNetworkHandler.checkAndSetItemPlayer(playerItem, player); + + if (playerItem.getTagCompound() == null) { playerItem.setTagCompound(new NBTTagCompound()); } @@ -101,38 +94,38 @@ public class BlockTeleposer 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; @@ -146,147 +139,140 @@ public class BlockTeleposer extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TETeleposer(); } - - public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf) - { - return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, true, 3); - } - - public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf) - { - return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, false, 3); + + public static boolean swapBlocks( + Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf) { + return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, true, 3); } - public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf, boolean doSound, int flag) - { + public static boolean swapBlocksWithoutSound( + Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf) { + return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, false, 3); + } + + public static boolean swapBlocks( + Object caller, + World worldI, + World worldF, + int xi, + int yi, + int zi, + int xf, + int yf, + int zf, + boolean doSound, + int flag) { TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi); TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf); NBTTagCompound nbttag1 = new NBTTagCompound(); NBTTagCompound nbttag2 = new NBTTagCompound(); - if (tileEntityI != null) - { + if (tileEntityI != null) { tileEntityI.writeToNBT(nbttag1); } - if (tileEntityF != null) - { + if (tileEntityF != null) { tileEntityF.writeToNBT(nbttag2); } Block blockI = worldI.getBlock(xi, yi, zi); Block blockF = worldF.getBlock(xf, yf, zf); - - if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air)) - { + if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air)) { return false; } - if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner || caller instanceof TEDemonPortal ? false : blockI instanceof BlockPortal || blockF instanceof BlockPortal) - { + if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner || caller instanceof TEDemonPortal + ? false + : blockI instanceof BlockPortal || blockF instanceof BlockPortal) { return false; } int metaI = worldI.getBlockMetadata(xi, yi, zi); int metaF = worldF.getBlockMetadata(xf, yf, zf); - + TeleposeEvent evt = new TeleposeEvent(worldI, xi, yi, zi, blockI, metaI, worldF, xf, yf, zf, blockF, metaF); - if (MinecraftForge.EVENT_BUS.post(evt)) - return false; - - if(doSound) - { - worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F); + if (MinecraftForge.EVENT_BUS.post(evt)) return false; + + if (doSound) { + worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F); worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F); } - - //CLEAR TILES + + // CLEAR TILES Block finalBlock = blockF; - if (finalBlock != null) - { + if (finalBlock != null) { TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF); worldF.setTileEntity(xf, yf, zf, tileToSet); } - if (blockI != null) - { + if (blockI != null) { TileEntity tileToSet = blockI.createTileEntity(worldI, metaI); worldI.setTileEntity(xi, yi, zi, tileToSet); } - //TILES CLEARED + // TILES CLEARED worldF.setBlock(xf, yf, zf, blockI, metaI, flag); - if (tileEntityI != null) - { + if (tileEntityI != null) { TileEntity newTileEntityI = TileEntity.createAndLoadEntity(nbttag1); - - if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI)) - { - newTileEntityI = createMultipartFromNBT(worldF, nbttag1); - } - + + if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI)) { + newTileEntityI = createMultipartFromNBT(worldF, nbttag1); + } + worldF.setTileEntity(xf, yf, zf, newTileEntityI); - + newTileEntityI.xCoord = xf; newTileEntityI.yCoord = yf; newTileEntityI.zCoord = zf; - - if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI)) - { - sendDescriptorOfTile(worldF, newTileEntityI); - } + + if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI)) { + sendDescriptorOfTile(worldF, newTileEntityI); + } } worldI.setBlock(xi, yi, zi, finalBlock, metaF, flag); - if (tileEntityF != null) - { + if (tileEntityF != null) { TileEntity newTileEntityF = TileEntity.createAndLoadEntity(nbttag2); - if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF)) - { - newTileEntityF = createMultipartFromNBT(worldI, nbttag2); - } - + if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF)) { + newTileEntityF = createMultipartFromNBT(worldI, nbttag2); + } + worldI.setTileEntity(xi, yi, zi, newTileEntityF); - + newTileEntityF.xCoord = xi; newTileEntityF.yCoord = yi; newTileEntityF.zCoord = zi; - - if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF)) - { - sendDescriptorOfTile(worldI, newTileEntityF); - } + + if (AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF)) { + sendDescriptorOfTile(worldI, newTileEntityF); + } } return true; } - + @Optional.Method(modid = "ForgeMultipart") - public static boolean isMultipart(TileEntity tile) - { - return tile instanceof TileMultipart; + public static boolean isMultipart(TileEntity tile) { + return tile instanceof TileMultipart; } - + @Optional.Method(modid = "ForgeMultipart") - public static TileEntity createMultipartFromNBT(World world, NBTTagCompound tag) - { - return MultipartHelper.createTileFromNBT(world, tag); + public static TileEntity createMultipartFromNBT(World world, NBTTagCompound tag) { + return MultipartHelper.createTileFromNBT(world, tag); } - + @Optional.Method(modid = "ForgeMultipart") - public static void sendDescriptorOfTile(World world, TileEntity tile) - { - MultipartHelper.sendDescPacket(world, tile); + public static void sendDescriptorOfTile(World world, TileEntity tile) { + MultipartHelper.sendDescPacket(world, tile); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockWritingTable.java index c55e50a8..80a4742a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockWritingTable.java @@ -4,6 +4,8 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -19,20 +21,17 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - -public class BlockWritingTable extends BlockContainer -{ +public class BlockWritingTable extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon topIcon; + @SideOnly(Side.CLIENT) private IIcon sideIcon2; + @SideOnly(Side.CLIENT) private IIcon bottomIcon; - public BlockWritingTable() - { + public BlockWritingTable() { super(Material.wood); setHardness(2.0F); setResistance(5.0F); @@ -42,8 +41,7 @@ public class BlockWritingTable extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:AlchemicChemistrySet"); this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2"); this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom"); @@ -51,10 +49,8 @@ public class BlockWritingTable 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: @@ -65,55 +61,52 @@ public class BlockWritingTable extends BlockContainer } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are) { TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) - { + if (tileEntity == null || player.isSneaking()) { return false; } - //code to open gui explained later + // code to open gui explained later player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z); return true; } @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; @@ -127,46 +120,46 @@ public class BlockWritingTable extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TEWritingTable(); } @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 void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) - { + public void addCollisionBoxesToList( + World par1World, + int par2, + int par3, + int par4, + AxisAlignedBB par5AxisAlignedBB, + List par6List, + Entity par7Entity) { this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.9375F, 0.5625F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); this.setBlockBoundsForItemRender(); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } - public void setBlockBoundsForItemRender() - { + public void setBlockBoundsForItemRender() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodRune.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodRune.java index 9b1cdf56..f7c7ab64 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodRune.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodRune.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModBlocks; 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; @@ -12,24 +13,24 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - -public class BloodRune extends Block -{ - //private Icon bloodRuneIcon; +public class BloodRune extends Block { + // private Icon bloodRuneIcon; @SideOnly(Side.CLIENT) private IIcon altarCapacityRuneIcon; + @SideOnly(Side.CLIENT) private IIcon dislocationRuneIcon; + @SideOnly(Side.CLIENT) private IIcon orbCapacityRuneIcon; + @SideOnly(Side.CLIENT) private IIcon betterCapacityRuneIcon; + @SideOnly(Side.CLIENT) private IIcon accelerationRuneIcon; - public BloodRune() - { + public BloodRune() { super(Material.iron); this.setBlockName("bloodRune"); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -39,8 +40,7 @@ public class BloodRune extends Block @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune"); this.altarCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AltarCapacityRune"); this.dislocationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:DislocationRune"); @@ -49,27 +49,25 @@ public class BloodRune extends Block this.accelerationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AccelerationRune"); } - public int getRuneEffect(int metaData) - { - switch (metaData) - { + public int getRuneEffect(int metaData) { + switch (metaData) { case 0: return 0; - case 1: //Altar Capacity rune + case 1: // Altar Capacity rune return 5; - case 2: //Filling/emptying rune + case 2: // Filling/emptying rune return 6; - case 3: //Orb Capacity rune + case 3: // Orb Capacity rune return 7; - case 4: //Better Capacity rune + case 4: // Better Capacity rune return 8; - - case 5: //Acceleration rune - return 9; + + case 5: // Acceleration rune + return 9; } return 0; @@ -80,28 +78,23 @@ public class BloodRune extends Block /** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) */ - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - if (this.equals(ModBlocks.bloodRune)) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + if (this.equals(ModBlocks.bloodRune)) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); par3List.add(new ItemStack(par1, 1, 2)); par3List.add(new ItemStack(par1, 1, 3)); par3List.add(new ItemStack(par1, 1, 4)); par3List.add(new ItemStack(par1, 1, 5)); - } else - { + } else { super.getSubBlocks(par1, 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 blockIcon; @@ -118,15 +111,14 @@ public class BloodRune extends Block return this.betterCapacityRuneIcon; case 5: - return this.accelerationRuneIcon; + return this.accelerationRuneIcon; default: return blockIcon; } } @Override - public int damageDropped(int metadata) - { + public int damageDropped(int metadata) { return metadata; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodStoneBrick.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodStoneBrick.java index 054cd8b8..29a9087b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodStoneBrick.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BloodStoneBrick.java @@ -7,10 +7,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -public class BloodStoneBrick extends Block -{ - public BloodStoneBrick() - { +public class BloodStoneBrick extends Block { + public BloodStoneBrick() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -20,8 +18,7 @@ public class BloodStoneBrick extends Block @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodStoneBrick"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/EfficiencyRune.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/EfficiencyRune.java index 6226b917..987dfd0a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/EfficiencyRune.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/EfficiencyRune.java @@ -5,10 +5,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class EfficiencyRune extends BloodRune -{ - public EfficiencyRune() - { +public class EfficiencyRune extends BloodRune { + public EfficiencyRune() { super(); this.setBlockName("efficiencyRune"); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -18,14 +16,12 @@ public class EfficiencyRune extends BloodRune @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EfficiencyRune"); } @Override - public int getRuneEffect(int metaData) - { + public int getRuneEffect(int metaData) { return 2; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/EmptySocket.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/EmptySocket.java index f6964f63..8d6d1a61 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/EmptySocket.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/EmptySocket.java @@ -7,10 +7,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -public class EmptySocket extends Block -{ - public EmptySocket() - { +public class EmptySocket extends Block { + public EmptySocket() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -19,15 +17,13 @@ public class EmptySocket extends Block } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EmptySocket"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/IOrientable.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/IOrientable.java index 7545d11c..9b4fe29a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/IOrientable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/IOrientable.java @@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.common.block; import net.minecraftforge.common.util.ForgeDirection; -public interface IOrientable -{ +public interface IOrientable { ForgeDirection getInputDirection(); ForgeDirection getOutputDirection(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java index f03c62b9..fea26ddc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java @@ -16,10 +16,8 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class ImperfectRitualStone extends Block -{ - public ImperfectRitualStone() - { +public class ImperfectRitualStone extends Block { + public ImperfectRitualStone() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -29,37 +27,31 @@ public class ImperfectRitualStone extends Block @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:ImperfectRitualStone"); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff) - { - if(SpellHelper.isFakePlayer(player)) - { - return false; - } + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff) { + if (SpellHelper.isFakePlayer(player)) { + return false; + } { Block block = world.getBlock(x, y + 1, z); - if (block == Blocks.water && !AlchemicalWizardry.ritualWeakDisabledThunderstorm) - { - if (!player.capabilities.isCreativeMode && !world.isRemote) - { + if (block == Blocks.water && !AlchemicalWizardry.ritualWeakDisabledThunderstorm) { + if (!player.capabilities.isCreativeMode && !world.isRemote) { EnergyItems.drainPlayerNetwork(player, AlchemicalWizardry.ritualWeakCostThunderstorm); } - if (!world.isRemote) - { + if (!world.isRemote) { world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); } world.getWorldInfo().setRaining(true); - if (world.isRemote) - { + if (world.isRemote) { world.setRainStrength(1.0F); world.setThunderStrength(1.0f); } @@ -68,8 +60,7 @@ public class ImperfectRitualStone extends Block world.getWorldInfo().setThundering(true); return true; } else if (block == Blocks.coal_block && !AlchemicalWizardry.ritualWeakDisabledZombie) { - if (!player.capabilities.isCreativeMode && !world.isRemote) - { + if (!player.capabilities.isCreativeMode && !world.isRemote) { EnergyItems.drainPlayerNetwork(player, AlchemicalWizardry.ritualWeakCostZombie); } @@ -79,34 +70,27 @@ public class ImperfectRitualStone extends Block zomb.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20000, 7)); zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3)); - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(zomb); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); } return true; - } else if (block == Blocks.lapis_block && !AlchemicalWizardry.ritualWeakDisabledNight) - { - if (!player.capabilities.isCreativeMode && !world.isRemote) - { + } else if (block == Blocks.lapis_block && !AlchemicalWizardry.ritualWeakDisabledNight) { + if (!player.capabilities.isCreativeMode && !world.isRemote) { EnergyItems.drainPlayerNetwork(player, AlchemicalWizardry.ritualWeakCostNight); } - if (!world.isRemote) - { + if (!world.isRemote) { world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); world.setWorldTime((world.getWorldTime() / 24000) * 24000 + 13800); } - } else if (block == Blocks.bedrock && !AlchemicalWizardry.ritualWeakDisabledResistance) - { - if (!player.capabilities.isCreativeMode && !world.isRemote) - { + } else if (block == Blocks.bedrock && !AlchemicalWizardry.ritualWeakDisabledResistance) { + if (!player.capabilities.isCreativeMode && !world.isRemote) { EnergyItems.drainPlayerNetwork(player, AlchemicalWizardry.ritualWeakCostResistance); } - if (!world.isRemote) - { + if (!world.isRemote) { world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/LargeBloodStoneBrick.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/LargeBloodStoneBrick.java index 623c2418..09186f55 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/LargeBloodStoneBrick.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/LargeBloodStoneBrick.java @@ -7,10 +7,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -public class LargeBloodStoneBrick extends Block -{ - public LargeBloodStoneBrick() - { +public class LargeBloodStoneBrick extends Block { + public LargeBloodStoneBrick() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -20,8 +18,7 @@ public class LargeBloodStoneBrick extends Block @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/LifeEssenceBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/LifeEssenceBlock.java index 79c6f8a4..7cbbc69c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/LifeEssenceBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/LifeEssenceBlock.java @@ -10,10 +10,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; -public class LifeEssenceBlock extends BlockFluidClassic -{ - public LifeEssenceBlock() - { +public class LifeEssenceBlock extends BlockFluidClassic { + public LifeEssenceBlock() { super(AlchemicalWizardry.lifeEssenceFluid, Material.water); AlchemicalWizardry.lifeEssenceFluid.setBlock(this); this.setBlockName("lifeEssenceFluidBlock"); @@ -21,29 +19,25 @@ public class LifeEssenceBlock extends BlockFluidClassic @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { return this.blockIcon; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:lifeEssenceStill"); AlchemicalWizardry.lifeEssenceFluid.setFlowingIcon(blockIcon); AlchemicalWizardry.lifeEssenceFluid.setStillIcon(blockIcon); } @Override - public boolean canDisplace(IBlockAccess world, int x, int y, int z) - { + public boolean canDisplace(IBlockAccess world, int x, int y, int z) { return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.canDisplace(world, x, y, z); } @Override - public boolean displaceIfPossible(World world, int x, int y, int z) - { + public boolean displaceIfPossible(World world, int x, int y, int z) { return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.displaceIfPossible(world, x, y, z); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/MimicBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/MimicBlock.java index 84dcdcb6..f5f6fc94 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/MimicBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/MimicBlock.java @@ -1,7 +1,9 @@ package WayofTime.alchemicalWizardry.common.block; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock; +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,118 +19,108 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class MimicBlock extends BlockContainer -{ - public MimicBlock() - { - super(Material.water); - setHardness(2.0F); +public class MimicBlock extends BlockContainer { + public MimicBlock() { + super(Material.water); + setHardness(2.0F); setResistance(5.0F); this.setBlockName("blockMimic"); -// this.setBlockBounds(0, 0, 0, 0, 0, 0); + // this.setBlockBounds(0, 0, 0, 0, 0, 0); } - - @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) - { - TileEntity TE = world.getTileEntity(x, y, z); - if(!(TE instanceof TEMimicBlock)) - { - return true; - } - TEMimicBlock mimic = (TEMimicBlock)TE; + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { + TileEntity TE = world.getTileEntity(x, y, z); + if (!(TE instanceof TEMimicBlock)) { + return true; + } + TEMimicBlock mimic = (TEMimicBlock) TE; Block block = mimic.getBlock(); - + return block == null || block.shouldSideBeRendered(world, x, y, z, side); - } - - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + } + + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { return 1; } - - @Override - public boolean canCollideCheck(int meta, boolean bool) - { + + @Override + public boolean canCollideCheck(int meta, boolean bool) { return meta == 1; } - - @SideOnly(Side.CLIENT) + + @SideOnly(Side.CLIENT) @Override /** * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side */ - public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) - { + public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { TileEntity TE = blockAccess.getTileEntity(x, y, z); - TEMimicBlock mimic = (TEMimicBlock)TE; + TEMimicBlock mimic = (TEMimicBlock) TE; Block block = mimic.getBlock(); int meta = mimic.getMetaOfMimic(); return block != null ? block.getIcon(side, meta) : this.blockIcon; } - - public boolean isOpaqueCube() - { + + public boolean isOpaqueCube() { return false; } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TEMimicBlock(); - } - - @Override - public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) - { - return false; - } - - @Override - public int quantityDropped(int meta, int fortune, Random random) - { - return 0; - } - - @Override - public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int meta) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TEMimicBlock) - { - Block block = ((TEMimicBlock) tile).getBlock(); - int mimicMeta = ((TEMimicBlock) tile).getMetaOfMimic(); - - if(block != null) - { - return block.isBlockSolid(world, x, y, z, mimicMeta); - } - } - return super.isBlockSolid(world, x, y, z, meta); - } - - @Override - public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) - { - TileEntity tile = world.getTileEntity(target.blockX, target.blockY, target.blockZ); - - TEMimicBlock TE = (TEMimicBlock)tile; + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TEMimicBlock(); + } - if (TE != null) - { + @Override + public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) { + return false; + } + + @Override + public int quantityDropped(int meta, int fortune, Random random) { + return 0; + } + + @Override + public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int meta) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof TEMimicBlock) { + Block block = ((TEMimicBlock) tile).getBlock(); + int mimicMeta = ((TEMimicBlock) tile).getMetaOfMimic(); + + if (block != null) { + return block.isBlockSolid(world, x, y, z, mimicMeta); + } + } + return super.isBlockSolid(world, x, y, z, meta); + } + + @Override + public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { + TileEntity tile = world.getTileEntity(target.blockX, target.blockY, target.blockZ); + + TEMimicBlock TE = (TEMimicBlock) tile; + + if (TE != null) { Block block = TE.getBlock(); - double xOffset = target.blockX + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinX(); - double yOffset = target.blockY + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinY(); - double zOffset = target.blockZ + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinZ(); + double xOffset = target.blockX + + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - 0.1F * 2.0F) + + 0.1F + + block.getBlockBoundsMinX(); + double yOffset = target.blockY + + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - 0.1F * 2.0F) + + 0.1F + + block.getBlockBoundsMinY(); + double zOffset = target.blockZ + + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - 0.1F * 2.0F) + + 0.1F + + block.getBlockBoundsMinZ(); switch (target.sideHit) { case 0: @@ -154,78 +146,76 @@ public class MimicBlock extends BlockContainer MimicBlock.addHitEffect(TE, target, xOffset, yOffset, zOffset, null, effectRenderer); return true; - } return super.addHitEffects(world, target, effectRenderer); } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { - TEMimicBlock tile = (TEMimicBlock)world.getTileEntity(x, y, z); - Block block = tile.getBlock(); - - return block != null ? block.getCollisionBoundingBoxFromPool(world, x, y, z) : super.getCollisionBoundingBoxFromPool(world, x, y, z); + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + TEMimicBlock tile = (TEMimicBlock) world.getTileEntity(x, y, z); + Block block = tile.getBlock(); + + return block != null + ? block.getCollisionBoundingBoxFromPool(world, x, y, z) + : super.getCollisionBoundingBoxFromPool(world, x, y, z); } - - @Override - @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) - { - TEMimicBlock TE = (TEMimicBlock)blockAccess.getTileEntity(x, y, z); - if (TE != null) - { + + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) { + TEMimicBlock TE = (TEMimicBlock) blockAccess.getTileEntity(x, y, z); + if (TE != null) { Block block = TE.getBlock(); - if(block != null) - { + if (block != null) { return block.colorMultiplier(blockAccess, x, y, z); } } return super.colorMultiplier(blockAccess, x, y, z); } - - @Override - public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec) - { - TEMimicBlock TE = (TEMimicBlock)world.getTileEntity(x, y, z); - if (TE != null) - { + + @Override + public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec) { + TEMimicBlock TE = (TEMimicBlock) world.getTileEntity(x, y, z); + if (TE != null) { Block block = TE.getBlock(); - if(block != null) - { - block.velocityToAddToEntity(world, x, y, z, entity, vec); + if (block != null) { + block.velocityToAddToEntity(world, x, y, z, entity, vec); } } - } - - public static void addHitEffect(TEMimicBlock TE, MovingObjectPosition target, double x, double y, double z, ItemStack itemStack, EffectRenderer effectRenderer) - { - EntityDiggingFX particle = new EntityDiggingFX(TE.getWorldObj(), x, y, z, 0.0D, 0.0D, 0.0D, TE.getBlock(), TE.getMetaOfMimic()); - effectRenderer.addEffect(particle.applyColourMultiplier(target.blockX, target.blockY, target.blockZ).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); - } - - @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) - { - TEMimicBlock TE = (TEMimicBlock)world.getTileEntity(x, y, z); - if (TE != null) - { - if(TE.getBlockEffectWhileInside(entity, x, y, z)) - { - return; - }else - { - Block block = TE.getBlock(); - if(block != null) - { - block.onEntityCollidedWithBlock(world, x, y, z, entity); - return; - } - } + } + + public static void addHitEffect( + TEMimicBlock TE, + MovingObjectPosition target, + double x, + double y, + double z, + ItemStack itemStack, + EffectRenderer effectRenderer) { + EntityDiggingFX particle = + new EntityDiggingFX(TE.getWorldObj(), x, y, z, 0.0D, 0.0D, 0.0D, TE.getBlock(), TE.getMetaOfMimic()); + effectRenderer.addEffect(particle.applyColourMultiplier(target.blockX, target.blockY, target.blockZ) + .multiplyVelocity(0.2F) + .multipleParticleScaleBy(0.6F)); + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + TEMimicBlock TE = (TEMimicBlock) world.getTileEntity(x, y, z); + if (TE != null) { + if (TE.getBlockEffectWhileInside(entity, x, y, z)) { + return; + } else { + Block block = TE.getBlock(); + if (block != null) { + block.onEntityCollidedWithBlock(world, x, y, z, entity); + return; + } + } } - super.onEntityCollidedWithBlock(world, x, y, z, entity); - } + super.onEntityCollidedWithBlock(world, x, y, z, entity); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/RitualStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/RitualStone.java index ae839bed..e54e75e0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/RitualStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/RitualStone.java @@ -14,25 +14,29 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class RitualStone extends Block implements IRitualStone -{ +public class RitualStone extends Block implements IRitualStone { @SideOnly(Side.CLIENT) private IIcon blankIcon; + @SideOnly(Side.CLIENT) private IIcon waterStoneIcon; + @SideOnly(Side.CLIENT) private IIcon fireStoneIcon; + @SideOnly(Side.CLIENT) private IIcon earthStoneIcon; + @SideOnly(Side.CLIENT) private IIcon airStoneIcon; + @SideOnly(Side.CLIENT) private IIcon duskStoneIcon; + @SideOnly(Side.CLIENT) private IIcon dawnStoneIcon; - public RitualStone() - { + public RitualStone() { super(Material.iron); setHardness(2.0F); setResistance(5.0F); @@ -42,8 +46,7 @@ public class RitualStone extends Block implements IRitualStone @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blankIcon = iconRegister.registerIcon("AlchemicalWizardry:RitualStone"); this.waterStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterRitualStone"); this.fireStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:FireRitualStone"); @@ -54,37 +57,32 @@ public class RitualStone extends Block implements IRitualStone } @Override - public int damageDropped(int metadata) - { + public int damageDropped(int metadata) { return 0; } @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) { ItemStack playerItem = player.getCurrentEquippedItem(); - if (playerItem == null) - { + if (playerItem == null) { return false; } Item item = playerItem.getItem(); - if (!(item instanceof ScribeTool)) - { + if (!(item instanceof ScribeTool)) { return false; } - if (playerItem.getMaxDamage() <= playerItem.getItemDamage() && !(playerItem.getMaxDamage() == 0)) - { + if (playerItem.getMaxDamage() <= playerItem.getItemDamage() && !(playerItem.getMaxDamage() == 0)) { return false; } ScribeTool scribeTool = (ScribeTool) item; - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { playerItem.setItemDamage(playerItem.getItemDamage() + 1); } @@ -95,10 +93,8 @@ public class RitualStone extends Block implements IRitualStone @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int metadata) - { - switch (metadata) - { + public IIcon getIcon(int side, int metadata) { + switch (metadata) { case 0: return blankIcon; @@ -116,18 +112,17 @@ public class RitualStone extends Block implements IRitualStone case 5: return duskStoneIcon; - + case 6: - return dawnStoneIcon; + return dawnStoneIcon; default: return blankIcon; } } - @Override - public boolean isRuneType(World world, int x, int y, int z, int meta, int runeType) - { - return meta == runeType; - } + @Override + public boolean isRuneType(World world, int x, int y, int z, int meta, int runeType) { + return meta == runeType; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSacrifice.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSacrifice.java index 2094e97a..c62c3d14 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSacrifice.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSacrifice.java @@ -5,10 +5,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class RuneOfSacrifice extends BloodRune -{ - public RuneOfSacrifice() - { +public class RuneOfSacrifice extends BloodRune { + public RuneOfSacrifice() { super(); this.setBlockName("runeOfSacrifice"); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -18,14 +16,12 @@ public class RuneOfSacrifice extends BloodRune @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSacrifice"); } @Override - public int getRuneEffect(int metaData) - { + public int getRuneEffect(int metaData) { return 3; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSelfSacrifice.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSelfSacrifice.java index 2c13ce41..294fb5a8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSelfSacrifice.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/RuneOfSelfSacrifice.java @@ -5,10 +5,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class RuneOfSelfSacrifice extends BloodRune -{ - public RuneOfSelfSacrifice() - { +public class RuneOfSelfSacrifice extends BloodRune { + public RuneOfSelfSacrifice() { super(); this.setBlockName("runeOfSelfSacrifice"); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -18,14 +16,12 @@ public class RuneOfSelfSacrifice extends BloodRune @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSelfSacrifice"); } @Override - public int getRuneEffect(int metaData) - { + public int getRuneEffect(int metaData) { return 4; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/SpectralBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/SpectralBlock.java index 9ff5313a..6f28074f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/SpectralBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/SpectralBlock.java @@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.block; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock; 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; @@ -15,87 +16,78 @@ import net.minecraft.util.Facing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - -public class SpectralBlock extends BlockContainer -{ - public SpectralBlock() - { +public class SpectralBlock extends BlockContainer { + public SpectralBlock() { super(Material.rock); this.setBlockName("spectralBlock"); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpectralBlock"); } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { Block d; return false; } @Override - public int quantityDropped(Random par1Random) - { + public int quantityDropped(Random par1Random) { return 0; } @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) - { + public boolean shouldSideBeRendered( + IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); - if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) - { + if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) + != p_149646_1_.getBlockMetadata( + p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], + p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], + p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) { return true; } - if (block == this) - { + if (block == this) { return false; } - return block != this && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); + return block != this + && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); } @SideOnly(Side.CLIENT) /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ - public int getRenderBlockPass() - { + public int getRenderBlockPass() { return 1; } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) - { - if (player.isSneaking()) - { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { + if (player.isSneaking()) { return false; } ItemStack playerItem = player.getCurrentEquippedItem(); - if (playerItem != null) - { - if (playerItem.getItem() instanceof ItemBlock) - { - world.setBlock(x, y, z, ((ItemBlock) (playerItem.getItem())).field_150939_a, playerItem.getItemDamage(), 3); + if (playerItem != null) { + if (playerItem.getItem() instanceof ItemBlock) { + world.setBlock( + x, y, z, ((ItemBlock) (playerItem.getItem())).field_150939_a, playerItem.getItemDamage(), 3); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { playerItem.stackSize--; } return true; - } else - { + } else { return false; } } @@ -104,8 +96,7 @@ public class SpectralBlock extends BlockContainer } @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) - { + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TESpectralBlock(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/SpeedRune.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/SpeedRune.java index ac628ad6..1e991c9d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/SpeedRune.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/SpeedRune.java @@ -5,10 +5,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class SpeedRune extends BloodRune -{ - public SpeedRune() - { +public class SpeedRune extends BloodRune { + public SpeedRune() { super(); this.setBlockName("speedRune"); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -18,14 +16,12 @@ public class SpeedRune extends BloodRune @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpeedRune"); } @Override - public int getRuneEffect(int metaData) - { + public int getRuneEffect(int metaData) { return 1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java index 4aeb4e75..d9fc5fc0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java @@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; import net.minecraft.block.Block; -public class AltarComponent -{ +public class AltarComponent { private int x; private int y; private int z; @@ -12,8 +11,7 @@ public class AltarComponent private boolean isBloodRune; private boolean isUpgradeSlot; - public AltarComponent(int x, int y, int z, Block block, int metadata, boolean isBloodRune, boolean isUpgradeSlot) - { + public AltarComponent(int x, int y, int z, Block block, int metadata, boolean isBloodRune, boolean isUpgradeSlot) { this.x = x; this.y = y; this.z = z; @@ -23,38 +21,31 @@ public class AltarComponent this.isUpgradeSlot = isUpgradeSlot; } - public int getX() - { + public int getX() { return x; } - public int getY() - { + public int getY() { return y; } - public int getZ() - { + public int getZ() { return z; } - public Block getBlock() - { + public Block getBlock() { return block; } - public int getMetadata() - { + public int getMetadata() { return metadata; } - public boolean isBloodRune() - { + public boolean isBloodRune() { return isBloodRune; } - public boolean isUpgradeSlot() - { + public boolean isUpgradeSlot() { return isUpgradeSlot; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarUpgradeComponent.java b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarUpgradeComponent.java index 9bf8496f..55dca380 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarUpgradeComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarUpgradeComponent.java @@ -1,7 +1,6 @@ package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; -public class AltarUpgradeComponent -{ +public class AltarUpgradeComponent { private int speedUpgrades; private int efficiencyUpgrades; private int sacrificeUpgrades; @@ -12,8 +11,7 @@ public class AltarUpgradeComponent private int betterCapacitiveUpgrades; private int accelerationUpgrades; - public AltarUpgradeComponent() - { + public AltarUpgradeComponent() { speedUpgrades = 0; efficiencyUpgrades = 0; sacrificeUpgrades = 0; @@ -25,93 +23,75 @@ public class AltarUpgradeComponent accelerationUpgrades = 0; } - public void addSpeedUpgrade() - { + public void addSpeedUpgrade() { speedUpgrades++; } - public void addEfficiencyUpgrade() - { + public void addEfficiencyUpgrade() { efficiencyUpgrades++; } - public void addSacrificeUpgrade() - { + public void addSacrificeUpgrade() { sacrificeUpgrades++; } - public void addSelfSacrificeUpgrade() - { + public void addSelfSacrificeUpgrade() { selfSacrificeUpgrades++; } - public void addDisplacementUpgrade() - { + public void addDisplacementUpgrade() { displacementUpgrades++; } - public void addaltarCapacitiveUpgrade() - { + public void addaltarCapacitiveUpgrade() { altarCapacitiveUpgrades++; } - public void addorbCapacitiveUpgrade() - { + public void addorbCapacitiveUpgrade() { orbCapacitiveUpgrades++; } - public void addBetterCapacitiveUpgrade() - { + public void addBetterCapacitiveUpgrade() { betterCapacitiveUpgrades++; } - - public void addAccelerationUpgrade() - { - accelerationUpgrades++; + + public void addAccelerationUpgrade() { + accelerationUpgrades++; } - public int getSpeedUpgrades() - { + public int getSpeedUpgrades() { return speedUpgrades; } - public int getEfficiencyUpgrades() - { + public int getEfficiencyUpgrades() { return efficiencyUpgrades; } - public int getSacrificeUpgrades() - { + public int getSacrificeUpgrades() { return sacrificeUpgrades; } - public int getSelfSacrificeUpgrades() - { + public int getSelfSacrificeUpgrades() { return selfSacrificeUpgrades; } - public int getDisplacementUpgrades() - { + public int getDisplacementUpgrades() { return displacementUpgrades; } - public int getAltarCapacitiveUpgrades() - { + public int getAltarCapacitiveUpgrades() { return this.altarCapacitiveUpgrades; } - public int getOrbCapacitiveUpgrades() - { + public int getOrbCapacitiveUpgrades() { return this.orbCapacitiveUpgrades; } - public int getBetterCapacitiveUpgrades() - { + public int getBetterCapacitiveUpgrades() { return this.betterCapacitiveUpgrades; } - - public int getAccelerationUpgrades() - { - return this.accelerationUpgrades; + + public int getAccelerationUpgrades() { + return this.accelerationUpgrades; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/CompatChecks.java b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/CompatChecks.java index d15b3fc7..1d40e218 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/CompatChecks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/CompatChecks.java @@ -8,15 +8,15 @@ import com.google.common.base.Strings; public class CompatChecks { public static boolean checkChiselBlock(BlockStack blockStack, String groupName) { - if (blockStack.getBlock() == null) - return false; + if (blockStack.getBlock() == null) return false; ICarvingGroup group = CarvingUtils.getChiselRegistry().getGroup(blockStack.getBlock(), blockStack.getMeta()); if (group != null) { - String check = CarvingUtils.getChiselRegistry().getGroup(blockStack.getBlock(), blockStack.getMeta()).getName(); + String check = CarvingUtils.getChiselRegistry() + .getGroup(blockStack.getBlock(), blockStack.getMeta()) + .getName(); - if (Strings.isNullOrEmpty(check)) - return false; + if (Strings.isNullOrEmpty(check)) return false; return check.equals(groupName); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java index 10439310..87427c1b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java @@ -1,17 +1,15 @@ package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.BlockStack; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class UpgradedAltars -{ +public class UpgradedAltars { public static List secondTierAltar = new ArrayList(); public static List thirdTierAltar = new ArrayList(); public static List fourthTierAltar = new ArrayList(); @@ -19,12 +17,9 @@ public class UpgradedAltars public static List sixthTierAltar = new ArrayList(); public static int highestAltar = 6; - public static int isAltarValid(World world, int x, int y, int z) - { - for (int i = highestAltar; i >= 2; i--) - { - if (checkAltarIsValid(world, x, y, z, i)) - { + public static int isAltarValid(World world, int x, int y, int z) { + for (int i = highestAltar; i >= 2; i--) { + if (checkAltarIsValid(world, x, y, z, i)) { return i; } } @@ -32,31 +27,24 @@ public class UpgradedAltars return 1; } - public static boolean checkAltarIsValid(World world, int x, int y, int z, int altarTier) - { - if (altarTier == 1) - { + public static boolean checkAltarIsValid(World world, int x, int y, int z, int altarTier) { + if (altarTier == 1) { return true; } List altarComponents = getAltarUpgradeListForTier(altarTier); - if (altarComponents == null) - { + if (altarComponents == null) { return false; } - for (AltarComponent ac : altarComponents) - { - if (!checkAltarComponent(ac, world, x, y, z, altarTier)) - { + for (AltarComponent ac : altarComponents) { + if (!checkAltarComponent(ac, world, x, y, z, altarTier)) { return false; } } return true; } - private static BlockStack[] getRuneOverrides(int altarTier) - { - switch (altarTier) - { + private static BlockStack[] getRuneOverrides(int altarTier) { + switch (altarTier) { case 2: return AlchemicalWizardry.secondTierRunes; case 3: @@ -71,58 +59,50 @@ public class UpgradedAltars return null; } } - private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z, int altarTier) - { + + private static boolean checkAltarComponent( + AltarComponent altarComponent, IBlockAccess world, int x, int y, int z, int altarTier) { Block block = world.getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); - int metadata = world.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); - if (altarComponent.isBloodRune()) - { + int metadata = + world.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); + if (altarComponent.isBloodRune()) { boolean result = false; BlockStack[] runes = getRuneOverrides(altarTier); - if (runes == null) - { + if (runes == null) { return false; } - for (BlockStack rune : runes) - { - result |= altarComponent.isUpgradeSlot() ? - block == rune.getBlock() && metadata == rune.getMeta() : - block == altarComponent.getBlock() && metadata == altarComponent.getMetadata(); + for (BlockStack rune : runes) { + result |= altarComponent.isUpgradeSlot() + ? block == rune.getBlock() && metadata == rune.getMeta() + : block == altarComponent.getBlock() && metadata == altarComponent.getMetadata(); } return result; - } - else - { - if (altarComponent.getBlock() != block || altarComponent.getMetadata() != metadata) - { + } else { + if (altarComponent.getBlock() != block || altarComponent.getMetadata() != metadata) { return false; } } return true; } - public static AltarUpgradeComponent getUpgrades(World world, int x, int y, int z, int altarTier) - { - if(world.isRemote) - { - return null; - } + public static AltarUpgradeComponent getUpgrades(World world, int x, int y, int z, int altarTier) { + if (world.isRemote) { + return null; + } AltarUpgradeComponent upgrades = new AltarUpgradeComponent(); List list = UpgradedAltars.getAltarUpgradeListForTier(altarTier); BlockStack[] runes = getRuneOverrides(altarTier); - if (list == null || runes == null) - { + if (list == null || runes == null) { return upgrades; } - for (AltarComponent altarComponent : list) - { - if (altarComponent.isUpgradeSlot()) - { - Block block = world.getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); - int metadata = world.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); + for (AltarComponent altarComponent : list) { + if (altarComponent.isUpgradeSlot()) { + Block block = + world.getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); + int metadata = world.getBlockMetadata( + x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); BlockStack blockStack = new BlockStack(block, metadata); - switch (Arrays.asList(runes).indexOf(blockStack)) - { + switch (Arrays.asList(runes).indexOf(blockStack)) { case 1: upgrades.addSpeedUpgrade(); break; @@ -164,105 +144,544 @@ public class UpgradedAltars return upgrades; } - public static void loadAltars() - { - secondTierAltar.add(new AltarComponent(-1, -1, -1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, false)); - secondTierAltar.add(new AltarComponent(0, -1, -1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - secondTierAltar.add(new AltarComponent(1, -1, -1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, false)); - secondTierAltar.add(new AltarComponent(-1, -1, 0, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - secondTierAltar.add(new AltarComponent(1, -1, 0, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - secondTierAltar.add(new AltarComponent(-1, -1, 1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, false)); - secondTierAltar.add(new AltarComponent(0, -1, 1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - secondTierAltar.add(new AltarComponent(1, -1, 1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, false)); + public static void loadAltars() { + secondTierAltar.add(new AltarComponent( + -1, + -1, + -1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + false)); + secondTierAltar.add(new AltarComponent( + 0, + -1, + -1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + secondTierAltar.add(new AltarComponent( + 1, + -1, + -1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + false)); + secondTierAltar.add(new AltarComponent( + -1, + -1, + 0, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + secondTierAltar.add(new AltarComponent( + 1, + -1, + 0, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + secondTierAltar.add(new AltarComponent( + -1, + -1, + 1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + false)); + secondTierAltar.add(new AltarComponent( + 0, + -1, + 1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + secondTierAltar.add(new AltarComponent( + 1, + -1, + 1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + false)); - thirdTierAltar.add(new AltarComponent(-1, -1, -1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(0, -1, -1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(1, -1, -1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(-1, -1, 0, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(1, -1, 0, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(-1, -1, 1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(0, -1, 1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(1, -1, 1, AlchemicalWizardry.secondTierRunes[0].getBlock(), AlchemicalWizardry.secondTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(-3, -1, -3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(-3, 0, -3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(3, -1, -3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(3, 0, -3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(-3, -1, 3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(-3, 0, 3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(3, -1, 3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(3, 0, 3, AlchemicalWizardry.specialAltarBlock[0].getBlock(), AlchemicalWizardry.specialAltarBlock[0].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(-3, 1, -3, AlchemicalWizardry.specialAltarBlock[1].getBlock(), AlchemicalWizardry.specialAltarBlock[1].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(3, 1, -3, AlchemicalWizardry.specialAltarBlock[1].getBlock(), AlchemicalWizardry.specialAltarBlock[1].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(-3, 1, 3, AlchemicalWizardry.specialAltarBlock[1].getBlock(), AlchemicalWizardry.specialAltarBlock[1].getMeta(), false, false)); - thirdTierAltar.add(new AltarComponent(3, 1, 3, AlchemicalWizardry.specialAltarBlock[1].getBlock(), AlchemicalWizardry.specialAltarBlock[1].getMeta(), false, false)); + thirdTierAltar.add(new AltarComponent( + -1, + -1, + -1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + 0, + -1, + -1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + 1, + -1, + -1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + -1, + -1, + 0, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + 1, + -1, + 0, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + -1, + -1, + 1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + 0, + -1, + 1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + 1, + -1, + 1, + AlchemicalWizardry.secondTierRunes[0].getBlock(), + AlchemicalWizardry.secondTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + -3, + -1, + -3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + -3, + 0, + -3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + 3, + -1, + -3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + 3, + 0, + -3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + -3, + -1, + 3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + -3, + 0, + 3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + 3, + -1, + 3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + 3, + 0, + 3, + AlchemicalWizardry.specialAltarBlock[0].getBlock(), + AlchemicalWizardry.specialAltarBlock[0].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + -3, + 1, + -3, + AlchemicalWizardry.specialAltarBlock[1].getBlock(), + AlchemicalWizardry.specialAltarBlock[1].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + 3, + 1, + -3, + AlchemicalWizardry.specialAltarBlock[1].getBlock(), + AlchemicalWizardry.specialAltarBlock[1].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + -3, + 1, + 3, + AlchemicalWizardry.specialAltarBlock[1].getBlock(), + AlchemicalWizardry.specialAltarBlock[1].getMeta(), + false, + false)); + thirdTierAltar.add(new AltarComponent( + 3, + 1, + 3, + AlchemicalWizardry.specialAltarBlock[1].getBlock(), + AlchemicalWizardry.specialAltarBlock[1].getMeta(), + false, + false)); - for (int i = -2; i <= 2; i++) - { - thirdTierAltar.add(new AltarComponent(3, -2, i, AlchemicalWizardry.thirdTierRunes[0].getBlock(), AlchemicalWizardry.thirdTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(-3, -2, i, AlchemicalWizardry.thirdTierRunes[0].getBlock(), AlchemicalWizardry.thirdTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(i, -2, 3, AlchemicalWizardry.thirdTierRunes[0].getBlock(), AlchemicalWizardry.thirdTierRunes[0].getMeta(), true, true)); - thirdTierAltar.add(new AltarComponent(i, -2, -3, AlchemicalWizardry.thirdTierRunes[0].getBlock(), AlchemicalWizardry.thirdTierRunes[0].getMeta(), true, true)); + for (int i = -2; i <= 2; i++) { + thirdTierAltar.add(new AltarComponent( + 3, + -2, + i, + AlchemicalWizardry.thirdTierRunes[0].getBlock(), + AlchemicalWizardry.thirdTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + -3, + -2, + i, + AlchemicalWizardry.thirdTierRunes[0].getBlock(), + AlchemicalWizardry.thirdTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + i, + -2, + 3, + AlchemicalWizardry.thirdTierRunes[0].getBlock(), + AlchemicalWizardry.thirdTierRunes[0].getMeta(), + true, + true)); + thirdTierAltar.add(new AltarComponent( + i, + -2, + -3, + AlchemicalWizardry.thirdTierRunes[0].getBlock(), + AlchemicalWizardry.thirdTierRunes[0].getMeta(), + true, + true)); } fourthTierAltar.addAll(thirdTierAltar); - for (int i = -3; i <= 3; i++) - { - fourthTierAltar.add(new AltarComponent(5, -3, i, AlchemicalWizardry.fourthTierRunes[0].getBlock(), AlchemicalWizardry.fourthTierRunes[0].getMeta(), true, true)); - fourthTierAltar.add(new AltarComponent(-5, -3, i, AlchemicalWizardry.fourthTierRunes[0].getBlock(), AlchemicalWizardry.fourthTierRunes[0].getMeta(), true, true)); - fourthTierAltar.add(new AltarComponent(i, -3, 5, AlchemicalWizardry.fourthTierRunes[0].getBlock(), AlchemicalWizardry.fourthTierRunes[0].getMeta(), true, true)); - fourthTierAltar.add(new AltarComponent(i, -3, -5, AlchemicalWizardry.fourthTierRunes[0].getBlock(), AlchemicalWizardry.fourthTierRunes[0].getMeta(), true, true)); + for (int i = -3; i <= 3; i++) { + fourthTierAltar.add(new AltarComponent( + 5, + -3, + i, + AlchemicalWizardry.fourthTierRunes[0].getBlock(), + AlchemicalWizardry.fourthTierRunes[0].getMeta(), + true, + true)); + fourthTierAltar.add(new AltarComponent( + -5, + -3, + i, + AlchemicalWizardry.fourthTierRunes[0].getBlock(), + AlchemicalWizardry.fourthTierRunes[0].getMeta(), + true, + true)); + fourthTierAltar.add(new AltarComponent( + i, + -3, + 5, + AlchemicalWizardry.fourthTierRunes[0].getBlock(), + AlchemicalWizardry.fourthTierRunes[0].getMeta(), + true, + true)); + fourthTierAltar.add(new AltarComponent( + i, + -3, + -5, + AlchemicalWizardry.fourthTierRunes[0].getBlock(), + AlchemicalWizardry.fourthTierRunes[0].getMeta(), + true, + true)); } - for (int i = -2; i <= 1; i++) - { - fourthTierAltar.add(new AltarComponent(5, i, 5, AlchemicalWizardry.specialAltarBlock[2].getBlock(), AlchemicalWizardry.specialAltarBlock[2].getMeta(), false, false)); - fourthTierAltar.add(new AltarComponent(5, i, -5, AlchemicalWizardry.specialAltarBlock[2].getBlock(), AlchemicalWizardry.specialAltarBlock[2].getMeta(), false, false)); - fourthTierAltar.add(new AltarComponent(-5, i, -5, AlchemicalWizardry.specialAltarBlock[2].getBlock(), AlchemicalWizardry.specialAltarBlock[2].getMeta(), false, false)); - fourthTierAltar.add(new AltarComponent(-5, i, 5, AlchemicalWizardry.specialAltarBlock[2].getBlock(), AlchemicalWizardry.specialAltarBlock[2].getMeta(), false, false)); + for (int i = -2; i <= 1; i++) { + fourthTierAltar.add(new AltarComponent( + 5, + i, + 5, + AlchemicalWizardry.specialAltarBlock[2].getBlock(), + AlchemicalWizardry.specialAltarBlock[2].getMeta(), + false, + false)); + fourthTierAltar.add(new AltarComponent( + 5, + i, + -5, + AlchemicalWizardry.specialAltarBlock[2].getBlock(), + AlchemicalWizardry.specialAltarBlock[2].getMeta(), + false, + false)); + fourthTierAltar.add(new AltarComponent( + -5, + i, + -5, + AlchemicalWizardry.specialAltarBlock[2].getBlock(), + AlchemicalWizardry.specialAltarBlock[2].getMeta(), + false, + false)); + fourthTierAltar.add(new AltarComponent( + -5, + i, + 5, + AlchemicalWizardry.specialAltarBlock[2].getBlock(), + AlchemicalWizardry.specialAltarBlock[2].getMeta(), + false, + false)); } - fourthTierAltar.add(new AltarComponent(5, 2, 5, AlchemicalWizardry.specialAltarBlock[3].getBlock(), AlchemicalWizardry.specialAltarBlock[3].getMeta(), false, false)); - fourthTierAltar.add(new AltarComponent(5, 2, -5, AlchemicalWizardry.specialAltarBlock[3].getBlock(), AlchemicalWizardry.specialAltarBlock[3].getMeta(), false, false)); - fourthTierAltar.add(new AltarComponent(-5, 2, -5, AlchemicalWizardry.specialAltarBlock[3].getBlock(), AlchemicalWizardry.specialAltarBlock[3].getMeta(), false, false)); - fourthTierAltar.add(new AltarComponent(-5, 2, 5, AlchemicalWizardry.specialAltarBlock[3].getBlock(), AlchemicalWizardry.specialAltarBlock[3].getMeta(), false, false)); + fourthTierAltar.add(new AltarComponent( + 5, + 2, + 5, + AlchemicalWizardry.specialAltarBlock[3].getBlock(), + AlchemicalWizardry.specialAltarBlock[3].getMeta(), + false, + false)); + fourthTierAltar.add(new AltarComponent( + 5, + 2, + -5, + AlchemicalWizardry.specialAltarBlock[3].getBlock(), + AlchemicalWizardry.specialAltarBlock[3].getMeta(), + false, + false)); + fourthTierAltar.add(new AltarComponent( + -5, + 2, + -5, + AlchemicalWizardry.specialAltarBlock[3].getBlock(), + AlchemicalWizardry.specialAltarBlock[3].getMeta(), + false, + false)); + fourthTierAltar.add(new AltarComponent( + -5, + 2, + 5, + AlchemicalWizardry.specialAltarBlock[3].getBlock(), + AlchemicalWizardry.specialAltarBlock[3].getMeta(), + false, + false)); fifthTierAltar.addAll(fourthTierAltar); - fifthTierAltar.add(new AltarComponent(-8, -3, 8, AlchemicalWizardry.specialAltarBlock[4].getBlock(), AlchemicalWizardry.specialAltarBlock[4].getMeta(), false, false)); - fifthTierAltar.add(new AltarComponent(-8, -3, -8, AlchemicalWizardry.specialAltarBlock[4].getBlock(), AlchemicalWizardry.specialAltarBlock[4].getMeta(), false, false)); - fifthTierAltar.add(new AltarComponent(8, -3, -8, AlchemicalWizardry.specialAltarBlock[4].getBlock(), AlchemicalWizardry.specialAltarBlock[4].getMeta(), false, false)); - fifthTierAltar.add(new AltarComponent(8, -3, 8, AlchemicalWizardry.specialAltarBlock[4].getBlock(), AlchemicalWizardry.specialAltarBlock[4].getMeta(), false, false)); - for (int i = -6; i <= 6; i++) - { - fifthTierAltar.add(new AltarComponent(8, -4, i, AlchemicalWizardry.fifthTierRunes[0].getBlock(), AlchemicalWizardry.fifthTierRunes[0].getMeta(), true, true)); - fifthTierAltar.add(new AltarComponent(-8, -4, i, AlchemicalWizardry.fifthTierRunes[0].getBlock(), AlchemicalWizardry.fifthTierRunes[0].getMeta(), true, true)); - fifthTierAltar.add(new AltarComponent(i, -4, 8, AlchemicalWizardry.fifthTierRunes[0].getBlock(), AlchemicalWizardry.fifthTierRunes[0].getMeta(), true, true)); - fifthTierAltar.add(new AltarComponent(i, -4, -8, AlchemicalWizardry.fifthTierRunes[0].getBlock(), AlchemicalWizardry.fifthTierRunes[0].getMeta(), true, true)); + fifthTierAltar.add(new AltarComponent( + -8, + -3, + 8, + AlchemicalWizardry.specialAltarBlock[4].getBlock(), + AlchemicalWizardry.specialAltarBlock[4].getMeta(), + false, + false)); + fifthTierAltar.add(new AltarComponent( + -8, + -3, + -8, + AlchemicalWizardry.specialAltarBlock[4].getBlock(), + AlchemicalWizardry.specialAltarBlock[4].getMeta(), + false, + false)); + fifthTierAltar.add(new AltarComponent( + 8, + -3, + -8, + AlchemicalWizardry.specialAltarBlock[4].getBlock(), + AlchemicalWizardry.specialAltarBlock[4].getMeta(), + false, + false)); + fifthTierAltar.add(new AltarComponent( + 8, + -3, + 8, + AlchemicalWizardry.specialAltarBlock[4].getBlock(), + AlchemicalWizardry.specialAltarBlock[4].getMeta(), + false, + false)); + for (int i = -6; i <= 6; i++) { + fifthTierAltar.add(new AltarComponent( + 8, + -4, + i, + AlchemicalWizardry.fifthTierRunes[0].getBlock(), + AlchemicalWizardry.fifthTierRunes[0].getMeta(), + true, + true)); + fifthTierAltar.add(new AltarComponent( + -8, + -4, + i, + AlchemicalWizardry.fifthTierRunes[0].getBlock(), + AlchemicalWizardry.fifthTierRunes[0].getMeta(), + true, + true)); + fifthTierAltar.add(new AltarComponent( + i, + -4, + 8, + AlchemicalWizardry.fifthTierRunes[0].getBlock(), + AlchemicalWizardry.fifthTierRunes[0].getMeta(), + true, + true)); + fifthTierAltar.add(new AltarComponent( + i, + -4, + -8, + AlchemicalWizardry.fifthTierRunes[0].getBlock(), + AlchemicalWizardry.fifthTierRunes[0].getMeta(), + true, + true)); } sixthTierAltar.addAll(fifthTierAltar); - for (int i = -4; i <= 2; i++) - { - sixthTierAltar.add(new AltarComponent(11, i, 11, AlchemicalWizardry.specialAltarBlock[5].getBlock(), AlchemicalWizardry.specialAltarBlock[5].getMeta(), false, false)); - sixthTierAltar.add(new AltarComponent(-11, i, -11, AlchemicalWizardry.specialAltarBlock[5].getBlock(), AlchemicalWizardry.specialAltarBlock[5].getMeta(), false, false)); - sixthTierAltar.add(new AltarComponent(11, i, -11, AlchemicalWizardry.specialAltarBlock[5].getBlock(), AlchemicalWizardry.specialAltarBlock[5].getMeta(), false, false)); - sixthTierAltar.add(new AltarComponent(-11, i, 11, AlchemicalWizardry.specialAltarBlock[5].getBlock(), AlchemicalWizardry.specialAltarBlock[5].getMeta(), false, false)); + for (int i = -4; i <= 2; i++) { + sixthTierAltar.add(new AltarComponent( + 11, + i, + 11, + AlchemicalWizardry.specialAltarBlock[5].getBlock(), + AlchemicalWizardry.specialAltarBlock[5].getMeta(), + false, + false)); + sixthTierAltar.add(new AltarComponent( + -11, + i, + -11, + AlchemicalWizardry.specialAltarBlock[5].getBlock(), + AlchemicalWizardry.specialAltarBlock[5].getMeta(), + false, + false)); + sixthTierAltar.add(new AltarComponent( + 11, + i, + -11, + AlchemicalWizardry.specialAltarBlock[5].getBlock(), + AlchemicalWizardry.specialAltarBlock[5].getMeta(), + false, + false)); + sixthTierAltar.add(new AltarComponent( + -11, + i, + 11, + AlchemicalWizardry.specialAltarBlock[5].getBlock(), + AlchemicalWizardry.specialAltarBlock[5].getMeta(), + false, + false)); } - sixthTierAltar.add(new AltarComponent(11, 3, 11, AlchemicalWizardry.specialAltarBlock[6].getBlock(), AlchemicalWizardry.specialAltarBlock[6].getMeta(), false, false)); - sixthTierAltar.add(new AltarComponent(-11, 3, -11, AlchemicalWizardry.specialAltarBlock[6].getBlock(), AlchemicalWizardry.specialAltarBlock[6].getMeta(), false, false)); - sixthTierAltar.add(new AltarComponent(11, 3, -11, AlchemicalWizardry.specialAltarBlock[6].getBlock(), AlchemicalWizardry.specialAltarBlock[6].getMeta(), false, false)); - sixthTierAltar.add(new AltarComponent(-11, 3, 11, AlchemicalWizardry.specialAltarBlock[6].getBlock(), AlchemicalWizardry.specialAltarBlock[6].getMeta(), false, false)); - for (int i = -9; i <= 9; i++) - { - sixthTierAltar.add(new AltarComponent(11, -5, i, AlchemicalWizardry.sixthTierRunes[0].getBlock(), AlchemicalWizardry.sixthTierRunes[0].getMeta(), true, true)); - sixthTierAltar.add(new AltarComponent(-11, -5, i, AlchemicalWizardry.sixthTierRunes[0].getBlock(), AlchemicalWizardry.sixthTierRunes[0].getMeta(), true, true)); - sixthTierAltar.add(new AltarComponent(i, -5, 11, AlchemicalWizardry.sixthTierRunes[0].getBlock(), AlchemicalWizardry.sixthTierRunes[0].getMeta(), true, true)); - sixthTierAltar.add(new AltarComponent(i, -5, -11, AlchemicalWizardry.sixthTierRunes[0].getBlock(), AlchemicalWizardry.sixthTierRunes[0].getMeta(), true, true)); + sixthTierAltar.add(new AltarComponent( + 11, + 3, + 11, + AlchemicalWizardry.specialAltarBlock[6].getBlock(), + AlchemicalWizardry.specialAltarBlock[6].getMeta(), + false, + false)); + sixthTierAltar.add(new AltarComponent( + -11, + 3, + -11, + AlchemicalWizardry.specialAltarBlock[6].getBlock(), + AlchemicalWizardry.specialAltarBlock[6].getMeta(), + false, + false)); + sixthTierAltar.add(new AltarComponent( + 11, + 3, + -11, + AlchemicalWizardry.specialAltarBlock[6].getBlock(), + AlchemicalWizardry.specialAltarBlock[6].getMeta(), + false, + false)); + sixthTierAltar.add(new AltarComponent( + -11, + 3, + 11, + AlchemicalWizardry.specialAltarBlock[6].getBlock(), + AlchemicalWizardry.specialAltarBlock[6].getMeta(), + false, + false)); + for (int i = -9; i <= 9; i++) { + sixthTierAltar.add(new AltarComponent( + 11, + -5, + i, + AlchemicalWizardry.sixthTierRunes[0].getBlock(), + AlchemicalWizardry.sixthTierRunes[0].getMeta(), + true, + true)); + sixthTierAltar.add(new AltarComponent( + -11, + -5, + i, + AlchemicalWizardry.sixthTierRunes[0].getBlock(), + AlchemicalWizardry.sixthTierRunes[0].getMeta(), + true, + true)); + sixthTierAltar.add(new AltarComponent( + i, + -5, + 11, + AlchemicalWizardry.sixthTierRunes[0].getBlock(), + AlchemicalWizardry.sixthTierRunes[0].getMeta(), + true, + true)); + sixthTierAltar.add(new AltarComponent( + i, + -5, + -11, + AlchemicalWizardry.sixthTierRunes[0].getBlock(), + AlchemicalWizardry.sixthTierRunes[0].getMeta(), + true, + true)); } } - public static List getAltarUpgradeListForTier(int tier) - { - switch (tier) - { + public static List getAltarUpgradeListForTier(int tier) { + switch (tier) { case 2: return secondTierAltar; @@ -276,7 +695,7 @@ public class UpgradedAltars return fifthTierAltar; case 6: - return sixthTierAltar; + return sixthTierAltar; } return null; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java b/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java index 39204a70..3e7f89f6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java @@ -1,13 +1,5 @@ package WayofTime.alchemicalWizardry.common.book; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModItems; @@ -25,354 +17,431 @@ import amerifrance.guideapi.categories.CategoryItemStack; import amerifrance.guideapi.entries.EntryUniText; import amerifrance.guideapi.pages.PageIRecipe; import amerifrance.guideapi.pages.PageUnlocImage; +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; -public class BloodMagicGuide -{ - public static Book bloodMagicGuide; - public static List categories = new ArrayList(); - - public static void registerGuide() - { - registerArchitectBook(); - registerRitualBook(); - registerDemonBook(); - registerSpellBook(); - registerAlchemyBook(); - - BookBuilder bmBookBuilder = new BookBuilder(); - bmBookBuilder.setCategories(categories).setUnlocBookTitle("guide.BloodMagic.book.title").setUnlocWelcomeMessage("guide.BloodMagic.welcomeMessage").setUnlocDisplayName("guide.BloodMagic.book.name").setBookColor(new Color(190, 10, 0)).setAuthor("-Blood Magic"); - -// bloodMagicGuide = new Book(categories, "guide.BloodMagic.book.title", "guide.BloodMagic.welcomeMessage", "guide.BloodMagic.book.name", new Color(190, 10, 0)); - bloodMagicGuide = bmBookBuilder.build(); +public class BloodMagicGuide { + public static Book bloodMagicGuide; + public static List categories = new ArrayList(); + + public static void registerGuide() { + registerArchitectBook(); + registerRitualBook(); + registerDemonBook(); + registerSpellBook(); + registerAlchemyBook(); + + BookBuilder bmBookBuilder = new BookBuilder(); + bmBookBuilder + .setCategories(categories) + .setUnlocBookTitle("guide.BloodMagic.book.title") + .setUnlocWelcomeMessage("guide.BloodMagic.welcomeMessage") + .setUnlocDisplayName("guide.BloodMagic.book.name") + .setBookColor(new Color(190, 10, 0)) + .setAuthor("-Blood Magic"); + + // bloodMagicGuide = new Book(categories, "guide.BloodMagic.book.title", "guide.BloodMagic.welcomeMessage", + // "guide.BloodMagic.book.name", new Color(190, 10, 0)); + bloodMagicGuide = bmBookBuilder.build(); GuideRegistry.registerBook(bloodMagicGuide); - } - - public static PageIRecipe getOrbPageForRecipe(IRecipe recipe) - { - return new PageIRecipe(recipe, new OrbRecipeRenderer(recipe)); - } - - public static void registerArchitectBook() - { - List entries = new ArrayList(); + } - ArrayList introPages = new ArrayList(); + public static PageIRecipe getOrbPageForRecipe(IRecipe recipe) { + return new PageIRecipe(recipe, new OrbRecipeRenderer(recipe)); + } + + public static void registerArchitectBook() { + List entries = new ArrayList(); + + ArrayList introPages = new ArrayList(); introPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.intro"))); entries.add(new EntryUniText(introPages, "guide.BloodMagic.entryName.architect.intro")); - - ArrayList bloodAltarPages = new ArrayList(); - bloodAltarPages.add(new PageIRecipe(RecipeHolder.bloodAltarRecipe)); - bloodAltarPages.add(new PageIRecipe(RecipeHolder.knifeRecipe)); - bloodAltarPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodAltar.1"))); - bloodAltarPages.add(new PageAltarRecipe(RecipeHolder.weakBloodOrbRecipe)); - bloodAltarPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodAltar.2"))); - entries.add(new EntryUniText(bloodAltarPages, "guide.BloodMagic.entryName.architect.bloodAltar")); - - ArrayList soulNetworkPages = new ArrayList(); - soulNetworkPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.soulNetwork"))); - entries.add(new EntryUniText(soulNetworkPages, "guide.BloodMagic.entryName.architect.soulNetwork")); - - ArrayList blankSlatePages = new ArrayList(); - blankSlatePages.add(new PageAltarRecipe(RecipeHolder.blankSlateRecipe)); - blankSlatePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.blankSlate"))); - entries.add(new EntryUniText(blankSlatePages, "guide.BloodMagic.entryName.architect.blankSlate")); - - ArrayList divinationSigilPages = new ArrayList(); - divinationSigilPages.add(getOrbPageForRecipe(RecipeHolder.divinationSigilRecipe)); - divinationSigilPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.divination"))); - entries.add(new EntryUniText(divinationSigilPages, "guide.BloodMagic.entryName.architect.divination")); - ArrayList waterSigilPages = new ArrayList(); - waterSigilPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.waterSigil.1"))); - waterSigilPages.add(getOrbPageForRecipe(RecipeHolder.waterSigilRecipe)); - waterSigilPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.waterSigil.2"))); - entries.add(new EntryUniText(waterSigilPages, "guide.BloodMagic.entryName.architect.waterSigil")); - - ArrayList lavaCrystalPages = new ArrayList(); - lavaCrystalPages.add(getOrbPageForRecipe(RecipeHolder.lavaCrystalRecipe)); - lavaCrystalPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.lavaCrystal"))); - entries.add(new EntryUniText(lavaCrystalPages, "guide.BloodMagic.entryName.architect.lavaCrystal")); - - ArrayList hellHarvestPages = new ArrayList(); - hellHarvestPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.hellHarvest"))); - entries.add(new EntryUniText(hellHarvestPages, "guide.BloodMagic.entryName.architect.hellHarvest")); - - ArrayList lavaSigilPages = new ArrayList(); - lavaSigilPages.add(new PageIRecipe(RecipeHolder.lavaSigilRecipe)); - lavaSigilPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.lavaSigil"))); - entries.add(new EntryUniText(lavaSigilPages, "guide.BloodMagic.entryName.architect.lavaSigil")); + ArrayList bloodAltarPages = new ArrayList(); + bloodAltarPages.add(new PageIRecipe(RecipeHolder.bloodAltarRecipe)); + bloodAltarPages.add(new PageIRecipe(RecipeHolder.knifeRecipe)); + bloodAltarPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodAltar.1"))); + bloodAltarPages.add(new PageAltarRecipe(RecipeHolder.weakBloodOrbRecipe)); + bloodAltarPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodAltar.2"))); + entries.add(new EntryUniText(bloodAltarPages, "guide.BloodMagic.entryName.architect.bloodAltar")); - ArrayList blankRunePages = new ArrayList(); - blankRunePages.add(getOrbPageForRecipe(RecipeHolder.blankRuneRecipe)); - blankRunePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.blankRunes.1"))); - blankRunePages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T2.png"), true)); - blankRunePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.blankRunes.2"))); - entries.add(new EntryUniText(blankRunePages, "guide.BloodMagic.entryName.architect.blankRunes")); - - ArrayList speedRunePages = new ArrayList(); - speedRunePages.add(new PageIRecipe(RecipeHolder.speedRuneRecipe)); - speedRunePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.speedRunes"))); - entries.add(new EntryUniText(speedRunePages, "guide.BloodMagic.entryName.architect.speedRunes")); - - ArrayList apprenticeOrbPages = new ArrayList(); - apprenticeOrbPages.add(new PageAltarRecipe(RecipeHolder.apprenticeBloodOrbRecipe)); - apprenticeOrbPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.apprenticeOrb"))); - entries.add(new EntryUniText(apprenticeOrbPages, "guide.BloodMagic.entryName.architect.apprenticeOrb")); - - ArrayList voidSigilPages = new ArrayList(); - voidSigilPages.add(getOrbPageForRecipe(RecipeHolder.voidSigilRecipe)); - voidSigilPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.voidSigil"))); - entries.add(new EntryUniText(voidSigilPages, "guide.BloodMagic.entryName.architect.voidSigil")); - - ArrayList airSigilPages = new ArrayList(); - airSigilPages.add(getOrbPageForRecipe(RecipeHolder.airSigilRecipe)); - airSigilPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.airSigil"))); - entries.add(new EntryUniText(airSigilPages, "guide.BloodMagic.entryName.architect.airSigil")); - - ArrayList sightSigilPages = new ArrayList(); - sightSigilPages.add(getOrbPageForRecipe(RecipeHolder.sightSigilRecipe)); - sightSigilPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.sightSigil"))); - entries.add(new EntryUniText(sightSigilPages, "guide.BloodMagic.entryName.architect.sightSigil")); - - ArrayList advancedAltarPages = new ArrayList(); - advancedAltarPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.advancedAltar"))); - entries.add(new EntryUniText(advancedAltarPages, "guide.BloodMagic.entryName.architect.advancedAltar")); + ArrayList soulNetworkPages = new ArrayList(); + soulNetworkPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.soulNetwork"))); + entries.add(new EntryUniText(soulNetworkPages, "guide.BloodMagic.entryName.architect.soulNetwork")); - ArrayList fastMinerPages = new ArrayList(); - fastMinerPages.add(getOrbPageForRecipe(RecipeHolder.fastMinerRecipe)); - fastMinerPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fastMiner"))); - entries.add(new EntryUniText(fastMinerPages, "guide.BloodMagic.entryName.architect.fastMiner")); - - ArrayList soulFrayPages = new ArrayList(); - soulFrayPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.soulFray"))); - entries.add(new EntryUniText(soulFrayPages, "guide.BloodMagic.entryName.architect.soulFray")); - - ArrayList greenGrovePages = new ArrayList(); - greenGrovePages.add(getOrbPageForRecipe(RecipeHolder.greenGroveRecipe)); - greenGrovePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.greenGrove"))); - entries.add(new EntryUniText(greenGrovePages, "guide.BloodMagic.entryName.architect.greenGrove")); - - ArrayList daggerPages = new ArrayList(); - daggerPages.add(new PageAltarRecipe(RecipeHolder.daggerRecipe)); - daggerPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.dagger"))); - entries.add(new EntryUniText(daggerPages, "guide.BloodMagic.entryName.architect.dagger")); - - ArrayList sacrificePages = new ArrayList(); - sacrificePages.add(getOrbPageForRecipe(RecipeHolder.selfSacrificeRuneRecipe)); - sacrificePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.sacrifice.1"))); - sacrificePages.add(getOrbPageForRecipe(RecipeHolder.sacrificeRuneRecipe)); - sacrificePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.sacrifice.2"))); - entries.add(new EntryUniText(sacrificePages, "guide.BloodMagic.entryName.architect.sacrifice")); - - ArrayList bloodPackPages = new ArrayList(); - bloodPackPages.add(new PageIRecipe(RecipeHolder.bloodPackRecipe)); - bloodPackPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodPack"))); - entries.add(new EntryUniText(bloodPackPages, "guide.BloodMagic.entryName.architect.bloodPack")); - - ArrayList fivePeoplePages = new ArrayList(); - fivePeoplePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fivePeople"))); - entries.add(new EntryUniText(fivePeoplePages, "guide.BloodMagic.entryName.architect.fivePeople")); - - ArrayList tier3Pages = new ArrayList(); - tier3Pages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T3.png"), true)); + ArrayList blankSlatePages = new ArrayList(); + blankSlatePages.add(new PageAltarRecipe(RecipeHolder.blankSlateRecipe)); + blankSlatePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.blankSlate"))); + entries.add(new EntryUniText(blankSlatePages, "guide.BloodMagic.entryName.architect.blankSlate")); + + ArrayList divinationSigilPages = new ArrayList(); + divinationSigilPages.add(getOrbPageForRecipe(RecipeHolder.divinationSigilRecipe)); + divinationSigilPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.divination"))); + entries.add(new EntryUniText(divinationSigilPages, "guide.BloodMagic.entryName.architect.divination")); + + ArrayList waterSigilPages = new ArrayList(); + waterSigilPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.waterSigil.1"))); + waterSigilPages.add(getOrbPageForRecipe(RecipeHolder.waterSigilRecipe)); + waterSigilPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.waterSigil.2"))); + entries.add(new EntryUniText(waterSigilPages, "guide.BloodMagic.entryName.architect.waterSigil")); + + ArrayList lavaCrystalPages = new ArrayList(); + lavaCrystalPages.add(getOrbPageForRecipe(RecipeHolder.lavaCrystalRecipe)); + lavaCrystalPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.lavaCrystal"))); + entries.add(new EntryUniText(lavaCrystalPages, "guide.BloodMagic.entryName.architect.lavaCrystal")); + + ArrayList hellHarvestPages = new ArrayList(); + hellHarvestPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.hellHarvest"))); + entries.add(new EntryUniText(hellHarvestPages, "guide.BloodMagic.entryName.architect.hellHarvest")); + + ArrayList lavaSigilPages = new ArrayList(); + lavaSigilPages.add(new PageIRecipe(RecipeHolder.lavaSigilRecipe)); + lavaSigilPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.lavaSigil"))); + entries.add(new EntryUniText(lavaSigilPages, "guide.BloodMagic.entryName.architect.lavaSigil")); + + ArrayList blankRunePages = new ArrayList(); + blankRunePages.add(getOrbPageForRecipe(RecipeHolder.blankRuneRecipe)); + blankRunePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.blankRunes.1"))); + blankRunePages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T2.png"), true)); + blankRunePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.blankRunes.2"))); + entries.add(new EntryUniText(blankRunePages, "guide.BloodMagic.entryName.architect.blankRunes")); + + ArrayList speedRunePages = new ArrayList(); + speedRunePages.add(new PageIRecipe(RecipeHolder.speedRuneRecipe)); + speedRunePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.speedRunes"))); + entries.add(new EntryUniText(speedRunePages, "guide.BloodMagic.entryName.architect.speedRunes")); + + ArrayList apprenticeOrbPages = new ArrayList(); + apprenticeOrbPages.add(new PageAltarRecipe(RecipeHolder.apprenticeBloodOrbRecipe)); + apprenticeOrbPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.apprenticeOrb"))); + entries.add(new EntryUniText(apprenticeOrbPages, "guide.BloodMagic.entryName.architect.apprenticeOrb")); + + ArrayList voidSigilPages = new ArrayList(); + voidSigilPages.add(getOrbPageForRecipe(RecipeHolder.voidSigilRecipe)); + voidSigilPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.voidSigil"))); + entries.add(new EntryUniText(voidSigilPages, "guide.BloodMagic.entryName.architect.voidSigil")); + + ArrayList airSigilPages = new ArrayList(); + airSigilPages.add(getOrbPageForRecipe(RecipeHolder.airSigilRecipe)); + airSigilPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.airSigil"))); + entries.add(new EntryUniText(airSigilPages, "guide.BloodMagic.entryName.architect.airSigil")); + + ArrayList sightSigilPages = new ArrayList(); + sightSigilPages.add(getOrbPageForRecipe(RecipeHolder.sightSigilRecipe)); + sightSigilPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.sightSigil"))); + entries.add(new EntryUniText(sightSigilPages, "guide.BloodMagic.entryName.architect.sightSigil")); + + ArrayList advancedAltarPages = new ArrayList(); + advancedAltarPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.advancedAltar"))); + entries.add(new EntryUniText(advancedAltarPages, "guide.BloodMagic.entryName.architect.advancedAltar")); + + ArrayList fastMinerPages = new ArrayList(); + fastMinerPages.add(getOrbPageForRecipe(RecipeHolder.fastMinerRecipe)); + fastMinerPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fastMiner"))); + entries.add(new EntryUniText(fastMinerPages, "guide.BloodMagic.entryName.architect.fastMiner")); + + ArrayList soulFrayPages = new ArrayList(); + soulFrayPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.soulFray"))); + entries.add(new EntryUniText(soulFrayPages, "guide.BloodMagic.entryName.architect.soulFray")); + + ArrayList greenGrovePages = new ArrayList(); + greenGrovePages.add(getOrbPageForRecipe(RecipeHolder.greenGroveRecipe)); + greenGrovePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.greenGrove"))); + entries.add(new EntryUniText(greenGrovePages, "guide.BloodMagic.entryName.architect.greenGrove")); + + ArrayList daggerPages = new ArrayList(); + daggerPages.add(new PageAltarRecipe(RecipeHolder.daggerRecipe)); + daggerPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.dagger"))); + entries.add(new EntryUniText(daggerPages, "guide.BloodMagic.entryName.architect.dagger")); + + ArrayList sacrificePages = new ArrayList(); + sacrificePages.add(getOrbPageForRecipe(RecipeHolder.selfSacrificeRuneRecipe)); + sacrificePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.sacrifice.1"))); + sacrificePages.add(getOrbPageForRecipe(RecipeHolder.sacrificeRuneRecipe)); + sacrificePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.sacrifice.2"))); + entries.add(new EntryUniText(sacrificePages, "guide.BloodMagic.entryName.architect.sacrifice")); + + ArrayList bloodPackPages = new ArrayList(); + bloodPackPages.add(new PageIRecipe(RecipeHolder.bloodPackRecipe)); + bloodPackPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodPack"))); + entries.add(new EntryUniText(bloodPackPages, "guide.BloodMagic.entryName.architect.bloodPack")); + + ArrayList fivePeoplePages = new ArrayList(); + fivePeoplePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fivePeople"))); + entries.add(new EntryUniText(fivePeoplePages, "guide.BloodMagic.entryName.architect.fivePeople")); + + ArrayList tier3Pages = new ArrayList(); + tier3Pages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T3.png"), true)); tier3Pages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier3"))); - entries.add(new EntryUniText(tier3Pages, "guide.BloodMagic.entryName.architect.tier3")); - - ArrayList magicianOrbPages = new ArrayList(); - magicianOrbPages.add(new PageAltarRecipe(RecipeHolder.magicianBloodOrbRecipe)); - magicianOrbPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.magicianOrb"))); - entries.add(new EntryUniText(magicianOrbPages, "guide.BloodMagic.entryName.architect.magicianOrb")); - - ArrayList newRunePages = new ArrayList(); - newRunePages.add(getOrbPageForRecipe(RecipeHolder.capacityRuneRecipe)); - newRunePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.newRune.1"))); - newRunePages.add(getOrbPageForRecipe(RecipeHolder.dislocationRuneRecipe)); - newRunePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.newRune.2"))); - entries.add(new EntryUniText(newRunePages, "guide.BloodMagic.entryName.architect.newRune")); - - ArrayList magnetismPages = new ArrayList(); - magnetismPages.add(getOrbPageForRecipe(RecipeHolder.magnetismSigilRecipe)); - magnetismPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.magnetism"))); - entries.add(new EntryUniText(magnetismPages, "guide.BloodMagic.entryName.architect.magnetism")); - - ArrayList phantomBridgePages = new ArrayList(); - phantomBridgePages.add(getOrbPageForRecipe(RecipeHolder.phantomBridgeRecipe)); - phantomBridgePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.phantomBridge"))); - entries.add(new EntryUniText(phantomBridgePages, "guide.BloodMagic.entryName.architect.phantomBridge")); - - ArrayList holdingPages = new ArrayList(); - holdingPages.add(getOrbPageForRecipe(RecipeHolder.holdingSigilRecipe)); - holdingPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.holding"))); - entries.add(new EntryUniText(holdingPages, "guide.BloodMagic.entryName.architect.holding")); - - ArrayList elementalAffinityPages = new ArrayList(); - elementalAffinityPages.add(getOrbPageForRecipe(RecipeHolder.affinitySigilRecipe)); - elementalAffinityPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.elementalAffinity"))); - entries.add(new EntryUniText(elementalAffinityPages, "guide.BloodMagic.entryName.architect.elementalAffinity")); - - ArrayList ritualStonesPages = new ArrayList(); - ritualStonesPages.add(getOrbPageForRecipe(RecipeHolder.ritualStoneRecipe)); - ritualStonesPages.add(getOrbPageForRecipe(RecipeHolder.masterStoneRecipe)); - ritualStonesPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.ritualStones"))); - entries.add(new EntryUniText(ritualStonesPages, "guide.BloodMagic.entryName.architect.ritualStones")); + entries.add(new EntryUniText(tier3Pages, "guide.BloodMagic.entryName.architect.tier3")); - ArrayList bloodLampPages = new ArrayList(); - bloodLampPages.add(getOrbPageForRecipe(RecipeHolder.bloodLampRecipe)); - bloodLampPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodLamp"))); - entries.add(new EntryUniText(bloodLampPages, "guide.BloodMagic.entryName.architect.bloodLamp")); - - ArrayList boundArmourPages = new ArrayList(); - boundArmourPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.boundArmour.1"))); - boundArmourPages.add(new PageIRecipe(RecipeHolder.emptySocketRecipe)); - boundArmourPages.add(new PageAltarRecipe(RecipeHolder.filledSocketRecipe)); - boundArmourPages.add(getOrbPageForRecipe(RecipeHolder.soulForgeRecipe)); - boundArmourPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.boundArmour.2"))); - entries.add(new EntryUniText(boundArmourPages, "guide.BloodMagic.entryName.architect.boundArmour")); - - if(AlchemicalWizardry.isThaumcraftLoaded) - { - ArrayList sanguineArmourPages = new ArrayList(); - sanguineArmourPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.sanguineArmour"), new ItemStack(ModItems.sanguineRobe))); - entries.add(new EntryUniText(sanguineArmourPages, "guide.BloodMagic.entryName.architect.sanguineArmour")); - } - - ArrayList soulSuppressPages = new ArrayList(); - soulSuppressPages.add(new PageIRecipe(RecipeHolder.inhibitorRecipe)); - soulSuppressPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.soulSuppress"))); - entries.add(new EntryUniText(soulSuppressPages, "guide.BloodMagic.entryName.architect.soulSuppress")); - - ArrayList ritualDivinerPages = new ArrayList(); - ritualDivinerPages.add(new PageIRecipe(RecipeHolder.ritualDiviner1Recipe)); - ritualDivinerPages.add(new PageIRecipe(RecipeHolder.ritualDiviner2Recipe)); - ritualDivinerPages.add(new PageIRecipe(RecipeHolder.ritualDiviner3Recipe)); - ritualDivinerPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.ritualDiviner"))); - entries.add(new EntryUniText(ritualDivinerPages, "guide.BloodMagic.entryName.architect.ritualDiviner")); - - ArrayList bloodShardPages = new ArrayList(); - bloodShardPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodShard"), new ItemStack(ModItems.weakBloodShard))); - entries.add(new EntryUniText(bloodShardPages, "guide.BloodMagic.entryName.architect.bloodShard")); - - ArrayList tier4AltarPages = new ArrayList(); - tier4AltarPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier4Altar.1"))); - tier4AltarPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T4.png"), true)); - tier4AltarPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier4Altar.2"))); - entries.add(new EntryUniText(tier4AltarPages, "guide.BloodMagic.entryName.architect.tier4Altar")); - - ArrayList masterOrbPages = new ArrayList(); - masterOrbPages.add(new PageAltarRecipe(RecipeHolder.masterBloodOrbRecipe)); - masterOrbPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.masterOrb"))); - entries.add(new EntryUniText(masterOrbPages, "guide.BloodMagic.entryName.architect.masterOrb")); - - ArrayList whirlwindPages = new ArrayList(); - whirlwindPages.add(getOrbPageForRecipe(RecipeHolder.whirlwindSigilRecipe)); - whirlwindPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.whirlwind"))); - entries.add(new EntryUniText(whirlwindPages, "guide.BloodMagic.entryName.architect.whirlwind")); - - ArrayList compressionPages = new ArrayList(); - compressionPages.add(getOrbPageForRecipe(RecipeHolder.compressionSigilRecipe)); - compressionPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.compression"))); - entries.add(new EntryUniText(compressionPages, "guide.BloodMagic.entryName.architect.compression")); - - ArrayList severancePages = new ArrayList(); - severancePages.add(getOrbPageForRecipe(RecipeHolder.enderSeveranceSigilRecipe)); - severancePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.severance"))); - entries.add(new EntryUniText(severancePages, "guide.BloodMagic.entryName.architect.severance")); - - ArrayList teleposerPages = new ArrayList(); - teleposerPages.add(new PageAltarRecipe(RecipeHolder.teleposerFocusRecipe1)); - teleposerPages.add(new PageIRecipe(RecipeHolder.teleposerRecipe)); - teleposerPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.teleposer"))); - entries.add(new EntryUniText(teleposerPages, "guide.BloodMagic.entryName.architect.teleposer")); - - ArrayList suppressionPages = new ArrayList(); - suppressionPages.add(getOrbPageForRecipe(RecipeHolder.suppressionSigilRecipe)); - suppressionPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.suppression"))); - entries.add(new EntryUniText(suppressionPages, "guide.BloodMagic.entryName.architect.suppression")); - - ArrayList superiorCapacityPages = new ArrayList(); - superiorCapacityPages.add(getOrbPageForRecipe(RecipeHolder.superiorCapacityRecipe)); - superiorCapacityPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.superiorCapacity"))); - entries.add(new EntryUniText(superiorCapacityPages, "guide.BloodMagic.entryName.architect.superiorCapacity")); - - ArrayList orbRunePages = new ArrayList(); - orbRunePages.add(getOrbPageForRecipe(RecipeHolder.orbRuneRecipe)); - orbRunePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.orbRune"))); - entries.add(new EntryUniText(orbRunePages, "guide.BloodMagic.entryName.architect.orbRune")); - - ArrayList fieldTripPages = new ArrayList(); - fieldTripPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fieldTrip"))); - entries.add(new EntryUniText(fieldTripPages, "guide.BloodMagic.entryName.architect.fieldTrip")); - - ArrayList bindingKeyPages = new ArrayList(); - bindingKeyPages.add(new PageIRecipe(RecipeHolder.keyOfBindingRecipe)); - bindingKeyPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bindingKey"))); - entries.add(new EntryUniText(bindingKeyPages, "guide.BloodMagic.entryName.architect.bindingKey")); - - ArrayList tier5AltarPages = new ArrayList(); - tier5AltarPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T5.png"), true)); - tier5AltarPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier5Altar"))); - entries.add(new EntryUniText(tier5AltarPages, "guide.BloodMagic.entryName.architect.tier5Altar")); - - ArrayList priceOfPowerPages = new ArrayList(); - priceOfPowerPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.priceOfPower"))); - entries.add(new EntryUniText(priceOfPowerPages, "guide.BloodMagic.entryName.architect.priceOfPower")); - - ArrayList demonicOrbPages = new ArrayList(); - demonicOrbPages.add(new PageAltarRecipe(RecipeHolder.archmageBloodOrbRecipe)); - demonicOrbPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.demonicOrb"))); - entries.add(new EntryUniText(demonicOrbPages, "guide.BloodMagic.entryName.architect.demonicOrb")); - - ArrayList energyBazookaPages = new ArrayList(); - demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.energyBazookaRecipe)); - energyBazookaPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.energyBazooka"))); - entries.add(new EntryUniText(energyBazookaPages, "guide.BloodMagic.entryName.architect.energyBazooka")); - - ArrayList accelerationRunePages = new ArrayList(); - demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.accelerationRuneRecipe)); - accelerationRunePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.accelerationRune"))); - entries.add(new EntryUniText(accelerationRunePages, "guide.BloodMagic.entryName.architect.accelerationRune")); - - ArrayList harvestPages = new ArrayList(); - demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.harvestSigilRecipe)); - harvestPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.harvest"))); - entries.add(new EntryUniText(harvestPages, "guide.BloodMagic.entryName.architect.harvest")); - - ArrayList demonProblemPages = new ArrayList(); - demonProblemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.demonProblem"))); - entries.add(new EntryUniText(demonProblemPages, "guide.BloodMagic.entryName.architect.demonProblem")); - - ArrayList tier6AltarPages = new ArrayList(); - tier6AltarPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T6.png"), true)); - tier6AltarPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier6Altar"))); - tier6AltarPages.add(new PageIRecipe(RecipeHolder.crystalCluserRecipe)); - tier6AltarPages.add(new PageAltarRecipe(RecipeHolder.transcendentBloodOrbRecipe)); - entries.add(new EntryUniText(tier6AltarPages, "guide.BloodMagic.entryName.architect.tier6Altar")); - - ArrayList moreThanHumanPages = new ArrayList(); - moreThanHumanPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.moreThanHuman"))); - entries.add(new EntryUniText(moreThanHumanPages, "guide.BloodMagic.entryName.architect.moreThanHuman")); - - categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.architect", new ItemStack(ModItems.divinationSigil))); - } - - public static void registerRitualBook() - { - List entries = new ArrayList(); - -// ArrayList testPages = new ArrayList(); -// testPages.add(PageRitualMultiBlock.getPageForRitual("AW031Convocation")); -// entries.add(new EntryUniText(testPages, "Test page")); - - - ArrayList introPages = new ArrayList(); + ArrayList magicianOrbPages = new ArrayList(); + magicianOrbPages.add(new PageAltarRecipe(RecipeHolder.magicianBloodOrbRecipe)); + magicianOrbPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.magicianOrb"))); + entries.add(new EntryUniText(magicianOrbPages, "guide.BloodMagic.entryName.architect.magicianOrb")); + + ArrayList newRunePages = new ArrayList(); + newRunePages.add(getOrbPageForRecipe(RecipeHolder.capacityRuneRecipe)); + newRunePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.newRune.1"))); + newRunePages.add(getOrbPageForRecipe(RecipeHolder.dislocationRuneRecipe)); + newRunePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.newRune.2"))); + entries.add(new EntryUniText(newRunePages, "guide.BloodMagic.entryName.architect.newRune")); + + ArrayList magnetismPages = new ArrayList(); + magnetismPages.add(getOrbPageForRecipe(RecipeHolder.magnetismSigilRecipe)); + magnetismPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.magnetism"))); + entries.add(new EntryUniText(magnetismPages, "guide.BloodMagic.entryName.architect.magnetism")); + + ArrayList phantomBridgePages = new ArrayList(); + phantomBridgePages.add(getOrbPageForRecipe(RecipeHolder.phantomBridgeRecipe)); + phantomBridgePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.phantomBridge"))); + entries.add(new EntryUniText(phantomBridgePages, "guide.BloodMagic.entryName.architect.phantomBridge")); + + ArrayList holdingPages = new ArrayList(); + holdingPages.add(getOrbPageForRecipe(RecipeHolder.holdingSigilRecipe)); + holdingPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.holding"))); + entries.add(new EntryUniText(holdingPages, "guide.BloodMagic.entryName.architect.holding")); + + ArrayList elementalAffinityPages = new ArrayList(); + elementalAffinityPages.add(getOrbPageForRecipe(RecipeHolder.affinitySigilRecipe)); + elementalAffinityPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.elementalAffinity"))); + entries.add(new EntryUniText(elementalAffinityPages, "guide.BloodMagic.entryName.architect.elementalAffinity")); + + ArrayList ritualStonesPages = new ArrayList(); + ritualStonesPages.add(getOrbPageForRecipe(RecipeHolder.ritualStoneRecipe)); + ritualStonesPages.add(getOrbPageForRecipe(RecipeHolder.masterStoneRecipe)); + ritualStonesPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.ritualStones"))); + entries.add(new EntryUniText(ritualStonesPages, "guide.BloodMagic.entryName.architect.ritualStones")); + + ArrayList bloodLampPages = new ArrayList(); + bloodLampPages.add(getOrbPageForRecipe(RecipeHolder.bloodLampRecipe)); + bloodLampPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bloodLamp"))); + entries.add(new EntryUniText(bloodLampPages, "guide.BloodMagic.entryName.architect.bloodLamp")); + + ArrayList boundArmourPages = new ArrayList(); + boundArmourPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.boundArmour.1"))); + boundArmourPages.add(new PageIRecipe(RecipeHolder.emptySocketRecipe)); + boundArmourPages.add(new PageAltarRecipe(RecipeHolder.filledSocketRecipe)); + boundArmourPages.add(getOrbPageForRecipe(RecipeHolder.soulForgeRecipe)); + boundArmourPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.boundArmour.2"))); + entries.add(new EntryUniText(boundArmourPages, "guide.BloodMagic.entryName.architect.boundArmour")); + + if (AlchemicalWizardry.isThaumcraftLoaded) { + ArrayList sanguineArmourPages = new ArrayList(); + sanguineArmourPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.architect.sanguineArmour"), + new ItemStack(ModItems.sanguineRobe))); + entries.add(new EntryUniText(sanguineArmourPages, "guide.BloodMagic.entryName.architect.sanguineArmour")); + } + + ArrayList soulSuppressPages = new ArrayList(); + soulSuppressPages.add(new PageIRecipe(RecipeHolder.inhibitorRecipe)); + soulSuppressPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.soulSuppress"))); + entries.add(new EntryUniText(soulSuppressPages, "guide.BloodMagic.entryName.architect.soulSuppress")); + + ArrayList ritualDivinerPages = new ArrayList(); + ritualDivinerPages.add(new PageIRecipe(RecipeHolder.ritualDiviner1Recipe)); + ritualDivinerPages.add(new PageIRecipe(RecipeHolder.ritualDiviner2Recipe)); + ritualDivinerPages.add(new PageIRecipe(RecipeHolder.ritualDiviner3Recipe)); + ritualDivinerPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.ritualDiviner"))); + entries.add(new EntryUniText(ritualDivinerPages, "guide.BloodMagic.entryName.architect.ritualDiviner")); + + ArrayList bloodShardPages = new ArrayList(); + bloodShardPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.architect.bloodShard"), + new ItemStack(ModItems.weakBloodShard))); + entries.add(new EntryUniText(bloodShardPages, "guide.BloodMagic.entryName.architect.bloodShard")); + + ArrayList tier4AltarPages = new ArrayList(); + tier4AltarPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier4Altar.1"))); + tier4AltarPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T4.png"), true)); + tier4AltarPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier4Altar.2"))); + entries.add(new EntryUniText(tier4AltarPages, "guide.BloodMagic.entryName.architect.tier4Altar")); + + ArrayList masterOrbPages = new ArrayList(); + masterOrbPages.add(new PageAltarRecipe(RecipeHolder.masterBloodOrbRecipe)); + masterOrbPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.masterOrb"))); + entries.add(new EntryUniText(masterOrbPages, "guide.BloodMagic.entryName.architect.masterOrb")); + + ArrayList whirlwindPages = new ArrayList(); + whirlwindPages.add(getOrbPageForRecipe(RecipeHolder.whirlwindSigilRecipe)); + whirlwindPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.whirlwind"))); + entries.add(new EntryUniText(whirlwindPages, "guide.BloodMagic.entryName.architect.whirlwind")); + + ArrayList compressionPages = new ArrayList(); + compressionPages.add(getOrbPageForRecipe(RecipeHolder.compressionSigilRecipe)); + compressionPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.compression"))); + entries.add(new EntryUniText(compressionPages, "guide.BloodMagic.entryName.architect.compression")); + + ArrayList severancePages = new ArrayList(); + severancePages.add(getOrbPageForRecipe(RecipeHolder.enderSeveranceSigilRecipe)); + severancePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.severance"))); + entries.add(new EntryUniText(severancePages, "guide.BloodMagic.entryName.architect.severance")); + + ArrayList teleposerPages = new ArrayList(); + teleposerPages.add(new PageAltarRecipe(RecipeHolder.teleposerFocusRecipe1)); + teleposerPages.add(new PageIRecipe(RecipeHolder.teleposerRecipe)); + teleposerPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.teleposer"))); + entries.add(new EntryUniText(teleposerPages, "guide.BloodMagic.entryName.architect.teleposer")); + + ArrayList suppressionPages = new ArrayList(); + suppressionPages.add(getOrbPageForRecipe(RecipeHolder.suppressionSigilRecipe)); + suppressionPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.suppression"))); + entries.add(new EntryUniText(suppressionPages, "guide.BloodMagic.entryName.architect.suppression")); + + ArrayList superiorCapacityPages = new ArrayList(); + superiorCapacityPages.add(getOrbPageForRecipe(RecipeHolder.superiorCapacityRecipe)); + superiorCapacityPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.superiorCapacity"))); + entries.add(new EntryUniText(superiorCapacityPages, "guide.BloodMagic.entryName.architect.superiorCapacity")); + + ArrayList orbRunePages = new ArrayList(); + orbRunePages.add(getOrbPageForRecipe(RecipeHolder.orbRuneRecipe)); + orbRunePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.orbRune"))); + entries.add(new EntryUniText(orbRunePages, "guide.BloodMagic.entryName.architect.orbRune")); + + ArrayList fieldTripPages = new ArrayList(); + fieldTripPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fieldTrip"))); + entries.add(new EntryUniText(fieldTripPages, "guide.BloodMagic.entryName.architect.fieldTrip")); + + ArrayList bindingKeyPages = new ArrayList(); + bindingKeyPages.add(new PageIRecipe(RecipeHolder.keyOfBindingRecipe)); + bindingKeyPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.bindingKey"))); + entries.add(new EntryUniText(bindingKeyPages, "guide.BloodMagic.entryName.architect.bindingKey")); + + ArrayList tier5AltarPages = new ArrayList(); + tier5AltarPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T5.png"), true)); + tier5AltarPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier5Altar"))); + entries.add(new EntryUniText(tier5AltarPages, "guide.BloodMagic.entryName.architect.tier5Altar")); + + ArrayList priceOfPowerPages = new ArrayList(); + priceOfPowerPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.priceOfPower"))); + entries.add(new EntryUniText(priceOfPowerPages, "guide.BloodMagic.entryName.architect.priceOfPower")); + + ArrayList demonicOrbPages = new ArrayList(); + demonicOrbPages.add(new PageAltarRecipe(RecipeHolder.archmageBloodOrbRecipe)); + demonicOrbPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.demonicOrb"))); + entries.add(new EntryUniText(demonicOrbPages, "guide.BloodMagic.entryName.architect.demonicOrb")); + + ArrayList energyBazookaPages = new ArrayList(); + demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.energyBazookaRecipe)); + energyBazookaPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.energyBazooka"))); + entries.add(new EntryUniText(energyBazookaPages, "guide.BloodMagic.entryName.architect.energyBazooka")); + + ArrayList accelerationRunePages = new ArrayList(); + demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.accelerationRuneRecipe)); + accelerationRunePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.accelerationRune"))); + entries.add(new EntryUniText(accelerationRunePages, "guide.BloodMagic.entryName.architect.accelerationRune")); + + ArrayList harvestPages = new ArrayList(); + demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.harvestSigilRecipe)); + harvestPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.harvest"))); + entries.add(new EntryUniText(harvestPages, "guide.BloodMagic.entryName.architect.harvest")); + + ArrayList demonProblemPages = new ArrayList(); + demonProblemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.demonProblem"))); + entries.add(new EntryUniText(demonProblemPages, "guide.BloodMagic.entryName.architect.demonProblem")); + + ArrayList tier6AltarPages = new ArrayList(); + tier6AltarPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T6.png"), true)); + tier6AltarPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier6Altar"))); + tier6AltarPages.add(new PageIRecipe(RecipeHolder.crystalCluserRecipe)); + tier6AltarPages.add(new PageAltarRecipe(RecipeHolder.transcendentBloodOrbRecipe)); + entries.add(new EntryUniText(tier6AltarPages, "guide.BloodMagic.entryName.architect.tier6Altar")); + + ArrayList moreThanHumanPages = new ArrayList(); + moreThanHumanPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.moreThanHuman"))); + entries.add(new EntryUniText(moreThanHumanPages, "guide.BloodMagic.entryName.architect.moreThanHuman")); + + categories.add(new CategoryItemStack( + entries, "guide.BloodMagic.category.architect", new ItemStack(ModItems.divinationSigil))); + } + + public static void registerRitualBook() { + List entries = new ArrayList(); + + // ArrayList testPages = new ArrayList(); + // testPages.add(PageRitualMultiBlock.getPageForRitual("AW031Convocation")); + // entries.add(new EntryUniText(testPages, "Test page")); + + ArrayList introPages = new ArrayList(); introPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.intro"))); entries.add(new EntryUniText(introPages, "guide.BloodMagic.entryName.rituals.intro")); - + ArrayList weakRitualPages = new ArrayList(); weakRitualPages.add(getOrbPageForRecipe(RecipeHolder.weakRitualStoneRecipe)); - weakRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.weakRitual"))); + weakRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.weakRitual"))); entries.add(new EntryUniText(weakRitualPages, "guide.BloodMagic.entryName.rituals.weakRitual")); - + ArrayList ritualsPages = new ArrayList(); ritualsPages.add(getOrbPageForRecipe(RecipeHolder.ritualStoneRecipe)); ritualsPages.add(getOrbPageForRecipe(RecipeHolder.masterStoneRecipe)); @@ -384,453 +453,620 @@ public class BloodMagicGuide ritualsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.rituals"))); ritualsPages.add(new PageAltarRecipe(RecipeHolder.weakActivationRecipe)); entries.add(new EntryUniText(ritualsPages, "guide.BloodMagic.entryName.rituals.rituals")); - + ArrayList waterRitualPages = new ArrayList(); - waterRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Water.png"), true)); - waterRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.waterRitual"))); + waterRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Water.png"), true)); + waterRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.waterRitual"))); entries.add(new EntryUniText(waterRitualPages, "guide.BloodMagic.entryName.rituals.waterRitual")); - + ArrayList lavaRitualPages = new ArrayList(); - lavaRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Lava.png"), true)); - lavaRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.lavaRitual"))); + lavaRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Lava.png"), true)); + lavaRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.lavaRitual"))); entries.add(new EntryUniText(lavaRitualPages, "guide.BloodMagic.entryName.rituals.lavaRitual")); - + ArrayList groveRitualPages = new ArrayList(); - groveRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/GreenGrove.png"), true)); - groveRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.groveRitual"))); + groveRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/GreenGrove.png"), true)); + groveRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.groveRitual"))); entries.add(new EntryUniText(groveRitualPages, "guide.BloodMagic.entryName.rituals.groveRitual")); - + ArrayList interdictionRitualPages = new ArrayList(); - interdictionRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Interdiction.png"), true)); - interdictionRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.interdictionRitual"))); + interdictionRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Interdiction.png"), + true)); + interdictionRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.interdictionRitual"))); entries.add(new EntryUniText(interdictionRitualPages, "guide.BloodMagic.entryName.rituals.interdictionRitual")); - + ArrayList containmentRitualPages = new ArrayList(); - containmentRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Containment.png"), true)); - containmentRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.containmentRitual"))); + containmentRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Containment.png"), + true)); + containmentRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.containmentRitual"))); entries.add(new EntryUniText(containmentRitualPages, "guide.BloodMagic.entryName.rituals.containmentRitual")); - + ArrayList bindingRitualPages = new ArrayList(); - bindingRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Binding.png"), true)); - bindingRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.bindingRitual"))); + bindingRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Binding.png"), true)); + bindingRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.bindingRitual"))); entries.add(new EntryUniText(bindingRitualPages, "guide.BloodMagic.entryName.rituals.bindingRitual")); - + ArrayList beastModePages = new ArrayList(); - beastModePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.beastMode"))); + beastModePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.beastMode"))); entries.add(new EntryUniText(beastModePages, "guide.BloodMagic.entryName.rituals.beastMode")); - + ArrayList unbindingRitualPages = new ArrayList(); - unbindingRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Unbinding.png"), true)); - unbindingRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.unbindingRitual"))); + unbindingRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Unbinding.png"), true)); + unbindingRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.unbindingRitual"))); entries.add(new EntryUniText(unbindingRitualPages, "guide.BloodMagic.entryName.rituals.unbindingRitual")); - + ArrayList jumpRitualPages = new ArrayList(); - jumpRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Jump.png"), true)); - jumpRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.jumpRitual"))); + jumpRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Jump.png"), true)); + jumpRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.jumpRitual"))); entries.add(new EntryUniText(jumpRitualPages, "guide.BloodMagic.entryName.rituals.jumpRitual")); - + ArrayList duskInkPages = new ArrayList(); duskInkPages.add(new PageAltarRecipe(RecipeHolder.duskRecipe)); duskInkPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.duskInk"))); entries.add(new EntryUniText(duskInkPages, "guide.BloodMagic.entryName.rituals.duskInk")); - + ArrayList magnetismRitualPages = new ArrayList(); - magnetismRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Magnetism.png"), true)); - magnetismRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.magnetismRitual"))); + magnetismRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Magnetism.png"), true)); + magnetismRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.magnetismRitual"))); entries.add(new EntryUniText(magnetismRitualPages, "guide.BloodMagic.entryName.rituals.magnetismRitual")); - + ArrayList crusherRitualPages = new ArrayList(); - crusherRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Crusher.png"), true)); - crusherRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.crusherRitual"))); + crusherRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Crusher.png"), true)); + crusherRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.crusherRitual"))); entries.add(new EntryUniText(crusherRitualPages, "guide.BloodMagic.entryName.rituals.crusherRitual")); - + ArrayList speedRitualPages = new ArrayList(); - speedRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Speed.png"), true)); - speedRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.speedRitual"))); + speedRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Speed.png"), true)); + speedRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.speedRitual"))); entries.add(new EntryUniText(speedRitualPages, "guide.BloodMagic.entryName.rituals.speedRitual")); - + ArrayList shepherdRitualPages = new ArrayList(); - shepherdRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/AnimalGrowth.png"), true)); - shepherdRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.shepherdRitual"))); + shepherdRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/AnimalGrowth.png"), + true)); + shepherdRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.shepherdRitual"))); entries.add(new EntryUniText(shepherdRitualPages, "guide.BloodMagic.entryName.rituals.shepherdRitual")); - + ArrayList darkMagicPages = new ArrayList(); - darkMagicPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.darkMagic"))); + darkMagicPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.darkMagic"))); entries.add(new EntryUniText(darkMagicPages, "guide.BloodMagic.entryName.rituals.darkMagic")); - + ArrayList knifeAndSufferingRitualPages = new ArrayList(); - knifeAndSufferingRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/WellOfSuffering.png"), true)); - knifeAndSufferingRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.knifeAndSufferingRitual.1"))); - knifeAndSufferingRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/FeatheredKnife.png"), true)); - knifeAndSufferingRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.knifeAndSufferingRitual.2"))); - entries.add(new EntryUniText(knifeAndSufferingRitualPages, "guide.BloodMagic.entryName.rituals.knifeAndSufferingRitual")); - + knifeAndSufferingRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/WellOfSuffering.png"), + true)); + knifeAndSufferingRitualPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.rituals.knifeAndSufferingRitual.1"))); + knifeAndSufferingRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/FeatheredKnife.png"), + true)); + knifeAndSufferingRitualPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.rituals.knifeAndSufferingRitual.2"))); + entries.add(new EntryUniText( + knifeAndSufferingRitualPages, "guide.BloodMagic.entryName.rituals.knifeAndSufferingRitual")); + ArrayList regenerationRitualPages = new ArrayList(); - regenerationRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Regeneration.png"), true)); - regenerationRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.regenerationRitual"))); + regenerationRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Regeneration.png"), + true)); + regenerationRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.regenerationRitual"))); entries.add(new EntryUniText(regenerationRitualPages, "guide.BloodMagic.entryName.rituals.regenerationRitual")); - + ArrayList harvestFestivalPages = new ArrayList(); - harvestFestivalPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.harvestFestival"))); + harvestFestivalPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.harvestFestival"))); entries.add(new EntryUniText(harvestFestivalPages, "guide.BloodMagic.entryName.rituals.harvestFestival")); - + ArrayList thenThereWereFivePages = new ArrayList(); - thenThereWereFivePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.thenThereWereFive"))); + thenThereWereFivePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.thenThereWereFive"))); entries.add(new EntryUniText(thenThereWereFivePages, "guide.BloodMagic.entryName.rituals.thenThereWereFive")); - + ArrayList alchemyRitualPages = new ArrayList(); - alchemyRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Alchemy.png"), true)); - alchemyRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.alchemyRitual"))); + alchemyRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Alchemy.png"), true)); + alchemyRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.alchemyRitual"))); entries.add(new EntryUniText(alchemyRitualPages, "guide.BloodMagic.entryName.rituals.alchemyRitual")); - + ArrayList domeRitualPages = new ArrayList(); - domeRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Dome.png"), true)); - domeRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.domeRitual"))); + domeRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Dome.png"), true)); + domeRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.domeRitual"))); entries.add(new EntryUniText(domeRitualPages, "guide.BloodMagic.entryName.rituals.domeRitual")); - + ArrayList awakenedCrystalPages = new ArrayList(); - awakenedCrystalPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.awakenedCrystal"))); + awakenedCrystalPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.awakenedCrystal"))); entries.add(new EntryUniText(awakenedCrystalPages, "guide.BloodMagic.entryName.rituals.awakenedCrystal")); - + ArrayList featheredEarthRitualPages = new ArrayList(); - featheredEarthRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/FeatheredEarth.png"), true)); - featheredEarthRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.featheredEarthRitual"))); - entries.add(new EntryUniText(featheredEarthRitualPages, "guide.BloodMagic.entryName.rituals.featheredEarthRitual")); - + featheredEarthRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/FeatheredEarth.png"), + true)); + featheredEarthRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.featheredEarthRitual"))); + entries.add( + new EntryUniText(featheredEarthRitualPages, "guide.BloodMagic.entryName.rituals.featheredEarthRitual")); + ArrayList gaiaRitualPages = new ArrayList(); - gaiaRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Gaia.png"), true)); - gaiaRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.gaiaRitual"))); + gaiaRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Gaia.png"), true)); + gaiaRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.gaiaRitual"))); entries.add(new EntryUniText(gaiaRitualPages, "guide.BloodMagic.entryName.rituals.gaiaRitual")); - + ArrayList condorRitualPages = new ArrayList(); - condorRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Flight.png"), true)); - condorRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.condorRitual"))); + condorRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Flight.png"), true)); + condorRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.condorRitual"))); entries.add(new EntryUniText(condorRitualPages, "guide.BloodMagic.entryName.rituals.condorRitual")); - + ArrayList meteorRitualPages = new ArrayList(); - meteorRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Meteor.png"), true)); - meteorRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.meteorRitual"))); + meteorRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Meteor.png"), true)); + meteorRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.meteorRitual"))); entries.add(new EntryUniText(meteorRitualPages, "guide.BloodMagic.entryName.rituals.meteorRitual")); - + ArrayList expulsionRitualPages = new ArrayList(); - expulsionRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Expulsion.png"), true)); - expulsionRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.expulsionRitual"))); + expulsionRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Expulsion.png"), true)); + expulsionRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.expulsionRitual"))); entries.add(new EntryUniText(expulsionRitualPages, "guide.BloodMagic.entryName.rituals.expulsionRitual")); - + ArrayList costOfProgressPages = new ArrayList(); - costOfProgressPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.costOfProgress.1"))); - costOfProgressPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.costOfProgress.2"))); + costOfProgressPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.costOfProgress.1"))); + costOfProgressPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.costOfProgress.2"))); entries.add(new EntryUniText(costOfProgressPages, "guide.BloodMagic.entryName.rituals.costOfProgress")); - + ArrayList zephyrRitualPages = new ArrayList(); - zephyrRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Zephyr.png"), true)); - zephyrRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.zephyrRitual"))); + zephyrRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Zephyr.png"), true)); + zephyrRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.zephyrRitual"))); entries.add(new EntryUniText(zephyrRitualPages, "guide.BloodMagic.entryName.rituals.zephyrRitual")); - + ArrayList harvestRitualPages = new ArrayList(); - harvestRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Harvest.png"), true)); - harvestRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.harvestRitual"))); + harvestRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Harvest.png"), true)); + harvestRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.harvestRitual"))); entries.add(new EntryUniText(harvestRitualPages, "guide.BloodMagic.entryName.rituals.harvestRitual")); - + ArrayList eternalSoulRitualPages = new ArrayList(); - eternalSoulRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/EternalSoul.png"), true)); - eternalSoulRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.eternalSoulRitual"))); + eternalSoulRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/EternalSoul.png"), + true)); + eternalSoulRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.eternalSoulRitual"))); entries.add(new EntryUniText(eternalSoulRitualPages, "guide.BloodMagic.entryName.rituals.eternalSoulRitual")); - + ArrayList ellipsoidRitualPages = new ArrayList(); - ellipsoidRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Ellipsoid.png"), true)); - ellipsoidRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.ellipsoidRitual"))); + ellipsoidRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Ellipsoid.png"), true)); + ellipsoidRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.ellipsoidRitual"))); entries.add(new EntryUniText(ellipsoidRitualPages, "guide.BloodMagic.entryName.rituals.ellipsoidRitual")); - + ArrayList evaporationRitualPages = new ArrayList(); - evaporationRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Evaporation.png"), true)); - evaporationRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.evaporationRitual"))); + evaporationRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Evaporation.png"), + true)); + evaporationRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.evaporationRitual"))); entries.add(new EntryUniText(evaporationRitualPages, "guide.BloodMagic.entryName.rituals.evaporationRitual")); - + ArrayList sacrosanctityRitualPages = new ArrayList(); - sacrosanctityRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Sacrosanctity.png"), true)); - sacrosanctityRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.sacrosanctityRitual"))); - entries.add(new EntryUniText(sacrosanctityRitualPages, "guide.BloodMagic.entryName.rituals.sacrosanctityRitual")); - + sacrosanctityRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Sacrosanctity.png"), + true)); + sacrosanctityRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.sacrosanctityRitual"))); + entries.add( + new EntryUniText(sacrosanctityRitualPages, "guide.BloodMagic.entryName.rituals.sacrosanctityRitual")); + ArrayList evilRitualPages = new ArrayList(); - evilRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/VeilOfEvil.png"), true)); - evilRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.evilRitual"))); + evilRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/VeilOfEvil.png"), true)); + evilRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.evilRitual"))); entries.add(new EntryUniText(evilRitualPages, "guide.BloodMagic.entryName.rituals.evilRitual")); - + ArrayList stomachRitualPages = new ArrayList(); - stomachRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Stomach.png"), true)); - stomachRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.stomachRitual"))); + stomachRitualPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Stomach.png"), true)); + stomachRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.stomachRitual"))); entries.add(new EntryUniText(stomachRitualPages, "guide.BloodMagic.entryName.rituals.stomachRitual")); - + ArrayList reagentEffectsRitualPages = new ArrayList(); - for(int i=1; i<=24; i++) - { - reagentEffectsRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.reagentEffects." + i))); + for (int i = 1; i <= 24; i++) { + reagentEffectsRitualPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.rituals.reagentEffects." + i))); } entries.add(new EntryUniText(reagentEffectsRitualPages, "guide.BloodMagic.entryName.rituals.reagentEffects")); - + ArrayList conclaveOfMagesPages = new ArrayList(); - conclaveOfMagesPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.conclaveOfMages"))); + conclaveOfMagesPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.conclaveOfMages"))); entries.add(new EntryUniText(conclaveOfMagesPages, "guide.BloodMagic.entryName.rituals.conclaveOfMages")); - + ArrayList forbiddenParadisePages = new ArrayList(); - forbiddenParadisePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.forbiddenParadise"))); + forbiddenParadisePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.forbiddenParadise"))); entries.add(new EntryUniText(forbiddenParadisePages, "guide.BloodMagic.entryName.rituals.forbiddenParadise")); - + ArrayList convocationRitualPages = new ArrayList(); - convocationRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Convocation.png"), true)); - convocationRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.convocationRitual"))); + convocationRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Convocation.png"), + true)); + convocationRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.convocationRitual"))); entries.add(new EntryUniText(convocationRitualPages, "guide.BloodMagic.entryName.rituals.convocationRitual")); - + ArrayList longHaulPages = new ArrayList(); - longHaulPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.longHaul"))); + longHaulPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.longHaul"))); entries.add(new EntryUniText(longHaulPages, "guide.BloodMagic.entryName.rituals.longHaul")); - + ArrayList phantomHandsRitualPages = new ArrayList(); - phantomHandsRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/PhantomHands.png"), true)); - phantomHandsRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.phantomHandsRitual"))); + phantomHandsRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/PhantomHands.png"), + true)); + phantomHandsRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.phantomHandsRitual"))); entries.add(new EntryUniText(phantomHandsRitualPages, "guide.BloodMagic.entryName.rituals.phantomHandsRitual")); - + ArrayList anvilRitualPages = new ArrayList(); - anvilRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/BeatingAnvil.png"), true)); - anvilRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.anvilRitual"))); + anvilRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/BeatingAnvil.png"), + true)); + anvilRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.anvilRitual"))); entries.add(new EntryUniText(anvilRitualPages, "guide.BloodMagic.entryName.rituals.anvilRitual")); - + ArrayList dawnInkPages = new ArrayList(); dawnInkPages.add(new PageAltarRecipe(RecipeHolder.dawnRecipe)); dawnInkPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.dawnInk"))); entries.add(new EntryUniText(dawnInkPages, "guide.BloodMagic.entryName.rituals.dawnInk")); - + ArrayList symmetryRitualPages = new ArrayList(); - symmetryRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/SymmetryOmega.png"), true)); - symmetryRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.symmetryRitual"))); + symmetryRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/SymmetryOmega.png"), + true)); + symmetryRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.symmetryRitual"))); entries.add(new EntryUniText(symmetryRitualPages, "guide.BloodMagic.entryName.rituals.symmetryRitual")); - + ArrayList stallingRitualPages = new ArrayList(); - stallingRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/StallingOmega.png"), true)); - stallingRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.stallingRitual"))); + stallingRitualPages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/StallingOmega.png"), + true)); + stallingRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.stallingRitual"))); entries.add(new EntryUniText(stallingRitualPages, "guide.BloodMagic.entryName.rituals.stallingRitual")); - + ArrayList newMoonRitualPages = new ArrayList(); - newMoonRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.newMoonRitual"))); + newMoonRitualPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.newMoonRitual"))); entries.add(new EntryUniText(newMoonRitualPages, "guide.BloodMagic.entryName.rituals.newMoonRitual")); - - categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.rituals", new ItemStack(ModBlocks.blockMasterStone))); - } - - public static void registerDemonBook() - { - List entries = new ArrayList(); - - ArrayList ashesPages = new ArrayList(); + + categories.add(new CategoryItemStack( + entries, "guide.BloodMagic.category.rituals", new ItemStack(ModBlocks.blockMasterStone))); + } + + public static void registerDemonBook() { + List entries = new ArrayList(); + + ArrayList ashesPages = new ArrayList(); ashesPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.ashes"))); entries.add(new EntryUniText(ashesPages, "guide.BloodMagic.entryName.demons.ashes")); - + ArrayList tamedDemonPages = new ArrayList(); - tamedDemonPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.tamedDemon"))); + tamedDemonPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.tamedDemon"))); entries.add(new EntryUniText(tamedDemonPages, "guide.BloodMagic.entryName.demons.tamedDemon")); - + ArrayList futurePages = new ArrayList(); futurePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.future"))); entries.add(new EntryUniText(futurePages, "guide.BloodMagic.entryName.demons.future")); - + ArrayList knightPages = new ArrayList(); knightPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.knight"))); entries.add(new EntryUniText(knightPages, "guide.BloodMagic.entryName.demons.knight")); - + ArrayList demonShardPages = new ArrayList(); - demonShardPages.addAll(PageHelper.pagesForLongText((StatCollector.translateToLocal("aw.entries.demons.demonShard")), new ItemStack(ModItems.demonBloodShard))); + demonShardPages.addAll(PageHelper.pagesForLongText( + (StatCollector.translateToLocal("aw.entries.demons.demonShard")), + new ItemStack(ModItems.demonBloodShard))); entries.add(new EntryUniText(demonShardPages, "guide.BloodMagic.entryName.demons.demonShard")); - - - ArrayList demonSummoningPages = new ArrayList(); - demonSummoningPages.add(new PageIRecipe(RecipeHolder.arcanePedestalRecipe)); - demonSummoningPages.add(new PageIRecipe(RecipeHolder.arcanePlinthRecipe)); - demonSummoningPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/demons/Ring1.png"), true)); - demonSummoningPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/demons/Ring2.png"), true)); - demonSummoningPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.demonSummoning"))); + + ArrayList demonSummoningPages = new ArrayList(); + demonSummoningPages.add(new PageIRecipe(RecipeHolder.arcanePedestalRecipe)); + demonSummoningPages.add(new PageIRecipe(RecipeHolder.arcanePlinthRecipe)); + demonSummoningPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/demons/Ring1.png"), true)); + demonSummoningPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/demons/Ring2.png"), true)); + demonSummoningPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.demonSummoning"))); entries.add(new EntryUniText(demonSummoningPages, "guide.BloodMagic.entryName.demons.demonSummoning")); - + ArrayList keysGatePages = new ArrayList(); - for(int i=1; i<=10; i++) - { - keysGatePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.keysGate." + i))); + for (int i = 1; i <= 10; i++) { + keysGatePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.keysGate." + i))); } entries.add(new EntryUniText(keysGatePages, "guide.BloodMagic.entryName.demons.keysGate")); - - ArrayList futurePlansPages = new ArrayList(); - futurePlansPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.futurePlans"))); - entries.add(new EntryUniText(futurePlansPages, "guide.BloodMagic.entryName.demons.futurePlans")); - - ArrayList demonInvasionPages = new ArrayList(); - demonInvasionPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.demonInvasion"))); - entries.add(new EntryUniText(demonInvasionPages, "guide.BloodMagic.entryName.demons.demonInvasion")); - - ArrayList observationsPages = new ArrayList(); - observationsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.observations"))); - entries.add(new EntryUniText(observationsPages, "guide.BloodMagic.entryName.demons.observations")); - - categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.demons", new ItemStack(ModItems.demonBloodShard))); - } - - public static void registerSpellBook() - { - List entries = new ArrayList(); - ArrayList demonGirlPages = new ArrayList(); - demonGirlPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.demonGirl"))); + ArrayList futurePlansPages = new ArrayList(); + futurePlansPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.futurePlans"))); + entries.add(new EntryUniText(futurePlansPages, "guide.BloodMagic.entryName.demons.futurePlans")); + + ArrayList demonInvasionPages = new ArrayList(); + demonInvasionPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.demonInvasion"))); + entries.add(new EntryUniText(demonInvasionPages, "guide.BloodMagic.entryName.demons.demonInvasion")); + + ArrayList observationsPages = new ArrayList(); + observationsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.demons.observations"))); + entries.add(new EntryUniText(observationsPages, "guide.BloodMagic.entryName.demons.observations")); + + categories.add(new CategoryItemStack( + entries, "guide.BloodMagic.category.demons", new ItemStack(ModItems.demonBloodShard))); + } + + public static void registerSpellBook() { + List entries = new ArrayList(); + + ArrayList demonGirlPages = new ArrayList(); + demonGirlPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.demonGirl"))); entries.add(new EntryUniText(demonGirlPages, "guide.BloodMagic.entryName.spells.demonGirl")); - + ArrayList spellTablePages = new ArrayList(); - spellTablePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.spellTable.1"))); - spellTablePages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/SimpleSpellTable.png"), true)); - spellTablePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.spellTable.2"))); + spellTablePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.spellTable.1"))); + spellTablePages.add(new PageUnlocImage( + "", + new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/SimpleSpellTable.png"), + true)); + spellTablePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.spellTable.2"))); entries.add(new EntryUniText(spellTablePages, "guide.BloodMagic.entryName.spells.spellTable")); - + ArrayList simpleEffectsPages = new ArrayList(); - for(int i=1; i<=11; i++) - { - simpleEffectsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.simpleEffects." + i))); + for (int i = 1; i <= 11; i++) { + simpleEffectsPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.spells.simpleEffects." + i))); } entries.add(new EntryUniText(simpleEffectsPages, "guide.BloodMagic.entryName.spells.simpleEffects")); - + ArrayList tableAndSkullsPages = new ArrayList(); - tableAndSkullsPages.add(new PageAltarRecipe(RecipeHolder.blankSpellRecipe)); - tableAndSkullsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.tableAndSkulls.1"))); - tableAndSkullsPages.add(getOrbPageForRecipe(RecipeHolder.spellTableRecipe)); - tableAndSkullsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.tableAndSkulls.2"))); + tableAndSkullsPages.add(new PageAltarRecipe(RecipeHolder.blankSpellRecipe)); + tableAndSkullsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.tableAndSkulls.1"))); + tableAndSkullsPages.add(getOrbPageForRecipe(RecipeHolder.spellTableRecipe)); + tableAndSkullsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.tableAndSkulls.2"))); entries.add(new EntryUniText(tableAndSkullsPages, "guide.BloodMagic.entryName.spells.tableAndSkulls")); - + ArrayList timePassesPages = new ArrayList(); - timePassesPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.timePasses"))); + timePassesPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.timePasses"))); entries.add(new EntryUniText(timePassesPages, "guide.BloodMagic.entryName.spells.timePasses")); - + ArrayList complexSpellBasicsPages = new ArrayList(); - complexSpellBasicsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics.1"))); - complexSpellBasicsPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Paradigm.png"), true)); - - for(int i=2; i<=6; i++) - complexSpellBasicsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics." + i))); - - complexSpellBasicsPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Effect.png"), true)); - complexSpellBasicsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics.7"))); - complexSpellBasicsPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Modifier.png"), true)); - - for(int i=8; i<=12; i++) - complexSpellBasicsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics." + i))); - - complexSpellBasicsPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Enhancement.png"), true)); - - for(int i=13; i<=16; i++) - complexSpellBasicsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics." + i))); - - complexSpellBasicsPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Conduit.png"), true)); - complexSpellBasicsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics.17"))); + complexSpellBasicsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics.1"))); + complexSpellBasicsPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Paradigm.png"), true)); + + for (int i = 2; i <= 6; i++) + complexSpellBasicsPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics." + i))); + + complexSpellBasicsPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Effect.png"), true)); + complexSpellBasicsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics.7"))); + complexSpellBasicsPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Modifier.png"), true)); + + for (int i = 8; i <= 12; i++) + complexSpellBasicsPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics." + i))); + + complexSpellBasicsPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Enhancement.png"), true)); + + for (int i = 13; i <= 16; i++) + complexSpellBasicsPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics." + i))); + + complexSpellBasicsPages.add(new PageUnlocImage( + "", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/spells/Conduit.png"), true)); + complexSpellBasicsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellBasics.17"))); entries.add(new EntryUniText(complexSpellBasicsPages, "guide.BloodMagic.entryName.spells.complexSpellBasics")); - + ArrayList complexSpellEffectsPages = new ArrayList(); - for(int i=1; i<=17; i++) - complexSpellEffectsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.complexSpellEffects." + i))); - entries.add(new EntryUniText(complexSpellEffectsPages, "guide.BloodMagic.entryName.spells.complexSpellEffects")); - + for (int i = 1; i <= 17; i++) + complexSpellEffectsPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.spells.complexSpellEffects." + i))); + entries.add( + new EntryUniText(complexSpellEffectsPages, "guide.BloodMagic.entryName.spells.complexSpellEffects")); + ArrayList offTopicPages = new ArrayList(); offTopicPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.offTopic"))); entries.add(new EntryUniText(offTopicPages, "guide.BloodMagic.entryName.spells.offTopic")); - + ArrayList demonicPowerPages = new ArrayList(); - demonicPowerPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.demonicPower"))); + demonicPowerPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.spells.demonicPower"))); entries.add(new EntryUniText(demonicPowerPages, "guide.BloodMagic.entryName.spells.demonicPower")); - - categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.spells", new ItemStack(ModItems.itemComplexSpellCrystal))); - } - - public static void registerAlchemyBook() - { - List entries = new ArrayList(); - - ArrayList fatedMeetingPages = new ArrayList(); - fatedMeetingPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.fatedMeeting"))); + + categories.add(new CategoryItemStack( + entries, "guide.BloodMagic.category.spells", new ItemStack(ModItems.itemComplexSpellCrystal))); + } + + public static void registerAlchemyBook() { + List entries = new ArrayList(); + + ArrayList fatedMeetingPages = new ArrayList(); + fatedMeetingPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.fatedMeeting"))); entries.add(new EntryUniText(fatedMeetingPages, "guide.BloodMagic.entryName.alchemy.fatedMeeting")); - + ArrayList firstStepsPages = new ArrayList(); firstStepsPages.add(getOrbPageForRecipe(RecipeHolder.alchemySetRecipe)); - firstStepsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.firstSteps"))); + firstStepsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.firstSteps"))); entries.add(new EntryUniText(firstStepsPages, "guide.BloodMagic.entryName.alchemy.firstSteps")); - + ArrayList chemistrySetPages = new ArrayList(); - for(int i=1; i<=10; i++) - chemistrySetPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.chemistrySet." + i))); + for (int i = 1; i <= 10; i++) + chemistrySetPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.alchemy.chemistrySet." + i))); entries.add(new EntryUniText(chemistrySetPages, "guide.BloodMagic.entryName.alchemy.chemistrySet")); - + ArrayList incensePages = new ArrayList(); - incensePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.incense.1"))); + incensePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.incense.1"))); incensePages.add(new PageIRecipe(RecipeHolder.crucibleRecipe)); incensePages.add(new PageIRecipe(RecipeHolder.woodAshRecipe)); - incensePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.incense.2"))); + incensePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.incense.2"))); incensePages.add(getOrbPageForRecipe(RecipeHolder.byrrusRecipe)); incensePages.add(getOrbPageForRecipe(RecipeHolder.livensRecipe)); incensePages.add(getOrbPageForRecipe(RecipeHolder.virRecipe)); incensePages.add(getOrbPageForRecipe(RecipeHolder.purpuraRecipe)); - incensePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.incense.3"))); + incensePages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.incense.3"))); entries.add(new EntryUniText(incensePages, "guide.BloodMagic.entryName.alchemy.incense")); - + ArrayList potionsPages = new ArrayList(); potionsPages.add(new PageAltarRecipe(RecipeHolder.flaskRecipe)); potionsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.potions"))); entries.add(new EntryUniText(potionsPages, "guide.BloodMagic.entryName.alchemy.potions")); - + ArrayList reagentRevolutionPages = new ArrayList(); - for(int i=1; i<=8; i++) - reagentRevolutionPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentRevolution." + i))); + for (int i = 1; i <= 8; i++) + reagentRevolutionPages.addAll(PageHelper.pagesForLongText( + StatCollector.translateToLocal("aw.entries.alchemy.reagentRevolution." + i))); entries.add(new EntryUniText(reagentRevolutionPages, "guide.BloodMagic.entryName.alchemy.reagentRevolution")); - + ArrayList newPotionsPages = new ArrayList(); - newPotionsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.newPotions"))); + newPotionsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.newPotions"))); entries.add(new EntryUniText(newPotionsPages, "guide.BloodMagic.entryName.alchemy.newPotions")); - + ArrayList soulSandPages = new ArrayList(); - soulSandPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.soulSand"))); + soulSandPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.soulSand"))); entries.add(new EntryUniText(soulSandPages, "guide.BloodMagic.entryName.alchemy.soulSand")); - + ArrayList timeGoesByPages = new ArrayList(); - timeGoesByPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.timeGoesBy"))); + timeGoesByPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.timeGoesBy"))); entries.add(new EntryUniText(timeGoesByPages, "guide.BloodMagic.entryName.alchemy.timeGoesBy")); - + ArrayList catalystsPages = new ArrayList(); - catalystsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.catalysts"))); + catalystsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.catalysts"))); entries.add(new EntryUniText(catalystsPages, "guide.BloodMagic.entryName.alchemy.catalysts")); - + ArrayList activationCrystalPages = new ArrayList(); - activationCrystalPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.activationCrystal"))); + activationCrystalPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.activationCrystal"))); entries.add(new EntryUniText(activationCrystalPages, "guide.BloodMagic.entryName.alchemy.activationCrystal")); - + ArrayList reagentSystemPages = new ArrayList(); - reagentSystemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.1"))); + reagentSystemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.1"))); reagentSystemPages.add(new PageIRecipe(RecipeHolder.calcinatorRecipe)); - reagentSystemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.2"))); + reagentSystemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.2"))); reagentSystemPages.add(new PageIRecipe(RecipeHolder.belljarRecipe)); reagentSystemPages.add(new PageIRecipe(RecipeHolder.relayRecipe)); - reagentSystemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.3"))); - reagentSystemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.4"))); - reagentSystemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.5"))); + reagentSystemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.3"))); + reagentSystemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.4"))); + reagentSystemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.5"))); reagentSystemPages.add(new PageIRecipe(RecipeHolder.routerRecipe)); reagentSystemPages.add(new PageIRecipe(RecipeHolder.segmenterRecipe)); reagentSystemPages.add(new PageIRecipe(RecipeHolder.cleanserRecipe)); - reagentSystemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.6"))); - - reagentSystemPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.7"))); + reagentSystemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.6"))); + + reagentSystemPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.reagentSystem.7"))); entries.add(new EntryUniText(reagentSystemPages, "guide.BloodMagic.entryName.alchemy.reagentSystem")); - + ArrayList magusSecretPages = new ArrayList(); - magusSecretPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.magusSecret"))); + magusSecretPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.magusSecret"))); entries.add(new EntryUniText(magusSecretPages, "guide.BloodMagic.entryName.alchemy.magusSecret")); - + ArrayList simpleCreationsPages = new ArrayList(); - simpleCreationsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.simpleCreations"))); + simpleCreationsPages.addAll( + PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.alchemy.simpleCreations"))); entries.add(new EntryUniText(simpleCreationsPages, "guide.BloodMagic.entryName.alchemy.simpleCreations")); - - categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.alchemy", new ItemStack(ModItems.alchemyFlask))); - } + + categories.add(new CategoryItemStack( + entries, "guide.BloodMagic.category.alchemy", new ItemStack(ModItems.alchemyFlask))); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBind.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBind.java index c97515a8..d750de83 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBind.java @@ -1,76 +1,60 @@ package WayofTime.alchemicalWizardry.common.commands; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; import java.util.List; - import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -public class CommandBind extends CommandBase -{ +public class CommandBind extends CommandBase { public CommandBind() {} - public String getCommandName() - { + public String getCommandName() { return "bind"; } - public int getRequiredPermissionLevel() - { + public int getRequiredPermissionLevel() { return 2; } - public String getCommandUsage(ICommandSender icommandsender) - { + public String getCommandUsage(ICommandSender icommandsender) { return "commands.bind.usage"; } - public void processCommand(ICommandSender iCommandSender, String[] astring) - { + public void processCommand(ICommandSender iCommandSender, String[] astring) { EntityPlayerMP entityplayermp = getCommandSenderAsPlayer(iCommandSender); ItemStack item = entityplayermp.getCurrentEquippedItem(); EntityPlayerMP targetPlayer = getPlayer(iCommandSender, astring[0]); - if (targetPlayer == null) - { + if (targetPlayer == null) { throw new CommandException("commands.bind.failed.noPlayer"); } - if (item != null && item.getItem() instanceof IBindable) - { - if (EnergyItems.getOwnerName(item).isEmpty()) - { + if (item != null && item.getItem() instanceof IBindable) { + if (EnergyItems.getOwnerName(item).isEmpty()) { EnergyItems.checkAndSetItemOwner(item, targetPlayer); func_152373_a(iCommandSender, this, "commands.bind.success"); - } - else - { + } else { throw new CommandException("commands.bind.failed.alreadyBound"); } - } - else if (!(item.getItem() instanceof IBindable)) - { + } else if (!(item.getItem() instanceof IBindable)) { throw new CommandException("commands.bind.failed.notBindable"); } } - public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) - { + public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) { return getListOfStringsMatchingLastWord(astring, this.getPlayer()); } - protected String[] getPlayer() - { + protected String[] getPlayer() { return MinecraftServer.getServer().getAllUsernames(); } - public boolean isUsernameIndex(String[] astring, int par2) - { + public boolean isUsernameIndex(String[] astring, int par2) { return par2 == 0; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java index 199bb65e..2b95f972 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java @@ -5,15 +5,13 @@ import WayofTime.alchemicalWizardry.common.commands.sub.SubCommandBind; import WayofTime.alchemicalWizardry.common.commands.sub.SubCommandHelp; import WayofTime.alchemicalWizardry.common.commands.sub.SubCommandNetwork; import WayofTime.alchemicalWizardry.common.commands.sub.SubCommandOrb; +import java.util.*; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; -import java.util.*; - public class CommandBloodMagic extends CommandBase { private final List aliases = new ArrayList(); @@ -59,12 +57,13 @@ public class CommandBloodMagic extends CommandBase { ISubCommand subCommand = subCommands.get(args[0]); String[] subArgs = Arrays.copyOfRange(args, 1, args.length); - if (subCommand.canSenderUseSubCommand(commandSender)) - subCommand.processSubCommand(commandSender, subArgs); + if (subCommand.canSenderUseSubCommand(commandSender)) subCommand.processSubCommand(commandSender, subArgs); else - commandSender.addChatMessage(new ChatComponentTranslation("commands.error.perm").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + commandSender.addChatMessage(new ChatComponentTranslation("commands.error.perm") + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); } else { - commandSender.addChatMessage(new ChatComponentTranslation("commands.error.unknown").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + commandSender.addChatMessage(new ChatComponentTranslation("commands.error.unknown") + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java index 5f96be2d..c858ead4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java @@ -1,137 +1,108 @@ package WayofTime.alchemicalWizardry.common.commands; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import java.util.List; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import java.util.List; - -public class CommandSN extends CommandBase -{ +public class CommandSN extends CommandBase { public CommandSN() {} @Override - public String getCommandName() - { + public String getCommandName() { return "soulnetwork"; } @Override - public int getRequiredPermissionLevel() - { + public int getRequiredPermissionLevel() { return 2; } @Override - public String getCommandUsage(ICommandSender icommandsender) - { + public String getCommandUsage(ICommandSender icommandsender) { return "commands.soulnetwork.usage"; } @Override - public void processCommand(ICommandSender icommandsender, String[] astring) - { + public void processCommand(ICommandSender icommandsender, String[] astring) { EntityPlayerMP targetPlayer = getPlayer(icommandsender, astring[0]); String owner = targetPlayer.getDisplayName(); EntityPlayerMP proxyPlayerName = getPlayer(icommandsender, astring[0]); - if (astring.length >= 2 && astring.length <= 3) - { - if ("add".equalsIgnoreCase(astring[1])) - { + if (astring.length >= 2 && astring.length <= 3) { + if ("add".equalsIgnoreCase(astring[1])) { int amount = parseIntBounded(icommandsender, astring[2], Integer.MIN_VALUE, Integer.MAX_VALUE); SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE); func_152373_a(icommandsender, this, "commands.soulnetwork.add.success", amount, owner); - } - else if ("subtract".equalsIgnoreCase(astring[1])) - { + } else if ("subtract".equalsIgnoreCase(astring[1])) { int amount = parseIntBounded(icommandsender, astring[2], Integer.MIN_VALUE, Integer.MAX_VALUE); - if (amount > SoulNetworkHandler.getCurrentEssence(owner)) - { + if (amount > SoulNetworkHandler.getCurrentEssence(owner)) { int lp = SoulNetworkHandler.getCurrentEssence(owner); SoulNetworkHandler.syphonFromNetwork(owner, lp); - func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", SoulNetworkHandler.getCurrentEssence(owner), owner); - } - else - { + func_152373_a( + icommandsender, + this, + "commands.soulnetwork.subtract.success", + SoulNetworkHandler.getCurrentEssence(owner), + owner); + } else { SoulNetworkHandler.syphonFromNetwork(owner, amount); func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", amount, owner); } - } - else if ("fill".equalsIgnoreCase(astring[1])) - { + } else if ("fill".equalsIgnoreCase(astring[1])) { int amount = Integer.MAX_VALUE - SoulNetworkHandler.getCurrentEssence(owner); SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE); func_152373_a(icommandsender, this, "commands.soulnetwork.fill.success", owner); - } - else if ("empty".equalsIgnoreCase(astring[1])) - { + } else if ("empty".equalsIgnoreCase(astring[1])) { SoulNetworkHandler.syphonFromNetwork(owner, SoulNetworkHandler.getCurrentEssence(owner)); func_152373_a(icommandsender, this, "commands.soulnetwork.empty.success", owner); - } - else if ("get".equalsIgnoreCase(astring[1])) - { + } else if ("get".equalsIgnoreCase(astring[1])) { int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", currentEssence, owner); - } - else if ("fillMax".equalsIgnoreCase(astring[1])) - { + } else if ("fillMax".equalsIgnoreCase(astring[1])) { int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); int orbTier = SoulNetworkHandler.getCurrentMaxOrb(owner); int maxForOrb = SoulNetworkHandler.getMaximumForOrbTier(orbTier); int fillAmount = maxForOrb - currentEssence; SoulNetworkHandler.addCurrentEssenceToMaximum(owner, fillAmount, fillAmount); func_152373_a(icommandsender, this, "commands.soulnetwork.fillMax.success", owner); - } - else if ("create".equalsIgnoreCase(astring[1])) - { + } else if ("create".equalsIgnoreCase(astring[1])) { int orbTier = parseIntBounded(icommandsender, astring[2], 1, 6); SoulNetworkHandler.setMaxOrbToMax(proxyPlayerName.getDisplayName(), orbTier); func_152373_a(icommandsender, this, "commands.soulnetwork.create.success", owner, orbTier); - } - else - { + } else { throw new CommandException("commands.soulnetwork.notACommand"); } - } - else if (astring.length == 0) - { + } else if (astring.length == 0) { throw new CommandException("commands.soulnetwork.noPlayer"); - } - else if (astring.length == 1) - { + } else if (astring.length == 1) { throw new CommandException("commands.soulnetwork.noCommand"); } } @Override - public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) - { - if (astring.length == 1) - { + public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) { + if (astring.length == 1) { return getListOfStringsMatchingLastWord(astring, this.getPlayer()); - } - else if (astring.length == 2) - { - return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty", "get", "fillMax", "create"); + } else if (astring.length == 2) { + return getListOfStringsMatchingLastWord( + astring, "add", "subtract", "fill", "empty", "get", "fillMax", "create"); } return null; } - protected String[] getPlayer() - { + protected String[] getPlayer() { return MinecraftServer.getServer().getAllUsernames(); } @Override - public boolean isUsernameIndex(String[] astring, int par2) - { + public boolean isUsernameIndex(String[] astring, int par2) { return par2 == 0; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandUnbind.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandUnbind.java index 3a1cc09a..b7e33f3c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandUnbind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandUnbind.java @@ -8,44 +8,33 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -public class CommandUnbind extends CommandBase -{ +public class CommandUnbind extends CommandBase { public CommandUnbind() {} - public String getCommandName() - { + public String getCommandName() { return "unbind"; } - public int getRequiredPermissionLevel() - { + public int getRequiredPermissionLevel() { return 2; } - public String getCommandUsage(ICommandSender icommandsender) - { + public String getCommandUsage(ICommandSender icommandsender) { return "commands.unbind.usage"; } - public void processCommand(ICommandSender iCommandSender, String[] astring) - { + public void processCommand(ICommandSender iCommandSender, String[] astring) { EntityPlayerMP entityplayermp = getCommandSenderAsPlayer(iCommandSender); ItemStack item = entityplayermp.getCurrentEquippedItem(); - if (item != null && item.getItem() instanceof IBindable) - { - if (!EnergyItems.getOwnerName(item).isEmpty()) - { + if (item != null && item.getItem() instanceof IBindable) { + if (!EnergyItems.getOwnerName(item).isEmpty()) { item.getTagCompound().removeTag("ownerName"); func_152373_a(iCommandSender, this, "commands.unbind.success"); - } - else - { + } else { throw new CommandException("commands.unbind.failed.notBindable"); } - } - else if (!(item.getItem() instanceof IBindable)) - { + } else if (!(item.getItem() instanceof IBindable)) { throw new CommandException("commands.unbind.failed.notBindable"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandBind.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandBind.java index f138043b..a43f5a0a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandBind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandBind.java @@ -7,7 +7,6 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.StatCollector; @@ -44,14 +43,12 @@ public class SubCommandBind extends SubCommandBase { if (held != null && held.getItem() instanceof IBindable) { if (args.length > 0) { - if (args[0].equalsIgnoreCase("help")) - return; + if (args[0].equalsIgnoreCase("help")) return; if (isBoolean(args[0])) { bind = Boolean.parseBoolean(args[0]); - if (args.length > 2) - playerName = args[1]; + if (args.length > 2) playerName = args[1]; } else { playerName = args[0]; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandHelp.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandHelp.java index b6f702c1..007c2380 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandHelp.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandHelp.java @@ -35,10 +35,14 @@ public class SubCommandHelp extends SubCommandBase { public void processSubCommand(ICommandSender commandSender, String[] args) { super.processSubCommand(commandSender, args); - if (args.length > 0) - return; + if (args.length > 0) return; - for (ISubCommand subCommand : ((CommandBloodMagic)getParentCommand()).getSubCommands().values()) - commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("commands.format.help", capitalizeFirstLetter(subCommand.getSubCommandName()), subCommand.getArgUsage(commandSender))).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN))); + for (ISubCommand subCommand : + ((CommandBloodMagic) getParentCommand()).getSubCommands().values()) + commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted( + "commands.format.help", + capitalizeFirstLetter(subCommand.getSubCommandName()), + subCommand.getArgUsage(commandSender))) + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN))); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandNetwork.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandNetwork.java index 93fb76ef..0104d3b6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandNetwork.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandNetwork.java @@ -2,14 +2,13 @@ package WayofTime.alchemicalWizardry.common.commands.sub; import WayofTime.alchemicalWizardry.api.command.SubCommandBase; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import java.util.Locale; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; -import java.util.Locale; - public class SubCommandNetwork extends SubCommandBase { public SubCommandNetwork(ICommand parent) { @@ -37,8 +36,7 @@ public class SubCommandNetwork extends SubCommandBase { if (args.length > 0) { - if (args[0].equalsIgnoreCase("help")) - return; + if (args[0].equalsIgnoreCase("help")) return; String givenName = commandSender.getCommandSenderName(); EntityPlayer player = getPlayer(commandSender, givenName); @@ -62,7 +60,8 @@ public class SubCommandNetwork extends SubCommandBase { if (isInteger(args[2])) { int amount = Integer.parseInt(args[2]); SoulNetworkHandler.syphonAndDamageFromNetwork(givenName, player, amount); - displaySuccessString(commandSender, "commands.network.syphon.success", amount, givenName); + displaySuccessString( + commandSender, "commands.network.syphon.success", amount, givenName); } else { displayErrorString(commandSender, "commands.error.arg.invalid"); } @@ -81,7 +80,8 @@ public class SubCommandNetwork extends SubCommandBase { if (args.length == 3) { if (isInteger(args[2])) { int amount = Integer.parseInt(args[2]); - int maxOrb = SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(givenName)); + int maxOrb = SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(givenName)); SoulNetworkHandler.addCurrentEssenceToMaximum(givenName, amount, maxOrb); displaySuccessString(commandSender, "commands.network.add.success", amount, givenName); } else { @@ -120,7 +120,9 @@ public class SubCommandNetwork extends SubCommandBase { } if (args.length > 1) - commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + SoulNetworkHandler.getCurrentEssence(givenName) + "LP")); + commandSender.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + + SoulNetworkHandler.getCurrentEssence(givenName) + "LP")); break; } @@ -144,7 +146,8 @@ public class SubCommandNetwork extends SubCommandBase { } if (args.length > 1) { - int maxOrb = SoulNetworkHandler.getMaximumForOrbTier(SoulNetworkHandler.getCurrentMaxOrb(givenName)); + int maxOrb = SoulNetworkHandler.getMaximumForOrbTier( + SoulNetworkHandler.getCurrentMaxOrb(givenName)); SoulNetworkHandler.setCurrentEssence(givenName, maxOrb); displaySuccessString(commandSender, "commands.network.cap.success", givenName); } @@ -177,9 +180,9 @@ public class SubCommandNetwork extends SubCommandBase { private static boolean isInteger(String s) { try { Integer.parseInt(s); - } catch(NumberFormatException e) { + } catch (NumberFormatException e) { return false; - } catch(NullPointerException e) { + } catch (NullPointerException e) { return false; } // only got here if we didn't return false diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandOrb.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandOrb.java index 541aef20..ed5971bc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/sub/SubCommandOrb.java @@ -2,13 +2,12 @@ package WayofTime.alchemicalWizardry.common.commands.sub; import WayofTime.alchemicalWizardry.api.command.SubCommandBase; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import java.util.Locale; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; -import java.util.Locale; - public class SubCommandOrb extends SubCommandBase { public SubCommandOrb(ICommand parent) { @@ -36,13 +35,11 @@ public class SubCommandOrb extends SubCommandBase { if (args.length > 0) { - if (args[0].equalsIgnoreCase("help")) - return; + if (args[0].equalsIgnoreCase("help")) return; String givenName = commandSender.getCommandSenderName(); - if (args.length > 1) - givenName = args[1]; + if (args.length > 1) givenName = args[1]; boolean displayHelp = isBounded(0, 2, args.length); @@ -75,7 +72,8 @@ public class SubCommandOrb extends SubCommandBase { } if (args.length > 1) - commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("message.orb.currenttier", SoulNetworkHandler.getCurrentMaxOrb(givenName)))); + commandSender.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted( + "message.orb.currenttier", SoulNetworkHandler.getCurrentMaxOrb(givenName)))); break; } @@ -101,9 +99,9 @@ public class SubCommandOrb extends SubCommandBase { private static boolean isInteger(String s) { try { Integer.parseInt(s); - } catch(NumberFormatException e) { + } catch (NumberFormatException e) { return false; - } catch(NullPointerException e) { + } catch (NullPointerException e) { return false; } // only got here if we didn't return false diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/compress/AdvancedCompressionHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/compress/AdvancedCompressionHandler.java index 42061aa6..6c2403c9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/compress/AdvancedCompressionHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/compress/AdvancedCompressionHandler.java @@ -1,178 +1,155 @@ package WayofTime.alchemicalWizardry.common.compress; +import WayofTime.alchemicalWizardry.api.compress.CompressionHandler; +import WayofTime.alchemicalWizardry.api.compress.CompressionRegistry; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.compress.CompressionHandler; -import WayofTime.alchemicalWizardry.api.compress.CompressionRegistry; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class AdvancedCompressionHandler extends CompressionHandler -{ - @Override - public ItemStack compressInventory(ItemStack[] inv, World world) - { - return test(inv, true, world); - } - - public ItemStack test(ItemStack[] inv, boolean doDrain, World world) - { - for(ItemStack invStack : inv) - { - if(invStack == null) - { - continue; - } - - for(int i=2; i<=3; i++) - { - ItemStack stacky = getRecipe(invStack, world, i); - if(stacky!=null) - { - int threshold = CompressionRegistry.getItemThreshold(invStack); +public class AdvancedCompressionHandler extends CompressionHandler { + @Override + public ItemStack compressInventory(ItemStack[] inv, World world) { + return test(inv, true, world); + } - int needed = i*i; - int neededLeft = iterateThroughInventory(invStack, threshold + invStack.getMaxStackSize() - needed, inv, needed, false); - if(neededLeft <= 0) - { - iterateThroughInventory(invStack, 0, inv, needed, true); - return stacky; - } - } - } - } - - return null; - } - - public int iterateThroughInventory(ItemStack required, int kept, ItemStack[] inv, int needed, boolean doDrain) - { - int i = -1; - - for(ItemStack invStack : inv) - { - i++; - - if(invStack == null) - { - continue; - } - - if(invStack.isItemEqual(required) && (invStack.getTagCompound() == null ? required.getTagCompound() == null : invStack.getTagCompound().equals(required.getTagCompound()))) - { - int stackSize = invStack.stackSize; - int used = 0; - if(kept > 0) - { - int remainingFromStack = Math.max(stackSize - kept, 0); - used += stackSize - remainingFromStack; - } - - kept -= used; - - if(kept <= 0 && needed > 0) - { - int remainingFromStack = Math.max(stackSize - used - needed, 0); - if(doDrain) - { - invStack.stackSize = remainingFromStack + used; - if(invStack.stackSize <= 0) - { - inv[i] = null; - } - } - - needed -= (stackSize - used - remainingFromStack); - } - - if(needed <= 0) - { - return 0; - } - } - } - - return needed; - } - - public static boolean isResultStackReversible(ItemStack stack, int gridSize, World world) - { - if(stack == null) - { - return false; - } - InventoryCrafting inventory = new InventoryCrafting(new Container() - { - public boolean canInteractWith(EntityPlayer player) - { - return false; - } - }, 2, 2); - - inventory.setInventorySlotContents(0, stack); + public ItemStack test(ItemStack[] inv, boolean doDrain, World world) { + for (ItemStack invStack : inv) { + if (invStack == null) { + continue; + } - ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); - if(returnStack == null) - { - return false; - } - - ItemStack compressedStack = null; - switch(gridSize) - { - case 2: - compressedStack = get22Recipe(returnStack, world); - break; - case 3: - compressedStack = get33Recipe(returnStack, world); - break; - } - - if(compressedStack == null) - { - return false; - }else - { - return SpellHelper.areItemStacksEqual(stack, compressedStack); - } - } - - public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) - { - InventoryCrafting inventory = new InventoryCrafting(new Container() - { - public boolean canInteractWith(EntityPlayer player) - { - return false; - } - }, gridSize, gridSize); - for(int i=0; i 0) { + int remainingFromStack = Math.max(stackSize - kept, 0); + used += stackSize - remainingFromStack; + } + + kept -= used; + + if (kept <= 0 && needed > 0) { + int remainingFromStack = Math.max(stackSize - used - needed, 0); + if (doDrain) { + invStack.stackSize = remainingFromStack + used; + if (invStack.stackSize <= 0) { + inv[i] = null; + } + } + + needed -= (stackSize - used - remainingFromStack); + } + + if (needed <= 0) { + return 0; + } + } + } + + return needed; + } + + public static boolean isResultStackReversible(ItemStack stack, int gridSize, World world) { + if (stack == null) { + return false; + } + InventoryCrafting inventory = new InventoryCrafting( + new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 2, + 2); + + inventory.setInventorySlotContents(0, stack); + + ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); + if (returnStack == null) { + return false; + } + + ItemStack compressedStack = null; + switch (gridSize) { + case 2: + compressedStack = get22Recipe(returnStack, world); + break; + case 3: + compressedStack = get33Recipe(returnStack, world); + break; + } + + if (compressedStack == null) { + return false; + } else { + return SpellHelper.areItemStacksEqual(stack, compressedStack); + } + } + + public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) { + InventoryCrafting inventory = new InventoryCrafting( + new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + gridSize, + gridSize); + for (int i = 0; i < inventory.getSizeInventory(); i++) { + inventory.setInventorySlotContents(i, stack); + } + + return StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); + } + + public static boolean has22Recipe(ItemStack stack, World world) { + return get22Recipe(stack, world) != null; + } + + public static ItemStack get22Recipe(ItemStack stack, World world) { + return getRecipe(stack, world, 2); + } + + public static boolean has33Recipe(ItemStack stack, World world) { + return get33Recipe(stack, world) != null; + } + + public static ItemStack get33Recipe(ItemStack stack, World world) { + return getRecipe(stack, world, 3); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/compress/BaseCompressionHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/compress/BaseCompressionHandler.java index a788e156..37015007 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/compress/BaseCompressionHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/compress/BaseCompressionHandler.java @@ -1,110 +1,95 @@ package WayofTime.alchemicalWizardry.common.compress; +import WayofTime.alchemicalWizardry.api.compress.CompressionHandler; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.compress.CompressionHandler; -public class BaseCompressionHandler extends CompressionHandler -{ - private final ItemStack required; - private final ItemStack result; - private final int leftover; - - public BaseCompressionHandler(ItemStack requested, ItemStack result, int leftover) - { - super(); - this.required = requested; - this.result = result; - this.leftover = leftover; - } - - public ItemStack getResultStack() - { - return this.result.copy(); - } +public class BaseCompressionHandler extends CompressionHandler { + private final ItemStack required; + private final ItemStack result; + private final int leftover; - public ItemStack getRequiredStack() - { - return this.required.copy(); - } + public BaseCompressionHandler(ItemStack requested, ItemStack result, int leftover) { + super(); + this.required = requested; + this.result = result; + this.leftover = leftover; + } - @Override - public ItemStack compressInventory(ItemStack[] inv, World world) - { - int remaining = this.getRemainingNeeded(inv); - if(remaining <= 0) - { - this.drainInventory(inv); - return this.getResultStack(); - } - - return null; - } - - public int getRemainingNeeded(ItemStack[] inv) - { - return iterateThroughInventory(inv, false); - } - - public int drainInventory(ItemStack[] inv) - { - return iterateThroughInventory(inv, true); - } - - public int iterateThroughInventory(ItemStack[] inv, boolean doDrain) - { - int needed = this.required.stackSize; - int kept = this.getLeftover(); - int i = -1; - - for(ItemStack invStack : inv) - { - i++; - - if(invStack == null) - { - continue; - } - - if(invStack.isItemEqual(this.required) && (invStack.getTagCompound() == null ? this.required.getTagCompound() == null : invStack.getTagCompound().equals(this.required.getTagCompound()))) - { - int stackSize = invStack.stackSize; - int used = 0; - if(kept > 0) - { - int remainingFromStack = Math.max(stackSize - kept, 0); - used += stackSize - remainingFromStack; - } - - kept -= used; - - if(kept <= 0 && needed > 0) - { - int remainingFromStack = Math.max(stackSize - used - needed, 0); - if(doDrain) - { - invStack.stackSize = remainingFromStack + used; - if(invStack.stackSize <= 0) - { - inv[i] = null; - } - } - - needed -= (stackSize - used - remainingFromStack); - } - - if(needed <= 0) - { - return 0; - } - } - } - - return needed; - } - - public int getLeftover() - { - return this.leftover; - } + public ItemStack getResultStack() { + return this.result.copy(); + } + + public ItemStack getRequiredStack() { + return this.required.copy(); + } + + @Override + public ItemStack compressInventory(ItemStack[] inv, World world) { + int remaining = this.getRemainingNeeded(inv); + if (remaining <= 0) { + this.drainInventory(inv); + return this.getResultStack(); + } + + return null; + } + + public int getRemainingNeeded(ItemStack[] inv) { + return iterateThroughInventory(inv, false); + } + + public int drainInventory(ItemStack[] inv) { + return iterateThroughInventory(inv, true); + } + + public int iterateThroughInventory(ItemStack[] inv, boolean doDrain) { + int needed = this.required.stackSize; + int kept = this.getLeftover(); + int i = -1; + + for (ItemStack invStack : inv) { + i++; + + if (invStack == null) { + continue; + } + + if (invStack.isItemEqual(this.required) + && (invStack.getTagCompound() == null + ? this.required.getTagCompound() == null + : invStack.getTagCompound().equals(this.required.getTagCompound()))) { + int stackSize = invStack.stackSize; + int used = 0; + if (kept > 0) { + int remainingFromStack = Math.max(stackSize - kept, 0); + used += stackSize - remainingFromStack; + } + + kept -= used; + + if (kept <= 0 && needed > 0) { + int remainingFromStack = Math.max(stackSize - used - needed, 0); + if (doDrain) { + invStack.stackSize = remainingFromStack + used; + if (invStack.stackSize <= 0) { + inv[i] = null; + } + } + + needed -= (stackSize - used - remainingFromStack); + } + + if (needed <= 0) { + return 0; + } + } + } + + return needed; + } + + public int getLeftover() { + return this.leftover; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingManager.java b/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingManager.java index 9b90faa9..74edce65 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingManager.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingManager.java @@ -1,9 +1,9 @@ package WayofTime.alchemicalWizardry.common.compress; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.LinkedList; import java.util.List; - -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; @@ -11,217 +11,200 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class StorageBlockCraftingManager -{ +public class StorageBlockCraftingManager { private static final StorageBlockCraftingManager instance = new StorageBlockCraftingManager(); private List recipes = new LinkedList(); - public static StorageBlockCraftingManager getInstance() - { - return instance; + public static StorageBlockCraftingManager getInstance() { + return instance; } - - public void addStorageBlockRecipes() - { - this.recipes = new StorageBlockCraftingRecipeAssimilator().getPackingRecipes(); - - AlchemicalWizardry.logger.info("Total number of compression recipes: " + this.recipes.size()); -// List tempRecipeList = new LinkedList(); -// -// World world = DimensionManager.getWorld(0); -// -// for(Object obj : this.recipes) -// { -// if(obj instanceof IRecipe) -// { -// IRecipe recipe = (IRecipe)obj; -// ItemStack outputStack = recipe.getRecipeOutput(); -// if(outputStack == null || outputStack.getItem() == null) -// { -// continue; -// } -// -// if(recipe instanceof ShapedRecipes) -// { -// ShapedRecipes sRecipe = (ShapedRecipes)recipe; -// ItemStack[] input = sRecipe.recipeItems; -// -// if(outputStack.stackSize == 1 && (input.length == 9 || input.length == 4)) -// { -// tempRecipeList.add(recipe); -// }else if((outputStack.stackSize == 9 || outputStack.stackSize == 4) && input.length == 1) -// { -// tempRecipeList.add(recipe); -// } -// } -// else if(recipe instanceof ShapelessRecipes) -// { -// ShapelessRecipes sRecipe = (ShapelessRecipes)recipe; -// List input = sRecipe.recipeItems; -// -// if(outputStack.stackSize == 1 && (input.size() == 9 || input.size() == 4)) -// { -// Object obj1 = input.get(0); -// if(obj1 != null) -// { -// boolean allMatch = true; -// for(Object obj2 : input) -// { -// if(obj2 == null || !obj2.equals(obj1)) -// { -// allMatch = false; -// break; -// } -// } -// if(allMatch) -// { -// tempRecipeList.add(recipe); -// } -// } -// -// }else if((outputStack.stackSize == 9 || outputStack.stackSize == 4) && input.size() == 1) -// { -// tempRecipeList.add(recipe); -// } -// } -// else if((outputStack.stackSize == 1 && (recipe.getRecipeSize() == 9 || recipe.getRecipeSize() == 4)) || ((outputStack.stackSize == 9 || outputStack.stackSize == 4) && recipe.getRecipeSize() == 1)) -// { -// tempRecipeList.add(recipe); -// continue; -// } -// } -// } -// -// List tempRecipeList2 = new LinkedList(); -// -// for(Object obj : tempRecipeList) -// { -// if(obj instanceof IRecipe) -// { -// IRecipe recipe = (IRecipe)obj; -// ItemStack outputStack = recipe.getRecipeOutput(); -// if(outputStack == null || outputStack.getItem() == null) -// { -// continue; -// } -// -// if(isResultStackReversible(outputStack, 2, world, tempRecipeList) || isResultStackReversible(outputStack, 3, world, tempRecipeList)) -// { -// tempRecipeList2.add(recipe); -// AlchemicalWizardry.logger.info("Now adding recipe for " + outputStack + " to the compression handler."); -// } -// } -// } -// -// this.recipes = tempRecipeList2; - } - - private static boolean isResultStackReversible(ItemStack stack, int gridSize, World world, List list) - { - if(stack == null) - { - return false; - } - InventoryCrafting inventory = new InventoryCrafting(new Container() - { - public boolean canInteractWith(EntityPlayer player) - { - return false; - } - }, 2, 2); - - inventory.setInventorySlotContents(0, stack); - ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list); - if(returnStack == null || returnStack.getItem() == null) - { - return false; - } - - ItemStack compressedStack = null; - switch(gridSize) - { - case 2: - compressedStack = get22Recipe(returnStack, world, list); - break; - case 3: - compressedStack = get33Recipe(returnStack, world, list); - break; - } - - if(compressedStack == null) - { - return false; - }else - { - return SpellHelper.areItemStacksEqual(stack, compressedStack); - } - } - - private static ItemStack getRecipe(ItemStack stack, World world, int gridSize, List list) - { - InventoryCrafting inventory = new InventoryCrafting(new Container() - { - public boolean canInteractWith(EntityPlayer player) - { - return false; - } - }, gridSize, gridSize); - for(int i=0; i tempRecipeList = new LinkedList(); + // + // World world = DimensionManager.getWorld(0); + // + // for(Object obj : this.recipes) + // { + // if(obj instanceof IRecipe) + // { + // IRecipe recipe = (IRecipe)obj; + // ItemStack outputStack = recipe.getRecipeOutput(); + // if(outputStack == null || outputStack.getItem() == null) + // { + // continue; + // } + // + // if(recipe instanceof ShapedRecipes) + // { + // ShapedRecipes sRecipe = (ShapedRecipes)recipe; + // ItemStack[] input = sRecipe.recipeItems; + // + // if(outputStack.stackSize == 1 && (input.length == 9 || input.length == 4)) + // { + // tempRecipeList.add(recipe); + // }else if((outputStack.stackSize == 9 || outputStack.stackSize == 4) && input.length == 1) + // { + // tempRecipeList.add(recipe); + // } + // } + // else if(recipe instanceof ShapelessRecipes) + // { + // ShapelessRecipes sRecipe = (ShapelessRecipes)recipe; + // List input = sRecipe.recipeItems; + // + // if(outputStack.stackSize == 1 && (input.size() == 9 || input.size() == 4)) + // { + // Object obj1 = input.get(0); + // if(obj1 != null) + // { + // boolean allMatch = true; + // for(Object obj2 : input) + // { + // if(obj2 == null || !obj2.equals(obj1)) + // { + // allMatch = false; + // break; + // } + // } + // if(allMatch) + // { + // tempRecipeList.add(recipe); + // } + // } + // + // }else if((outputStack.stackSize == 9 || outputStack.stackSize == 4) && input.size() == 1) + // { + // tempRecipeList.add(recipe); + // } + // } + // else if((outputStack.stackSize == 1 && (recipe.getRecipeSize() == 9 || recipe.getRecipeSize() == 4)) || + // ((outputStack.stackSize == 9 || outputStack.stackSize == 4) && recipe.getRecipeSize() == 1)) + // { + // tempRecipeList.add(recipe); + // continue; + // } + // } + // } + // + // List tempRecipeList2 = new LinkedList(); + // + // for(Object obj : tempRecipeList) + // { + // if(obj instanceof IRecipe) + // { + // IRecipe recipe = (IRecipe)obj; + // ItemStack outputStack = recipe.getRecipeOutput(); + // if(outputStack == null || outputStack.getItem() == null) + // { + // continue; + // } + // + // if(isResultStackReversible(outputStack, 2, world, tempRecipeList) || + // isResultStackReversible(outputStack, 3, world, tempRecipeList)) + // { + // tempRecipeList2.add(recipe); + // AlchemicalWizardry.logger.info("Now adding recipe for " + outputStack + " to the compression + // handler."); + // } + // } + // } + // + // this.recipes = tempRecipeList2; + } + + private static boolean isResultStackReversible(ItemStack stack, int gridSize, World world, List list) { + if (stack == null) { + return false; + } + InventoryCrafting inventory = new InventoryCrafting( + new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 2, + 2); + + inventory.setInventorySlotContents(0, stack); + + ItemStack returnStack = StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list); + if (returnStack == null || returnStack.getItem() == null) { + return false; + } + + ItemStack compressedStack = null; + switch (gridSize) { + case 2: + compressedStack = get22Recipe(returnStack, world, list); + break; + case 3: + compressedStack = get33Recipe(returnStack, world, list); + break; + } + + if (compressedStack == null) { + return false; + } else { + return SpellHelper.areItemStacksEqual(stack, compressedStack); + } + } + + private static ItemStack getRecipe(ItemStack stack, World world, int gridSize, List list) { + InventoryCrafting inventory = new InventoryCrafting( + new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + gridSize, + gridSize); + for (int i = 0; i < inventory.getSizeInventory(); i++) { + inventory.setInventorySlotContents(i, stack); + } + + return StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world, list); + } + + private static boolean has22Recipe(ItemStack stack, World world, List list) { + return get22Recipe(stack, world, list) != null; + } + + private static ItemStack get22Recipe(ItemStack stack, World world, List list) { + return getRecipe(stack, world, 2, list); + } + + private static boolean has33Recipe(ItemStack stack, World world, List list) { + return get33Recipe(stack, world, list) != null; + } + + private static ItemStack get33Recipe(ItemStack stack, World world, List list) { + return getRecipe(stack, world, 3, list); + } + + public ItemStack findMatchingRecipe(InventoryCrafting p_82787_1_, World p_82787_2_) { + return this.findMatchingRecipe(p_82787_1_, p_82787_2_, this.recipes); + } + + private ItemStack findMatchingRecipe(InventoryCrafting p_82787_1_, World p_82787_2_, List list) { int i = 0; ItemStack itemstack = null; ItemStack itemstack1 = null; int j; - for (j = 0; j < p_82787_1_.getSizeInventory(); ++j) - { + for (j = 0; j < p_82787_1_.getSizeInventory(); ++j) { ItemStack itemstack2 = p_82787_1_.getStackInSlot(j); - if (itemstack2 != null) - { - if (i == 0) - { + if (itemstack2 != null) { + if (i == 0) { itemstack = itemstack2; } - if (i == 1) - { + if (i == 1) { itemstack1 = itemstack2; } @@ -229,29 +212,27 @@ public class StorageBlockCraftingManager } } - if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable()) - { + if (i == 2 + && itemstack.getItem() == itemstack1.getItem() + && itemstack.stackSize == 1 + && itemstack1.stackSize == 1 + && itemstack.getItem().isRepairable()) { Item item = itemstack.getItem(); int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); int k = item.getMaxDamage() - itemstack1.getItemDamageForDisplay(); int l = j1 + k + item.getMaxDamage() * 5 / 100; int i1 = item.getMaxDamage() - l; - if (i1 < 0) - { + if (i1 < 0) { i1 = 0; } return new ItemStack(itemstack.getItem(), 1, i1); - } - else - { - for (j = 0; j < list.size(); ++j) - { - IRecipe irecipe = (IRecipe)list.get(j); + } else { + for (j = 0; j < list.size(); ++j) { + IRecipe irecipe = (IRecipe) list.get(j); - if (irecipe.matches(p_82787_1_, p_82787_2_)) - { + if (irecipe.matches(p_82787_1_, p_82787_2_)) { return irecipe.getCraftingResult(p_82787_1_); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingRecipeAssimilator.java b/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingRecipeAssimilator.java index efe9fb43..7cd5db76 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingRecipeAssimilator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/compress/StorageBlockCraftingRecipeAssimilator.java @@ -1,12 +1,11 @@ package WayofTime.alchemicalWizardry.common.compress; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.LinkedList; import java.util.List; - -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; @@ -22,213 +21,212 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; public class StorageBlockCraftingRecipeAssimilator { - public static String[] problemMods = { - "BiblioWoodsForestry" - }; + public static String[] problemMods = {"BiblioWoodsForestry"}; - public List getPackingRecipes() { - // grab all recipes potentially suitable for packing or unpacking + public List getPackingRecipes() { + // grab all recipes potentially suitable for packing or unpacking - List packingRecipes = new LinkedList(); - List unpackingRecipes = new ArrayList(); + List packingRecipes = new LinkedList(); + List unpackingRecipes = new ArrayList(); - for (IRecipe recipe : getCraftingRecipes()) { - ItemStack output = recipe.getRecipeOutput(); - if (output == null || output.getItem() == null) continue; + for (IRecipe recipe : getCraftingRecipes()) { + ItemStack output = recipe.getRecipeOutput(); + if (output == null || output.getItem() == null) continue; - if (output.stackSize == 1) { - PackingRecipe packingRecipe = getPackingRecipe(recipe); + if (output.stackSize == 1) { + PackingRecipe packingRecipe = getPackingRecipe(recipe); - if (packingRecipe != null) { - packingRecipes.add(packingRecipe); - } - } else if ((output.stackSize == 4 || output.stackSize == 9) && recipe.getRecipeSize() == 1) { - unpackingRecipes.add(recipe); - } - } + if (packingRecipe != null) { + packingRecipes.add(packingRecipe); + } + } else if ((output.stackSize == 4 || output.stackSize == 9) && recipe.getRecipeSize() == 1) { + unpackingRecipes.add(recipe); + } + } - // grab all packing recipes which accept the output of any of the unpacking recipes + // grab all packing recipes which accept the output of any of the unpacking recipes - Container container = makeDummyContainer(); - InventoryCrafting inventoryUnpack = new InventoryCrafting(container, 2, 2); - InventoryCrafting inventory2x2 = new InventoryCrafting(container, 2, 2); - InventoryCrafting inventory3x3 = new InventoryCrafting(container, 3, 3); - World world = null; // TODO: use a proper dummy world? + Container container = makeDummyContainer(); + InventoryCrafting inventoryUnpack = new InventoryCrafting(container, 2, 2); + InventoryCrafting inventory2x2 = new InventoryCrafting(container, 2, 2); + InventoryCrafting inventory3x3 = new InventoryCrafting(container, 3, 3); + World world = null; // TODO: use a proper dummy world? - List ret = new ArrayList(); + List ret = new ArrayList(); - for (IRecipe recipeUnpack : unpackingRecipes) { - ItemStack unpacked = recipeUnpack.getRecipeOutput(); - InventoryCrafting inventory = null; + for (IRecipe recipeUnpack : unpackingRecipes) { + ItemStack unpacked = recipeUnpack.getRecipeOutput(); + InventoryCrafting inventory = null; - for (Iterator it = packingRecipes.iterator(); it.hasNext(); ) { - PackingRecipe recipePack = it.next(); + for (Iterator it = packingRecipes.iterator(); it.hasNext(); ) { + PackingRecipe recipePack = it.next(); - // check if the packing recipe accepts the unpacking recipe's output + // check if the packing recipe accepts the unpacking recipe's output - boolean matched = false; + boolean matched = false; - if (recipePack.possibleInputs != null) { // the recipe could be parsed, use its inputs directly since that's faster - // verify recipe size + if (recipePack.possibleInputs + != null) { // the recipe could be parsed, use its inputs directly since that's faster + // verify recipe size - if (recipePack.inputCount != unpacked.stackSize) continue; + if (recipePack.inputCount != unpacked.stackSize) continue; - // check if any of the input options matches the unpacked item stack + // check if any of the input options matches the unpacked item stack - for (ItemStack stack : recipePack.possibleInputs) { - if (areInputsIdentical(unpacked, stack)) { - matched = true; - break; - } - } - } else { // unknown IRecipe, check through the recipe conventionally - // verify recipe size for 3x3 to skip anything smaller quickly + for (ItemStack stack : recipePack.possibleInputs) { + if (areInputsIdentical(unpacked, stack)) { + matched = true; + break; + } + } + } else { // unknown IRecipe, check through the recipe conventionally + // verify recipe size for 3x3 to skip anything smaller quickly - if (unpacked.stackSize == 9 && recipePack.recipe.getRecipeSize() < 9) continue; + if (unpacked.stackSize == 9 && recipePack.recipe.getRecipeSize() < 9) continue; - // initialize inventory late, but only once per unpack recipe + // initialize inventory late, but only once per unpack recipe - if (inventory == null) { - if (unpacked.stackSize == 4) { - inventory = inventory2x2; - } else { - inventory = inventory3x3; - } + if (inventory == null) { + if (unpacked.stackSize == 4) { + inventory = inventory2x2; + } else { + inventory = inventory3x3; + } - for (int i = 0; i < unpacked.stackSize; i++) { - inventory.setInventorySlotContents(i, unpacked.copy()); - } - } + for (int i = 0; i < unpacked.stackSize; i++) { + inventory.setInventorySlotContents(i, unpacked.copy()); + } + } - // check if the packing recipe accepts the unpacked item stack + // check if the packing recipe accepts the unpacked item stack - matched = recipePack.recipe.matches(inventory, world); - } + matched = recipePack.recipe.matches(inventory, world); + } - if (matched) { - // check if the unpacking recipe accepts the packing recipe's output + if (matched) { + // check if the unpacking recipe accepts the packing recipe's output - ItemStack packOutput = recipePack.recipe.getRecipeOutput(); - inventoryUnpack.setInventorySlotContents(0, packOutput.copy()); + ItemStack packOutput = recipePack.recipe.getRecipeOutput(); + inventoryUnpack.setInventorySlotContents(0, packOutput.copy()); - if (recipeUnpack.matches(inventoryUnpack, world)) { - ret.add(recipePack.recipe); - AlchemicalWizardry.logger.info("Adding the following recipe to the Compression Handler: " + packOutput); - it.remove(); - } - } - } - } + if (recipeUnpack.matches(inventoryUnpack, world)) { + ret.add(recipePack.recipe); + AlchemicalWizardry.logger.info( + "Adding the following recipe to the Compression Handler: " + packOutput); + it.remove(); + } + } + } + } - return ret; - } + return ret; + } - @SuppressWarnings("unchecked") - private List getCraftingRecipes() { - return CraftingManager.getInstance().getRecipeList(); - } + @SuppressWarnings("unchecked") + private List getCraftingRecipes() { + return CraftingManager.getInstance().getRecipeList(); + } - private Container makeDummyContainer() { - return new Container() { - @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) { - return true; - } - }; - } + private Container makeDummyContainer() { + return new Container() { + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return true; + } + }; + } - private PackingRecipe getPackingRecipe(IRecipe recipe) { - if (recipe.getRecipeSize() < 4) return null; + private PackingRecipe getPackingRecipe(IRecipe recipe) { + if (recipe.getRecipeSize() < 4) return null; - List inputs; + List inputs; - if (recipe instanceof ShapedRecipes) { - inputs = Arrays.asList(((ShapedRecipes) recipe).recipeItems); - } else if (recipe instanceof ShapelessRecipes) { - inputs = ((ShapelessRecipes) recipe).recipeItems; - } else if (recipe instanceof ShapedOreRecipe) { - inputs = Arrays.asList(((ShapedOreRecipe) recipe).getInput()); - } else if (recipe instanceof ShapelessOreRecipe) { - inputs = ((ShapelessOreRecipe) recipe).getInput(); - } else { - return new PackingRecipe(recipe, null, -1); - } + if (recipe instanceof ShapedRecipes) { + inputs = Arrays.asList(((ShapedRecipes) recipe).recipeItems); + } else if (recipe instanceof ShapelessRecipes) { + inputs = ((ShapelessRecipes) recipe).recipeItems; + } else if (recipe instanceof ShapedOreRecipe) { + inputs = Arrays.asList(((ShapedOreRecipe) recipe).getInput()); + } else if (recipe instanceof ShapelessOreRecipe) { + inputs = ((ShapelessOreRecipe) recipe).getInput(); + } else { + return new PackingRecipe(recipe, null, -1); + } - // check if the recipe inputs are size 4 or 9 + // check if the recipe inputs are size 4 or 9 - int count = 0; + int count = 0; - for (Object o : inputs) { - if (o != null) count++; - } + for (Object o : inputs) { + if (o != null) count++; + } - if (count != 4 && count != 9) return null; + if (count != 4 && count != 9) return null; - // grab identical inputs + // grab identical inputs - List identicalInputs = getIdenticalInputs(inputs); - if (identicalInputs == null) return null; + List identicalInputs = getIdenticalInputs(inputs); + if (identicalInputs == null) return null; - return new PackingRecipe(recipe, identicalInputs, count); - } + return new PackingRecipe(recipe, identicalInputs, count); + } - /** - * Determine the item stacks from the provided inputs which are suitable for every input element. - * - * @param inputs List of all inputs, null elements are being ignored. - * @return List List of all options. - */ - @SuppressWarnings("unchecked") - private List getIdenticalInputs(List inputs) { - List options = null; + /** + * Determine the item stacks from the provided inputs which are suitable for every input element. + * + * @param inputs List of all inputs, null elements are being ignored. + * @return List List of all options. + */ + @SuppressWarnings("unchecked") + private List getIdenticalInputs(List inputs) { + List options = null; - for (Object input : inputs) { - if (input == null) continue; + for (Object input : inputs) { + if (input == null) continue; - List offers; + List offers; - if (input instanceof ItemStack) { - offers = Arrays.asList((ItemStack) input); - } else if (input instanceof List) { - offers = (List) input; + if (input instanceof ItemStack) { + offers = Arrays.asList((ItemStack) input); + } else if (input instanceof List) { + offers = (List) input; - if (offers.isEmpty()) return null; - } else { - throw new RuntimeException("invalid input: "+input.getClass()); - } + if (offers.isEmpty()) return null; + } else { + throw new RuntimeException("invalid input: " + input.getClass()); + } - if (options == null) { - options = new ArrayList(offers); - continue; - } + if (options == null) { + options = new ArrayList(offers); + continue; + } - for (Iterator it = options.iterator(); it.hasNext(); ) { - ItemStack stackReq = it.next(); - boolean found = false; + for (Iterator it = options.iterator(); it.hasNext(); ) { + ItemStack stackReq = it.next(); + boolean found = false; - for (ItemStack stackCmp : offers) { - if (areInputsIdentical(stackReq, stackCmp)) { - found = true; - break; - } - } + for (ItemStack stackCmp : offers) { + if (areInputsIdentical(stackReq, stackCmp)) { + found = true; + break; + } + } - if (!found) { - it.remove(); + if (!found) { + it.remove(); - if (options.isEmpty()) return null; - } - } - } + if (options.isEmpty()) return null; + } + } + } - return options; - } + return options; + } - private boolean areInputsIdentical(ItemStack a, ItemStack b) { + private boolean areInputsIdentical(ItemStack a, ItemStack b) { try { - if (a.getItem() != b.getItem()) - return false; + if (a.getItem() != b.getItem()) return false; int dmgA = a.getItemDamage(); int dmgB = b.getItemDamage(); @@ -236,26 +234,26 @@ public class StorageBlockCraftingRecipeAssimilator { return dmgA == dmgB || dmgA == OreDictionary.WILDCARD_VALUE || dmgB == OreDictionary.WILDCARD_VALUE; } catch (NullPointerException e) { - AlchemicalWizardry.logger.error("A mod in this instance has registered an item with a null input. Known problem mods are:"); + AlchemicalWizardry.logger.error( + "A mod in this instance has registered an item with a null input. Known problem mods are:"); String err = ""; - for (String problem : problemMods) - err += (err.length() > 0 ? ", " : "") + problem; + for (String problem : problemMods) err += (err.length() > 0 ? ", " : "") + problem; AlchemicalWizardry.logger.error(err); return false; } - } + } - private static class PackingRecipe { - PackingRecipe(IRecipe recipe, List possibleInputs, int inputCount) { - this.recipe = recipe; - this.possibleInputs = possibleInputs; - this.inputCount = inputCount; - } + private static class PackingRecipe { + PackingRecipe(IRecipe recipe, List possibleInputs, int inputCount) { + this.recipe = recipe; + this.possibleInputs = possibleInputs; + this.inputCount = inputCount; + } - final IRecipe recipe; - final List possibleInputs; - final int inputCount; - } -} \ No newline at end of file + final IRecipe recipe; + final List possibleInputs; + final int inputCount; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java index 18503f85..125a05d0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BlockSet.java @@ -1,8 +1,14 @@ package WayofTime.alchemicalWizardry.common.demonVillage; +import WayofTime.alchemicalWizardry.api.Int3; +import WayofTime.alchemicalWizardry.common.demonVillage.loot.DemonVillageLootRegistry; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IBlockPortalNode; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.ITilePortalNode; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; import java.util.ArrayList; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.block.BlockLadder; @@ -16,57 +22,42 @@ import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.common.demonVillage.loot.DemonVillageLootRegistry; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IBlockPortalNode; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.ITilePortalNode; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; -public class BlockSet -{ +public class BlockSet { protected String blockid; protected int[] metadata; protected List positions; - public BlockSet() - { + public BlockSet() { this(Blocks.stone); } - public BlockSet(String blockid) - { + public BlockSet(String blockid) { this.blockid = blockid; this.metadata = new int[4]; positions = new ArrayList(); } - public BlockSet(Block block) - { + public BlockSet(Block block) { this(BlockSet.getPairedIdForBlock(block)); } - public BlockSet(Block block, int meta) - { + public BlockSet(Block block, int meta) { this(block); - for (int i = 0; i < metadata.length; i++) - { + for (int i = 0; i < metadata.length; i++) { metadata[i] = meta; } - if (block instanceof BlockStairs) - { - int[] northSet = new int[]{2, 3, 0, 1}; - int[] eastSet = new int[]{1, 0, 2, 3}; - int[] southSet = new int[]{3, 2, 1, 0}; - int[] westSet = new int[]{0, 1, 3, 2}; - int[] northUpSet = new int[]{6, 7, 4, 5}; - int[] eastUpSet = new int[]{5, 4, 6, 7}; - int[] southUpSet = new int[]{7, 6, 5, 4}; - int[] westUpSet = new int[]{4, 5, 7, 6}; + if (block instanceof BlockStairs) { + int[] northSet = new int[] {2, 3, 0, 1}; + int[] eastSet = new int[] {1, 0, 2, 3}; + int[] southSet = new int[] {3, 2, 1, 0}; + int[] westSet = new int[] {0, 1, 3, 2}; + int[] northUpSet = new int[] {6, 7, 4, 5}; + int[] eastUpSet = new int[] {5, 4, 6, 7}; + int[] southUpSet = new int[] {7, 6, 5, 4}; + int[] westUpSet = new int[] {4, 5, 7, 6}; - switch (meta) - { + switch (meta) { case 0: metadata = westSet; break; @@ -92,16 +83,13 @@ public class BlockSet metadata = southUpSet; break; } - } - else if(block instanceof BlockLadder) - { - int[] northSet = new int[]{3, 2, 5, 4}; - int[] eastSet = new int[]{4, 5, 3, 2}; - int[] southSet = new int[]{2, 3, 4, 5}; - int[] westSet = new int[]{5, 4, 2, 3}; - - switch (meta) - { + } else if (block instanceof BlockLadder) { + int[] northSet = new int[] {3, 2, 5, 4}; + int[] eastSet = new int[] {4, 5, 3, 2}; + int[] southSet = new int[] {2, 3, 4, 5}; + int[] westSet = new int[] {5, 4, 2, 3}; + + switch (meta) { case 3: metadata = northSet; break; @@ -115,17 +103,15 @@ public class BlockSet metadata = westSet; break; } - }else if(block instanceof BlockTrapDoor) - { - int div = meta / 4; - int mod = meta % 4; - int[] northSet = new int[]{1 + div*4, div*4, 3 + div*4, 2 + div*4}; //Second one: 0 + - int[] eastSet = new int[]{2 + div*4, 3 + div*4, 1 + div*4, div*4}; //Last one: 0 + - int[] southSet = new int[]{div*4, 1 + div*4, 2 + div*4, 3 + div*4}; //First one: 0 + - int[] westSet = new int[]{3 + div*4, 2 + div*4, div*4, 1 + div*4}; //Third one: 0 + + } else if (block instanceof BlockTrapDoor) { + int div = meta / 4; + int mod = meta % 4; + int[] northSet = new int[] {1 + div * 4, div * 4, 3 + div * 4, 2 + div * 4}; // Second one: 0 + + int[] eastSet = new int[] {2 + div * 4, 3 + div * 4, 1 + div * 4, div * 4}; // Last one: 0 + + int[] southSet = new int[] {div * 4, 1 + div * 4, 2 + div * 4, 3 + div * 4}; // First one: 0 + + int[] westSet = new int[] {3 + div * 4, 2 + div * 4, div * 4, 1 + div * 4}; // Third one: 0 + - switch (mod) - { + switch (mod) { case 0: metadata = southSet; break; @@ -139,16 +125,13 @@ public class BlockSet metadata = westSet; break; } - }else if(block instanceof BlockTorch) - { - int[] northSet = new int[]{3, 4, 1, 2}; - int[] eastSet = new int[]{2, 1, 3, 4}; - int[] southSet = new int[]{4, 3, 2, 1}; - int[] westSet = new int[]{1, 2, 4, 3}; + } else if (block instanceof BlockTorch) { + int[] northSet = new int[] {3, 4, 1, 2}; + int[] eastSet = new int[] {2, 1, 3, 4}; + int[] southSet = new int[] {4, 3, 2, 1}; + int[] westSet = new int[] {1, 2, 4, 3}; - - switch (meta) - { + switch (meta) { case 1: metadata = westSet; break; @@ -162,16 +145,13 @@ public class BlockSet metadata = southSet; break; } - }else if(block instanceof BlockDoor) - { - int[] northSet = new int[]{3, 1, 2, 0}; - int[] eastSet = new int[]{0, 2, 3, 1}; - int[] southSet = new int[]{1, 3, 0, 2}; - int[] westSet = new int[]{2, 0, 1, 3}; + } else if (block instanceof BlockDoor) { + int[] northSet = new int[] {3, 1, 2, 0}; + int[] eastSet = new int[] {0, 2, 3, 1}; + int[] southSet = new int[] {1, 3, 0, 2}; + int[] westSet = new int[] {2, 0, 1, 3}; - - switch (meta) - { + switch (meta) { case 0: metadata = eastSet; break; @@ -185,17 +165,15 @@ public class BlockSet metadata = northSet; break; } - }else if(block instanceof BlockRedstoneComparator) - { - int div = meta / 4; - int mod = meta % 4; - int[] northSet = new int[]{div * 4, 2 + div * 4, 3 + div * 4, 1 + div * 4}; //First one: 0 + - int[] eastSet = new int[]{1 + div*4, 3 + div*4, div*4, 2 + div*4}; //Third one: 0 + - int[] southSet = new int[]{2 + div*4, div*4, 1 + div*4, 3 + div*4}; //Second one: 0 + - int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, div*4}; //Last one: 0 + + } else if (block instanceof BlockRedstoneComparator) { + int div = meta / 4; + int mod = meta % 4; + int[] northSet = new int[] {div * 4, 2 + div * 4, 3 + div * 4, 1 + div * 4}; // First one: 0 + + int[] eastSet = new int[] {1 + div * 4, 3 + div * 4, div * 4, 2 + div * 4}; // Third one: 0 + + int[] southSet = new int[] {2 + div * 4, div * 4, 1 + div * 4, 3 + div * 4}; // Second one: 0 + + int[] westSet = new int[] {3 + div * 4, 1 + div * 4, 2 + div * 4, div * 4}; // Last one: 0 + - switch (mod) - { + switch (mod) { case 0: metadata = northSet; break; @@ -209,19 +187,15 @@ public class BlockSet metadata = westSet; break; } - }else if(block instanceof BlockRedstoneRepeater) - { - int div = meta / 4; - int mod = meta % 4; - int[] northSet = new int[]{div*4, 2 + div*4, 3 + div*4, 1 + div*4}; //First one: 0 + - int[] eastSet = new int[]{1 + div*4, 3 + div*4, div*4, 2 + div*4}; //Third one: 0 + - int[] southSet = new int[]{2 + div*4, div*4, 1 + div*4, 3 + div*4}; //Second one: 0 + - int[] westSet = new int[]{3 + div*4, 1 + div*4, 2 + div*4, div*4}; //Last one: 0 + + } else if (block instanceof BlockRedstoneRepeater) { + int div = meta / 4; + int mod = meta % 4; + int[] northSet = new int[] {div * 4, 2 + div * 4, 3 + div * 4, 1 + div * 4}; // First one: 0 + + int[] eastSet = new int[] {1 + div * 4, 3 + div * 4, div * 4, 2 + div * 4}; // Third one: 0 + + int[] southSet = new int[] {2 + div * 4, div * 4, 1 + div * 4, 3 + div * 4}; // Second one: 0 + + int[] westSet = new int[] {3 + div * 4, 1 + div * 4, 2 + div * 4, div * 4}; // Last one: 0 + - - - switch (mod) - { + switch (mod) { case 0: metadata = northSet; break; @@ -236,55 +210,44 @@ public class BlockSet break; } } - - } - public List getPositions() - { + public List getPositions() { return positions; } - public void addPositionToBlock(int xOffset, int yOffset, int zOffset) - { + public void addPositionToBlock(int xOffset, int yOffset, int zOffset) { positions.add(new Int3(xOffset, yOffset, zOffset)); } - public Block getBlock() - { + public Block getBlock() { return getBlockForString(blockid); } - public static String getPairedIdForBlock(Block block) - { + public static String getPairedIdForBlock(Block block) { UniqueIdentifier un = GameRegistry.findUniqueIdentifierFor(block); String name = ""; - if (un != null) - { + if (un != null) { name = un.modId + ":" + un.name; } return name; } - public static Block getBlockForString(String str) - { + public static Block getBlockForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findBlock(modId, name); } - public int getMetaForDirection(ForgeDirection dir) - { - if (metadata.length < 4) - { + public int getMetaForDirection(ForgeDirection dir) { + if (metadata.length < 4) { return 0; } - switch (dir) - { + switch (dir) { case NORTH: return metadata[0]; case SOUTH: @@ -298,11 +261,18 @@ public class BlockSet } } - public void buildAtIndex(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, int index, boolean populateInventories, int tier) - { + public void buildAtIndex( + TEDemonPortal teDemonPortal, + World world, + int xCoord, + int yCoord, + int zCoord, + ForgeDirection dir, + int index, + boolean populateInventories, + int tier) { Block block = this.getBlock(); - if (index >= positions.size() || block == null) - { + if (index >= positions.size() || block == null) { return; } @@ -312,8 +282,7 @@ public class BlockSet int zOff = position.zCoord; int meta = this.getMetaForDirection(dir); - switch (dir) - { + switch (dir) { case NORTH: break; case SOUTH: @@ -334,40 +303,40 @@ public class BlockSet } world.setBlock(xCoord + xOff, yCoord + yOff, zCoord + zOff, block, meta, 3); - if(populateInventories) - { - this.populateIfIInventory(world, xCoord + xOff, yCoord + yOff, zCoord + zOff, tier); + if (populateInventories) { + this.populateIfIInventory(world, xCoord + xOff, yCoord + yOff, zCoord + zOff, tier); } - if(block instanceof IBlockPortalNode) - { - TileEntity tile = world.getTileEntity(xCoord + xOff, yCoord + yOff, zCoord + zOff); - if(tile instanceof ITilePortalNode) - { - ((ITilePortalNode) tile).setPortalLocation(teDemonPortal); - } + if (block instanceof IBlockPortalNode) { + TileEntity tile = world.getTileEntity(xCoord + xOff, yCoord + yOff, zCoord + zOff); + if (tile instanceof ITilePortalNode) { + ((ITilePortalNode) tile).setPortalLocation(teDemonPortal); + } } } - - public void populateIfIInventory(World world, int x, int y, int z, int tier) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof IInventory) - { - DemonVillageLootRegistry.populateChest((IInventory)tile, tier); - } - } - public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories, int tier) - { - for (int i = 0; i < positions.size(); i++) - { + public void populateIfIInventory(World world, int x, int y, int z, int tier) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof IInventory) { + DemonVillageLootRegistry.populateChest((IInventory) tile, tier); + } + } + + public void buildAll( + TEDemonPortal teDemonPortal, + World world, + int xCoord, + int yCoord, + int zCoord, + ForgeDirection dir, + boolean populateInventories, + int tier) { + for (int i = 0; i < positions.size(); i++) { this.buildAtIndex(teDemonPortal, world, xCoord, yCoord, zCoord, dir, i, populateInventories, tier); } } - public boolean isContained(Block block, int defaultMeta) - { + public boolean isContained(Block block, int defaultMeta) { Block thisBlock = this.getBlock(); return thisBlock != null && thisBlock.equals(block) && this.metadata[0] == defaultMeta; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BuildingSchematic.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BuildingSchematic.java index fc1ba6b7..ea548a86 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BuildingSchematic.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/BuildingSchematic.java @@ -1,17 +1,15 @@ package WayofTime.alchemicalWizardry.common.demonVillage; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class BuildingSchematic -{ +public class BuildingSchematic { public String name; public int doorX; public int doorZ; @@ -20,13 +18,11 @@ public class BuildingSchematic public int buildingType; public List blockList; - public BuildingSchematic() - { + public BuildingSchematic() { this(""); } - public BuildingSchematic(String name) - { + public BuildingSchematic(String name) { this.name = name; blockList = new ArrayList(); this.doorX = 0; @@ -36,12 +32,9 @@ public class BuildingSchematic this.buildingType = DemonBuilding.BUILDING_HOUSE; } - public void addBlockWithMeta(Block block, int meta, int xOffset, int yOffset, int zOffset) - { - for (BlockSet set : blockList) - { - if (set.isContained(block, meta)) - { + public void addBlockWithMeta(Block block, int meta, int xOffset, int yOffset, int zOffset) { + for (BlockSet set : blockList) { + if (set.isContained(block, meta)) { set.addPositionToBlock(xOffset, yOffset, zOffset); return; } @@ -52,22 +45,24 @@ public class BuildingSchematic blockList.add(set); } - public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories) - { - for (BlockSet set : blockList) - { + public void buildAll( + TEDemonPortal teDemonPortal, + World world, + int xCoord, + int yCoord, + int zCoord, + ForgeDirection dir, + boolean populateInventories) { + for (BlockSet set : blockList) { set.buildAll(teDemonPortal, world, xCoord, yCoord, zCoord, dir, populateInventories, this.buildingTier); } } - public GridSpaceHolder createGSH() - { + public GridSpaceHolder createGSH() { GridSpaceHolder holder = new GridSpaceHolder(); - for (BlockSet set : blockList) - { - for (Int3 coords : set.getPositions()) - { + for (BlockSet set : blockList) { + for (Int3 coords : set.getPositions()) { int gridX = (int) ((coords.xCoord + 2 * Math.signum(coords.xCoord)) / 5); int gridZ = (int) ((coords.zCoord + 2 * Math.signum(coords.zCoord)) / 5); @@ -78,27 +73,22 @@ public class BuildingSchematic return holder; } - public Int3 getGridSpotOfDoor() - { + public Int3 getGridSpotOfDoor() { int gridX = (int) ((doorX + 2 * Math.signum(doorX)) / 5); int gridZ = (int) ((doorZ + 2 * Math.signum(doorZ)) / 5); return new Int3(gridX, doorY, gridZ); } - public List getGriddedPositions(ForgeDirection dir) - { + public List getGriddedPositions(ForgeDirection dir) { List positionList = new ArrayList(); - for (BlockSet blockSet : blockList) - { - for (Int3 pos : blockSet.getPositions()) - { + for (BlockSet blockSet : blockList) { + for (Int3 pos : blockSet.getPositions()) { int xOff = pos.xCoord; int zOff = pos.zCoord; - switch (dir) - { + switch (dir) { case SOUTH: xOff *= -1; zOff *= -1; @@ -117,8 +107,7 @@ public class BuildingSchematic } Int3 nextPos = new Int3(xOff, 0, zOff); - if (!positionList.contains(nextPos)) - { + if (!positionList.contains(nextPos)) { positionList.add(nextPos); } } @@ -127,34 +116,27 @@ public class BuildingSchematic return positionList; } - public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) - { -// GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic + public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) { + // GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use + // the schematic List positionList = getGriddedPositions(dir); - for (int i = this.getMinY(); i <= this.getMaxY(); i++) - { - for (Int3 pos : positionList) - { + for (int i = this.getMinY(); i <= this.getMaxY(); i++) { + for (Int3 pos : positionList) { Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord); - if (block != ModBlocks.blockDemonPortal) - { + if (block != ModBlocks.blockDemonPortal) { world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord); } } } } - public int getMinY() - { + public int getMinY() { int min = 0; - for (BlockSet set : blockList) - { - for (Int3 pos : set.getPositions()) - { - if (pos.yCoord < min) - { + for (BlockSet set : blockList) { + for (Int3 pos : set.getPositions()) { + if (pos.yCoord < min) { min = pos.yCoord; } } @@ -163,24 +145,19 @@ public class BuildingSchematic return min; } - public int getMaxY() - { + public int getMaxY() { int max = 0; - for (BlockSet set : blockList) - { - for (Int3 pos : set.getPositions()) - { - if (pos.yCoord > max) - { + for (BlockSet set : blockList) { + for (Int3 pos : set.getPositions()) { + if (pos.yCoord > max) { max = pos.yCoord; } } } return max; } - - public String getName() - { - return this.name; + + public String getName() { + return this.name; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java index aa190a28..39f59010 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java @@ -1,12 +1,11 @@ package WayofTime.alchemicalWizardry.common.demonVillage; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class DemonBuilding -{ +public class DemonBuilding { public static final int BUILDING_HOUSE = 0; public static final int BUILDING_PORTAL = 1; @@ -16,8 +15,7 @@ public class DemonBuilding public int buildingType; public Int3 doorGridSpace; - public DemonBuilding(BuildingSchematic schematic) - { + public DemonBuilding(BuildingSchematic schematic) { this.schematic = schematic; this.buildingType = schematic.buildingType; this.buildingTier = schematic.buildingTier; @@ -25,44 +23,43 @@ public class DemonBuilding this.doorGridSpace = schematic.getGridSpotOfDoor(); } - public String getName() - { + public String getName() { return schematic.getName(); } - public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, ForgeDirection dir) - { + public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, ForgeDirection dir) { return area.doesContainAll(master, gridX, gridZ, dir); } - public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories) - { + public void buildAll( + TEDemonPortal teDemonPortal, + World world, + int xCoord, + int yCoord, + int zCoord, + ForgeDirection dir, + boolean populateInventories) { schematic.buildAll(teDemonPortal, world, xCoord, yCoord, zCoord, dir, populateInventories); } - public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master) - { + public void setAllGridSpaces( + int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master) { area.setAllGridSpaces(xInit, zInit, yLevel, dir, type, master); } - public GridSpaceHolder createGSHForSchematic(BuildingSchematic scheme) - { - switch (this.buildingType) - { + public GridSpaceHolder createGSHForSchematic(BuildingSchematic scheme) { + switch (this.buildingType) { case DemonBuilding.BUILDING_HOUSE: return scheme.createGSH(); case DemonBuilding.BUILDING_PORTAL: - } return scheme.createGSH(); } - public Int3 getDoorSpace(ForgeDirection dir) - { + public Int3 getDoorSpace(ForgeDirection dir) { int x; int z; - switch (dir) - { + switch (dir) { case SOUTH: x = -doorGridSpace.xCoord; z = -doorGridSpace.zCoord; @@ -84,14 +81,12 @@ public class DemonBuilding return new Int3(x, doorGridSpace.yCoord, z); } - public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel) - { + public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel) { Int3 doorSpace = this.getDoorSpace(sideOfRoad); int x = doorSpace.xCoord; int z = doorSpace.zCoord; - switch (sideOfRoad) - { + switch (sideOfRoad) { case SOUTH: z++; break; @@ -109,13 +104,11 @@ public class DemonBuilding return new Int3(x, yLevel, z); } - public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) - { + public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) { schematic.destroyAllInField(world, xCoord, yCoord, zCoord, dir); } - public int getNumberOfGridSpaces() - { + public int getNumberOfGridSpaces() { return area.getNumberOfGridSpaces(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonCrosspath.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonCrosspath.java index 6badd634..9b5c7272 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonCrosspath.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonCrosspath.java @@ -2,21 +2,16 @@ package WayofTime.alchemicalWizardry.common.demonVillage; import net.minecraft.world.World; -public class DemonCrosspath -{ +public class DemonCrosspath { private int xCoord; private int yLevel; private int zCoord; - public DemonCrosspath(int xCoord, int yLevel, int zCoord) - { + public DemonCrosspath(int xCoord, int yLevel, int zCoord) { this.xCoord = xCoord; this.yLevel = yLevel; this.zCoord = zCoord; } - public void createCrosspath(World world) - { - - } + public void createCrosspath(World world) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java index ee83c7f8..2185c591 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java @@ -1,30 +1,28 @@ package WayofTime.alchemicalWizardry.common.demonVillage; +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.Int3; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IRoadWard; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import net.minecraft.block.Block; import net.minecraft.block.BlockFlower; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IRoadWard; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; -public class DemonVillagePath -{ +public class DemonVillagePath { public int xPos; public int yPos; public int zPos; public ForgeDirection dir; public int length; - + public static boolean canGoDown = true; public static boolean tunnelIfObstructed = false; public static boolean createBridgeInAirIfObstructed = false; - public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length) - { + public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length) { this.xPos = xi; this.yPos = yi; this.zPos = zi; @@ -32,21 +30,30 @@ public class DemonVillagePath this.length = length; } - public Int3AndBool constructFullPath(TEDemonPortal portal, World world, int clearance) - { + public Int3AndBool constructFullPath(TEDemonPortal portal, World world, int clearance) { int xi = this.xPos; int yi = this.yPos; int zi = this.zPos; int rad = this.getRoadRadius(); int value = 0; - int finalYPos = this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX, yi, zi - rad * dir.offsetZ, dir, length + rad, false); + int finalYPos = this.constructPartialPath( + portal, world, clearance, xi - rad * dir.offsetX, yi, zi - rad * dir.offsetZ, dir, length + rad, false); - for (int i = -rad; i <= rad; i++) - { - value = Math.max(this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX + i * dir.offsetZ, yi, zi - rad * dir.offsetZ + i * dir.offsetX, dir, length + 2 * rad, true), value); - if(TEDemonPortal.printDebug) - System.out.println("" + (length + 2 * rad) + ", " + value + ""); + for (int i = -rad; i <= rad; i++) { + value = Math.max( + this.constructPartialPath( + portal, + world, + clearance, + xi - rad * dir.offsetX + i * dir.offsetZ, + yi, + zi - rad * dir.offsetZ + i * dir.offsetX, + dir, + length + 2 * rad, + true), + value); + if (TEDemonPortal.printDebug) System.out.println("" + (length + 2 * rad) + ", " + value + ""); } Int3 position = new Int3(xi, finalYPos, zi); @@ -56,15 +63,14 @@ public class DemonVillagePath return new Int3AndBool(position, bool); } - public class Int3AndBool - { - public Int3 coords; - public boolean bool; - public Int3AndBool(Int3 int3, boolean bool) - { - this.coords = int3; - this.bool = bool; - } + public class Int3AndBool { + public Int3 coords; + public boolean bool; + + public Int3AndBool(Int3 int3, boolean bool) { + this.coords = int3; + this.bool = bool; + } } /** @@ -80,42 +86,65 @@ public class DemonVillagePath * @param doConstruct * @return length if doConstruct, yi if !doConstruct */ - public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, ForgeDirection dir, int length, boolean doConstruct) - { - for (int i = 0; i < length; i++) - { + public int constructPartialPath( + TEDemonPortal portal, + World world, + int clearance, + int xi, + int yi, + int zi, + ForgeDirection dir, + int length, + boolean doConstruct) { + for (int i = 0; i < length; i++) { int xOffset = i * dir.offsetX; int zOffset = i * dir.offsetZ; boolean completed = false; - for (int yOffset = 0; yOffset <= clearance; yOffset++) - { + for (int yOffset = 0; yOffset <= clearance; yOffset++) { int sign = 1; Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset); Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset); - if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) - { - if(doConstruct) - { - world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); + if ((this.forceReplaceBlock(block1)) + || (!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) + && this.isBlockReplaceable(block1)) + && (this.forceCanTunnelUnder(highBlock1) + || highBlock1.isReplaceable( + world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) { + if (doConstruct) { + world.setBlock( + xi + xOffset, + yi + sign * yOffset, + zi + zOffset, + portal.getRoadBlock(), + portal.getRoadMeta(), + 3); } yi += sign * yOffset; completed = true; break; - } else if(canGoDown) - { + } else if (canGoDown) { sign = -1; Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset); Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset); - if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2)) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) - { - if(doConstruct) - { - world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); + if ((this.forceReplaceBlock(block2)) + || (!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) + && this.isBlockReplaceable(block2)) + && (this.forceCanTunnelUnder(highBlock2) + || highBlock2.isReplaceable( + world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) { + if (doConstruct) { + world.setBlock( + xi + xOffset, + yi + sign * yOffset, + zi + zOffset, + portal.getRoadBlock(), + portal.getRoadMeta(), + 3); } yi += sign * yOffset; completed = true; @@ -124,87 +153,87 @@ public class DemonVillagePath } } - if(!completed) - { - boolean returnAmount = true; - if(createBridgeInAirIfObstructed) - { - Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset); + if (!completed) { + boolean returnAmount = true; + if (createBridgeInAirIfObstructed) { + Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset); - if (block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1)) - { - returnAmount = false; + if (block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) + || !this.isBlockReplaceable(block1) + || !this.forceReplaceBlock(block1)) { + returnAmount = false; - if(doConstruct) - { - world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); + if (doConstruct) { + world.setBlock( + xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); } - }else - { - returnAmount = true; + } else { + returnAmount = true; } - }else if(tunnelIfObstructed) - { - Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset); + } else if (tunnelIfObstructed) { + Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset); - if (!block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1)) - { - returnAmount = false; + if (!block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) + || this.isBlockReplaceable(block1) + || !this.forceReplaceBlock(block1)) { + returnAmount = false; - if(doConstruct) - { - world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); - world.setBlockToAir(xi + xOffset, yi + 1, zi + zOffset); - world.setBlockToAir(xi + xOffset, yi + 2, zi + zOffset); - world.setBlockToAir(xi + xOffset, yi + 3, zi + zOffset); + if (doConstruct) { + world.setBlock( + xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3); + world.setBlockToAir(xi + xOffset, yi + 1, zi + zOffset); + world.setBlockToAir(xi + xOffset, yi + 2, zi + zOffset); + world.setBlockToAir(xi + xOffset, yi + 3, zi + zOffset); } - }else - { - returnAmount = true; + } else { + returnAmount = true; } - } + } - if(returnAmount) - { - return doConstruct ? i : yi; - } + if (returnAmount) { + return doConstruct ? i : yi; + } } } return doConstruct ? length : yi; } - public Int3 getFinalLocation(World world, int clearance) - { + public Int3 getFinalLocation(World world, int clearance) { int xi = xPos; int yi = yPos; int zi = zPos; - for (int i = 0; i < length; i++) - { + for (int i = 0; i < length; i++) { int xOffset = i * dir.offsetX; int zOffset = i * dir.offsetZ; - for (int yOffset = 0; yOffset <= clearance; yOffset++) - { + for (int yOffset = 0; yOffset <= clearance; yOffset++) { int sign = 1; Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset); Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset); - if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) - { + if ((this.forceReplaceBlock(block1)) + || (!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) + && this.isBlockReplaceable(block1)) + && (this.forceCanTunnelUnder(highBlock1) + || highBlock1.isReplaceable( + world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) { yi += sign * yOffset; break; - } else - { + } else { sign = -1; Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset); Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset); - if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) - { + if ((this.forceReplaceBlock(block2)) + || (!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) + && this.isBlockReplaceable(block2)) + && (this.forceCanTunnelUnder(highBlock2) + || highBlock2.isReplaceable( + world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset))) { yi += sign * yOffset; break; } @@ -215,23 +244,22 @@ public class DemonVillagePath return new Int3(xi, yi, zi); } - public int getRoadRadius() - { + public int getRoadRadius() { return 1; } - public boolean isBlockReplaceable(Block block) - { - return !(block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine || block instanceof IRoadWard) &&!block.equals(ModBlocks.blockDemonPortal); + public boolean isBlockReplaceable(Block block) { + return !(block.getMaterial() == Material.leaves + || block.getMaterial() == Material.vine + || block instanceof IRoadWard) + && !block.equals(ModBlocks.blockDemonPortal); } - - public boolean forceReplaceBlock(Block block) - { - return block.getMaterial().isLiquid(); + + public boolean forceReplaceBlock(Block block) { + return block.getMaterial().isLiquid(); } - - public boolean forceCanTunnelUnder(Block block) - { - return block instanceof BlockFlower || block == Blocks.double_plant; + + public boolean forceCanTunnelUnder(Block block) { + return block instanceof BlockFlower || block == Blocks.double_plant; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpace.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpace.java index b21a30f4..eaf4db2a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpace.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpace.java @@ -2,8 +2,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage; import net.minecraft.nbt.NBTTagCompound; -public class GridSpace -{ +public class GridSpace { public static final int EMPTY = 0; public static final int MAIN_PORTAL = 1; public static final int MINI_PORTAL = 2; @@ -14,49 +13,40 @@ public class GridSpace private int yLevel; private int type; - public GridSpace() - { + public GridSpace() { this(EMPTY, -1); } - public GridSpace(int type, int yLevel) - { + public GridSpace(int type, int yLevel) { this.type = type; this.yLevel = yLevel; } - public int getGridType() - { + public int getGridType() { return this.type; } - public void setGridType(int type) - { + public void setGridType(int type) { this.type = type; } - public int getYLevel() - { + public int getYLevel() { return this.yLevel; } - public void setYLevel(int yLevel) - { + public void setYLevel(int yLevel) { this.yLevel = yLevel; } - public boolean isEmpty() - { + public boolean isEmpty() { return type == EMPTY; } - public static GridSpace getGridFromTag(NBTTagCompound tag) - { + public static GridSpace getGridFromTag(NBTTagCompound tag) { return new GridSpace(tag.getInteger("type"), tag.getInteger("yLevel")); } - public NBTTagCompound getTag() - { + public NBTTagCompound getTag() { NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("type", type); @@ -65,13 +55,11 @@ public class GridSpace return tag; } - public boolean isRoadSegment() - { + public boolean isRoadSegment() { return type == ROAD || type == CROSSROAD; } - public boolean isBuilding() - { + public boolean isBuilding() { return type == HOUSE; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java index e4c58087..403823bb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java @@ -7,32 +7,26 @@ import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class GridSpaceHolder -{ +public class GridSpaceHolder { public GridSpace[][] area; - public int negXRadius; //These variables indicate how much the grid has expanded from the 1x1 - public int posXRadius; //matrix in each direction + public int negXRadius; // These variables indicate how much the grid has expanded from the 1x1 + public int posXRadius; // matrix in each direction public int negZRadius; public int posZRadius; - public GridSpaceHolder() - { + public GridSpaceHolder() { area = new GridSpace[1][1]; area[0][0] = new GridSpace(); } - public void expandAreaInNegX() - { + public void expandAreaInNegX() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1]; - for (int i = 0; i <= negZRadius + posZRadius; i++) - { + for (int i = 0; i <= negZRadius + posZRadius; i++) { newGrid[0][i] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i + 1][j] = area[i][j]; } } @@ -41,19 +35,15 @@ public class GridSpaceHolder negXRadius += 1; } - public void expandAreaInPosX() - { + public void expandAreaInPosX() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1]; - for (int i = 0; i <= negZRadius + posZRadius; i++) - { + for (int i = 0; i <= negZRadius + posZRadius; i++) { newGrid[negXRadius + posXRadius + 1][i] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i][j] = area[i][j]; } } @@ -62,19 +52,15 @@ public class GridSpaceHolder posXRadius += 1; } - public void expandAreaInNegZ() - { + public void expandAreaInNegZ() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2]; - for (int i = 0; i <= negXRadius + posXRadius; i++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { newGrid[i][0] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i][j + 1] = area[i][j]; } } @@ -83,19 +69,15 @@ public class GridSpaceHolder negZRadius += 1; } - public void expandAreaInPosZ() - { + public void expandAreaInPosZ() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2]; - for (int i = 0; i <= negXRadius + posXRadius; i++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { newGrid[i][negZRadius + posZRadius + 1] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i][j] = area[i][j]; } } @@ -104,65 +86,50 @@ public class GridSpaceHolder posZRadius += 1; } - public GridSpace getGridSpace(int x, int z) - { - if (x > posXRadius || x < -negXRadius || z > posZRadius || z < -negZRadius) - { + public GridSpace getGridSpace(int x, int z) { + if (x > posXRadius || x < -negXRadius || z > posZRadius || z < -negZRadius) { return new GridSpace(); - } else - { + } else { return (area[x + negXRadius][z + negZRadius]); } } - public void setGridSpace(int x, int z, GridSpace space) - { - if (x > posXRadius) - { + public void setGridSpace(int x, int z, GridSpace space) { + if (x > posXRadius) { this.expandAreaInPosX(); this.setGridSpace(x, z, space); - } else if (x < -negXRadius) - { + } else if (x < -negXRadius) { this.expandAreaInNegX(); this.setGridSpace(x, z, space); - } else if (z > posZRadius) - { + } else if (z > posZRadius) { this.expandAreaInPosZ(); this.setGridSpace(x, z, space); - } else if (z < -negZRadius) - { + } else if (z < -negZRadius) { this.expandAreaInNegZ(); this.setGridSpace(x, z, space); - } else - { + } else { area[x + negXRadius][z + negZRadius] = space; } } - public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, ForgeDirection dir) - { - if (master != null) - { - if(TEDemonPortal.printDebug) - AlchemicalWizardry.logger.info("negXRadius: " + negXRadius + " posXRadius: " + posXRadius + " negZRadius: " + negZRadius + " posZRadius: " + posZRadius); - for (int i = -negXRadius; i <= posXRadius; i++) - { - for (int j = -negZRadius; j <= posZRadius; j++) - { + public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, ForgeDirection dir) { + if (master != null) { + if (TEDemonPortal.printDebug) + AlchemicalWizardry.logger.info("negXRadius: " + negXRadius + " posXRadius: " + posXRadius + + " negZRadius: " + negZRadius + " posZRadius: " + posZRadius); + for (int i = -negXRadius; i <= posXRadius; i++) { + for (int j = -negZRadius; j <= posZRadius; j++) { GridSpace thisSpace = this.getGridSpace(i, j); - if (thisSpace.isEmpty()) - { + if (thisSpace.isEmpty()) { continue; } - if(TEDemonPortal.printDebug) - AlchemicalWizardry.logger.info("x: " + i + " z: " + j); + if (TEDemonPortal.printDebug) AlchemicalWizardry.logger.info("x: " + i + " z: " + j); int xOff; int zOff; - switch (dir) - { + switch (dir) { case SOUTH: xOff = -i; zOff = -j; @@ -180,8 +147,7 @@ public class GridSpaceHolder zOff = j; break; } - if (!master.getGridSpace(xInit + xOff, zInit + zOff).isEmpty()) - { + if (!master.getGridSpace(xInit + xOff, zInit + zOff).isEmpty()) { return false; } } @@ -191,27 +157,22 @@ public class GridSpaceHolder return false; } - public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master) - { - if(TEDemonPortal.printDebug) - AlchemicalWizardry.logger.info("Grid space selected: (" + xInit + "," + zInit + ")"); - if (master != null) - { - for (int i = -negXRadius; i <= posXRadius; i++) - { - for (int j = -negZRadius; j <= posZRadius; j++) - { + public void setAllGridSpaces( + int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master) { + if (TEDemonPortal.printDebug) + AlchemicalWizardry.logger.info("Grid space selected: (" + xInit + "," + zInit + ")"); + if (master != null) { + for (int i = -negXRadius; i <= posXRadius; i++) { + for (int j = -negZRadius; j <= posZRadius; j++) { GridSpace thisSpace = this.getGridSpace(i, j); - if (thisSpace.isEmpty()) - { + if (thisSpace.isEmpty()) { continue; } int xOff; int zOff; - switch (dir) - { + switch (dir) { case SOUTH: xOff = -i; zOff = -j; @@ -230,8 +191,8 @@ public class GridSpaceHolder break; } - if(TEDemonPortal.printDebug) - AlchemicalWizardry.logger.info("Grid space (" + (xInit + xOff) + "," + (zInit + zOff) + ")"); + if (TEDemonPortal.printDebug) + AlchemicalWizardry.logger.info("Grid space (" + (xInit + xOff) + "," + (zInit + zOff) + ")"); master.setGridSpace(xInit + xOff, zInit + zOff, new GridSpace(type, yLevel)); } @@ -239,23 +200,18 @@ public class GridSpaceHolder } } - public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) - { - for (int i = -negXRadius; i <= posXRadius; i++) - { - for (int j = -negZRadius; j <= posZRadius; j++) - { + public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) { + for (int i = -negXRadius; i <= posXRadius; i++) { + for (int j = -negZRadius; j <= posZRadius; j++) { GridSpace thisSpace = this.getGridSpace(i, j); - if (thisSpace.isEmpty()) - { + if (thisSpace.isEmpty()) { continue; } int xOff; int zOff; - switch (dir) - { + switch (dir) { case SOUTH: xOff = -i; zOff = -j; @@ -274,13 +230,10 @@ public class GridSpaceHolder break; } - for (int l = -2; l <= 2; l++) - { - for (int m = -2; m <= 2; m++) - { + for (int l = -2; l <= 2; l++) { + for (int m = -2; m <= 2; m++) { Block block = world.getBlock(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m); - if (block == ModBlocks.blockDemonPortal) - { + if (block == ModBlocks.blockDemonPortal) { continue; } world.setBlockToAir(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m); @@ -290,15 +243,11 @@ public class GridSpaceHolder } } - public int getNumberOfGridSpaces() - { + public int getNumberOfGridSpaces() { int num = 0; - for (int i = -this.negXRadius; i <= this.posXRadius; i++) - { - for (int j = -this.negZRadius; j <= this.posZRadius; j++) - { - if (!this.getGridSpace(i, j).isEmpty()) - { + for (int i = -this.negXRadius; i <= this.posXRadius; i++) { + for (int j = -this.negZRadius; j <= this.posZRadius; j++) { + if (!this.getGridSpace(i, j).isEmpty()) { num++; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/TileBlockSet.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/TileBlockSet.java index a135df1a..6c71e768 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/TileBlockSet.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/TileBlockSet.java @@ -2,7 +2,6 @@ package WayofTime.alchemicalWizardry.common.demonVillage; import net.minecraft.nbt.NBTTagCompound; -public class TileBlockSet extends BlockSet -{ +public class TileBlockSet extends BlockSet { public NBTTagCompound tag; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityAIOccasionalRangedAttack.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityAIOccasionalRangedAttack.java index d23816ae..afbf32c3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityAIOccasionalRangedAttack.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityAIOccasionalRangedAttack.java @@ -5,45 +5,49 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.util.MathHelper; -public class EntityAIOccasionalRangedAttack extends EntityAIBase -{ +public class EntityAIOccasionalRangedAttack extends EntityAIBase { /** The entity the AI instance has been applied to */ private final EntityLiving entityHost; /** The entity (as a RangedAttackMob) the AI instance has been applied to. */ private final IOccasionalRangedAttackMob rangedAttackEntityHost; + private EntityLivingBase attackTarget; /** * A decrementing tick that spawns a ranged attack once this value reaches 0. It is then set back to the * maxRangedAttackTime. */ private int rangedAttackTime; + private double entityMoveSpeed; private int field_75318_f; private int field_96561_g; /** The maximum time the AI has to wait before peforming another ranged attack. */ private int maxRangedAttackTime; + private float field_96562_i; private float field_82642_h; private static final String __OBFID = "CL_00001609"; private double range; - public EntityAIOccasionalRangedAttack(IOccasionalRangedAttackMob p_i1649_1_, double p_i1649_2_, int p_i1649_4_, float p_i1649_5_, double range) - { + public EntityAIOccasionalRangedAttack( + IOccasionalRangedAttackMob p_i1649_1_, double p_i1649_2_, int p_i1649_4_, float p_i1649_5_, double range) { this(p_i1649_1_, p_i1649_2_, p_i1649_4_, p_i1649_4_, p_i1649_5_, range); } - public EntityAIOccasionalRangedAttack(IOccasionalRangedAttackMob p_i1650_1_, double p_i1650_2_, int p_i1650_4_, int p_i1650_5_, float p_i1650_6_, double range) - { + public EntityAIOccasionalRangedAttack( + IOccasionalRangedAttackMob p_i1650_1_, + double p_i1650_2_, + int p_i1650_4_, + int p_i1650_5_, + float p_i1650_6_, + double range) { this.rangedAttackTime = -1; - if (!(p_i1650_1_ instanceof EntityLivingBase)) - { + if (!(p_i1650_1_ instanceof EntityLivingBase)) { throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob"); - } - else - { + } else { this.rangedAttackEntityHost = p_i1650_1_; - this.entityHost = (EntityLiving)p_i1650_1_; + this.entityHost = (EntityLiving) p_i1650_1_; this.entityMoveSpeed = p_i1650_2_; this.field_96561_g = p_i1650_4_; this.maxRangedAttackTime = p_i1650_5_; @@ -57,49 +61,42 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { + public boolean shouldExecute() { EntityLivingBase entitylivingbase = this.entityHost.getAttackTarget(); - if (entitylivingbase == null) - { + if (entitylivingbase == null) { return false; - } - else if(this.rangedAttackEntityHost.shouldUseRangedAttack() && this.isInRange(entitylivingbase)) - { + } else if (this.rangedAttackEntityHost.shouldUseRangedAttack() && this.isInRange(entitylivingbase)) { this.attackTarget = entitylivingbase; return true; - }else - { - return false; + } else { + return false; } } /** * Returns whether an in-progress EntityAIBase should continue executing */ - public boolean continueExecuting() - { - return this.shouldExecute() || !this.entityHost.getNavigator().noPath() && this.rangedAttackEntityHost.shouldUseRangedAttack(); + public boolean continueExecuting() { + return this.shouldExecute() + || !this.entityHost.getNavigator().noPath() && this.rangedAttackEntityHost.shouldUseRangedAttack(); } - - public boolean isInRange(EntityLivingBase target) - { - double xf = target.posX; - double yf = target.posY; - double zf = target.posZ; - - double xi = this.entityHost.posX; - double yi = this.entityHost.posY; - double zi = this.entityHost.posZ; - return (xi-xf)*(xi-xf) + (yi-yf)*(yi-yf) + (zi-zf)*(zi-zf) >= range*range; + + public boolean isInRange(EntityLivingBase target) { + double xf = target.posX; + double yf = target.posY; + double zf = target.posZ; + + double xi = this.entityHost.posX; + double yi = this.entityHost.posY; + double zi = this.entityHost.posZ; + return (xi - xf) * (xi - xf) + (yi - yf) * (yi - yf) + (zi - zf) * (zi - zf) >= range * range; } /** * Resets the task */ - public void resetTask() - { + public void resetTask() { this.attackTarget = null; this.field_75318_f = 0; this.rangedAttackTime = -1; @@ -108,59 +105,49 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase /** * Updates the task */ - public void updateTask() - { - double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ); + public void updateTask() { + double d0 = this.entityHost.getDistanceSq( + this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ); boolean flag = this.entityHost.getEntitySenses().canSee(this.attackTarget); - if (flag) - { + if (flag) { ++this.field_75318_f; - } - else - { + } else { this.field_75318_f = 0; } - if (d0 <= (double)this.field_82642_h && this.field_75318_f >= 20) - { + if (d0 <= (double) this.field_82642_h && this.field_75318_f >= 20) { this.entityHost.getNavigator().clearPathEntity(); - } - else - { + } else { this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed); } this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F); float f; - if (--this.rangedAttackTime == 0) - { - if (d0 > (double)this.field_82642_h || !flag) - { + if (--this.rangedAttackTime == 0) { + if (d0 > (double) this.field_82642_h || !flag) { return; } f = MathHelper.sqrt_double(d0) / this.field_96562_i; float f1 = f; - if (f < 0.1F) - { + if (f < 0.1F) { f1 = 0.1F; } - if (f1 > 1.0F) - { + if (f1 > 1.0F) { f1 = 1.0F; } this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, f1); - this.rangedAttackTime = MathHelper.floor_float(f * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g); - } - else if (this.rangedAttackTime < 0) - { + this.rangedAttackTime = MathHelper.floor_float( + f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); + } else if (this.rangedAttackTime < 0) { f = MathHelper.sqrt_double(d0) / this.field_96562_i; - this.rangedAttackTime = MathHelper.floor_float(f * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g); + this.rangedAttackTime = MathHelper.floor_float( + f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java index 147ddd73..68d48d5c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java @@ -1,62 +1,61 @@ package WayofTime.alchemicalWizardry.common.demonVillage.ai; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.ai.EntityAIHurtByTarget; -import net.minecraft.tileentity.TileEntity; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.tileentity.TileEntity; -public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget -{ - boolean entityCallsForHelp; +public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget { + boolean entityCallsForHelp; - public EntityDemonAIHurtByTarget(EntityCreature demon, boolean callsForHelp) - { - super(demon, callsForHelp); - this.entityCallsForHelp = callsForHelp; - } + public EntityDemonAIHurtByTarget(EntityCreature demon, boolean callsForHelp) { + super(demon, callsForHelp); + this.entityCallsForHelp = callsForHelp; + } + + @Override + public void startExecuting() { + Int3 portalPosition = ((IHoardDemon) this.taskOwner).getPortalLocation(); + if (portalPosition == null) { + super.startExecuting(); + return; + } + + TileEntity portal = this.taskOwner.worldObj.getTileEntity( + portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord); + + if ((this.taskOwner.getAITarget() instanceof IHoardDemon + && portalPosition.equals(((IHoardDemon) this.taskOwner.getAITarget()).getPortalLocation()))) { + return; + } - @Override - public void startExecuting() - { - Int3 portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation(); - if(portalPosition == null) - { - super.startExecuting(); - return; - } - - TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord); - - if((this.taskOwner.getAITarget() instanceof IHoardDemon && portalPosition.equals(((IHoardDemon)this.taskOwner.getAITarget()).getPortalLocation()))) - { - return; - } - this.taskOwner.setAttackTarget(this.taskOwner.getAITarget()); - if (this.entityCallsForHelp && this.taskOwner instanceof IHoardDemon) - { - - if(portal instanceof TEDemonPortal) - { - ((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget(), 25); - } - -// 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)); -// Iterator iterator = list.iterator(); -// -// while (iterator.hasNext()) -// { -// EntityCreature entitycreature = (EntityCreature)iterator.next(); -// -// if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget())) -// { -// entitycreature.setAttackTarget(this.taskOwner.getAITarget()); -// } -// } + if (this.entityCallsForHelp && this.taskOwner instanceof IHoardDemon) { + + if (portal instanceof TEDemonPortal) { + ((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget(), 25); + } + + // 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)); + // Iterator iterator = list.iterator(); + // + // while (iterator.hasNext()) + // { + // EntityCreature entitycreature = (EntityCreature)iterator.next(); + // + // if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && + // !entitycreature.isOnSameTeam(this.taskOwner.getAITarget())) + // { + // entitycreature.setAttackTarget(this.taskOwner.getAITarget()); + // } + // } } super.startExecuting(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/IOccasionalRangedAttackMob.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/IOccasionalRangedAttackMob.java index 958575d6..b66075e3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/IOccasionalRangedAttackMob.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/IOccasionalRangedAttackMob.java @@ -2,7 +2,6 @@ package WayofTime.alchemicalWizardry.common.demonVillage.ai; import net.minecraft.entity.IRangedAttackMob; -public interface IOccasionalRangedAttackMob extends IRangedAttackMob -{ - boolean shouldUseRangedAttack(); +public interface IOccasionalRangedAttackMob extends IRangedAttackMob { + boolean shouldUseRangedAttack(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java index ba35ddde..99aa2505 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java @@ -3,16 +3,20 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import net.minecraft.world.World; -public abstract class DemonHoardPacket -{ - public DemonHoardPacket() - { - - } - - public abstract int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian); - - public abstract boolean canFitType(DemonType type); - - public abstract float getRelativeChance(DemonType type, int tier, boolean spawnGuardian); +public abstract class DemonHoardPacket { + public DemonHoardPacket() {} + + public abstract int summonDemons( + TEDemonPortal teDemonPortal, + World world, + int x, + int y, + int z, + DemonType type, + int tier, + boolean spawnGuardian); + + public abstract boolean canFitType(DemonType type); + + public abstract float getRelativeChance(DemonType type, int tier, boolean spawnGuardian); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketMinorGrunt.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketMinorGrunt.java index cfd0ade8..4b7937e3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketMinorGrunt.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketMinorGrunt.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire; @@ -12,87 +11,80 @@ import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityM import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; +import net.minecraft.world.World; -public class DemonPacketMinorGrunt extends DemonHoardPacket -{ - @Override - public boolean canFitType(DemonType type) - { - return true; - } +public class DemonPacketMinorGrunt extends DemonHoardPacket { + @Override + public boolean canFitType(DemonType type) { + return true; + } - @Override - public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian) - { - return 1.0f; - } + @Override + public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian) { + return 1.0f; + } - @Override - public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian) - { - EntityMinorDemonGrunt entity; + @Override + public int summonDemons( + TEDemonPortal teDemonPortal, + World world, + int x, + int y, + int z, + DemonType type, + int tier, + boolean spawnGuardian) { + EntityMinorDemonGrunt entity; - { - switch(type) - { - case FIRE: - if(spawnGuardian) - { - entity = new EntityMinorDemonGruntGuardianFire(world); - }else - { - entity = new EntityMinorDemonGruntFire(world); - } - break; - case ICE: - if(spawnGuardian) - { - entity = new EntityMinorDemonGruntGuardianIce(world); - }else - { - entity = new EntityMinorDemonGruntIce(world); - } - break; - case EARTH: - if(spawnGuardian) - { - entity = new EntityMinorDemonGruntGuardianEarth(world); - }else - { - entity = new EntityMinorDemonGruntEarth(world); - } - break; - case WIND: - if(spawnGuardian) - { - entity = new EntityMinorDemonGruntGuardianWind(world); - }else - { - entity = new EntityMinorDemonGruntWind(world); - } - break; - case NORMAL: - default: - if(spawnGuardian) - { - entity = new EntityMinorDemonGruntGuardian(world); - }else - { - entity = new EntityMinorDemonGrunt(world); - } - break; - - } - } - - entity.setPosition(x, y, z); - - world.spawnEntityInWorld(entity); - - teDemonPortal.enthrallDemon(entity); - entity.setAggro(true); - entity.setDropCrystal(false); - - return spawnGuardian ? 3 : 1; - } + { + switch (type) { + case FIRE: + if (spawnGuardian) { + entity = new EntityMinorDemonGruntGuardianFire(world); + } else { + entity = new EntityMinorDemonGruntFire(world); + } + break; + case ICE: + if (spawnGuardian) { + entity = new EntityMinorDemonGruntGuardianIce(world); + } else { + entity = new EntityMinorDemonGruntIce(world); + } + break; + case EARTH: + if (spawnGuardian) { + entity = new EntityMinorDemonGruntGuardianEarth(world); + } else { + entity = new EntityMinorDemonGruntEarth(world); + } + break; + case WIND: + if (spawnGuardian) { + entity = new EntityMinorDemonGruntGuardianWind(world); + } else { + entity = new EntityMinorDemonGruntWind(world); + } + break; + case NORMAL: + default: + if (spawnGuardian) { + entity = new EntityMinorDemonGruntGuardian(world); + } else { + entity = new EntityMinorDemonGrunt(world); + } + break; + } + } + + entity.setPosition(x, y, z); + + world.spawnEntityInWorld(entity); + + teDemonPortal.enthrallDemon(entity); + entity.setAggro(true); + entity.setDropCrystal(false); + + return spawnGuardian ? 3 : 1; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java index fd193f95..71c5948d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java @@ -1,81 +1,93 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; - -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import net.minecraft.world.World; -public class DemonPacketRegistry -{ - public static Map packetMap = new HashMap(); - - public static boolean registerDemonPacket(String string, DemonHoardPacket packet) - { - if(!packetMap.containsValue(string) && packet != null) - { - packetMap.put(string, packet); - - return true; - } - - return false; - } - - public static String getDemonPacketName(DemonType type, int tier, boolean spawnGuardian) - { - float totalChance = 0; - - for(Entry entry : packetMap.entrySet()) - { - DemonHoardPacket packet = entry.getValue(); - - if(packet == null) - { - continue; - } - - totalChance += packet.getRelativeChance(type, tier, spawnGuardian); - } - - for(Entry entry : packetMap.entrySet()) - { - DemonHoardPacket packet = entry.getValue(); - - if(packet == null) - { - continue; - } - - float relativeChance = packet.getRelativeChance(type, tier, spawnGuardian); - - if(relativeChance >= totalChance) - { - return entry.getKey(); - }else - { - totalChance -= relativeChance; - } - } - - return ""; - } - - public static int spawnDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian) - { - return spawnDemons(teDemonPortal, world, x, y, z, getDemonPacketName(type, tier, spawnGuardian), type, tier, spawnGuardian); - } - - public static int spawnDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, String name, DemonType type, int tier, boolean spawnGuardian) - { - DemonHoardPacket packet = packetMap.get(name); - - if(packet != null) - { - return packet.summonDemons(teDemonPortal, world, x, y, z, type, tier, spawnGuardian); - } - - return 0; - } -} \ No newline at end of file +public class DemonPacketRegistry { + public static Map packetMap = new HashMap(); + + public static boolean registerDemonPacket(String string, DemonHoardPacket packet) { + if (!packetMap.containsValue(string) && packet != null) { + packetMap.put(string, packet); + + return true; + } + + return false; + } + + public static String getDemonPacketName(DemonType type, int tier, boolean spawnGuardian) { + float totalChance = 0; + + for (Entry entry : packetMap.entrySet()) { + DemonHoardPacket packet = entry.getValue(); + + if (packet == null) { + continue; + } + + totalChance += packet.getRelativeChance(type, tier, spawnGuardian); + } + + for (Entry entry : packetMap.entrySet()) { + DemonHoardPacket packet = entry.getValue(); + + if (packet == null) { + continue; + } + + float relativeChance = packet.getRelativeChance(type, tier, spawnGuardian); + + if (relativeChance >= totalChance) { + return entry.getKey(); + } else { + totalChance -= relativeChance; + } + } + + return ""; + } + + public static int spawnDemons( + TEDemonPortal teDemonPortal, + World world, + int x, + int y, + int z, + DemonType type, + int tier, + boolean spawnGuardian) { + return spawnDemons( + teDemonPortal, + world, + x, + y, + z, + getDemonPacketName(type, tier, spawnGuardian), + type, + tier, + spawnGuardian); + } + + public static int spawnDemons( + TEDemonPortal teDemonPortal, + World world, + int x, + int y, + int z, + String name, + DemonType type, + int tier, + boolean spawnGuardian) { + DemonHoardPacket packet = packetMap.get(name); + + if (packet != null) { + return packet.summonDemons(teDemonPortal, world, x, y, z, type, tier, spawnGuardian); + } + + return 0; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonType.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonType.java index 75c5aed4..e031685f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonType.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonType.java @@ -1,10 +1,9 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard; -public enum DemonType -{ - NORMAL, - FIRE, - EARTH, - ICE, - WIND +public enum DemonType { + NORMAL, + FIRE, + EARTH, + ICE, + WIND } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java index c507d72a..efecbfeb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java @@ -1,5 +1,19 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.Int3; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage; +import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking; +import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityAIOccasionalRangedAttack; +import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityDemonAIHurtByTarget; +import WayofTime.alchemicalWizardry.common.demonVillage.ai.IOccasionalRangedAttackMob; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon; +import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile; +import WayofTime.alchemicalWizardry.common.rituals.LocalStorageAlphaPact; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; @@ -22,36 +36,22 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage; -import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking; -import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityAIOccasionalRangedAttack; -import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityDemonAIHurtByTarget; -import WayofTime.alchemicalWizardry.common.demonVillage.ai.IOccasionalRangedAttackMob; -import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; -import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon; -import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile; -import WayofTime.alchemicalWizardry.common.rituals.LocalStorageAlphaPact; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRangedAttackMob, IHoardDemon -{ - private EntityAIOccasionalRangedAttack aiArrowAttack = new EntityAIOccasionalRangedAttack(this, 1.0D, 40, 40, 15.0F, 5); - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); +public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRangedAttackMob, IHoardDemon { + private EntityAIOccasionalRangedAttack aiArrowAttack = + new EntityAIOccasionalRangedAttack(this, 1.0D, 40, 40, 15.0F, 5); + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private boolean isAngry = true; private Int3 demonPortal; - + private static float maxTamedHealth = 200.0F; private static float maxUntamedHealth = 200.0F; - + private boolean enthralled = false; - public EntityMinorDemonGrunt(World par1World) - { + public EntityMinorDemonGrunt(World par1World) { super(par1World, AlchemicalWizardry.entityMinorDemonGruntID); this.setSize(0.7F, 1.8F); this.getNavigator().setAvoidsWater(true); @@ -67,98 +67,82 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan this.targetTasks.addTask(4, new EntityAITargetAggroCloaking(this, EntityPlayer.class, 0, false, 0)); this.setAggro(false); this.setTamed(false); - - demonPortal = new Int3(0,0,0); - if (par1World != null && !par1World.isRemote) - { + demonPortal = new Int3(0, 0, 0); + + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } - //this.isImmuneToFire = true; + // this.isImmuneToFire = true; } - public boolean isTameable() - { - return false; + public boolean isTameable() { + return false; } - + @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - if (this.isTamed()) - { + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } - + @Override - protected void dropFewItems(boolean par1, int par2) - { - if(!this.getDoesDropCrystal()) - { - ItemStack lifeShardStack = new ItemStack(ModItems.baseItems, 1, 28); + protected void dropFewItems(boolean par1, int par2) { + if (!this.getDoesDropCrystal()) { + ItemStack lifeShardStack = new ItemStack(ModItems.baseItems, 1, 28); ItemStack soulShardStack = new ItemStack(ModItems.baseItems, 1, 29); - + int dropAmount = 0; - - for(int i=0; i<=par2; i++) - { - dropAmount += this.worldObj.rand.nextFloat() < 0.6f ? 1 : 0; + + for (int i = 0; i <= par2; i++) { + dropAmount += this.worldObj.rand.nextFloat() < 0.6f ? 1 : 0; } - + ItemStack drop = this.worldObj.rand.nextBoolean() ? lifeShardStack : soulShardStack; drop.stackSize = dropAmount; - if(dropAmount > 0) - { + if (dropAmount > 0) { this.entityDropItem(drop, 0.0f); } - }else - { - super.dropFewItems(par1, par2); - } + } else { + super.dropFewItems(par1, par2); + } } - + @Override - public void setPortalLocation(Int3 position) - { - this.demonPortal = position; + public void setPortalLocation(Int3 position) { + this.demonPortal = position; } - + @Override - public Int3 getPortalLocation() - { - return this.demonPortal; + public Int3 getPortalLocation() { + return this.demonPortal; } /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -166,21 +150,20 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan /** * main AI tick function, replaces updateEntityActionState */ -// @Override -// protected void updateAITick() -// { -// this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); -// } + // @Override + // protected void updateAITick() + // { + // this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); + // } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); - + this.demonPortal.writeToNBT(par1NBTTagCompound); } @@ -188,12 +171,11 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); this.demonPortal = Int3.readFromNBT(par1NBTTagCompound); - + this.setCombatTask(); } @@ -201,9 +183,8 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * Returns the sound this mob makes while it's alive. */ @Override - protected String getLivingSound() - { - //TODO change sounds + protected String getLivingSound() { + // TODO change sounds return "none"; } @@ -211,8 +192,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * Returns the sound this mob makes when it is hurt. */ @Override - protected String getHurtSound() - { + protected String getHurtSound() { return "none"; } @@ -220,8 +200,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * Returns the sound this mob makes on death. */ @Override - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.wolf.death"; } @@ -229,8 +208,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * Returns the volume for the sounds this mob makes. */ @Override - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } @@ -239,8 +217,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * use this to react to sunlight and start to burn. */ @Override - public void onLivingUpdate() - { + public void onLivingUpdate() { super.onLivingUpdate(); } @@ -248,33 +225,28 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { - if(!this.enthralled) - { - TileEntity tile = this.worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord); - if(tile instanceof TEDemonPortal) - { - ((TEDemonPortal) tile).enthrallDemon(this); - this.enthralled = true; - }else if(tile instanceof IMasterRitualStone) - { - IMasterRitualStone stone = (IMasterRitualStone)tile; - LocalRitualStorage stor = stone.getLocalStorage(); - if(stor instanceof LocalStorageAlphaPact) - { - LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor; - - storage.thrallDemon(this); - } + public void onUpdate() { + if (!this.enthralled) { + TileEntity tile = this.worldObj.getTileEntity( + this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord); + if (tile instanceof TEDemonPortal) { + ((TEDemonPortal) tile).enthrallDemon(this); + this.enthralled = true; + } else if (tile instanceof IMasterRitualStone) { + IMasterRitualStone stone = (IMasterRitualStone) tile; + LocalRitualStorage stor = stone.getLocalStorage(); + if (stor instanceof LocalStorageAlphaPact) { + LocalStorageAlphaPact storage = (LocalStorageAlphaPact) stor; + + storage.thrallDemon(this); + } } - } + } super.onUpdate(); } @Override - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -283,21 +255,17 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * use in wolves. */ @Override - public int getVerticalFaceSpeed() - { + public int getVerticalFaceSpeed() { return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); } @Override - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -306,30 +274,25 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -337,10 +300,11 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -350,22 +314,20 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (this.isTameable() && itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (this.isTameable() + && itemstack != null + && itemstack.getItem().equals(ModItems.weakBloodOrb) + && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -374,8 +336,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -387,46 +348,38 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan return super.interact(par1EntityPlayer); } - - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * Determines whether this wolf is angry or not. */ - public boolean isAngry() - { + public boolean isAngry() { return this.isAngry; } /** * Sets whether this wolf is angry or not. */ - public void setAngry(boolean angry) - { + public void setAngry(boolean angry) { this.isAngry = angry; } - /** * Returns true if the mob is currently able to mate with the specified mob. */ @Override - public boolean canMateWith(EntityAnimal par1EntityAnimal) - { + public boolean canMateWith(EntityAnimal par1EntityAnimal) { return false; } - /** * Determines if an entity can be despawned, used on idle far away entities */ @Override - protected boolean canDespawn() - { - //return !this.isTamed() && this.ticksExisted > 2400; + protected boolean canDespawn() { + // return !this.isTamed() && this.ticksExisted > 2400; return false; } @@ -434,49 +387,45 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan * A call to determine if this entity should attack the other entity */ @Override - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityDemon) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityDemon) { EntityDemon entitywolf = (EntityDemon) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } @Override - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 20 : 20; - - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - + /** * Attack the specified entity using a ranged attack. */ @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600); this.worldObj.spawnEntityInWorld(hol); @@ -485,33 +434,32 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiArrowAttack); this.tasks.addTask(4, this.aiArrowAttack); this.tasks.addTask(5, this.aiAttackOnCollide); } - @Override - public boolean shouldUseRangedAttack() - { - return true; - } + @Override + public boolean shouldUseRangedAttack() { + return true; + } - @Override - public boolean thrallDemon(Int3 location) - { - this.setPortalLocation(location); - return true; - } + @Override + public boolean thrallDemon(Int3 location) { + this.setPortalLocation(location); + return true; + } - @Override - public boolean isSamePortal(IHoardDemon demon) - { - Int3 position = demon.getPortalLocation(); - TileEntity portal = worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord); - - return portal instanceof TEDemonPortal ? portal == worldObj.getTileEntity(position.xCoord, position.yCoord, position.zCoord) : false; - } + @Override + public boolean isSamePortal(IHoardDemon demon) { + Int3 position = demon.getPortalLocation(); + TileEntity portal = + worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord); + + return portal instanceof TEDemonPortal + ? portal == worldObj.getTileEntity(position.xCoord, position.yCoord, position.zCoord) + : false; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntEarth.java index cf33c1f1..c702dc4c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntEarth.java @@ -1,47 +1,41 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile; -public class EntityMinorDemonGruntEarth extends EntityMinorDemonGrunt -{ - public EntityMinorDemonGruntEarth(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntEarthID); - } - - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { +public class EntityMinorDemonGruntEarth extends EntityMinorDemonGrunt { + public EntityMinorDemonGruntEarth(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntEarthID); + } + + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 20 : 20; - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - - if(par1Entity instanceof EntityLivingBase) - { - ((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2)); + + if (par1Entity instanceof EntityLivingBase) { + ((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2)); } - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } - ExplosionProjectile hol = new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600, false); + ExplosionProjectile hol = + new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600, false); this.worldObj.spawnEntityInWorld(hol); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntFire.java index b7b58e5a..bffcf15c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntFire.java @@ -1,41 +1,35 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile; -public class EntityMinorDemonGruntFire extends EntityMinorDemonGrunt -{ - public EntityMinorDemonGruntFire(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntFireID); - this.isImmuneToFire = true; - } - - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { +public class EntityMinorDemonGruntFire extends EntityMinorDemonGrunt { + public EntityMinorDemonGruntFire(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntFireID); + this.isImmuneToFire = true; + } + + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 20 : 20; - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - + par1Entity.setFire(10); - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600); this.worldObj.spawnEntityInWorld(hol); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardian.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardian.java index ac38f3c5..a7fcf2be 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardian.java @@ -7,36 +7,30 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityMinorDemonGruntGuardian extends EntityMinorDemonGrunt -{ - public EntityMinorDemonGruntGuardian(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianID); - } +public class EntityMinorDemonGruntGuardian extends EntityMinorDemonGrunt { + public EntityMinorDemonGruntGuardian(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianID); + } - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 25 : 25; - - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - + /** * Attack the specified entity using a ranged attack. */ @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600); this.worldObj.spawnEntityInWorld(hol); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianEarth.java index a055ebb1..0cbdfbc5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianEarth.java @@ -1,51 +1,45 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile; -public class EntityMinorDemonGruntGuardianEarth extends EntityMinorDemonGruntGuardian -{ - public EntityMinorDemonGruntGuardianEarth(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianEarthID); - } +public class EntityMinorDemonGruntGuardianEarth extends EntityMinorDemonGruntGuardian { + public EntityMinorDemonGruntGuardianEarth(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianEarthID); + } - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 25 : 25; - - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - - if(par1Entity instanceof EntityLivingBase) - { - ((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 4)); + + if (par1Entity instanceof EntityLivingBase) { + ((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 4)); } - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - + /** * Attack the specified entity using a ranged attack. */ @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } - ExplosionProjectile hol = new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600, false); + ExplosionProjectile hol = + new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600, false); this.worldObj.spawnEntityInWorld(hol); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianFire.java index 8e502f5f..c0690482 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianFire.java @@ -1,45 +1,39 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile; -public class EntityMinorDemonGruntGuardianFire extends EntityMinorDemonGruntGuardian -{ - public EntityMinorDemonGruntGuardianFire(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianFireID); - this.isImmuneToFire = true; - } +public class EntityMinorDemonGruntGuardianFire extends EntityMinorDemonGruntGuardian { + public EntityMinorDemonGruntGuardianFire(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianFireID); + this.isImmuneToFire = true; + } - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 25 : 25; - - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - + par1Entity.setFire(15); - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - + /** * Attack the specified entity using a ranged attack. */ @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600); this.worldObj.spawnEntityInWorld(hol); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianIce.java index ea35c250..fd67cfde 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianIce.java @@ -1,42 +1,36 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; -public class EntityMinorDemonGruntGuardianIce extends EntityMinorDemonGruntGuardian -{ - public EntityMinorDemonGruntGuardianIce(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianIceID); - } +public class EntityMinorDemonGruntGuardianIce extends EntityMinorDemonGruntGuardian { + public EntityMinorDemonGruntGuardianIce(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianIceID); + } - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 25 : 25; - - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - + /** * Attack the specified entity using a ranged attack. */ @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600); this.worldObj.spawnEntityInWorld(hol); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianWind.java index 86cd67d3..1aa4d8d3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntGuardianWind.java @@ -1,59 +1,51 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class EntityMinorDemonGruntGuardianWind extends EntityMinorDemonGruntGuardian -{ - public EntityMinorDemonGruntGuardianWind(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianWindID); - } +public class EntityMinorDemonGruntGuardianWind extends EntityMinorDemonGruntGuardian { + public EntityMinorDemonGruntGuardianWind(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianWindID); + } - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 25 : 25; - - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - - if (par1Entity instanceof EntityPlayer) - { - SpellHelper.setPlayerSpeedFromServer((EntityPlayer) par1Entity, par1Entity.motionX, par1Entity.motionY + 4, par1Entity.motionZ); - } else if (par1Entity instanceof EntityLivingBase) - { + + if (par1Entity instanceof EntityPlayer) { + SpellHelper.setPlayerSpeedFromServer( + (EntityPlayer) par1Entity, par1Entity.motionX, par1Entity.motionY + 4, par1Entity.motionZ); + } else if (par1Entity instanceof EntityLivingBase) { ((EntityLivingBase) par1Entity).motionY += 4.0D; } - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - - @Override - public void onLivingUpdate() - { - super.onLivingUpdate(); - this.fallDistance = 0; - } - + + @Override + public void onLivingUpdate() { + super.onLivingUpdate(); + this.fallDistance = 0; + } + /** * Attack the specified entity using a ranged attack. */ @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } WindGustProjectile hol = new WindGustProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600); this.worldObj.spawnEntityInWorld(hol); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntIce.java index cff401ed..14770d71 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntIce.java @@ -1,38 +1,32 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; -public class EntityMinorDemonGruntIce extends EntityMinorDemonGrunt -{ - public EntityMinorDemonGruntIce(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntIceID); - } - - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { +public class EntityMinorDemonGruntIce extends EntityMinorDemonGrunt { + public EntityMinorDemonGruntIce(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntIceID); + } + + @Override + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 20 : 20; - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; } - + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600); this.worldObj.spawnEntityInWorld(hol); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java index 488ae144..1645276c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java @@ -1,55 +1,47 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt -{ - public EntityMinorDemonGruntWind(World par1World) - { - super(par1World); - this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntWindID); - } - - @Override - public boolean attackEntityAsMob(Entity par1Entity) - { - int i = this.isTamed() ? 20 : 20; - if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) - { - return false; - } - - if (par1Entity instanceof EntityPlayer) - { - SpellHelper.setPlayerSpeedFromServer((EntityPlayer) par1Entity, par1Entity.motionX, par1Entity.motionY + 3, par1Entity.motionZ); - } else if (par1Entity instanceof EntityLivingBase) - { - ((EntityLivingBase) par1Entity).motionY += 3.0D; - } - - return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); +public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt { + public EntityMinorDemonGruntWind(World par1World) { + super(par1World); + this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntWindID); } - - @Override - public void onLivingUpdate() - { - super.onLivingUpdate(); - this.fallDistance = 0; - } @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { - if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) - { - return; + public boolean attackEntityAsMob(Entity par1Entity) { + int i = this.isTamed() ? 20 : 20; + if (par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this)) { + return false; + } + + if (par1Entity instanceof EntityPlayer) { + SpellHelper.setPlayerSpeedFromServer( + (EntityPlayer) par1Entity, par1Entity.motionX, par1Entity.motionY + 3, par1Entity.motionZ); + } else if (par1Entity instanceof EntityLivingBase) { + ((EntityLivingBase) par1Entity).motionY += 3.0D; + } + + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); + } + + @Override + public void onLivingUpdate() { + super.onLivingUpdate(); + this.fallDistance = 0; + } + + @Override + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + if (par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this)) { + return; } WindGustProjectile hol = new WindGustProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600); this.worldObj.spawnEntityInWorld(hol); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/IHoardDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/IHoardDemon.java index 7f9f2660..1b1367dc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/IHoardDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/IHoardDemon.java @@ -2,10 +2,12 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon; import WayofTime.alchemicalWizardry.api.Int3; -public interface IHoardDemon -{ - void setPortalLocation(Int3 position); +public interface IHoardDemon { + void setPortalLocation(Int3 position); + Int3 getPortalLocation(); + boolean thrallDemon(Int3 location); + boolean isSamePortal(IHoardDemon demon); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/loot/DemonVillageLootRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/loot/DemonVillageLootRegistry.java index a501269b..5134e82b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/loot/DemonVillageLootRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/loot/DemonVillageLootRegistry.java @@ -1,49 +1,42 @@ package WayofTime.alchemicalWizardry.common.demonVillage.loot; +import WayofTime.alchemicalWizardry.ModItems; import java.util.ArrayList; import java.util.List; import java.util.Random; - import net.minecraft.inventory.IInventory; import net.minecraft.util.WeightedRandomChestContent; import net.minecraftforge.common.ChestGenHooks; -import WayofTime.alchemicalWizardry.ModItems; -public class DemonVillageLootRegistry -{ - public static ArrayList list1 = new ArrayList(); - - public static void init() - { - String[] tier1Strings = new String[]{ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST}; - for(String str : tier1Strings) - { - WeightedRandomChestContent[] contents = ChestGenHooks.getItems(str, new Random()); - if(contents != null) - { - for(WeightedRandomChestContent content : contents) - { - list1.add(content); - } - } - } - - list1.add(new WeightedRandomChestContent(ModItems.baseItems, 28, 1, 2, 5)); - list1.add(new WeightedRandomChestContent(ModItems.baseItems, 29, 1, 2, 5)); - } - - public static void populateChest(IInventory tile, int tier) - { - WeightedRandomChestContent.generateChestContents(new Random(), toArray(list1), tile, tile.getSizeInventory() / 3); - } - - public static WeightedRandomChestContent[] toArray(List aList) - { - int size = aList.size(); - WeightedRandomChestContent[] contents = new WeightedRandomChestContent[size]; - - contents = aList.toArray(contents); - - return contents; - } +public class DemonVillageLootRegistry { + public static ArrayList list1 = new ArrayList(); + + public static void init() { + String[] tier1Strings = new String[] {ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST}; + for (String str : tier1Strings) { + WeightedRandomChestContent[] contents = ChestGenHooks.getItems(str, new Random()); + if (contents != null) { + for (WeightedRandomChestContent content : contents) { + list1.add(content); + } + } + } + + list1.add(new WeightedRandomChestContent(ModItems.baseItems, 28, 1, 2, 5)); + list1.add(new WeightedRandomChestContent(ModItems.baseItems, 29, 1, 2, 5)); + } + + public static void populateChest(IInventory tile, int tier) { + WeightedRandomChestContent.generateChestContents( + new Random(), toArray(list1), tile, tile.getSizeInventory() / 3); + } + + public static WeightedRandomChestContent[] toArray(List aList) { + int size = aList.size(); + WeightedRandomChestContent[] contents = new WeightedRandomChestContent[size]; + + contents = aList.toArray(contents); + + return contents; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java index eec54945..abb6d930 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/BlockDemonChest.java @@ -1,46 +1,39 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; import net.minecraft.block.Block; import net.minecraft.block.BlockChest; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -public class BlockDemonChest extends BlockChest implements IBlockPortalNode -{ - public BlockDemonChest() - { - super(0); - this.setHardness(2.5F).setStepSound(soundTypeWood).setBlockName("demonChest"); - this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); - } - - public IInventory func_149951_m(World world, int x, int y, int z) - { - return (IInventory)world.getTileEntity(x, y, z); +public class BlockDemonChest extends BlockChest implements IBlockPortalNode { + public BlockDemonChest() { + super(0); + this.setHardness(2.5F).setStepSound(soundTypeWood).setBlockName("demonChest"); + this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); } - - @Override - public TileEntity createNewTileEntity(World var1, int var2) - { + + public IInventory func_149951_m(World world, int x, int y, int z) { + return (IInventory) world.getTileEntity(x, y, z); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { return new TEDemonChest(); } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TEDemonChest) - { - ((TEDemonChest) tile).notifyPortalOfInteraction(); - } - super.breakBlock(world, x, y, z, block, meta); - } - - @Override - public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) - { - return true; - } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof TEDemonChest) { + ((TEDemonChest) tile).notifyPortalOfInteraction(); + } + super.breakBlock(world, x, y, z, block, meta); + } + + @Override + public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { + return true; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IBlockPortalNode.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IBlockPortalNode.java index 8b1595dc..38ed2306 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IBlockPortalNode.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IBlockPortalNode.java @@ -1,6 +1,3 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity; -public interface IBlockPortalNode -{ - -} +public interface IBlockPortalNode {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IRoadWard.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IRoadWard.java index 09ce6e85..cf18e266 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IRoadWard.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/IRoadWard.java @@ -1,6 +1,3 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity; -public interface IRoadWard -{ - -} +public interface IRoadWard {} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/ITilePortalNode.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/ITilePortalNode.java index 2771254d..5b1f69bc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/ITilePortalNode.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/ITilePortalNode.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity; -public interface ITilePortalNode -{ - void setPortalLocation(TEDemonPortal teDemonPortal); +public interface ITilePortalNode { + void setPortalLocation(TEDemonPortal teDemonPortal); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonChest.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonChest.java index a1d4fd88..e754df23 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonChest.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonChest.java @@ -1,76 +1,62 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity; +import WayofTime.alchemicalWizardry.api.Int3; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -import WayofTime.alchemicalWizardry.api.Int3; -public class TEDemonChest extends TileEntityChest implements ITilePortalNode -{ - public Int3 portalLocation = new Int3(0,0,0); - - @Override - public String getInventoryName() - { +public class TEDemonChest extends TileEntityChest implements ITilePortalNode { + public Int3 portalLocation = new Int3(0, 0, 0); + + @Override + public String getInventoryName() { return "Demon's Chest"; } - - @Override - public void readFromNBT(NBTTagCompound tag) - { - super.readFromNBT(tag); - NBTTagCompound portalTag = tag.getCompoundTag("portalLocation"); - portalLocation = Int3.readFromNBT(portalTag); - } - - @Override - public void writeToNBT(NBTTagCompound tag) - { - super.writeToNBT(tag); - NBTTagCompound portalTag = portalLocation.writeToNBT(new NBTTagCompound()); - tag.setTag("portalLocation", portalTag); - } - - @Override - public void openInventory() - { - super.openInventory(); - this.notifyPortalOfInteraction(); - } - - @Override - public void checkForAdjacentChests() - { - } + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + NBTTagCompound portalTag = tag.getCompoundTag("portalLocation"); + portalLocation = Int3.readFromNBT(portalTag); + } - @Override - public void setPortalLocation(TEDemonPortal teDemonPortal) - { - if(teDemonPortal != null) - { - portalLocation = new Int3(teDemonPortal.xCoord, teDemonPortal.yCoord, teDemonPortal.zCoord); - } - } - - public TEDemonPortal getDemonPortal() - { - TileEntity tile = worldObj.getTileEntity(portalLocation.xCoord, portalLocation.yCoord, portalLocation.zCoord); - if(tile instanceof TEDemonPortal) - { - return (TEDemonPortal)tile; - } - return null; - } - - public void notifyPortalOfInteraction() - { - TEDemonPortal portal = this.getDemonPortal(); - if(portal == null) - { - return; - } - - portal.notifyDemons(xCoord, yCoord, zCoord, 50); - } + @Override + public void writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + NBTTagCompound portalTag = portalLocation.writeToNBT(new NBTTagCompound()); + tag.setTag("portalLocation", portalTag); + } + + @Override + public void openInventory() { + super.openInventory(); + this.notifyPortalOfInteraction(); + } + + @Override + public void checkForAdjacentChests() {} + + @Override + public void setPortalLocation(TEDemonPortal teDemonPortal) { + if (teDemonPortal != null) { + portalLocation = new Int3(teDemonPortal.xCoord, teDemonPortal.yCoord, teDemonPortal.zCoord); + } + } + + public TEDemonPortal getDemonPortal() { + TileEntity tile = worldObj.getTileEntity(portalLocation.xCoord, portalLocation.yCoord, portalLocation.zCoord); + if (tile instanceof TEDemonPortal) { + return (TEDemonPortal) tile; + } + return null; + } + + public void notifyPortalOfInteraction() { + TEDemonPortal portal = this.getDemonPortal(); + if (portal == null) { + return; + } + + portal.notifyDemons(xCoord, yCoord, zCoord, 50); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java index 5c6f43c4..c48bb3c6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java @@ -1,30 +1,5 @@ package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Random; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.common.block.BlockTeleposer; @@ -38,20 +13,42 @@ import WayofTime.alchemicalWizardry.common.demonVillage.GridSpaceHolder; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketRegistry; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonType; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Random; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; + +public class TEDemonPortal extends TileEntity { + public DemonType type = DemonType.FIRE; + + public static boolean printDebug = false; + + public static int limit = 100; + + public static int demonLimit = 100; -public class TEDemonPortal extends TileEntity -{ - public DemonType type = DemonType.FIRE; - - public static boolean printDebug = false; - - public static int limit = 100; - - public static int demonLimit = 100; - public static int buildingGridDelay = 25; public static int roadGridDelay = 10; public static int demonHoardDelay = 40; @@ -61,16 +58,16 @@ public class TEDemonPortal extends TileEntity public static float demonHoardChance = 0.8f; public static float portalTickRate = 1f; - public static int[] tierCostList = new int[]{1500}; - + public static int[] tierCostList = new int[] {1500}; + public Set hoardList = new HashSet(); public static List buildingList = new ArrayList(); public Random rand = new Random(); private GridSpace[][] area; - private int negXRadius; //These variables indicate how much the grid has expanded from the 1x1 - private int posXRadius; //matrix in each direction + private int negXRadius; // These variables indicate how much the grid has expanded from the 1x1 + private int posXRadius; // matrix in each direction private int negZRadius; private int posZRadius; @@ -78,37 +75,32 @@ public class TEDemonPortal extends TileEntity public int houseCooldown; public int roadCooldown; - public int tier; //Tier of the demon portal - Should select buildings 2 below to this + public int tier; // Tier of the demon portal - Should select buildings 2 below to this public int demonHouseCooldown; public int demonHoardCooldown; - + public float pointPool; - + public String nextDemonPortalName = ""; public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN; - + public int buildingStage = -1; - + public int delayBeforeParty = 0; - + public int lockdownTimer; - public TEDemonPortal() - { + public TEDemonPortal() { super(); negXRadius = posXRadius = negZRadius = posZRadius = 1; area = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 1]; - for (int xIndex = -negXRadius; xIndex <= posXRadius; xIndex++) - { - for (int zIndex = -negZRadius; zIndex <= posZRadius; zIndex++) - { - if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1) - { + for (int xIndex = -negXRadius; xIndex <= posXRadius; xIndex++) { + for (int zIndex = -negZRadius; zIndex <= posZRadius; zIndex++) { + if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1) { this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, 4)); - } else - { + } else { this.setGridSpace(xIndex, zIndex, new GridSpace()); } } @@ -123,195 +115,154 @@ public class TEDemonPortal extends TileEntity this.tier = 0; this.lockdownTimer = 0; } - - public boolean isLockedDown() - { - return this.lockdownTimer > 0; - } - - public float getRoadChance() - { - if(isLockedDown()) - { - return 0; - } - return demonRoadChance; - } - - public float getHouseChance() - { - if(isLockedDown()) - { - return 0; - } - return demonHouseChance; - } - - public float getDemonPortalChance() - { - if(isLockedDown()) - { - return 0; - } - return demonPortalChance; - } - - public float getDemonHoardChance() - { - return demonHoardChance; - } - - public boolean decreaseRandomCooldown(int amount) - { - float totalChance = 0; - Map map = new HashMap(); - map.put("roadChance", this.getRoadChance()); - map.put("houseChance", this.getHouseChance()); - map.put("demonPortalChance", this.getDemonPortalChance()); - map.put("demonHoardChance", this.getDemonHoardChance()); - - String action = ""; - - for(Entry entry : map.entrySet()) - { - totalChance += entry.getValue(); - } - - float pointer = rand.nextFloat() * totalChance; - - for(Entry entry : map.entrySet()) - { - float value = entry.getValue(); - if(pointer <= value) - { - action = entry.getKey(); - break; - }else - { - pointer -= value; - } - } - - if(action.equals("roadChance")) - { - if(roadCooldown > 0) - { - roadCooldown -= amount; - }else - { - return false; - } - }else if(action.equals("houseChance")) - { - if(houseCooldown > 0) - { - houseCooldown -= amount; - }else - { - return false; - } - }else if(action.equals("demonPortalChance")) - { - demonHouseCooldown += amount; - }else if(action.equals("demonHoardChance")) - { - if(demonHoardCooldown > 0) - { - demonHoardCooldown -= amount; - }else - { - return false; - } - } - - return true; - } - - public void notifyDemons(EntityLivingBase demon, EntityLivingBase target, double radius) //TODO - { - this.lockdownTimer = 1000; - for(IHoardDemon thrallDemon : this.hoardList) - { - if(thrallDemon instanceof EntityCreature) - { - if(thrallDemon != demon && ((EntityCreature) thrallDemon).getAttackTarget() == null && !((EntityCreature) thrallDemon).isOnSameTeam(target)) - { - double xf = demon.posX; - double yf = demon.posY; - double zf = demon.posZ; - - double xi = ((EntityCreature) thrallDemon).posX; - double yi = ((EntityCreature) thrallDemon).posY; - double zi = ((EntityCreature) thrallDemon).posZ; - - if((xi-xf)*(xi-xf) + (yi-yf)*(yi-yf) + (zi-zf)*(zi-zf) <= radius*radius) - { - ((EntityCreature) thrallDemon).setAttackTarget(target); - }else - { - ((EntityCreature) thrallDemon).getNavigator().tryMoveToEntityLiving(target, 2); - } - } - } - } - } - - public void notifyDemons(int xf, int yf, int zf, double radius) - { - for(IHoardDemon thrallDemon : this.hoardList) - { - if(thrallDemon instanceof EntityCreature) - { - if(((EntityCreature) thrallDemon).getAttackTarget() == null) - { - double xi = ((EntityCreature) thrallDemon).posX; - double yi = ((EntityCreature) thrallDemon).posY; - double zi = ((EntityCreature) thrallDemon).posZ; - - if((xi-xf)*(xi-xf) + (yi-yf)*(yi-yf) + (zi-zf)*(zi-zf) <= radius*radius) - { - ((EntityCreature) thrallDemon).getNavigator().tryMoveToXYZ(xf, yf, zf, 1); - } - } - } - } - } - - public void enthrallDemon(EntityLivingBase demon) - { - if(demon instanceof IHoardDemon) - { - boolean enthrall = ((IHoardDemon) demon).thrallDemon(new Int3(this.xCoord, this.yCoord, this.zCoord)); - if(enthrall) - { - this.hoardList.add((IHoardDemon)demon); - } - } + public boolean isLockedDown() { + return this.lockdownTimer > 0; } - public void initialize() - { - if (isInitialized) - { + public float getRoadChance() { + if (isLockedDown()) { + return 0; + } + return demonRoadChance; + } + + public float getHouseChance() { + if (isLockedDown()) { + return 0; + } + return demonHouseChance; + } + + public float getDemonPortalChance() { + if (isLockedDown()) { + return 0; + } + return demonPortalChance; + } + + public float getDemonHoardChance() { + return demonHoardChance; + } + + public boolean decreaseRandomCooldown(int amount) { + float totalChance = 0; + + Map map = new HashMap(); + map.put("roadChance", this.getRoadChance()); + map.put("houseChance", this.getHouseChance()); + map.put("demonPortalChance", this.getDemonPortalChance()); + map.put("demonHoardChance", this.getDemonHoardChance()); + + String action = ""; + + for (Entry entry : map.entrySet()) { + totalChance += entry.getValue(); + } + + float pointer = rand.nextFloat() * totalChance; + + for (Entry entry : map.entrySet()) { + float value = entry.getValue(); + if (pointer <= value) { + action = entry.getKey(); + break; + } else { + pointer -= value; + } + } + + if (action.equals("roadChance")) { + if (roadCooldown > 0) { + roadCooldown -= amount; + } else { + return false; + } + } else if (action.equals("houseChance")) { + if (houseCooldown > 0) { + houseCooldown -= amount; + } else { + return false; + } + } else if (action.equals("demonPortalChance")) { + demonHouseCooldown += amount; + } else if (action.equals("demonHoardChance")) { + if (demonHoardCooldown > 0) { + demonHoardCooldown -= amount; + } else { + return false; + } + } + + return true; + } + + public void notifyDemons(EntityLivingBase demon, EntityLivingBase target, double radius) // TODO + { + this.lockdownTimer = 1000; + for (IHoardDemon thrallDemon : this.hoardList) { + if (thrallDemon instanceof EntityCreature) { + if (thrallDemon != demon + && ((EntityCreature) thrallDemon).getAttackTarget() == null + && !((EntityCreature) thrallDemon).isOnSameTeam(target)) { + double xf = demon.posX; + double yf = demon.posY; + double zf = demon.posZ; + + double xi = ((EntityCreature) thrallDemon).posX; + double yi = ((EntityCreature) thrallDemon).posY; + double zi = ((EntityCreature) thrallDemon).posZ; + + if ((xi - xf) * (xi - xf) + (yi - yf) * (yi - yf) + (zi - zf) * (zi - zf) <= radius * radius) { + ((EntityCreature) thrallDemon).setAttackTarget(target); + } else { + ((EntityCreature) thrallDemon).getNavigator().tryMoveToEntityLiving(target, 2); + } + } + } + } + } + + public void notifyDemons(int xf, int yf, int zf, double radius) { + for (IHoardDemon thrallDemon : this.hoardList) { + if (thrallDemon instanceof EntityCreature) { + if (((EntityCreature) thrallDemon).getAttackTarget() == null) { + double xi = ((EntityCreature) thrallDemon).posX; + double yi = ((EntityCreature) thrallDemon).posY; + double zi = ((EntityCreature) thrallDemon).posZ; + + if ((xi - xf) * (xi - xf) + (yi - yf) * (yi - yf) + (zi - zf) * (zi - zf) <= radius * radius) { + ((EntityCreature) thrallDemon).getNavigator().tryMoveToXYZ(xf, yf, zf, 1); + } + } + } + } + } + + public void enthrallDemon(EntityLivingBase demon) { + if (demon instanceof IHoardDemon) { + boolean enthrall = ((IHoardDemon) demon).thrallDemon(new Int3(this.xCoord, this.yCoord, this.zCoord)); + if (enthrall) { + this.hoardList.add((IHoardDemon) demon); + } + } + } + + public void initialize() { + if (isInitialized) { return; } - + DemonType[] types = DemonType.values(); this.type = types[rand.nextInt(types.length)]; - - for (int xIndex = -negXRadius; xIndex <= posXRadius; xIndex++) - { - for (int zIndex = -negZRadius; zIndex <= posZRadius; zIndex++) - { - if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1) - { + + for (int xIndex = -negXRadius; xIndex <= posXRadius; xIndex++) { + for (int zIndex = -negZRadius; zIndex <= posZRadius; zIndex++) { + if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1) { this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, yCoord)); - } else if (xIndex == 0 && zIndex == 0) - { + } else if (xIndex == 0 && zIndex == 0) { this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord)); - } else - { + } else { this.setGridSpace(xIndex, zIndex, new GridSpace()); } } @@ -320,146 +271,128 @@ public class TEDemonPortal extends TileEntity this.houseCooldown = TEDemonPortal.buildingGridDelay; this.roadCooldown = TEDemonPortal.roadGridDelay; this.demonHoardCooldown = TEDemonPortal.demonHoardDelay; - + this.createRandomRoad(); - - if (this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier) >= 1) - { - System.out.println("Portal building successfully found!"); - this.buildingStage = 0; + + if (this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier) >= 1) { + System.out.println("Portal building successfully found!"); + this.buildingStage = 0; } isInitialized = true; } - - public void createParty() - { - worldObj.createExplosion(null, xCoord + rand.nextInt(10) - rand.nextInt(10), yCoord, zCoord + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false); + + public void createParty() { + worldObj.createExplosion( + null, + xCoord + rand.nextInt(10) - rand.nextInt(10), + yCoord, + zCoord + rand.nextInt(10) - rand.nextInt(10), + 5 * rand.nextFloat(), + false); } - public void start() - { - this.delayBeforeParty = 200; + public void start() { + this.delayBeforeParty = 200; } - + /** * Randomly increase one of the cooldowns such that a road, house, or a demon portal tier is caused. Demons are also randomly spawned via this mechanic. */ @Override - public void updateEntity() - { - if(worldObj.isRemote) - { - return; - } - - if(this.delayBeforeParty > 0) - { - this.delayBeforeParty--; - - if(rand.nextInt(20) == 0) - { - this.createParty(); - } - - if(delayBeforeParty <= 0) - { - worldObj.createExplosion(null, xCoord, yCoord, zCoord, 15, false); - this.initialize(); - } - - return; - } - - if (!isInitialized) - { + public void updateEntity() { + if (worldObj.isRemote) { return; } - + + if (this.delayBeforeParty > 0) { + this.delayBeforeParty--; + + if (rand.nextInt(20) == 0) { + this.createParty(); + } + + if (delayBeforeParty <= 0) { + worldObj.createExplosion(null, xCoord, yCoord, zCoord, 15, false); + this.initialize(); + } + + return; + } + + if (!isInitialized) { + return; + } + lockdownTimer = Math.max(0, this.lockdownTimer - 1); this.incrementPoints(); this.assignPoints(); - - if(printDebug) - AlchemicalWizardry.logger.info("Roads: " + roadCooldown + " Buildings: " + houseCooldown + " Lockdown: " + lockdownTimer); - if(buildingStage >= 0 && buildingStage <=2) - { - if(printDebug) - AlchemicalWizardry.logger.info("BuildingStage = " + buildingStage); - if(printDebug) - AlchemicalWizardry.logger.info("Tier = " + this.tier); - this.createPortalBuilding(buildingStage, nextDemonPortalName, tier); - buildingStage++; - return; + if (printDebug) + AlchemicalWizardry.logger.info( + "Roads: " + roadCooldown + " Buildings: " + houseCooldown + " Lockdown: " + lockdownTimer); + + if (buildingStage >= 0 && buildingStage <= 2) { + if (printDebug) AlchemicalWizardry.logger.info("BuildingStage = " + buildingStage); + if (printDebug) AlchemicalWizardry.logger.info("Tier = " + this.tier); + this.createPortalBuilding(buildingStage, nextDemonPortalName, tier); + buildingStage++; + return; } - if(this.roadCooldown <= 0) - { + if (this.roadCooldown <= 0) { int roadsMade = this.createRandomRoad(); - if (roadsMade > 0) - { + if (roadsMade > 0) { this.roadCooldown = TEDemonPortal.roadGridDelay * roadsMade; - //this.demonHouseCooldown += this.roadCooldown; + // this.demonHouseCooldown += this.roadCooldown; } } - - if(this.houseCooldown <= 0) - { - int gridsUsed = this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, tier); - if (gridsUsed > 0) - { - this.houseCooldown = TEDemonPortal.buildingGridDelay * gridsUsed; - //this.demonHouseCooldown += this.houseCooldown; - } - } - - if(this.demonHoardCooldown <= 0) //TODO - { - if(this.hoardList.size() <= demonLimit) - { - int complexityCost = this.createRandomDemonHoard(this, tier, this.type, this.isLockedDown()); - if(complexityCost > 0) - { - this.demonHoardCooldown += TEDemonPortal.demonHoardDelay * complexityCost; - } - } - } - if(this.tier < tierCostList.length && this.demonHouseCooldown > tierCostList[this.tier]) + if (this.houseCooldown <= 0) { + int gridsUsed = this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, tier); + if (gridsUsed > 0) { + this.houseCooldown = TEDemonPortal.buildingGridDelay * gridsUsed; + // this.demonHouseCooldown += this.houseCooldown; + } + } + + if (this.demonHoardCooldown <= 0) // TODO { + if (this.hoardList.size() <= demonLimit) { + int complexityCost = this.createRandomDemonHoard(this, tier, this.type, this.isLockedDown()); + if (complexityCost > 0) { + this.demonHoardCooldown += TEDemonPortal.demonHoardDelay * complexityCost; + } + } + } + + if (this.tier < tierCostList.length && this.demonHouseCooldown > tierCostList[this.tier]) { this.tier++; - if (this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier) >= 1) - { - this.buildingStage = 0; + if (this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier) >= 1) { + this.buildingStage = 0; } } - -// this.houseCooldown = Math.max(0, this.houseCooldown - 1); //Current dummy implementation of the increasing costs -// this.roadCooldown = Math.max(0, this.roadCooldown - 1); + // this.houseCooldown = Math.max(0, this.houseCooldown - 1); //Current dummy implementation of the + // increasing costs + // this.roadCooldown = Math.max(0, this.roadCooldown - 1); } - - public void assignPoints() - { - if((int)this.pointPool > 0) - { - if(this.decreaseRandomCooldown((int)this.pointPool)) - { - this.pointPool -= (int)this.pointPool; - } - } + + public void assignPoints() { + if ((int) this.pointPool > 0) { + if (this.decreaseRandomCooldown((int) this.pointPool)) { + this.pointPool -= (int) this.pointPool; + } + } } - - public void incrementPoints() - { - this.pointPool += portalTickRate; + + public void incrementPoints() { + this.pointPool += portalTickRate; } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); this.negXRadius = par1NBTTagCompound.getInteger("negXRadius"); this.negZRadius = par1NBTTagCompound.getInteger("negZRadius"); @@ -473,8 +406,7 @@ public class TEDemonPortal extends TileEntity NBTTagList tagList = par1NBTTagCompound.getTagList("Grid", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { int length = (negZRadius + posZRadius + 1); int x = i / length; @@ -490,11 +422,12 @@ public class TEDemonPortal extends TileEntity this.tier = par1NBTTagCompound.getInteger("tier"); this.demonHouseCooldown = par1NBTTagCompound.getInteger("demonHouseCooldown"); - + this.nextDemonPortalName = par1NBTTagCompound.getString("nextDemonPortalName"); this.buildingStage = par1NBTTagCompound.getInteger("buildingStage"); - this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection")); - + this.nextDemonPortalDirection = + ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection")); + this.pointPool = par1NBTTagCompound.getFloat("pointPool"); this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer"); this.delayBeforeParty = par1NBTTagCompound.getInteger("delayBeforeParty"); @@ -502,8 +435,7 @@ public class TEDemonPortal extends TileEntity } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("negXRadius", negXRadius); par1NBTTagCompound.setInteger("negZRadius", negZRadius); @@ -515,18 +447,14 @@ public class TEDemonPortal extends TileEntity NBTTagList gridList = new NBTTagList(); - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { GridSpace space = area[i][j]; NBTTagCompound nextTag; - if (space == null) - { + if (space == null) { nextTag = new GridSpace().getTag(); - } else - { + } else { nextTag = space.getTag(); } @@ -539,10 +467,10 @@ public class TEDemonPortal extends TileEntity par1NBTTagCompound.setBoolean("init", this.isInitialized); par1NBTTagCompound.setInteger("tier", this.tier); par1NBTTagCompound.setInteger("demonHouseCooldown", this.demonHouseCooldown); - + par1NBTTagCompound.setString("nextDemonPortalName", nextDemonPortalName); par1NBTTagCompound.setInteger("buildingStage", buildingStage); - + par1NBTTagCompound.setInteger("nextDemonPortalDirection", this.nextDemonPortalDirection.ordinal()); par1NBTTagCompound.setFloat("pointPool", pointPool); par1NBTTagCompound.setInteger("lockdownTimer", this.lockdownTimer); @@ -550,48 +478,11 @@ public class TEDemonPortal extends TileEntity par1NBTTagCompound.setString("demonType", this.type.toString()); } - public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian) - { - int next = rand.nextInt(4); - ForgeDirection dir; - - switch (next) - { - case 0: - dir = ForgeDirection.NORTH; - break; - case 1: - dir = ForgeDirection.SOUTH; - break; - case 2: - dir = ForgeDirection.EAST; - break; - case 3: - dir = ForgeDirection.WEST; - break; - default: - dir = ForgeDirection.NORTH; - } - - Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); - if(road == null) - { - return 0; - } - - if(TEDemonPortal.printDebug) - System.out.println("Spawning Demons"); - - return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, xCoord + road.xCoord * 5, road.yCoord + 1, zCoord + road.zCoord * 5, type, tier, spawnGuardian); - } - - public int createRandomRoad() //Return the number of road spaces - { + public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian) { int next = rand.nextInt(4); ForgeDirection dir; - switch (next) - { + switch (next) { case 0: dir = ForgeDirection.NORTH; break; @@ -608,19 +499,59 @@ public class TEDemonPortal extends TileEntity dir = ForgeDirection.NORTH; } - Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); + Int3 road = + findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); + if (road == null) { + return 0; + } + + if (TEDemonPortal.printDebug) System.out.println("Spawning Demons"); + + return DemonPacketRegistry.spawnDemons( + teDemonPortal, + worldObj, + xCoord + road.xCoord * 5, + road.yCoord + 1, + zCoord + road.zCoord * 5, + type, + tier, + spawnGuardian); + } + + public int createRandomRoad() // Return the number of road spaces + { + int next = rand.nextInt(4); + ForgeDirection dir; + + switch (next) { + case 0: + dir = ForgeDirection.NORTH; + break; + case 1: + dir = ForgeDirection.SOUTH; + break; + case 2: + dir = ForgeDirection.EAST; + break; + case 3: + dir = ForgeDirection.WEST; + break; + default: + dir = ForgeDirection.NORTH; + } + + Int3 road = + findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); int x = road.xCoord; int yLevel = road.yCoord; int z = road.zCoord; - if(printDebug) - AlchemicalWizardry.logger.info("X: " + x + " Z: " + z + " Direction: " + dir.toString()); + if (printDebug) AlchemicalWizardry.logger.info("X: " + x + " Z: " + z + " Direction: " + dir.toString()); List directions = this.findValidExtentionDirection(x, z); - if (directions.size() <= 0) - { + if (directions.size() <= 0) { return 0; } @@ -629,168 +560,133 @@ public class TEDemonPortal extends TileEntity int distance = 0; ForgeDirection dominantDirection = null; - for (ForgeDirection direction : directions) - { + for (ForgeDirection direction : directions) { int amt = this.getLength(direction, maxDistance, x, z); - if (amt > distance) - { + if (amt > distance) { distance = amt; dominantDirection = direction; - } else if (amt == distance && rand.nextBoolean()) - { + } else if (amt == distance && rand.nextBoolean()) { dominantDirection = direction; } } - if (dominantDirection == null) - { + if (dominantDirection == null) { return 0; } - if(printDebug) - AlchemicalWizardry.logger.info("I got here!"); - if(printDebug) - AlchemicalWizardry.logger.info("Distance: " + distance + " Direction: " + dominantDirection.toString() + " yLevel: " + yLevel); + if (printDebug) AlchemicalWizardry.logger.info("I got here!"); + if (printDebug) + AlchemicalWizardry.logger.info( + "Distance: " + distance + " Direction: " + dominantDirection.toString() + " yLevel: " + yLevel); this.createGriddedRoad(x, yLevel, z, dominantDirection, distance + 1, true); return distance; } - public List findValidExtentionDirection(int x, int z) - { + public List findValidExtentionDirection(int x, int z) { List directions = new LinkedList(); - if (this.getGridSpace(x, z) == null || !this.getGridSpace(x, z).isRoadSegment()) - { + if (this.getGridSpace(x, z) == null || !this.getGridSpace(x, z).isRoadSegment()) { return directions; } GridSpace nextGrid = this.getGridSpace(x + 1, z); - if (nextGrid.isEmpty()) - { + if (nextGrid.isEmpty()) { directions.add(ForgeDirection.EAST); } nextGrid = this.getGridSpace(x - 1, z); - if (nextGrid.isEmpty()) - { + if (nextGrid.isEmpty()) { directions.add(ForgeDirection.WEST); } nextGrid = this.getGridSpace(x, z + 1); - if (nextGrid.isEmpty()) - { + if (nextGrid.isEmpty()) { directions.add(ForgeDirection.SOUTH); } nextGrid = this.getGridSpace(x, z - 1); - if (nextGrid.isEmpty()) - { + if (nextGrid.isEmpty()) { directions.add(ForgeDirection.NORTH); } return directions; } - public int getLength(ForgeDirection dir, int maxLength, int x, int z) //Number of spaces forward - { - for (int i = 1; i <= maxLength; i++) - { - GridSpace space = this.getGridSpace(x + i * dir.offsetX, z + i * dir.offsetZ); - if (space.isEmpty()) + public int getLength(ForgeDirection dir, int maxLength, int x, int z) // Number of spaces forward { - for (int k = 1; k <= this.getRoadSpacer(); k++) - { - GridSpace space1 = this.getGridSpace(x + i * dir.offsetX + dir.offsetZ * k, z + i * dir.offsetZ + dir.offsetX * k); - GridSpace space2 = this.getGridSpace(x + i * dir.offsetX - dir.offsetZ * k, z + i * dir.offsetZ - dir.offsetX * k); + for (int i = 1; i <= maxLength; i++) { + GridSpace space = this.getGridSpace(x + i * dir.offsetX, z + i * dir.offsetZ); + if (space.isEmpty()) { + for (int k = 1; k <= this.getRoadSpacer(); k++) { + GridSpace space1 = this.getGridSpace( + x + i * dir.offsetX + dir.offsetZ * k, z + i * dir.offsetZ + dir.offsetX * k); + GridSpace space2 = this.getGridSpace( + x + i * dir.offsetX - dir.offsetZ * k, z + i * dir.offsetZ - dir.offsetX * k); - if (space1.isRoadSegment() || space2.isRoadSegment()) - { + if (space1.isRoadSegment() || space2.isRoadSegment()) { return i - 1; } } continue; } - if (space.isRoadSegment()) - { + if (space.isRoadSegment()) { return i; - } else - { + } else { return i - 1; } } return maxLength; } - public Int3 findRoadSpaceFromDirection(ForgeDirection dir, int amount) //TODO - { + public Int3 findRoadSpaceFromDirection(ForgeDirection dir, int amount) // TODO + { int index = 0; - if (dir == ForgeDirection.NORTH) - { - if(printDebug) - System.out.print("NORTH!"); - for (int i = Math.max(0, -limit + negZRadius); i <= negZRadius + Math.min(posZRadius, limit); i++) - { - for (int j = Math.max(0, -limit + negXRadius); j <= negXRadius + Math.min(posXRadius, limit); j++) - { + if (dir == ForgeDirection.NORTH) { + if (printDebug) System.out.print("NORTH!"); + for (int i = Math.max(0, -limit + negZRadius); i <= negZRadius + Math.min(posZRadius, limit); i++) { + for (int j = Math.max(0, -limit + negXRadius); j <= negXRadius + Math.min(posXRadius, limit); j++) { GridSpace space = area[j][i]; - if (space.isRoadSegment()) - { + if (space.isRoadSegment()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(j - negXRadius, space.getYLevel(), i - negZRadius); } } } } - } else if (dir == ForgeDirection.SOUTH) - { - for (int i = negZRadius + Math.min(posZRadius, limit); i >= Math.max(0, -limit + negZRadius); i--) - { - for (int j = Math.max(0, -limit + negXRadius); j <= negXRadius + Math.min(posXRadius, limit); j++) - { + } else if (dir == ForgeDirection.SOUTH) { + for (int i = negZRadius + Math.min(posZRadius, limit); i >= Math.max(0, -limit + negZRadius); i--) { + for (int j = Math.max(0, -limit + negXRadius); j <= negXRadius + Math.min(posXRadius, limit); j++) { GridSpace space = area[j][i]; - if (space.isRoadSegment()) - { + if (space.isRoadSegment()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(j - negXRadius, space.getYLevel(), i - negZRadius); } } } } - } else if (dir == ForgeDirection.EAST) - { - for (int i = negXRadius + Math.min(posXRadius, limit); i >= Math.max(0, -limit + negXRadius); i--) - { - for (int j = Math.max(0, -limit + negZRadius); j <= negZRadius + Math.min(posZRadius, limit); j++) - { + } else if (dir == ForgeDirection.EAST) { + for (int i = negXRadius + Math.min(posXRadius, limit); i >= Math.max(0, -limit + negXRadius); i--) { + for (int j = Math.max(0, -limit + negZRadius); j <= negZRadius + Math.min(posZRadius, limit); j++) { GridSpace space = area[i][j]; - if (space.isRoadSegment()) - { + if (space.isRoadSegment()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(i - negXRadius, space.getYLevel(), j - negZRadius); } } } } - } else if (dir == ForgeDirection.WEST) - { - for (int i = Math.max(0, -limit + negXRadius); i <= negXRadius + Math.min(posXRadius, limit); i++) - { - for (int j = Math.max(0, -limit + negZRadius); j <= negZRadius + Math.min(posZRadius, limit); j++) - { + } else if (dir == ForgeDirection.WEST) { + for (int i = Math.max(0, -limit + negXRadius); i <= negXRadius + Math.min(posXRadius, limit); i++) { + for (int j = Math.max(0, -limit + negZRadius); j <= negZRadius + Math.min(posZRadius, limit); j++) { GridSpace space = area[i][j]; - if (space.isRoadSegment()) - { + if (space.isRoadSegment()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(i - negXRadius, space.getYLevel(), j - negZRadius); } } @@ -801,94 +697,68 @@ public class TEDemonPortal extends TileEntity return new Int3(0, 0, 0); } - public Int3 findEmptySpaceNearRoad(ForgeDirection dir, int amount, int closeness) - { + public Int3 findEmptySpaceNearRoad(ForgeDirection dir, int amount, int closeness) { int index = 0; - if (dir == ForgeDirection.NORTH) - { - if(printDebug) - System.out.print("NORTH!"); - for (int i = 0; i <= negZRadius + posZRadius; i++) - { - for (int j = 0; j <= negXRadius + posXRadius; j++) - { + if (dir == ForgeDirection.NORTH) { + if (printDebug) System.out.print("NORTH!"); + for (int i = 0; i <= negZRadius + posZRadius; i++) { + for (int j = 0; j <= negXRadius + posXRadius; j++) { GridSpace space = area[j][i]; - if (space.isEmpty()) - { + if (space.isEmpty()) { int yLevel = this.findNearestRoadYLevel(j - negXRadius, i - negZRadius, closeness); - if (yLevel == -1) - { + if (yLevel == -1) { continue; } index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(j - negXRadius, yLevel, i - negZRadius); } } } } - } else if (dir == ForgeDirection.SOUTH) - { - for (int i = negZRadius + posZRadius; i >= 0; i--) - { - for (int j = 0; j <= negXRadius + posXRadius; j++) - { + } else if (dir == ForgeDirection.SOUTH) { + for (int i = negZRadius + posZRadius; i >= 0; i--) { + for (int j = 0; j <= negXRadius + posXRadius; j++) { GridSpace space = area[j][i]; int yLevel = this.findNearestRoadYLevel(j - negXRadius, i - negZRadius, closeness); - if (yLevel == -1) - { + if (yLevel == -1) { continue; } - if (space.isEmpty()) - { + if (space.isEmpty()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(j - negXRadius, yLevel, i - negZRadius); } } } } - } else if (dir == ForgeDirection.EAST) - { - for (int i = negXRadius + posXRadius; i >= 0; i--) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + } else if (dir == ForgeDirection.EAST) { + for (int i = negXRadius + posXRadius; i >= 0; i--) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { GridSpace space = area[i][j]; int yLevel = this.findNearestRoadYLevel(i - negXRadius, j - negZRadius, closeness); - if (yLevel == -1) - { + if (yLevel == -1) { continue; } - if (space.isEmpty()) - { + if (space.isEmpty()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(i - negXRadius, yLevel, j - negZRadius); } } } } - } else if (dir == ForgeDirection.WEST) - { - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + } else if (dir == ForgeDirection.WEST) { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { GridSpace space = area[i][j]; int yLevel = this.findNearestRoadYLevel(i - negXRadius, j - negZRadius, closeness); - if (yLevel == -1) - { + if (yLevel == -1) { continue; } - if (space.isEmpty()) - { + if (space.isEmpty()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(i - negXRadius, yLevel, j - negZRadius); } } @@ -899,74 +769,52 @@ public class TEDemonPortal extends TileEntity return new Int3(0, 0, 0); } - public Int3 findEmptySpaceFromDirection(ForgeDirection dir, int amount) - { + public Int3 findEmptySpaceFromDirection(ForgeDirection dir, int amount) { int index = 0; - if (dir == ForgeDirection.NORTH) - { - if(printDebug) - System.out.print("NORTH!"); - for (int i = 0; i <= negZRadius + posZRadius; i++) - { - for (int j = 0; j <= negXRadius + posXRadius; j++) - { + if (dir == ForgeDirection.NORTH) { + if (printDebug) System.out.print("NORTH!"); + for (int i = 0; i <= negZRadius + posZRadius; i++) { + for (int j = 0; j <= negXRadius + posXRadius; j++) { GridSpace space = area[j][i]; - if (space.isEmpty()) - { + if (space.isEmpty()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(j - negXRadius, space.getYLevel(), i - negZRadius); } } } } - } else if (dir == ForgeDirection.SOUTH) - { - for (int i = negZRadius + posZRadius; i >= 0; i--) - { - for (int j = 0; j <= negXRadius + posXRadius; j++) - { + } else if (dir == ForgeDirection.SOUTH) { + for (int i = negZRadius + posZRadius; i >= 0; i--) { + for (int j = 0; j <= negXRadius + posXRadius; j++) { GridSpace space = area[j][i]; - if (space.isEmpty()) - { + if (space.isEmpty()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(j - negXRadius, space.getYLevel(), i - negZRadius); } } } } - } else if (dir == ForgeDirection.EAST) - { - for (int i = negXRadius + posXRadius; i >= 0; i--) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + } else if (dir == ForgeDirection.EAST) { + for (int i = negXRadius + posXRadius; i >= 0; i--) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { GridSpace space = area[i][j]; - if (space.isEmpty()) - { + if (space.isEmpty()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(i - negXRadius, space.getYLevel(), j - negZRadius); } } } } - } else if (dir == ForgeDirection.WEST) - { - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + } else if (dir == ForgeDirection.WEST) { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { GridSpace space = area[i][j]; - if (space.isEmpty()) - { + if (space.isEmpty()) { index++; - if (index >= amount) - { + if (index >= amount) { return new Int3(i - negXRadius, space.getYLevel(), j - negZRadius); } } @@ -977,10 +825,15 @@ public class TEDemonPortal extends TileEntity return new Int3(0, 0, 0); } - public int createGriddedRoad(int gridXi, int yi, int gridZi, ForgeDirection dir, int gridLength, boolean convertStarter) //Total grid length - { - if (gridLength == 0 || gridLength == 1) - { + public int createGriddedRoad( + int gridXi, + int yi, + int gridZi, + ForgeDirection dir, + int gridLength, + boolean convertStarter) // Total grid length + { + if (gridLength == 0 || gridLength == 1) { return 0; } @@ -988,57 +841,47 @@ public class TEDemonPortal extends TileEntity int initGridZ = gridZi; int initY = yi; - if (convertStarter) - { + if (convertStarter) { this.setGridSpace(initGridX, initGridZ, new GridSpace(GridSpace.CROSSROAD, initY)); DemonCrosspath crosspath = new DemonCrosspath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5); crosspath.createCrosspath(worldObj); } - for (int index = 0; index < gridLength - 1; index++) - { + for (int index = 0; index < gridLength - 1; index++) { DemonVillagePath path = new DemonVillagePath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5, dir, 6); Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance()); Int3 next = temp.coords; - if (next != null) - { + if (next != null) { initY = next.yCoord; - if(printDebug) - AlchemicalWizardry.logger.info("" + initY); + if (printDebug) AlchemicalWizardry.logger.info("" + initY); } - - if(!temp.bool) - { - return index; + + if (!temp.bool) { + return index; } initGridX += dir.offsetX; initGridZ += dir.offsetZ; - if (!this.getGridSpace(initGridX, initGridZ).isRoadSegment()) - { + if (!this.getGridSpace(initGridX, initGridZ).isRoadSegment()) { this.setGridSpace(initGridX, initGridZ, new GridSpace(GridSpace.ROAD, initY)); } } - + return gridLength - 1; } - public void expandAreaInNegX() - { + public void expandAreaInNegX() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1]; - for (int i = 0; i <= negZRadius + posZRadius; i++) - { + for (int i = 0; i <= negZRadius + posZRadius; i++) { newGrid[0][i] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i + 1][j] = area[i][j]; } } @@ -1047,19 +890,15 @@ public class TEDemonPortal extends TileEntity negXRadius += 1; } - public void expandAreaInPosX() - { + public void expandAreaInPosX() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1]; - for (int i = 0; i <= negZRadius + posZRadius; i++) - { + for (int i = 0; i <= negZRadius + posZRadius; i++) { newGrid[negXRadius + posXRadius + 1][i] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i][j] = area[i][j]; } } @@ -1068,22 +907,17 @@ public class TEDemonPortal extends TileEntity posXRadius += 1; } - public void expandAreaInNegZ() - { + public void expandAreaInNegZ() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2]; - if(printDebug) - AlchemicalWizardry.logger.info("x " + newGrid.length + "z " + newGrid[0].length); + if (printDebug) AlchemicalWizardry.logger.info("x " + newGrid.length + "z " + newGrid[0].length); - for (int i = 0; i <= negXRadius + posXRadius; i++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { newGrid[i][0] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i][j + 1] = area[i][j]; } } @@ -1092,19 +926,15 @@ public class TEDemonPortal extends TileEntity negZRadius += 1; } - public void expandAreaInPosZ() - { + public void expandAreaInPosZ() { GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2]; - for (int i = 0; i <= negXRadius + posXRadius; i++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { newGrid[i][negZRadius + posZRadius + 1] = new GridSpace(); } - for (int i = 0; i <= negXRadius + posXRadius; i++) - { - for (int j = 0; j <= negZRadius + posZRadius; j++) - { + for (int i = 0; i <= negXRadius + posXRadius; i++) { + for (int j = 0; j <= negZRadius + posZRadius; j++) { newGrid[i][j] = area[i][j]; } } @@ -1113,66 +943,54 @@ public class TEDemonPortal extends TileEntity posZRadius += 1; } - public GridSpace getGridSpace(int x, int z) - { - if (x > posXRadius || x < -negXRadius || z > posZRadius || z < -negZRadius) - { + public GridSpace getGridSpace(int x, int z) { + if (x > posXRadius || x < -negXRadius || z > posZRadius || z < -negZRadius) { return new GridSpace(); - } else - { + } else { return (area[x + negXRadius][z + negZRadius]); } } - public void setGridSpace(int x, int z, GridSpace space) - { - if (x > posXRadius) - { + public void setGridSpace(int x, int z, GridSpace space) { + if (x > posXRadius) { this.expandAreaInPosX(); this.setGridSpace(x, z, space); - } else if (x < -negXRadius) - { + } else if (x < -negXRadius) { this.expandAreaInNegX(); this.setGridSpace(x, z, space); - } else if (z > posZRadius) - { + } else if (z > posZRadius) { this.expandAreaInPosZ(); this.setGridSpace(x, z, space); - } else if (z < -negZRadius) - { + } else if (z < -negZRadius) { this.expandAreaInNegZ(); this.setGridSpace(x, z, space); - } else - { + } else { area[x + negXRadius][z + negZRadius] = space; } } - public void rightClickBlock(EntityPlayer player, int side) - { -// if (worldObj.isRemote) -// { -// return; -// } -// -// this.initialize(); -// -// if (ForgeDirection.getOrientation(side) == ForgeDirection.UP) -// { -// this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, 0); -// } else if (ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) -// { -// this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, 0); -// } else -// { -// this.createRandomRoad(); -// } + public void rightClickBlock(EntityPlayer player, int side) { + // if (worldObj.isRemote) + // { + // return; + // } + // + // this.initialize(); + // + // if (ForgeDirection.getOrientation(side) == ForgeDirection.UP) + // { + // this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, 0); + // } else if (ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) + // { + // this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, 0); + // } else + // { + // this.createRandomRoad(); + // } } - public int createRandomBuilding(int type, int tier) - { - switch (type) - { + public int createRandomBuilding(int type, int tier) { + switch (type) { case DemonBuilding.BUILDING_HOUSE: return this.createRandomHouse(tier); case DemonBuilding.BUILDING_PORTAL: @@ -1182,142 +1000,136 @@ public class TEDemonPortal extends TileEntity return 0; } - public int createPortalBuilding(int buildingTier) //TODO Telepose block next time, then build the new building. - { - if(printDebug) - AlchemicalWizardry.logger.info("Hello, I am here!"); + public int createPortalBuilding(int buildingTier) // TODO Telepose block next time, then build the new building. + { + if (printDebug) AlchemicalWizardry.logger.info("Hello, I am here!"); int x = 0; int z = 0; -// GridSpace home = this.getGridSpace(x, z); -// int yLevel = home.getYLevel(); + // GridSpace home = this.getGridSpace(x, z); + // int yLevel = home.getYLevel(); -// GridSpaceHolder grid = this.createGSH(); + // GridSpaceHolder grid = this.createGSH(); List directions = new ArrayList(); - for (int i = 2; i < 6; i++) - { + for (int i = 2; i < 6; i++) { ForgeDirection testDir = ForgeDirection.getOrientation(i); directions.add(testDir); } - if (directions.isEmpty()) - { + if (directions.isEmpty()) { return 0; } HashMap> schemMap = new HashMap(); - for (ForgeDirection nextDir : directions) - { - for (DemonBuilding build : TEDemonPortal.buildingList) - { - if (build.buildingType != DemonBuilding.BUILDING_PORTAL || build.buildingTier != buildingTier) - { + for (ForgeDirection nextDir : directions) { + for (DemonBuilding build : TEDemonPortal.buildingList) { + if (build.buildingType != DemonBuilding.BUILDING_PORTAL || build.buildingTier != buildingTier) { continue; } System.out.println("This one matches!"); - if (schemMap.containsKey(nextDir)) - { + if (schemMap.containsKey(nextDir)) { schemMap.get(nextDir).add(build); - } else - { + } else { schemMap.put(nextDir, new ArrayList()); schemMap.get(nextDir).add(build); } } } - if (schemMap.keySet().isEmpty()) - { + if (schemMap.keySet().isEmpty()) { return 0; } - ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())]; - DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size())); -// Int3 portalSpace = build.getDoorSpace(chosenDirection); + ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet() + .toArray()[new Random().nextInt(schemMap.keySet().size())]; + DemonBuilding build = schemMap.get(chosenDirection) + .get(new Random().nextInt(schemMap.get(chosenDirection).size())); + // Int3 portalSpace = build.getDoorSpace(chosenDirection); this.nextDemonPortalDirection = chosenDirection; this.nextDemonPortalName = build.getName(); -// build.destroyAllInField(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite()); -// -// int yOffset = portalSpace.yCoord; -// build.buildAll(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite()); -// build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid); -// this.loadGSH(grid); + // build.destroyAllInField(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, + // chosenDirection.getOpposite()); + // + // int yOffset = portalSpace.yCoord; + // build.buildAll(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite()); + // build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid); + // this.loadGSH(grid); return build.getNumberOfGridSpaces(); } - + /** - * The Stage is at what point the portal is in reacting to the creation of the Demon Portal. + * The Stage is at what point the portal is in reacting to the creation of the Demon Portal. * Stage == 0 means just the saving * Stage == 1 means to telepose the portal * Stage == 2 means the teleposition is complete and that the building may be constructed */ - public void createPortalBuilding(int stage, String name, int tier) - { - for(DemonBuilding build : TEDemonPortal.buildingList) - { - if(build.buildingType != DemonBuilding.BUILDING_PORTAL || build.buildingTier != tier) - { - continue; - } - - if(build.getName().equals(this.nextDemonPortalName)) - { - int x = 0; - int z = 0; + public void createPortalBuilding(int stage, String name, int tier) { + for (DemonBuilding build : TEDemonPortal.buildingList) { + if (build.buildingType != DemonBuilding.BUILDING_PORTAL || build.buildingTier != tier) { + continue; + } - GridSpace home = this.getGridSpace(x, z); - int yLevel = home.getYLevel(); + if (build.getName().equals(this.nextDemonPortalName)) { + int x = 0; + int z = 0; - GridSpaceHolder grid = this.createGSH(); - - ForgeDirection chosenDirection = this.nextDemonPortalDirection; - Int3 portalSpace = build.getDoorSpace(chosenDirection); - int yOffset = portalSpace.yCoord; - - switch(stage) - { - case 0: - - break; - - case 1: - int yDestination = yLevel + yOffset; - if(yCoord != yDestination) - { - BlockTeleposer.swapBlocks(this, worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yDestination, zCoord); - }else - { - //Nuthin - just as a reminder that we can now increment properly - } - break; - - case 2: - build.destroyAllInField(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite()); - - build.buildAll(this, worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite(), true); - build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid); - this.loadGSH(grid); - break; - } - - return; - } - } + GridSpace home = this.getGridSpace(x, z); + int yLevel = home.getYLevel(); + + GridSpaceHolder grid = this.createGSH(); + + ForgeDirection chosenDirection = this.nextDemonPortalDirection; + Int3 portalSpace = build.getDoorSpace(chosenDirection); + int yOffset = portalSpace.yCoord; + + switch (stage) { + case 0: + break; + + case 1: + int yDestination = yLevel + yOffset; + if (yCoord != yDestination) { + BlockTeleposer.swapBlocks( + this, worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yDestination, zCoord); + } else { + // Nuthin - just as a reminder that we can now increment properly + } + break; + + case 2: + build.destroyAllInField( + worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite()); + + build.buildAll( + this, + worldObj, + xCoord + (x) * 5, + yLevel, + zCoord + (z) * 5, + chosenDirection.getOpposite(), + true); + build.setAllGridSpaces( + x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid); + this.loadGSH(grid); + break; + } + + return; + } + } } - public int createRandomHouse(int buildingTier) - { + public int createRandomHouse(int buildingTier) { int next = rand.nextInt(4); ForgeDirection dir; - switch (next) - { + switch (next) { case 0: dir = ForgeDirection.NORTH; break; @@ -1334,87 +1146,84 @@ public class TEDemonPortal extends TileEntity dir = ForgeDirection.NORTH; } - Int3 space = this.findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); // Second: 1 * + Int3 space = this.findRoadSpaceFromDirection( + dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); // Second: 1 * int x = space.xCoord; int z = space.zCoord; int yLevel = space.yCoord; - if(printDebug) - AlchemicalWizardry.logger.info("Road space - x: " + x + " z: " + z); + if (printDebug) AlchemicalWizardry.logger.info("Road space - x: " + x + " z: " + z); GridSpaceHolder grid = this.createGSH(); - if (!this.getGridSpace(x, z).isRoadSegment()) - { + if (!this.getGridSpace(x, z).isRoadSegment()) { return 0; } List directions = new ArrayList(); - for (int i = 2; i < 6; i++) - { + for (int i = 2; i < 6; i++) { ForgeDirection testDir = ForgeDirection.getOrientation(i); - if (this.getGridSpace(x + testDir.offsetX, z + testDir.offsetZ).isEmpty()) - { + if (this.getGridSpace(x + testDir.offsetX, z + testDir.offsetZ).isEmpty()) { directions.add(testDir); } } - if (directions.isEmpty()) - { + if (directions.isEmpty()) { return 0; } HashMap> schemMap = new HashMap(); - for (ForgeDirection nextDir : directions) - { - for (DemonBuilding build : TEDemonPortal.buildingList) - { - if (build.buildingTier != buildingTier || build.buildingType != DemonBuilding.BUILDING_HOUSE) - { + for (ForgeDirection nextDir : directions) { + for (DemonBuilding build : TEDemonPortal.buildingList) { + if (build.buildingTier != buildingTier || build.buildingType != DemonBuilding.BUILDING_HOUSE) { continue; } Int3 offsetSpace = build.getGridOffsetFromRoad(nextDir, yLevel); int xOff = offsetSpace.xCoord; int zOff = offsetSpace.zCoord; - if (build.isValid(grid, x + xOff, z + zOff, nextDir.getOpposite())) - { - if (schemMap.containsKey(nextDir)) - { + if (build.isValid(grid, x + xOff, z + zOff, nextDir.getOpposite())) { + if (schemMap.containsKey(nextDir)) { schemMap.get(nextDir).add(build); - } else - { + } else { schemMap.put(nextDir, new ArrayList()); schemMap.get(nextDir).add(build); } - } else - { - if(printDebug) - AlchemicalWizardry.logger.info("This ISN'T valid!"); + } else { + if (printDebug) AlchemicalWizardry.logger.info("This ISN'T valid!"); } } } - if (schemMap.keySet().isEmpty()) - { + if (schemMap.keySet().isEmpty()) { return 0; } - ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())]; - DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size())); + ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet() + .toArray()[new Random().nextInt(schemMap.keySet().size())]; + DemonBuilding build = schemMap.get(chosenDirection) + .get(new Random().nextInt(schemMap.get(chosenDirection).size())); Int3 offsetSpace = build.getGridOffsetFromRoad(chosenDirection, yLevel); int xOff = offsetSpace.xCoord; int zOff = offsetSpace.zCoord; - build.destroyAllInField(worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite()); - build.buildAll(this, worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite(), true); + build.destroyAllInField( + worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite()); + build.buildAll( + this, + worldObj, + xCoord + (x + xOff) * 5, + yLevel, + zCoord + (z + zOff) * 5, + chosenDirection.getOpposite(), + true); build.setAllGridSpaces(x + xOff, z + zOff, yLevel, chosenDirection.getOpposite(), GridSpace.HOUSE, grid); this.loadGSH(grid); - + DemonVillagePath path = new DemonVillagePath(xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection, 2); Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance()); @@ -1422,21 +1231,15 @@ public class TEDemonPortal extends TileEntity return build.getNumberOfGridSpaces(); } - public int findNearestRoadYLevel(int xCoord, int zCoord, int maxDistance) - { - for (int l = 1; l <= maxDistance; l++) - { - for (int i = -l; i <= l; i++) - { - for (int j = -l; j <= l; j++) - { - if (Math.abs(i) != l && Math.abs(j) != l) - { + public int findNearestRoadYLevel(int xCoord, int zCoord, int maxDistance) { + for (int l = 1; l <= maxDistance; l++) { + for (int i = -l; i <= l; i++) { + for (int j = -l; j <= l; j++) { + if (Math.abs(i) != l && Math.abs(j) != l) { continue; } - if (this.getGridSpace(xCoord + i, zCoord + j).isRoadSegment()) - { + if (this.getGridSpace(xCoord + i, zCoord + j).isRoadSegment()) { return this.getGridSpace(xCoord + i, zCoord + j).getYLevel(); } } @@ -1446,15 +1249,13 @@ public class TEDemonPortal extends TileEntity return -1; } - public void createRoad(int xi, int yi, int zi, ForgeDirection dir, int length, boolean doesNotDrop) - { + public void createRoad(int xi, int yi, int zi, ForgeDirection dir, int length, boolean doesNotDrop) { int curX = xi; int curY = yi; int curZ = zi; int roadRadius = this.getRoadRadius(); - if (dir.offsetY != 0) - { + if (dir.offsetY != 0) { return; } @@ -1463,51 +1264,42 @@ public class TEDemonPortal extends TileEntity path.constructFullPath(this, worldObj, this.getRoadStepClearance()); } - public int placeMaterialOnNextAvailable() - { + public int placeMaterialOnNextAvailable() { return 0; } - public int getRoadRadius() - { + public int getRoadRadius() { return 1; } - public Block getRoadBlock() - { - switch(this.tier) - { - case 0: - return rand.nextFloat() < 0.6 ? Blocks.cobblestone : Blocks.mossy_cobblestone; - case 1: - return Blocks.stonebrick; - default: - return Blocks.nether_brick; - } + public Block getRoadBlock() { + switch (this.tier) { + case 0: + return rand.nextFloat() < 0.6 ? Blocks.cobblestone : Blocks.mossy_cobblestone; + case 1: + return Blocks.stonebrick; + default: + return Blocks.nether_brick; + } } - public int getRoadMeta() - { - switch(this.tier) - { - case 1: - return rand.nextFloat() < 0.6 ? 1 : 0; - } + public int getRoadMeta() { + switch (this.tier) { + case 1: + return rand.nextFloat() < 0.6 ? 1 : 0; + } return 0; } - public int getRoadStepClearance() - { + public int getRoadStepClearance() { return 10; } - public int getRoadSpacer() - { + public int getRoadSpacer() { return 1; } - public GridSpaceHolder createGSH() - { + public GridSpaceHolder createGSH() { GridSpaceHolder grid = new GridSpaceHolder(); grid.area = this.area; grid.negXRadius = this.negXRadius; @@ -1518,8 +1310,7 @@ public class TEDemonPortal extends TileEntity return grid; } - public void loadGSH(GridSpaceHolder grid) - { + public void loadGSH(GridSpaceHolder grid) { this.area = grid.area; this.negXRadius = grid.negXRadius; this.negZRadius = grid.negZRadius; @@ -1527,8 +1318,7 @@ public class TEDemonPortal extends TileEntity this.posZRadius = grid.posZRadius; } - public static void loadBuildingList() - { + public static void loadBuildingList() { String folder = "config/BloodMagic/schematics"; Gson gson = new GsonBuilder().setPrettyPrinting().create(); @@ -1536,33 +1326,26 @@ public class TEDemonPortal extends TileEntity File[] files = file.listFiles(); BufferedReader br; - try - { - for (File f : files) - { + try { + for (File f : files) { br = new BufferedReader(new FileReader(f)); BuildingSchematic schema = gson.fromJson(br, BuildingSchematic.class); TEDemonPortal.buildingList.add(new DemonBuilding(schema)); } - } catch (FileNotFoundException e) - { + } catch (FileNotFoundException e) { e.printStackTrace(); } } - public void addToPoints(int addition) - { + public void addToPoints(int addition) { this.demonHouseCooldown += addition; } - public void notifyPortalOfBreak() - { - for(IHoardDemon demon : hoardList) - { - if(demon instanceof Entity) - { - ((Entity) demon).setDead(); - } - } - } + public void notifyPortalOfBreak() { + for (IHoardDemon demon : hoardList) { + if (demon instanceof Entity) { + ((Entity) demon).setDead(); + } + } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/BookEntityItem.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/BookEntityItem.java index 14f06b92..7958535c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/BookEntityItem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/BookEntityItem.java @@ -6,51 +6,44 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class BookEntityItem extends EntityItem -{ - public BookEntityItem(World par1World, double par2, double par4, double par6) - { - super(par1World, par2, par4, par6); - this.isImmuneToFire = true; - this.lifespan = 72000; - } +public class BookEntityItem extends EntityItem { + public BookEntityItem(World par1World, double par2, double par4, double par6) { + super(par1World, par2, par4, par6); + this.isImmuneToFire = true; + this.lifespan = 72000; + } - public BookEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) - { - this(par1World, par2, par4, par6); - this.setEntityItemStack(par8ItemStack); - this.lifespan = (par8ItemStack.getItem() == null ? 6000 : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World)); - this.isImmuneToFire = true; - } - - public BookEntityItem(World world, Entity original, ItemStack stack) - { - this(world, original.posX, original.posY, original.posZ); - this.delayBeforeCanPickup = 20; - this.motionX = original.motionX; - this.motionY = original.motionY; - this.motionZ = original.motionZ; - this.setEntityItemStack(stack); - this.isImmuneToFire = true; - } + public BookEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) { + this(par1World, par2, par4, par6); + this.setEntityItemStack(par8ItemStack); + this.lifespan = (par8ItemStack.getItem() == null + ? 6000 + : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World)); + this.isImmuneToFire = true; + } - public BookEntityItem(World par1world) - { - super(par1world); - } - - @Override - public void onUpdate() - { - super.onUpdate(); - } - - @Override - public boolean attackEntityFrom (DamageSource par1DamageSource, float par2) - { - if (par1DamageSource.getDamageType().equals("outOfWorld")) - return true; - return false; - } + public BookEntityItem(World world, Entity original, ItemStack stack) { + this(world, original.posX, original.posY, original.posZ); + this.delayBeforeCanPickup = 20; + this.motionX = original.motionX; + this.motionY = original.motionY; + this.motionZ = original.motionZ; + this.setEntityItemStack(stack); + this.isImmuneToFire = true; + } -} \ No newline at end of file + public BookEntityItem(World par1world) { + super(par1world); + } + + @Override + public void onUpdate() { + super.onUpdate(); + } + + @Override + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (par1DamageSource.getDamageType().equals("outOfWorld")) return true; + return false; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityAirElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityAirElemental.java index e1bad7e6..4330622f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityAirElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityAirElemental.java @@ -9,23 +9,21 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class EntityAirElemental extends EntityElemental implements IMob -{ - public EntityAirElemental(World world) - { +public class EntityAirElemental extends EntityElemental implements IMob { + public EntityAirElemental(World world) { super(world, AlchemicalWizardry.entityAirElementalID); } - public void inflictEffectOnEntity(Entity target) - { - if (target instanceof EntityPlayer) - { - SpellHelper.setPlayerSpeedFromServer((EntityPlayer) target, target.motionX, target.motionY + 3, target.motionZ); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); - } else if (target instanceof EntityLivingBase) - { + public void inflictEffectOnEntity(Entity target) { + if (target instanceof EntityPlayer) { + SpellHelper.setPlayerSpeedFromServer( + (EntityPlayer) target, target.motionX, target.motionY + 3, target.motionZ); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); + } else if (target instanceof EntityLivingBase) { ((EntityLivingBase) target).motionY += 3.0D; - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java index 3d21cda8..08189de7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java @@ -18,14 +18,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityBileDemon extends EntityDemon -{ +public class EntityBileDemon extends EntityDemon { private static float maxTamedHealth = 100.0F; private static float maxUntamedHealth = 200.0F; private int attackTimer; - public EntityBileDemon(World par1World) - { + public EntityBileDemon(World par1World) { super(par1World, AlchemicalWizardry.entityBileDemonID); this.setSize(1.3F, 2.0F); this.getNavigator().setAvoidsWater(true); @@ -44,44 +42,37 @@ public class EntityBileDemon extends EntityDemon } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } - //this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(10.0D); + // this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(10.0D); } /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -89,31 +80,27 @@ public class EntityBileDemon extends EntityDemon /** * 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(20, new Byte((byte) BlockColored.getBlockFromDye(1))); + // this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1))); } /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer); @@ -122,8 +109,7 @@ public class EntityBileDemon extends EntityDemon /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -133,32 +119,28 @@ public class EntityBileDemon extends EntityDemon /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { + protected String getLivingSound() { return "none"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.irongolem.hit"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.irongolem.death"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 1.0F; } @@ -166,12 +148,10 @@ public class EntityBileDemon extends EntityDemon * 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 (attackTimer > 0) - { + if (attackTimer > 0) { attackTimer--; } } @@ -179,13 +159,11 @@ public class EntityBileDemon extends EntityDemon /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -193,26 +171,21 @@ public class EntityBileDemon extends EntityDemon * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -220,14 +193,13 @@ public class EntityBileDemon extends EntityDemon } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { this.attackTimer = 10; this.worldObj.setEntityState(this, (byte) 4); - boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15))); + boolean flag = + par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15))); - if (flag) - { + if (flag) { par1Entity.motionY += 0.4000000059604645D; } @@ -235,15 +207,12 @@ public class EntityBileDemon extends EntityDemon return flag; } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -252,30 +221,25 @@ public class EntityBileDemon extends EntityDemon * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -283,10 +247,11 @@ public class EntityBileDemon extends EntityDemon } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -296,22 +261,17 @@ public class EntityBileDemon extends EntityDemon this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -320,8 +280,7 @@ public class EntityBileDemon extends EntityDemon this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -337,62 +296,56 @@ public class EntityBileDemon extends EntityDemon * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } @Override - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityBileDemon) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityBileDemon) { EntityBileDemon entitywolf = (EntityBileDemon) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java index 2dad0271..909557c4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java @@ -20,15 +20,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityBoulderFist extends EntityDemon -{ - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); +public class EntityBoulderFist extends EntityDemon { + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private static float maxTamedHealth = 60.0F; private static float maxUntamedHealth = 50.0F; - public EntityBoulderFist(World par1World) - { + public EntityBoulderFist(World par1World) { super(par1World, AlchemicalWizardry.entityBoulderFistID); this.setSize(0.8F, 1.2F); this.getNavigator().setAvoidsWater(true); @@ -47,25 +46,21 @@ public class EntityBoulderFist extends EntityDemon this.setAggro(false); this.setTamed(false); - if (par1World != null && !par1World.isRemote) - { + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -73,23 +68,19 @@ public class EntityBoulderFist extends EntityDemon /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -97,13 +88,11 @@ public class EntityBoulderFist extends EntityDemon /** * 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()); } @@ -111,24 +100,21 @@ public class EntityBoulderFist extends EntityDemon /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -138,33 +124,35 @@ public class EntityBoulderFist extends EntityDemon /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { - //TODO change sounds - 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() { + // TODO change sounds + 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; } @@ -172,21 +160,18 @@ public class EntityBoulderFist extends EntityDemon * 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(); } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -194,26 +179,21 @@ public class EntityBoulderFist extends EntityDemon * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -221,21 +201,17 @@ public class EntityBoulderFist extends EntityDemon } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 6 : 7; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -244,30 +220,25 @@ public class EntityBoulderFist extends EntityDemon * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -275,10 +246,11 @@ public class EntityBoulderFist extends EntityDemon } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -288,22 +260,17 @@ public class EntityBoulderFist extends EntityDemon this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -312,8 +279,7 @@ public class EntityBoulderFist extends EntityDemon this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -325,66 +291,59 @@ public class EntityBoulderFist extends EntityDemon return super.interact(par1EntityPlayer); } - /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } @Override - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityBoulderFist) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityBoulderFist) { EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } @@ -392,8 +351,7 @@ public class EntityBoulderFist extends EntityDemon /** * Attack the specified entity using a ranged attack. */ - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 5, 600); this.worldObj.spawnEntityInWorld(hol); } @@ -401,10 +359,9 @@ public class EntityBoulderFist extends EntityDemon /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); - //this.tasks.removeTask(this.aiArrowAttack); + // this.tasks.removeTask(this.aiArrowAttack); this.tasks.addTask(4, this.aiAttackOnCollide); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java index a9179329..764f3858 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java @@ -1,5 +1,9 @@ package WayofTime.alchemicalWizardry.common.entity.mob; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.IDemon; +import WayofTime.alchemicalWizardry.common.items.DemonPlacer; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.player.EntityPlayer; @@ -7,121 +11,97 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.IDemon; -import WayofTime.alchemicalWizardry.common.items.DemonPlacer; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class EntityDemon extends EntityTameable implements IDemon -{ +public class EntityDemon extends EntityTameable implements IDemon { private boolean isAggro; private String demonID; - + protected boolean dropCrystal = true; - public EntityDemon(World par1World, String demonID) - { + public EntityDemon(World par1World, String demonID) { super(par1World); this.demonID = demonID; } - + @Override - public boolean getDoesDropCrystal() - { - return dropCrystal; - } - - @Override - public void setDropCrystal(boolean crystal) - { - this.dropCrystal = crystal; + public boolean getDoesDropCrystal() { + return dropCrystal; } @Override - public void setSummonedConditions() - { + public void setDropCrystal(boolean crystal) { + this.dropCrystal = crystal; + } + + @Override + public void setSummonedConditions() { this.setAggro(true); } @Override - public boolean isAggro() - { + public boolean isAggro() { return this.isAggro; } @Override - public void setAggro(boolean aggro) - { + public void setAggro(boolean aggro) { this.isAggro = aggro; } @Override - public EntityAgeable createChild(EntityAgeable entityageable) - { + public EntityAgeable createChild(EntityAgeable entityageable) { // TODO Auto-generated method stub return null; } @Override - public void writeToNBT(NBTTagCompound tag) - { - super.writeToNBT(tag); - - tag.setBoolean("dropCrystal", this.getDoesDropCrystal()); - } - - @Override - public void readFromNBT(NBTTagCompound tag) - { - super.readFromNBT(tag); - - this.setDropCrystal(tag.getBoolean("dropCrystal")); + public void writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + + tag.setBoolean("dropCrystal", this.getDoesDropCrystal()); } @Override - protected void dropFewItems(boolean par1, int par2) - { - if(this.getDoesDropCrystal()) - { - ItemStack drop = new ItemStack(ModItems.demonPlacer); - + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + + this.setDropCrystal(tag.getBoolean("dropCrystal")); + } + + @Override + protected void dropFewItems(boolean par1, int par2) { + if (this.getDoesDropCrystal()) { + ItemStack drop = new ItemStack(ModItems.demonPlacer); + DemonPlacer.setDemonString(drop, this.getDemonID()); - if ((this.getOwner() instanceof EntityPlayer)) - { + if ((this.getOwner() instanceof EntityPlayer)) { DemonPlacer.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer) this.getOwner())); } - if (this.hasCustomNameTag()) - { + if (this.hasCustomNameTag()) { drop.setStackDisplayName(this.getCustomNameTag()); } this.entityDropItem(drop, 0.0f); - } + } } - public void onLivingUpdate() - { + public void onLivingUpdate() { super.onLivingUpdate(); - if (!this.isAggro() && worldObj.getWorldTime() % 100 == 0) - { + if (!this.isAggro() && worldObj.getWorldTime() % 100 == 0) { this.heal(1); } } - public void sendSittingMessageToPlayer(EntityPlayer owner, boolean isSitting) - { - if (owner != null && owner.worldObj.isRemote) - { + public void sendSittingMessageToPlayer(EntityPlayer owner, boolean isSitting) { + if (owner != null && owner.worldObj.isRemote) { ChatComponentTranslation chatmessagecomponent; - if (isSitting) - { + if (isSitting) { chatmessagecomponent = new ChatComponentTranslation("message.demon.willstay"); - } else - { + } else { chatmessagecomponent = new ChatComponentTranslation("message.demon.shallfollow"); } @@ -129,13 +109,11 @@ public class EntityDemon extends EntityTameable implements IDemon } } - public String getDemonID() - { + public String getDemonID() { return this.demonID; } - - protected void setDemonID(String id) - { - this.demonID = id; + + protected void setDemonID(String id) { + this.demonID = id; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityEarthElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityEarthElemental.java index e6915fb6..a4a25675 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityEarthElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityEarthElemental.java @@ -9,20 +9,17 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityEarthElemental extends EntityElemental implements IMob -{ - public EntityEarthElemental(World world) - { +public class EntityEarthElemental extends EntityElemental implements IMob { + public EntityEarthElemental(World world) { super(world, AlchemicalWizardry.entityEarthElementalID); } - public void inflictEffectOnEntity(Entity target) - { - if (target instanceof EntityLivingBase) - { + public void inflictEffectOnEntity(Entity target) { + if (target instanceof EntityLivingBase) { target.attackEntityFrom(DamageSource.causeMobDamage(this), 10); ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 4)); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java index 6b6d73e2..9c399482 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java @@ -1,7 +1,8 @@ package WayofTime.alchemicalWizardry.common.entity.mob; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModItems; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -19,25 +20,21 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModItems; -public class EntityElemental extends EntityDemon -{ - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); +public class EntityElemental extends EntityDemon { + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private static float maxTamedHealth = 100.0F; private static float maxUntamedHealth = 100.0F; - public EntityElemental(World par1World, String entityAirElementalID) - { + public EntityElemental(World par1World, String entityAirElementalID) { super(par1World, entityAirElementalID); this.setSize(0.5F, 1.0F); this.setAggro(false); this.setTamed(false); - if (par1World != null && !par1World.isRemote) - { + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } } @@ -52,62 +49,54 @@ public class EntityElemental extends EntityDemon * Cooldown time between target loss and new target aquirement. */ private int aggroCooldown; + public int prevAttackCounter; public int attackCounter; /** * The explosion radius of spawned fireballs. */ - protected void dropFewItems(boolean par1, int par2) - { - if (worldObj.rand.nextFloat() < (1 - Math.pow(0.6f, par2 + 1))) - { + protected void dropFewItems(boolean par1, int par2) { + if (worldObj.rand.nextFloat() < (1 - Math.pow(0.6f, par2 + 1))) { this.entityDropItem(new ItemStack(ModItems.demonBloodShard, 1, 0), 0.0f); } } - protected void fall(float par1) - { - } + protected void fall(float par1) {} /** * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround */ - protected void updateFallState(double par1, boolean par3) - { - } + protected void updateFallState(double par1, boolean par3) {} /** * Moves the entity based on the specified heading. Args: strafe, forward */ - public void moveEntityWithHeading(float par1, float par2) - { - if (this.isInWater()) - { + public void moveEntityWithHeading(float par1, float par2) { + if (this.isInWater()) { this.moveFlying(par1, par2, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.800000011920929D; this.motionY *= 0.800000011920929D; this.motionZ *= 0.800000011920929D; - } else if (this.handleLavaMovement()) - { + } else if (this.handleLavaMovement()) { this.moveFlying(par1, par2, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.5D; this.motionY *= 0.5D; this.motionZ *= 0.5D; - } else - { + } else { float f2 = 0.91F; - if (this.onGround) - { + if (this.onGround) { f2 = 0.54600006F; - Block i = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + Block i = this.worldObj.getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)); - if (i != null) - { + if (i != null) { f2 = i.slipperiness * 0.91F; } } @@ -116,13 +105,14 @@ public class EntityElemental extends EntityDemon this.moveFlying(par1, par2, this.onGround ? 0.1F * f3 : 0.02F); f2 = 0.91F; - if (this.onGround) - { + if (this.onGround) { f2 = 0.54600006F; - Block j = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + Block j = this.worldObj.getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)); - if (j != null) - { + if (j != null) { f2 = j.slipperiness * 0.91F; } } @@ -137,15 +127,12 @@ public class EntityElemental extends EntityDemon /** * returns true if this entity is by a ladder, false otherwise */ - public boolean isOnLadder() - { + public boolean isOnLadder() { return false; } - protected void updateEntityActionState() - { - if (this.getHealth() <= this.getMaxHealth() / 2.0f && worldObj.rand.nextInt(200) == 0) - { + protected void updateEntityActionState() { + if (this.getHealth() <= this.getMaxHealth() / 2.0f && worldObj.rand.nextInt(200) == 0) { this.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionReciprocation.id, 100, 1)); } @@ -155,67 +142,62 @@ public class EntityElemental extends EntityDemon double d2 = this.waypointZ - this.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (d3 < 1.0D || d3 > 3600.0D) - { + if (d3 < 1.0D || d3 > 3600.0D) { this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); } - if (this.courseChangeCooldown-- <= 0) - { + if (this.courseChangeCooldown-- <= 0) { this.courseChangeCooldown += this.rand.nextInt(5) + 2; d3 = (double) MathHelper.sqrt_double(d3); - if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) - { + if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) { this.motionX += d0 / d3 * 0.1D; this.motionY += d1 / d3 * 0.1D; this.motionZ += d2 / d3 * 0.1D; - } else - { + } else { this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); } } - if (this.targetedEntity != null && this.targetedEntity.isDead) - { + if (this.targetedEntity != null && this.targetedEntity.isDead) { this.targetedEntity = null; } - if (this.targetedEntity == null || this.aggroCooldown-- <= 0) - { + if (this.targetedEntity == null || this.aggroCooldown-- <= 0) { this.targetedEntity = getClosestVulnerableMonsterToEntity(this, 100.0D); - if (this.targetedEntity != null) - { + if (this.targetedEntity != null) { this.aggroCooldown = 20; } } double d4 = 64.0D; - if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4) - { + if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4) { double d5 = this.targetedEntity.posX - this.posX; - double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - (this.posY + (double) (this.height / 2.0F)); + double d6 = this.targetedEntity.boundingBox.minY + + (double) (this.targetedEntity.height / 2.0F) + - (this.posY + (double) (this.height / 2.0F)); double d7 = this.targetedEntity.posZ - this.posZ; this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI; - if (this.courseChangeCooldown <= 0) - { - if (isCourseTraversable(this.targetedEntity.posX, this.targetedEntity.posY, this.targetedEntity.posZ, Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7))) - { + if (this.courseChangeCooldown <= 0) { + if (isCourseTraversable( + this.targetedEntity.posX, + this.targetedEntity.posY, + this.targetedEntity.posZ, + Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7))) { this.waypointX = this.targetedEntity.posX; this.waypointY = this.targetedEntity.posY; this.waypointZ = this.targetedEntity.posZ; this.motionX += d5 / d3 * 0.1D; this.motionY += d6 / d3 * 0.1D; this.motionZ += d7 / d3 * 0.1D; - } else - { + } else { this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); @@ -225,29 +207,25 @@ public class EntityElemental extends EntityDemon } } - if (this.canEntityBeSeen(this.targetedEntity)) - { - if (Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7) < 4) - { + if (this.canEntityBeSeen(this.targetedEntity)) { + if (Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7) < 4) { ++this.attackCounter; - if (this.attackCounter >= 10) - { - this.worldObj.playAuxSFXAtEntity(null, 1008, (int) this.posX, (int) this.posY, (int) this.posZ, 0); + if (this.attackCounter >= 10) { + this.worldObj.playAuxSFXAtEntity( + null, 1008, (int) this.posX, (int) this.posY, (int) this.posZ, 0); this.inflictEffectOnEntity(this.targetedEntity); this.attackCounter = -40; } } - } else if (this.attackCounter > 0) - { + } else if (this.attackCounter > 0) { --this.attackCounter; } - } else - { - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(motionX, this.motionZ)) * 180.0F / (float) Math.PI; + } else { + this.renderYawOffset = + this.rotationYaw = -((float) Math.atan2(motionX, this.motionZ)) * 180.0F / (float) Math.PI; - if (this.attackCounter > 0) - { + if (this.attackCounter > 0) { --this.attackCounter; } } @@ -256,19 +234,16 @@ public class EntityElemental extends EntityDemon /** * True if the ghast has an unobstructed line of travel to the waypoint. */ - private boolean isCourseTraversable(double par1, double par3, double par5, double par7) - { + private boolean isCourseTraversable(double par1, double par3, double par5, double par7) { double d4 = (this.waypointX - this.posX) / par7; double d5 = (this.waypointY - this.posY) / par7; double d6 = (this.waypointZ - this.posZ) / par7; AxisAlignedBB axisalignedbb = this.boundingBox.copy(); - for (int i = 1; (double) i < par7; ++i) - { + for (int i = 1; (double) i < par7; ++i) { axisalignedbb.offset(d4, d5, d6); - if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) - { + if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) { return false; } } @@ -279,42 +254,36 @@ public class EntityElemental extends EntityDemon /** * Will return how many at most can spawn in a chunk at once. */ - public int getMaxSpawnedInChunk() - { + public int getMaxSpawnedInChunk() { return 1; } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setCombatTask(); } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -322,29 +291,25 @@ public class EntityElemental extends EntityDemon /** * Returns true if the newer Entity AI code should be run */ - public boolean isAIEnabled() - { + public boolean isAIEnabled() { return false; } /** * Sets the active target the Task system uses for tracking */ - public void setAttackTarget(EntityLivingBase par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); } /** * 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, 0); @@ -353,41 +318,36 @@ public class EntityElemental extends EntityDemon /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { - //TODO change sounds + protected String getLivingSound() { + // TODO change sounds return "none"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "none"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "none"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } @@ -395,21 +355,18 @@ public class EntityElemental extends EntityDemon * 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(); } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -417,26 +374,21 @@ public class EntityElemental extends EntityDemon * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -444,21 +396,17 @@ public class EntityElemental extends EntityDemon } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 6 : 7; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -471,61 +419,55 @@ public class EntityElemental extends EntityDemon * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } @Override - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityBoulderFist) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityBoulderFist) { EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } - /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.addTask(4, this.aiAttackOnCollide); } - public void inflictEffectOnEntity(Entity target) - { - if (target instanceof EntityLivingBase) - { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 0)); + public void inflictEffectOnEntity(Entity target) { + if (target instanceof EntityLivingBase) { + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 0)); } } - public static Entity getClosestVulnerableMonsterToEntity(Entity par1Entity, double par2) - { + public static Entity getClosestVulnerableMonsterToEntity(Entity par1Entity, double par2) { double d4 = -1.0D; double par1 = par1Entity.posX; double par3 = par1Entity.posY; @@ -536,42 +478,41 @@ public class EntityElemental extends EntityDemon double range = Math.sqrt(par2); double verticalRange = Math.sqrt(par2); - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par1 - 0.5f, par3 - 0.5f, par5 - 0.5f, par1 + 0.5f, par3 + 0.5f, par5 + 0.5f).expand(range, verticalRange, range)); - if (entities == null) - { + List entities = world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + par1 - 0.5f, par3 - 0.5f, par5 - 0.5f, par1 + 0.5f, par3 + 0.5f, par5 + 0.5f) + .expand(range, verticalRange, range)); + if (entities == null) { return null; } - for (int i = 0; i < entities.size(); ++i) - { + for (int i = 0; i < entities.size(); ++i) { EntityLivingBase entityLiving1 = entities.get(i); - if (!(entityLiving1 instanceof EntityPlayer && ((EntityPlayer) entityLiving1).capabilities.disableDamage) && entityLiving1.isEntityAlive()) - { + if (!(entityLiving1 instanceof EntityPlayer && ((EntityPlayer) entityLiving1).capabilities.disableDamage) + && entityLiving1.isEntityAlive()) { double d5 = entityLiving1.getDistanceSq(par1, par3, par5); double d6 = par2; - if (entityLiving1.isSneaking()) - { + if (entityLiving1.isSneaking()) { d6 = par2 * 0.800000011920929D; } - if (entityLiving1.isInvisible()) - { - float f = entityLiving1 instanceof EntityPlayer ? ((EntityPlayer) entityLiving1).getArmorVisibility() : 1.0f; + if (entityLiving1.isInvisible()) { + float f = entityLiving1 instanceof EntityPlayer + ? ((EntityPlayer) entityLiving1).getArmorVisibility() + : 1.0f; - if (f < 0.1F) - { + if (f < 0.1F) { f = 0.1F; } d6 *= (double) (0.7F * f); } - if ((par2 < 0.0D || d5 < d6 * d6) && (d4 == -1.0D || d5 < d4)) - { - if (par1Entity != entityLiving1) - { + if ((par2 < 0.0D || d5 < d6 * d6) && (d4 == -1.0D || d5 < d4)) { + if (par1Entity != entityLiving1) { d4 = d5; entityLiving = entityLiving1; } @@ -583,8 +524,7 @@ public class EntityElemental extends EntityDemon } @Override - public int getTotalArmorValue() - { + public int getTotalArmorValue() { return 10; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java index 3187dccf..68aed12d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java @@ -18,16 +18,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob -{ +public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob { private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F); - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private static float maxTamedHealth = 50.0F; private static float maxUntamedHealth = 50.0F; - public EntityFallenAngel(World par1World) - { + public EntityFallenAngel(World par1World) { super(par1World, AlchemicalWizardry.entityFallenAngelID); this.setSize(0.7F, 1.8F); this.getNavigator().setAvoidsWater(true); @@ -44,27 +43,23 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob this.setAggro(false); this.setTamed(false); - if (par1World != null && !par1World.isRemote) - { + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } - //this.isImmuneToFire = true; + // this.isImmuneToFire = true; } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -72,23 +67,19 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -96,13 +87,11 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob /** * 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()); } @@ -110,16 +99,14 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); } @@ -127,8 +114,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -138,33 +124,29 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { - //TODO change sounds + protected String getLivingSound() { + // TODO change sounds return "none"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "none"; } /** * 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; } @@ -172,21 +154,18 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob * 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(); } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -194,26 +173,21 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -221,21 +195,17 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 4 : 2; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -244,30 +214,25 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -275,10 +240,11 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -288,22 +254,17 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -312,8 +273,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -325,67 +285,61 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob return super.interact(par1EntityPlayer); } - /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; - //return par1ItemStack == null ? false : (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood) ? false : ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat()); + // return par1ItemStack == null ? false : (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood) ? false : + // ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat()); } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { - //return !this.isTamed() && this.ticksExisted > 2400; + protected boolean canDespawn() { + // return !this.isTamed() && this.ticksExisted > 2400; return false; } - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityFallenAngel) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityFallenAngel) { EntityFallenAngel entitywolf = (EntityFallenAngel) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } @@ -393,8 +347,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob /** * Attack the specified entity using a ranged attack. */ - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 5, 600); this.worldObj.spawnEntityInWorld(hol); } @@ -402,8 +355,7 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiArrowAttack); this.tasks.addTask(4, this.aiArrowAttack); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFireElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFireElemental.java index b09aa6e5..fe6c49ba 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFireElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFireElemental.java @@ -7,20 +7,17 @@ import net.minecraft.entity.monster.IMob; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class EntityFireElemental extends EntityElemental implements IMob -{ - public EntityFireElemental(World world) - { +public class EntityFireElemental extends EntityElemental implements IMob { + public EntityFireElemental(World world) { super(world, AlchemicalWizardry.entityFireElementalID); this.isImmuneToFire = true; } - public void inflictEffectOnEntity(Entity target) - { - if (target instanceof EntityLivingBase) - { + public void inflictEffectOnEntity(Entity target) { + if (target instanceof EntityLivingBase) { target.setFire(10); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityHolyElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityHolyElemental.java index 51be44c9..7132ae67 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityHolyElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityHolyElemental.java @@ -9,20 +9,17 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityHolyElemental extends EntityElemental implements IMob -{ - public EntityHolyElemental(World world) - { +public class EntityHolyElemental extends EntityElemental implements IMob { + public EntityHolyElemental(World world) { super(world, AlchemicalWizardry.entityHolyElementalID); } - public void inflictEffectOnEntity(Entity target) - { - if (target instanceof EntityLivingBase) - { + public void inflictEffectOnEntity(Entity target) { + if (target instanceof EntityLivingBase) { target.attackEntityFrom(DamageSource.causeMobDamage(this), 15); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.poison.id, 100, 1)); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityIceDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityIceDemon.java index 854926e7..dfdca9b4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityIceDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityIceDemon.java @@ -1,5 +1,10 @@ package WayofTime.alchemicalWizardry.common.entity.mob; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.EntityAITargetAggro; +import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IRangedAttackMob; @@ -25,22 +30,16 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.EntityAITargetAggro; -import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class EntityIceDemon extends EntityDemon implements IRangedAttackMob -{ +public class EntityIceDemon extends EntityDemon implements IRangedAttackMob { private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 30, 50, 15.0F); - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private static float maxTamedHealth = 50.0F; private static float maxUntamedHealth = 30.0F; - public EntityIceDemon(World par1World) - { + public EntityIceDemon(World par1World) { super(par1World, AlchemicalWizardry.entityIceDemonID); this.setSize(0.5F, 2.0F); this.tasks.addTask(1, new EntityAISwimming(this)); @@ -56,25 +55,21 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob this.setAggro(false); this.setTamed(false); - if (par1World != null && !par1World.isRemote) - { + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.40000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -82,23 +77,19 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -106,13 +97,11 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * 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()); } @@ -120,16 +109,14 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); } @@ -137,8 +124,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -148,32 +134,28 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { + protected String getLivingSound() { return "none"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.irongolem.hit"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.irongolem.death"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } @@ -181,8 +163,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob * 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(); int range = 2; @@ -192,14 +173,10 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob int yCoord = (int) (blockVector.yCoord); int zCoord = (int) (blockVector.zCoord); - for (int i = -range; i <= range; i++) - { - for (int j = -range; j <= range; j++) - { - for (int k = -range; k <= range; k++) - { - if (worldObj.rand.nextFloat() < 0.25f) - { + for (int i = -range; i <= range; i++) { + for (int j = -range; j <= range; j++) { + for (int k = -range; k <= range; k++) { + if (worldObj.rand.nextFloat() < 0.25f) { SpellHelper.freezeWaterBlock(worldObj, xCoord + i, yCoord + j, zCoord + k); } } @@ -210,13 +187,11 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -224,26 +199,21 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -251,21 +221,17 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 4 : 2; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -274,30 +240,25 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -305,10 +266,11 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -318,22 +280,17 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -342,8 +299,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -355,65 +311,58 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob return super.interact(par1EntityPlayer); } - /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityIceDemon) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityIceDemon) { EntityIceDemon entitywolf = (EntityIceDemon) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } @@ -421,8 +370,7 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * Attack the specified entity using a ranged attack. */ - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 3, 600); this.worldObj.spawnEntityInWorld(hol); } @@ -430,10 +378,9 @@ public class EntityIceDemon extends EntityDemon implements IRangedAttackMob /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiArrowAttack); this.tasks.addTask(4, this.aiArrowAttack); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java index e6d9955f..b84d2bca 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java @@ -19,14 +19,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityLowerGuardian extends EntityDemon -{ +public class EntityLowerGuardian extends EntityDemon { private static float maxTamedHealth = 50.0F; private static float maxUntamedHealth = 30.0F; private int attackTimer; - public EntityLowerGuardian(World par1World) - { + public EntityLowerGuardian(World par1World) { super(par1World, AlchemicalWizardry.entityLowerGuardianID); this.setSize(0.7F, 1.8F); this.getNavigator().setAvoidsWater(true); @@ -47,18 +45,15 @@ public class EntityLowerGuardian extends EntityDemon } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -66,23 +61,19 @@ public class EntityLowerGuardian extends EntityDemon /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -90,13 +81,11 @@ public class EntityLowerGuardian extends EntityDemon /** * 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()); } @@ -104,16 +93,14 @@ public class EntityLowerGuardian extends EntityDemon /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer); @@ -123,8 +110,7 @@ public class EntityLowerGuardian extends EntityDemon /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -134,32 +120,28 @@ public class EntityLowerGuardian extends EntityDemon /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { + protected String getLivingSound() { return "none"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.irongolem.hit"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.irongolem.death"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 1.0F; } @@ -167,31 +149,26 @@ public class EntityLowerGuardian extends EntityDemon * 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 (attackTimer > 0) - { + if (attackTimer > 0) { attackTimer--; } } - public int getAttackTimer() - { + public int getAttackTimer() { return attackTimer; } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -199,26 +176,21 @@ public class EntityLowerGuardian extends EntityDemon * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -226,14 +198,13 @@ public class EntityLowerGuardian extends EntityDemon } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { this.attackTimer = 10; this.worldObj.setEntityState(this, (byte) 4); - boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15))); + boolean flag = + par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15))); - if (flag) - { + if (flag) { par1Entity.motionY += 0.4000000059604645D; } @@ -241,15 +212,12 @@ public class EntityLowerGuardian extends EntityDemon return flag; } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -258,30 +226,25 @@ public class EntityLowerGuardian extends EntityDemon * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -289,10 +252,11 @@ public class EntityLowerGuardian extends EntityDemon } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -302,22 +266,17 @@ public class EntityLowerGuardian extends EntityDemon this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -326,8 +285,7 @@ public class EntityLowerGuardian extends EntityDemon this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -339,65 +297,58 @@ public class EntityLowerGuardian extends EntityDemon return super.interact(par1EntityPlayer); } - /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityLowerGuardian) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityLowerGuardian) { EntityLowerGuardian entitywolf = (EntityLowerGuardian) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java index f73ba7c8..0609dd03 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java @@ -20,15 +20,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityShade extends EntityDemon -{ - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); +public class EntityShade extends EntityDemon { + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private static float maxTamedHealth = 50.0F; private static float maxUntamedHealth = 100.0F; - public EntityShade(World par1World) - { + public EntityShade(World par1World) { super(par1World, AlchemicalWizardry.entityShadeID); this.setSize(0.8F, 2.0F); this.getNavigator().setAvoidsWater(true); @@ -46,25 +45,21 @@ public class EntityShade extends EntityDemon this.setAggro(false); this.setTamed(false); - if (par1World != null && !par1World.isRemote) - { + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -72,23 +67,19 @@ public class EntityShade extends EntityDemon /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -96,13 +87,11 @@ public class EntityShade extends EntityDemon /** * 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()); } @@ -110,16 +99,14 @@ public class EntityShade extends EntityDemon /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); } @@ -127,8 +114,7 @@ public class EntityShade extends EntityDemon /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -138,33 +124,29 @@ public class EntityShade extends EntityDemon /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { - //TODO change sounds + protected String getLivingSound() { + // TODO change sounds return "none"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "none"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "none"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } @@ -172,21 +154,18 @@ public class EntityShade extends EntityDemon * 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(); } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -194,26 +173,21 @@ public class EntityShade extends EntityDemon * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -221,21 +195,17 @@ public class EntityShade extends EntityDemon } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 6 : 7; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -244,30 +214,25 @@ public class EntityShade extends EntityDemon * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -275,10 +240,11 @@ public class EntityShade extends EntityDemon } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -288,22 +254,18 @@ public class EntityShade extends EntityDemon this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, (ItemStack) null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -312,8 +274,7 @@ public class EntityShade extends EntityDemon this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -325,65 +286,58 @@ public class EntityShade extends EntityDemon return super.interact(par1EntityPlayer); } - /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityBoulderFist) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityBoulderFist) { EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } @@ -391,8 +345,7 @@ public class EntityShade extends EntityDemon /** * Attack the specified entity using a ranged attack. */ - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 5, 600); this.worldObj.spawnEntityInWorld(hol); } @@ -400,10 +353,9 @@ public class EntityShade extends EntityDemon /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); - //this.tasks.removeTask(this.aiArrowAttack); + // this.tasks.removeTask(this.aiArrowAttack); this.tasks.addTask(4, this.aiAttackOnCollide); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShadeElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShadeElemental.java index 004fcce4..033ab94a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShadeElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShadeElemental.java @@ -8,20 +8,17 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class EntityShadeElemental extends EntityElemental implements IMob -{ - public EntityShadeElemental(World world) - { +public class EntityShadeElemental extends EntityElemental implements IMob { + public EntityShadeElemental(World world) { super(world, AlchemicalWizardry.entityShadeElementalID); } - public void inflictEffectOnEntity(Entity target) - { - if (target instanceof EntityLivingBase) - { + public void inflictEffectOnEntity(Entity target) { + if (target instanceof EntityLivingBase) { ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 1)); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.nightVision.id, 100, 0)); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java index 0ebeb103..e54fe21a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java @@ -18,16 +18,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackMob -{ +public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackMob { private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 25, 25, 15.0F); - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private static float maxTamedHealth = 20.0F; private static float maxUntamedHealth = 10.0F; - public EntitySmallEarthGolem(World par1World) - { + public EntitySmallEarthGolem(World par1World) { super(par1World, AlchemicalWizardry.entitySmallEarthGolemID); this.setSize(0.2F, 1.0F); this.getNavigator().setAvoidsWater(true); @@ -44,25 +43,21 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM this.setAggro(false); this.setTamed(false); - if (par1World != null && !par1World.isRemote) - { + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.40000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -70,23 +65,19 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -94,13 +85,11 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM /** * 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()); } @@ -108,16 +97,14 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); } @@ -125,8 +112,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -136,32 +122,28 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { + protected String getLivingSound() { return "none"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.irongolem.hit"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.irongolem.death"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } @@ -169,21 +151,18 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM * 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(); } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -191,26 +170,21 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -218,21 +192,17 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 4 : 2; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -241,30 +211,25 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -272,10 +237,11 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -285,22 +251,18 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, (ItemStack) null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -309,8 +271,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -322,65 +283,58 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM return super.interact(par1EntityPlayer); } - /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntitySmallEarthGolem) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntitySmallEarthGolem) { EntitySmallEarthGolem entitywolf = (EntitySmallEarthGolem) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } @@ -388,8 +342,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM /** * Attack the specified entity using a ranged attack. */ - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { MudProjectile hol = new MudProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 3, 600, false); this.worldObj.spawnEntityInWorld(hol); } @@ -397,8 +350,7 @@ public class EntitySmallEarthGolem extends EntityDemon implements IRangedAttackM /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiArrowAttack); this.tasks.addTask(4, this.aiArrowAttack); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWaterElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWaterElemental.java index ab141887..0018e9b1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWaterElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWaterElemental.java @@ -7,19 +7,17 @@ import net.minecraft.entity.monster.IMob; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class EntityWaterElemental extends EntityElemental implements IMob -{ - public EntityWaterElemental(World world) - { +public class EntityWaterElemental extends EntityElemental implements IMob { + public EntityWaterElemental(World world) { super(world, AlchemicalWizardry.entityWaterElementalID); } - public void inflictEffectOnEntity(Entity target) - { - if (target instanceof EntityLivingBase) - { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 2)); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); + public void inflictEffectOnEntity(Entity target) { + if (target instanceof EntityLivingBase) { + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 2)); + ((EntityLivingBase) target) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java index 02389aac..1e1afaf4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java @@ -18,16 +18,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackMob -{ +public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackMob { private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F); - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); + private EntityAIAttackOnCollide aiAttackOnCollide = + new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private static float maxTamedHealth = 100.0F; private static float maxUntamedHealth = 200.0F; - public EntityWingedFireDemon(World par1World) - { + public EntityWingedFireDemon(World par1World) { super(par1World, AlchemicalWizardry.entityWingedFireDemonID); this.setSize(0.7F, 1.8F); this.getNavigator().setAvoidsWater(true); @@ -44,8 +43,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM this.setAggro(false); this.setTamed(false); - if (par1World != null && !par1World.isRemote) - { + if (par1World != null && !par1World.isRemote) { this.setCombatTask(); } @@ -53,44 +51,37 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - //This line affects the speed of the monster + // This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - //My guess is that this will alter the max health - if (this.isTamed()) - { + // My guess is that this will alter the max health + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } - //this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(10.0D); + // this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(10.0D); } /** * 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 par1EntityLivingBase) - { + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { super.setAttackTarget(par1EntityLivingBase); - if (par1EntityLivingBase == null) - { + if (par1EntityLivingBase == null) { this.setAngry(false); - } else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -98,13 +89,11 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM /** * 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()); } @@ -112,16 +101,14 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound(int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.zombie.step", 0.15F, 1.0F); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); } @@ -129,8 +116,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); @@ -140,40 +126,35 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM /** * Returns the sound this mob makes while it's alive. */ - protected String getLivingSound() - { + protected String getLivingSound() { return "mob.blaze.breathe"; } /** * Returns the sound this mob makes when it is hurt. */ - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.blaze.hit"; } /** * Returns the sound this mob makes on death. */ - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.blaze.death"; } /** * Returns the volume for the sounds this mob makes. */ - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } /** * Returns the item ID for the item the mob drops on death. */ - protected int getDropItemId() - { + protected int getDropItemId() { return -1; } @@ -181,21 +162,18 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM * 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(); } /** * Called to update the entity's position/logic. */ - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); } - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @@ -203,26 +181,21 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM * 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 par1DamageSource, float par2) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if (this.isEntityInvulnerable()) { return false; - } else - { + } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } @@ -230,21 +203,17 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM } } - public boolean attackEntityAsMob(Entity par1Entity) - { + public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 4 : 2; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i); } - public void setTamed(boolean par1) - { + public void setTamed(boolean par1) { super.setTamed(par1); - if (par1) - { + if (par1) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth); - } else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth); } } @@ -253,30 +222,25 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer par1EntityPlayer) - { + public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + if (itemfood.isWolfsFavoriteMeat() + && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); + if (itemstack.stackSize <= 0) { + par1EntityPlayer.inventory.setInventorySlotContents( + par1EntityPlayer.inventory.currentItem, null); } return true; @@ -284,10 +248,11 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM } } - if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack)) - { - if (!this.worldObj.isRemote) - { + if (this.getOwner() instanceof EntityPlayer + && SpellHelper.getUsername(par1EntityPlayer) + .equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) + && !this.isBreedingItem(itemstack)) { + if (!this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.setPathToEntity(null); @@ -297,22 +262,17 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) - { - if (!par1EntityPlayer.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { + if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { + if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(1) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(1) == 0) { this.setTamed(true); this.setPathToEntity(null); this.setAttackTarget(null); @@ -321,8 +281,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM this.func_152115_b(par1EntityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); - } else - { + } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } @@ -334,65 +293,58 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM return super.interact(par1EntityPlayer); } - /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ - public boolean isBreedingItem(ItemStack par1ItemStack) - { + public boolean isBreedingItem(ItemStack par1ItemStack) { return false; } /** * 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 par1) - { + public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (par1) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Determines if an entity can be despawned, used on idle far away entities */ - protected boolean canDespawn() - { + protected boolean canDespawn() { return false; } - public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) - { - if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) - { - if (par1EntityLivingBase instanceof EntityWingedFireDemon) - { + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) { + if (par1EntityLivingBase instanceof EntityWingedFireDemon) { EntityWingedFireDemon entitywolf = (EntityWingedFireDemon) par1EntityLivingBase; - if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) - { + if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase) { return false; } } - return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); - } else - { + return par1EntityLivingBase instanceof EntityPlayer + && par2EntityLivingBase instanceof EntityPlayer + && !((EntityPlayer) par2EntityLivingBase) + .canAttackPlayer((EntityPlayer) par1EntityLivingBase) + ? false + : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame(); + } else { return false; } } @@ -400,8 +352,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM /** * Attack the specified entity using a ranged attack. */ - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) - { + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { this.worldObj.playAuxSFXAtEntity(null, 1009, (int) this.posX, (int) this.posY, (int) this.posZ, 0); FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600); this.worldObj.spawnEntityInWorld(hol); @@ -410,8 +361,7 @@ public class EntityWingedFireDemon extends EntityDemon implements IRangedAttackM /** * sets this entity's combat AI. */ - public void setCombatTask() - { + public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiArrowAttack); this.tasks.addTask(4, this.aiArrowAttack); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java index bf7f5263..354eeb11 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java @@ -1,76 +1,79 @@ package WayofTime.alchemicalWizardry.common.entity.mob; -import pneumaticCraft.api.PneumaticRegistry; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.book.BloodMagicGuide; +import amerifrance.guideapi.api.GuideRegistry; import cpw.mods.fml.common.Optional; import net.minecraft.entity.Entity; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.book.BloodMagicGuide; -import amerifrance.guideapi.api.GuideRegistry; +import pneumaticCraft.api.PneumaticRegistry; -public class MailOrderEntityItem extends EntityItem -{ - public MailOrderEntityItem(World par1World, double par2, double par4, double par6) - { - super(par1World, par2, par4, par6); - this.isImmuneToFire = true; - this.lifespan = 72000; - } +public class MailOrderEntityItem extends EntityItem { + public MailOrderEntityItem(World par1World, double par2, double par4, double par6) { + super(par1World, par2, par4, par6); + this.isImmuneToFire = true; + this.lifespan = 72000; + } - public MailOrderEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) - { - this(par1World, par2, par4, par6); - this.setEntityItemStack(par8ItemStack); - this.isImmuneToFire = true; - this.lifespan = (par8ItemStack.getItem() == null ? 6000 : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World)); - } - - public MailOrderEntityItem(World world, Entity original, ItemStack stack) - { - this(world, original.posX, original.posY, original.posZ); - this.delayBeforeCanPickup = 20; - this.motionX = original.motionX; - this.motionY = original.motionY; - this.motionZ = original.motionZ; - this.setEntityItemStack(stack); - this.isImmuneToFire = true; - } + public MailOrderEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) { + this(par1World, par2, par4, par6); + this.setEntityItemStack(par8ItemStack); + this.isImmuneToFire = true; + this.lifespan = (par8ItemStack.getItem() == null + ? 6000 + : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World)); + } - public MailOrderEntityItem(World par1world) - { - super(par1world); - } - - public void onUpdate() - { - super.onUpdate(); - - if(!worldObj.isRemote && this.ticksExisted > 100 && !this.isDead) - { - worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, this.posX, this.posY, this.posZ)); + public MailOrderEntityItem(World world, Entity original, ItemStack stack) { + this(world, original.posX, original.posY, original.posZ); + this.delayBeforeCanPickup = 20; + this.motionX = original.motionX; + this.motionY = original.motionY; + this.motionZ = original.motionZ; + this.setEntityItemStack(stack); + this.isImmuneToFire = true; + } - if(AlchemicalWizardry.isPneumaticCraftLoaded) - { - this.deliverItemViaDrone(this.posX, this.posY, this.posZ); - }else - { - EntityItem entity = new BookEntityItem(worldObj, this.posX, this.posY, this.posZ, GuideRegistry.getItemStackForBook(BloodMagicGuide.bloodMagicGuide)); - entity.lifespan = 6000; - entity.delayBeforeCanPickup = 20; - entity.motionY = 1; - worldObj.spawnEntityInWorld(entity); - } - - this.setDead(); - } - } - - @Optional.Method(modid = "PneumaticCraft") - public void deliverItemViaDrone(double x, double y, double z) - { - PneumaticRegistry.getInstance().deliverItemsAmazonStyle(worldObj, (int)x, (int)y, (int)z, GuideRegistry.getItemStackForBook(BloodMagicGuide.bloodMagicGuide)); - } -} \ No newline at end of file + public MailOrderEntityItem(World par1world) { + super(par1world); + } + + public void onUpdate() { + super.onUpdate(); + + if (!worldObj.isRemote && this.ticksExisted > 100 && !this.isDead) { + worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, this.posX, this.posY, this.posZ)); + + if (AlchemicalWizardry.isPneumaticCraftLoaded) { + this.deliverItemViaDrone(this.posX, this.posY, this.posZ); + } else { + EntityItem entity = new BookEntityItem( + worldObj, + this.posX, + this.posY, + this.posZ, + GuideRegistry.getItemStackForBook(BloodMagicGuide.bloodMagicGuide)); + entity.lifespan = 6000; + entity.delayBeforeCanPickup = 20; + entity.motionY = 1; + worldObj.spawnEntityInWorld(entity); + } + + this.setDead(); + } + } + + @Optional.Method(modid = "PneumaticCraft") + public void deliverItemViaDrone(double x, double y, double z) { + PneumaticRegistry.getInstance() + .deliverItemsAmazonStyle( + worldObj, + (int) x, + (int) y, + (int) z, + GuideRegistry.getItemStackForBook(BloodMagicGuide.bloodMagicGuide)); + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java index 3e5e9bfa..65c59a35 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EnergyBlastProjectile.java @@ -1,8 +1,11 @@ package WayofTime.alchemicalWizardry.common.entity.projectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import cpw.mods.fml.common.registry.IThrowableEntity; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.Iterator; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,14 +20,9 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import cpw.mods.fml.common.registry.IThrowableEntity; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -//Shamelessly ripped off from x3n0ph0b3 -public class EnergyBlastProjectile extends Entity implements IProjectile, IThrowableEntity -{ +// Shamelessly ripped off from x3n0ph0b3 +public class EnergyBlastProjectile extends Entity implements IProjectile, IThrowableEntity { protected int xTile = -1; protected int yTile = -1; protected int zTile = -1; @@ -35,21 +33,20 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * The owner of this arrow. */ public EntityLivingBase shootingEntity; + protected int ticksInAir = 0; protected int maxTicksInAir = 600; private int ricochetCounter = 0; private boolean scheduledForDeath = false; protected int projectileDamage; - public EnergyBlastProjectile(World par1World) - { + public EnergyBlastProjectile(World par1World) { super(par1World); this.setSize(0.5F, 0.5F); this.maxTicksInAir = 600; } - public EnergyBlastProjectile(World par1World, double par2, double par4, double par6) - { + public EnergyBlastProjectile(World par1World, double par2, double par4, double par6) { super(par1World); this.setSize(0.5F, 0.5F); this.setPosition(par2, par4, par6); @@ -57,28 +54,42 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow this.maxTicksInAir = 600; } - public EnergyBlastProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public EnergyBlastProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World); shootingEntity = par2EntityPlayer; float par3 = 0.8F; this.setSize(0.5F, 0.5F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); + this.setLocationAndAngles( + par2EntityPlayer.posX, + par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), + par2EntityPlayer.posZ, + par2EntityPlayer.rotationYaw, + par2EntityPlayer.rotationPitch); posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; posY -= 0.2D; posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(posX, posY, posZ); yOffset = 0.0F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); this.projectileDamage = damage; this.maxTicksInAir = 600; } - public EnergyBlastProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public EnergyBlastProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World); shootingEntity = par2EntityPlayer; float par3 = 0.8F; @@ -89,16 +100,24 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(posX, posY, posZ); yOffset = 0.0F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); this.projectileDamage = damage; this.maxTicksInAir = maxTicksInAir; } - public EnergyBlastProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + public EnergyBlastProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLivingBase; @@ -108,13 +127,13 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ; double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2); - if (d3 >= 1.0E-7D) - { + if (d3 >= 1.0E-7D) { float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI)); double d4 = d0 / d3; double d5 = d2 / d3; - this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3); + this.setLocationAndAngles( + par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3); this.yOffset = 0.0F; float f4 = (float) d3 * 0.2F; this.setThrowableHeading(d0, d1, d2, par4, par5); @@ -125,8 +144,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow } @Override - protected void entityInit() - { + protected void entityInit() { dataWatcher.addObject(16, Byte.valueOf((byte) 0)); } @@ -135,8 +153,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * direction. */ @Override - public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) - { + public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) { float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); var1 /= var9; var3 /= var9; @@ -161,8 +178,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) - { + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { this.setPosition(par1, par3, par5); this.setRotation(par7, par8); } @@ -172,14 +188,12 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow /** * Sets the velocity to the args. Args: x, y, z */ - public void setVelocity(double par1, double par3, double par5) - { + public void setVelocity(double par1, double par3, double par5) { motionX = par1; motionY = par3; motionZ = par5; - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { + if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI); @@ -193,41 +207,36 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if (ticksInAir > maxTicksInAir) - { + if (ticksInAir > maxTicksInAir) { this.setDead(); } - if (shootingEntity == null) - { - List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)); + if (shootingEntity == null) { + List players = worldObj.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)); Iterator i = players.iterator(); double closestDistance = Double.MAX_VALUE; EntityPlayer closestPlayer = null; - while (i.hasNext()) - { + while (i.hasNext()) { EntityPlayer e = (EntityPlayer) i.next(); double distance = e.getDistanceToEntity(this); - if (distance < closestDistance) - { + if (distance < closestDistance) { closestPlayer = e; } } - if (closestPlayer != null) - { + if (closestPlayer != null) { shootingEntity = closestPlayer; } } - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { + if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI); @@ -235,33 +244,25 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow Block var16 = worldObj.getBlock(xTile, yTile, zTile); - if (var16 != null) - { + if (var16 != null) { var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ))) - { + if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ))) { inGround = true; } } - if (inGround) - { + if (inGround) { Block var18 = worldObj.getBlock(xTile, yTile, zTile); int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile); - if (var18.equals(Block.getBlockById(inTile)) && var19 == inData) - { - } - } else - { + if (var18.equals(Block.getBlockById(inTile)) && var19 == inData) {} + } else { ++ticksInAir; - if (ticksInAir > 1 && ticksInAir < 3) - { - for (int particles = 0; particles < 3; particles++) - { + if (ticksInAir > 1 && ticksInAir < 3) { + for (int particles = 0; particles < 3; particles++) { this.doFiringParticles(); } } @@ -272,33 +273,29 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow var17 = SpellHelper.createVec3(posX, posY, posZ); var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); - if (var4 != null) - { + if (var4 != null) { var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); } Entity var5 = null; - List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); + List var6 = worldObj.getEntitiesWithinAABBExcludingEntity( + this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); double var7 = 0.0D; Iterator var9 = var6.iterator(); float var11; - while (var9.hasNext()) - { + while (var9.hasNext()) { Entity var10 = (Entity) var9.next(); - if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) - { + if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) { var11 = 0.3F; AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11); MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); - if (var13 != null) - { + if (var13 != null) { double var14 = var17.distanceTo(var13.hitVec); - if (var14 < var7 || var7 == 0.0D) - { + if (var14 < var7 || var7 == 0.0D) { var5 = var10; var7 = var14; } @@ -306,17 +303,14 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow } } - if (var5 != null) - { + if (var5 != null) { var4 = new MovingObjectPosition(var5); } - if (var4 != null) - { + if (var4 != null) { this.onImpact(var4); - if (scheduledForDeath) - { + if (scheduledForDeath) { this.setDead(); } } @@ -329,9 +323,15 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow } } - public void doFiringParticles() - { - worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + public void doFiringParticles() { + worldObj.spawnParticle( + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); } @@ -339,8 +339,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short) xTile); par1NBTTagCompound.setShort("yTile", (short) yTile); par1NBTTagCompound.setShort("zTile", (short) zTile); @@ -356,8 +355,7 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { xTile = par1NBTTagCompound.getShort("xTile"); yTile = par1NBTTagCompound.getShort("yTile"); zTile = par1NBTTagCompound.getShort("zTile"); @@ -374,31 +372,26 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * walk on. used for spiders and wolves to prevent them from trampling crops */ @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } @Override @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 0.0F; } /** * Sets the amount of knockback the arrow applies when it hits a mob. */ - public void setKnockbackStrength(int par1) - { - } + public void setKnockbackStrength(int par1) {} /** * If returns false, the item will not inflict any damage against entities. */ @Override - public boolean canAttackWithItem() - { + public boolean canAttackWithItem() { return false; } @@ -406,15 +399,12 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * Whether the arrow has a stream of critical hit particles flying behind * it. */ - public void setIsCritical(boolean par1) - { + public void setIsCritical(boolean par1) { byte var2 = dataWatcher.getWatchableObjectByte(16); - if (par1) - { + if (par1) { dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 | 1))); - } else - { + } else { dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 & -2))); } } @@ -423,39 +413,30 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow * Whether the arrow has a stream of critical hit particles flying behind * it. */ - public boolean getIsCritical() - { + public boolean getIsCritical() { byte var1 = dataWatcher.getWatchableObjectByte(16); return (var1 & 1) != 0; } - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float) (0.1), true); this.setDead(); } } - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { + } else { + if (mop instanceof EntityLivingBase) { ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2)); } doDamage(projectileDamage, mop); @@ -466,56 +447,51 @@ public class EnergyBlastProjectile extends Entity implements IProjectile, IThrow this.setDead(); } - private int d6() - { + private int d6() { return rand.nextInt(6) + 1; } - protected void spawnHitParticles(String string, int i) - { - for (int particles = 0; particles < i; particles++) - { - worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); + protected void spawnHitParticles(String string, int i) { + for (int particles = 0; particles < i; particles++) { + worldObj.spawnParticle( + string, + posX, + posY - (string == "portal" ? 1 : 0), + posZ, + gaussian(motionX), + gaussian(motionY), + gaussian(motionZ)); } } - protected void doDamage(int i, Entity mop) - { + protected void doDamage(int i, Entity mop) { mop.attackEntityFrom(this.getDamageSource(), i); } - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } - public double smallGauss(double d) - { + public double smallGauss(double d) { return (worldObj.rand.nextFloat() - 0.5D) * d; } - public double gaussian(double d) - { + public double gaussian(double d) { return d + d * ((rand.nextFloat() - 0.5D) / 4); } - private int getRicochetMax() - { + private int getRicochetMax() { return 0; } @Override - public Entity getThrower() - { + public Entity getThrower() { // TODO Auto-generated method stub return this.shootingEntity; } @Override - public void setThrower(Entity entity) - { - if (entity instanceof EntityLivingBase) - this.shootingEntity = (EntityLivingBase) entity; - + public void setThrower(Entity entity) { + if (entity instanceof EntityLivingBase) this.shootingEntity = (EntityLivingBase) entity; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBeamParticle.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBeamParticle.java index d4029d91..bd9beffa 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBeamParticle.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBeamParticle.java @@ -3,14 +3,10 @@ package WayofTime.alchemicalWizardry.common.entity.projectile; import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; -public class EntityBeamParticle extends EntityFX -{ +public class EntityBeamParticle extends EntityFX { - protected EntityBeamParticle(World p_i1218_1_, double p_i1218_2_, - double p_i1218_4_, double p_i1218_6_) - { + protected EntityBeamParticle(World p_i1218_1_, double p_i1218_2_, double p_i1218_4_, double p_i1218_6_) { super(p_i1218_1_, p_i1218_2_, p_i1218_4_, p_i1218_6_); // TODO Auto-generated constructor stub } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBloodLightProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBloodLightProjectile.java index c0490bd8..1c8dc485 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBloodLightProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityBloodLightProjectile.java @@ -8,85 +8,83 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; - -public class EntityBloodLightProjectile extends EnergyBlastProjectile -{ - public EntityBloodLightProjectile(World par1World) - { +public class EntityBloodLightProjectile extends EnergyBlastProjectile { + public EntityBloodLightProjectile(World par1World) { super(par1World); } - public EntityBloodLightProjectile(World par1World, double par2, double par4, double par6) - { + public EntityBloodLightProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World, par2EntityPlayer, damage); } - public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public EntityBloodLightProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); } - public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + public EntityBloodLightProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int sideHit = mop.sideHit; int blockX = mop.blockX; int blockY = mop.blockY; int blockZ = mop.blockZ; - if (sideHit == 0 && this.worldObj.isAirBlock(blockX, blockY - 1, blockZ)) - { + if (sideHit == 0 && this.worldObj.isAirBlock(blockX, blockY - 1, blockZ)) { this.worldObj.setBlock(blockX, blockY - 1, blockZ, ModBlocks.blockBloodLight); } - if (sideHit == 1 && this.worldObj.isAirBlock(blockX, blockY + 1, blockZ)) - { + if (sideHit == 1 && this.worldObj.isAirBlock(blockX, blockY + 1, blockZ)) { this.worldObj.setBlock(blockX, blockY + 1, blockZ, ModBlocks.blockBloodLight); } - if (sideHit == 2 && this.worldObj.isAirBlock(blockX, blockY, blockZ - 1)) - { + if (sideHit == 2 && this.worldObj.isAirBlock(blockX, blockY, blockZ - 1)) { this.worldObj.setBlock(blockX, blockY, blockZ - 1, ModBlocks.blockBloodLight); } - if (sideHit == 3 && this.worldObj.isAirBlock(blockX, blockY, blockZ + 1)) - { + if (sideHit == 3 && this.worldObj.isAirBlock(blockX, blockY, blockZ + 1)) { this.worldObj.setBlock(blockX, blockY, blockZ + 1, ModBlocks.blockBloodLight); } - if (sideHit == 4 && this.worldObj.isAirBlock(blockX - 1, blockY, blockZ)) - { + if (sideHit == 4 && this.worldObj.isAirBlock(blockX - 1, blockY, blockZ)) { this.worldObj.setBlock(blockX - 1, blockY, blockZ, ModBlocks.blockBloodLight); } - if (sideHit == 5 && this.worldObj.isAirBlock(blockX + 1, blockY, blockZ)) - { + if (sideHit == 5 && this.worldObj.isAirBlock(blockX + 1, blockY, blockZ)) { this.worldObj.setBlock(blockX + 1, blockY, blockZ, ModBlocks.blockBloodLight); } } @@ -95,23 +93,18 @@ public class EntityBloodLightProjectile extends EnergyBlastProjectile } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { + } else { + if (mop instanceof EntityLivingBase) { ((EntityLivingBase) mop).setRevengeTarget(shootingEntity); doDamage(1, mop); } } - if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) - { + if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) { worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, Blocks.fire); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaMainProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaMainProjectile.java index b332c0a6..279127ff 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaMainProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaMainProjectile.java @@ -7,52 +7,57 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile -{ - public EntityEnergyBazookaMainProjectile(World par1World) - { +public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile { + public EntityEnergyBazookaMainProjectile(World par1World) { super(par1World); } - public EntityEnergyBazookaMainProjectile(World par1World, double par2, double par4, double par6) - { + public EntityEnergyBazookaMainProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World, par2EntityPlayer, damage); } - public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public EntityEnergyBazookaMainProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); } - public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + public EntityEnergyBazookaMainProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, (float) (5.0f), false); this.spawnSecondaryProjectiles(); } @@ -61,16 +66,12 @@ public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { + } else { + if (mop instanceof EntityLivingBase) { spawnSecondaryProjectiles(); } @@ -81,24 +82,20 @@ public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile this.setDead(); } - public void spawnSecondaryProjectiles() - { + public void spawnSecondaryProjectiles() { int secondaryDamage = 0; - if (this.projectileDamage == AlchemicalWizardry.energyBazookaDamage) - { + if (this.projectileDamage == AlchemicalWizardry.energyBazookaDamage) { secondaryDamage = AlchemicalWizardry.energyBazookaSecondaryDamage; } - if (this.projectileDamage == AlchemicalWizardry.energyBazookaSecondTierDamage) - { + if (this.projectileDamage == AlchemicalWizardry.energyBazookaSecondTierDamage) { secondaryDamage = AlchemicalWizardry.energyBazookaSecondTierSecondaryDamage; } - if (this.projectileDamage == AlchemicalWizardry.energyBazookaThirdTierDamage) - { + if (this.projectileDamage == AlchemicalWizardry.energyBazookaThirdTierDamage) { secondaryDamage = AlchemicalWizardry.energyBazookaThirdTierSecondaryDamage; } - for (int i = 0; i < 20; i++) - { - EntityEnergyBazookaSecondaryProjectile secProj = new EntityEnergyBazookaSecondaryProjectile(worldObj, this.posX, this.posY, this.posZ, secondaryDamage); + for (int i = 0; i < 20; i++) { + EntityEnergyBazookaSecondaryProjectile secProj = new EntityEnergyBazookaSecondaryProjectile( + worldObj, this.posX, this.posY, this.posZ, secondaryDamage); secProj.shootingEntity = this.shootingEntity; float xVel = rand.nextFloat() - rand.nextFloat(); float yVel = rand.nextFloat() - rand.nextFloat(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java index 617db735..bd6baaa7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityEnergyBazookaSecondaryProjectile.java @@ -1,8 +1,10 @@ package WayofTime.alchemicalWizardry.common.entity.projectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.Iterator; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -15,12 +17,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectile implements IProjectile -{ +public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectile implements IProjectile { private int xTile = -1; private int yTile = -1; private int zTile = -1; @@ -31,20 +29,19 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * The owner of this arrow. */ public EntityLivingBase shootingEntity; + private int ticksInAir = 0; private int ricochetCounter = 0; private boolean scheduledForDeath = false; public int damage; - public EntityEnergyBazookaSecondaryProjectile(World par1World) - { + public EntityEnergyBazookaSecondaryProjectile(World par1World) { super(par1World); this.setSize(0.5F, 0.5F); damage = 5; } - public EntityEnergyBazookaSecondaryProjectile(World par1World, double par2, double par4, double par6, int damage) - { + public EntityEnergyBazookaSecondaryProjectile(World par1World, double par2, double par4, double par6, int damage) { super(par1World); this.setSize(0.5F, 0.5F); this.setPosition(par2, par4, par6); @@ -52,28 +49,33 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil this.damage = damage; } - public EntityEnergyBazookaSecondaryProjectile(World par1World, EntityPlayer par2EntityPlayer, int damage) - { + public EntityEnergyBazookaSecondaryProjectile(World par1World, EntityPlayer par2EntityPlayer, int damage) { super(par1World); shootingEntity = par2EntityPlayer; float par3 = 0.8F; this.setSize(0.1F, 0.1F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); + this.setLocationAndAngles( + par2EntityPlayer.posX, + par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), + par2EntityPlayer.posZ, + par2EntityPlayer.rotationYaw, + par2EntityPlayer.rotationPitch); posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; posY -= 0.2D; posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(posX, posY, posZ); yOffset = 0.0F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); this.damage = damage; } @Override - protected void entityInit() - { + protected void entityInit() { dataWatcher.addObject(16, Byte.valueOf((byte) 0)); } @@ -82,8 +84,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * direction. */ @Override - public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) - { + public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) { float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); var1 /= var9; var3 /= var9; @@ -108,8 +109,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) - { + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { this.setPosition(par1, par3, par5); this.setRotation(par7, par8); } @@ -119,14 +119,12 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil /** * Sets the velocity to the args. Args: x, y, z */ - public void setVelocity(double par1, double par3, double par5) - { + public void setVelocity(double par1, double par3, double par5) { motionX = par1; motionY = par3; motionZ = par5; - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { + if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI); @@ -140,41 +138,36 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if (ticksInAir > maxTicksInAir) - { + if (ticksInAir > maxTicksInAir) { this.setDead(); } - if (shootingEntity == null) - { - List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)); + if (shootingEntity == null) { + List players = worldObj.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)); Iterator i = players.iterator(); double closestDistance = Double.MAX_VALUE; EntityPlayer closestPlayer = null; - while (i.hasNext()) - { + while (i.hasNext()) { EntityPlayer e = (EntityPlayer) i.next(); double distance = e.getDistanceToEntity(this); - if (distance < closestDistance) - { + if (distance < closestDistance) { closestPlayer = e; } } - if (closestPlayer != null) - { + if (closestPlayer != null) { shootingEntity = closestPlayer; } } - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { + if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI); @@ -182,33 +175,25 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil Block var16 = worldObj.getBlock(xTile, yTile, zTile); - if (var16 != null) - { + if (var16 != null) { var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ))) - { + if (var2 != null && var2.isVecInside(SpellHelper.createVec3(posX, posY, posZ))) { inGround = true; } } - if (inGround) - { + if (inGround) { Block var18 = worldObj.getBlock(xTile, yTile, zTile); int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile); - if (var18.equals(Block.getBlockById(inTile)) && var19 == inData) - { - } - } else - { + if (var18.equals(Block.getBlockById(inTile)) && var19 == inData) {} + } else { ++ticksInAir; - if (ticksInAir > 1 && ticksInAir < 3) - { - for (int particles = 0; particles < 3; particles++) - { + if (ticksInAir > 1 && ticksInAir < 3) { + for (int particles = 0; particles < 3; particles++) { this.doFiringParticles(); } } @@ -219,33 +204,29 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil var17 = SpellHelper.createVec3(posX, posY, posZ); var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); - if (var4 != null) - { + if (var4 != null) { var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); } Entity var5 = null; - List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); + List var6 = worldObj.getEntitiesWithinAABBExcludingEntity( + this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); double var7 = 0.0D; Iterator var9 = var6.iterator(); float var11; - while (var9.hasNext()) - { + while (var9.hasNext()) { Entity var10 = (Entity) var9.next(); - if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) - { + if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) { var11 = 0.3F; AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11); MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); - if (var13 != null) - { + if (var13 != null) { double var14 = var17.distanceTo(var13.hitVec); - if (var14 < var7 || var7 == 0.0D) - { + if (var14 < var7 || var7 == 0.0D) { var5 = var10; var7 = var14; } @@ -253,17 +234,14 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil } } - if (var5 != null) - { + if (var5 != null) { var4 = new MovingObjectPosition(var5); } - if (var4 != null) - { + if (var4 != null) { this.onImpact(var4); - if (scheduledForDeath) - { + if (scheduledForDeath) { this.setDead(); } } @@ -276,9 +254,15 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil } } - public void doFiringParticles() - { - worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + public void doFiringParticles() { + worldObj.spawnParticle( + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); } @@ -286,8 +270,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short) xTile); par1NBTTagCompound.setShort("yTile", (short) yTile); par1NBTTagCompound.setShort("zTile", (short) zTile); @@ -300,8 +283,7 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { xTile = par1NBTTagCompound.getShort("xTile"); yTile = par1NBTTagCompound.getShort("yTile"); zTile = par1NBTTagCompound.getShort("zTile"); @@ -315,31 +297,26 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * walk on. used for spiders and wolves to prevent them from trampling crops */ @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } @Override @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 0.0F; } /** * Sets the amount of knockback the arrow applies when it hits a mob. */ - public void setKnockbackStrength(int par1) - { - } + public void setKnockbackStrength(int par1) {} /** * If returns false, the item will not inflict any damage against entities. */ @Override - public boolean canAttackWithItem() - { + public boolean canAttackWithItem() { return false; } @@ -347,15 +324,12 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * Whether the arrow has a stream of critical hit particles flying behind * it. */ - public void setIsCritical(boolean par1) - { + public void setIsCritical(boolean par1) { byte var2 = dataWatcher.getWatchableObjectByte(16); - if (par1) - { + if (par1) { dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 | 1))); - } else - { + } else { dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 & -2))); } } @@ -364,37 +338,29 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil * Whether the arrow has a stream of critical hit particles flying behind * it. */ - public boolean getIsCritical() - { + public boolean getIsCritical() { byte var1 = dataWatcher.getWatchableObjectByte(16); return (var1 & 1) != 0; } - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { this.groundImpact(mop.sideHit); worldObj.createExplosion(shootingEntity, posX, posY, posZ, 2, false); } } - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { + } else { doDamage(this.damage + d6(), mop); worldObj.createExplosion(shootingEntity, posX, posY, posZ, 2, false); } @@ -403,48 +369,45 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil this.setDead(); } - private int d6() - { + private int d6() { return rand.nextInt(6) + 1; } - public void spawnHitParticles(String string, int i) - { - for (int particles = 0; particles < i; particles++) - { - worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); + public void spawnHitParticles(String string, int i) { + for (int particles = 0; particles < i; particles++) { + worldObj.spawnParticle( + string, + posX, + posY - (string == "portal" ? 1 : 0), + posZ, + gaussian(motionX), + gaussian(motionY), + gaussian(motionZ)); } } - public void doDamage(int i, Entity mop) - { + public void doDamage(int i, Entity mop) { mop.attackEntityFrom(this.getDamageSource(), i); } - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } - public void groundImpact(int sideHit) - { + public void groundImpact(int sideHit) { this.ricochet(sideHit); } - public double smallGauss(double d) - { + public double smallGauss(double d) { return (worldObj.rand.nextFloat() - 0.5D) * d; } - public double gaussian(double d) - { + public double gaussian(double d) { return d + d * ((rand.nextFloat() - 0.5D) / 4); } - private void ricochet(int sideHit) - { - switch (sideHit) - { + private void ricochet(int sideHit) { + switch (sideHit) { case 0: case 1: // topHit, bottomHit, reflect Y @@ -466,44 +429,46 @@ public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectil ricochetCounter++; - if (ricochetCounter > this.getRicochetMax()) - { + if (ricochetCounter > this.getRicochetMax()) { scheduledForDeath = true; - for (int particles = 0; particles < 4; particles++) - { - switch (sideHit) - { + for (int particles = 0; particles < 4; particles++) { + switch (sideHit) { case 0: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D)); break; case 1: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; case 2: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D)); break; case 3: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; case 4: - worldObj.spawnParticle("smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; case 5: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + worldObj.spawnParticle( + "smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); break; } } } } - private int getRicochetMax() - { + private int getRicochetMax() { return 3; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityMeteor.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityMeteor.java index 2307236c..863f5879 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityMeteor.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityMeteor.java @@ -7,8 +7,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class EntityMeteor extends EnergyBlastProjectile -{ +public class EntityMeteor extends EnergyBlastProjectile { private int meteorID; public boolean hasTerrae; @@ -17,21 +16,18 @@ public class EntityMeteor extends EnergyBlastProjectile public boolean hasIncendium; public boolean hasTennebrae; - public EntityMeteor(World par1World) - { + public EntityMeteor(World par1World) { super(par1World); this.meteorID = 0; } - public EntityMeteor(World par1World, double par2, double par4, double par6, int meteorID) - { + public EntityMeteor(World par1World, double par2, double par4, double par6, int meteorID) { super(par1World, par2, par4, par6); this.meteorID = meteorID; } @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("meteorID", meteorID); @@ -43,8 +39,7 @@ public class EntityMeteor extends EnergyBlastProjectile } @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); meteorID = par1NBTTagCompound.getInteger("meteorID"); @@ -56,34 +51,34 @@ public class EntityMeteor extends EnergyBlastProjectile } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.fallingBlock; } @Override - public void onImpact(MovingObjectPosition mop) - { - if (worldObj.isRemote) - { + public void onImpact(MovingObjectPosition mop) { + if (worldObj.isRemote) { return; } - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - MeteorRegistry.createMeteorImpact(worldObj, mop.blockX, mop.blockY, mop.blockZ, this.meteorID, new boolean[]{hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae}); + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + MeteorRegistry.createMeteorImpact( + worldObj, mop.blockX, mop.blockY, mop.blockZ, this.meteorID, new boolean[] { + hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae + }); } this.setDead(); } @Override - public void onImpact(Entity mop) - { - MeteorRegistry.createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID, new boolean[]{hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae}); + public void onImpact(Entity mop) { + MeteorRegistry.createMeteorImpact( + worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID, new boolean[] { + hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae + }); this.setDead(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityParticleBeam.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityParticleBeam.java index 88c92ad2..2e8683aa 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityParticleBeam.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/EntityParticleBeam.java @@ -14,9 +14,8 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -//Shamelessly ripped off from x3n0ph0b3 -public class EntityParticleBeam extends Entity implements IProjectile, IThrowableEntity -{ +// Shamelessly ripped off from x3n0ph0b3 +public class EntityParticleBeam extends Entity implements IProjectile, IThrowableEntity { protected int xTile = -1; protected int yTile = -1; protected int zTile = -1; @@ -33,21 +32,20 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl * The owner of this arrow. */ public EntityLivingBase shootingEntity; + protected int ticksInAir = 0; protected int maxTicksInAir = 600; private int ricochetCounter = 0; private boolean scheduledForDeath = false; protected int projectileDamage; - public EntityParticleBeam(World par1World) - { + public EntityParticleBeam(World par1World) { super(par1World); this.setSize(0.5F, 0.5F); this.maxTicksInAir = 600; } - public EntityParticleBeam(World par1World, double par2, double par4, double par6) - { + public EntityParticleBeam(World par1World, double par2, double par4, double par6) { super(par1World); this.setSize(0.5F, 0.5F); this.setPosition(par2, par4, par6); @@ -55,28 +53,42 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl this.maxTicksInAir = 600; } - public EntityParticleBeam(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public EntityParticleBeam(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World); shootingEntity = par2EntityPlayer; float par3 = 0.8F; this.setSize(0.5F, 0.5F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); + this.setLocationAndAngles( + par2EntityPlayer.posX, + par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), + par2EntityPlayer.posZ, + par2EntityPlayer.rotationYaw, + par2EntityPlayer.rotationPitch); posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; posY -= 0.2D; posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(posX, posY, posZ); yOffset = 0.0F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); this.projectileDamage = damage; this.maxTicksInAir = 600; } - public EntityParticleBeam(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public EntityParticleBeam( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World); shootingEntity = par2EntityPlayer; float par3 = 0.8F; @@ -87,16 +99,24 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(posX, posY, posZ); yOffset = 0.0F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); + motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); this.projectileDamage = damage; this.maxTicksInAir = maxTicksInAir; } - public EntityParticleBeam(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + public EntityParticleBeam( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLivingBase; @@ -106,13 +126,13 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ; double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2); - if (d3 >= 1.0E-7D) - { + if (d3 >= 1.0E-7D) { float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI)); double d4 = d0 / d3; double d5 = d2 / d3; - this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3); + this.setLocationAndAngles( + par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3); this.yOffset = 0.0F; float f4 = (float) d3 * 0.2F; this.setThrowableHeading(d0, d1, d2, par4, par5); @@ -123,8 +143,7 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl } @Override - protected void entityInit() - { + protected void entityInit() { dataWatcher.addObject(16, Byte.valueOf((byte) 0)); } @@ -133,8 +152,7 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl * direction. */ @Override - public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) - { + public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) { float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); var1 /= var9; var3 /= var9; @@ -159,8 +177,7 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) - { + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { this.setPosition(par1, par3, par5); this.setRotation(par7, par8); } @@ -170,14 +187,12 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl /** * Sets the velocity to the args. Args: x, y, z */ - public void setVelocity(double par1, double par3, double par5) - { + public void setVelocity(double par1, double par3, double par5) { motionX = par1; motionY = par3; motionZ = par5; - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { + if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI); @@ -191,12 +206,10 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if (ticksInAir > maxTicksInAir) - { + if (ticksInAir > maxTicksInAir) { this.setDead(); } @@ -208,25 +221,24 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl this.doFiringParticles(); - if (Math.pow(posX - xDest, 2) + Math.pow(posY - yDest, 2) + Math.pow(posZ - zDest, 2) <= 1) - { + if (Math.pow(posX - xDest, 2) + Math.pow(posY - yDest, 2) + Math.pow(posZ - zDest, 2) <= 1) { this.scheduledForDeath = true; } - if (this.scheduledForDeath) - { + if (this.scheduledForDeath) { this.setDead(); } } - public void doFiringParticles() - { - if (!worldObj.isRemote) - { + public void doFiringParticles() { + if (!worldObj.isRemote) { return; } EntityFX particle = new EntityCloudFX(worldObj, posX, posY, posZ, 0, 0, 0); - particle.setRBGColorF(colourRed + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), colourGreen + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), colourBlue + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat())); + particle.setRBGColorF( + colourRed + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), + colourGreen + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), + colourBlue + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat())); FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); } @@ -234,8 +246,7 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short) xTile); par1NBTTagCompound.setShort("yTile", (short) yTile); par1NBTTagCompound.setShort("zTile", (short) zTile); @@ -257,8 +268,7 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { xTile = par1NBTTagCompound.getShort("xTile"); yTile = par1NBTTagCompound.getShort("yTile"); zTile = par1NBTTagCompound.getShort("zTile"); @@ -277,70 +287,63 @@ public class EntityParticleBeam extends Entity implements IProjectile, IThrowabl } @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } @Override @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 0.0F; } - protected void spawnHitParticles(String string, int i) - { - for (int particles = 0; particles < i; particles++) - { - worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); + protected void spawnHitParticles(String string, int i) { + for (int particles = 0; particles < i; particles++) { + worldObj.spawnParticle( + string, + posX, + posY - (string == "portal" ? 1 : 0), + posZ, + gaussian(motionX), + gaussian(motionY), + gaussian(motionZ)); } } - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } - public double smallGauss(double d) - { + public double smallGauss(double d) { return (worldObj.rand.nextFloat() - 0.5D) * d; } - public double gaussian(double d) - { + public double gaussian(double d) { return d + d * ((rand.nextFloat() - 0.5D) / 4); } - private int getRicochetMax() - { + private int getRicochetMax() { return 0; } @Override - public Entity getThrower() - { + public Entity getThrower() { // TODO Auto-generated method stub return this.shootingEntity; } @Override - public void setThrower(Entity entity) - { - if (entity instanceof EntityLivingBase) - this.shootingEntity = (EntityLivingBase) entity; - + public void setThrower(Entity entity) { + if (entity instanceof EntityLivingBase) this.shootingEntity = (EntityLivingBase) entity; } - public void setColour(float red, float green, float blue) - { + public void setColour(float red, float green, float blue) { this.colourRed = red; this.colourGreen = green; this.colourBlue = blue; } - public void setDestination(int xDest, int yDest, int zDest) - { + public void setDestination(int xDest, int yDest, int zDest) { this.xDest = xDest; this.yDest = yDest; this.zDest = zDest; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/ExplosionProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/ExplosionProjectile.java index 24c6af9b..cf3cb802 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/ExplosionProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/ExplosionProjectile.java @@ -7,59 +7,66 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ExplosionProjectile extends EnergyBlastProjectile -{ +public class ExplosionProjectile extends EnergyBlastProjectile { protected boolean causesEnvDamage; - public ExplosionProjectile(World par1World) - { + public ExplosionProjectile(World par1World) { super(par1World); } - public ExplosionProjectile(World par1World, double par2, double par4, double par6) - { + public ExplosionProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public ExplosionProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) - { + public ExplosionProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) { super(par1World, par2EntityPlayer, damage); causesEnvDamage = flag; } - public ExplosionProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag) - { + public ExplosionProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch, + boolean flag) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); causesEnvDamage = flag; } - - public ExplosionProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir, boolean flag) - { + + public ExplosionProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir, + boolean flag) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); causesEnvDamage = flag; } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } - + this.onImpact(mop.entityHit); worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (2), causesEnvDamage); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (2), causesEnvDamage); } @@ -67,16 +74,12 @@ public class ExplosionProjectile extends EnergyBlastProjectile } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { + } else { + if (mop instanceof EntityLivingBase) { doDamage(projectileDamage, mop); } } @@ -86,15 +89,20 @@ public class ExplosionProjectile extends EnergyBlastProjectile } @Override - public void doFiringParticles() - { - worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + public void doFiringParticles() { + worldObj.spawnParticle( + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); worldObj.spawnParticle("explode", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); } @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("causesEnvDamage", causesEnvDamage); } @@ -103,8 +111,7 @@ public class ExplosionProjectile extends EnergyBlastProjectile * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); causesEnvDamage = par1NBTTagCompound.getBoolean("causesEnvDamage"); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/FireProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/FireProjectile.java index ba8f3041..73f4377d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/FireProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/FireProjectile.java @@ -8,61 +8,63 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class FireProjectile extends EnergyBlastProjectile -{ - public FireProjectile(World par1World) - { +public class FireProjectile extends EnergyBlastProjectile { + public FireProjectile(World par1World) { super(par1World); } - public FireProjectile(World par1World, double par2, double par4, double par6) - { + public FireProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public FireProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public FireProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World, par2EntityPlayer, damage); } - public FireProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public FireProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); } - public FireProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + public FireProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - for (int i = -1; i <= 1; i++) - { - for (int j = -1; j <= 1; j++) - { - for (int k = -1; k <= 1; k++) - { - if (worldObj.isAirBlock((int) this.posX + i, (int) this.posY + j, (int) this.posZ + k)) - { - worldObj.setBlock((int) this.posX + i, (int) this.posY + j, (int) this.posZ + k, Blocks.fire); + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + for (int i = -1; i <= 1; i++) { + for (int j = -1; j <= 1; j++) { + for (int k = -1; k <= 1; k++) { + if (worldObj.isAirBlock((int) this.posX + i, (int) this.posY + j, (int) this.posZ + k)) { + worldObj.setBlock( + (int) this.posX + i, (int) this.posY + j, (int) this.posZ + k, Blocks.fire); } } } @@ -73,32 +75,26 @@ public class FireProjectile extends EnergyBlastProjectile } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { + } else { + if (mop instanceof EntityLivingBase) { ((EntityLivingBase) mop).setFire(10 * this.projectileDamage); ((EntityLivingBase) mop).setRevengeTarget(shootingEntity); - if (((EntityLivingBase) mop).isPotionActive(Potion.fireResistance) || ((EntityLivingBase) mop).isImmuneToFire()) - { + if (((EntityLivingBase) mop).isPotionActive(Potion.fireResistance) + || ((EntityLivingBase) mop).isImmuneToFire()) { ((EntityLivingBase) mop).attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); - } else - { + } else { doDamage(projectileDamage, mop); ((EntityLivingBase) mop).hurtResistantTime = 0; } } } - if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) - { + if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) { worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, Blocks.fire); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/HolyProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/HolyProjectile.java index 3fc5e2ac..51de84ba 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/HolyProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/HolyProjectile.java @@ -7,90 +7,112 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class HolyProjectile extends EnergyBlastProjectile -{ - public HolyProjectile(World par1World) - { +public class HolyProjectile extends EnergyBlastProjectile { + public HolyProjectile(World par1World) { super(par1World); } - public HolyProjectile(World par1World, double par2, double par4, double par6) - { + public HolyProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public HolyProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public HolyProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World, par2EntityPlayer, damage); } - public HolyProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public HolyProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); } - public HolyProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + public HolyProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { } this.setDead(); } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { - if (((EntityLivingBase) mop).isEntityUndead()) - { + } else { + if (mop instanceof EntityLivingBase) { + if (((EntityLivingBase) mop).isEntityUndead()) { doDamage((int) (projectileDamage * 2), mop); - } else - { + } else { doDamage(projectileDamage, mop); } } } - if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) - { - } + if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) {} spawnHitParticles("magicCrit", 8); this.setDead(); } @Override - public void doFiringParticles() - { - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 1.0F, 1.0F, 1.0F); + public void doFiringParticles() { + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpell", + posX, + posY, + posZ, + 1.0F, + 1.0F, + 1.0F); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/IceProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/IceProjectile.java index 3ba02709..61deae9a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/IceProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/IceProjectile.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.common.entity.projectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.Potion; @@ -7,84 +8,81 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class IceProjectile extends EnergyBlastProjectile -{ - public IceProjectile(World par1World) - { +public class IceProjectile extends EnergyBlastProjectile { + public IceProjectile(World par1World) { super(par1World); } - public IceProjectile(World par1World, double par2, double par4, double par6) - { + public IceProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public IceProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public IceProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World, par2EntityPlayer, damage); } - public IceProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public IceProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); } - - public IceProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + + public IceProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { } this.setDead(); } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1); this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { - if (((EntityLivingBase) mop).isImmuneToFire()) - { + } else { + if (mop instanceof EntityLivingBase) { + if (((EntityLivingBase) mop).isImmuneToFire()) { doDamage((int) (projectileDamage * 2), mop); ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2)); - } else - { + } else { doDamage(projectileDamage, mop); ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1)); } } } - if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) - { - //worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ,Block.fire.blockID); + if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) { + // worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ,Block.fire.blockID); } spawnHitParticles("magicCrit", 8); @@ -92,9 +90,34 @@ public class IceProjectile extends EnergyBlastProjectile } @Override - public void doFiringParticles() - { - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "explode", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); + public void doFiringParticles() { + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "explode", + posX, + posY, + posZ, + gaussian(motionX), + gaussian(motionY), + gaussian(motionZ)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/LightningBoltProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/LightningBoltProjectile.java index fe521b4c..f00b0223 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/LightningBoltProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/LightningBoltProjectile.java @@ -9,53 +9,52 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class LightningBoltProjectile extends EnergyBlastProjectile -{ +public class LightningBoltProjectile extends EnergyBlastProjectile { private boolean causeLightning; - public LightningBoltProjectile(World par1World) - { + public LightningBoltProjectile(World par1World) { super(par1World); } - public LightningBoltProjectile(World par1World, double par2, double par4, double par6) - { + public LightningBoltProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public LightningBoltProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) - { + public LightningBoltProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) { super(par1World, par2EntityPlayer, damage); causeLightning = flag; } - public LightningBoltProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag) - { + public LightningBoltProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch, + boolean flag) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); causeLightning = flag; } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - if (causeLightning) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if (causeLightning) { this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); } } @@ -64,20 +63,18 @@ public class LightningBoltProjectile extends EnergyBlastProjectile } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { - if (causeLightning) - { - this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, ((EntityLivingBase) mop).posX, ((EntityLivingBase) mop).posY, ((EntityLivingBase) mop).posZ)); - } else - { + } else { + if (mop instanceof EntityLivingBase) { + if (causeLightning) { + this.worldObj.addWeatherEffect(new EntityLightningBolt( + this.worldObj, + ((EntityLivingBase) mop).posX, + ((EntityLivingBase) mop).posY, + ((EntityLivingBase) mop).posZ)); + } else { doDamage(projectileDamage, mop); } } @@ -88,23 +85,46 @@ public class LightningBoltProjectile extends EnergyBlastProjectile } @Override - public void doFiringParticles() - { - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 1.0F, 1.0F, 1.0F); + public void doFiringParticles() { + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpell", + posX, + posY, + posZ, + 1.0F, + 1.0F, + 1.0F); } @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("causeLightning", causeLightning); } @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); causeLightning = par1NBTTagCompound.getBoolean("causeLightning"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/MudProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/MudProjectile.java index cc9cf06c..d7826895 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/MudProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/MudProjectile.java @@ -10,77 +10,78 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class MudProjectile extends EnergyBlastProjectile -{ - private boolean doesBlindness; //True for when it applies blindness, false for slowness +public class MudProjectile extends EnergyBlastProjectile { + private boolean doesBlindness; // True for when it applies blindness, false for slowness - public MudProjectile(World par1World) - { + public MudProjectile(World par1World) { super(par1World); } - public MudProjectile(World par1World, double par2, double par4, double par6) - { + public MudProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public MudProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) - { + public MudProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) { super(par1World, par2EntityPlayer, damage); doesBlindness = flag; } - public MudProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag) - { + public MudProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch, + boolean flag) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); doesBlindness = flag; } - public MudProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir, boolean flag) - { + public MudProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir, + boolean flag) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); doesBlindness = flag; } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { } this.setDead(); } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { - if (doesBlindness) - { + } else { + if (mop instanceof EntityLivingBase) { + if (doesBlindness) { ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 0)); - } else - { + } else { ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2)); } doDamage(projectileDamage, mop); @@ -92,22 +93,45 @@ public class MudProjectile extends EnergyBlastProjectile } @Override - public void doFiringParticles() - { - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 0.5F, 0.297F, 0.0664F); + public void doFiringParticles() { + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpell", + posX, + posY, + posZ, + 0.5F, + 0.297F, + 0.0664F); } @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("doesBlindness", doesBlindness); } @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); doesBlindness = par1NBTTagCompound.getBoolean("doesBlindness"); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/TeleportProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/TeleportProjectile.java index 48ea1bf5..17b17217 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/TeleportProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/TeleportProjectile.java @@ -12,28 +12,24 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; -public class TeleportProjectile extends EnergyBlastProjectile -{ +public class TeleportProjectile extends EnergyBlastProjectile { private boolean isEntityTeleport; - public TeleportProjectile(World par1World) - { + public TeleportProjectile(World par1World) { super(par1World); this.motionX *= 3; this.motionY *= 3; this.motionZ *= 3; } - public TeleportProjectile(World par1World, double par2, double par4, double par6) - { + public TeleportProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); this.motionX *= 3; this.motionY *= 3; this.motionZ *= 3; } - public TeleportProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) - { + public TeleportProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag) { super(par1World, par2EntityPlayer, damage); isEntityTeleport = flag; this.motionX *= 3; @@ -41,8 +37,17 @@ public class TeleportProjectile extends EnergyBlastProjectile this.motionZ *= 3; } - public TeleportProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag) - { + public TeleportProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch, + boolean flag) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); isEntityTeleport = flag; this.motionX *= 3; @@ -51,38 +56,29 @@ public class TeleportProjectile extends EnergyBlastProjectile } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - if (isEntityTeleport) - { - if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if (isEntityTeleport) { + if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP) { EntityPlayerMP entityplayermp = (EntityPlayerMP) shootingEntity; - if (entityplayermp.worldObj == this.worldObj) - { - EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); + if (entityplayermp.worldObj == this.worldObj) { + EnderTeleportEvent event = + new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); - if (!MinecraftForge.EVENT_BUS.post(event)) - { - if (shootingEntity.isRiding()) - { + if (!MinecraftForge.EVENT_BUS.post(event)) { + if (shootingEntity.isRiding()) { shootingEntity.mountEntity((Entity) null); } shootingEntity.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); @@ -96,27 +92,19 @@ public class TeleportProjectile extends EnergyBlastProjectile } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { - if (isEntityTeleport) - { - if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP) - { + } else { + if (mop instanceof EntityLivingBase) { + if (isEntityTeleport) { + if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP) { EntityPlayerMP entityplayermp = (EntityPlayerMP) shootingEntity; - if (entityplayermp.worldObj == this.worldObj) - { - EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); - if (!MinecraftForge.EVENT_BUS.post(event)) - { - if (shootingEntity.isRiding()) - { + if (entityplayermp.worldObj == this.worldObj) { + EnderTeleportEvent event = + new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); + if (!MinecraftForge.EVENT_BUS.post(event)) { + if (shootingEntity.isRiding()) { shootingEntity.mountEntity((Entity) null); } @@ -124,8 +112,7 @@ public class TeleportProjectile extends EnergyBlastProjectile } } } - } else - { + } else { SpellTeleport.teleportRandomly((EntityLivingBase) mop, 64); } } @@ -136,22 +123,45 @@ public class TeleportProjectile extends EnergyBlastProjectile } @Override - public void doFiringParticles() - { - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "portal", posX, posY, posZ, -motionX, -motionY, -motionZ); + public void doFiringParticles() { + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "portal", + posX, + posY, + posZ, + -motionX, + -motionY, + -motionZ); } @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("isEntityTeleport", isEntityTeleport); } @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); isEntityTeleport = par1NBTTagCompound.getBoolean("isEntityTeleport"); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WaterProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WaterProjectile.java index 4ec890ff..0c0fad91 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WaterProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WaterProjectile.java @@ -9,70 +9,65 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class WaterProjectile extends EnergyBlastProjectile -{ - public WaterProjectile(World par1World) - { +public class WaterProjectile extends EnergyBlastProjectile { + public WaterProjectile(World par1World) { super(par1World); } - public WaterProjectile(World par1World, double par2, double par4, double par6) - { + public WaterProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public WaterProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public WaterProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World, par2EntityPlayer, damage); } - public WaterProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public WaterProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { } this.setDead(); } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { - if (((EntityLivingBase) mop).isImmuneToFire()) - { + } else { + if (mop instanceof EntityLivingBase) { + if (((EntityLivingBase) mop).isImmuneToFire()) { doDamage(projectileDamage * 2, mop); - ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 1)); - } else - { + ((EntityLivingBase) mop) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 1)); + } else { doDamage(projectileDamage, mop); - ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 0)); + ((EntityLivingBase) mop) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 0)); } } } @@ -82,9 +77,34 @@ public class WaterProjectile extends EnergyBlastProjectile } @Override - public void doFiringParticles() - { - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "portal", posX, posY, posZ, -motionX, -motionY, -motionZ); - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + public void doFiringParticles() { + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "portal", + posX, + posY, + posZ, + -motionX, + -motionY, + -motionZ); + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WindGustProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WindGustProjectile.java index fbe86c24..560ca1c2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WindGustProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/projectile/WindGustProjectile.java @@ -7,70 +7,71 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class WindGustProjectile extends EnergyBlastProjectile -{ - public WindGustProjectile(World par1World) - { +public class WindGustProjectile extends EnergyBlastProjectile { + public WindGustProjectile(World par1World) { super(par1World); } - public WindGustProjectile(World par1World, double par2, double par4, double par6) - { + public WindGustProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } - public WindGustProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) - { + public WindGustProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage) { super(par1World, par2EntityPlayer, damage); } - public WindGustProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) - { + public WindGustProjectile( + World par1World, + EntityLivingBase par2EntityPlayer, + int damage, + int maxTicksInAir, + double posX, + double posY, + double posZ, + float rotationYaw, + float rotationPitch) { super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch); } - - public WindGustProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir) - { + + public WindGustProjectile( + World par1World, + EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase, + float par4, + float par5, + int damage, + int maxTicksInAir) { super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir); } @Override - public DamageSource getDamageSource() - { + public DamageSource getDamageSource() { return DamageSource.causeMobDamage(shootingEntity); } @Override - public void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) - { + public void onImpact(MovingObjectPosition mop) { + if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { + if (mop.entityHit == shootingEntity) { return; } this.onImpact(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { } this.setDead(); } @Override - public void onImpact(Entity mop) - { - if (mop == shootingEntity && ticksInAir > 3) - { + public void onImpact(Entity mop) { + if (mop == shootingEntity && ticksInAir > 3) { this.setDead(); - } else - { - if (mop instanceof EntityLivingBase) - { - ((EntityLivingBase) mop).motionX = this.motionX * 0.25*this.projectileDamage; + } else { + if (mop instanceof EntityLivingBase) { + ((EntityLivingBase) mop).motionX = this.motionX * 0.25 * this.projectileDamage; ((EntityLivingBase) mop).motionY = 1.5; - ((EntityLivingBase) mop).motionZ = this.motionZ * 0.25*this.projectileDamage; + ((EntityLivingBase) mop).motionZ = this.motionZ * 0.25 * this.projectileDamage; } } @@ -79,9 +80,34 @@ public class WindGustProjectile extends EnergyBlastProjectile } @Override - public void doFiringParticles() - { - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); - SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 1.0F, 1.0F, 1.0F); + public void doFiringParticles() { + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpellAmbient", + posX + smallGauss(0.1D), + posY + smallGauss(0.1D), + posZ + smallGauss(0.1D), + 0.5D, + 0.5D, + 0.5D); + SpellHelper.sendParticleToAllAround( + worldObj, + posX, + posY, + posZ, + 30, + worldObj.provider.dimensionId, + "mobSpell", + posX, + posY, + posZ, + 1.0F, + 1.0F, + 1.0F); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/guide/RecipeHolder.java b/src/main/java/WayofTime/alchemicalWizardry/common/guide/RecipeHolder.java index 8bbbaba9..9253e648 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/guide/RecipeHolder.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/guide/RecipeHolder.java @@ -1,227 +1,218 @@ package WayofTime.alchemicalWizardry.common.guide; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModItems; 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; -public class RecipeHolder -{ - private static List recipeList; +public class RecipeHolder { + private static List recipeList; - public static IRecipe bloodAltarRecipe; - public static IRecipe knifeRecipe; - public static IRecipe divinationSigilRecipe; - public static IRecipe waterSigilRecipe; - public static IRecipe lavaCrystalRecipe; - public static IRecipe lavaSigilRecipe; - public static IRecipe blankRuneRecipe; - public static IRecipe speedRuneRecipe; - public static IRecipe voidSigilRecipe; - public static IRecipe airSigilRecipe; - public static IRecipe sightSigilRecipe; - public static IRecipe fastMinerRecipe; - public static IRecipe greenGroveRecipe; - public static IRecipe sacrificeRuneRecipe; - public static IRecipe selfSacrificeRuneRecipe; - public static IRecipe bloodPackRecipe; - public static IRecipe capacityRuneRecipe; - public static IRecipe dislocationRuneRecipe; - public static IRecipe magnetismSigilRecipe; - public static IRecipe phantomBridgeRecipe; - public static IRecipe holdingSigilRecipe; - public static IRecipe affinitySigilRecipe; - public static IRecipe weakRitualStoneRecipe; - public static IRecipe ritualStoneRecipe; - public static IRecipe masterStoneRecipe; - public static IRecipe bloodLampRecipe; - public static IRecipe emptySocketRecipe; - public static IRecipe soulForgeRecipe; - public static IRecipe inhibitorRecipe; - public static IRecipe ritualDiviner1Recipe; - public static IRecipe ritualDiviner2Recipe; - public static IRecipe ritualDiviner3Recipe; - public static IRecipe bloodStoneRecipe; - public static IRecipe whirlwindSigilRecipe; - public static IRecipe compressionSigilRecipe; - public static IRecipe enderSeveranceSigilRecipe; - public static IRecipe teleposerRecipe; - public static IRecipe suppressionSigilRecipe; - public static IRecipe superiorCapacityRecipe; - public static IRecipe orbRuneRecipe; - public static IRecipe keyOfBindingRecipe; - public static IRecipe energyBazookaRecipe; - public static IRecipe accelerationRuneRecipe; - public static IRecipe harvestSigilRecipe; - public static IRecipe crystalCluserRecipe; - public static IRecipe arcanePlinthRecipe; - public static IRecipe arcanePedestalRecipe; - public static IRecipe spellTableRecipe; - public static IRecipe alchemySetRecipe; - public static IRecipe crucibleRecipe; - - public static IRecipe woodAshRecipe; - public static IRecipe byrrusRecipe; - public static IRecipe livensRecipe; - public static IRecipe virRecipe; - public static IRecipe purpuraRecipe; - - public static IRecipe routerRecipe; - public static IRecipe segmenterRecipe; - public static IRecipe cleanserRecipe; - public static IRecipe calcinatorRecipe; - public static IRecipe belljarRecipe; - public static IRecipe relayRecipe; - - public static AltarRecipe weakBloodOrbRecipe; - public static AltarRecipe apprenticeBloodOrbRecipe; - public static AltarRecipe magicianBloodOrbRecipe; - public static AltarRecipe masterBloodOrbRecipe; - public static AltarRecipe archmageBloodOrbRecipe; - public static AltarRecipe transcendentBloodOrbRecipe; - - public static AltarRecipe blankSlateRecipe; - public static AltarRecipe reinforcedSlateRecipe; - public static AltarRecipe imbuedSlateRecipe; - public static AltarRecipe demonicSlateRecipe; - public static AltarRecipe etherealSlateRecipe; - public static AltarRecipe daggerRecipe; - public static AltarRecipe weakActivationRecipe; - public static AltarRecipe filledSocketRecipe; - public static AltarRecipe teleposerFocusRecipe1; - public static AltarRecipe blankSpellRecipe; - public static AltarRecipe waterScribeTool; - public static AltarRecipe fireScribeTool; - public static AltarRecipe earthScribeTool; - public static AltarRecipe airScribeTool; - public static AltarRecipe duskRecipe; - public static AltarRecipe dawnRecipe; - public static AltarRecipe flaskRecipe; - - public static void init() - { - recipeList = CraftingManager.getInstance().getRecipeList(); - bloodAltarRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockAltar)); - knifeRecipe = getRecipeForItemStack(new ItemStack(ModItems.sacrificialDagger)); - divinationSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.divinationSigil)); - waterSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.waterSigil)); - lavaCrystalRecipe = getRecipeForItemStack(new ItemStack(ModItems.lavaCrystal)); - lavaSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.lavaSigil)); - blankRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune)); - speedRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.speedRune)); - - voidSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.voidSigil)); - airSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.airSigil)); - sightSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemSeerSigil)); - fastMinerRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfTheFastMiner)); - greenGroveRecipe = getRecipeForItemStack(new ItemStack(ModItems.growthSigil)); - sacrificeRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.runeOfSacrifice)); - selfSacrificeRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.runeOfSelfSacrifice)); - bloodPackRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemBloodPack)); - capacityRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 1)); - dislocationRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 2)); - magnetismSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfMagnetism)); - phantomBridgeRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfTheBridge)); - holdingSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfHolding)); - affinitySigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfElementalAffinity)); - ritualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.ritualStone)); - masterStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockMasterStone)); - bloodLampRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemBloodLightSigil)); - emptySocketRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.emptySocket)); - soulForgeRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.armourForge)); - inhibitorRecipe = getRecipeForItemStack(new ItemStack(ModItems.armourInhibitor)); - ritualDiviner1Recipe = getRecipeForItemStack(new ItemStack(ModItems.itemRitualDiviner)); - ritualDiviner2Recipe = getRecipeForItemStack(new ItemStack(ModItems.itemRitualDiviner, 1, 1)); - ritualDiviner3Recipe = getRecipeForItemStack(new ItemStack(ModItems.itemRitualDiviner, 1, 2)); - bloodStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.largeBloodStoneBrick)); - whirlwindSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfWind)); - compressionSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemCompressionSigil)); - enderSeveranceSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemSigilOfEnderSeverance)); - teleposerRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockTeleposer)); - suppressionSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemSigilOfSupression)); - superiorCapacityRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 4)); - orbRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 3)); - keyOfBindingRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemKeyOfDiablo)); - energyBazookaRecipe = getRecipeForItemStack(new ItemStack(ModItems.energyBazooka)); - accelerationRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 5)); - harvestSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemHarvestSigil)); - crystalCluserRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystal)); - weakRitualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.imperfectRitualStone)); - - arcanePlinthRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPlinth)); - arcanePedestalRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPedestal)); - spellTableRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockHomHeart)); - - alchemySetRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockWritingTable)); - crucibleRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrucible)); - woodAshRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 0)); - byrrusRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 1)); - livensRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 2)); - virRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 3)); - purpuraRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 4)); - - routerRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemAttunedCrystal)); - segmenterRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemTankSegmenter)); - cleanserRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemDestinationClearer)); - calcinatorRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockAlchemicCalcinator)); - belljarRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystalBelljar)); - relayRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockReagentConduit)); - - weakBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.weakBloodOrb)); - apprenticeBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.apprenticeBloodOrb)); - magicianBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.magicianBloodOrb)); - masterBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.masterBloodOrb)); - archmageBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.archmageBloodOrb)); - transcendentBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.transcendentBloodOrb)); - - blankSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.blankSlate)); - reinforcedSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.reinforcedSlate)); - imbuedSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.imbuedSlate)); - demonicSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.demonicSlate)); - etherealSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.baseItems, 1, 27)); - daggerRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.daggerOfSacrifice)); - weakActivationRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.activationCrystal, 1, 0)); - filledSocketRecipe = getAltarRecipeForItemStack(new ItemStack(ModBlocks.bloodSocket)); - teleposerFocusRecipe1 = getAltarRecipeForItemStack(new ItemStack(ModItems.telepositionFocus)); - blankSpellRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.blankSpell)); - waterScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.waterScribeTool)); - fireScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.fireScribeTool)); - earthScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.earthScribeTool)); - airScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.airScribeTool)); - duskRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.duskScribeTool)); - dawnRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.dawnScribeTool)); - flaskRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.alchemyFlask)); - } - - private static IRecipe getRecipeForItemStack(ItemStack stack) - { - for(Object obj : recipeList) - { - IRecipe recipe = (IRecipe)obj; - if(recipe.getRecipeOutput() != null && stack.isItemEqual(recipe.getRecipeOutput())) - { - return recipe; - } - } - - return null; - } - - private static AltarRecipe getAltarRecipeForItemStack(ItemStack stack) - { - for(AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) - { - if(recipe.getResult() != null && stack.isItemEqual(recipe.getResult())) - { - return recipe; - } - } - - return null; - } + public static IRecipe bloodAltarRecipe; + public static IRecipe knifeRecipe; + public static IRecipe divinationSigilRecipe; + public static IRecipe waterSigilRecipe; + public static IRecipe lavaCrystalRecipe; + public static IRecipe lavaSigilRecipe; + public static IRecipe blankRuneRecipe; + public static IRecipe speedRuneRecipe; + public static IRecipe voidSigilRecipe; + public static IRecipe airSigilRecipe; + public static IRecipe sightSigilRecipe; + public static IRecipe fastMinerRecipe; + public static IRecipe greenGroveRecipe; + public static IRecipe sacrificeRuneRecipe; + public static IRecipe selfSacrificeRuneRecipe; + public static IRecipe bloodPackRecipe; + public static IRecipe capacityRuneRecipe; + public static IRecipe dislocationRuneRecipe; + public static IRecipe magnetismSigilRecipe; + public static IRecipe phantomBridgeRecipe; + public static IRecipe holdingSigilRecipe; + public static IRecipe affinitySigilRecipe; + public static IRecipe weakRitualStoneRecipe; + public static IRecipe ritualStoneRecipe; + public static IRecipe masterStoneRecipe; + public static IRecipe bloodLampRecipe; + public static IRecipe emptySocketRecipe; + public static IRecipe soulForgeRecipe; + public static IRecipe inhibitorRecipe; + public static IRecipe ritualDiviner1Recipe; + public static IRecipe ritualDiviner2Recipe; + public static IRecipe ritualDiviner3Recipe; + public static IRecipe bloodStoneRecipe; + public static IRecipe whirlwindSigilRecipe; + public static IRecipe compressionSigilRecipe; + public static IRecipe enderSeveranceSigilRecipe; + public static IRecipe teleposerRecipe; + public static IRecipe suppressionSigilRecipe; + public static IRecipe superiorCapacityRecipe; + public static IRecipe orbRuneRecipe; + public static IRecipe keyOfBindingRecipe; + public static IRecipe energyBazookaRecipe; + public static IRecipe accelerationRuneRecipe; + public static IRecipe harvestSigilRecipe; + public static IRecipe crystalCluserRecipe; + public static IRecipe arcanePlinthRecipe; + public static IRecipe arcanePedestalRecipe; + public static IRecipe spellTableRecipe; + public static IRecipe alchemySetRecipe; + public static IRecipe crucibleRecipe; + + public static IRecipe woodAshRecipe; + public static IRecipe byrrusRecipe; + public static IRecipe livensRecipe; + public static IRecipe virRecipe; + public static IRecipe purpuraRecipe; + + public static IRecipe routerRecipe; + public static IRecipe segmenterRecipe; + public static IRecipe cleanserRecipe; + public static IRecipe calcinatorRecipe; + public static IRecipe belljarRecipe; + public static IRecipe relayRecipe; + + public static AltarRecipe weakBloodOrbRecipe; + public static AltarRecipe apprenticeBloodOrbRecipe; + public static AltarRecipe magicianBloodOrbRecipe; + public static AltarRecipe masterBloodOrbRecipe; + public static AltarRecipe archmageBloodOrbRecipe; + public static AltarRecipe transcendentBloodOrbRecipe; + + public static AltarRecipe blankSlateRecipe; + public static AltarRecipe reinforcedSlateRecipe; + public static AltarRecipe imbuedSlateRecipe; + public static AltarRecipe demonicSlateRecipe; + public static AltarRecipe etherealSlateRecipe; + public static AltarRecipe daggerRecipe; + public static AltarRecipe weakActivationRecipe; + public static AltarRecipe filledSocketRecipe; + public static AltarRecipe teleposerFocusRecipe1; + public static AltarRecipe blankSpellRecipe; + public static AltarRecipe waterScribeTool; + public static AltarRecipe fireScribeTool; + public static AltarRecipe earthScribeTool; + public static AltarRecipe airScribeTool; + public static AltarRecipe duskRecipe; + public static AltarRecipe dawnRecipe; + public static AltarRecipe flaskRecipe; + + public static void init() { + recipeList = CraftingManager.getInstance().getRecipeList(); + bloodAltarRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockAltar)); + knifeRecipe = getRecipeForItemStack(new ItemStack(ModItems.sacrificialDagger)); + divinationSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.divinationSigil)); + waterSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.waterSigil)); + lavaCrystalRecipe = getRecipeForItemStack(new ItemStack(ModItems.lavaCrystal)); + lavaSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.lavaSigil)); + blankRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune)); + speedRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.speedRune)); + + voidSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.voidSigil)); + airSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.airSigil)); + sightSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemSeerSigil)); + fastMinerRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfTheFastMiner)); + greenGroveRecipe = getRecipeForItemStack(new ItemStack(ModItems.growthSigil)); + sacrificeRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.runeOfSacrifice)); + selfSacrificeRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.runeOfSelfSacrifice)); + bloodPackRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemBloodPack)); + capacityRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 1)); + dislocationRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 2)); + magnetismSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfMagnetism)); + phantomBridgeRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfTheBridge)); + holdingSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfHolding)); + affinitySigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfElementalAffinity)); + ritualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.ritualStone)); + masterStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockMasterStone)); + bloodLampRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemBloodLightSigil)); + emptySocketRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.emptySocket)); + soulForgeRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.armourForge)); + inhibitorRecipe = getRecipeForItemStack(new ItemStack(ModItems.armourInhibitor)); + ritualDiviner1Recipe = getRecipeForItemStack(new ItemStack(ModItems.itemRitualDiviner)); + ritualDiviner2Recipe = getRecipeForItemStack(new ItemStack(ModItems.itemRitualDiviner, 1, 1)); + ritualDiviner3Recipe = getRecipeForItemStack(new ItemStack(ModItems.itemRitualDiviner, 1, 2)); + bloodStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.largeBloodStoneBrick)); + whirlwindSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.sigilOfWind)); + compressionSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemCompressionSigil)); + enderSeveranceSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemSigilOfEnderSeverance)); + teleposerRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockTeleposer)); + suppressionSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemSigilOfSupression)); + superiorCapacityRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 4)); + orbRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 3)); + keyOfBindingRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemKeyOfDiablo)); + energyBazookaRecipe = getRecipeForItemStack(new ItemStack(ModItems.energyBazooka)); + accelerationRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 5)); + harvestSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemHarvestSigil)); + crystalCluserRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystal)); + weakRitualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.imperfectRitualStone)); + + arcanePlinthRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPlinth)); + arcanePedestalRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPedestal)); + spellTableRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockHomHeart)); + + alchemySetRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockWritingTable)); + crucibleRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrucible)); + woodAshRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 0)); + byrrusRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 1)); + livensRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 2)); + virRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 3)); + purpuraRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemIncense, 1, 4)); + + routerRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemAttunedCrystal)); + segmenterRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemTankSegmenter)); + cleanserRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemDestinationClearer)); + calcinatorRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockAlchemicCalcinator)); + belljarRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystalBelljar)); + relayRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockReagentConduit)); + + weakBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.weakBloodOrb)); + apprenticeBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.apprenticeBloodOrb)); + magicianBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.magicianBloodOrb)); + masterBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.masterBloodOrb)); + archmageBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.archmageBloodOrb)); + transcendentBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.transcendentBloodOrb)); + + blankSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.blankSlate)); + reinforcedSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.reinforcedSlate)); + imbuedSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.imbuedSlate)); + demonicSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.demonicSlate)); + etherealSlateRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.baseItems, 1, 27)); + daggerRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.daggerOfSacrifice)); + weakActivationRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.activationCrystal, 1, 0)); + filledSocketRecipe = getAltarRecipeForItemStack(new ItemStack(ModBlocks.bloodSocket)); + teleposerFocusRecipe1 = getAltarRecipeForItemStack(new ItemStack(ModItems.telepositionFocus)); + blankSpellRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.blankSpell)); + waterScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.waterScribeTool)); + fireScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.fireScribeTool)); + earthScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.earthScribeTool)); + airScribeTool = getAltarRecipeForItemStack(new ItemStack(ModItems.airScribeTool)); + duskRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.duskScribeTool)); + dawnRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.dawnScribeTool)); + flaskRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.alchemyFlask)); + } + + private static IRecipe getRecipeForItemStack(ItemStack stack) { + for (Object obj : recipeList) { + IRecipe recipe = (IRecipe) obj; + if (recipe.getRecipeOutput() != null && stack.isItemEqual(recipe.getRecipeOutput())) { + return recipe; + } + } + + return null; + } + + private static AltarRecipe getAltarRecipeForItemStack(ItemStack stack) { + for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) { + if (recipe.getResult() != null && stack.isItemEqual(recipe.getResult())) { + return recipe; + } + } + + return null; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/AgriCraftCropHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/AgriCraftCropHarvestHandler.java index 6ed664b2..3f10456c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/AgriCraftCropHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/AgriCraftCropHarvestHandler.java @@ -1,82 +1,73 @@ package WayofTime.alchemicalWizardry.common.harvest; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import net.minecraft.block.Block; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler; import cpw.mods.fml.common.registry.GameRegistry; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import net.minecraft.block.Block; +import net.minecraft.world.World; -public class AgriCraftCropHarvestHandler implements IHarvestHandler -{ +public class AgriCraftCropHarvestHandler implements IHarvestHandler { public Block harvestBlock; public Method isMature; public Method harvest; - public AgriCraftCropHarvestHandler() - { + public AgriCraftCropHarvestHandler() { this.harvestBlock = getBlockForString("AgriCraft:crops"); - if(this.harvestBlock != null) - { - try { - Class clazz = Class.forName("com.InfinityRaider.AgriCraft.blocks.BlockCrop"); - if(clazz != null) - { - isMature = clazz.getMethod("isMature", World.class, int.class, int.class, int.class); - harvest = clazz.getMethod("harvest", World.class, int.class, int.class, int.class); - } - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + if (this.harvestBlock != null) { + try { + Class clazz = Class.forName("com.InfinityRaider.AgriCraft.blocks.BlockCrop"); + if (clazz != null) { + isMature = clazz.getMethod("isMature", World.class, int.class, int.class, int.class); + harvest = clazz.getMethod("harvest", World.class, int.class, int.class, int.class); + } + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } - public boolean isHarvesterValid() - { + public boolean isHarvesterValid() { return harvestBlock != null && isMature != null && harvest != null; } - public static Block getBlockForString(String str) - { + public static Block getBlockForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findBlock(modId, name); } - public boolean canHandleBlock(Block block) - { + public boolean canHandleBlock(Block block) { return block == harvestBlock; } @Override - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) - { - if (!this.canHandleBlock(block)) - { + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) { + if (!this.canHandleBlock(block)) { return false; } - + try { - return (Boolean)(isMature.invoke(block, world, xCoord, yCoord, zCoord)) && (Boolean)(harvest.invoke(block, world, xCoord, yCoord, zCoord)); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return (Boolean) (isMature.invoke(block, world, xCoord, yCoord, zCoord)) + && (Boolean) (harvest.invoke(block, world, xCoord, yCoord, zCoord)); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } return false; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/BloodMagicHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/BloodMagicHarvestHandler.java index 3b437fac..276fca86 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/BloodMagicHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/BloodMagicHarvestHandler.java @@ -1,7 +1,7 @@ package WayofTime.alchemicalWizardry.common.harvest; +import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.entity.item.EntityItem; @@ -11,52 +11,42 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; -import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler; -public class BloodMagicHarvestHandler implements IHarvestHandler -{ - public boolean canHandleBlock(Block block) - { - return block == Blocks.wheat || block == Blocks.carrots || block == Blocks.potatoes || block == Blocks.nether_wart; +public class BloodMagicHarvestHandler implements IHarvestHandler { + public boolean canHandleBlock(Block block) { + return block == Blocks.wheat + || block == Blocks.carrots + || block == Blocks.potatoes + || block == Blocks.nether_wart; } - public int getHarvestMeta(Block block) - { - if(block instanceof BlockCrops) - { - - } - if (block == Blocks.wheat) - { + public int getHarvestMeta(Block block) { + if (block instanceof BlockCrops) {} + + if (block == Blocks.wheat) { return 7; } - if (block == Blocks.carrots) - { + if (block == Blocks.carrots) { return 7; } - if (block == Blocks.potatoes) - { + if (block == Blocks.potatoes) { return 7; } - if (block == Blocks.nether_wart) - { + if (block == Blocks.nether_wart) { return 3; } return 7; } @Override - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) - { - if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) - { + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) { + if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) { return false; } IPlantable seed = this.getSeedItem(block); - if (seed == null) - { + if (seed == null) { return false; } @@ -65,24 +55,19 @@ public class BloodMagicHarvestHandler implements IHarvestHandler List list = block.getDrops(world, xCoord, yCoord, zCoord, meta, fortune); boolean foundAndRemovedSeed = false; - for (ItemStack stack : list) - { - if (stack == null) - { + for (ItemStack stack : list) { + if (stack == null) { continue; } Item item = stack.getItem(); - if (item == seed) - { + if (item == seed) { int itemSize = stack.stackSize; - if (itemSize > 1) - { + if (itemSize > 1) { stack.stackSize--; foundAndRemovedSeed = true; break; - } else if (itemSize == 1) - { + } else if (itemSize == 1) { list.remove(stack); foundAndRemovedSeed = true; break; @@ -90,8 +75,7 @@ public class BloodMagicHarvestHandler implements IHarvestHandler } } - if (foundAndRemovedSeed) - { + if (foundAndRemovedSeed) { int plantMeta = seed.getPlantMetadata(world, xCoord, yCoord, zCoord); Block plantBlock = seed.getPlant(world, xCoord, yCoord, zCoord); @@ -99,8 +83,7 @@ public class BloodMagicHarvestHandler implements IHarvestHandler world.setBlock(xCoord, yCoord, zCoord, plantBlock, plantMeta, 3); - for (ItemStack stack : list) - { + for (ItemStack stack : list) { EntityItem itemEnt = new EntityItem(world, xCoord, yCoord, zCoord, stack); world.spawnEntityInWorld(itemEnt); @@ -110,25 +93,20 @@ public class BloodMagicHarvestHandler implements IHarvestHandler return false; } - public IPlantable getSeedItem(Block block) - { - if (block == Blocks.wheat) - { + public IPlantable getSeedItem(Block block) { + if (block == Blocks.wheat) { return (IPlantable) Items.wheat_seeds; } - if (block == Blocks.carrots) - { + if (block == Blocks.carrots) { return (IPlantable) Items.carrot; } - if (block == Blocks.potatoes) - { + if (block == Blocks.potatoes) { return (IPlantable) Items.potato; } - if (block == Blocks.nether_wart) - { + if (block == Blocks.nether_wart) { return (IPlantable) Items.nether_wart; } return null; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/CactusReedHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/CactusReedHarvestHandler.java index 3f948080..c75b7c72 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/CactusReedHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/CactusReedHarvestHandler.java @@ -5,23 +5,19 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class CactusReedHarvestHandler implements IHarvestHandler -{ - public boolean canHandleBlock(Block block) - { +public class CactusReedHarvestHandler implements IHarvestHandler { + public boolean canHandleBlock(Block block) { return block == Blocks.reeds || block == Blocks.cactus; } @Override - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) - { - if (!this.canHandleBlock(block)) - { + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) { + if (!this.canHandleBlock(block)) { return false; } - if (world.getBlock(xCoord, yCoord - 1, zCoord) != block || world.getBlock(xCoord, yCoord - 2, zCoord) != block) - { + if (world.getBlock(xCoord, yCoord - 1, zCoord) != block + || world.getBlock(xCoord, yCoord - 2, zCoord) != block) { return false; } @@ -29,4 +25,4 @@ public class CactusReedHarvestHandler implements IHarvestHandler return true; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericItemStackHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericItemStackHarvestHandler.java index 45dee807..c2289746 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericItemStackHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericItemStackHarvestHandler.java @@ -1,81 +1,64 @@ package WayofTime.alchemicalWizardry.common.harvest; import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; -import java.util.List; - -public class GenericItemStackHarvestHandler implements IHarvestHandler -{ +public class GenericItemStackHarvestHandler implements IHarvestHandler { public Block harvestBlock; public int harvestMeta; public ItemStack harvestItem; public IPlantable harvestSeed; - public GenericItemStackHarvestHandler(Block block, int meta, ItemStack seed) - { + public GenericItemStackHarvestHandler(Block block, int meta, ItemStack seed) { harvestBlock = block; harvestMeta = meta; harvestItem = seed; if (seed.getItem() instanceof IPlantable) harvestSeed = (IPlantable) seed.getItem(); } - public boolean canHandleBlock(Block block) - { + public boolean canHandleBlock(Block block) { return block == harvestBlock; } - public int getHarvestMeta(Block block) - { + public int getHarvestMeta(Block block) { return harvestMeta; } @Override - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) - { - if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) - { + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) { + if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) { return false; } IPlantable seed = this.getSeedItem(block); - if (seed == null) - { + if (seed == null) { world.func_147480_a(xCoord, yCoord, zCoord, true); return true; - } else - { + } else { int fortune = 0; List list = block.getDrops(world, xCoord, yCoord, zCoord, meta, fortune); boolean foundAndRemovedSeed = false; - for (ItemStack stack : list) - { - if (stack == null) - { + for (ItemStack stack : list) { + if (stack == null) { continue; } - if (harvestItem.isItemEqual(stack)) - { + if (harvestItem.isItemEqual(stack)) { int itemSize = stack.stackSize; - if (itemSize<1) - { + if (itemSize < 1) { continue; - } - else if (itemSize==1) - { + } else if (itemSize == 1) { list.remove(stack); - } - else - { + } else { stack.stackSize--; } foundAndRemovedSeed = true; @@ -83,8 +66,7 @@ public class GenericItemStackHarvestHandler implements IHarvestHandler } } - if (foundAndRemovedSeed) - { + if (foundAndRemovedSeed) { int plantMeta = seed.getPlantMetadata(world, xCoord, yCoord, zCoord); Block plantBlock = seed.getPlant(world, xCoord, yCoord, zCoord); @@ -92,8 +74,7 @@ public class GenericItemStackHarvestHandler implements IHarvestHandler world.setBlock(xCoord, yCoord, zCoord, plantBlock, plantMeta, 3); - for (ItemStack stack : list) - { + for (ItemStack stack : list) { EntityItem itemEnt = new EntityItem(world, xCoord, yCoord, zCoord, stack); world.spawnEntityInWorld(itemEnt); @@ -104,8 +85,7 @@ public class GenericItemStackHarvestHandler implements IHarvestHandler } } - public IPlantable getSeedItem(Block block) - { + public IPlantable getSeedItem(Block block) { return harvestSeed; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericPamSeedlessFruitHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericPamSeedlessFruitHarvestHandler.java index a5d4b036..ca731c56 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericPamSeedlessFruitHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericPamSeedlessFruitHarvestHandler.java @@ -6,55 +6,46 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.world.World; -public class GenericPamSeedlessFruitHarvestHandler implements IHarvestHandler -{ +public class GenericPamSeedlessFruitHarvestHandler implements IHarvestHandler { public Block harvestBlock; public int harvestMeta; public int resetMeta; - public GenericPamSeedlessFruitHarvestHandler(String block, int harvestMeta, int resetMeta) - { + public GenericPamSeedlessFruitHarvestHandler(String block, int harvestMeta, int resetMeta) { this.harvestBlock = getBlockForString(block); this.harvestMeta = harvestMeta; this.resetMeta = resetMeta; } - public boolean isHarvesterValid() - { + public boolean isHarvesterValid() { return harvestBlock != null; } - public static Block getBlockForString(String str) - { + public static Block getBlockForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findBlock(modId, name); } - public static Item getItemForString(String str) - { + public static Item getItemForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findItem(modId, name); } - public boolean canHandleBlock(Block block) - { + public boolean canHandleBlock(Block block) { return block == harvestBlock; } - public int getHarvestMeta(Block block) - { + public int getHarvestMeta(Block block) { return harvestMeta; } @Override - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) - { - if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) - { + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) { + if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) { return false; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericSeededHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericSeededHarvestHandler.java index 0fbd69e1..3753b3ce 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericSeededHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GenericSeededHarvestHandler.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.harvest; import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; @@ -9,99 +10,79 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; -import java.util.List; - -public class GenericSeededHarvestHandler implements IHarvestHandler -{ +public class GenericSeededHarvestHandler implements IHarvestHandler { public Block harvestBlock; public int harvestMeta; public IPlantable harvestSeed; - public GenericSeededHarvestHandler(String block, int meta, String seed) - { + public GenericSeededHarvestHandler(String block, int meta, String seed) { harvestBlock = getBlockForString(block); harvestMeta = meta; Item testSeed = getItemForString(seed); - if (testSeed instanceof IPlantable) - { + if (testSeed instanceof IPlantable) { harvestSeed = (IPlantable) testSeed; - } else - { + } else { harvestSeed = null; } } - public boolean isHarvesterValid() - { + public boolean isHarvesterValid() { return harvestBlock != null && harvestSeed != null; } - public static Block getBlockForString(String str) - { + public static Block getBlockForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findBlock(modId, name); } - public static Item getItemForString(String str) - { + public static Item getItemForString(String str) { String[] parts = str.split(":"); String modId = parts[0]; String name = parts[1]; return GameRegistry.findItem(modId, name); } - public boolean canHandleBlock(Block block) - { + public boolean canHandleBlock(Block block) { return block == harvestBlock; } - public int getHarvestMeta(Block block) - { + public int getHarvestMeta(Block block) { return harvestMeta; } @Override - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) - { - if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) - { + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) { + if (!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) { return false; } IPlantable seed = this.getSeedItem(block); - if (seed == null) - { + if (seed == null) { world.func_147480_a(xCoord, yCoord, zCoord, true); return true; - } else - { + } else { int fortune = 0; List list = block.getDrops(world, xCoord, yCoord, zCoord, meta, fortune); boolean foundAndRemovedSeed = false; - for (ItemStack stack : list) - { - if (stack == null) - { + for (ItemStack stack : list) { + if (stack == null) { continue; } Item item = stack.getItem(); - if (item == seed) - { + if (item == seed) { int itemSize = stack.stackSize; - if (itemSize > 1) - { + if (itemSize > 1) { stack.stackSize--; foundAndRemovedSeed = true; break; - } else if (itemSize == 1) - { + } else if (itemSize == 1) { list.remove(stack); foundAndRemovedSeed = true; break; @@ -109,8 +90,7 @@ public class GenericSeededHarvestHandler implements IHarvestHandler } } - if (foundAndRemovedSeed) - { + if (foundAndRemovedSeed) { int plantMeta = seed.getPlantMetadata(world, xCoord, yCoord, zCoord); Block plantBlock = seed.getPlant(world, xCoord, yCoord, zCoord); @@ -118,8 +98,7 @@ public class GenericSeededHarvestHandler implements IHarvestHandler world.setBlock(xCoord, yCoord, zCoord, plantBlock, plantMeta, 3); - for (ItemStack stack : list) - { + for (ItemStack stack : list) { EntityItem itemEnt = new EntityItem(world, xCoord, yCoord, zCoord, stack); world.spawnEntityInWorld(itemEnt); @@ -130,8 +109,7 @@ public class GenericSeededHarvestHandler implements IHarvestHandler } } - public IPlantable getSeedItem(Block block) - { + public IPlantable getSeedItem(Block block) { return harvestSeed; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GourdHarvestHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GourdHarvestHandler.java index 485005d4..a9bd1997 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GourdHarvestHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/GourdHarvestHandler.java @@ -5,21 +5,17 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class GourdHarvestHandler implements IHarvestHandler -{ - public boolean canHandleBlock(Block block) - { +public class GourdHarvestHandler implements IHarvestHandler { + public boolean canHandleBlock(Block block) { return block == Blocks.melon_block || block == Blocks.pumpkin; } @Override - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) - { - if (!this.canHandleBlock(block)) - { + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) { + if (!this.canHandleBlock(block)) { return false; } world.func_147480_a(xCoord, yCoord, zCoord, true); return true; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/PamHarvestCompatRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/PamHarvestCompatRegistry.java index 30b4df24..13959b9b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/harvest/PamHarvestCompatRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/harvest/PamHarvestCompatRegistry.java @@ -2,10 +2,8 @@ package WayofTime.alchemicalWizardry.common.harvest; import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry; -public class PamHarvestCompatRegistry -{ - public static void registerPamHandlers() - { +public class PamHarvestCompatRegistry { + public static void registerPamHandlers() { registerSeededHandler("blackberry", 7); registerSeededHandler("blueberry", 7); registerSeededHandler("candleberry", 7); @@ -100,25 +98,22 @@ public class PamHarvestCompatRegistry registerFruitHandler("Walnut", 7, 0); } - public static void registerSeededHandler(String name, int meta) - { + public static void registerSeededHandler(String name, int meta) { String block = "harvestcraft:pam" + name + "Crop"; String seed = "harvestcraft:" + name + "Item"; GenericSeededHarvestHandler handler = new GenericSeededHarvestHandler(block, meta, seed); - if (handler.isHarvesterValid()) - { + if (handler.isHarvesterValid()) { HarvestRegistry.registerHarvestHandler(handler); } } - public static void registerFruitHandler(String name, int harvestMeta, int resetMeta) - { + public static void registerFruitHandler(String name, int harvestMeta, int resetMeta) { String block = "harvestcraft:pam" + name; - GenericPamSeedlessFruitHarvestHandler handler = new GenericPamSeedlessFruitHarvestHandler(block, harvestMeta, resetMeta); - if (handler.isHarvesterValid()) - { + GenericPamSeedlessFruitHarvestHandler handler = + new GenericPamSeedlessFruitHarvestHandler(block, harvestMeta, resetMeta); + if (handler.isHarvesterValid()) { HarvestRegistry.registerHarvestHandler(handler); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/AWBaseItems.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/AWBaseItems.java index 2960e5ee..47ebbbfd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/AWBaseItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/AWBaseItems.java @@ -2,43 +2,34 @@ package WayofTime.alchemicalWizardry.common.items; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModItems; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.List; - -public class AWBaseItems extends Item -{ - public AWBaseItems() - { +public class AWBaseItems extends Item { + public AWBaseItems() { super(); setMaxStackSize(64); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } - public void registerIcons(IIconRegister iconRegister) - { - if (this.equals(ModItems.blankSlate)) - { + public void registerIcons(IIconRegister iconRegister) { + if (this.equals(ModItems.blankSlate)) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankSlate"); - } else if (this.equals(ModItems.reinforcedSlate)) - { + } else if (this.equals(ModItems.reinforcedSlate)) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ReinforcedSlate"); - } else if (this.equals(ModItems.imbuedSlate)) - { + } else if (this.equals(ModItems.imbuedSlate)) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:InfusedSlate"); - } else if (this.equals(ModItems.demonicSlate)) - { + } else if (this.equals(ModItems.demonicSlate)) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonSlate"); } } @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.infusedstone.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.infusedstone.desc2")); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ActivationCrystal.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ActivationCrystal.java index 75354585..6ef570d7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ActivationCrystal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ActivationCrystal.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; 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; @@ -16,17 +17,13 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import org.lwjgl.input.Keyboard; -import java.util.List; - -public class ActivationCrystal extends EnergyItems -{ - private static final String[] ACTIVATION_CRYSTAL_NAMES = new String[]{"Weak", "Awakened", "Creative"}; +public class ActivationCrystal extends EnergyItems { + private static final String[] ACTIVATION_CRYSTAL_NAMES = new String[] {"Weak", "Awakened", "Creative"}; @SideOnly(Side.CLIENT) private IIcon[] icons; - public ActivationCrystal() - { + public ActivationCrystal() { super(); this.maxStackSize = 1; setEnergyUsed(100); @@ -36,103 +33,90 @@ public class ActivationCrystal extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[ACTIVATION_CRYSTAL_NAMES.length]; - for (int i = 0; i < ACTIVATION_CRYSTAL_NAMES.length; ++i) - { - icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "activationCrystal" + ACTIVATION_CRYSTAL_NAMES[i]); + for (int i = 0; i < ACTIVATION_CRYSTAL_NAMES.length; ++i) { + icons[i] = iconRegister.registerIcon( + "AlchemicalWizardry:" + "activationCrystal" + ACTIVATION_CRYSTAL_NAMES[i]); } } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - switch (par1ItemStack.getItemDamage()) - { - case 0: - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + switch (par1ItemStack.getItemDamage()) { + case 0: { par3List.add(StatCollector.translateToLocal("tooltip.activationcrystal.lowlevelrituals")); break; } - case 1: - { + case 1: { par3List.add(StatCollector.translateToLocal("tooltip.activationcrystal.powerfulrituals")); - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { + if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack); - if (recipe != null) - { - par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); + if (recipe != null) { + par3List.add( + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); - for (ItemStack item : recipe) - { - if (item != null) - { + for (ItemStack item : recipe) { + if (item != null) { par3List.add("" + item.getDisplayName()); } } } - } else - { - par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); + } else { + par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + + EnumChatFormatting.GRAY + " " + + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); } break; } - - case 2: - { + + case 2: { par3List.add(StatCollector.translateToLocal("tooltip.activationcrystal.creativeonly")); break; } } - 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")); } } @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; } - public int getCrystalLevel(ItemStack itemStack) - { + public int getCrystalLevel(ItemStack itemStack) { return itemStack.getItemDamage() > 1 ? Integer.MAX_VALUE : itemStack.getItemDamage() + 1; } @Override - public String getUnlocalizedName(ItemStack itemStack) - { - //This is what will do all the localisation things on the alchemy components so you dont have to set it :D + public String getUnlocalizedName(ItemStack itemStack) { + // This is what will do all the localisation things on the alchemy components so you dont have to set it :D int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ACTIVATION_CRYSTAL_NAMES.length - 1); return ("" + "item.activationCrystal" + ACTIVATION_CRYSTAL_NAMES[meta]); } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { + public IIcon getIconFromDamage(int meta) { int j = MathHelper.clamp_int(meta, 0, ACTIVATION_CRYSTAL_NAMES.length - 1); return icons[j]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < ACTIVATION_CRYSTAL_NAMES.length; ++meta) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { + for (int meta = 0; meta < ACTIVATION_CRYSTAL_NAMES.length; ++meta) { list.add(new ItemStack(id, 1, meta)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/AirScribeTool.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/AirScribeTool.java index 612ee865..bbb1c1d5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/AirScribeTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/AirScribeTool.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class AirScribeTool extends ScribeTool -{ - public AirScribeTool() - { +public class AirScribeTool extends ScribeTool { + public AirScribeTool() { super(4); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AirScribeTool"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ApprenticeBloodOrb.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ApprenticeBloodOrb.java index ac3aa56c..1068776e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ApprenticeBloodOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ApprenticeBloodOrb.java @@ -4,18 +4,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class ApprenticeBloodOrb extends EnergyBattery -{ - public ApprenticeBloodOrb(int damage) - { +public class ApprenticeBloodOrb extends EnergyBattery { + public ApprenticeBloodOrb(int damage) { super(damage); orbLevel = 2; } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ApprenticeBloodOrb"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ArchmageBloodOrb.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ArchmageBloodOrb.java index 065781e3..37afdd4b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ArchmageBloodOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ArchmageBloodOrb.java @@ -4,18 +4,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class ArchmageBloodOrb extends EnergyBattery -{ - public ArchmageBloodOrb(int damage) - { +public class ArchmageBloodOrb extends EnergyBattery { + public ArchmageBloodOrb(int damage) { super(damage); orbLevel = 5; } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ArchmageBloodOrb"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ArmourInhibitor.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ArmourInhibitor.java index 8c3fe83b..7ac9fb73 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ArmourInhibitor.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ArmourInhibitor.java @@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items; import WayofTime.alchemicalWizardry.AlchemicalWizardry; 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; @@ -13,18 +14,16 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class ArmourInhibitor extends EnergyItems -{ +public class ArmourInhibitor extends EnergyItems { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int tickDelay = 200; - public ArmourInhibitor() - { + public ArmourInhibitor() { super(); this.maxStackSize = 1; setEnergyUsed(0); @@ -32,88 +31,72 @@ public class ArmourInhibitor 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.armorinhibitor.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.armorinhibitor.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ArmourInhibitor_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:ArmourInhibitor_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:ArmourInhibitor_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -121,27 +104,22 @@ public class ArmourInhibitor extends EnergyItems } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) - { - } + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (par2World.getWorldTime() % tickDelay + == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {} - //TODO Do stuff + // TODO Do stuff par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 2, 0)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/BlankSpell.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/BlankSpell.java index 885b7d07..e41dec8b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/BlankSpell.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/BlankSpell.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart; 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.ItemStack; @@ -13,12 +14,8 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -import java.util.List; - -public class BlankSpell extends EnergyItems -{ - public BlankSpell() - { +public class BlankSpell extends EnergyItems { + public BlankSpell() { super(); this.setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -26,81 +23,71 @@ public class BlankSpell extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankSpell"); } @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.blankspell.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); + par3List.add( + StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { World world = DimensionManager.getWorld(getDimensionID(par1ItemStack)); - if (world != null) - { + if (world != null) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - TileEntity tileEntity = world.getTileEntity(itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord")); + TileEntity tileEntity = world.getTileEntity( + itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord")); - if (tileEntity instanceof TEHomHeart) - { + if (tileEntity instanceof TEHomHeart) { TEHomHeart homHeart = (TEHomHeart) tileEntity; - if (homHeart.canCastSpell(par1ItemStack, par2World, par3EntityPlayer)) - { - if(EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, homHeart.getCostForSpell())) - { - EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, homHeart.castSpell(par1ItemStack, par2World, par3EntityPlayer)); - } - } else - { + if (homHeart.canCastSpell(par1ItemStack, par2World, par3EntityPlayer)) { + if (EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, homHeart.getCostForSpell())) { + EnergyItems.syphonBatteries( + par1ItemStack, + par3EntityPlayer, + homHeart.castSpell(par1ItemStack, par2World, par3EntityPlayer)); + } + } else { return par1ItemStack; } - } else - { + } else { return par1ItemStack; } - } else - { + } else { return par1ItemStack; } - } else - { + } else { return par1ItemStack; } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); return par1ItemStack; } - public int getDimensionID(ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public int getDimensionID(ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/BloodShard.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/BloodShard.java index 82d93df7..325bbb38 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/BloodShard.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/BloodShard.java @@ -11,10 +11,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class BloodShard extends Item implements ArmourUpgrade -{ - public BloodShard() - { +public class BloodShard extends Item implements ArmourUpgrade { + public BloodShard() { super(); this.maxStackSize = 64; setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -22,27 +20,21 @@ public class BloodShard extends Item implements ArmourUpgrade @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - if (this.equals(ModItems.weakBloodShard)) - { + public void registerIcons(IIconRegister iconRegister) { + if (this.equals(ModItems.weakBloodShard)) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WeakBloodShard"); return; } - if (this.equals(ModItems.demonBloodShard)) - { + if (this.equals(ModItems.demonBloodShard)) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonBloodShard"); } } - public int getBloodShardLevel() - { - if (this.equals(ModItems.weakBloodShard)) - { + public int getBloodShardLevel() { + if (this.equals(ModItems.weakBloodShard)) { return 1; - } else if (this.equals(ModItems.demonBloodShard)) - { + } else if (this.equals(ModItems.demonBloodShard)) { return 2; } @@ -50,19 +42,15 @@ public class BloodShard extends Item implements ArmourUpgrade } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - } + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {} @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return false; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 0; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundAxe.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundAxe.java index 1259cb29..f9b743c4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundAxe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundAxe.java @@ -1,8 +1,14 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.common.ItemType; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import com.google.common.collect.HashMultiset; +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.BlockLeavesBase; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,28 +24,20 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.common.ItemType; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import com.google.common.collect.HashMultiset; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BoundAxe extends ItemAxe implements IBindable -{ +public class BoundAxe extends ItemAxe implements IBindable { public float efficiencyOnProperMaterial = 12.0F; public float damageVsEntity; + @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int energyUsed; - public BoundAxe() - { + public BoundAxe() { super(AlchemicalWizardry.bloodBoundToolMaterial); this.maxStackSize = 1; this.efficiencyOnProperMaterial = 12.0F; @@ -49,99 +47,81 @@ public class BoundAxe extends ItemAxe implements IBindable this.setHarvestLevel("axe", 5); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return this.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.boundaxe.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundAxe_activated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundAxe_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { this.setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); return par1ItemStack; } - if (par2World.isRemote) - { + if (par2World.isRemote) { return par1ItemStack; } - if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) - { + if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) { return par1ItemStack; } - if (AlchemicalWizardry.disableBoundToolsRightClick) - { + if (AlchemicalWizardry.disableBoundToolsRightClick) { return par1ItemStack; } - if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) - { + if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) { return par1ItemStack; } - - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) - { - return par1ItemStack; + + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) { + return par1ItemStack; } Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer); @@ -152,31 +132,28 @@ public class BoundAxe extends ItemAxe implements IBindable int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer); HashMultiset dropMultiset = HashMultiset.create(); - - for (int i = -5; i <= 5; i++) - { - for (int j = 0; j <= 10; j++) - { - for (int k = -5; k <= 5; k++) - { + + for (int i = -5; i <= 5; i++) { + for (int j = 0; j <= 10; j++) { + for (int k = -5; k <= 5; k++) { Block block = par2World.getBlock(posX + i, posY + j, posZ + k); int meta = par2World.getBlockMetadata(posX + i, posY + j, posZ + k); - if (block != null) - { + if (block != null) { float str = func_150893_a(par1ItemStack, block); - if (str > 1.1f || block instanceof BlockLeavesBase && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k)) - { - if (silkTouch && block.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta)) - { + if (str > 1.1f + || block instanceof BlockLeavesBase + && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k)) { + if (silkTouch + && block.canSilkHarvest( + par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta)) { dropMultiset.add(new ItemType(block, meta)); - } else - { - ArrayList itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl); + } else { + ArrayList itemDropList = + block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl); - if (itemDropList != null) - { + if (itemDropList != null) { for (ItemStack stack : itemDropList) dropMultiset.add(ItemType.fromStack(stack), stack.stackSize); } @@ -195,26 +172,21 @@ public class BoundAxe extends ItemAxe 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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) - { - this.setActivated(par1ItemStack, false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) { + this.setActivated(par1ItemStack, false); } } } @@ -222,22 +194,18 @@ public class BoundAxe extends ItemAxe implements IBindable par1ItemStack.setItemDamage(0); } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { - if (!par1ItemStack.hasTagCompound()) - { + public boolean getActivated(ItemStack par1ItemStack) { + if (!par1ItemStack.hasTagCompound()) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -251,10 +219,8 @@ public class BoundAxe extends ItemAxe implements IBindable * sword */ @Override - public float func_150893_a(ItemStack par1ItemStack, Block par2Block) - { - if (!getActivated(par1ItemStack)) - { + public float func_150893_a(ItemStack par1ItemStack, Block par2Block) { + if (!getActivated(par1ItemStack)) { return 0.0F; } @@ -265,13 +231,19 @@ public class BoundAxe extends ItemAxe implements IBindable * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * the damage on the stack. */ - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { return getActivated(par1ItemStack); } - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { return true; } @@ -280,8 +252,7 @@ public class BoundAxe extends ItemAxe implements IBindable /** * Returns True is the item is renderer in full 3D when hold. */ - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @@ -289,8 +260,7 @@ public class BoundAxe extends ItemAxe implements IBindable * Return the enchantability factor of the item, most of the time is based on material. */ @Override - public int getItemEnchantability() - { + public int getItemEnchantability() { return 30; } @@ -298,15 +268,12 @@ public class BoundAxe extends ItemAxe implements IBindable * FORGE: Overridden to allow custom tool effectiveness */ @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!getActivated(stack)) - { + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!getActivated(stack)) { return 0.0F; } - if (ForgeHooks.isToolEffective(stack, block, meta)) - { + if (ForgeHooks.isToolEffective(stack, block, meta)) { return efficiencyOnProperMaterial; } @@ -314,14 +281,12 @@ public class BoundAxe extends ItemAxe implements IBindable } @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { return !getActivated(stack); } @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { + public int getHarvestLevel(ItemStack stack, String toolClass) { return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundPickaxe.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundPickaxe.java index fbb5ed4b..fb6d2b75 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundPickaxe.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundPickaxe.java @@ -1,8 +1,15 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.common.ItemType; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Multiset; +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.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.EnchantmentHelper; @@ -18,30 +25,20 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.common.ItemType; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import com.google.common.collect.HashMultiset; -import com.google.common.collect.Multiset; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BoundPickaxe extends ItemPickaxe implements IBindable -{ +public class BoundPickaxe extends ItemPickaxe implements IBindable { public float efficiencyOnProperMaterial = 12.0F; public float damageVsEntity; + @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; private int energyUsed; - public BoundPickaxe() - { + public BoundPickaxe() { super(AlchemicalWizardry.bloodBoundToolMaterial); this.maxStackSize = 1; this.efficiencyOnProperMaterial = 12.0F; @@ -51,100 +48,82 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable setHarvestLevel("pickaxe", 5); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return this.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.boundpickaxe.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundPickaxe_activated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundPickaxe_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { this.setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); return par1ItemStack; } - - if (par2World.isRemote) - { + + if (par2World.isRemote) { return par1ItemStack; } - if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) - { + if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) { return par1ItemStack; } - if (AlchemicalWizardry.disableBoundToolsRightClick) - { + if (AlchemicalWizardry.disableBoundToolsRightClick) { return par1ItemStack; } - if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) - { + if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) { return par1ItemStack; } - - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) - { - return par1ItemStack; + + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) { + return par1ItemStack; } Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer); @@ -155,31 +134,26 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer); HashMultiset dropMultiset = HashMultiset.create(); - - for (int i = -5; i <= 5; i++) - { - for (int j = -5; j <= 5; j++) - { - for (int k = -5; k <= 5; k++) - { + + for (int i = -5; i <= 5; i++) { + for (int j = -5; j <= 5; j++) { + for (int k = -5; k <= 5; k++) { Block block = par2World.getBlock(posX + i, posY + j, posZ + k); int meta = par2World.getBlockMetadata(posX + i, posY + j, posZ + k); - if (block != null && block.getBlockHardness(par2World, posX + i, posY + j, posZ + k) != -1) - { + if (block != null && block.getBlockHardness(par2World, posX + i, posY + j, posZ + k) != -1) { float str = func_150893_a(par1ItemStack, block); - if (str > 1.1f && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k)) - { - if (silkTouch && block.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta)) - { + if (str > 1.1f && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k)) { + if (silkTouch + && block.canSilkHarvest( + par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta)) { dropMultiset.add(new ItemType(block, meta)); - } else - { - ArrayList itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl); + } else { + ArrayList itemDropList = + block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl); - if (itemDropList != null) - { + if (itemDropList != null) { for (ItemStack stack : itemDropList) dropMultiset.add(ItemType.fromStack(stack), stack.stackSize); } @@ -191,54 +165,45 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable } } } - + dropMultisetStacks(dropMultiset, par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ); - + return par1ItemStack; } - - public static void dropMultisetStacks(Multiset dropMultiset, World world, double x, double y, double z) - { - for (Multiset.Entry entry : dropMultiset.entrySet()) - { + + public static void dropMultisetStacks(Multiset dropMultiset, World world, double x, double y, double z) { + for (Multiset.Entry entry : dropMultiset.entrySet()) { int count = entry.getCount(); ItemType type = entry.getElement(); int maxStackSize = type.item.getItemStackLimit(type.createStack(1)); - - //Drop in groups of maximum size - while (count >= maxStackSize) - { + + // Drop in groups of maximum size + while (count >= maxStackSize) { world.spawnEntityInWorld(new EntityItem(world, x, y, z, type.createStack(maxStackSize))); count -= maxStackSize; } - //Drop remainder - if (count > 0) - world.spawnEntityInWorld(new EntityItem(world, x, y, z, type.createStack(count))); + // Drop remainder + if (count > 0) world.spawnEntityInWorld(new EntityItem(world, x, y, z, type.createStack(count))); } } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) - { - this.setActivated(par1ItemStack, false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) { + this.setActivated(par1ItemStack, false); } } } @@ -246,22 +211,18 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable par1ItemStack.setItemDamage(0); } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { - if (!par1ItemStack.hasTagCompound()) - { + public boolean getActivated(ItemStack par1ItemStack) { + if (!par1ItemStack.hasTagCompound()) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -275,10 +236,9 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable * sword */ @Override - public float func_150893_a(ItemStack par1ItemStack, Block par2Block) //getStrVsBlock - { - if (!getActivated(par1ItemStack)) - { + public float func_150893_a(ItemStack par1ItemStack, Block par2Block) // getStrVsBlock + { + if (!getActivated(par1ItemStack)) { return 0.0F; } @@ -289,17 +249,22 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * the damage on the stack. */ - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { return getActivated(par1ItemStack); } @Override - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + Block par3, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { - if (par7EntityLivingBase instanceof EntityPlayer) - { + if (par7EntityLivingBase instanceof EntityPlayer) { EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); } return true; @@ -310,8 +275,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable /** * Returns True is the item is renderer in full 3D when hold. */ - public boolean isFull3D() - { + public boolean isFull3D() { return true; } @@ -319,8 +283,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable * Return the enchantability factor of the item, most of the time is based on material. */ @Override - public int getItemEnchantability() - { + public int getItemEnchantability() { return 30; } @@ -328,15 +291,12 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable * FORGE: Overridden to allow custom tool effectiveness */ @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!getActivated(stack)) - { + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!getActivated(stack)) { return 0.0F; } - if (ForgeHooks.isToolEffective(stack, block, meta)) - { + if (ForgeHooks.isToolEffective(stack, block, meta)) { return efficiencyOnProperMaterial; } @@ -344,14 +304,12 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable } @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { return !getActivated(stack); } @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { + public int getHarvestLevel(ItemStack stack, String toolClass) { return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundShovel.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundShovel.java index a2f5aaf8..0efafac7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundShovel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/BoundShovel.java @@ -1,8 +1,15 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.common.ItemType; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Multimap; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.EnchantmentHelper; @@ -19,31 +26,20 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.common.ItemType; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import com.google.common.collect.HashMultiset; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BoundShovel extends ItemSpade implements IBindable -{ +public class BoundShovel extends ItemSpade implements IBindable { public float efficiencyOnProperMaterial = 12.0F; public float damageVsEntity; @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; private int energyUsed; - public BoundShovel() - { + public BoundShovel() { super(AlchemicalWizardry.bloodBoundToolMaterial); this.maxStackSize = 1; this.efficiencyOnProperMaterial = 12.0F; @@ -53,99 +49,81 @@ public class BoundShovel extends ItemSpade implements IBindable setHarvestLevel("shovel", 5); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return this.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.boundshovel.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundShovel_activated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundShovel_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { this.setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); return par1ItemStack; } - - if (par2World.isRemote) - { + + if (par2World.isRemote) { return par1ItemStack; } - if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) - { + if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) { return par1ItemStack; } - if (AlchemicalWizardry.disableBoundToolsRightClick) - { + if (AlchemicalWizardry.disableBoundToolsRightClick) { return par1ItemStack; } - if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) - { + if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) { return par1ItemStack; } - - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) - { - return par1ItemStack; + + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) { + return par1ItemStack; } Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer); @@ -156,31 +134,26 @@ public class BoundShovel extends ItemSpade implements IBindable int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer); HashMultiset dropMultiset = HashMultiset.create(); - - for (int i = -5; i <= 5; i++) - { - for (int j = 0; j <= 10; j++) - { - for (int k = -5; k <= 5; k++) - { + + for (int i = -5; i <= 5; i++) { + for (int j = 0; j <= 10; j++) { + for (int k = -5; k <= 5; k++) { Block block = par2World.getBlock(posX + i, posY + j, posZ + k); int meta = par2World.getBlockMetadata(posX + i, posY + j, posZ + k); - if (block != null) - { + if (block != null) { float str = func_150893_a(par1ItemStack, block); - if (str > 1.1f && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k)) - { - if (silkTouch && block.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta)) - { + if (str > 1.1f && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k)) { + if (silkTouch + && block.canSilkHarvest( + par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta)) { dropMultiset.add(new ItemType(block, meta)); - } else - { - ArrayList itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl); + } else { + ArrayList itemDropList = + block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl); - if (itemDropList != null) - { + if (itemDropList != null) { for (ItemStack stack : itemDropList) dropMultiset.add(ItemType.fromStack(stack), stack.stackSize); } @@ -192,33 +165,28 @@ public class BoundShovel extends ItemSpade implements IBindable } } } - + BoundPickaxe.dropMultisetStacks(dropMultiset, par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ); 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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) - { - this.setActivated(par1ItemStack, false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) { + this.setActivated(par1ItemStack, false); } } } @@ -226,22 +194,18 @@ public class BoundShovel extends ItemSpade implements IBindable par1ItemStack.setItemDamage(0); } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } itemTag.setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { - if (!par1ItemStack.hasTagCompound()) - { + public boolean getActivated(ItemStack par1ItemStack) { + if (!par1ItemStack.hasTagCompound()) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -255,10 +219,8 @@ public class BoundShovel extends ItemSpade implements IBindable * sword */ @Override - public float func_150893_a(ItemStack par1ItemStack, Block par2Block) - { - if (!getActivated(par1ItemStack)) - { + public float func_150893_a(ItemStack par1ItemStack, Block par2Block) { + if (!getActivated(par1ItemStack)) { return 0.0F; } @@ -269,13 +231,19 @@ public class BoundShovel extends ItemSpade implements IBindable * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * the damage on the stack. */ - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { return getActivated(par1ItemStack); } - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + int par3, + int par4, + int par5, + int par6, + EntityLivingBase par7EntityLivingBase) { return true; } @@ -284,24 +252,23 @@ public class BoundShovel extends ItemSpade implements IBindable /** * Returns True is the item is renderer in full 3D when hold. */ - public boolean isFull3D() - { + public boolean isFull3D() { return true; } /** * Return the enchantability factor of the item, most of the time is based on material. */ - public int getItemEnchantability() - { + public int getItemEnchantability() { return 30; } @Override - public Multimap getItemAttributeModifiers() - { + public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double) this.damageVsEntity, 0)); + multimap.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Tool modifier", (double) this.damageVsEntity, 0)); return multimap; } @@ -309,15 +276,12 @@ public class BoundShovel extends ItemSpade implements IBindable * FORGE: Overridden to allow custom tool effectiveness */ @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!getActivated(stack)) - { + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!getActivated(stack)) { return 0.0F; } - if (ForgeHooks.isToolEffective(stack, block, meta)) - { + if (ForgeHooks.isToolEffective(stack, block, meta)) { return efficiencyOnProperMaterial; } @@ -325,14 +289,12 @@ public class BoundShovel extends ItemSpade implements IBindable } @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { return !getActivated(stack); } @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { + public int getHarvestLevel(ItemStack stack, String toolClass) { return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/CheatyItem.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/CheatyItem.java index 29a842fa..c0b2171a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/CheatyItem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/CheatyItem.java @@ -7,23 +7,19 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; 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.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.DamageSource; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; -import java.util.List; - -public class CheatyItem extends Item implements IBindable -{ - public CheatyItem() - { +public class CheatyItem extends Item implements IBindable { + public CheatyItem() { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -31,59 +27,58 @@ public class CheatyItem extends Item implements IBindable @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBattery"); } @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.mode.creative")); par3List.add(StatCollector.translateToLocal("tooltip.cheatyitem.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.cheatyitem.desc2")); - 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")); } } - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { World world = par3EntityPlayer.worldObj; - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer instanceof FakePlayer) - { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) + || par3EntityPlayer instanceof FakePlayer) { return par1ItemStack; } - if (world != null) - { + if (world != null) { double posX = par3EntityPlayer.posX; double posY = par3EntityPlayer.posY; double posZ = par3EntityPlayer.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); - SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, 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); + SpellHelper.sendIndexedParticleToAllAround( + world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ); } - if (par3EntityPlayer.worldObj.isRemote) - { + if (par3EntityPlayer.worldObj.isRemote) { return par1ItemStack; } NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null || itemTag.getString("ownerName").equals("")) - { + if (itemTag == null || itemTag.getString("ownerName").equals("")) { return par1ItemStack; } - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { SoulNetworkHandler.setCurrentEssence(itemTag.getString("ownerName"), 0); - } else - { + } else { SoulNetworkHandler.addCurrentEssenceToMaximum(itemTag.getString("ownerName"), 1000000, Integer.MAX_VALUE); } return par1ItemStack; @@ -92,10 +87,8 @@ public class CheatyItem extends Item implements IBindable /* * @return the damage that was not deducted */ - public int damageItem(ItemStack par1ItemStack, int par2int) - { - if (par2int == 0) - { + public int damageItem(ItemStack par1ItemStack, int par2int) { + if (par2int == 0) { return 0; } @@ -104,62 +97,64 @@ public class CheatyItem extends Item implements IBindable return par2int - (this.getDamage(par1ItemStack) - before); } - protected void damagePlayer(World world, EntityPlayer player, int damage) - { - if (world != null) - { + protected void damagePlayer(World world, EntityPlayer player, int damage) { + if (world != null) { 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 (!player.capabilities.isCreativeMode) - { - for (int i = 0; i < damage; i++) - { + if (!player.capabilities.isCreativeMode) { + for (int i = 0; i < damage; i++) { player.setHealth((player.getHealth() - 1)); } } - if (player.getHealth() <= 0) - { + if (player.getHealth() <= 0) { player.inventory.dropAllItems(); } } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { return itemStack; } @Override - public boolean hasContainerItem(ItemStack itemStack) - { + public boolean hasContainerItem(ItemStack itemStack) { return true; } - public int getCurrentEssence(ItemStack par1ItemStack) - { - if (par1ItemStack == null) - { + public int getCurrentEssence(ItemStack par1ItemStack) { + if (par1ItemStack == null) { return 0; } NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null || itemTag.getString("ownerName").equals("")) - { + if (itemTag == null || itemTag.getString("ownerName").equals("")) { return 0; } @@ -167,8 +162,7 @@ public class CheatyItem extends Item implements IBindable 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); } @@ -178,8 +172,7 @@ public class CheatyItem extends Item implements IBindable } @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) - { + public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) { return false; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/CreativeDagger.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/CreativeDagger.java index a3074d2a..30fd3ce9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/CreativeDagger.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/CreativeDagger.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.event.SacrificeKnifeUsedEvent; import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler; +import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -11,14 +14,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class CreativeDagger extends Item -{ - public CreativeDagger() - { +public class CreativeDagger extends Item { + public CreativeDagger() { super(); setTextureName("AlchemicalWizardry:SacrificialDagger"); setMaxStackSize(1); @@ -26,54 +24,58 @@ public class CreativeDagger extends Item setFull3D(); } - 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; } @@ -81,15 +83,13 @@ public class CreativeDagger extends Item return stack; } - 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; } @@ -97,21 +97,16 @@ public class CreativeDagger 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) - { - return (IBloodAltar)tileEntity; + if (tileEntity instanceof IBloodAltar) { + return (IBloodAltar) tileEntity; } } } @@ -121,31 +116,25 @@ public class CreativeDagger 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)); } } - 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); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/DaggerOfSacrifice.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/DaggerOfSacrifice.java index 45077e88..57f27a73 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/DaggerOfSacrifice.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/DaggerOfSacrifice.java @@ -1,7 +1,5 @@ package WayofTime.alchemicalWizardry.common.items; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.IDemon; @@ -10,6 +8,7 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import com.google.common.collect.Multimap; 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; @@ -25,10 +24,8 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class DaggerOfSacrifice extends EnergyItems -{ - public DaggerOfSacrifice() - { +public class DaggerOfSacrifice extends EnergyItems { + public DaggerOfSacrifice() { super(); this.maxStackSize = 1; setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -39,55 +36,55 @@ public class DaggerOfSacrifice extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DaggerOfSacrifice"); } @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) - { - return false; + 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); - this.findAndNotifyAltarOfDemon(world, par2EntityLivingBase); + if (par2EntityLivingBase instanceof IDemon) { + ((IDemon) par2EntityLivingBase).setDropCrystal(false); + this.findAndNotifyAltarOfDemon(world, par2EntityLivingBase); } - int lifeEssence = AlchemicalWizardry.lpPerSactificeCustom.containsKey(par2EntityLivingBase.getClass()) ? - AlchemicalWizardry.lpPerSactificeCustom.get(par2EntityLivingBase.getClass()) : - AlchemicalWizardry.lpPerSacrificeBase; + int lifeEssence = AlchemicalWizardry.lpPerSactificeCustom.containsKey(par2EntityLivingBase.getClass()) + ? AlchemicalWizardry.lpPerSactificeCustom.get(par2EntityLivingBase.getClass()) + : AlchemicalWizardry.lpPerSacrificeBase; - 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); @@ -97,54 +94,53 @@ public class DaggerOfSacrifice extends EnergyItems return false; } - public float func_82803_g() - { + public float func_82803_g() { return 4.0F; } @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.caution.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.caution.desc2")); } @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", 1.0d, 0)); + multimap.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Tool modifier", 1.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; } @@ -153,15 +149,13 @@ public class DaggerOfSacrifice 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; } @@ -170,20 +164,15 @@ public class DaggerOfSacrifice 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/WayofTime/alchemicalWizardry/common/items/DawnScribeTool.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/DawnScribeTool.java index a0bda137..2bdf9b65 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/DawnScribeTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/DawnScribeTool.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class DawnScribeTool extends ScribeTool -{ - public DawnScribeTool() - { +public class DawnScribeTool extends ScribeTool { + public DawnScribeTool() { super(6); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DawnScribeTool"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonPlacer.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonPlacer.java index eeafc65c..c741590c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonPlacer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonPlacer.java @@ -1,7 +1,11 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +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; @@ -20,16 +24,9 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry; -import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class DemonPlacer extends Item -{ - public DemonPlacer() - { +public class DemonPlacer extends Item { + public DemonPlacer() { super(); this.setHasSubtypes(true); this.setCreativeTab(CreativeTabs.tabMisc); @@ -37,48 +34,57 @@ public class DemonPlacer extends Item } @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) - { - EntityEggInfo entityegginfo = (EntityEggInfo) EntityList.entityEggs.get(Integer.valueOf(par1ItemStack.getItemDamage())); - return entityegginfo != null ? (par2 == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { + EntityEggInfo entityegginfo = + (EntityEggInfo) EntityList.entityEggs.get(Integer.valueOf(par1ItemStack.getItemDamage())); + return entityegginfo != null + ? (par2 == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) + : 16777215; } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */ - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) - { - if (par3World.isRemote) - { + public boolean onItemUse( + ItemStack par1ItemStack, + EntityPlayer par2EntityPlayer, + World par3World, + int par4, + int par5, + int par6, + int par7, + float par8, + float par9, + float par10) { + if (par3World.isRemote) { return true; - } else - { + } else { Block i1 = par3World.getBlock(par4, par5, par6); par4 += Facing.offsetsXForSide[par7]; par5 += Facing.offsetsYForSide[par7]; par6 += Facing.offsetsZForSide[par7]; double d0 = 0.0D; - if (par7 == 1 && i1 != null && i1.getRenderType() == 11) - { + if (par7 == 1 && i1 != null && i1.getRenderType() == 11) { d0 = 0.5D; } - String demonName = DemonPlacer.getDemonString(par1ItemStack); - Entity entity = spawnCreature(par3World, demonName, (double) par4 + 0.5D, (double) par5 + d0, (double) par6 + 0.5D, par1ItemStack); + String demonName = DemonPlacer.getDemonString(par1ItemStack); + Entity entity = spawnCreature( + par3World, + demonName, + (double) par4 + 0.5D, + (double) par5 + d0, + (double) par6 + 0.5D, + par1ItemStack); - if (entity != null) - { - if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) - { + if (entity != null) { + if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) { ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName()); } - - - if (!par2EntityPlayer.capabilities.isCreativeMode) - { + if (!par2EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } } @@ -90,50 +96,40 @@ public class DemonPlacer extends Item /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (par2World.isRemote) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (par2World.isRemote) { return par1ItemStack; - } else - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + } else { + MovingObjectPosition movingobjectposition = + this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return par1ItemStack; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) - { + if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) { return par1ItemStack; } - if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) - { + if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) { return par1ItemStack; } - if (par2World.getBlock(i, j, k).getMaterial() == Material.water) - { - String demonName = DemonPlacer.getDemonString(par1ItemStack); - Entity entity = spawnCreature(par2World, demonName, (double) i, (double) j, (double) k, par1ItemStack); + if (par2World.getBlock(i, j, k).getMaterial() == Material.water) { + String demonName = DemonPlacer.getDemonString(par1ItemStack); + Entity entity = + spawnCreature(par2World, demonName, (double) i, (double) j, (double) k, par1ItemStack); - if (entity != null) - { - if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) - { + if (entity != null) { + if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) { ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName()); } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } } @@ -149,32 +145,29 @@ public class DemonPlacer extends Item * Spawns the creature specified by the egg's type in the location specified by the last three parameters. * Parameters: world, entityID, x, y, z. */ - public static Entity spawnCreature(World par0World, String par1, double par2, double par4, double par6, ItemStack itemStack) - { + public static Entity spawnCreature( + World par0World, String par1, double par2, double par4, double par6, ItemStack itemStack) { Entity entity = null; - for (int j = 0; j < 1; ++j) - { + for (int j = 0; j < 1; ++j) { entity = SummoningRegistry.getEntityWithID(par0World, par1); - if (entity != null && entity instanceof EntityLivingBase) - { + if (entity != null && entity instanceof EntityLivingBase) { EntityLiving entityliving = (EntityLiving) entity; - entity.setLocationAndAngles(par2, par4, par6, MathHelper.wrapAngleTo180_float(par0World.rand.nextFloat() * 360.0F), 0.0F); + entity.setLocationAndAngles( + par2, par4, par6, MathHelper.wrapAngleTo180_float(par0World.rand.nextFloat() * 360.0F), 0.0F); entityliving.rotationYawHead = entityliving.rotationYaw; entityliving.renderYawOffset = entityliving.rotationYaw; - if (entityliving instanceof EntityDemon) - { - Entity owner = SpellHelper.getPlayerForUsername(DemonPlacer.getOwnerName(itemStack)); - if(owner != null) - { - ((EntityDemon) entityliving).func_152115_b(owner.getPersistentID().toString()); + if (entityliving instanceof EntityDemon) { + Entity owner = SpellHelper.getPlayerForUsername(DemonPlacer.getOwnerName(itemStack)); + if (owner != null) { + ((EntityDemon) entityliving) + .func_152115_b(owner.getPersistentID().toString()); - if (!DemonPlacer.getOwnerName(itemStack).equals("")) - { + if (!DemonPlacer.getOwnerName(itemStack).equals("")) { ((EntityDemon) entityliving).setTamed(true); } - } + } } par0World.spawnEntityInWorld(entity); @@ -184,40 +177,32 @@ public class DemonPlacer extends Item return entity; } - public static void setOwnerName(ItemStack par1ItemStack, String ownerName) - { - if (par1ItemStack.getTagCompound() == null) - { + public static void setOwnerName(ItemStack par1ItemStack, String ownerName) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } par1ItemStack.getTagCompound().setString("ownerName", ownerName); } - public static String getOwnerName(ItemStack par1ItemStack) - { - if (par1ItemStack.getTagCompound() == null) - { + public static String getOwnerName(ItemStack par1ItemStack) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } return par1ItemStack.getTagCompound().getString("ownerName"); } - - public static void setDemonString(ItemStack itemStack, String demonName) - { - if (itemStack.getTagCompound() == null) - { + + public static void setDemonString(ItemStack itemStack, String demonName) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } itemStack.getTagCompound().setString("demonName", demonName); } - - public static String getDemonString(ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + + public static String getDemonString(ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -225,23 +210,20 @@ public class DemonPlacer extends Item } @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.demonplacer.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.demonsowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!(par1ItemStack.getTagCompound() == null)) { + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.demonsowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonPlacer"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonicTelepositionFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonicTelepositionFocus.java index 799fc38e..9d5d75f3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonicTelepositionFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/DemonicTelepositionFocus.java @@ -2,45 +2,41 @@ package WayofTime.alchemicalWizardry.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.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; -import java.util.List; - -public class DemonicTelepositionFocus extends TelepositionFocus -{ - public DemonicTelepositionFocus() - { +public class DemonicTelepositionFocus extends TelepositionFocus { + public DemonicTelepositionFocus() { super(4); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonicTeleposerFocus"); } @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.demonictelepfocus.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.demonictelepfocus.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); + par3List.add( + StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/DuskScribeTool.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/DuskScribeTool.java index 6de25769..0c6b507e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/DuskScribeTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/DuskScribeTool.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class DuskScribeTool extends ScribeTool -{ - public DuskScribeTool() - { +public class DuskScribeTool extends ScribeTool { + public DuskScribeTool() { super(5); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DuskScribeTool"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/EarthScribeTool.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/EarthScribeTool.java index 824d3925..984fbd28 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/EarthScribeTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/EarthScribeTool.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class EarthScribeTool extends ScribeTool -{ - public EarthScribeTool() - { +public class EarthScribeTool extends ScribeTool { + public EarthScribeTool() { super(3); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EarthScribeTool"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBattery.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBattery.java index 3f12eb8e..06d0294b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBattery.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBattery.java @@ -9,6 +9,7 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; 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.Item; @@ -18,15 +19,11 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBloodOrb -{ +public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBloodOrb { private int maxEssence; protected int orbLevel; - public EnergyBattery(int damage) - { + public EnergyBattery(int damage) { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -36,58 +33,56 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBl @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBattery"); } @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.energybattery.desc")); - 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")); } } - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { return par1ItemStack; } World world = par3EntityPlayer.worldObj; - - if (world != null) - { + + if (world != null) { double posX = par3EntityPlayer.posX; double posY = par3EntityPlayer.posY; double posZ = par3EntityPlayer.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); - SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, 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); + SpellHelper.sendIndexedParticleToAllAround( + world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ); } NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if(SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) - { - return par1ItemStack; - } - - if (itemTag == null || itemTag.getString("ownerName").equals("")) - { + if (SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) { return par1ItemStack; } - if (world.isRemote) - { + if (itemTag == null || itemTag.getString("ownerName").equals("")) { return par1ItemStack; } - - if(itemTag.getString("ownerName").equals(SpellHelper.getUsername(par3EntityPlayer))) - { - SoulNetworkHandler.setMaxOrbToMax(itemTag.getString("ownerName"), this.orbLevel); + + if (world.isRemote) { + return par1ItemStack; + } + + if (itemTag.getString("ownerName").equals(SpellHelper.getUsername(par3EntityPlayer))) { + SoulNetworkHandler.setMaxOrbToMax(itemTag.getString("ownerName"), this.orbLevel); } SoulNetworkHandler.addCurrentEssenceToMaximum(itemTag.getString("ownerName"), 200, this.getMaxEssence()); @@ -98,10 +93,8 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBl /* * @return the damage that was not deducted */ - public int damageItem(ItemStack par1ItemStack, int par2int) - { - if (par2int == 0) - { + public int damageItem(ItemStack par1ItemStack, int par2int) { + if (par2int == 0) { return 0; } @@ -110,91 +103,87 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBl return par2int - (this.getDamage(par1ItemStack) - before); } - protected void damagePlayer(World world, EntityPlayer player, int damage) - { - if (world != null) - { + protected void damagePlayer(World world, EntityPlayer player, int damage) { + if (world != null) { 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 (!player.capabilities.isCreativeMode) - { - for (int i = 0; i < damage; i++) - { + if (!player.capabilities.isCreativeMode) { + for (int i = 0; i < damage; i++) { player.setHealth((player.getHealth() - 1)); } } - if (player.getHealth() <= 0) - { + if (player.getHealth() <= 0) { player.inventory.dropAllItems(); } } - public int getMaxEssence() - { + public int getMaxEssence() { return this.maxEssence; } - public int getOrbLevel() - { + public int getOrbLevel() { return orbLevel; } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - } + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {} @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return false; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 0; } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { return itemStack; } @Override - public boolean hasContainerItem(ItemStack itemStack) - { + public boolean hasContainerItem(ItemStack itemStack) { return true; } - //@SideOnly(Side.SERVER) + // @SideOnly(Side.SERVER) @Deprecated - public int getCurrentEssence(ItemStack par1ItemStack) - { - if (par1ItemStack == null) - { + public int getCurrentEssence(ItemStack par1ItemStack) { + if (par1ItemStack == null) { return 0; } NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null || itemTag.getString("ownerName").equals("")) - { + if (itemTag == null || itemTag.getString("ownerName").equals("")) { return 0; } @@ -202,8 +191,7 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBl 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); } @@ -212,8 +200,7 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBl } @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) - { + public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) { return false; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBazooka.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBazooka.java index dc13f536..197a3bb9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBazooka.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBazooka.java @@ -1,11 +1,10 @@ package WayofTime.alchemicalWizardry.common.items; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile; 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; @@ -16,29 +15,30 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class EnergyBazooka extends EnergyItems -{ +public class EnergyBazooka extends EnergyItems { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon activeIconTier2; + @SideOnly(Side.CLIENT) private IIcon activeIconTier3; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int tier; private int damage; - public EnergyBazooka(int tier) - { + public EnergyBazooka(int tier) { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); setFull3D(); setMaxDamage(250); this.tier = tier; - switch (this.tier) - { + switch (this.tier) { case 1: this.setEnergyUsed(AlchemicalWizardry.energyBazookaLPPerShot); this.damage = AlchemicalWizardry.energyBazookaDamage; @@ -56,8 +56,7 @@ public class EnergyBazooka extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBazooka_activated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBazooka_activated"); this.activeIconTier2 = iconRegister.registerIcon("AlchemicalWizardry:EnergyBazooka2_activated"); @@ -66,19 +65,15 @@ public class EnergyBazooka extends EnergyItems } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { - switch (this.tier) - { + if (tag.getBoolean("isActive")) { + switch (this.tier) { case 1: return this.activeIcon; case 2: @@ -87,20 +82,16 @@ public class EnergyBazooka extends EnergyItems return this.activeIconTier3; } return this.activeIcon; - } - else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { int maxDelay = 1; int maxDelayAfterActivation = 1; - switch (this.tier) - { + switch (this.tier) { case 1: maxDelay = AlchemicalWizardry.energyBazookaMaxDelay; maxDelayAfterActivation = AlchemicalWizardry.energyBazookaMaxDelayAfterActivation + 1; @@ -114,36 +105,33 @@ public class EnergyBazooka extends EnergyItems maxDelayAfterActivation = AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation + 1; break; } - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { this.setActivated(par1ItemStack, !getActivated(par1ItemStack)); - par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % maxDelayAfterActivation); + par1ItemStack + .getTagCompound() + .setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % maxDelayAfterActivation); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } - if (this.getDelay(par1ItemStack) > 0) - { + if (this.getDelay(par1ItemStack) > 0) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) - { - return par1ItemStack; + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) { + return par1ItemStack; } } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { - par2World.spawnEntityInWorld(new EntityEnergyBazookaMainProjectile(par2World, par3EntityPlayer, this.damage)); + if (!par2World.isRemote) { + par2World.spawnEntityInWorld( + new EntityEnergyBazookaMainProjectile(par2World, par3EntityPlayer, this.damage)); this.setDelay(par1ItemStack, maxDelay); } @@ -152,35 +140,36 @@ public class EnergyBazooka extends EnergyItems par3EntityPlayer.motionX = -vec.xCoord * wantedVelocity; par3EntityPlayer.motionY = -vec.yCoord * wantedVelocity; par3EntityPlayer.motionZ = -vec.zCoord * wantedVelocity; - par2World.playSoundEffect((double) ((float) par3EntityPlayer.posX + 0.5F), (double) ((float) par3EntityPlayer.posY + 0.5F), (double) ((float) par3EntityPlayer.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); + par2World.playSoundEffect( + (double) ((float) par3EntityPlayer.posX + 0.5F), + (double) ((float) par3EntityPlayer.posY + 0.5F), + (double) ((float) par3EntityPlayer.posZ + 0.5F), + "random.fizz", + 0.5F, + 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); par3EntityPlayer.fallDistance = 0; 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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } int delay = this.getDelay(par1ItemStack); - if (!par2World.isRemote && delay > 0) - { + if (!par2World.isRemote && delay > 0) { this.setDelay(par1ItemStack, delay - 1); } int lpPerActivation = 0; int maxDelayAfterActivation = 1; - switch (this.tier) - { + switch (this.tier) { case 1: lpPerActivation = AlchemicalWizardry.energyBazookaLPPerActivation; maxDelayAfterActivation = AlchemicalWizardry.energyBazookaMaxDelayAfterActivation + 1; @@ -194,14 +183,12 @@ public class EnergyBazooka extends EnergyItems maxDelayAfterActivation = AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation + 1; break; } - if (par2World.getWorldTime() % maxDelayAfterActivation == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && - par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, lpPerActivation)) - { - this.setActivated(par1ItemStack, false); + if (par2World.getWorldTime() % maxDelayAfterActivation + == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, lpPerActivation)) { + this.setActivated(par1ItemStack, false); } } } @@ -212,58 +199,45 @@ public class EnergyBazooka extends EnergyItems @Override @SideOnly(Side.CLIENT) @SuppressWarnings({"unchecked", "rawtypes"}) - 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.energybazooka.desc")); par3List.add(StatCollector.translateToLocal("tooltip.alchemy.damage") + " " + this.damage); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } - else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { - if (par1ItemStack.getTagCompound() == null) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } par1ItemStack.getTagCompound().setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { - if (par1ItemStack.getTagCompound() == null) - { + public boolean getActivated(ItemStack par1ItemStack) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } return par1ItemStack.getTagCompound().getBoolean("isActive"); } - public void setDelay(ItemStack par1ItemStack, int newDelay) - { - if (par1ItemStack.getTagCompound() == null) - { + public void setDelay(ItemStack par1ItemStack, int newDelay) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } par1ItemStack.getTagCompound().setInteger("delay", newDelay); } - public int getDelay(ItemStack par1ItemStack) - { - if (par1ItemStack.getTagCompound() == null) - { + public int getDelay(ItemStack par1ItemStack) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } return par1ItemStack.getTagCompound().getInteger("delay"); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBlast.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBlast.java index c3edc29e..18b6d99a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBlast.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyBlast.java @@ -1,11 +1,10 @@ package WayofTime.alchemicalWizardry.common.items; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; 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; @@ -15,21 +14,23 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class EnergyBlast extends EnergyItems -{ +public class EnergyBlast extends EnergyItems { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon activeIconTier2; + @SideOnly(Side.CLIENT) private IIcon activeIconTier3; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int tier; private int damage; - public EnergyBlast(int tier) - { + public EnergyBlast(int tier) { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -37,8 +38,7 @@ public class EnergyBlast extends EnergyItems setFull3D(); setMaxDamage(250); this.tier = tier; - switch (this.tier) - { + switch (this.tier) { case 1: this.setEnergyUsed(AlchemicalWizardry.energyBlastLPPerShot); this.damage = AlchemicalWizardry.energyBlastDamage; @@ -56,8 +56,7 @@ public class EnergyBlast extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBlaster_activated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:EnergyBlaster_activated"); this.activeIconTier2 = iconRegister.registerIcon("AlchemicalWizardry:EnergyBlaster2_activated"); @@ -67,19 +66,15 @@ public class EnergyBlast extends EnergyItems @Override @SideOnly(Side.CLIENT) - 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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { - switch (this.tier) - { + if (tag.getBoolean("isActive")) { + switch (this.tier) { case 1: return this.activeIcon; case 2: @@ -88,20 +83,16 @@ public class EnergyBlast extends EnergyItems return this.activeIconTier3; } return this.activeIcon; - } - else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { int maxDelay = 1; int maxDelayAfterActivation = 1; - switch (this.tier) - { + switch (this.tier) { case 1: maxDelay = AlchemicalWizardry.energyBlastMaxDelay; maxDelayAfterActivation = AlchemicalWizardry.energyBlastMaxDelayAfterActivation + 1; @@ -115,35 +106,31 @@ public class EnergyBlast extends EnergyItems maxDelayAfterActivation = AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation + 1; break; } - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { this.setActivated(par1ItemStack, !getActivated(par1ItemStack)); - par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % maxDelayAfterActivation); + par1ItemStack + .getTagCompound() + .setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % maxDelayAfterActivation); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } - if (this.getDelay(par1ItemStack) > 0) - { + if (this.getDelay(par1ItemStack) > 0) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) - { - return par1ItemStack; + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) { + return par1ItemStack; } } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, this.damage)); this.setDelay(par1ItemStack, maxDelay); } @@ -152,28 +139,23 @@ public class EnergyBlast extends EnergyItems } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } int delay = this.getDelay(par1ItemStack); - if (!par2World.isRemote && delay > 0) - { + if (!par2World.isRemote && delay > 0) { this.setDelay(par1ItemStack, delay - 1); } int lpPerActivation = 0; int maxDelayAfterActivation = 1; - switch (this.tier) - { + switch (this.tier) { case 1: lpPerActivation = AlchemicalWizardry.energyBlastLPPerActivation; maxDelayAfterActivation = AlchemicalWizardry.energyBlastMaxDelayAfterActivation + 1; @@ -187,14 +169,12 @@ public class EnergyBlast extends EnergyItems maxDelayAfterActivation = AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation + 1; break; } - if (par2World.getWorldTime() % maxDelayAfterActivation == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && - par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, lpPerActivation)) - { - this.setActivated(par1ItemStack, false); + if (par2World.getWorldTime() % maxDelayAfterActivation + == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, lpPerActivation)) { + this.setActivated(par1ItemStack, false); } } } @@ -205,59 +185,46 @@ public class EnergyBlast extends EnergyItems @Override @SideOnly(Side.CLIENT) @SuppressWarnings({"unchecked", "rawtypes"}) - 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.energyblast.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.energyblast.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.alchemy.damage") + " " + this.damage); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } - else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { - if (par1ItemStack.getTagCompound() == null) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } par1ItemStack.getTagCompound().setBoolean("isActive", newActivated); } - public boolean getActivated(ItemStack par1ItemStack) - { - if (par1ItemStack.getTagCompound() == null) - { + public boolean getActivated(ItemStack par1ItemStack) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } return par1ItemStack.getTagCompound().getBoolean("isActive"); } - public void setDelay(ItemStack par1ItemStack, int newDelay) - { - if (par1ItemStack.getTagCompound() == null) - { + public void setDelay(ItemStack par1ItemStack, int newDelay) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } par1ItemStack.getTagCompound().setInteger("delay", newDelay); } - public int getDelay(ItemStack par1ItemStack) - { - if (par1ItemStack.getTagCompound() == null) - { + public int getDelay(ItemStack par1ItemStack) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } return par1ItemStack.getTagCompound().getInteger("delay"); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyItems.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyItems.java index 4b0cecaa..0b559bb9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergyItems.java @@ -13,99 +13,102 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class EnergyItems extends Item implements IBindable -{ +public class EnergyItems extends Item implements IBindable { private int energyUsed; - public EnergyItems() - { + public EnergyItems() { super(); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } - protected void setEnergyUsed(int par1int) - { + protected void setEnergyUsed(int par1int) { this.energyUsed = par1int; } - protected int getEnergyUsed() - { + protected int getEnergyUsed() { return this.energyUsed; } - protected void damagePlayer(World world, EntityPlayer player, int damage) - { - if (world != null) - { + protected void damagePlayer(World world, EntityPlayer player, int damage) { + if (world != null) { 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); } } - for (int i = 0; i < damage; i++) - { + for (int i = 0; i < damage; i++) { player.setHealth((player.getHealth() - 1)); - if (player.getHealth() <= 0.0005) - { + if (player.getHealth() <= 0.0005) { player.inventory.dropAllItems(); break; } } } - public static boolean syphonBatteries(ItemStack ist, EntityPlayer player, int damageToBeDone) - { - if (!player.worldObj.isRemote) - { + public static boolean syphonBatteries(ItemStack ist, EntityPlayer player, int damageToBeDone) { + if (!player.worldObj.isRemote) { return SoulNetworkHandler.syphonAndDamageFromNetwork(ist, player, damageToBeDone); - } else - { + } else { World world = player.worldObj; - if (world != null) - { + if (world != null) { double posX = player.posX; double posY = player.posY; double posZ = player.posZ; - SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ); - world.playSoundEffect((double) ((float) player.posX + 0.5F), (double) ((float) player.posY + 0.5F), (double) ((float) player.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); + SpellHelper.sendIndexedParticleToAllAround( + world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ); + world.playSoundEffect( + (double) ((float) player.posX + 0.5F), + (double) ((float) player.posY + 0.5F), + (double) ((float) player.posZ + 0.5F), + "random.fizz", + 0.5F, + 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); } } return true; } @Deprecated - public static boolean syphonWhileInContainer(ItemStack ist, int damageToBeDone) - { - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { + public static boolean syphonWhileInContainer(ItemStack ist, int damageToBeDone) { + if (ist.getTagCompound() != null + && !(ist.getTagCompound().getString("ownerName").equals(""))) { String ownerName = ist.getTagCompound().getString("ownerName"); - if (MinecraftServer.getServer() == null) - { + if (MinecraftServer.getServer() == null) { return false; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } - if (data.currentEssence >= damageToBeDone) - { + if (data.currentEssence >= damageToBeDone) { data.currentEssence -= damageToBeDone; data.markDirty(); return true; @@ -115,22 +118,19 @@ public class EnergyItems extends Item implements IBindable return false; } - public static boolean canSyphonInContainer(ItemStack ist, int damageToBeDone) - { - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { + public static boolean canSyphonInContainer(ItemStack ist, int damageToBeDone) { + if (ist.getTagCompound() != null + && !(ist.getTagCompound().getString("ownerName").equals(""))) { String ownerName = ist.getTagCompound().getString("ownerName"); - if (MinecraftServer.getServer() == null) - { + if (MinecraftServer.getServer() == null) { return false; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } @@ -141,30 +141,21 @@ public class EnergyItems extends Item implements IBindable return false; } - public static void hurtPlayer(EntityPlayer user, int energySyphoned) - { - if (energySyphoned < 100 && energySyphoned > 0) - { - if (!user.capabilities.isCreativeMode) - { + public static void hurtPlayer(EntityPlayer user, int energySyphoned) { + if (energySyphoned < 100 && energySyphoned > 0) { + if (!user.capabilities.isCreativeMode) { user.setHealth((user.getHealth() - 1)); - if (user.getHealth() <= 0.0005f) - { + if (user.getHealth() <= 0.0005f) { user.onDeath(DamageSource.generic); - } } - } else if (energySyphoned >= 100) - { - if (!user.capabilities.isCreativeMode) - { - for (int i = 0; i < ((energySyphoned + 99) / 100); i++) - { + } else if (energySyphoned >= 100) { + if (!user.capabilities.isCreativeMode) { + for (int i = 0; i < ((energySyphoned + 99) / 100); i++) { user.setHealth((user.getHealth() - 1)); - if (user.getHealth() <= 0.0005f) - { + if (user.getHealth() <= 0.0005f) { user.onDeath(DamageSource.generic); break; } @@ -173,49 +164,39 @@ public class EnergyItems extends Item implements IBindable } } - public static boolean syphonAndDamageWhileInContainer(ItemStack ist, EntityPlayer player, int damageToBeDone) - { - if (!syphonWhileInContainer(ist, damageToBeDone)) - { + public static boolean syphonAndDamageWhileInContainer(ItemStack ist, EntityPlayer player, int damageToBeDone) { + if (!syphonWhileInContainer(ist, damageToBeDone)) { hurtPlayer(player, damageToBeDone); } return true; } - //Global static methods - public static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) - { + // Global static methods + public static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) { return !SpellHelper.isFakePlayer(player) && SoulNetworkHandler.checkAndSetItemPlayer(item, player); } - public static void setItemOwner(ItemStack item, String ownerName) - { - if (item.getTagCompound() == null) - { + public static void setItemOwner(ItemStack item, String ownerName) { + if (item.getTagCompound() == null) { item.setTagCompound(new NBTTagCompound()); } item.getTagCompound().setString("ownerName", ownerName); } - public static void checkAndSetItemOwner(ItemStack item, String ownerName) - { - if (item.getTagCompound() == null) - { + public static void checkAndSetItemOwner(ItemStack item, String ownerName) { + if (item.getTagCompound() == null) { item.setTagCompound(new NBTTagCompound()); } - if (item.getTagCompound().getString("ownerName").equals("")) - { + if (item.getTagCompound().getString("ownerName").equals("")) { item.getTagCompound().setString("ownerName", ownerName); } } - public static String getOwnerName(ItemStack item) - { - if (item.getTagCompound() == null) - { + public static String getOwnerName(ItemStack item) { + if (item.getTagCompound() == null) { item.setTagCompound(new NBTTagCompound()); } @@ -223,47 +204,39 @@ public class EnergyItems extends Item implements IBindable } @Deprecated - public static void drainPlayerNetwork(EntityPlayer player, int damageToBeDone) - { + public static void drainPlayerNetwork(EntityPlayer player, int damageToBeDone) { String ownerName = SpellHelper.getUsername(player); - if (MinecraftServer.getServer() == null) - { + if (MinecraftServer.getServer() == null) { return; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } - if (data.currentEssence >= damageToBeDone) - { + if (data.currentEssence >= damageToBeDone) { data.currentEssence -= damageToBeDone; data.markDirty(); - } else - { + } else { hurtPlayer(player, damageToBeDone); } } @Deprecated - public static int getCurrentEssence(String ownerName) - { - if (MinecraftServer.getServer() == null) - { + public static int getCurrentEssence(String ownerName) { + if (MinecraftServer.getServer() == null) { return 0; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } @@ -272,18 +245,15 @@ public class EnergyItems extends Item implements IBindable } @Deprecated - public static void setCurrentEssence(String ownerName, int amount) - { - if (MinecraftServer.getServer() == null) - { + public static void setCurrentEssence(String ownerName, int amount) { + if (MinecraftServer.getServer() == null) { return; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } @@ -293,24 +263,20 @@ public class EnergyItems extends Item implements IBindable } @Deprecated - public static void addEssenceToMaximum(String ownerName, int amount, int maximum) - { - if (MinecraftServer.getServer() == null) - { + public static void addEssenceToMaximum(String ownerName, int amount, int maximum) { + if (MinecraftServer.getServer() == null) { return; } World world = MinecraftServer.getServer().worldServers[0]; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } - if (data.currentEssence >= maximum) - { + if (data.currentEssence >= maximum) { return; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergySword.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergySword.java index 65477341..3ca7b742 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergySword.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnergySword.java @@ -1,7 +1,11 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; +import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; +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; @@ -17,22 +21,17 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; -import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class EnergySword extends ItemSword -{ +public class EnergySword extends ItemSword { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int energyUsed; - public EnergySword() - { + public EnergySword() { super(AlchemicalWizardry.bloodBoundToolMaterial); this.maxStackSize = 1; setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -41,76 +40,64 @@ public class EnergySword extends ItemSword setMaxDamage(100); } - public void setEnergyUsed(int i) - { + public void setEnergyUsed(int i) { energyUsed = i; } - public int getEnergyUsed() - { + public int getEnergyUsed() { return this.energyUsed; } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundSword_activated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundSword_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } - - private OmegaParadigm getOmegaParadigmOfWeilder(EntityPlayer player) - { - return OmegaRegistry.getOmegaParadigmOfWeilder(player); + + private OmegaParadigm getOmegaParadigmOfWeilder(EntityPlayer player) { + return OmegaRegistry.getOmegaParadigmOfWeilder(player); } @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { - boolean isActive = getActivated(stack); - if(isActive && !player.worldObj.isRemote) - { - OmegaParadigm parad = this.getOmegaParadigmOfWeilder(player); - - if(parad != null && parad.isPlayerWearingFullSet(player)) - { - if(!parad.onBoundSwordLeftClickEntity(stack, player, entity)) - { - return true; - } - } - } + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { + boolean isActive = getActivated(stack); + if (isActive && !player.worldObj.isRemote) { + OmegaParadigm parad = this.getOmegaParadigmOfWeilder(player); + + if (parad != null && parad.isPlayerWearingFullSet(player)) { + if (!parad.onBoundSwordLeftClickEntity(stack, player, entity)) { + return true; + } + } + } return !isActive; } @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { - if (par3EntityLivingBase instanceof EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase) || !EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.getEnergyUsed())) - { - return false; + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + if (par3EntityLivingBase instanceof EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase) + || !EnergyItems.syphonBatteries( + par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.getEnergyUsed())) { + return false; } } @@ -119,18 +106,15 @@ public class EnergySword extends ItemSword } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { this.setActivated(par1ItemStack, !getActivated(par1ItemStack)); par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100); return par1ItemStack; } - if (!getActivated(par1ItemStack)) - { + if (!getActivated(par1ItemStack)) { return par1ItemStack; } @@ -138,33 +122,27 @@ public class EnergySword extends ItemSword } @Override - public int getItemEnchantability() - { + public int getItemEnchantability() { return 30; } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par2World.getWorldTime() % 100 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50)) - { - this.setActivated(par1ItemStack, false); + if (par2World.getWorldTime() % 100 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50)) { + this.setActivated(par1ItemStack, false); } } } @@ -172,68 +150,62 @@ public class EnergySword extends ItemSword par1ItemStack.setItemDamage(0); } - public void setActivated(ItemStack par1ItemStack, boolean newActivated) - { + public void setActivated(ItemStack par1ItemStack, boolean newActivated) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - 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.getTagCompound(); - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } return itemTag.getBoolean("isActive"); } - public float func_82803_g() - { + public float func_82803_g() { return 4.0F; } @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.caution.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.caution.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } } @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; } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnhancedTelepositionFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnhancedTelepositionFocus.java index 165ecda3..8e3a1934 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/EnhancedTelepositionFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/EnhancedTelepositionFocus.java @@ -2,44 +2,40 @@ package WayofTime.alchemicalWizardry.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.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; -import java.util.List; - -public class EnhancedTelepositionFocus extends TelepositionFocus -{ - public EnhancedTelepositionFocus() - { +public class EnhancedTelepositionFocus extends TelepositionFocus { + public EnhancedTelepositionFocus() { super(2); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnhancedTeleposerFocus"); } @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.enhancedtelepfocus.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); + par3List.add( + StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/FireScribeTool.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/FireScribeTool.java index 67420fc2..7c624ff7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/FireScribeTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/FireScribeTool.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class FireScribeTool extends ScribeTool -{ - public FireScribeTool() - { +public class FireScribeTool extends ScribeTool { + public FireScribeTool() { super(2); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:FireScribeTool"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemAlchemyBase.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemAlchemyBase.java index bb60ec62..b793d306 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemAlchemyBase.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemAlchemyBase.java @@ -4,6 +4,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; 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; @@ -16,17 +17,23 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import org.lwjgl.input.Keyboard; -import java.util.List; - -public class ItemAlchemyBase extends Item -{ - private static final String[] ITEM_NAMES = new String[]{"Offensa", "Praesidium", "OrbisTerrae", "StrengthenedCatalyst", "ConcentratedCatalyst", "FracturedBone", "Virtus", "Reductus", "Potentia"}; +public class ItemAlchemyBase extends Item { + private static final String[] ITEM_NAMES = new String[] { + "Offensa", + "Praesidium", + "OrbisTerrae", + "StrengthenedCatalyst", + "ConcentratedCatalyst", + "FracturedBone", + "Virtus", + "Reductus", + "Potentia" + }; @SideOnly(Side.CLIENT) private IIcon[] icons; - public ItemAlchemyBase() - { + public ItemAlchemyBase() { super(); this.maxStackSize = 64; this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -35,70 +42,59 @@ public class ItemAlchemyBase extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[ITEM_NAMES.length]; - for (int i = 0; i < ITEM_NAMES.length; ++i) - { + for (int i = 0; i < ITEM_NAMES.length; ++i) { icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "baseAlchemyItem" + ITEM_NAMES[i]); } } @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.alchemy.usedinalchemy")); - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { + if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack); - if (recipe != null) - { + if (recipe != null) { par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); - for (ItemStack item : recipe) - { - if (item != null) - { + for (ItemStack item : recipe) { + if (item != null) { par3List.add("" + item.getDisplayName()); } } } - } else - { - par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); + } else { + par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return par1ItemStack; } @Override - public String getUnlocalizedName(ItemStack itemStack) - { + public String getUnlocalizedName(ItemStack itemStack) { int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ITEM_NAMES.length - 1); return ("" + "item.bloodMagicAlchemyItem." + ITEM_NAMES[meta]); } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { + public IIcon getIconFromDamage(int meta) { int j = MathHelper.clamp_int(meta, 0, ITEM_NAMES.length - 1); return icons[j]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < ITEM_NAMES.length; ++meta) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { + for (int meta = 0; meta < ITEM_NAMES.length; ++meta) { list.add(new ItemStack(id, 1, meta)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBlockCrystalBelljar.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBlockCrystalBelljar.java index b6452305..1b0c88f1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBlockCrystalBelljar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBlockCrystalBelljar.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -12,27 +13,20 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import java.util.List; - -public class ItemBlockCrystalBelljar extends ItemBlock -{ - public ItemBlockCrystalBelljar(Block par1) - { +public class ItemBlockCrystalBelljar extends ItemBlock { + public ItemBlockCrystalBelljar(Block par1) { super(par1); this.setHasSubtypes(true); this.setMaxDamage(0); this.setMaxStackSize(16); } - public int getMetadata(int par1) - { + public int getMetadata(int par1) { return par1; } - public ReagentContainer[] getReagentContainers(ItemStack stack) - { - if (stack != null && stack.hasTagCompound()) - { + public ReagentContainer[] getReagentContainers(ItemStack stack) { + if (stack != null && stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound(); NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND); @@ -40,8 +34,7 @@ public class ItemBlockCrystalBelljar extends ItemBlock int size = tagList.tagCount(); ReagentContainer[] tanks = new ReagentContainer[size]; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { NBTTagCompound savedTag = tagList.getCompoundTagAt(i); tanks[i] = ReagentContainer.readFromNBT(savedTag); } @@ -52,40 +45,43 @@ public class ItemBlockCrystalBelljar extends ItemBlock } @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { ReagentContainer[] tanks = this.getReagentContainers(stack); - if (tanks == null) - { + if (tanks == null) { list.add(StatCollector.translateToLocal("tooltip.crystalbelljar.empty")); - } else - { + } else { list.add(StatCollector.translateToLocal("tooltip.crystalbelljar.contents")); - for (int i = 0; i < tanks.length; i++) - { - if (tanks[i] == null || tanks[i].getReagent() == null || tanks[i].getReagent().reagent == null) - { + for (int i = 0; i < tanks.length; i++) { + if (tanks[i] == null || tanks[i].getReagent() == null || tanks[i].getReagent().reagent == null) { list.add("- Empty"); - } else - { + } else { ReagentStack reagentStack = tanks[i].getReagent(); - list.add("- " + reagentStack.reagent.name + ": " + reagentStack.amount + "/" + tanks[i].getCapacity() / 1000 + "k AR"); + list.add("- " + reagentStack.reagent.name + ": " + reagentStack.amount + "/" + + tanks[i].getCapacity() / 1000 + "k AR"); } } } } @Override - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) - { - if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) - { + public boolean placeBlockAt( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ, + int metadata) { + if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) { return false; } - if (world.getBlock(x, y, z) == field_150939_a) - { + if (world.getBlock(x, y, z) == field_150939_a) { field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack); field_150939_a.onPostBlockPlaced(world, x, y, z, metadata); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodLetterPack.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodLetterPack.java index dc5354c8..b779c855 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodLetterPack.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodLetterPack.java @@ -1,7 +1,13 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.IAltarManipulator; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +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; @@ -13,168 +19,134 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.IAltarManipulator; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemBloodLetterPack extends ItemArmor implements ArmourUpgrade, IAltarManipulator -{ +public class ItemBloodLetterPack extends ItemArmor implements ArmourUpgrade, IAltarManipulator { @SideOnly(Side.CLIENT) private IIcon plateIcon; - - public int conversionRate = 100; //LP / half heart + + public int conversionRate = 100; // LP / half heart public float activationPoint = 0.5f; public int tickRate = 20; public int maxStored = 10000; - public ItemBloodLetterPack() - { + public ItemBloodLetterPack() { super(ArmorMaterial.CHAIN, 0, 1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodPack"); } @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.bloodletterpack.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { par3List.add(StatCollector.translateToLocal("tooltip.lp.storedlp") + " " + this.getStoredLP(par1ItemStack)); } } - + @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { + public IIcon getIconFromDamage(int par1) { return this.plateIcon; } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { return "alchemicalwizardry:models/armor/bloodPack_layer_1.png"; } - + @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) - { - return super.onItemRightClick(itemStack, world, player); - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + if (movingobjectposition == null) { + return super.onItemRightClick(itemStack, world, player); + } 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; - - if(!altar.isActive()) - { - int amount = this.getStoredLP(itemStack); - if(amount > 0) - { - int filledAmount = altar.fillMainTank(amount); - amount -= filledAmount; - this.setStoredLP(itemStack, amount); - - world.markBlockForUpdate(x, y, z); - } + + TEAltar altar = (TEAltar) tile; + + if (!altar.isActive()) { + int amount = this.getStoredLP(itemStack); + if (amount > 0) { + int filledAmount = altar.fillMainTank(amount); + amount -= filledAmount; + this.setStoredLP(itemStack, amount); + + world.markBlockForUpdate(x, y, z); + } } } } - + return itemStack; } - - public void setStoredLP(ItemStack itemStack, int lp) - { - if(!itemStack.hasTagCompound()) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - NBTTagCompound tag = itemStack.getTagCompound(); - - tag.setInteger("storedLP", lp); + + public void setStoredLP(ItemStack itemStack, int lp) { + if (!itemStack.hasTagCompound()) { + itemStack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = itemStack.getTagCompound(); + + tag.setInteger("storedLP", lp); } - - public int getStoredLP(ItemStack itemStack) - { - if(!itemStack.hasTagCompound()) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - NBTTagCompound tag = itemStack.getTagCompound(); - - return tag.getInteger("storedLP"); - } - - @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) - { - //This is where I need to do the updating - if(world.isRemote) - { - return; - } - - if(world.getWorldTime() % tickRate == 0) - { - boolean shouldExecute = player.getHealth() / player.getMaxHealth() > activationPoint && this.getStoredLP(itemStack) < maxStored; - - if(shouldExecute) - { - SoulNetworkHandler.hurtPlayer(player, 1.0f); - this.setStoredLP(itemStack, Math.min(this.getStoredLP(itemStack) + conversionRate, maxStored)); - } - } + + public int getStoredLP(ItemStack itemStack) { + if (!itemStack.hasTagCompound()) { + itemStack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = itemStack.getTagCompound(); + + return tag.getInteger("storedLP"); } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + // This is where I need to do the updating + if (world.isRemote) { + return; + } + if (world.getWorldTime() % tickRate == 0) { + boolean shouldExecute = player.getHealth() / player.getMaxHealth() > activationPoint + && this.getStoredLP(itemStack) < maxStored; + + if (shouldExecute) { + SoulNetworkHandler.hurtPlayer(player, 1.0f); + this.setStoredLP(itemStack, Math.min(this.getStoredLP(itemStack) + conversionRate, maxStored)); + } + } } @Override - public boolean isUpgrade() - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {} + + @Override + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 0; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodRuneBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodRuneBlock.java index 7932014c..289c28da 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodRuneBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemBloodRuneBlock.java @@ -4,29 +4,22 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemBloodRuneBlock extends ItemBlock -{ - public ItemBloodRuneBlock(Block block) - { +public class ItemBloodRuneBlock extends ItemBlock { + public ItemBloodRuneBlock(Block block) { super(block); setHasSubtypes(true); - } - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { - case 0: - { + switch (itemstack.getItemDamage()) { + case 0: { name = "blank"; break; } - case 1: - { + case 1: { name = "fill"; break; } @@ -42,10 +35,10 @@ public class ItemBloodRuneBlock extends ItemBlock case 4: name = "betterCapacity"; break; - + case 5: - name = "acceleration"; - break; + name = "acceleration"; + break; default: name = "broken"; @@ -54,9 +47,8 @@ public class ItemBloodRuneBlock extends ItemBlock return getUnlocalizedName() + "." + name; } - public int getMetadata(int par1) + public int getMetadata(int par1) { - { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComplexSpellCrystal.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComplexSpellCrystal.java index 3798a1c7..10b3f06f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComplexSpellCrystal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComplexSpellCrystal.java @@ -4,21 +4,18 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock; 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.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -import java.util.List; - -public class ItemComplexSpellCrystal extends EnergyItems -{ - public ItemComplexSpellCrystal() - { +public class ItemComplexSpellCrystal extends EnergyItems { + public ItemComplexSpellCrystal() { super(); this.setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -26,72 +23,62 @@ public class ItemComplexSpellCrystal extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ComplexCrystal"); } @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.complexspellcrystal.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); + par3List.add( + StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { World world = DimensionManager.getWorld(getDimensionID(par1ItemStack)); - if (world != null) - { + if (world != null) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - TileEntity tileEntity = world.getTileEntity(itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord")); + TileEntity tileEntity = world.getTileEntity( + itemTag.getInteger("xCoord"), itemTag.getInteger("yCoord"), itemTag.getInteger("zCoord")); - if (tileEntity instanceof TESpellParadigmBlock) - { + if (tileEntity instanceof TESpellParadigmBlock) { TESpellParadigmBlock tileParad = (TESpellParadigmBlock) tileEntity; tileParad.castSpell(par2World, par3EntityPlayer, par1ItemStack); - } else - { + } else { return par1ItemStack; } - } else - { + } else { return par1ItemStack; } - } else - { + } else { return par1ItemStack; } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); return par1ItemStack; } - public int getDimensionID(ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public int getDimensionID(ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComponents.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComponents.java index 4175c955..cf097efc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComponents.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemComponents.java @@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items; import WayofTime.alchemicalWizardry.AlchemicalWizardry; 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; @@ -12,17 +13,47 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import java.util.List; - -public class ItemComponents extends Item -{ - private static final String[] ITEM_NAMES = new String[]{"QuartzRod", "EmptyCore", "MagicalesCable", "WoodBrace", "StoneBrace", "ProjectileCore", "SelfCore", "MeleeCore", "ParadigmBackPlate", "OutputCable", "FlameCore", "IcyCore", "GustCore", "EarthenCore", "InputCable", "CrackedRunicPlate", "RunicPlate", "ScribedRunicPlate", "DefaultCore", "OffensiveCore", "DefensiveCore", "EnvironmentalCore", "PowerCore", "CostCore", "PotencyCore", "ObsidianBrace", "ToolCore", "EtherealSlate", "LifeShard", "SoulShard", "SoulRunicPlate", "LifeBrace", "EnderShard"}; +public class ItemComponents extends Item { + private static final String[] ITEM_NAMES = new String[] { + "QuartzRod", + "EmptyCore", + "MagicalesCable", + "WoodBrace", + "StoneBrace", + "ProjectileCore", + "SelfCore", + "MeleeCore", + "ParadigmBackPlate", + "OutputCable", + "FlameCore", + "IcyCore", + "GustCore", + "EarthenCore", + "InputCable", + "CrackedRunicPlate", + "RunicPlate", + "ScribedRunicPlate", + "DefaultCore", + "OffensiveCore", + "DefensiveCore", + "EnvironmentalCore", + "PowerCore", + "CostCore", + "PotencyCore", + "ObsidianBrace", + "ToolCore", + "EtherealSlate", + "LifeShard", + "SoulShard", + "SoulRunicPlate", + "LifeBrace", + "EnderShard" + }; @SideOnly(Side.CLIENT) private IIcon[] icons; - public ItemComponents() - { + public ItemComponents() { super(); this.maxStackSize = 64; this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -31,44 +62,37 @@ public class ItemComponents extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[ITEM_NAMES.length]; - for (int i = 0; i < ITEM_NAMES.length; ++i) - { + for (int i = 0; i < ITEM_NAMES.length; ++i) { icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "baseItem" + ITEM_NAMES[i]); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return par1ItemStack; } @Override - public String getUnlocalizedName(ItemStack itemStack) - { - //This is what will do all the localisation things on the alchemy components so you dont have to set it :D + public String getUnlocalizedName(ItemStack itemStack) { + // This is what will do all the localisation things on the alchemy components so you dont have to set it :D int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ITEM_NAMES.length - 1); return ("" + "item.bloodMagicBaseItem." + ITEM_NAMES[meta]); } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { + public IIcon getIconFromDamage(int meta) { int j = MathHelper.clamp_int(meta, 0, ITEM_NAMES.length - 1); return icons[j]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < ITEM_NAMES.length; ++meta) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { + for (int meta = 0; meta < ITEM_NAMES.length; ++meta) { list.add(new ItemStack(id, 1, meta)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemCrystalBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemCrystalBlock.java index 75c7ae92..4c071531 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemCrystalBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemCrystalBlock.java @@ -4,29 +4,22 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemCrystalBlock extends ItemBlock -{ - public ItemCrystalBlock(Block par1) - { +public class ItemCrystalBlock extends ItemBlock { + public ItemCrystalBlock(Block par1) { super(par1); setHasSubtypes(true); - } - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { - case 0: - { + switch (itemstack.getItemDamage()) { + case 0: { name = "fullCrystal"; break; } - case 1: - { + case 1: { name = "crystalBrick"; break; } @@ -38,9 +31,8 @@ public class ItemCrystalBlock extends ItemBlock return getUnlocalizedName() + "." + name; } - public int getMetadata(int par1) + public int getMetadata(int par1) { - { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemDiabloKey.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemDiabloKey.java index 64cf00bd..0c60ccc6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemDiabloKey.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemDiabloKey.java @@ -6,10 +6,10 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; 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; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -17,12 +17,8 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; -import java.util.List; - -public class ItemDiabloKey extends EnergyItems -{ - public ItemDiabloKey() - { +public class ItemDiabloKey extends EnergyItems { + public ItemDiabloKey() { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -32,74 +28,70 @@ public class ItemDiabloKey extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DiabloKey"); } @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.diablokey.desc")); - 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")); } } - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { World world = par3EntityPlayer.worldObj; - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer instanceof FakePlayer) - { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) + || par3EntityPlayer instanceof FakePlayer) { return par1ItemStack; } - if (world != null) - { + if (world != null) { double posX = par3EntityPlayer.posX; double posY = par3EntityPlayer.posY; double posZ = par3EntityPlayer.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); - SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, 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); + SpellHelper.sendIndexedParticleToAllAround( + world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ); } - if (par3EntityPlayer.worldObj.isRemote) - { + if (par3EntityPlayer.worldObj.isRemote) { return par1ItemStack; } - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { return par1ItemStack; } NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null || itemTag.getString("ownerName").equals("")) - { + if (itemTag == null || itemTag.getString("ownerName").equals("")) { return par1ItemStack; } String ownerName = itemTag.getString("ownerName"); ItemStack[] inv = par3EntityPlayer.inventory.mainInventory; - for (ItemStack itemStack : inv) - { - if (itemStack == null) - { + for (ItemStack itemStack : inv) { + if (itemStack == null) { continue; } Item item = itemStack.getItem(); - if (item instanceof ItemDiabloKey) - { + if (item instanceof ItemDiabloKey) { continue; } - if (item instanceof IBindable) - { + if (item instanceof IBindable) { EnergyItems.checkAndSetItemOwner(itemStack, ownerName); } } @@ -110,8 +102,7 @@ public class ItemDiabloKey extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { list.add(new ItemStack(ModItems.itemKeyOfDiablo)); ItemStack boundKey = new ItemStack(ModItems.itemKeyOfDiablo); EnergyItems.checkAndSetItemOwner(boundKey, "Server-wide Soul Network"); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemEnchantmentGlyphBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemEnchantmentGlyphBlock.java index 4dfc459b..6467e769 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemEnchantmentGlyphBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemEnchantmentGlyphBlock.java @@ -4,39 +4,34 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemEnchantmentGlyphBlock extends ItemBlock -{ - public ItemEnchantmentGlyphBlock(Block block) - { +public class ItemEnchantmentGlyphBlock extends ItemBlock { + public ItemEnchantmentGlyphBlock(Block block) { super(block); setHasSubtypes(true); } @Override - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { - case 0: - name = "enchantability"; - break; + switch (itemstack.getItemDamage()) { + case 0: + name = "enchantability"; + break; - case 1: - name = "enchantmentLevel"; - break; + case 1: + name = "enchantmentLevel"; + break; - default: - name = "broken"; + default: + name = "broken"; } return getUnlocalizedName() + "." + name; } @Override - public int getMetadata(int par1) - { + public int getMetadata(int par1) { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemIncense.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemIncense.java index f906c402..cd936061 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemIncense.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemIncense.java @@ -1,7 +1,13 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe; +import WayofTime.alchemicalWizardry.api.sacrifice.IIncense; +import cpw.mods.fml.common.registry.GameRegistry; +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; @@ -13,23 +19,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe; -import WayofTime.alchemicalWizardry.api.sacrifice.IIncense; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemIncense extends Item implements IIncense -{ - private static final String[] ITEM_NAMES = new String[]{"Woodash", "Byrrus", "Livens", "Viridis", "Purpura"}; +public class ItemIncense extends Item implements IIncense { + private static final String[] ITEM_NAMES = new String[] {"Woodash", "Byrrus", "Livens", "Viridis", "Purpura"}; @SideOnly(Side.CLIENT) private IIcon[] icons; - public ItemIncense() - { + public ItemIncense() { super(); this.maxStackSize = 64; this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -38,179 +35,190 @@ public class ItemIncense extends Item implements IIncense @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[ITEM_NAMES.length]; IIcon baseIcon = iconRegister.registerIcon("AlchemicalWizardry:" + "baseIncenseItem"); - - for (int i = 0; i < ITEM_NAMES.length; ++i) - { - if(this.doesIncenseHaveUniqueTexture(i)) - { + + for (int i = 0; i < ITEM_NAMES.length; ++i) { + if (this.doesIncenseHaveUniqueTexture(i)) { icons[i] = iconRegister.registerIcon("AlchemicalWizardry:" + "baseIncenseItem" + ITEM_NAMES[i]); - }else - { - icons[i] = baseIcon; - } + } else { + icons[i] = baseIcon; + } } } @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.alchemy.usedinincense")); } @Override - public String getUnlocalizedName(ItemStack itemStack) - { + public String getUnlocalizedName(ItemStack itemStack) { int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ITEM_NAMES.length - 1); return ("" + "item.bloodMagicIncenseItem." + ITEM_NAMES[meta]); } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { + public IIcon getIconFromDamage(int meta) { int j = MathHelper.clamp_int(meta, 0, ITEM_NAMES.length - 1); return icons[j]; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < ITEM_NAMES.length; ++meta) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { + for (int meta = 0; meta < ITEM_NAMES.length; ++meta) { list.add(new ItemStack(id, 1, meta)); } } - + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - if(!this.doesIncenseHaveUniqueTexture(stack.getItemDamage())) - { - EnumIncense inc = EnumIncense.getEnumForIndex(stack.getItemDamage()); - return (int)((255*inc.redColour * 256 * 256 + 255*inc.greenColour * 256 + 255*inc.blueColour)); - } + public int getColorFromItemStack(ItemStack stack, int pass) { + if (!this.doesIncenseHaveUniqueTexture(stack.getItemDamage())) { + EnumIncense inc = EnumIncense.getEnumForIndex(stack.getItemDamage()); + return (int) ((255 * inc.redColour * 256 * 256 + 255 * inc.greenColour * 256 + 255 * inc.blueColour)); + } return 256 * (256 * 255 + 255) + 255; } - @Override - public int getMinLevel(ItemStack stack) - { - return EnumIncense.getEnumForIndex(stack.getItemDamage()).minValue; - } + @Override + public int getMinLevel(ItemStack stack) { + return EnumIncense.getEnumForIndex(stack.getItemDamage()).minValue; + } - @Override - public int getMaxLevel(ItemStack stack) - { - return EnumIncense.getEnumForIndex(stack.getItemDamage()).maxValue; - } + @Override + public int getMaxLevel(ItemStack stack) { + return EnumIncense.getEnumForIndex(stack.getItemDamage()).maxValue; + } - @Override - public int getIncenseDuration(ItemStack stack) - { - return EnumIncense.getEnumForIndex(stack.getItemDamage()).incenseDuration; - } - - @Override - public float getTickRate(ItemStack stack) - { - return EnumIncense.getEnumForIndex(stack.getItemDamage()).tickRate; - } + @Override + public int getIncenseDuration(ItemStack stack) { + return EnumIncense.getEnumForIndex(stack.getItemDamage()).incenseDuration; + } - @Override - public float getRedColour(ItemStack stack) - { - return EnumIncense.getEnumForIndex(stack.getItemDamage()).redColour; - } + @Override + public float getTickRate(ItemStack stack) { + return EnumIncense.getEnumForIndex(stack.getItemDamage()).tickRate; + } - @Override - public float getGreenColour(ItemStack stack) - { - return EnumIncense.getEnumForIndex(stack.getItemDamage()).greenColour; - } + @Override + public float getRedColour(ItemStack stack) { + return EnumIncense.getEnumForIndex(stack.getItemDamage()).redColour; + } - @Override - public float getBlueColour(ItemStack stack) - { - return EnumIncense.getEnumForIndex(stack.getItemDamage()).blueColour; - } - - public boolean doesIncenseHaveUniqueTexture(int meta) - { - return false; - } - - public static void registerIncenseRecipes() - { - int WILDCARD = OreDictionary.WILDCARD_VALUE; - ItemStack woodStack = new ItemStack(Blocks.log, 1, WILDCARD); - ItemStack charcoalStack = new ItemStack(Items.coal, 1, 1); - ItemStack leavesStack = new ItemStack(Blocks.leaves, 1, WILDCARD); - ItemStack goldNuggetStack = new ItemStack(Items.gold_nugget, 1, WILDCARD); - ItemStack stringStack = new ItemStack(Items.string, 1, WILDCARD); - ItemStack glowstoneStack = new ItemStack(Items.glowstone_dust, 1, WILDCARD); - ItemStack soulSandStack = new ItemStack(Blocks.soul_sand); - ItemStack gunpowderStack = new ItemStack(Items.gunpowder); - ItemStack fermentedEyeStack = new ItemStack(Items.fermented_spider_eye); - ItemStack quartzStack = new ItemStack(Items.quartz, 1, WILDCARD); - ItemStack blazePowderStack = new ItemStack(Items.blaze_powder); - ItemStack netherwartStack = new ItemStack(Items.nether_wart); - ItemStack fracturedBoneStack = new ItemStack(ModItems.baseAlchemyItems, 1, 5); - - ItemStack woodashStack = new ItemStack(ModItems.itemIncense, 1, 0); - - GameRegistry.addRecipe(woodashStack, "WWW", "WCW", "WWW", 'W', woodStack, 'C', charcoalStack); //WOODASH - GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(ModItems.itemIncense, 1, 1), woodashStack, "dyeRed", "dyeRed", new ItemStack(Items.redstone), leavesStack, leavesStack, new ItemStack(ModItems.apprenticeBloodOrb))); - GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(ModItems.itemIncense, 1, 2), woodashStack, "dyeBlue", "dyeBlue", goldNuggetStack, goldNuggetStack, glowstoneStack, stringStack, stringStack, new ItemStack(ModItems.magicianBloodOrb))); - GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(ModItems.itemIncense, 1, 3), woodashStack, "dyeGreen", "dyeGreen", soulSandStack, gunpowderStack, fermentedEyeStack, new ItemStack(ModItems.masterBloodOrb))); - GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(ModItems.itemIncense, 1, 4), woodashStack, "dyePurple", "dyePurple", quartzStack, netherwartStack, blazePowderStack, fracturedBoneStack, goldNuggetStack, new ItemStack(ModItems.archmageBloodOrb))); - } - - public enum EnumIncense - { - WOODASH(0, 200, 1.0f, 1000, 0.937f, 0.898f, 0.820f), - RED(200, 600, 1.5f, 1000, 1.0f, 0, 0), - BLUE(600, 1200, 3.0f, 1000, 0, 0, 1.0f), - GREEN(1200, 2000, 4.0f, 1000, 0, 1.0f, 0), - PURPLE(2000, 3000, 5.0f, 1000, 1.0f, 0, 1.0f); - - public final int minValue; - public final int maxValue; - public final float tickRate; - public final int incenseDuration; - - public final float redColour; - public final float greenColour; - public final float blueColour; - - EnumIncense(int minValue, int maxValue, float tickRate, int dur, float red, float green, float blue) - { - this.minValue = minValue; - this.maxValue = maxValue; - this.tickRate = tickRate; - this.incenseDuration = dur; - - this.redColour = red; - this.greenColour = green; - this.blueColour = blue; - } - - public static EnumIncense getEnumForIndex(int index) - { - if(index > EnumIncense.values().length || index < 0) - { - return WOODASH; - }else - { - return EnumIncense.values()[index]; - } - } - } + @Override + public float getGreenColour(ItemStack stack) { + return EnumIncense.getEnumForIndex(stack.getItemDamage()).greenColour; + } + + @Override + public float getBlueColour(ItemStack stack) { + return EnumIncense.getEnumForIndex(stack.getItemDamage()).blueColour; + } + + public boolean doesIncenseHaveUniqueTexture(int meta) { + return false; + } + + public static void registerIncenseRecipes() { + int WILDCARD = OreDictionary.WILDCARD_VALUE; + ItemStack woodStack = new ItemStack(Blocks.log, 1, WILDCARD); + ItemStack charcoalStack = new ItemStack(Items.coal, 1, 1); + ItemStack leavesStack = new ItemStack(Blocks.leaves, 1, WILDCARD); + ItemStack goldNuggetStack = new ItemStack(Items.gold_nugget, 1, WILDCARD); + ItemStack stringStack = new ItemStack(Items.string, 1, WILDCARD); + ItemStack glowstoneStack = new ItemStack(Items.glowstone_dust, 1, WILDCARD); + ItemStack soulSandStack = new ItemStack(Blocks.soul_sand); + ItemStack gunpowderStack = new ItemStack(Items.gunpowder); + ItemStack fermentedEyeStack = new ItemStack(Items.fermented_spider_eye); + ItemStack quartzStack = new ItemStack(Items.quartz, 1, WILDCARD); + ItemStack blazePowderStack = new ItemStack(Items.blaze_powder); + ItemStack netherwartStack = new ItemStack(Items.nether_wart); + ItemStack fracturedBoneStack = new ItemStack(ModItems.baseAlchemyItems, 1, 5); + + ItemStack woodashStack = new ItemStack(ModItems.itemIncense, 1, 0); + + GameRegistry.addRecipe(woodashStack, "WWW", "WCW", "WWW", 'W', woodStack, 'C', charcoalStack); // WOODASH + GameRegistry.addRecipe(new ShapelessBloodOrbRecipe( + new ItemStack(ModItems.itemIncense, 1, 1), + woodashStack, + "dyeRed", + "dyeRed", + new ItemStack(Items.redstone), + leavesStack, + leavesStack, + new ItemStack(ModItems.apprenticeBloodOrb))); + GameRegistry.addRecipe(new ShapelessBloodOrbRecipe( + new ItemStack(ModItems.itemIncense, 1, 2), + woodashStack, + "dyeBlue", + "dyeBlue", + goldNuggetStack, + goldNuggetStack, + glowstoneStack, + stringStack, + stringStack, + new ItemStack(ModItems.magicianBloodOrb))); + GameRegistry.addRecipe(new ShapelessBloodOrbRecipe( + new ItemStack(ModItems.itemIncense, 1, 3), + woodashStack, + "dyeGreen", + "dyeGreen", + soulSandStack, + gunpowderStack, + fermentedEyeStack, + new ItemStack(ModItems.masterBloodOrb))); + GameRegistry.addRecipe(new ShapelessBloodOrbRecipe( + new ItemStack(ModItems.itemIncense, 1, 4), + woodashStack, + "dyePurple", + "dyePurple", + quartzStack, + netherwartStack, + blazePowderStack, + fracturedBoneStack, + goldNuggetStack, + new ItemStack(ModItems.archmageBloodOrb))); + } + + public enum EnumIncense { + WOODASH(0, 200, 1.0f, 1000, 0.937f, 0.898f, 0.820f), + RED(200, 600, 1.5f, 1000, 1.0f, 0, 0), + BLUE(600, 1200, 3.0f, 1000, 0, 0, 1.0f), + GREEN(1200, 2000, 4.0f, 1000, 0, 1.0f, 0), + PURPLE(2000, 3000, 5.0f, 1000, 1.0f, 0, 1.0f); + + public final int minValue; + public final int maxValue; + public final float tickRate; + public final int incenseDuration; + + public final float redColour; + public final float greenColour; + public final float blueColour; + + EnumIncense(int minValue, int maxValue, float tickRate, int dur, float red, float green, float blue) { + this.minValue = minValue; + this.maxValue = maxValue; + this.tickRate = tickRate; + this.incenseDuration = dur; + + this.redColour = red; + this.greenColour = green; + this.blueColour = blue; + } + + public static EnumIncense getEnumForIndex(int index) { + if (index > EnumIncense.values().length || index < 0) { + return WOODASH; + } else { + return EnumIncense.values()[index]; + } + } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemMailOrderCatalogue.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemMailOrderCatalogue.java index 2e2e07e7..b919fbeb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemMailOrderCatalogue.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemMailOrderCatalogue.java @@ -1,39 +1,34 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.entity.mob.MailOrderEntityItem; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.mob.MailOrderEntityItem; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemMailOrderCatalogue extends Item -{ - public ItemMailOrderCatalogue() - { - super(); - this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); - } - - @Override +public class ItemMailOrderCatalogue extends Item { + public ItemMailOrderCatalogue() { + super(); + this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); + } + + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MailOrder"); } - - @Override - public boolean hasCustomEntity(ItemStack stack) - { - return true; - } - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) - { - return new MailOrderEntityItem(world, location, itemstack); - } + @Override + public boolean hasCustomEntity(ItemStack stack) { + return true; + } + + @Override + public Entity createEntity(World world, Entity location, ItemStack itemstack) { + return new MailOrderEntityItem(world, location, itemstack); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDismantler.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDismantler.java index d1ca42ce..b14e7152 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDismantler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDismantler.java @@ -8,6 +8,7 @@ import WayofTime.alchemicalWizardry.common.block.RitualStone; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; 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.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -16,12 +17,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class ItemRitualDismantler extends EnergyItems -{ - public ItemRitualDismantler() - { +public class ItemRitualDismantler extends EnergyItems { + public ItemRitualDismantler() { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -29,55 +26,60 @@ public class ItemRitualDismantler extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ritual_dismantler"); } @Override - public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x) - { + public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x) { par3List.add(StatCollector.translateToLocal("tooltip.dismatler.desc")); - if(stack.hasTagCompound()) - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + stack.getTagCompound().getString("ownerName")); + if (stack.hasTagCompound()) + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + stack.getTagCompound().getString("ownerName")); } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) - { - return EnergyItems.checkAndSetItemOwner(stack, player) && breakRitualStoneAtMasterStone(stack, player, world, x, y, z); + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int par7, + float par8, + float par9, + float par10) { + return EnergyItems.checkAndSetItemOwner(stack, player) + && breakRitualStoneAtMasterStone(stack, player, world, x, y, z); } - public boolean breakRitualStoneAtMasterStone(ItemStack stack, EntityPlayer player, World world, int x, int y, int z) - { + public boolean breakRitualStoneAtMasterStone( + ItemStack stack, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof TEMasterStone) - { + if (tileEntity instanceof TEMasterStone) { TEMasterStone masterStone = (TEMasterStone) tileEntity; int direction = masterStone.getDirection(); String ritualName = Rituals.checkValidRitual(world, x, y, z); List ritualList = Rituals.getRitualList(ritualName); - if (ritualList == null) - { + if (ritualList == null) { return false; } - for (RitualComponent rc : ritualList) - { - if (!world.isAirBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)) && world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)) instanceof RitualStone) - { - if (EnergyItems.syphonBatteries(stack, player, getEnergyUsed()) || player.capabilities.isCreativeMode) - { + for (RitualComponent rc : ritualList) { + if (!world.isAirBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)) + && world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)) + instanceof RitualStone) { + if (EnergyItems.syphonBatteries(stack, player, getEnergyUsed()) + || player.capabilities.isCreativeMode) { world.setBlockToAir(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); - EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(ModBlocks.ritualStone)); - if (world.isRemote) - { + EntityItem entityItem = new EntityItem( + world, player.posX, player.posY, player.posZ, new ItemStack(ModBlocks.ritualStone)); + if (world.isRemote) { world.playAuxSFX(2005, x, y + 1, z, 0); - } - else - { + } else { world.spawnEntityInWorld(entityItem); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java index 9ea41cfb..66ea9fca 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java @@ -1,7 +1,17 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.Int3; +import WayofTime.alchemicalWizardry.api.items.interfaces.IRitualDiviner; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import WayofTime.alchemicalWizardry.api.rituals.IRitualStone; +import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; +import WayofTime.alchemicalWizardry.api.rituals.Rituals; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -17,27 +27,12 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; import net.minecraft.util.StatCollector; import net.minecraft.world.World; - import org.lwjgl.input.Keyboard; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.api.items.interfaces.IRitualDiviner; -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -import WayofTime.alchemicalWizardry.api.rituals.IRitualStone; -import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; -import WayofTime.alchemicalWizardry.api.rituals.Rituals; -import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner -{ +public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner { private int maxMetaData; - public ItemRitualDiviner() - { + public ItemRitualDiviner() { super(); this.maxStackSize = 1; setEnergyUsed(100); @@ -48,43 +43,37 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:RitualDiviner"); } @Override - public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x) - { + public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x) { par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.desc")); - if (this.getMaxRuneDisplacement(stack) == 1) - { + if (this.getMaxRuneDisplacement(stack) == 1) { par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplace")); - }else if (this.getMaxRuneDisplacement(stack) >= 2) - { + } else if (this.getMaxRuneDisplacement(stack) >= 2) { par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplacedawn")); - }else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.cannotplace")); } - - par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(stack))); + + par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + + this.getNameForDirection(this.getDirection(stack))); boolean sneaking = Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT); - - if(sneaking) - { - if (!(stack.getTagCompound() == null)) - { + + if (sneaking) { + if (!(stack.getTagCompound() == null)) { String ritualID = this.getCurrentRitual(stack); - //TODO - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + stack.getTagCompound().getString("ownerName")); + // TODO + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + stack.getTagCompound().getString("ownerName")); par3List.add(StatCollector.translateToLocal("tooltip.alchemy.ritualid") + " " + ritualID); List ritualList = Rituals.getRitualList(this.getCurrentRitual(stack)); - if (ritualList == null) - { + if (ritualList == null) { return; } @@ -96,10 +85,8 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner int duskStones = 0; int dawnStones = 0; - for (RitualComponent rc : ritualList) - { - switch (rc.getStoneType()) - { + for (RitualComponent rc : ritualList) { + switch (rc.getStoneType()) { case RitualComponent.BLANK: blankStones++; break; @@ -123,157 +110,166 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner case RitualComponent.DUSK: duskStones++; break; - + case RitualComponent.DAWN: - dawnStones++; - break; + dawnStones++; + break; } } - int totalStones = blankStones + airStones + waterStones + fireStones + earthStones + duskStones + dawnStones; + int totalStones = + blankStones + airStones + waterStones + fireStones + earthStones + duskStones + dawnStones; - par3List.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.ritualdiviner.blankstones") + " " + blankStones); - par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.ritualdiviner.airstones") + " " + airStones); - par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.ritualdiviner.waterstones") + " " + waterStones); - par3List.add(EnumChatFormatting.RED + StatCollector.translateToLocal("tooltip.ritualdiviner.firestones") + " " + fireStones); - par3List.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocal("tooltip.ritualdiviner.earthstones") + " " + earthStones); - par3List.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tooltip.ritualdiviner.duskstones") + " " + duskStones); - par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.ritualdiviner.dawnstones") + " " + dawnStones); - par3List.add(EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal("tooltip.ritualdiviner.totalStones") + " " + totalStones); + par3List.add(EnumChatFormatting.WHITE + + StatCollector.translateToLocal("tooltip.ritualdiviner.blankstones") + " " + blankStones); + par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.ritualdiviner.airstones") + + " " + airStones); + par3List.add(EnumChatFormatting.BLUE + + StatCollector.translateToLocal("tooltip.ritualdiviner.waterstones") + " " + waterStones); + par3List.add(EnumChatFormatting.RED + StatCollector.translateToLocal("tooltip.ritualdiviner.firestones") + + " " + fireStones); + par3List.add(EnumChatFormatting.DARK_GREEN + + StatCollector.translateToLocal("tooltip.ritualdiviner.earthstones") + " " + earthStones); + par3List.add(EnumChatFormatting.DARK_PURPLE + + StatCollector.translateToLocal("tooltip.ritualdiviner.duskstones") + " " + duskStones); + par3List.add(EnumChatFormatting.GOLD + + StatCollector.translateToLocal("tooltip.ritualdiviner.dawnstones") + " " + dawnStones); + par3List.add(EnumChatFormatting.UNDERLINE + + StatCollector.translateToLocal("tooltip.ritualdiviner.totalStones") + " " + totalStones); } - }else - { - par3List.add(EnumChatFormatting.AQUA + "-" + StatCollector.translateToLocal("tooltip.ritualdiviner.moreinfo") + "-"); + } else { + par3List.add(EnumChatFormatting.AQUA + "-" + + StatCollector.translateToLocal("tooltip.ritualdiviner.moreinfo") + "-"); } - } @Override - public String getItemStackDisplayName(ItemStack stack) - { - if (!(stack.getTagCompound() == null)) - { + public String getItemStackDisplayName(ItemStack stack) { + if (!(stack.getTagCompound() == null)) { String ritualID = this.getCurrentRitual(stack); - if (ritualID.equals("")) - { + if (ritualID.equals("")) { return super.getItemStackDisplayName(stack); } - return StatCollector.translateToLocalFormatted("bm.string.ritualDiviner", Rituals.getLocalizedNameOfRitual(ritualID)); - } else - { + return StatCollector.translateToLocalFormatted( + "bm.string.ritualDiviner", Rituals.getLocalizedNameOfRitual(ritualID)); + } else { return super.getItemStackDisplayName(stack); } } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int par7, + float par8, + float par9, + float par10) { if (!EnergyItems.checkAndSetItemOwner(stack, player)) return false; - if(placeRitualStoneAtMasterStone(stack, player, world, x, y, z)) - { - this.setStoredLocation(stack, new Int3(x, y, z)); - return true; - }else if(!(world.getBlock(x, y, z) instanceof IRitualStone || world.getBlock(x, y, z) instanceof IMasterRitualStone) && !player.isSneaking()) - { - if(world.isRemote) - { - return false; - } - this.cycleDirection(stack); - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(stack)))); + if (placeRitualStoneAtMasterStone(stack, player, world, x, y, z)) { + this.setStoredLocation(stack, new Int3(x, y, z)); + return true; + } else if (!(world.getBlock(x, y, z) instanceof IRitualStone + || world.getBlock(x, y, z) instanceof IMasterRitualStone) + && !player.isSneaking()) { + if (world.isRemote) { + return false; + } + this.cycleDirection(stack); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + + this.getNameForDirection(this.getDirection(stack)))); return true; } - + return false; } - - public boolean placeRitualStoneAtMasterStone(ItemStack stack, EntityPlayer player, World world, int x, int y, int z) - { - int direction = this.getDirection(stack); - ItemStack[] playerInventory = player.inventory.mainInventory; + public boolean placeRitualStoneAtMasterStone( + ItemStack stack, EntityPlayer player, World world, int x, int y, int z) { + int direction = this.getDirection(stack); + + ItemStack[] playerInventory = player.inventory.mainInventory; TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof TEMasterStone) - { + if (tileEntity instanceof TEMasterStone) { List ritualList = Rituals.getRitualList(this.getCurrentRitual(stack)); - if (ritualList == null) - { + if (ritualList == null) { return false; } int playerInvRitualStoneLocation = -1; - for (int i = 0; i < playerInventory.length; i++) - { - if (playerInventory[i] == null) - { + for (int i = 0; i < playerInventory.length; i++) { + if (playerInventory[i] == null) { continue; } - if (new ItemStack(ModBlocks.ritualStone).isItemEqual(playerInventory[i])) - { + if (new ItemStack(ModBlocks.ritualStone).isItemEqual(playerInventory[i])) { playerInvRitualStoneLocation = i; break; } } - for (RitualComponent rc : ritualList) - { - if (world.isAirBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction))) - { - if (playerInvRitualStoneLocation >= 0 || player.capabilities.isCreativeMode) - { - if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack)) - { + for (RitualComponent rc : ritualList) { + if (world.isAirBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction))) { + if (playerInvRitualStoneLocation >= 0 || player.capabilities.isCreativeMode) { + if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack)) { world.playAuxSFX(200, x, y + 1, z, 0); return true; } - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { player.inventory.decrStackSize(playerInvRitualStoneLocation, 1); } - if(EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { - world.setBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction), ModBlocks.ritualStone, rc.getStoneType(), 3); + if (EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { + world.setBlock( + x + rc.getX(direction), + y + rc.getY(), + z + rc.getZ(direction), + ModBlocks.ritualStone, + rc.getStoneType(), + 3); - if (world.isRemote) - { + if (world.isRemote) { world.playAuxSFX(2005, x, y + 1, z, 0); - + return true; } } return true; } - } else - { + } else { Block block = world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); - if (block == ModBlocks.ritualStone) - { - int metadata = world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); + if (block == ModBlocks.ritualStone) { + int metadata = + world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); - if (metadata != rc.getStoneType()) - { - if(EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { - if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack)) - { - world.playAuxSFX(200, x, y + 1, z, 0); - return true; - } - - world.setBlockMetadataWithNotify(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction), rc.getStoneType(), 3); - return true; - } + if (metadata != rc.getStoneType()) { + if (EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { + if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack)) { + world.playAuxSFX(200, x, y + 1, z, 0); + return true; + } + + world.setBlockMetadataWithNotify( + x + rc.getX(direction), + y + rc.getY(), + z + rc.getZ(direction), + rc.getStoneType(), + 3); + return true; + } } - } else - { + } else { world.playAuxSFX(0, x, y + 1, z, 0); return true; } @@ -285,143 +281,127 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner } @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) - { - if(entity instanceof EntityPlayer && hasStoredLocation(stack) && world.getWorldTime() % 5 == 0) - { - Int3 loc = getStoredLocation(stack); - - int x = loc.xCoord; - int y = loc.yCoord; - int z = loc.zCoord; - - if(!this.placeRitualStoneAtMasterStone(stack, (EntityPlayer)entity, world, x, y, z)) - { - this.voidStoredLocation(stack); - } - } + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { + if (entity instanceof EntityPlayer && hasStoredLocation(stack) && world.getWorldTime() % 5 == 0) { + Int3 loc = getStoredLocation(stack); + + int x = loc.xCoord; + int y = loc.yCoord; + int z = loc.zCoord; + + if (!this.placeRitualStoneAtMasterStone(stack, (EntityPlayer) entity, world, x, y, z)) { + this.voidStoredLocation(stack); + } + } } - - public void setStoredLocation(ItemStack stack, Int3 location) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - NBTTagCompound locTag = location.writeToNBT(new NBTTagCompound()); - locTag.setBoolean("isStored", true); - - tag.setTag("location", locTag); + + public void setStoredLocation(ItemStack stack, Int3 location) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + NBTTagCompound locTag = location.writeToNBT(new NBTTagCompound()); + locTag.setBoolean("isStored", true); + + tag.setTag("location", locTag); } - - public void voidStoredLocation(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null || !tag.hasKey("location")) - { -// tag = new NBTTagCompound(); -// stack.setTagCompound(tag); - this.setStoredLocation(stack, new Int3(0,0,0)); - return; - } - - NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location"); - if(locTag != null) - { - locTag.setBoolean("isStored", false); - } + + public void voidStoredLocation(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null || !tag.hasKey("location")) { + // tag = new NBTTagCompound(); + // stack.setTagCompound(tag); + this.setStoredLocation(stack, new Int3(0, 0, 0)); + return; + } + + NBTTagCompound locTag = (NBTTagCompound) tag.getTag("location"); + if (locTag != null) { + locTag.setBoolean("isStored", false); + } } - - public Int3 getStoredLocation(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null || !tag.hasKey("location")) - { - return new Int3(0, 0, 0); - } - - NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location"); - - return Int3.readFromNBT(locTag); + + public Int3 getStoredLocation(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null || !tag.hasKey("location")) { + return new Int3(0, 0, 0); + } + + NBTTagCompound locTag = (NBTTagCompound) tag.getTag("location"); + + return Int3.readFromNBT(locTag); } - - public boolean hasStoredLocation(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null || !tag.hasKey("location")) - { - return false; - } - - NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location"); - - return locTag.getBoolean("isStored"); + + public boolean hasStoredLocation(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null || !tag.hasKey("location")) { + return false; + } + + NBTTagCompound locTag = (NBTTagCompound) tag.getTag("location"); + + return locTag.getBoolean("isStored"); } @Override - public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) - { - rotateRituals(par2World,par3EntityPlayer, stack, true); + public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) { + rotateRituals(par2World, par3EntityPlayer, stack, true); } return stack; } @Override - public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) - { - if (entityLiving instanceof EntityPlayer) - { + public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { + if (entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityLiving; - if (!EnergyItems.checkAndSetItemOwner(stack,player)) return true; + if (!EnergyItems.checkAndSetItemOwner(stack, player)) return true; - if (!player.isSwingInProgress) - { - if (player.isSneaking()) - { + if (!player.isSwingInProgress) { + if (player.isSneaking()) { rotateRituals(player.worldObj, player, stack, false); } -// else -// { -// if (!player.worldObj.isRemote) -// { -// int direction = this.getDirection(stack) - 1; -// if (direction == 0) direction = 4; -// this.setDirection(stack, direction); -// player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(direction))); -// } -// } + // else + // { + // if (!player.worldObj.isRemote) + // { + // int direction = this.getDirection(stack) - 1; + // if (direction == 0) direction = 4; + // this.setDirection(stack, direction); + // player.addChatComponentMessage(new + // ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + + // this.getNameForDirection(direction))); + // } + // } } } return false; } - public void rotateRituals(World world, EntityPlayer player, ItemStack stack, boolean next) - { - this.voidStoredLocation(stack); + public void rotateRituals(World world, EntityPlayer player, ItemStack stack, boolean next) { + this.voidStoredLocation(stack); String currentRitualID = this.getCurrentRitual(stack); - this.setCurrentRitual(stack, next? Rituals.getNextRitualKey(currentRitualID):Rituals.getPreviousRitualKey(currentRitualID)); + this.setCurrentRitual( + stack, + next ? Rituals.getNextRitualKey(currentRitualID) : Rituals.getPreviousRitualKey(currentRitualID)); - if (world.isRemote) - { - IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getLocalizedNameOfRitual(this.getCurrentRitual(stack))); + if (world.isRemote) { + IChatComponent chatmessagecomponent = + new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + + Rituals.getLocalizedNameOfRitual(this.getCurrentRitual(stack))); player.addChatComponentMessage(chatmessagecomponent); } } @Override - public String getCurrentRitual(ItemStack stack) - { - if (stack.getTagCompound() == null) - { + public String getCurrentRitual(ItemStack stack) { + if (stack.getTagCompound() == null) { stack.setTagCompound(new NBTTagCompound()); } @@ -429,10 +409,8 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner } @Override - public void setCurrentRitual(ItemStack stack, String ritualID) - { - if (stack.getTagCompound() == null) - { + public void setCurrentRitual(ItemStack stack, String ritualID) { + if (stack.getTagCompound() == null) { stack.setTagCompound(new NBTTagCompound()); } @@ -440,93 +418,83 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner } @Override - public int getMaxRuneDisplacement(ItemStack stack) //0 indicates the starting 4 runes, 1 indicates it can use Dusk runes - { + public int getMaxRuneDisplacement( + ItemStack stack) // 0 indicates the starting 4 runes, 1 indicates it can use Dusk runes + { return stack.getItemDamage(); } @Override - public void setMaxRuneDisplacement(ItemStack stack, int displacement) - { + public void setMaxRuneDisplacement(ItemStack stack, int displacement) { stack.setItemDamage(displacement); } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { list.add(new ItemStack(id)); - + ItemStack duskRitualDivinerStack = new ItemStack(id); this.setMaxRuneDisplacement(duskRitualDivinerStack, 1); list.add(duskRitualDivinerStack); - + ItemStack dawnRitualDivinerStack = new ItemStack(id); this.setMaxRuneDisplacement(dawnRitualDivinerStack, 2); list.add(dawnRitualDivinerStack); } - + @Override - public int getDirection(ItemStack itemStack) - { - if(itemStack.getTagCompound() == null) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - return itemStack.getTagCompound().getInteger("direction"); + public int getDirection(ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + + return itemStack.getTagCompound().getInteger("direction"); } - + @Override - public void setDirection(ItemStack itemStack, int direction) - { - if(itemStack.getTagCompound() == null) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - itemStack.getTagCompound().setInteger("direction", direction); + public void setDirection(ItemStack itemStack, int direction) { + if (itemStack.getTagCompound() == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + + itemStack.getTagCompound().setInteger("direction", direction); } - + @Override - public int cycleDirection(ItemStack itemStack) - { - this.voidStoredLocation(itemStack); - int direction = this.getDirection(itemStack); - - if(direction < 4) - { - direction = Math.max(1, direction + 1); - }else - { - direction = 1; - } - - this.setDirection(itemStack, direction); - - return direction; + public int cycleDirection(ItemStack itemStack) { + this.voidStoredLocation(itemStack); + int direction = this.getDirection(itemStack); + + if (direction < 4) { + direction = Math.max(1, direction + 1); + } else { + direction = 1; + } + + this.setDirection(itemStack, direction); + + return direction; } - + @Override - public String getNameForDirection(int direction) - { - String dir = ""; - switch(direction) - { - case 0: - case 1: - dir = StatCollector.translateToLocal("message.ritual.side.north"); - break; - case 2: - dir = StatCollector.translateToLocal("message.ritual.side.east"); - break; - case 3: - dir = StatCollector.translateToLocal("message.ritual.side.south"); - break; - case 4: - dir = StatCollector.translateToLocal("message.ritual.side.west"); - } - - return dir; + public String getNameForDirection(int direction) { + String dir = ""; + switch (direction) { + case 0: + case 1: + dir = StatCollector.translateToLocal("message.ritual.side.north"); + break; + case 2: + dir = StatCollector.translateToLocal("message.ritual.side.east"); + break; + case 3: + dir = StatCollector.translateToLocal("message.ritual.side.south"); + break; + case 4: + dir = StatCollector.translateToLocal("message.ritual.side.west"); + } + + return dir; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEffectBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEffectBlock.java index e9ec4502..89391527 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEffectBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEffectBlock.java @@ -4,28 +4,22 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemSpellEffectBlock extends ItemBlock -{ - public ItemSpellEffectBlock(Block par1) - { +public class ItemSpellEffectBlock extends ItemBlock { + public ItemSpellEffectBlock(Block par1) { super(par1); setHasSubtypes(true); } - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { - case 0: - { + switch (itemstack.getItemDamage()) { + case 0: { name = "fire"; break; } - case 1: - { + case 1: { name = "ice"; break; } @@ -45,9 +39,8 @@ public class ItemSpellEffectBlock extends ItemBlock return getUnlocalizedName() + "." + name; } - public int getMetadata(int par1) + public int getMetadata(int par1) { - { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEnhancementBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEnhancementBlock.java index 5c515c3f..3c466f0e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEnhancementBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellEnhancementBlock.java @@ -4,21 +4,16 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemSpellEnhancementBlock extends ItemBlock -{ - public ItemSpellEnhancementBlock(Block par1) - { +public class ItemSpellEnhancementBlock extends ItemBlock { + public ItemSpellEnhancementBlock(Block par1) { super(par1); setHasSubtypes(true); - } - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { + switch (itemstack.getItemDamage()) { case 0: name = "power1"; break; @@ -86,9 +81,8 @@ public class ItemSpellEnhancementBlock extends ItemBlock return getUnlocalizedName() + "." + name; } - public int getMetadata(int par1) + public int getMetadata(int par1) { - { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellModifierBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellModifierBlock.java index 44e02d7b..01a34b7a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellModifierBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellModifierBlock.java @@ -4,29 +4,22 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemSpellModifierBlock extends ItemBlock -{ - public ItemSpellModifierBlock(Block par1) - { +public class ItemSpellModifierBlock extends ItemBlock { + public ItemSpellModifierBlock(Block par1) { super(par1); setHasSubtypes(true); - } - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { - case 0: - { + switch (itemstack.getItemDamage()) { + case 0: { name = "default"; break; } - case 1: - { + case 1: { name = "offensive"; break; } @@ -46,9 +39,8 @@ public class ItemSpellModifierBlock extends ItemBlock return getUnlocalizedName() + "." + name; } - public int getMetadata(int par1) + public int getMetadata(int par1) { - { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellParadigmBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellParadigmBlock.java index 2984cdb7..aa955d1f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellParadigmBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemSpellParadigmBlock.java @@ -4,29 +4,23 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemSpellParadigmBlock extends ItemBlock -{ - public ItemSpellParadigmBlock(Block par1) - { +public class ItemSpellParadigmBlock extends ItemBlock { + public ItemSpellParadigmBlock(Block par1) { super(par1); setHasSubtypes(true); } @Override - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { - case 0: - { + switch (itemstack.getItemDamage()) { + case 0: { name = "projectile"; break; } - case 1: - { + case 1: { name = "self"; break; } @@ -47,8 +41,7 @@ public class ItemSpellParadigmBlock extends ItemBlock } @Override - public int getMetadata(int par1) - { + public int getMetadata(int par1) { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemStabilityGlyphBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemStabilityGlyphBlock.java index 289fe3ec..01eea323 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemStabilityGlyphBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemStabilityGlyphBlock.java @@ -4,35 +4,30 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemStabilityGlyphBlock extends ItemBlock -{ - public ItemStabilityGlyphBlock(Block block) - { +public class ItemStabilityGlyphBlock extends ItemBlock { + public ItemStabilityGlyphBlock(Block block) { super(block); setHasSubtypes(true); } @Override - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { String name; - switch (itemstack.getItemDamage()) - { - case 0: - name = "stability1"; - break; + switch (itemstack.getItemDamage()) { + case 0: + name = "stability1"; + break; - default: - name = "broken"; + default: + name = "broken"; } return getUnlocalizedName() + "." + name; } @Override - public int getMetadata(int par1) - { + public int getMetadata(int par1) { return par1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/LavaCrystal.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/LavaCrystal.java index eec96479..dce7ec45 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/LavaCrystal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/LavaCrystal.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; +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.ItemStack; @@ -10,15 +13,9 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraftforge.common.DimensionManager; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class LavaCrystal extends EnergyItems -{ - public LavaCrystal() - { +public class LavaCrystal extends EnergyItems { + public LavaCrystal() { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -28,8 +25,7 @@ public class LavaCrystal extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:LavaCrystal"); } @@ -37,8 +33,7 @@ public class LavaCrystal extends EnergyItems * Used to have the item contain itself. */ @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { { syphonWhileInContainer(itemStack, this.getEnergyUsed()); ItemStack copiedStack = itemStack.copy(); @@ -49,57 +44,49 @@ public class LavaCrystal extends EnergyItems } @Override - public boolean hasContainerItem() - { + public boolean hasContainerItem() { return true; } - 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 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.lavacrystal.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.lavacrystal.desc2")); - 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")); } } - public boolean hasEnoughEssence(ItemStack itemStack) - { - if (itemStack.getTagCompound() != null && !(itemStack.getTagCompound().getString("ownerName").equals(""))) - { + public boolean hasEnoughEssence(ItemStack itemStack) { + if (itemStack.getTagCompound() != null + && !(itemStack.getTagCompound().getString("ownerName").equals(""))) { String ownerName = itemStack.getTagCompound().getString("ownerName"); - if (MinecraftServer.getServer() == null) - { + if (MinecraftServer.getServer() == null) { return false; } -// World world = MinecraftServer.getServer().worldServers[0]; + // World world = MinecraftServer.getServer().worldServers[0]; WorldProvider provider = DimensionManager.getProvider(0); - if(provider == null || provider.worldObj == null) - { - return false; + if (provider == null || provider.worldObj == null) { + return false; } World world = provider.worldObj; LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - if (data == null) - { + if (data == null) { data = new LifeEssenceNetwork(ownerName); world.setItemData(ownerName, data); } - if (data.currentEssence >= this.getEnergyUsed()) - { + if (data.currentEssence >= this.getEnergyUsed()) { return true; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/LifeBucket.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/LifeBucket.java index daaec1d1..8450fd0f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/LifeBucket.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/LifeBucket.java @@ -6,17 +6,14 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemBucket; -public class LifeBucket extends ItemBucket -{ - public LifeBucket(Block block) - { +public class LifeBucket extends ItemBucket { + public LifeBucket(Block block) { super(block); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:LifeBucket"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/MagicianBloodOrb.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/MagicianBloodOrb.java index 737760e4..e83e0b96 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/MagicianBloodOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/MagicianBloodOrb.java @@ -4,18 +4,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class MagicianBloodOrb extends EnergyBattery -{ - public MagicianBloodOrb(int damage) - { +public class MagicianBloodOrb extends EnergyBattery { + public MagicianBloodOrb(int damage) { super(damage); orbLevel = 3; } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MagicianBloodOrb"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/MasterBloodOrb.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/MasterBloodOrb.java index e82a160d..681ce433 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/MasterBloodOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/MasterBloodOrb.java @@ -4,18 +4,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class MasterBloodOrb extends EnergyBattery -{ - public MasterBloodOrb(int damage) - { +public class MasterBloodOrb extends EnergyBattery { + public MasterBloodOrb(int damage) { super(damage); orbLevel = 4; } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterBloodOrb"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/OrbOfTesting.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/OrbOfTesting.java index 4cd07069..a6a9030d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/OrbOfTesting.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/OrbOfTesting.java @@ -8,10 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class OrbOfTesting extends EnergyItems -{ - public OrbOfTesting() - { +public class OrbOfTesting extends EnergyItems { + public OrbOfTesting() { super(); setMaxStackSize(1); setCreativeTab(CreativeTabs.tabMisc); @@ -23,20 +21,16 @@ public class OrbOfTesting extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Untitled"); } - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!par3EntityPlayer.shouldHeal()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!par3EntityPlayer.shouldHeal()) { return par1ItemStack; } - if (syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) - { + if (syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) { par3EntityPlayer.heal(1); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ReinforcedTelepositionFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ReinforcedTelepositionFocus.java index 8d83eb3f..e41e8ce0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ReinforcedTelepositionFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ReinforcedTelepositionFocus.java @@ -2,45 +2,41 @@ package WayofTime.alchemicalWizardry.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.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; -import java.util.List; - -public class ReinforcedTelepositionFocus extends TelepositionFocus -{ - public ReinforcedTelepositionFocus() - { +public class ReinforcedTelepositionFocus extends TelepositionFocus { + public ReinforcedTelepositionFocus() { super(3); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ReinforcedTeleposerFocus"); } @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.reinforcedtelepfocus.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.reinforcedtelepfocus.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); + par3List.add( + StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java index 42bb942f..53674e46 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java @@ -1,7 +1,13 @@ package WayofTime.alchemicalWizardry.common.items; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.event.SacrificeKnifeUsedEvent; +import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler; +import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +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; @@ -15,18 +21,9 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.event.SacrificeKnifeUsedEvent; -import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler; -import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SacrificialDagger extends Item -{ - public SacrificialDagger() - { +public class SacrificialDagger extends Item { + public SacrificialDagger() { super(); this.maxStackSize = 1; setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -35,25 +32,19 @@ public class SacrificialDagger 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("AlchemicalWizardry:SheathedItem"); - } else - { + } else { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SacrificialDagger"); } } @Override - public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - if (AlchemicalWizardry.wimpySettings) - { + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if (AlchemicalWizardry.wimpySettings) { par3List.add(StatCollector.translateToLocal("tooltip.sacrificialdagger.desc1")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sacrificialdagger.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.sacrificialdagger.desc3")); } @@ -63,19 +54,17 @@ public class SacrificialDagger extends Item * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount */ @Override - public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) - { -// if(itemInUseCount < 32) -// { -// return; -// } + public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) { + // if(itemInUseCount < 32) + // { + // return; + // } PlayerSacrificeHandler.sacrificePlayerHealth(player); } @Override - public int getMaxItemUseDuration(ItemStack stack) - { + public int getMaxItemUseDuration(ItemStack stack) { return 72000; } @@ -83,88 +72,86 @@ public class SacrificialDagger extends Item * returns the action that specifies what animation to play when the items is being used */ @Override - public EnumAction getItemUseAction(ItemStack stack) - { + public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.bow; } @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) - { - SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2); - if(MinecraftForge.EVENT_BUS.post(evt)) - { - return stack; - } + if (!player.capabilities.isCreativeMode) { + SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2); + if (MinecraftForge.EVENT_BUS.post(evt)) { + return stack; + } - if(evt.shouldDrainHealth) - { + if (evt.shouldDrainHealth) { player.setHealth(player.getHealth() - 2); - } + } - if(!evt.shouldFillAltar) - { - return stack; - } + 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, AlchemicalWizardry.lpPerSelfSacrificeSoulFray); - } else - { + } else { findAndFillAltar(world, player, AlchemicalWizardry.lpPerSelfSacrifice); } - if (player.getHealth() <= 0.001f) - { + if (player.getHealth() <= 0.001f) { player.onDeath(DamageSource.generic); } return stack; } - 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; } @@ -172,21 +159,16 @@ public class SacrificialDagger 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) - { - return (IBloodAltar)tileEntity; + if (tileEntity instanceof IBloodAltar) { + return (IBloodAltar) tileEntity; } } } @@ -196,52 +178,43 @@ public class SacrificialDagger 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 "Sacrificial Orb"; } return super.getItemStackDisplayName(stack); } - public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player) - { - return !world.isRemote && (PlayerSacrificeHandler.getPlayerIncense(player) > 0); + public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player) { + return !world.isRemote && (PlayerSacrificeHandler.getPlayerIncense(player) > 0); } - public boolean canUseForSacrifice(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); + public boolean canUseForSacrifice(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); - return tag != null && tag.getBoolean("sacrifice"); + return tag != null && tag.getBoolean("sacrifice"); } - public void setUseForSacrifice(ItemStack stack, boolean sacrifice) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } + public void setUseForSacrifice(ItemStack stack, boolean sacrifice) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } - tag.setBoolean("sacrifice", sacrifice); + tag.setBoolean("sacrifice", sacrifice); } @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); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ScribeTool.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ScribeTool.java index 7714e676..de951eab 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ScribeTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ScribeTool.java @@ -1,19 +1,16 @@ package WayofTime.alchemicalWizardry.common.items; import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class ScribeTool extends EnergyItems -{ +public class ScribeTool extends EnergyItems { private int meta; - public ScribeTool(int inkType) - { + public ScribeTool(int inkType) { super(); setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -23,31 +20,26 @@ public class ScribeTool 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.scribetool.desc")); - 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")); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) - { - if (par1ItemStack.getItemDamage() > 0) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { + if (par1ItemStack.getItemDamage() > 0) { par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); } } return par1ItemStack; } - public int getType() - { + public int getType() { return this.meta; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/TelepositionFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/TelepositionFocus.java index 11fdbdf9..3cb90abb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/TelepositionFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/TelepositionFocus.java @@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items; import WayofTime.alchemicalWizardry.AlchemicalWizardry; 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.ItemStack; @@ -11,14 +12,10 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -import java.util.List; - -public class TelepositionFocus extends EnergyItems -{ +public class TelepositionFocus extends EnergyItems { private int focusLevel; - public TelepositionFocus(int focusLevel) - { + public TelepositionFocus(int focusLevel) { super(); this.setMaxStackSize(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -27,93 +24,76 @@ public class TelepositionFocus extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:TeleposerFocus"); } @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.telepositionfocus.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); + par3List.add( + StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack)); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) - { - if (par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { + if (par3EntityPlayer.isSneaking()) { return par1ItemStack; } } return par1ItemStack; } - public int getDimensionID(ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public int getDimensionID(ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } return itemStack.getTagCompound().getInteger("dimensionId"); } - public World getWorld(ItemStack itemStack) - { + public World getWorld(ItemStack itemStack) { return DimensionManager.getWorld(getDimensionID(itemStack)); } - public int xCoord(ItemStack itemStack) - { - if (!(itemStack.getTagCompound() == null)) - { + public int xCoord(ItemStack itemStack) { + if (!(itemStack.getTagCompound() == null)) { return itemStack.getTagCompound().getInteger("xCoord"); - } else - { + } else { return 0; } } - public int yCoord(ItemStack itemStack) - { - if (!(itemStack.getTagCompound() == null)) - { + public int yCoord(ItemStack itemStack) { + if (!(itemStack.getTagCompound() == null)) { return itemStack.getTagCompound().getInteger("yCoord"); - } else - { + } else { return 0; } } - public int zCoord(ItemStack itemStack) - { - if (!(itemStack.getTagCompound() == null)) - { + public int zCoord(ItemStack itemStack) { + if (!(itemStack.getTagCompound() == null)) { return itemStack.getTagCompound().getInteger("zCoord"); - } else - { + } else { return 0; } } - public int getFocusLevel() - { + public int getFocusLevel() { return this.focusLevel; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/TranscendentBloodOrb.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/TranscendentBloodOrb.java index ecab2b21..9b153fcd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/TranscendentBloodOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/TranscendentBloodOrb.java @@ -4,18 +4,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class TranscendentBloodOrb extends EnergyBattery -{ - public TranscendentBloodOrb(int damage) - { +public class TranscendentBloodOrb extends EnergyBattery { + public TranscendentBloodOrb(int damage) { super(damage); orbLevel = 6; } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:TranscendentBloodOrb"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/WaterScribeTool.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/WaterScribeTool.java index bec61005..de34dcd5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/WaterScribeTool.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/WaterScribeTool.java @@ -5,18 +5,15 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class WaterScribeTool extends ScribeTool -{ - public WaterScribeTool() - { +public class WaterScribeTool extends ScribeTool { + public WaterScribeTool() { super(1); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterScribeTool"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java index dd609433..30302b96 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java @@ -1,7 +1,19 @@ package WayofTime.alchemicalWizardry.common.items.armour; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.api.items.interfaces.ILPGauge; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaArmour; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.Optional.Interface; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.List; - import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -22,45 +34,39 @@ import net.minecraftforge.common.util.Constants; import thaumcraft.api.IGoggles; import thaumcraft.api.IRunicArmor; import thaumcraft.api.nodes.IRevealer; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.api.items.interfaces.ILPGauge; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaArmour; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.Optional.Interface; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -@Optional.InterfaceList(value = {@Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), @Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"), @Interface(iface = "thaumcraft.api.IRunicArmor", modid = "Thaumcraft")}) -public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialArmor, IBindable, IRevealer, IGoggles, IRunicArmor, ILPGauge -{ +@Optional.InterfaceList( + value = { + @Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.IRunicArmor", modid = "Thaumcraft") + }) +public class BoundArmour extends ItemArmor + implements IAlchemyGoggles, ISpecialArmor, IBindable, IRevealer, IGoggles, IRunicArmor, ILPGauge { private static int invSize = 9; + @SideOnly(Side.CLIENT) private IIcon helmetIcon; + @SideOnly(Side.CLIENT) private IIcon plateIcon; + @SideOnly(Side.CLIENT) private IIcon leggingsIcon; + @SideOnly(Side.CLIENT) private IIcon bootsIcon; public static boolean tryComplexRendering = true; - public BoundArmour(int armorType) - { + public BoundArmour(int armorType) { super(ItemArmor.ArmorMaterial.GOLD, 0, armorType); setMaxDamage(1000); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } - + @Override - public boolean isItemTool(ItemStack stack) - { + public boolean isItemTool(ItemStack stack) { return false; } @@ -70,30 +76,23 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA @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 ModelOmegaArmour(1.0f, true, true, false, true); } - if (this.model2 == null) - { + if (this.model2 == null) { this.model2 = new ModelOmegaArmour(0.5f, false, false, true, false); } - if (type == 1 || type == 3 || type == 0) - { + if (type == 1 || type == 3 || type == 0) { this.model = model1; - } else - { + } else { this.model = model2; } - if (this.model != null) - { + if (this.model != null) { this.model.bipedHead.showModel = (type == 0); this.model.bipedHeadwear.showModel = (type == 0); this.model.bipedBody.showModel = ((type == 1) || (type == 2)); @@ -109,16 +108,13 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA 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 (enumaction == EnumAction.block) - { + if ((entityLiving instanceof EntityPlayer)) { + if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { + EnumAction enumaction = + ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); + if (enumaction == EnumAction.block) { this.model.heldItemRight = 3; - } else if (enumaction == EnumAction.bow) - { + } else if (enumaction == EnumAction.bow) { this.model.aimedBow = true; } } @@ -127,16 +123,14 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA return model; - } else - { + } else { return super.getArmorModel(entityLiving, itemStack, armorSlot); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundHelmet"); this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundPlate"); @@ -146,25 +140,20 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (this.equals(ModItems.boundHelmet)) - { + public IIcon getIconFromDamage(int par1) { + if (this.equals(ModItems.boundHelmet)) { return this.helmetIcon; } - if (this.equals(ModItems.boundPlate)) - { + if (this.equals(ModItems.boundPlate)) { return this.plateIcon; } - if (this.equals(ModItems.boundLeggings)) - { + if (this.equals(ModItems.boundLeggings)) { return this.leggingsIcon; } - if (this.equals(ModItems.boundBoots)) - { + if (this.equals(ModItems.boundBoots)) { return this.bootsIcon; } @@ -172,64 +161,62 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA } @Override - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) - { + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return false; } - public boolean isAffectedBySoulHarden() - { - return true; + public boolean isAffectedBySoulHarden() { + return true; } - - public double getBaseArmourReduction() - { - return 0.9; + + public double getBaseArmourReduction() { + return 0.9; } - - public double getArmourPenetrationReduction() - { - return 0.9; + + public double getArmourPenetrationReduction() { + return 0.9; } - + @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) { double armourReduction = 0.0; int f = 0; int h = 0; - - if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) - { - f = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray).getAmplifier() + 1; + + if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) { + f = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray) + .getAmplifier() + + 1; } double damageAmount = 0.25; - if (player.isPotionActive(AlchemicalWizardry.customPotionSoulHarden)) - { - h = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulHarden).getAmplifier() + 1; + if (player.isPotionActive(AlchemicalWizardry.customPotionSoulHarden)) { + h = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulHarden) + .getAmplifier() + + 1; } - - armourReduction = isAffectedBySoulHarden() ? 1 - (1 - this.getBaseArmourReduction()) * Math.pow(1.0/3.0, Math.max(0, h - f)) - 0.1 * Math.max(0, f-h) : getBaseArmourReduction(); + + armourReduction = isAffectedBySoulHarden() + ? 1 + - (1 - this.getBaseArmourReduction()) * Math.pow(1.0 / 3.0, Math.max(0, h - f)) + - 0.1 * Math.max(0, f - h) + : getBaseArmourReduction(); damageAmount *= (armourReduction); int maxAbsorption = 100000; - if (source.equals(DamageSource.drown)) - { + if (source.equals(DamageSource.drown)) { return new ArmorProperties(-1, 0, 0); } - if (source.equals(DamageSource.outOfWorld)) - { - if (isImmuneToVoid(armor)) - { - return new ArmorProperties(-1, damageAmount * 1000 , maxAbsorption); - } else - { + if (source.equals(DamageSource.outOfWorld)) { + if (isImmuneToVoid(armor)) { + return new ArmorProperties(-1, damageAmount * 1000, maxAbsorption); + } else { return new ArmorProperties(-1, 0, 0); } } @@ -239,15 +226,15 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA ItemStack leggings = player.getEquipmentInSlot(2); ItemStack boots = player.getEquipmentInSlot(1); - if (helmet == null || plate == null || leggings == null || boots == null) - { + if (helmet == null || plate == null || leggings == null || boots == null) { return new ArmorProperties(-1, 0, 0); } - if (helmet.getItem() instanceof BoundArmour && plate.getItem() instanceof BoundArmour && leggings.getItem() instanceof BoundArmour && boots.getItem() instanceof BoundArmour) - { - if (source.isUnblockable()) - { + if (helmet.getItem() instanceof BoundArmour + && plate.getItem() instanceof BoundArmour + && leggings.getItem() instanceof BoundArmour + && boots.getItem() instanceof BoundArmour) { + if (source.isUnblockable()) { return new ArmorProperties(-1, damageAmount * getArmourPenetrationReduction(), maxAbsorption); } @@ -258,25 +245,20 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) - { - if (armor.getItem() == ModItems.boundHelmet) - { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + if (armor.getItem() == ModItems.boundHelmet) { return 3; } - if (armor.getItem() == ModItems.boundPlate) - { + if (armor.getItem() == ModItems.boundPlate) { return 8; } - if (armor.getItem() == ModItems.boundLeggings) - { + if (armor.getItem() == ModItems.boundLeggings) { return 6; } - if (armor.getItem() == ModItems.boundBoots) - { + if (armor.getItem() == ModItems.boundBoots) { return 3; } @@ -284,14 +266,11 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) - { - if (entity instanceof EntityPlayer) - { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + if (entity instanceof EntityPlayer) { EnergyItems.checkAndSetItemOwner(stack, (EntityPlayer) entity); - if (((EntityPlayer) entity).capabilities.isCreativeMode) - { + if (((EntityPlayer) entity).capabilities.isCreativeMode) { return; } } @@ -300,89 +279,72 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA } @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.boundarmor.devprotect")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + if (!(par1ItemStack.getTagCompound() == null)) { + if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } ItemStack[] inv = getInternalInventory(par1ItemStack); - if (inv == null) - { + if (inv == null) { return; } - for (int i = 0; i < invSize; i++) - { - if (inv[i] != null) - { - par3List.add(StatCollector.translateToLocal("tooltip.item.iteminslot") + " " + i + ": " + inv[i].getDisplayName()); + for (int i = 0; i < invSize; i++) { + if (inv[i] != null) { + par3List.add(StatCollector.translateToLocal("tooltip.item.iteminslot") + " " + i + ": " + + inv[i].getDisplayName()); } } } } @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 "alchemicalwizardry:models/armor/BloodArmour_WIP.png"; } - if (entity instanceof EntityLivingBase) - { - if (this.getIsInvisible(stack)) - { - if (this == ModItems.boundHelmet || this == ModItems.boundPlate || this == ModItems.boundBoots) - { + if (entity instanceof EntityLivingBase) { + if (this.getIsInvisible(stack)) { + if (this == ModItems.boundHelmet || this == ModItems.boundPlate || this == ModItems.boundBoots) { return "alchemicalwizardry:models/armor/boundArmour_invisible_layer_1.png"; } - if (this == ModItems.boundLeggings) - { + if (this == ModItems.boundLeggings) { return "alchemicalwizardry:models/armor/boundArmour_invisible_layer_2.png"; } } } - if (this == ModItems.boundHelmet || this == ModItems.boundPlate || this == ModItems.boundBoots) - { + if (this == ModItems.boundHelmet || this == ModItems.boundPlate || this == ModItems.boundBoots) { return "alchemicalwizardry:models/armor/boundArmour_layer_1.png"; } - if (this == ModItems.boundLeggings) - { + if (this == ModItems.boundLeggings) { return "alchemicalwizardry:models/armor/boundArmour_layer_2.png"; - } else - { + } else { return null; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); } @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } - if (!player.isPotionActive(AlchemicalWizardry.customPotionInhibit)) - { + if (!player.isPotionActive(AlchemicalWizardry.customPotionInhibit)) { tickInternalInventory(itemStack, world, player, 0, false); } @@ -390,83 +352,68 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA this.repairArmour(world, player, itemStack); } - - public void repairArmour(World world, EntityPlayer player, ItemStack itemStack) - { - if (itemStack.getItemDamage() > 0) - { + + public void repairArmour(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack.getItemDamage() > 0) { EnergyItems.checkAndSetItemOwner(itemStack, player); - if (!player.capabilities.isCreativeMode) - { - if(EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75)) - { - itemStack.setItemDamage(0); + if (!player.capabilities.isCreativeMode) { + if (EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75)) { + itemStack.setItemDamage(0); } } } } - public void tickInternalInventory(ItemStack par1ItemStack, World par2World, EntityPlayer par3Entity, int par4, boolean par5) - { + public void tickInternalInventory( + ItemStack par1ItemStack, World par2World, EntityPlayer par3Entity, int par4, boolean par5) { ItemStack[] inv = getInternalInventory(par1ItemStack); - if (inv == null) - { + if (inv == null) { return; } int blood = getMaxBloodShardLevel(par1ItemStack); - for (int i = 0; i < invSize; i++) - { - if (inv[i] == null) - { + for (int i = 0; i < invSize; i++) { + if (inv[i] == null) { continue; } - if (inv[i].getItem() instanceof ArmourUpgrade && blood > 0) - { - if (((ArmourUpgrade) inv[i].getItem()).isUpgrade()) - { + if (inv[i].getItem() instanceof ArmourUpgrade && blood > 0) { + if (((ArmourUpgrade) inv[i].getItem()).isUpgrade()) { ((ArmourUpgrade) inv[i].getItem()).onArmourUpdate(par2World, par3Entity, inv[i]); blood--; } - if (par2World.getWorldTime() % 200 == 0) - { - if (getUpgradeCostMultiplier(par1ItemStack) > 0.02f) - { - EnergyItems.syphonBatteries(par1ItemStack, par3Entity, (int) (((ArmourUpgrade) inv[i].getItem()).getEnergyForTenSeconds() * getUpgradeCostMultiplier(par1ItemStack))); + if (par2World.getWorldTime() % 200 == 0) { + if (getUpgradeCostMultiplier(par1ItemStack) > 0.02f) { + EnergyItems.syphonBatteries(par1ItemStack, par3Entity, (int) + (((ArmourUpgrade) inv[i].getItem()).getEnergyForTenSeconds() + * getUpgradeCostMultiplier(par1ItemStack))); } } } } } - public int getMaxBloodShardLevel(ItemStack armourStack) - { + public int getMaxBloodShardLevel(ItemStack armourStack) { ItemStack[] inv = getInternalInventory(armourStack); - if (inv == null) - { + if (inv == null) { return 0; } int max = 0; - for (int i = 0; i < invSize; i++) - { + for (int i = 0; i < invSize; i++) { ItemStack itemStack = inv[i]; - if (itemStack != null) - { - if (itemStack.getItem().equals(ModItems.weakBloodShard)) - { + if (itemStack != null) { + if (itemStack.getItem().equals(ModItems.weakBloodShard)) { max = Math.max(max, 1); } - if (itemStack.getItem().equals(ModItems.demonBloodShard)) - { + if (itemStack.getItem().equals(ModItems.demonBloodShard)) { max = Math.max(max, 2); } } @@ -475,40 +422,33 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA return max; } - public boolean hasAddedToInventory(ItemStack sigilItemStack, ItemStack addedItemStack) - { + public boolean hasAddedToInventory(ItemStack sigilItemStack, ItemStack addedItemStack) { ItemStack[] inv = getInternalInventory(sigilItemStack); - if (inv == null) - { + if (inv == null) { return false; } - if (addedItemStack == null) - { + if (addedItemStack == null) { return false; } int candidateSlot = -1; - for (int i = invSize - 1; i >= 0; i--) - { + for (int i = invSize - 1; i >= 0; i--) { ItemStack nextItem = inv[i]; - if (nextItem == null) - { + if (nextItem == null) { candidateSlot = i; continue; } } - if (candidateSlot == -1) - { + if (candidateSlot == -1) { return false; } - if (addedItemStack.getItem() instanceof ArmourUpgrade) - { + if (addedItemStack.getItem() instanceof ArmourUpgrade) { inv[candidateSlot] = addedItemStack; saveInternalInventory(sigilItemStack, inv); return true; @@ -517,12 +457,10 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA return false; } - public ItemStack[] getInternalInventory(ItemStack itemStack) - { + public ItemStack[] getInternalInventory(ItemStack itemStack) { NBTTagCompound itemTag = itemStack.getTagCompound(); - if (itemTag == null) - { + if (itemTag == null) { itemStack.setTagCompound(new NBTTagCompound()); } itemTag = itemStack.getTagCompound(); @@ -530,18 +468,15 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA ItemStack[] inv = new ItemStack[9]; NBTTagList tagList = itemTag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); - 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); } } @@ -549,21 +484,17 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA return inv; } - public void saveInternalInventory(ItemStack itemStack, ItemStack[] inventory) - { + public void saveInternalInventory(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); @@ -574,24 +505,19 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA itemTag.setTag("Inventory", itemList); } - public boolean isImmuneToVoid(ItemStack itemStack) - { + public boolean isImmuneToVoid(ItemStack itemStack) { ItemStack[] inv = getInternalInventory(itemStack); - if (inv == null) - { + if (inv == null) { return false; } - for (ItemStack item : inv) - { - if (item == null) - { + for (ItemStack item : inv) { + if (item == null) { continue; } - if (item.getItem().equals(ModItems.voidSigil)) - { + if (item.getItem().equals(ModItems.voidSigil)) { return true; } } @@ -600,24 +526,19 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA } @Optional.Method(modid = "Thaumcraft") - public boolean hasIRevealer(ItemStack itemStack) - { + public boolean hasIRevealer(ItemStack itemStack) { ItemStack[] inv = getInternalInventory(itemStack); - if (inv == null) - { + if (inv == null) { return false; } - for (ItemStack item : inv) - { - if (item == null) - { + for (ItemStack item : inv) { + if (item == null) { continue; } - if (item.getItem() instanceof IRevealer) - { + if (item.getItem() instanceof IRevealer) { return true; } } @@ -626,113 +547,90 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA } @Optional.Method(modid = "Thaumcraft") - public boolean hasIGoggles(ItemStack itemStack) - { + public boolean hasIGoggles(ItemStack itemStack) { ItemStack[] inv = getInternalInventory(itemStack); - if (inv == null) - { + if (inv == null) { return false; } - + int blood = getMaxBloodShardLevel(itemStack); - for (ItemStack item : inv) - { - if (item == null) - { + for (ItemStack item : inv) { + if (item == null) { continue; } - if (item.getItem() instanceof ArmourUpgrade && blood > 0) - { - if (item.getItem() instanceof IGoggles) - { + if (item.getItem() instanceof ArmourUpgrade && blood > 0) { + if (item.getItem() instanceof IGoggles) { return true; } - - if(((ArmourUpgrade)item.getItem()).isUpgrade()) - { - blood--; - } - } + + if (((ArmourUpgrade) item.getItem()).isUpgrade()) { + blood--; + } + } } return false; } - + @Override - public boolean canSeeLPBar(ItemStack itemStack) - { + public boolean canSeeLPBar(ItemStack itemStack) { ItemStack[] inv = getInternalInventory(itemStack); - if (inv == null) - { + if (inv == null) { return false; } - + int blood = getMaxBloodShardLevel(itemStack); - for (ItemStack item : inv) - { - if (item == null) - { + for (ItemStack item : inv) { + if (item == null) { continue; } - if (item.getItem() instanceof ArmourUpgrade && blood > 0) - { - if (item.getItem() instanceof SigilDivination) - { + if (item.getItem() instanceof ArmourUpgrade && blood > 0) { + if (item.getItem() instanceof SigilDivination) { return true; } - - if(((ArmourUpgrade)item.getItem()).isUpgrade()) - { - blood--; - } - } + + if (((ArmourUpgrade) item.getItem()).isUpgrade()) { + blood--; + } + } } return false; } - public float getUpgradeCostMultiplier(ItemStack itemStack) - { + public float getUpgradeCostMultiplier(ItemStack itemStack) { ItemStack[] inv = getInternalInventory(itemStack); - if (inv == null) - { + if (inv == null) { return 1.0f; } - for (ItemStack item : inv) - { - if (item == null) - { + for (ItemStack item : inv) { + if (item == null) { continue; } - if (item.getItem().equals(ModItems.weakBloodOrb)) - { + if (item.getItem().equals(ModItems.weakBloodOrb)) { return 0.75f; } - if (item.getItem().equals(ModItems.apprenticeBloodOrb)) - { + if (item.getItem().equals(ModItems.apprenticeBloodOrb)) { return 0.50f; } - if (item.getItem().equals(ModItems.magicianBloodOrb)) - { + if (item.getItem().equals(ModItems.magicianBloodOrb)) { return 0.25f; } - if (item.getItem().equals(ModItems.masterBloodOrb)) - { + if (item.getItem().equals(ModItems.masterBloodOrb)) { return 0.0f; } - if (item.getItem().equals(ModItems.archmageBloodOrb)) - { + if (item.getItem().equals(ModItems.archmageBloodOrb)) { return 0.0f; } } @@ -740,23 +638,19 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA return 1.0f; } - public int getItemEnchantability(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) - { + public int getItemEnchantability(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag != null) { return tag.getInteger("enchantability"); } - + return Integer.MIN_VALUE; } - - public void setItemEnchantability(ItemStack stack, int enchantability) - { - NBTTagCompound tag = stack.getTagCompound(); - if (tag == null) - { + public void setItemEnchantability(ItemStack stack, int enchantability) { + NBTTagCompound tag = stack.getTagCompound(); + + if (tag == null) { stack.setTagCompound(new NBTTagCompound()); tag = stack.getTagCompound(); } @@ -764,23 +658,19 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA tag.setInteger("enchantability", enchantability); } - public boolean getIsInvisible(ItemStack armourStack) - { + public boolean getIsInvisible(ItemStack armourStack) { NBTTagCompound tag = armourStack.getTagCompound(); - if (tag != null) - { + if (tag != null) { return tag.getBoolean("invisible"); } return false; } - public void setIsInvisible(ItemStack armourStack, boolean invisible) - { + public void setIsInvisible(ItemStack armourStack, boolean invisible) { NBTTagCompound tag = armourStack.getTagCompound(); - if (tag == null) - { + if (tag == null) { armourStack.setTagCompound(new NBTTagCompound()); tag = armourStack.getTagCompound(); } @@ -790,65 +680,53 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA @Override @Optional.Method(modid = "Thaumcraft") - public boolean showNodes(ItemStack itemstack, EntityLivingBase player) - { + public boolean showNodes(ItemStack itemstack, EntityLivingBase player) { return this.hasIRevealer(itemstack); } @Override @Optional.Method(modid = "Thaumcraft") - public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) - { + public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) { return this.hasIGoggles(itemstack); } @Override @Optional.Method(modid = "Thaumcraft") - public int getRunicCharge(ItemStack itemstack) - { + public int getRunicCharge(ItemStack itemstack) { ItemStack[] inv = this.getInternalInventory(itemstack); int shardLevel = this.getMaxBloodShardLevel(itemstack); int count = 0; int harden = 0; - if (inv == null) - { + if (inv == null) { return 0; } - for (ItemStack stack : inv) - { - if (count >= shardLevel) - { + for (ItemStack stack : inv) { + if (count >= shardLevel) { break; } - if (stack == null || !(stack.getItem() instanceof ArmourUpgrade)) - { + if (stack == null || !(stack.getItem() instanceof ArmourUpgrade)) { continue; } - if (stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).armorType != this.armorType) - { + if (stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).armorType != this.armorType) { continue; } - if (stack.hasTagCompound()) - { + if (stack.hasTagCompound()) { NBTTagCompound tag = stack.getTagCompound(); int enchLvl = tag.getByte("RS.HARDEN"); - if (stack.getItem() instanceof IRunicArmor) - { + if (stack.getItem() instanceof IRunicArmor) { enchLvl += ((IRunicArmor) stack.getItem()).getRunicCharge(stack); } - if (enchLvl > 0) - { + if (enchLvl > 0) { harden += enchLvl; - if (((ArmourUpgrade) stack.getItem()).isUpgrade()) - { + if (((ArmourUpgrade) stack.getItem()).isUpgrade()) { count += 1; } } @@ -859,24 +737,19 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA } @Override - public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player) - { + public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player) { ItemStack[] inv = getInternalInventory(stack); - if (inv == null) - { + if (inv == null) { return false; } - for (ItemStack item : inv) - { - if (item == null) - { + for (ItemStack item : inv) { + if (item == null) { continue; } - if (item.getItem().equals(ModItems.itemSeerSigil)) - { + if (item.getItem().equals(ModItems.itemSeerSigil)) { return true; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java index 1b726b44..0b897774 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java @@ -1,5 +1,12 @@ package WayofTime.alchemicalWizardry.common.items.armour; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -8,7 +15,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; - import net.minecraft.client.model.ModelBiped; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; @@ -22,340 +28,284 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public abstract class OmegaArmour extends BoundArmour -{ - public OmegaParadigm paradigm; - public Reagent reagent; - protected boolean storeBiomeID = false; - protected boolean storeDimensionID = false; - protected boolean storeYLevel = false; - protected boolean storeSeesSky = false; - - protected List illegalEnchantmentList = new LinkedList(); - - public float reagentDrainPerDamage = 0.1f; - - public OmegaArmour(int armorType) - { - super(armorType); - } - - public void setParadigm(OmegaParadigm paradigm) - { - this.paradigm = paradigm; - } - - public OmegaParadigm getOmegaParadigm() - { - return this.paradigm; - } - - public void setReagent(Reagent reagent) - { - this.reagent = reagent; - } - - @Override - public boolean isAffectedBySoulHarden() - { - return false; +public abstract class OmegaArmour extends BoundArmour { + public OmegaParadigm paradigm; + public Reagent reagent; + protected boolean storeBiomeID = false; + protected boolean storeDimensionID = false; + protected boolean storeYLevel = false; + protected boolean storeSeesSky = false; + + protected List illegalEnchantmentList = new LinkedList(); + + public float reagentDrainPerDamage = 0.1f; + + public OmegaArmour(int armorType) { + super(armorType); } - - @Override - public double getBaseArmourReduction() - { - return 0.9; + + public void setParadigm(OmegaParadigm paradigm) { + this.paradigm = paradigm; } - - @Override - public double getArmourPenetrationReduction() - { - return 0.5; + + public OmegaParadigm getOmegaParadigm() { + return this.paradigm; } - - @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) - { - super.onArmorTick(world, player, itemStack); - - if(world.getWorldTime() % 50 == 0) - { - if(this.storeBiomeID()) - { - int xCoord = (int) Math.floor(player.posX); - int zCoord = (int) Math.floor(player.posZ); - - BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord); - if(biome != null) - { - this.setBiomeIDStored(itemStack, biome.biomeID); - } - } - - if(this.storeDimensionID()) - { - this.setDimensionIDStored(itemStack, world.provider.dimensionId); - } - - if(this.storeYLevel()) - { - this.setYLevelStored(itemStack, (int) Math.floor(player.posY)); - } - } - - if(this.armorType == 1) - { - paradigm.onUpdate(world, player, itemStack); - int duration = this.getOmegaStallingDuration(itemStack); - if(duration > 0) - { - this.setOmegaStallingDuration(itemStack, duration - 1); - } - } + + public void setReagent(Reagent reagent) { + this.reagent = reagent; } - - @Override - public void repairArmour(World world, EntityPlayer player, ItemStack itemStack) - { - if (itemStack.getItemDamage() > 0) - { - if (!player.capabilities.isCreativeMode) - { - if(EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75)) - { - float reagentAmount = APISpellHelper.getPlayerCurrentReagentAmount(player); - - reagentAmount -= itemStack.getItemDamage() * reagentDrainPerDamage; - APISpellHelper.setPlayerCurrentReagentAmount(player, Math.max(0, reagentAmount)); - - itemStack.setItemDamage(0); + + @Override + public boolean isAffectedBySoulHarden() { + return false; + } + + @Override + public double getBaseArmourReduction() { + return 0.9; + } + + @Override + public double getArmourPenetrationReduction() { + return 0.5; + } + + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + super.onArmorTick(world, player, itemStack); + + if (world.getWorldTime() % 50 == 0) { + if (this.storeBiomeID()) { + int xCoord = (int) Math.floor(player.posX); + int zCoord = (int) Math.floor(player.posZ); + + BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord); + if (biome != null) { + this.setBiomeIDStored(itemStack, biome.biomeID); + } + } + + if (this.storeDimensionID()) { + this.setDimensionIDStored(itemStack, world.provider.dimensionId); + } + + if (this.storeYLevel()) { + this.setYLevelStored(itemStack, (int) Math.floor(player.posY)); + } + } + + if (this.armorType == 1) { + paradigm.onUpdate(world, player, itemStack); + int duration = this.getOmegaStallingDuration(itemStack); + if (duration > 0) { + this.setOmegaStallingDuration(itemStack, duration - 1); + } + } + } + + @Override + public void repairArmour(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack.getItemDamage() > 0) { + if (!player.capabilities.isCreativeMode) { + if (EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75)) { + float reagentAmount = APISpellHelper.getPlayerCurrentReagentAmount(player); + + reagentAmount -= itemStack.getItemDamage() * reagentDrainPerDamage; + APISpellHelper.setPlayerCurrentReagentAmount(player, Math.max(0, reagentAmount)); + + itemStack.setItemDamage(0); } } } - } - - public void revertArmour(EntityPlayer player, ItemStack itemStack) - { - ItemStack stack = this.getContainedArmourStack(itemStack); - player.inventory.armorInventory[3-this.armorType] = stack; - } - - public ItemStack getSubstituteStack(ItemStack boundStack, int stability, int affinity, int enchantability, int enchantmentLevel, Random rand) - { - ItemStack omegaStack = new ItemStack(this); - if(boundStack != null && boundStack.hasTagCompound()) - { - NBTTagCompound tag = (NBTTagCompound) boundStack.getTagCompound().copy(); - omegaStack.setTagCompound(tag); - } - this.setContainedArmourStack(omegaStack, boundStack); - SoulNetworkHandler.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack)); - this.setItemEnchantability(omegaStack, Math.min(enchantability, 70)); - - EnchantmentHelper.setEnchantments(new HashMap(), omegaStack); - - List enchantList = new ArrayList(); - - int adjustedEnchantLevel = Math.min(enchantmentLevel, 30); - int additionalPasses = enchantmentLevel - adjustedEnchantLevel; - - for(int i=0; i<1+additionalPasses; i++) - { - List lst = EnchantmentHelper.buildEnchantmentList(rand, omegaStack, adjustedEnchantLevel); - if(lst != null) - { - enchantList.addAll(lst); - } - } - - Map> map = new HashMap(); - - for(Object obj : enchantList) - { - EnchantmentData enchantmentdata = (EnchantmentData)obj; - - if(!map.containsKey(enchantmentdata.enchantmentobj)) - { - map.put(enchantmentdata.enchantmentobj, new HashMap()); + } + + public void revertArmour(EntityPlayer player, ItemStack itemStack) { + ItemStack stack = this.getContainedArmourStack(itemStack); + player.inventory.armorInventory[3 - this.armorType] = stack; + } + + public ItemStack getSubstituteStack( + ItemStack boundStack, int stability, int affinity, int enchantability, int enchantmentLevel, Random rand) { + ItemStack omegaStack = new ItemStack(this); + if (boundStack != null && boundStack.hasTagCompound()) { + NBTTagCompound tag = (NBTTagCompound) boundStack.getTagCompound().copy(); + omegaStack.setTagCompound(tag); + } + this.setContainedArmourStack(omegaStack, boundStack); + SoulNetworkHandler.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack)); + this.setItemEnchantability(omegaStack, Math.min(enchantability, 70)); + + EnchantmentHelper.setEnchantments(new HashMap(), omegaStack); + + List enchantList = new ArrayList(); + + int adjustedEnchantLevel = Math.min(enchantmentLevel, 30); + int additionalPasses = enchantmentLevel - adjustedEnchantLevel; + + for (int i = 0; i < 1 + additionalPasses; i++) { + List lst = EnchantmentHelper.buildEnchantmentList(rand, omegaStack, adjustedEnchantLevel); + if (lst != null) { + enchantList.addAll(lst); } - + } + + Map> map = new HashMap(); + + for (Object obj : enchantList) { + EnchantmentData enchantmentdata = (EnchantmentData) obj; + + if (!map.containsKey(enchantmentdata.enchantmentobj)) { + map.put(enchantmentdata.enchantmentobj, new HashMap()); + } + Map numMap = map.get(enchantmentdata.enchantmentobj); - if(numMap.containsKey(enchantmentdata.enchantmentLevel)) - { - numMap.put(enchantmentdata.enchantmentLevel, numMap.get(enchantmentdata.enchantmentLevel)+1); - }else - { - numMap.put(enchantmentdata.enchantmentLevel, 1); + if (numMap.containsKey(enchantmentdata.enchantmentLevel)) { + numMap.put(enchantmentdata.enchantmentLevel, numMap.get(enchantmentdata.enchantmentLevel) + 1); + } else { + numMap.put(enchantmentdata.enchantmentLevel, 1); } - } - - for(Enchantment ench : this.illegalEnchantmentList) - { - if(map.containsKey(ench)) - { - map.remove(ench); - } - } - - List newEnchantList = new ArrayList(); - - for(Entry> entry : map.entrySet()) - { - Enchantment ench = entry.getKey(); - Map numMap = entry.getValue(); - - if(numMap.isEmpty()) - { - continue; - } + } - int[] enchantValues = new int[1]; - - for(Entry entry1 : numMap.entrySet()) - { - int enchantLevel = entry1.getKey(); - int number = entry1.getValue(); - - if(enchantLevel >= enchantValues.length) - { - int[] newEnchantValues = new int[enchantLevel+1]; - for(int i=0; i< enchantValues.length; i++) - { - newEnchantValues[i] = enchantValues[i]; - } - - enchantValues = newEnchantValues; - } - - enchantValues[enchantLevel] += number; - } - - int size = enchantValues.length; - int i = 0; - while(i= 2 && i+1 >= size) - { - int[] newEnchantValues = new int[i+2]; - for(int z=0; z< enchantValues.length; z++) - { - newEnchantValues[z] = enchantValues[z]; - } - - enchantValues = newEnchantValues; - enchantValues[i+1] += number/2; - size = enchantValues.length; - } - i++; - } - - newEnchantList.add(new EnchantmentData(ench, enchantValues.length-1)); - } - - Iterator iterator = newEnchantList.iterator(); + for (Enchantment ench : this.illegalEnchantmentList) { + if (map.containsKey(ench)) { + map.remove(ench); + } + } - while (iterator.hasNext()) - { - EnchantmentData enchantmentdata = (EnchantmentData)iterator.next(); + List newEnchantList = new ArrayList(); + + for (Entry> entry : map.entrySet()) { + Enchantment ench = entry.getKey(); + Map numMap = entry.getValue(); + + if (numMap.isEmpty()) { + continue; + } + + int[] enchantValues = new int[1]; + + for (Entry entry1 : numMap.entrySet()) { + int enchantLevel = entry1.getKey(); + int number = entry1.getValue(); + + if (enchantLevel >= enchantValues.length) { + int[] newEnchantValues = new int[enchantLevel + 1]; + for (int i = 0; i < enchantValues.length; i++) { + newEnchantValues[i] = enchantValues[i]; + } + + enchantValues = newEnchantValues; + } + + enchantValues[enchantLevel] += number; + } + + int size = enchantValues.length; + int i = 0; + while (i < size) { + int number = enchantValues[i]; + if (number >= 2 && i + 1 >= size) { + int[] newEnchantValues = new int[i + 2]; + for (int z = 0; z < enchantValues.length; z++) { + newEnchantValues[z] = enchantValues[z]; + } + + enchantValues = newEnchantValues; + enchantValues[i + 1] += number / 2; + size = enchantValues.length; + } + i++; + } + + newEnchantList.add(new EnchantmentData(ench, enchantValues.length - 1)); + } + + Iterator iterator = newEnchantList.iterator(); + + while (iterator.hasNext()) { + EnchantmentData enchantmentdata = (EnchantmentData) iterator.next(); { omegaStack.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel); } } - - for(int i=0; i<1; i++) - { -// omegaStack = EnchantmentHelper.addRandomEnchantment(new Random(), omegaStack, 30); - } - return omegaStack; - } - - public void setContainedArmourStack(ItemStack omegaStack, ItemStack boundStack) - { - if(omegaStack == null || boundStack == null) - { - return; - } - - NBTTagCompound tag = new NBTTagCompound(); - boundStack.writeToNBT(tag); - - NBTTagCompound omegaTag = omegaStack.getTagCompound(); - if(omegaTag == null) - { - omegaTag = new NBTTagCompound(); - omegaStack.setTagCompound(omegaTag); - } - - omegaTag.setTag("armour", tag); - } - - public ItemStack getContainedArmourStack(ItemStack omegaStack) - { - NBTTagCompound omegaTag = omegaStack.getTagCompound(); - if(omegaTag == null) - { - return null; - } - - NBTTagCompound tag = omegaTag.getCompoundTag("armour"); - ItemStack armourStack = ItemStack.loadItemStackFromNBT(tag); - - return armourStack; - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - return "alchemicalwizardry:models/armor/OmegaWater.png"; + + for (int i = 0; i < 1; i++) { + // omegaStack = EnchantmentHelper.addRandomEnchantment(new Random(), omegaStack, 30); + } + return omegaStack; } - - @SideOnly(Side.CLIENT) - public abstract ModelBiped getChestModel(); - @SideOnly(Side.CLIENT) - public abstract ModelBiped getLegsModel(); - @SideOnly(Side.CLIENT) - ModelBiped model1 = null; - @SideOnly(Side.CLIENT) + + public void setContainedArmourStack(ItemStack omegaStack, ItemStack boundStack) { + if (omegaStack == null || boundStack == null) { + return; + } + + NBTTagCompound tag = new NBTTagCompound(); + boundStack.writeToNBT(tag); + + NBTTagCompound omegaTag = omegaStack.getTagCompound(); + if (omegaTag == null) { + omegaTag = new NBTTagCompound(); + omegaStack.setTagCompound(omegaTag); + } + + omegaTag.setTag("armour", tag); + } + + public ItemStack getContainedArmourStack(ItemStack omegaStack) { + NBTTagCompound omegaTag = omegaStack.getTagCompound(); + if (omegaTag == null) { + return null; + } + + NBTTagCompound tag = omegaTag.getCompoundTag("armour"); + ItemStack armourStack = ItemStack.loadItemStackFromNBT(tag); + + return armourStack; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return "alchemicalwizardry:models/armor/OmegaWater.png"; + } + + @SideOnly(Side.CLIENT) + public abstract ModelBiped getChestModel(); + + @SideOnly(Side.CLIENT) + public abstract ModelBiped getLegsModel(); + + @SideOnly(Side.CLIENT) + ModelBiped model1 = null; + + @SideOnly(Side.CLIENT) ModelBiped model2 = null; - @SideOnly(Side.CLIENT) + + @SideOnly(Side.CLIENT) ModelBiped model = null; @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 = getChestModel(); } - if (this.model2 == null) - { + if (this.model2 == null) { this.model2 = getLegsModel(); } - if (type == 1 || type == 3 || type == 0) - { + if (type == 1 || type == 3 || type == 0) { this.model = model1; - } else - { + } else { this.model = model2; } - if (this.model != null) - { + if (this.model != null) { this.model.bipedHead.showModel = (type == 0); this.model.bipedHeadwear.showModel = (type == 0); this.model.bipedBody.showModel = ((type == 1) || (type == 2)); @@ -371,16 +321,13 @@ public abstract class OmegaArmour extends BoundArmour 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 (enumaction == EnumAction.block) - { + if ((entityLiving instanceof EntityPlayer)) { + if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { + EnumAction enumaction = + ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); + if (enumaction == EnumAction.block) { this.model.heldItemRight = 3; - } else if (enumaction == EnumAction.bow) - { + } else if (enumaction == EnumAction.bow) { this.model.aimedBow = true; } } @@ -389,138 +336,114 @@ public abstract class OmegaArmour extends BoundArmour return model; - } else - { + } else { return super.getArmorModel(entityLiving, itemStack, armorSlot); } } - - public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) - { - if(paradigm != null) - { - paradigm.onOmegaKeyPressed(player, stack); - } + + public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) { + if (paradigm != null) { + paradigm.onOmegaKeyPressed(player, stack); + } } - - public void setOmegaStallingDuration(ItemStack stack, int duration) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - tag.setInteger("OmegaStallDuration", duration); + + public void setOmegaStallingDuration(ItemStack stack, int duration) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + tag.setInteger("OmegaStallDuration", duration); } - - public int getOmegaStallingDuration(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - return tag.getInteger("OmegaStallDuration"); + + public int getOmegaStallingDuration(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + return tag.getInteger("OmegaStallDuration"); } - - public boolean hasOmegaStalling(ItemStack stack) - { - return this.getOmegaStallingDuration(stack) > 0; + + public boolean hasOmegaStalling(ItemStack stack) { + return this.getOmegaStallingDuration(stack) > 0; } - - public boolean storeBiomeID() - { - return this.storeBiomeID; + + public boolean storeBiomeID() { + return this.storeBiomeID; } - - public boolean storeDimensionID() - { - return this.storeDimensionID; + + public boolean storeDimensionID() { + return this.storeDimensionID; } - - public boolean storeYLevel() - { - return this.storeYLevel; + + public boolean storeYLevel() { + return this.storeYLevel; } - - public boolean storeSeesSky() - { - return this.storeSeesSky; + + public boolean storeSeesSky() { + return this.storeSeesSky; } - - public int getBiomeIDStored(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - return tag.getInteger("biomeID"); + + public int getBiomeIDStored(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + return tag.getInteger("biomeID"); } - - public void setBiomeIDStored(ItemStack stack, int id) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - tag.setInteger("biomeID", id); + + public void setBiomeIDStored(ItemStack stack, int id) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + tag.setInteger("biomeID", id); } - - public int getDimensionIDStored(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - return tag.getInteger("dimensionID"); + + public int getDimensionIDStored(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + return tag.getInteger("dimensionID"); } - - public void setDimensionIDStored(ItemStack stack, int id) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - tag.setInteger("dimensionID", id); + + public void setDimensionIDStored(ItemStack stack, int id) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + tag.setInteger("dimensionID", id); } - - public int getYLevelStored(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - return tag.getInteger("yLevel"); + + public int getYLevelStored(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + return tag.getInteger("yLevel"); } - - public void setYLevelStored(ItemStack stack, int level) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - tag.setInteger("yLevel", level); + + public void setYLevelStored(ItemStack stack, int level) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + tag.setInteger("yLevel", level); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourEarth.java index a60bd254..7e6efcb0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourEarth.java @@ -1,7 +1,12 @@ package WayofTime.alchemicalWizardry.common.items.armour; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaEarth; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.UUID; - import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -9,130 +14,135 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaEarth; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; +public class OmegaArmourEarth extends OmegaArmour { + @SideOnly(Side.CLIENT) + private IIcon helmetIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class OmegaArmourEarth extends OmegaArmour -{ - @SideOnly(Side.CLIENT) - private IIcon helmetIcon; - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) private IIcon plateIcon; + @SideOnly(Side.CLIENT) private IIcon leggingsIcon; + @SideOnly(Side.CLIENT) private IIcon bootsIcon; - - public OmegaArmourEarth(int armorType) - { - super(armorType); - this.storeYLevel = true; - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - return "alchemicalwizardry:models/armor/OmegaEarth.png"; + + public OmegaArmourEarth(int armorType) { + super(armorType); + this.storeYLevel = true; } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getChestModel() - { - return new ModelOmegaEarth(1.0f, true, true, false, true); - } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getLegsModel() - { - return new ModelOmegaEarth(0.5f, false, false, true, false); - } - - @Override + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return "alchemicalwizardry:models/armor/OmegaEarth.png"; + } + + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public ModelBiped getChestModel() { + return new ModelOmegaEarth(1.0f, true, true, false, true); + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getLegsModel() { + return new ModelOmegaEarth(0.5f, false, false, true, false); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaHelmet_earth"); this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaPlate_earth"); this.leggingsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaLeggings_earth"); this.bootsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaBoots_earth"); } - - @Override + + @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (this.equals(ModItems.boundHelmetEarth)) - { + public IIcon getIconFromDamage(int par1) { + if (this.equals(ModItems.boundHelmetEarth)) { return this.helmetIcon; } - if (this.equals(ModItems.boundPlateEarth)) - { + if (this.equals(ModItems.boundPlateEarth)) { return this.plateIcon; } - if (this.equals(ModItems.boundLeggingsEarth)) - { + if (this.equals(ModItems.boundLeggingsEarth)) { return this.leggingsIcon; } - if (this.equals(ModItems.boundBootsEarth)) - { + if (this.equals(ModItems.boundBootsEarth)) { return this.bootsIcon; } return this.itemIcon; } - - @Override - public Multimap getAttributeModifiers(ItemStack stack) - { - Multimap map = HashMultimap.create(); - int yLevel = this.getYLevelStored(stack); - map.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(179618 /** Random number **/, armorType), "Knockback modifier" + armorType, getKnockbackResist(), 0)); - map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(80532 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForLevel(yLevel), 1)); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85112 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForLevel(yLevel), 2)); - - return map; - } - public float getKnockbackResist() - { - return 0.25f; - } - - public float getDefaultArmourBoost() - { - switch(this.armorType) - { - case 0: - return 2.5f; - case 1: - return 4; - case 2: - return 3.5f; - case 3: - return 2; - } - return 0.25f; - } - - public float getHealthBoostModifierForLevel(int yLevel) - { - return 0.05f * (yLevel <= 50 ? 1.5f : yLevel >= 100 ? -0.5f : 0.5f); - } - - public float getDamageModifierForLevel(int yLevel) - { - return 0.03f * (yLevel <= 50 ? 1.5f : yLevel >= 100 ? -0.5f : 0.5f); - } + @Override + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap map = HashMultimap.create(); + int yLevel = this.getYLevelStored(stack); + map.put( + SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 179618 + /** Random number **/ + , armorType), + "Knockback modifier" + armorType, + getKnockbackResist(), + 0)); + map.put( + SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 80532 + /** Random number **/ + , armorType), + "Health modifier" + armorType, + getDefaultArmourBoost() * getHealthBoostModifierForLevel(yLevel), + 1)); + map.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 85112 + /** Random number **/ + , armorType), + "Damage modifier" + armorType, + getDefaultArmourBoost() * getDamageModifierForLevel(yLevel), + 2)); + + return map; + } + + public float getKnockbackResist() { + return 0.25f; + } + + public float getDefaultArmourBoost() { + switch (this.armorType) { + case 0: + return 2.5f; + case 1: + return 4; + case 2: + return 3.5f; + case 3: + return 2; + } + return 0.25f; + } + + public float getHealthBoostModifierForLevel(int yLevel) { + return 0.05f * (yLevel <= 50 ? 1.5f : yLevel >= 100 ? -0.5f : 0.5f); + } + + public float getDamageModifierForLevel(int yLevel) { + return 0.03f * (yLevel <= 50 ? 1.5f : yLevel >= 100 ? -0.5f : 0.5f); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java index 2f9d6825..d8e0cf32 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java @@ -1,10 +1,12 @@ package WayofTime.alchemicalWizardry.common.items.armour; -import java.util.UUID; - +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaFire; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.UUID; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.Enchantment; @@ -14,158 +16,152 @@ import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.biome.BiomeGenBase; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaFire; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class OmegaArmourFire extends OmegaArmour -{ - @SideOnly(Side.CLIENT) - private IIcon helmetIcon; - @SideOnly(Side.CLIENT) - private IIcon plateIcon; - @SideOnly(Side.CLIENT) - private IIcon leggingsIcon; - @SideOnly(Side.CLIENT) - private IIcon bootsIcon; - - public OmegaArmourFire(int armorType) - { - super(armorType); - this.storeBiomeID = true; - this.illegalEnchantmentList.add(Enchantment.fireProtection); - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - return "alchemicalwizardry:models/armor/OmegaFire.png"; - } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getChestModel() - { - return new ModelOmegaFire(1.0f, true, true, false, true); - } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getLegsModel() - { - return new ModelOmegaFire(0.5f, false, false, true, false); - } - - @Override +public class OmegaArmourFire extends OmegaArmour { @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + private IIcon helmetIcon; + + @SideOnly(Side.CLIENT) + private IIcon plateIcon; + + @SideOnly(Side.CLIENT) + private IIcon leggingsIcon; + + @SideOnly(Side.CLIENT) + private IIcon bootsIcon; + + public OmegaArmourFire(int armorType) { + super(armorType); + this.storeBiomeID = true; + this.illegalEnchantmentList.add(Enchantment.fireProtection); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return "alchemicalwizardry:models/armor/OmegaFire.png"; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getChestModel() { + return new ModelOmegaFire(1.0f, true, true, false, true); + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getLegsModel() { + return new ModelOmegaFire(0.5f, false, false, true, false); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaHelmet_fire"); this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaPlate_fire"); this.leggingsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaLeggings_fire"); this.bootsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaBoots_fire"); } - - @Override + + @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (this.equals(ModItems.boundHelmetFire)) - { + public IIcon getIconFromDamage(int par1) { + if (this.equals(ModItems.boundHelmetFire)) { return this.helmetIcon; } - if (this.equals(ModItems.boundPlateFire)) - { + if (this.equals(ModItems.boundPlateFire)) { return this.plateIcon; } - if (this.equals(ModItems.boundLeggingsFire)) - { + if (this.equals(ModItems.boundLeggingsFire)) { return this.leggingsIcon; } - if (this.equals(ModItems.boundBootsFire)) - { + if (this.equals(ModItems.boundBootsFire)) { return this.bootsIcon; } return this.itemIcon; } - - @Override - public Multimap getAttributeModifiers(ItemStack stack) - { - Multimap map = HashMultimap.create(); - int biomeID = this.getBiomeIDStored(stack); - BiomeGenBase biome = BiomeGenBase.getBiome(biomeID); - if(biome != null) - { - map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForBiome(biome), 1)); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(196312 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForBiome(biome), 1)); - } - return map; + + @Override + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap map = HashMultimap.create(); + int biomeID = this.getBiomeIDStored(stack); + BiomeGenBase biome = BiomeGenBase.getBiome(biomeID); + if (biome != null) { + map.put( + SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 895132 + /** Random number **/ + , armorType), + "Health modifier" + armorType, + getDefaultArmourBoost() * getHealthBoostModifierForBiome(biome), + 1)); + map.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 196312 + /** Random number **/ + , armorType), + "Damage modifier" + armorType, + getDefaultArmourBoost() * getDamageModifierForBiome(biome), + 1)); + } + return map; + } + + public float getDefaultArmourBoost() { + switch (this.armorType) { + case 0: + return 2.5f; + case 1: + return 4; + case 2: + return 3.5f; + case 3: + return 2; + } + return 0.25f; + } + + public float getHealthBoostModifierForBiome(BiomeGenBase biome) { + float modifier = 0.05f; + + if (biome.isEqualTo(BiomeGenBase.hell)) { + return modifier * 2.0f; + } + + if (biome.isEqualTo(BiomeGenBase.ocean)) { + return modifier * -0.5f; + } + + if (biome.temperature >= 1) { + return modifier * 1.5f; + } + + return modifier * 0.5f; + } + + public float getDamageModifierForBiome(BiomeGenBase biome) { + float modifier = 0.03f; + + if (biome.isEqualTo(BiomeGenBase.hell)) { + return modifier * 2.0f; + } + + if (biome.isEqualTo(BiomeGenBase.ocean)) { + return modifier * -0.5f; + } + + if (biome.temperature >= 1) { + return modifier * 1.5f; + } + + return modifier * 0.5f; } - - public float getDefaultArmourBoost() - { - switch(this.armorType) - { - case 0: - return 2.5f; - case 1: - return 4; - case 2: - return 3.5f; - case 3: - return 2; - } - return 0.25f; - } - - public float getHealthBoostModifierForBiome(BiomeGenBase biome) - { - float modifier = 0.05f; - - if(biome.isEqualTo(BiomeGenBase.hell)) - { - return modifier * 2.0f; - } - - if(biome.isEqualTo(BiomeGenBase.ocean)) - { - return modifier * -0.5f; - } - - if(biome.temperature >= 1) - { - return modifier * 1.5f; - } - - return modifier * 0.5f; - } - - public float getDamageModifierForBiome(BiomeGenBase biome) - { - float modifier = 0.03f; - - if(biome.isEqualTo(BiomeGenBase.hell)) - { - return modifier * 2.0f; - } - - if(biome.isEqualTo(BiomeGenBase.ocean)) - { - return modifier * -0.5f; - } - - if(biome.temperature >= 1) - { - return modifier * 1.5f; - } - - return modifier * 0.5f; - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWater.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWater.java index 6afb527a..60b7bdc2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWater.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWater.java @@ -1,12 +1,12 @@ package WayofTime.alchemicalWizardry.common.items.armour; -import java.util.UUID; - +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWater; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.UUID; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -15,154 +15,150 @@ import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.biome.BiomeGenBase; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWater; -public class OmegaArmourWater extends OmegaArmour -{ - @SideOnly(Side.CLIENT) - private IIcon helmetIcon; - @SideOnly(Side.CLIENT) - private IIcon plateIcon; - @SideOnly(Side.CLIENT) - private IIcon leggingsIcon; - @SideOnly(Side.CLIENT) - private IIcon bootsIcon; - - public OmegaArmourWater(int armorType) - { - super(armorType); - this.storeBiomeID = true; - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - return "alchemicalwizardry:models/armor/OmegaWater.png"; - } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getChestModel() - { - return new ModelOmegaWater(1.0f, true, true, false, true); - } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getLegsModel() - { - return new ModelOmegaWater(0.5f, false, false, true, false); - } - - @Override +public class OmegaArmourWater extends OmegaArmour { @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + private IIcon helmetIcon; + + @SideOnly(Side.CLIENT) + private IIcon plateIcon; + + @SideOnly(Side.CLIENT) + private IIcon leggingsIcon; + + @SideOnly(Side.CLIENT) + private IIcon bootsIcon; + + public OmegaArmourWater(int armorType) { + super(armorType); + this.storeBiomeID = true; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return "alchemicalwizardry:models/armor/OmegaWater.png"; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getChestModel() { + return new ModelOmegaWater(1.0f, true, true, false, true); + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getLegsModel() { + return new ModelOmegaWater(0.5f, false, false, true, false); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaHelmet_water"); this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaPlate_water"); this.leggingsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaLeggings_water"); this.bootsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaBoots_water"); } - - @Override + + @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (this.equals(ModItems.boundHelmetWater)) - { + public IIcon getIconFromDamage(int par1) { + if (this.equals(ModItems.boundHelmetWater)) { return this.helmetIcon; } - if (this.equals(ModItems.boundPlateWater)) - { + if (this.equals(ModItems.boundPlateWater)) { return this.plateIcon; } - if (this.equals(ModItems.boundLeggingsWater)) - { + if (this.equals(ModItems.boundLeggingsWater)) { return this.leggingsIcon; } - if (this.equals(ModItems.boundBootsWater)) - { + if (this.equals(ModItems.boundBootsWater)) { return this.bootsIcon; } return this.itemIcon; } - - @Override - public Multimap getAttributeModifiers(ItemStack stack) - { - Multimap map = HashMultimap.create(); - int biomeID = this.getBiomeIDStored(stack); - BiomeGenBase biome = BiomeGenBase.getBiome(biomeID); - if(biome != null) - { - map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85312 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForBiome(biome), 2)); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85432 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForBiome(biome), 2)); - } - return map; + + @Override + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap map = HashMultimap.create(); + int biomeID = this.getBiomeIDStored(stack); + BiomeGenBase biome = BiomeGenBase.getBiome(biomeID); + if (biome != null) { + map.put( + SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 85312 + /** Random number **/ + , armorType), + "Health modifier" + armorType, + getDefaultArmourBoost() * getHealthBoostModifierForBiome(biome), + 2)); + map.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 85432 + /** Random number **/ + , armorType), + "Damage modifier" + armorType, + getDefaultArmourBoost() * getDamageModifierForBiome(biome), + 2)); + } + return map; + } + + public float getDefaultArmourBoost() { + switch (this.armorType) { + case 0: + return 2.5f; + case 1: + return 4; + case 2: + return 3.5f; + case 3: + return 2; + } + return 0.25f; + } + + public float getHealthBoostModifierForBiome(BiomeGenBase biome) { + float modifier = 0.05f; + if (biome.isEqualTo(BiomeGenBase.hell)) { + return modifier * -0.5f; + } + + if (biome.isEqualTo(BiomeGenBase.ocean) || biome.isEqualTo(BiomeGenBase.river)) { + return modifier * 2.0f; + } + + if (biome.isHighHumidity()) { + return modifier * 1.5f; + } + + return modifier * 0.5f; + } + + public float getDamageModifierForBiome(BiomeGenBase biome) { + float modifier = 0.03f; + + if (biome.isEqualTo(BiomeGenBase.hell)) { + return modifier * -0.5f; + } + + if (biome.isEqualTo(BiomeGenBase.ocean) || biome.isEqualTo(BiomeGenBase.river)) { + return modifier * 2.0f; + } + + if (biome.isHighHumidity()) { + return modifier * 1.5f; + } + + return modifier * 0.5f; } - - public float getDefaultArmourBoost() - { - switch(this.armorType) - { - case 0: - return 2.5f; - case 1: - return 4; - case 2: - return 3.5f; - case 3: - return 2; - } - return 0.25f; - } - - public float getHealthBoostModifierForBiome(BiomeGenBase biome) - { - float modifier = 0.05f; - if(biome.isEqualTo(BiomeGenBase.hell)) - { - return modifier * -0.5f; - } - - if(biome.isEqualTo(BiomeGenBase.ocean) || biome.isEqualTo(BiomeGenBase.river)) - { - return modifier * 2.0f; - } - - if(biome.isHighHumidity()) - { - return modifier * 1.5f; - } - - return modifier * 0.5f; - } - - public float getDamageModifierForBiome(BiomeGenBase biome) - { - float modifier = 0.03f; - - if(biome.isEqualTo(BiomeGenBase.hell)) - { - return modifier * -0.5f; - } - - if(biome.isEqualTo(BiomeGenBase.ocean) || biome.isEqualTo(BiomeGenBase.river)) - { - return modifier * 2.0f; - } - - if(biome.isHighHumidity()) - { - return modifier * 1.5f; - } - - return modifier * 0.5f; - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java index 1048d1c4..b5432707 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java @@ -1,7 +1,12 @@ package WayofTime.alchemicalWizardry.common.items.armour; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWind; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.UUID; - import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -9,124 +14,121 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWind; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class OmegaArmourWind extends OmegaArmour -{ - @SideOnly(Side.CLIENT) - private IIcon helmetIcon; - @SideOnly(Side.CLIENT) - private IIcon plateIcon; - @SideOnly(Side.CLIENT) - private IIcon leggingsIcon; - @SideOnly(Side.CLIENT) - private IIcon bootsIcon; - - public OmegaArmourWind(int armorType) - { - super(armorType); - this.storeYLevel = true; - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - return "alchemicalwizardry:models/armor/OmegaWind.png"; - } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getChestModel() - { - return new ModelOmegaWind(1.0f, true, true, false, true); - } - - @Override - @SideOnly(Side.CLIENT) - public ModelBiped getLegsModel() - { - return new ModelOmegaWind(0.5f, false, false, true, false); - } - - @Override +public class OmegaArmourWind extends OmegaArmour { @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + private IIcon helmetIcon; + + @SideOnly(Side.CLIENT) + private IIcon plateIcon; + + @SideOnly(Side.CLIENT) + private IIcon leggingsIcon; + + @SideOnly(Side.CLIENT) + private IIcon bootsIcon; + + public OmegaArmourWind(int armorType) { + super(armorType); + this.storeYLevel = true; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return "alchemicalwizardry:models/armor/OmegaWind.png"; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getChestModel() { + return new ModelOmegaWind(1.0f, true, true, false, true); + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getLegsModel() { + return new ModelOmegaWind(0.5f, false, false, true, false); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaHelmet_wind"); this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaPlate_wind"); this.leggingsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaLeggings_wind"); this.bootsIcon = iconRegister.registerIcon("AlchemicalWizardry:OmegaBoots_wind"); } - - @Override + + @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (this.equals(ModItems.boundHelmetWind)) - { + public IIcon getIconFromDamage(int par1) { + if (this.equals(ModItems.boundHelmetWind)) { return this.helmetIcon; } - if (this.equals(ModItems.boundPlateWind)) - { + if (this.equals(ModItems.boundPlateWind)) { return this.plateIcon; } - if (this.equals(ModItems.boundLeggingsWind)) - { + if (this.equals(ModItems.boundLeggingsWind)) { return this.leggingsIcon; } - if (this.equals(ModItems.boundBootsWind)) - { + if (this.equals(ModItems.boundBootsWind)) { return this.bootsIcon; } return this.itemIcon; } - - @Override - public Multimap getAttributeModifiers(ItemStack stack) - { - Multimap map = HashMultimap.create(); - int yLevel = this.getYLevelStored(stack); - map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForLevel(yLevel), 1)); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(86212 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForLevel(yLevel), 2)); - - return map; + + @Override + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap map = HashMultimap.create(); + int yLevel = this.getYLevelStored(stack); + map.put( + SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 85212 + /** Random number **/ + , armorType), + "Health modifier" + armorType, + getDefaultArmourBoost() * getHealthBoostModifierForLevel(yLevel), + 1)); + map.put( + SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier( + new UUID( + 86212 + /** Random number **/ + , armorType), + "Damage modifier" + armorType, + getDefaultArmourBoost() * getDamageModifierForLevel(yLevel), + 2)); + + return map; + } + + public float getDefaultArmourBoost() { + switch (this.armorType) { + case 0: + return 2.5f; + case 1: + return 4; + case 2: + return 3.5f; + case 3: + return 2; + } + return 0.25f; + } + + public float getHealthBoostModifierForLevel(int yLevel) { + return 0.05f * ((((float) Math.min(yLevel, 255)) / 64f) * 1.5f - 1); + } + + public float getDamageModifierForLevel(int yLevel) { + return 0.02f * ((((float) Math.min(yLevel, 255)) / 64f) * 1.5f - 1); } - - public float getDefaultArmourBoost() - { - switch(this.armorType) - { - case 0: - return 2.5f; - case 1: - return 4; - case 2: - return 3.5f; - case 3: - return 2; - } - return 0.25f; - } - - public float getHealthBoostModifierForLevel(int yLevel) - { - return 0.05f * ((((float)Math.min(yLevel, 255))/64f) * 1.5f - 1); - } - - public float getDamageModifierForLevel(int yLevel) - { - return 0.02f * ((((float)Math.min(yLevel, 255))/64f) * 1.5f - 1); - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java index a583a0ee..d4f782a8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java @@ -7,6 +7,8 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.LinkedList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -21,18 +23,13 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.LinkedList; -import java.util.List; - -public class ItemAttunedCrystal extends Item implements IReagentManipulator -{ +public class ItemAttunedCrystal extends Item implements IReagentManipulator { public static final int maxDistance = 6; public IIcon crystalBody; public IIcon crystalLabel; - public ItemAttunedCrystal() - { + public ItemAttunedCrystal() { super(); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.hasSubtypes = true; @@ -40,14 +37,12 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator } @Override - public String getItemStackDisplayName(ItemStack stack) - { + public String getItemStackDisplayName(ItemStack stack) { Reagent reagent = this.getReagent(stack); String name = super.getItemStackDisplayName(stack); - if (reagent != null) - { + if (reagent != null) { name = name + " (" + reagent.name + ")"; } @@ -55,50 +50,46 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator } @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.attunedcrystal.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.attunedcrystal.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { Reagent reagent = this.getReagent(par1ItemStack); - if (reagent != null) - { + if (reagent != null) { par3List.add(StatCollector.translateToLocal("tooltip.reagent.selectedreagent") + " " + reagent.name); } - if (this.getHasSavedCoordinates(par1ItemStack)) - { + if (this.getHasSavedCoordinates(par1ItemStack)) { par3List.add(""); Int3 coords = this.getCoordinates(par1ItemStack); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + coords.xCoord + ", " + coords.yCoord + ", " + coords.zCoord); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimension(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + coords.xCoord + ", " + + coords.yCoord + ", " + coords.zCoord); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + + getDimension(par1ItemStack)); } } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.crystalBody = iconRegister.registerIcon("AlchemicalWizardry:AttunedCrystal1"); this.crystalLabel = iconRegister.registerIcon("AlchemicalWizardry:AttunedCrystal2"); } @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - switch (pass) - { + public int getColorFromItemStack(ItemStack stack, int pass) { + switch (pass) { case 0: return 256 * (256 * 255 + 255) + 255; case 1: Reagent reagent = this.getReagent(stack); - if (reagent != null) - { - return (reagent.getColourRed() * 256 * 256 + reagent.getColourGreen() * 256 + reagent.getColourBlue()); + if (reagent != null) { + return (reagent.getColourRed() * 256 * 256 + + reagent.getColourGreen() * 256 + + reagent.getColourBlue()); } break; } @@ -108,24 +99,20 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return true; } @Override @SideOnly(Side.CLIENT) - public int getRenderPasses(int meta) - { + public int getRenderPasses(int meta) { return 2; } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int pass) - { - switch (pass) - { + public IIcon getIcon(ItemStack stack, int pass) { + switch (pass) { case 0: return this.crystalBody; case 1: @@ -135,57 +122,44 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator } @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 (player.isSneaking()) - { + if (movingobjectposition == null) { + if (player.isSneaking()) { this.setHasSavedCoordinates(itemStack, false); player.addChatComponentMessage(new ChatComponentTranslation("message.attunedcrystal.clearing")); } 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 IReagentHandler)) - { + if (!(tile instanceof IReagentHandler)) { return itemStack; } IReagentHandler relay = (IReagentHandler) tile; - if (player.isSneaking()) - { + if (player.isSneaking()) { ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.UNKNOWN); - if (infos != null) - { + if (infos != null) { List reagentList = new LinkedList(); - for (ReagentContainerInfo info : infos) - { - if (info != null) - { + for (ReagentContainerInfo info : infos) { + if (info != null) { ReagentStack reagentStack = info.reagent; - if (reagentStack != null) - { + if (reagentStack != null) { Reagent reagent = reagentStack.reagent; - if (reagent != null) - { + if (reagent != null) { reagentList.add(reagent); } } @@ -194,8 +168,7 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator Reagent pastReagent = this.getReagent(itemStack); - if (reagentList.size() <= 0) - { + if (reagentList.size() <= 0) { return itemStack; } @@ -203,64 +176,59 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator reagentLocation = reagentList.indexOf(pastReagent); - if (reagentLocation == -1 || reagentLocation + 1 >= reagentList.size()) - { + if (reagentLocation == -1 || reagentLocation + 1 >= reagentList.size()) { this.setReagentWithNotification(itemStack, reagentList.get(0), player); - } else - { + } else { this.setReagentWithNotification(itemStack, reagentList.get(reagentLocation + 1), player); } } - } else - { - if (this.getHasSavedCoordinates(itemStack)) - { + } else { + if (this.getHasSavedCoordinates(itemStack)) { Int3 coords = this.getCoordinates(itemStack); int dimension = this.getDimension(itemStack); - if (coords == null) - { + if (coords == null) { return itemStack; } - if (dimension != world.provider.dimensionId || Math.abs(coords.xCoord - x) > maxDistance || Math.abs(coords.yCoord - y) > maxDistance || Math.abs(coords.zCoord - z) > maxDistance) - { - player.addChatComponentMessage(new ChatComponentTranslation("message.attunedcrystal.error.toofar")); + if (dimension != world.provider.dimensionId + || Math.abs(coords.xCoord - x) > maxDistance + || Math.abs(coords.yCoord - y) > maxDistance + || Math.abs(coords.zCoord - z) > maxDistance) { + player.addChatComponentMessage( + new ChatComponentTranslation("message.attunedcrystal.error.toofar")); return itemStack; } TileEntity pastTile = world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord); - if (!(pastTile instanceof TEReagentConduit)) - { - player.addChatComponentMessage(new ChatComponentTranslation("message.attunedcrystal.error.cannotfind")); + if (!(pastTile instanceof TEReagentConduit)) { + player.addChatComponentMessage( + new ChatComponentTranslation("message.attunedcrystal.error.cannotfind")); return itemStack; } Reagent reagent = this.getReagent(itemStack); - if (reagent == null) - { + if (reagent == null) { return itemStack; } TEReagentConduit pastRelay = (TEReagentConduit) pastTile; - if (player.isSneaking()) - { + if (player.isSneaking()) { pastRelay.removeReagentDestinationViaActual(reagent, x, y, z); - } else - { - if (pastRelay.addReagentDestinationViaActual(reagent, x, y, z)) - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.attunedcrystal.linked") + " " + reagent.name)); - } else - { - player.addChatComponentMessage(new ChatComponentTranslation("message.attunedcrystal.error.noconnections")); + } else { + if (pastRelay.addReagentDestinationViaActual(reagent, x, y, z)) { + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.attunedcrystal.linked") + " " + + reagent.name)); + } else { + player.addChatComponentMessage( + new ChatComponentTranslation("message.attunedcrystal.error.noconnections")); } } world.markBlockForUpdate(coords.xCoord, coords.yCoord, coords.zCoord); - } else - { + } else { int dimension = world.provider.dimensionId; this.setDimension(itemStack, dimension); @@ -275,10 +243,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator return itemStack; } - public void setCoordinates(ItemStack stack, Int3 coords) - { - if (!stack.hasTagCompound()) - { + public void setCoordinates(ItemStack stack, Int3 coords) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -289,10 +255,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator this.setHasSavedCoordinates(stack, true); } - public void setDimension(ItemStack stack, int dimension) - { - if (!stack.hasTagCompound()) - { + public void setDimension(ItemStack stack, int dimension) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -301,10 +265,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator tag.setInteger("dimension", dimension); } - public Int3 getCoordinates(ItemStack stack) - { - if (!stack.hasTagCompound()) - { + public Int3 getCoordinates(ItemStack stack) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -313,10 +275,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator return Int3.readFromNBT(tag); } - public int getDimension(ItemStack stack) - { - if (!stack.hasTagCompound()) - { + public int getDimension(ItemStack stack) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -325,10 +285,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator return tag.getInteger("dimension"); } - public void setHasSavedCoordinates(ItemStack stack, boolean flag) - { - if (!stack.hasTagCompound()) - { + public void setHasSavedCoordinates(ItemStack stack, boolean flag) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -337,10 +295,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator tag.setBoolean("hasSavedCoordinates", flag); } - public boolean getHasSavedCoordinates(ItemStack stack) - { - if (!stack.hasTagCompound()) - { + public boolean getHasSavedCoordinates(ItemStack stack) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -349,10 +305,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator return tag.getBoolean("hasSavedCoordinates"); } - public Reagent getReagent(ItemStack stack) - { - if (!stack.hasTagCompound()) - { + public Reagent getReagent(ItemStack stack) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -361,10 +315,8 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator return ReagentRegistry.getReagentForKey(tag.getString("reagent")); } - public void setReagent(ItemStack stack, Reagent reagent) - { - if (!stack.hasTagCompound()) - { + public void setReagent(ItemStack stack, Reagent reagent) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -373,13 +325,12 @@ public class ItemAttunedCrystal extends Item implements IReagentManipulator tag.setString("reagent", ReagentRegistry.getKeyForReagent(reagent)); } - public void setReagentWithNotification(ItemStack stack, Reagent reagent, EntityPlayer player) - { + public void setReagentWithNotification(ItemStack stack, Reagent reagent, EntityPlayer player) { this.setReagent(stack, reagent); - if (reagent != null) - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.attunedcrystal.setto") + " " + reagent.name)); + if (reagent != null) { + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.attunedcrystal.setto") + " " + reagent.name)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemDestinationClearer.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemDestinationClearer.java index d4642a7f..b94cfef2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemDestinationClearer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemDestinationClearer.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; 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.Item; @@ -15,12 +16,8 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class ItemDestinationClearer extends Item implements IReagentManipulator -{ - public ItemDestinationClearer() - { +public class ItemDestinationClearer extends Item implements IReagentManipulator { + public ItemDestinationClearer() { super(); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.maxStackSize = 1; @@ -28,43 +25,35 @@ public class ItemDestinationClearer extends Item implements IReagentManipulator @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:TankClearer"); } @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.destclearer.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.destclearer.desc2")); } @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 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 TEReagentConduit)) - { + if (!(tile instanceof TEReagentConduit)) { return itemStack; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java index 83bbbd6b..af82599f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java @@ -5,6 +5,8 @@ import WayofTime.alchemicalWizardry.api.alchemy.energy.*; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.LinkedList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -18,18 +20,14 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.LinkedList; -import java.util.List; - -public class ItemTankSegmenter extends Item implements IReagentManipulator -{ +public class ItemTankSegmenter extends Item implements IReagentManipulator { @SideOnly(Side.CLIENT) public IIcon crystalBody; + @SideOnly(Side.CLIENT) public IIcon crystalLabel; - public ItemTankSegmenter() - { + public ItemTankSegmenter() { super(); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.hasSubtypes = true; @@ -37,28 +35,23 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator } @Override - public String getItemStackDisplayName(ItemStack stack) - { + public String getItemStackDisplayName(ItemStack stack) { Reagent reagent = this.getReagent(stack); String name = super.getItemStackDisplayName(stack); - if (reagent != null) - { + if (reagent != null) { name = name + " (" + reagent.name + ")"; } return name; } @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.tanksegmenter.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.tanksegmenter.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { Reagent reagent = this.getReagent(par1ItemStack); - if (reagent != null) - { + if (reagent != null) { par3List.add(StatCollector.translateToLocal("tooltip.reagent.selectedreagent") + " " + reagent.name); } } @@ -66,25 +59,23 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.crystalBody = iconRegister.registerIcon("AlchemicalWizardry:TankSegmenter1"); this.crystalLabel = iconRegister.registerIcon("AlchemicalWizardry:TankSegmenter2"); } @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - switch (pass) - { + public int getColorFromItemStack(ItemStack stack, int pass) { + switch (pass) { case 0: return 256 * (256 * 255 + 255) + 255; case 1: Reagent reagent = this.getReagent(stack); - if (reagent != null) - { - return (reagent.getColourRed() * 256 * 256 + reagent.getColourGreen() * 256 + reagent.getColourBlue()); + if (reagent != null) { + return (reagent.getColourRed() * 256 * 256 + + reagent.getColourGreen() * 256 + + reagent.getColourBlue()); } break; } @@ -94,24 +85,20 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return true; } @Override @SideOnly(Side.CLIENT) - public int getRenderPasses(int meta) - { + public int getRenderPasses(int meta) { return 2; } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int pass) - { - switch (pass) - { + public IIcon getIcon(ItemStack stack, int pass) { + switch (pass) { case 0: return this.crystalBody; case 1: @@ -121,47 +108,35 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator } @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 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 ISegmentedReagentHandler)) - { + if (!(tile instanceof ISegmentedReagentHandler)) { return itemStack; } ISegmentedReagentHandler reagentHandler = (ISegmentedReagentHandler) tile; - if (player.isSneaking()) - { + if (player.isSneaking()) { ReagentContainerInfo[] infos = reagentHandler.getContainerInfo(ForgeDirection.UNKNOWN); - if (infos != null) - { + if (infos != null) { List reagentList = new LinkedList(); - for (ReagentContainerInfo info : infos) - { - if (info != null) - { + for (ReagentContainerInfo info : infos) { + if (info != null) { ReagentStack reagentStack = info.reagent; - if (reagentStack != null) - { + if (reagentStack != null) { Reagent reagent = reagentStack.reagent; - if (reagent != null) - { + if (reagent != null) { reagentList.add(reagent); } } @@ -170,57 +145,49 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator Reagent pastReagent = this.getReagent(itemStack); boolean goForNext = false; boolean hasFound = false; - for (Reagent reagent : reagentList) - { - if (goForNext) - { + for (Reagent reagent : reagentList) { + if (goForNext) { goForNext = false; break; } - if (reagent == pastReagent) - { + if (reagent == pastReagent) { goForNext = true; hasFound = true; } } - if (hasFound) - { - if (goForNext) - { + if (hasFound) { + if (goForNext) { this.setReagentWithNotification(itemStack, reagentList.get(0), player); } - } else - { - if (reagentList.size() >= 1) - { + } else { + if (reagentList.size() >= 1) { this.setReagentWithNotification(itemStack, reagentList.get(0), player); } } } - } else - { + } else { Reagent reagent = this.getReagent(itemStack); - if (reagent == null) - { - //TODO: Send message that "All are wiped" + if (reagent == null) { + // TODO: Send message that "All are wiped" reagentHandler.getAttunedTankMap().clear(); return itemStack; } int totalTankSize = reagentHandler.getNumberOfTanks(); int numberAssigned = reagentHandler.getTanksTunedToReagent(reagent) + 1; - if (numberAssigned > totalTankSize) - { + if (numberAssigned > totalTankSize) { numberAssigned = 0; } - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.tanksegmenter.nowhas") + " " + numberAssigned + " " + StatCollector.translateToLocal("message.tanksegmenter.tankssetto") + " " + reagent.name)); + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.tanksegmenter.nowhas") + " " + numberAssigned + " " + + StatCollector.translateToLocal("message.tanksegmenter.tankssetto") + " " + + reagent.name)); reagentHandler.setTanksTunedToReagent(reagent, numberAssigned); } - } else if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) - { + } else if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { this.setReagent(itemStack, null); } } @@ -228,10 +195,8 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator return itemStack; } - public Reagent getReagent(ItemStack stack) - { - if (!stack.hasTagCompound()) - { + public Reagent getReagent(ItemStack stack) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -240,10 +205,8 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator return ReagentRegistry.getReagentForKey(tag.getString("reagent")); } - public void setReagent(ItemStack stack, Reagent reagent) - { - if (!stack.hasTagCompound()) - { + public void setReagent(ItemStack stack, Reagent reagent) { + if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } @@ -252,13 +215,12 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator tag.setString("reagent", ReagentRegistry.getKeyForReagent(reagent)); } - public void setReagentWithNotification(ItemStack stack, Reagent reagent, EntityPlayer player) - { + public void setReagentWithNotification(ItemStack stack, Reagent reagent, EntityPlayer player) { this.setReagent(stack, reagent); - if (reagent != null) - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.tanksegmenter.setto") + " " + reagent.name)); + if (reagent != null) { + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.tanksegmenter.setto") + " " + reagent.name)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/forestry/ItemBloodFrame.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/forestry/ItemBloodFrame.java index b8b156fa..c6a0bb11 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/forestry/ItemBloodFrame.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/forestry/ItemBloodFrame.java @@ -1,24 +1,21 @@ package WayofTime.alchemicalWizardry.common.items.forestry; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.*; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemBloodFrame extends EnergyItems implements IHiveFrame -{ +public class ItemBloodFrame extends EnergyItems implements IHiveFrame { private final IBeeModifier beeModifier = new BloodFrameBeeModifier(); - public ItemBloodFrame() - { + public ItemBloodFrame() { super(); this.maxStackSize = 1; this.setMaxDamage(10); @@ -80,33 +77,27 @@ public class ItemBloodFrame extends EnergyItems implements IHiveFrame } @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.bloodframe.desc")); - 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")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodFrame"); } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) - { - if (par1ItemStack.getItemDamage() > 0) - { - if(EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { + if (par1ItemStack.getItemDamage() > 0) { + if (EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java index 27ac77f7..8b4a4a92 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java @@ -5,6 +5,11 @@ import WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper; import com.google.common.collect.HashMultimap; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -24,16 +29,8 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public class AlchemyFlask extends Item -{ - public AlchemyFlask() - { +public class AlchemyFlask extends Item { + public AlchemyFlask() { super(); this.setMaxDamage(8); this.setMaxStackSize(1); @@ -42,89 +39,72 @@ public class AlchemyFlask extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:PotionFlask"); } - public static ArrayList getEffects(ItemStack par1ItemStack) - { - if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("CustomFlaskEffects")) - { + public static ArrayList getEffects(ItemStack par1ItemStack) { + if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("CustomFlaskEffects")) { ArrayList arraylist = new ArrayList(); - NBTTagList nbttaglist = par1ItemStack.getTagCompound().getTagList("CustomFlaskEffects", Constants.NBT.TAG_COMPOUND); + NBTTagList nbttaglist = + par1ItemStack.getTagCompound().getTagList("CustomFlaskEffects", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < nbttaglist.tagCount(); ++i) - { + for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); arraylist.add(AlchemyPotionHelper.readEffectFromNBT(nbttagcompound)); } return arraylist; - } else - { + } else { return null; } } - public static ArrayList getPotionEffects(ItemStack par1ItemStack) - { + public static ArrayList getPotionEffects(ItemStack par1ItemStack) { ArrayList list = AlchemyFlask.getEffects(par1ItemStack); - if (list != null) - { + if (list != null) { ArrayList newList = new ArrayList(); - for (AlchemyPotionHelper aph : list) - { + for (AlchemyPotionHelper aph : list) { newList.add(aph.getPotionEffect()); } return newList; - } else - { + } else { return null; } } - public static void setEffects(ItemStack par1ItemStack, List list) - { + public static void setEffects(ItemStack par1ItemStack, List list) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null) - { + if (itemTag == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagList nbttaglist = new NBTTagList(); - for (AlchemyPotionHelper aph : list) - { + for (AlchemyPotionHelper aph : list) { nbttaglist.appendTag(AlchemyPotionHelper.setEffectToNBT(aph)); } par1ItemStack.getTagCompound().setTag("CustomFlaskEffects", nbttaglist); } - public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() + 1); } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { ArrayList list = getEffects(par1ItemStack); - if (list != null) - { - for (AlchemyPotionHelper aph : list) - { + if (list != null) { + for (AlchemyPotionHelper aph : list) { PotionEffect pe = aph.getPotionEffect(); - if (pe != null) - { - //if(pe.get) + if (pe != null) { + // if(pe.get) par3EntityPlayer.addPotionEffect(pe); } } @@ -137,18 +117,15 @@ public class AlchemyFlask extends Item /** * How long it takes to use or consume an item */ - public int getMaxItemUseDuration(ItemStack par1ItemStack) - { + public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 32; } /** * returns the action that specifies what animation to play when the items is being used */ - public EnumAction getItemUseAction(ItemStack par1ItemStack) - { - if (this.isPotionThrowable(par1ItemStack)) - { + public EnumAction getItemUseAction(ItemStack par1ItemStack) { + if (this.isPotionThrowable(par1ItemStack)) { return EnumAction.none; } @@ -158,18 +135,13 @@ public class AlchemyFlask extends Item /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (par1ItemStack.getItemDamage() < par1ItemStack.getMaxDamage()) - { - if (this.isPotionThrowable(par1ItemStack)) - { - if (!par2World.isRemote) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (par1ItemStack.getItemDamage() < par1ItemStack.getMaxDamage()) { + if (this.isPotionThrowable(par1ItemStack)) { + if (!par2World.isRemote) { EntityPotion entityPotion = this.getEntityPotion(par1ItemStack, par2World, par3EntityPlayer); - if (entityPotion != null) - { + if (entityPotion != null) { float velocityChange = 2.0f; entityPotion.motionX *= velocityChange; entityPotion.motionY *= velocityChange; @@ -187,15 +159,11 @@ public class AlchemyFlask extends Item return par1ItemStack; } - public void setConcentrationOfPotion(ItemStack par1ItemStack, int potionID, int concentration) - { + public void setConcentrationOfPotion(ItemStack par1ItemStack, int potionID, int concentration) { ArrayList list = getEffects(par1ItemStack); - if (list != null) - { - for (AlchemyPotionHelper aph : list) - { - if (aph.getPotionID() == potionID) - { + if (list != null) { + for (AlchemyPotionHelper aph : list) { + if (aph.getPotionID() == potionID) { aph.setConcentration(concentration); break; } @@ -204,15 +172,11 @@ public class AlchemyFlask extends Item } } - public void setDurationFactorOfPotion(ItemStack par1ItemStack, int potionID, int durationFactor) - { + public void setDurationFactorOfPotion(ItemStack par1ItemStack, int potionID, int durationFactor) { ArrayList list = getEffects(par1ItemStack); - if (list != null) - { - for (AlchemyPotionHelper aph : list) - { - if (aph.getPotionID() == potionID) - { + if (list != null) { + for (AlchemyPotionHelper aph : list) { + if (aph.getPotionID() == potionID) { aph.setDurationFactor(durationFactor); break; } @@ -221,39 +185,30 @@ public class AlchemyFlask extends Item } } - public boolean hasPotionEffect(ItemStack par1ItemStack, int potionID) - { + public boolean hasPotionEffect(ItemStack par1ItemStack, int potionID) { return false; } - public int getNumberOfPotionEffects(ItemStack par1ItemStack) - { - if (getEffects(par1ItemStack) != null) - { + public int getNumberOfPotionEffects(ItemStack par1ItemStack) { + if (getEffects(par1ItemStack) != null) { return getEffects(par1ItemStack).size(); - } else - { + } else { return 0; } } - public boolean addPotionEffect(ItemStack par1ItemStack, int potionID, int tickDuration) - { + public boolean addPotionEffect(ItemStack par1ItemStack, int potionID, int tickDuration) { ArrayList list = getEffects(par1ItemStack); - if (list != null) - { - for (AlchemyPotionHelper aph : list) - { - if (aph.getPotionID() == potionID) - { + if (list != null) { + for (AlchemyPotionHelper aph : list) { + if (aph.getPotionID() == potionID) { return false; } } list.add(new AlchemyPotionHelper(potionID, tickDuration, 0, 0)); setEffects(par1ItemStack, list); return true; - } else - { + } else { list = new ArrayList(); list.add(new AlchemyPotionHelper(potionID, tickDuration, 0, 0)); setEffects(par1ItemStack, list); @@ -261,12 +216,11 @@ public class AlchemyFlask extends Item } } - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemyflask.swigsleft") + " " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemyflask.swigsleft") + " " + + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); - if (this.isPotionThrowable(par1ItemStack)) - { + if (this.isPotionThrowable(par1ItemStack)) { par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemyflask.caution")); } @@ -274,115 +228,111 @@ public class AlchemyFlask extends Item HashMultimap hashmultimap = HashMultimap.create(); Iterator iterator; - if (list1 != null && !list1.isEmpty()) - { + if (list1 != null && !list1.isEmpty()) { iterator = list1.iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { PotionEffect potioneffect = (PotionEffect) iterator.next(); - String s = StatCollector.translateToLocal(potioneffect.getEffectName()).trim(); + String s = StatCollector.translateToLocal(potioneffect.getEffectName()) + .trim(); Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; Map map = potion.func_111186_k(); - if (map != null && map.size() > 0) - { + if (map != null && map.size() > 0) { Iterator iterator1 = map.entrySet().iterator(); - while (iterator1.hasNext()) - { + while (iterator1.hasNext()) { Entry entry = (Entry) iterator1.next(); AttributeModifier attributemodifier = (AttributeModifier) entry.getValue(); - AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation()); - hashmultimap.put(((IAttribute) entry.getKey()).getAttributeUnlocalizedName(), attributemodifier1); + AttributeModifier attributemodifier1 = new AttributeModifier( + attributemodifier.getName(), + potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), + attributemodifier.getOperation()); + hashmultimap.put( + ((IAttribute) entry.getKey()).getAttributeUnlocalizedName(), attributemodifier1); } } - if (potioneffect.getAmplifier() > 0) - { - s = s + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim(); + if (potioneffect.getAmplifier() > 0) { + s = s + " " + + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()) + .trim(); } - if (potioneffect.getDuration() > 20) - { + if (potioneffect.getDuration() > 20) { s = s + " (" + Potion.getDurationString(potioneffect) + ")"; } - if (potion.isBadEffect()) - { + if (potion.isBadEffect()) { par3List.add(EnumChatFormatting.RED + s); - } else - { + } else { par3List.add(EnumChatFormatting.GRAY + s); } } - } else - { + } else { String s1 = StatCollector.translateToLocal("potion.empty").trim(); par3List.add(EnumChatFormatting.GRAY + s1); } - if (!hashmultimap.isEmpty()) - { + if (!hashmultimap.isEmpty()) { par3List.add(""); par3List.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank")); iterator = hashmultimap.entries().iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { Entry entry1 = (Entry) iterator.next(); AttributeModifier attributemodifier2 = (AttributeModifier) entry1.getValue(); double d0 = attributemodifier2.getAmount(); double d1; - if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2) - { + if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2) { d1 = attributemodifier2.getAmount(); - } else - { + } else { d1 = attributemodifier2.getAmount() * 100.0D; } - if (d0 > 0.0D) - { - par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[]{ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + (String) entry1.getKey())})); - } else if (d0 < 0.0D) - { + if (d0 > 0.0D) { + par3List.add(EnumChatFormatting.BLUE + + StatCollector.translateToLocalFormatted( + "attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[] { + ItemStack.field_111284_a.format(d1), + StatCollector.translateToLocal("attribute.name." + (String) entry1.getKey()) + })); + } else if (d0 < 0.0D) { d1 *= -1.0D; - par3List.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[]{ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + (String) entry1.getKey())})); + par3List.add(EnumChatFormatting.RED + + StatCollector.translateToLocalFormatted( + "attribute.modifier.take." + attributemodifier2.getOperation(), new Object[] { + ItemStack.field_111284_a.format(d1), + StatCollector.translateToLocal("attribute.name." + (String) entry1.getKey()) + })); } } } } - public boolean isPotionThrowable(ItemStack par1ItemStack) - { + public boolean isPotionThrowable(ItemStack par1ItemStack) { return par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().getBoolean("throwable"); } - public void setIsPotionThrowable(boolean flag, ItemStack par1ItemStack) - { - if (!par1ItemStack.hasTagCompound()) - { + public void setIsPotionThrowable(boolean flag, ItemStack par1ItemStack) { + if (!par1ItemStack.hasTagCompound()) { par1ItemStack.setTagCompound(new NBTTagCompound()); } par1ItemStack.getTagCompound().setBoolean("throwable", flag); } - public EntityPotion getEntityPotion(ItemStack par1ItemStack, World worldObj, EntityLivingBase entityLivingBase) - { + public EntityPotion getEntityPotion(ItemStack par1ItemStack, World worldObj, EntityLivingBase entityLivingBase) { ItemStack potionStack = new ItemStack(Items.potionitem, 1, 0); potionStack.setTagCompound(new NBTTagCompound()); ArrayList potionList = getPotionEffects(par1ItemStack); - if (potionList == null) - { + if (potionList == null) { return null; } NBTTagList nbttaglist = new NBTTagList(); - for (PotionEffect pe : potionList) - { + for (PotionEffect pe : potionList) { NBTTagCompound d = new NBTTagCompound(); d.setByte("Id", (byte) pe.getPotionID()); d.setByte("Amplifier", (byte) pe.getAmplifier()); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyReagent.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyReagent.java index 4f7caa72..2fb0c621 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyReagent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyReagent.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; 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.Item; @@ -13,12 +14,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; -import java.util.List; - -public class AlchemyReagent extends Item -{ - public AlchemyReagent() - { +public class AlchemyReagent extends Item { + public AlchemyReagent() { super(); setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setMaxStackSize(64); @@ -26,83 +23,68 @@ public class AlchemyReagent extends Item @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - if (this == ModItems.incendium) - { + public void registerIcons(IIconRegister iconRegister) { + if (this == ModItems.incendium) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Incendium"); return; } - if (this == ModItems.magicales) - { + if (this == ModItems.magicales) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Magicales"); return; } - if (this == ModItems.sanctus) - { + if (this == ModItems.sanctus) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Sanctus"); return; } - if (this == ModItems.aether) - { + if (this == ModItems.aether) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Aether"); return; } - if (this == ModItems.simpleCatalyst) - { + if (this == ModItems.simpleCatalyst) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleCatalyst"); return; } - if (this == ModItems.crepitous) - { + if (this == ModItems.crepitous) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Crepitous"); return; } - if (this == ModItems.crystallos) - { + if (this == ModItems.crystallos) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Crystallos"); return; } - if (this == ModItems.terrae) - { + if (this == ModItems.terrae) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Terrae"); return; } - if (this == ModItems.aquasalus) - { + if (this == ModItems.aquasalus) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Aquasalus"); return; } - if (this == ModItems.tennebrae) - { + if (this == ModItems.tennebrae) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:Tennebrae"); } } @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.alchemy.usedinalchemy")); - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { + if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack); - if (recipe != null) - { + if (recipe != null) { par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); - for (ItemStack item : recipe) - { - if (item != null) - { + for (ItemStack item : recipe) { + if (item != null) { par3List.add("" + item.getDisplayName()); } } } - } else - { - par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); + } else { + par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AverageLengtheningCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AverageLengtheningCatalyst.java index eb7885dd..882c771f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AverageLengtheningCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AverageLengtheningCatalyst.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class AverageLengtheningCatalyst extends LengtheningCatalyst -{ - public AverageLengtheningCatalyst() - { +public class AverageLengtheningCatalyst extends LengtheningCatalyst { + public AverageLengtheningCatalyst() { super(2); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AverageLengtheningCatalyst"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AveragePowerCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AveragePowerCatalyst.java index 1fb50aec..6b298d2d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AveragePowerCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/AveragePowerCatalyst.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class AveragePowerCatalyst extends PowerCatalyst -{ - public AveragePowerCatalyst() - { +public class AveragePowerCatalyst extends PowerCatalyst { + public AveragePowerCatalyst() { super(2); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AveragePowerCatalyst"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/CombinationalCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/CombinationalCatalyst.java index 071d7c9b..72e9388f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/CombinationalCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/CombinationalCatalyst.java @@ -7,18 +7,15 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; -public class CombinationalCatalyst extends Item implements ICombinationalCatalyst -{ - public CombinationalCatalyst() - { +public class CombinationalCatalyst extends Item implements ICombinationalCatalyst { + public CombinationalCatalyst() { super(); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:CombinationalCatalyst"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/EnhancedFillingAgent.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/EnhancedFillingAgent.java index b4026634..712f1f8e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/EnhancedFillingAgent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/EnhancedFillingAgent.java @@ -5,24 +5,19 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class EnhancedFillingAgent extends WeakFillingAgent -{ - public EnhancedFillingAgent() - { +public class EnhancedFillingAgent extends WeakFillingAgent { + public EnhancedFillingAgent() { super(); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override - public int getFilledAmountForPotionNumber(int potionEffects) - { - if (potionEffects == 0) - { + public int getFilledAmountForPotionNumber(int potionEffects) { + if (potionEffects == 0) { return 8; } { - switch (potionEffects) - { + switch (potionEffects) { case 1: return 6; @@ -44,8 +39,7 @@ public class EnhancedFillingAgent extends WeakFillingAgent @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:EnhancedFillingAgent"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterLengtheningCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterLengtheningCatalyst.java index 32d0e599..06931162 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterLengtheningCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterLengtheningCatalyst.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class GreaterLengtheningCatalyst extends LengtheningCatalyst -{ - public GreaterLengtheningCatalyst() - { +public class GreaterLengtheningCatalyst extends LengtheningCatalyst { + public GreaterLengtheningCatalyst() { super(3); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:GreaterLengtheningCatalyst"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterPowerCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterPowerCatalyst.java index 56dbe73f..cc2466e6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterPowerCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/GreaterPowerCatalyst.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class GreaterPowerCatalyst extends PowerCatalyst -{ - public GreaterPowerCatalyst() - { +public class GreaterPowerCatalyst extends PowerCatalyst { + public GreaterPowerCatalyst() { super(3); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:GreaterPowerCatalyst"); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/LengtheningCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/LengtheningCatalyst.java index 628ff26e..233c9855 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/LengtheningCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/LengtheningCatalyst.java @@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.potion; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.common.ICatalyst; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -10,54 +11,44 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; -import java.util.List; - -public class LengtheningCatalyst extends Item implements ICatalyst -{ +public class LengtheningCatalyst extends Item implements ICatalyst { private int catalystStrength; - public LengtheningCatalyst(int catalystStrength) - { + public LengtheningCatalyst(int catalystStrength) { this.catalystStrength = catalystStrength; setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override - public int getCatalystLevel() - { + public int getCatalystLevel() { return catalystStrength; } @Override - public boolean isConcentration() - { + public boolean isConcentration() { return false; } @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.alchemy.usedinalchemy")); - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { + if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack); - if (recipe != null) - { + if (recipe != null) { par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); - for (ItemStack item : recipe) - { - if (item != null) - { + for (ItemStack item : recipe) { + if (item != null) { par3List.add("" + item.getDisplayName()); } } } - } else - { - par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); + } else { + par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundaneLengtheningCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundaneLengtheningCatalyst.java index 581a4575..ee5571ab 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundaneLengtheningCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundaneLengtheningCatalyst.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class MundaneLengtheningCatalyst extends LengtheningCatalyst -{ - public MundaneLengtheningCatalyst() - { +public class MundaneLengtheningCatalyst extends LengtheningCatalyst { + public MundaneLengtheningCatalyst() { super(1); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MundaneLengtheningCatalyst"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundanePowerCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundanePowerCatalyst.java index 0a85efbe..f8cae7aa 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundanePowerCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/MundanePowerCatalyst.java @@ -4,17 +4,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class MundanePowerCatalyst extends PowerCatalyst -{ - public MundanePowerCatalyst() - { +public class MundanePowerCatalyst extends PowerCatalyst { + public MundanePowerCatalyst() { super(1); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MundanePowerCatalyst"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/PowerCatalyst.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/PowerCatalyst.java index fc965408..a4ef611c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/PowerCatalyst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/PowerCatalyst.java @@ -3,63 +3,53 @@ package WayofTime.alchemicalWizardry.common.items.potion; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.common.ICatalyst; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; - import org.lwjgl.input.Keyboard; -import java.util.List; - -public class PowerCatalyst extends Item implements ICatalyst -{ +public class PowerCatalyst extends Item implements ICatalyst { private int catalystStrength; - public PowerCatalyst(int catalystStrength) - { + public PowerCatalyst(int catalystStrength) { super(); this.catalystStrength = catalystStrength; setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override - public int getCatalystLevel() - { + public int getCatalystLevel() { return catalystStrength; } @Override - public boolean isConcentration() - { + public boolean isConcentration() { return true; } @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.alchemy.usedinalchemy")); - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { + if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack); - if (recipe != null) - { + if (recipe != null) { par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); - for (ItemStack item : recipe) - { - if (item != null) - { + for (ItemStack item : recipe) { + if (item != null) { par3List.add("" + item.getDisplayName()); } } } - } else - { - par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); + } else { + par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardBindingAgent.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardBindingAgent.java index 8c963024..ef27c36d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardBindingAgent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardBindingAgent.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.common.IBindingAgent; 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.Item; @@ -13,53 +14,43 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; -import java.util.List; - -public class StandardBindingAgent extends Item implements IBindingAgent -{ - public StandardBindingAgent() - { +public class StandardBindingAgent extends Item implements IBindingAgent { + public StandardBindingAgent() { super(); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override - public float getSuccessRateForPotionNumber(int potions) - { + public float getSuccessRateForPotionNumber(int potions) { return (float) Math.pow(0.65, potions); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:StandardBindingAgent"); } @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.alchemy.usedinalchemy")); - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { + if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack); - if (recipe != null) - { + if (recipe != null) { par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); - for (ItemStack item : recipe) - { - if (item != null) - { + for (ItemStack item : recipe) { + if (item != null) { par3List.add("" + item.getDisplayName()); } } } - } else - { - par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); + } else { + par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardFillingAgent.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardFillingAgent.java index c0a93be4..f60369a9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardFillingAgent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/StandardFillingAgent.java @@ -5,24 +5,19 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class StandardFillingAgent extends WeakFillingAgent -{ - public StandardFillingAgent() - { +public class StandardFillingAgent extends WeakFillingAgent { + public StandardFillingAgent() { super(); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override - public int getFilledAmountForPotionNumber(int potionEffects) - { - if (potionEffects == 0) - { + public int getFilledAmountForPotionNumber(int potionEffects) { + if (potionEffects == 0) { return 8; } - if (potionEffects >= 1 && potionEffects <= 3) - { + if (potionEffects >= 1 && potionEffects <= 3) { return (int) (4 * (Math.pow(0.5f, potionEffects - 1) + 0.01f)); } @@ -31,8 +26,7 @@ public class StandardFillingAgent extends WeakFillingAgent @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:StandardFillingAgent"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakBindingAgent.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakBindingAgent.java index 86c941e5..1cd0e1e9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakBindingAgent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakBindingAgent.java @@ -4,23 +4,19 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -public class WeakBindingAgent extends StandardBindingAgent -{ - public WeakBindingAgent() - { +public class WeakBindingAgent extends StandardBindingAgent { + public WeakBindingAgent() { super(); } @Override - public float getSuccessRateForPotionNumber(int potions) - { + public float getSuccessRateForPotionNumber(int potions) { return (float) Math.pow(0.4, potions); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WeakBindingAgent"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakFillingAgent.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakFillingAgent.java index d65b9e1c..cb425904 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakFillingAgent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/potion/WeakFillingAgent.java @@ -5,6 +5,8 @@ import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.common.IFillingAgent; 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.player.EntityPlayer; import net.minecraft.item.Item; @@ -13,34 +15,24 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; -import java.util.List; -import java.util.Random; - -public class WeakFillingAgent extends Item implements IFillingAgent -{ - public WeakFillingAgent() - { +public class WeakFillingAgent extends Item implements IFillingAgent { + public WeakFillingAgent() { super(); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @Override - public int getFilledAmountForPotionNumber(int potionEffects) - { + public int getFilledAmountForPotionNumber(int potionEffects) { Random rand = new Random(); - if (potionEffects == 0) - { + if (potionEffects == 0) { return 8; } - if (potionEffects == 1 || potionEffects == 2) - { - if (rand.nextFloat() > 0.5f) - { + if (potionEffects == 1 || potionEffects == 2) { + if (rand.nextFloat() > 0.5f) { return (4 - potionEffects); - } else - { + } else { return 3 - potionEffects; } } @@ -50,35 +42,30 @@ public class WeakFillingAgent extends Item implements IFillingAgent @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WeakFillingAgent"); } @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.alchemy.usedinalchemy")); - if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { + if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(par1ItemStack); - if (recipe != null) - { + if (recipe != null) { par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.recipe")); - for (ItemStack item : recipe) - { - if (item != null) - { + for (ItemStack item : recipe) { + if (item != null) { par3List.add("" + item.getDisplayName()); } } } - } else - { - par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); + } else { + par3List.add("-" + StatCollector.translateToLocal("tooltip.alchemy.press") + " " + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("tooltip.alchemy.shift") + EnumChatFormatting.GRAY + " " + + StatCollector.translateToLocal("tooltip.alchemy.forrecipe") + "-"); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/ILimitedRoutingFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/ILimitedRoutingFocus.java index da996b44..c7f55f0f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/ILimitedRoutingFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/ILimitedRoutingFocus.java @@ -2,9 +2,8 @@ package WayofTime.alchemicalWizardry.common.items.routing; import net.minecraft.item.ItemStack; -public interface ILimitedRoutingFocus -{ - int getRoutingFocusLimit(ItemStack stack); - - void setRoutingFocusLimit(ItemStack stack, int limit); +public interface ILimitedRoutingFocus { + int getRoutingFocusLimit(ItemStack stack); + + void setRoutingFocusLimit(ItemStack stack, int limit); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java index 5e3250ff..15009871 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/InputRoutingFocus.java @@ -1,20 +1,17 @@ package WayofTime.alchemicalWizardry.common.items.routing; -import net.minecraft.client.renderer.texture.IIconRegister; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; -public class InputRoutingFocus extends RoutingFocus -{ - public InputRoutingFocus() - { - super(); - } - - @Override +public class InputRoutingFocus extends RoutingFocus { + public InputRoutingFocus() { + super(); + } + + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:InputRoutingFocus"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java index 22965e3d..43920d24 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/OutputRoutingFocus.java @@ -1,15 +1,5 @@ package WayofTime.alchemicalWizardry.common.items.routing; -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; import WayofTime.alchemicalWizardry.common.routing.RoutingFocusLogicLimitDefault; import WayofTime.alchemicalWizardry.common.routing.RoutingFocusLogicLimitGlobal; @@ -18,147 +8,135 @@ import WayofTime.alchemicalWizardry.common.routing.RoutingFocusLogicLimitMatchNB import WayofTime.alchemicalWizardry.common.routing.RoutingFocusLogicLimitModItems; 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; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; -public class OutputRoutingFocus extends RoutingFocus implements ILimitedRoutingFocus -{ - IIcon modItemIcon; - IIcon ignMetaIcon; - IIcon matchNBTIcon; - IIcon globalIcon; - - public OutputRoutingFocus() - { - super(); - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); +public class OutputRoutingFocus extends RoutingFocus implements ILimitedRoutingFocus { + IIcon modItemIcon; + IIcon ignMetaIcon; + IIcon matchNBTIcon; + IIcon globalIcon; - if (!(par1ItemStack.getTagCompound() == null)) - { - int limit = this.getRoutingFocusLimit(par1ItemStack); - if(limit > 0) - { - par3List.add(StatCollector.translateToLocal("tooltip.routingFocus.limit") + " " + limit); - } + public OutputRoutingFocus() { + super(); + } + + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); + + if (!(par1ItemStack.getTagCompound() == null)) { + int limit = this.getRoutingFocusLimit(par1ItemStack); + if (limit > 0) { + par3List.add(StatCollector.translateToLocal("tooltip.routingFocus.limit") + " " + limit); + } } } - - @Override + + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:OutputRoutingFocus"); this.modItemIcon = iconRegister.registerIcon("AlchemicalWizardry:OutputRoutingFocusModItems"); this.ignMetaIcon = iconRegister.registerIcon("AlchemicalWizardry:OutputRoutingFocusIgnMeta"); this.matchNBTIcon = iconRegister.registerIcon("AlchemicalWizardry:OutputRoutingFocusMatchNBT"); this.globalIcon = iconRegister.registerIcon("AlchemicalWizardry:OutputRoutingFocusGlobal"); } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int damage) - { - switch(damage) - { - case 0: - return this.itemIcon; - case 1: - return this.modItemIcon; - case 2: - return this.ignMetaIcon; - case 3: - return this.matchNBTIcon; - case 4: - return this.globalIcon; - } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int damage) { + switch (damage) { + case 0: + return this.itemIcon; + case 1: + return this.modItemIcon; + case 2: + return this.ignMetaIcon; + case 3: + return this.matchNBTIcon; + case 4: + return this.globalIcon; + } return this.itemIcon; } - - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - String addedString = ""; - - switch(itemStack.getItemDamage()) - { - case 0: - addedString = "default"; - break; - case 1: - addedString = "modItem"; - break; - case 2: - addedString = "ignMeta"; - break; - case 3: - addedString = "matchNBT"; - break; - case 4: - addedString = "global"; - break; - } - - return super.getUnlocalizedName() + "." + addedString; - } - - @Override + + @Override + public String getUnlocalizedName(ItemStack itemStack) { + String addedString = ""; + + switch (itemStack.getItemDamage()) { + case 0: + addedString = "default"; + break; + case 1: + addedString = "modItem"; + break; + case 2: + addedString = "ignMeta"; + break; + case 3: + addedString = "matchNBT"; + break; + case 4: + addedString = "global"; + break; + } + + return super.getUnlocalizedName() + "." + addedString; + } + + @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < 5; ++meta) - { + public void getSubItems(Item id, CreativeTabs creativeTab, List list) { + for (int meta = 0; meta < 5; ++meta) { list.add(new ItemStack(id, 1, meta)); } } - - @Override - public RoutingFocusLogic getLogic(ItemStack itemStack) - { - if(itemStack != null) - { - switch(itemStack.getItemDamage()) - { - case 0: - return new RoutingFocusLogicLimitDefault(itemStack); - case 1: - return new RoutingFocusLogicLimitModItems(itemStack); - case 2: - return new RoutingFocusLogicLimitIgnMeta(itemStack); - case 3: - return new RoutingFocusLogicLimitMatchNBT(itemStack); - case 4: - return new RoutingFocusLogicLimitGlobal(itemStack); - } - } - - return new RoutingFocusLogic(); - } - - public int getDefaultStackLimit(int damage) - { - return 0; + + @Override + public RoutingFocusLogic getLogic(ItemStack itemStack) { + if (itemStack != null) { + switch (itemStack.getItemDamage()) { + case 0: + return new RoutingFocusLogicLimitDefault(itemStack); + case 1: + return new RoutingFocusLogicLimitModItems(itemStack); + case 2: + return new RoutingFocusLogicLimitIgnMeta(itemStack); + case 3: + return new RoutingFocusLogicLimitMatchNBT(itemStack); + case 4: + return new RoutingFocusLogicLimitGlobal(itemStack); + } + } + + return new RoutingFocusLogic(); } - - public int getRoutingFocusLimit(ItemStack itemStack) - { - if (!(itemStack.getTagCompound() == null)) - { + + public int getDefaultStackLimit(int damage) { + return 0; + } + + public int getRoutingFocusLimit(ItemStack itemStack) { + if (!(itemStack.getTagCompound() == null)) { return itemStack.getTagCompound().getInteger("stackLimit"); - } else - { + } else { return getDefaultStackLimit(itemStack.getItemDamage()); } } - - public void setRoutingFocusLimit(ItemStack itemStack, int amt) - { - if ((itemStack.getTagCompound() == null)) - { - itemStack.setTagCompound(new NBTTagCompound()); + + public void setRoutingFocusLimit(ItemStack itemStack, int amt) { + if ((itemStack.getTagCompound() == null)) { + itemStack.setTagCompound(new NBTTagCompound()); } - - itemStack.getTagCompound().setInteger("stackLimit", amt); + + itemStack.getTagCompound().setInteger("stackLimit", amt); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java index 32e456a7..f1090a1c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/routing/RoutingFocus.java @@ -1,7 +1,11 @@ package WayofTime.alchemicalWizardry.common.items.routing; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.Int3; +import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; +import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -12,172 +16,155 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; -import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class RoutingFocus extends Item -{ - public RoutingFocus() - { - super(); +public class RoutingFocus extends Item { + public RoutingFocus() { + super(); this.maxStackSize = 1; - this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); - } - - public RoutingFocusPosAndFacing getPosAndFacing(ItemStack itemStack) - { - return new RoutingFocusPosAndFacing(new Int3(this.xCoord(itemStack), this.yCoord(itemStack), this.zCoord(itemStack)), this.getSetDirection(itemStack)); - } - -// @Override -// public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) -// { -// this.cycleDirection(itemStack); -// return itemStack; -// } -// -// public void cycleDirection(ItemStack itemStack) -// { -// ForgeDirection dir = this.getSetDirection(itemStack); -// int direction = dir.ordinal(); -// direction++; -// if(direction >= ForgeDirection.VALID_DIRECTIONS.length) -// { -// direction = 0; -// } -// -// this.setSetDirection(itemStack, ForgeDirection.getOrientation(direction)); -// } - - public ForgeDirection getSetDirection(ItemStack itemStack) - { - if(!itemStack.hasTagCompound()) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - NBTTagCompound tag = itemStack.getTagCompound(); - - return ForgeDirection.getOrientation(tag.getInteger("direction")); - } - - public void setSetDirection(ItemStack itemStack, ForgeDirection dir) - { - if(!itemStack.hasTagCompound()) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - NBTTagCompound tag = itemStack.getTagCompound(); - - tag.setInteger("direction", dir.ordinal()); - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); + } + + public RoutingFocusPosAndFacing getPosAndFacing(ItemStack itemStack) { + return new RoutingFocusPosAndFacing( + new Int3(this.xCoord(itemStack), this.yCoord(itemStack), this.zCoord(itemStack)), + this.getSetDirection(itemStack)); + } + + // @Override + // public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + // { + // this.cycleDirection(itemStack); + // return itemStack; + // } + // + // public void cycleDirection(ItemStack itemStack) + // { + // ForgeDirection dir = this.getSetDirection(itemStack); + // int direction = dir.ordinal(); + // direction++; + // if(direction >= ForgeDirection.VALID_DIRECTIONS.length) + // { + // direction = 0; + // } + // + // this.setSetDirection(itemStack, ForgeDirection.getOrientation(direction)); + // } + + public ForgeDirection getSetDirection(ItemStack itemStack) { + if (!itemStack.hasTagCompound()) { + itemStack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = itemStack.getTagCompound(); + + return ForgeDirection.getOrientation(tag.getInteger("direction")); + } + + public void setSetDirection(ItemStack itemStack, ForgeDirection dir) { + if (!itemStack.hasTagCompound()) { + itemStack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = itemStack.getTagCompound(); + + tag.setInteger("direction", dir.ordinal()); + } + + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(StatCollector.translateToLocal(this.getFocusDescription())); - if (!(par1ItemStack.getTagCompound() == null)) - { + if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); - par3List.add(StatCollector.translateToLocal("tooltip.alchemy.direction") + " " + this.getSetDirection(par1ItemStack)); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + itemTag.getInteger("xCoord") + + ", " + itemTag.getInteger("yCoord") + ", " + itemTag.getInteger("zCoord")); + par3List.add(StatCollector.translateToLocal("tooltip.alchemy.direction") + " " + + this.getSetDirection(par1ItemStack)); } } - - public String getFocusDescription() - { - return "tooltip.routingFocus.desc"; - } - - @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { - if(world.isRemote) - { - return false; - } - - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof IInventory) - { - if(player.isSneaking()) - { - if(this instanceof ILimitedRoutingFocus) - { - int pastAmount = ((ILimitedRoutingFocus)this).getRoutingFocusLimit(stack); - int amount = SpellHelper.getNumberOfItemsInInventory((IInventory)tile, ForgeDirection.getOrientation(side)); - if(amount != pastAmount) - { - ((ILimitedRoutingFocus)this).setRoutingFocusLimit(stack, amount); - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.routerfocus.limit") + amount)); - } - } - } - - this.setCoordinates(stack, x, y, z); - this.setSetDirection(stack, ForgeDirection.getOrientation(side)); - - return true; - } - return true; - } - - public void setCoordinates(ItemStack itemStack, int x, int y, int z) - { - if(!itemStack.hasTagCompound()) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - NBTTagCompound tag = itemStack.getTagCompound(); - - tag.setInteger("xCoord", x); - tag.setInteger("yCoord", y); - tag.setInteger("zCoord", z); - } + public String getFocusDescription() { + return "tooltip.routingFocus.desc"; + } - public int xCoord(ItemStack itemStack) - { - if (!(itemStack.getTagCompound() == null)) - { + @Override + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { + if (world.isRemote) { + return false; + } + + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof IInventory) { + if (player.isSneaking()) { + if (this instanceof ILimitedRoutingFocus) { + int pastAmount = ((ILimitedRoutingFocus) this).getRoutingFocusLimit(stack); + int amount = SpellHelper.getNumberOfItemsInInventory( + (IInventory) tile, ForgeDirection.getOrientation(side)); + if (amount != pastAmount) { + ((ILimitedRoutingFocus) this).setRoutingFocusLimit(stack, amount); + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.routerfocus.limit") + amount)); + } + } + } + + this.setCoordinates(stack, x, y, z); + this.setSetDirection(stack, ForgeDirection.getOrientation(side)); + + return true; + } + + return true; + } + + public void setCoordinates(ItemStack itemStack, int x, int y, int z) { + if (!itemStack.hasTagCompound()) { + itemStack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = itemStack.getTagCompound(); + + tag.setInteger("xCoord", x); + tag.setInteger("yCoord", y); + tag.setInteger("zCoord", z); + } + + public int xCoord(ItemStack itemStack) { + if (!(itemStack.getTagCompound() == null)) { return itemStack.getTagCompound().getInteger("xCoord"); - } else - { + } else { return 0; } } - public int yCoord(ItemStack itemStack) - { - if (!(itemStack.getTagCompound() == null)) - { + public int yCoord(ItemStack itemStack) { + if (!(itemStack.getTagCompound() == null)) { return itemStack.getTagCompound().getInteger("yCoord"); - } else - { + } else { return 0; } } - public int zCoord(ItemStack itemStack) - { - if (!(itemStack.getTagCompound() == null)) - { + public int zCoord(ItemStack itemStack) { + if (!(itemStack.getTagCompound() == null)) { return itemStack.getTagCompound().getInteger("zCoord"); - } else - { + } else { return 0; } } - - public RoutingFocusLogic getLogic(ItemStack itemStack) - { - return new RoutingFocusLogic(); - } + + public RoutingFocusLogic getLogic(ItemStack itemStack) { + return new RoutingFocusLogic(); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilAir.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilAir.java index 6e6a168a..80cec05d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilAir.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilAir.java @@ -1,8 +1,12 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +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.ItemStack; @@ -10,134 +14,115 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilAir extends EnergyItems implements ArmourUpgrade, ISigil -{ - public SigilAir() - { +public class SigilAir extends EnergyItems implements ArmourUpgrade, ISigil { + public SigilAir() { super(); this.maxStackSize = 1; - //setMaxDamage(1000); + // setMaxDamage(1000); setEnergyUsed(AlchemicalWizardry.sigilAirCost); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @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.airsigil.desc")); - 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")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:AirSigil"); } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if(par2World.isRemote && this.isItemUnusable(par1ItemStack)) - { - return par1ItemStack; + if (par2World.isRemote && this.isItemUnusable(par1ItemStack)) { + return par1ItemStack; } - + Vec3 vec = par3EntityPlayer.getLookVec(); double wantedVelocity = 1.7; - if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost)) - { - int i = par3EntityPlayer.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier(); + if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost)) { + int i = par3EntityPlayer + .getActivePotionEffect(AlchemicalWizardry.customPotionBoost) + .getAmplifier(); wantedVelocity += (1 + i) * (0.35); } par3EntityPlayer.motionX = vec.xCoord * wantedVelocity; par3EntityPlayer.motionY = vec.yCoord * wantedVelocity; par3EntityPlayer.motionZ = vec.zCoord * wantedVelocity; - par2World.playSoundEffect((double) ((float) par3EntityPlayer.posX + 0.5F), (double) ((float) par3EntityPlayer.posY + 0.5F), (double) ((float) par3EntityPlayer.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); + par2World.playSoundEffect( + (double) ((float) par3EntityPlayer.posX + 0.5F), + (double) ((float) par3EntityPlayer.posY + 0.5F), + (double) ((float) par3EntityPlayer.posZ + 0.5F), + "random.fizz", + 0.5F, + 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); par3EntityPlayer.fallDistance = 0; - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - if(!par2World.isRemote) - { - this.setIsItemUnusable(par1ItemStack, true); - } - }else - { - if(!par2World.isRemote) - { - this.setIsItemUnusable(par1ItemStack, false); - } + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + if (!par2World.isRemote) { + this.setIsItemUnusable(par1ItemStack, true); + } + } else { + if (!par2World.isRemote) { + this.setIsItemUnusable(par1ItemStack, false); + } } - } else - { + } else { return par1ItemStack; } return par1ItemStack; } - - public boolean isItemUnusable(ItemStack stack) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - return tag.getBoolean("unusable"); + + public boolean isItemUnusable(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + return tag.getBoolean("unusable"); } - - public void setIsItemUnusable(ItemStack stack, boolean bool) - { - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - stack.setTagCompound(tag); - } - - tag.setBoolean("unusable", bool); + + public void setIsItemUnusable(ItemStack stack, boolean bool) { + NBTTagCompound tag = stack.getTagCompound(); + if (tag == null) { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + tag.setBoolean("unusable", bool); } @Override - public void onArmourUpdate(World world, EntityPlayer player, - ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { // TODO Auto-generated method stub player.fallDistance = 0; } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { // TODO Auto-generated method stub return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { // TODO Auto-generated method stub return 50; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilBloodLight.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilBloodLight.java index 434ebe71..628e9e24 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilBloodLight.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilBloodLight.java @@ -1,8 +1,15 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +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.ItemStack; @@ -11,19 +18,9 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; -import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgrade, ISigil -{ - public SigilBloodLight() - { +public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgrade, ISigil { + public SigilBloodLight() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilBloodLightCost); @@ -31,63 +28,63 @@ public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgr } @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.bloodlightsigil.desc")); - 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")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodLightSigil"); } @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(!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer) || !EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed())) - { - return true; - } - - if (par3World.isRemote) - { + public boolean onItemUse( + ItemStack par1ItemStack, + EntityPlayer par2EntityPlayer, + World par3World, + int par4, + int par5, + int par6, + int par7, + float par8, + float par9, + float par10) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer) + || !EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed())) { return true; } - if (par7 == 0 && par3World.isAirBlock(par4, par5 - 1, par6)) - { + if (par3World.isRemote) { + return true; + } + + if (par7 == 0 && par3World.isAirBlock(par4, par5 - 1, par6)) { par3World.setBlock(par4, par5 - 1, par6, ModBlocks.blockBloodLight); } - if (par7 == 1 && par3World.isAirBlock(par4, par5 + 1, par6)) - { + if (par7 == 1 && par3World.isAirBlock(par4, par5 + 1, par6)) { par3World.setBlock(par4, par5 + 1, par6, ModBlocks.blockBloodLight); } - if (par7 == 2 && par3World.isAirBlock(par4, par5, par6 - 1)) - { + if (par7 == 2 && par3World.isAirBlock(par4, par5, par6 - 1)) { par3World.setBlock(par4, par5, par6 - 1, ModBlocks.blockBloodLight); } - if (par7 == 3 && par3World.isAirBlock(par4, par5, par6 + 1)) - { + if (par7 == 3 && par3World.isAirBlock(par4, par5, par6 + 1)) { par3World.setBlock(par4, par5, par6 + 1, ModBlocks.blockBloodLight); } - if (par7 == 4 && par3World.isAirBlock(par4 - 1, par5, par6)) - { + if (par7 == 4 && par3World.isAirBlock(par4 - 1, par5, par6)) { par3World.setBlock(par4 - 1, par5, par6, ModBlocks.blockBloodLight); } - if (par7 == 5 && par3World.isAirBlock(par4 + 1, par5, par6)) - { + if (par7 == 5 && par3World.isAirBlock(par4 + 1, par5, par6)) { par3World.setBlock(par4 + 1, par5, par6, ModBlocks.blockBloodLight); } @@ -95,46 +92,38 @@ public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgr } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed() * 5)) - { - return par1ItemStack; + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed() * 5)) { + return par1ItemStack; } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityBloodLightProjectile(par2World, par3EntityPlayer, 10)); } return par1ItemStack; } - + @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 400, 9, true)); } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 25; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilDivination.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilDivination.java index 26f59fae..d682e9f2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilDivination.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilDivination.java @@ -1,9 +1,18 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; +import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +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.Item; @@ -15,21 +24,9 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; -import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilDivination extends Item implements ArmourUpgrade, IReagentManipulator, IBindable, ISigil -{ - public SigilDivination() - { +public class SigilDivination extends Item implements ArmourUpgrade, IReagentManipulator, IBindable, ISigil { + public SigilDivination() { super(); this.maxStackSize = 1; setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -37,67 +34,62 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:DivinationSigil"); } @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.divinationsigil.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.divinationsigil.desc2")); - 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")); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) - { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) { return par1ItemStack; } - - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 0)) - { - return par1ItemStack; + + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 0)) { + return par1ItemStack; } NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null || itemTag.getString("ownerName").equals("")) - { + if (itemTag == null || itemTag.getString("ownerName").equals("")) { return par1ItemStack; } String ownerName = itemTag.getString("ownerName"); - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false); + MovingObjectPosition movingobjectposition = + this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false); - if (movingobjectposition == null) - { - par3EntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + SoulNetworkHandler.getCurrentEssence(ownerName) + "LP")); + if (movingobjectposition == null) { + par3EntityPlayer.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + + SoulNetworkHandler.getCurrentEssence(ownerName) + "LP")); return par1ItemStack; - } 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 = par2World.getTileEntity(x, y, z); - if (!(tile instanceof IReagentHandler)) - { - par3EntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + SoulNetworkHandler.getCurrentEssence(ownerName) + "LP")); + if (!(tile instanceof IReagentHandler)) { + par3EntityPlayer.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("message.divinationsigil.currentessence") + " " + + SoulNetworkHandler.getCurrentEssence(ownerName) + "LP")); return par1ItemStack; } @@ -105,13 +97,14 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani IReagentHandler relay = (IReagentHandler) tile; ReagentContainerInfo[] infoList = relay.getContainerInfo(ForgeDirection.UNKNOWN); - if (infoList != null) - { - for (ReagentContainerInfo info : infoList) - { - if (info != null && info.reagent != null && info.reagent.reagent != null) - { - par3EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.divinationsigil.reagent") + " " + ReagentRegistry.getKeyForReagent(info.reagent.reagent) + "," + StatCollector.translateToLocal("message.divinationsigil.amount") + " " + info.reagent.amount)); + if (infoList != null) { + for (ReagentContainerInfo info : infoList) { + if (info != null && info.reagent != null && info.reagent.reagent != null) { + par3EntityPlayer.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("message.divinationsigil.reagent") + " " + + ReagentRegistry.getKeyForReagent(info.reagent.reagent) + "," + + StatCollector.translateToLocal("message.divinationsigil.amount") + " " + + info.reagent.amount)); } } } @@ -122,19 +115,15 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - } + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {} @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return false; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 25; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java index 8dbc8541..8dc6f272 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java @@ -5,6 +5,8 @@ import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; 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.MaterialLiquid; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,11 +23,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -import java.util.ArrayList; -import java.util.List; - -public class SigilFluid extends Item implements IFluidContainerItem, ISigil -{ +public class SigilFluid extends Item implements IFluidContainerItem, ISigil { private int capacity = 128 * 1000; private static final int STATE_SYPHON = 0; private static final int STATE_FORCE_SYPHON = 1; @@ -35,8 +33,7 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil private static final int STATE_BEAST_DRAIN = 5; private static final int maxNumOfStates = 6; - public SigilFluid() - { + public SigilFluid() { super(); this.setMaxDamage(0); this.setMaxStackSize(1); @@ -44,14 +41,11 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } @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.fluidsigil.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - switch (this.getActionState(par1ItemStack)) - { + if (!(par1ItemStack.getTagCompound() == null)) { + switch (this.getActionState(par1ItemStack)) { case STATE_SYPHON: par3List.add(StatCollector.translateToLocal("tooltip.fluidsigil.syphoningmode")); break; @@ -73,14 +67,12 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } FluidStack fluid = this.getFluid(par1ItemStack); - if (fluid != null && fluid.amount > 0) - { + if (fluid != null && fluid.amount > 0) { String str = fluid.getFluid().getName(); int amount = fluid.amount; par3List.add("" + amount + "mB of " + str); - } else - { + } else { par3List.add("Empty"); } } @@ -88,23 +80,19 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterSigil"); } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (par3EntityPlayer.isSneaking()) { int curState = this.cycleActionState(par1ItemStack); this.sendMessageViaState(curState, par3EntityPlayer); return par1ItemStack; } - switch (this.getActionState(par1ItemStack)) - { + switch (this.getActionState(par1ItemStack)) { case STATE_SYPHON: return this.fillItemFromWorld(par1ItemStack, par2World, par3EntityPlayer, false); case STATE_FORCE_SYPHON: @@ -122,34 +110,28 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil return par1ItemStack; } - public int getActionState(ItemStack item) - { - if (item.getTagCompound() == null) - { + public int getActionState(ItemStack item) { + if (item.getTagCompound() == null) { item.setTagCompound(new NBTTagCompound()); } return item.getTagCompound().getInteger("actionState"); } - public void setActionState(ItemStack item, int actionState) - { - if (item.getTagCompound() == null) - { + public void setActionState(ItemStack item, int actionState) { + if (item.getTagCompound() == null) { item.setTagCompound(new NBTTagCompound()); } item.getTagCompound().setInteger("actionState", actionState); } - public int cycleActionState(ItemStack item) - { + public int cycleActionState(ItemStack item) { int state = this.getActionState(item); state++; - if (state >= maxNumOfStates) - { + if (state >= maxNumOfStates) { state = 0; } @@ -158,13 +140,10 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil return state; } - public void sendMessageViaState(int state, EntityPlayer player) - { - if (player.worldObj.isRemote) - { + public void sendMessageViaState(int state, EntityPlayer player) { + if (player.worldObj.isRemote) { ChatComponentText cmc = new ChatComponentText(""); - switch (state) - { + switch (state) { case STATE_SYPHON: cmc.appendText("Now in Syphoning Mode"); break; @@ -188,10 +167,8 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } } - public ItemStack fillItemFromBeastWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill) - { - if (world.isRemote) - { + public ItemStack fillItemFromBeastWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill) { + if (world.isRemote) { return container; } int range = 5; @@ -200,35 +177,27 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil boolean flag = true; MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return container; - } 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; - if (!world.canMineBlock(player, x, y, z)) - { + if (!world.canMineBlock(player, x, y, z)) { return container; } - if (!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, container)) - { + if (!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, container)) { return container; } boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1]; - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { boolList[i][j][k] = false; } } @@ -240,90 +209,73 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil positionList.add(new Int3(range, range, range)); boolean isReady = false; - while (!isReady) - { + while (!isReady) { isReady = true; - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { - if (boolList[i][j][k]) - { - if (i - 1 >= 0 && !boolList[i - 1][j][k]) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { + if (boolList[i][j][k]) { + if (i - 1 >= 0 && !boolList[i - 1][j][k]) { Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - if (fluid != null) - { + if (fluid != null) { boolList[i - 1][j][k] = true; positionList.add(new Int3(i - 1, j, k)); isReady = false; } } - if (j - 1 >= 0 && !boolList[i][j - 1][k]) - { + if (j - 1 >= 0 && !boolList[i][j - 1][k]) { Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - if (fluid != null) - { + if (fluid != null) { boolList[i][j - 1][k] = true; positionList.add(new Int3(i, j - 1, k)); isReady = false; } } - if (k - 1 >= 0 && !boolList[i][j][k - 1]) - { + if (k - 1 >= 0 && !boolList[i][j][k - 1]) { Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - if (fluid != null) - { + if (fluid != null) { boolList[i][j][k - 1] = true; positionList.add(new Int3(i, j, k - 1)); isReady = false; } } - if (i + 1 <= 2 * range && !boolList[i + 1][j][k]) - { + if (i + 1 <= 2 * range && !boolList[i + 1][j][k]) { Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - if (fluid != null) - { + if (fluid != null) { boolList[i + 1][j][k] = true; positionList.add(new Int3(i + 1, j, k)); isReady = false; } } - if (j + 1 <= 2 * range && !boolList[i][j + 1][k]) - { + if (j + 1 <= 2 * range && !boolList[i][j + 1][k]) { Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - if (fluid != null) - { + if (fluid != null) { boolList[i][j + 1][k] = true; positionList.add(new Int3(i, j + 1, k)); isReady = false; } } - if (k + 1 <= 2 * range && !boolList[i][j][k + 1]) - { + if (k + 1 <= 2 * range && !boolList[i][j][k + 1]) { Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - if (fluid != null) - { + if (fluid != null) { boolList[i][j][k + 1] = true; positionList.add(new Int3(i, j, k + 1)); isReady = false; @@ -335,44 +287,39 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } } - for (Int3 pos : positionList) - { + for (Int3 pos : positionList) { int i = pos.xCoord; int j = pos.yCoord; int k = pos.zCoord; - if (!boolList[i][j][k]) - { + if (!boolList[i][j][k]) { continue; } - if (world.getBlock(x + i - range, y + j - range, z + k - range) != null && world.getBlock(x + i - range, y + j - range, z + k - range).getMaterial() instanceof MaterialLiquid) - { - //world.setBlockToAir(x+i-range, y+j-range, z+k-range); + if (world.getBlock(x + i - range, y + j - range, z + k - range) != null + && world.getBlock(x + i - range, y + j - range, z + k - range) + .getMaterial() + instanceof MaterialLiquid) { + // world.setBlockToAir(x+i-range, y+j-range, z+k-range); Block block = world.getBlock(x + i - range, y + j - range, z + k - range); - if (block == null) - { + if (block == null) { continue; } Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - AlchemicalWizardry.logger.info("x: " + (i - range) + " y: " + (j - range) + " z: " + (k - range)); + AlchemicalWizardry.logger.info( + "x: " + (i - range) + " y: " + (j - range) + " z: " + (k - range)); - - if (fluid == null || world.getBlockMetadata(x + i - range, y + j - range, z + k - range) != 0) - { + if (fluid == null || world.getBlockMetadata(x + i - range, y + j - range, z + k - range) != 0) { continue; } - FluidStack fillStack = new FluidStack(fluid, 1000); int amount = this.fill(container, fillStack, false); - if ((amount > 0 && forceFill) || (amount >= 1000 && !forceFill)) - { + if ((amount > 0 && forceFill) || (amount >= 1000 && !forceFill)) { { world.setBlockToAir(x + i - range, y + j - range, z + k - range); - } this.fill(container, new FluidStack(fluid, 1000), true); @@ -385,40 +332,33 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } } - public ItemStack fillItemFromWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill) - { + public ItemStack fillItemFromWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill) { float f = 1.0F; boolean flag = true; MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return container; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (!world.canMineBlock(player, i, j, k)) - { + if (!world.canMineBlock(player, i, j, k)) { return container; } - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, container)) - { + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, container)) { return container; } - if (world.getBlock(i, j, k) != null && world.getBlock(i, j, k).getMaterial() instanceof MaterialLiquid) - { + if (world.getBlock(i, j, k) != null + && world.getBlock(i, j, k).getMaterial() instanceof MaterialLiquid) { Block block = world.getBlock(i, j, k); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - if (fluid == null) - { + if (fluid == null) { return container; } @@ -426,19 +366,15 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil int amount = this.fill(container, fillStack, false); - if ((amount > 0 && forceFill) || (amount >= 1000 && !forceFill)) - { - if (!player.capabilities.isCreativeMode) - { + if ((amount > 0 && forceFill) || (amount >= 1000 && !forceFill)) { + if (!player.capabilities.isCreativeMode) { world.setBlockToAir(i, j, k); } this.fill(container, new FluidStack(fluid, 1000), true); - if (!player.capabilities.isCreativeMode) - { - } else - { + if (!player.capabilities.isCreativeMode) { + } else { return container; } } @@ -449,79 +385,66 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } } - public ItemStack emptyItemToWorld(ItemStack container, World world, EntityPlayer player) - { + public ItemStack emptyItemToWorld(ItemStack container, World world, EntityPlayer player) { FluidStack simStack = this.drain(container, 1000, false); - if (simStack != null && simStack.amount >= 1000) - { + if (simStack != null && simStack.amount >= 1000) { Block fluidBlock = simStack.getFluid().getBlock(); float f = 1.0F; double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; - double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f + 1.62D - (double) player.yOffset; + double d1 = + player.prevPosY + (player.posY - player.prevPosY) * (double) f + 1.62D - (double) player.yOffset; double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; boolean flag = false; MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return container; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (!world.canMineBlock(player, i, j, k)) - { + if (!world.canMineBlock(player, i, j, k)) { return container; } - if (movingobjectposition.sideHit == 0) - { + if (movingobjectposition.sideHit == 0) { --j; } - if (movingobjectposition.sideHit == 1) - { + if (movingobjectposition.sideHit == 1) { ++j; } - if (movingobjectposition.sideHit == 2) - { + if (movingobjectposition.sideHit == 2) { --k; } - if (movingobjectposition.sideHit == 3) - { + if (movingobjectposition.sideHit == 3) { ++k; } - if (movingobjectposition.sideHit == 4) - { + if (movingobjectposition.sideHit == 4) { --i; } - if (movingobjectposition.sideHit == 5) - { + if (movingobjectposition.sideHit == 5) { ++i; } - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, container)) - { + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, container)) { return container; } - if (this.tryPlaceContainedLiquid(world, fluidBlock, d0, d1, d2, i, j, k) && !player.capabilities.isCreativeMode) - { + if (this.tryPlaceContainedLiquid(world, fluidBlock, d0, d1, d2, i, j, k) + && !player.capabilities.isCreativeMode) { this.drain(container, 1000, true); return container; } - } return container; @@ -531,26 +454,35 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil return container; } - public boolean tryPlaceContainedLiquid(World par1World, Block block, double par2, double par4, double par6, int par8, int par9, int par10) - { - if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).func_149730_j()) - { + public boolean tryPlaceContainedLiquid( + World par1World, Block block, double par2, double par4, double par6, int par8, int par9, int par10) { + if (!par1World.isAirBlock(par8, par9, par10) + && par1World.getBlock(par8, par9, par10).func_149730_j()) { return false; - } else if ((par1World.getBlock(par8, par9, par10).getMaterial() instanceof MaterialLiquid && (par1World.getBlockMetadata(par8, par9, par10) == 0))) - { + } else if ((par1World.getBlock(par8, par9, par10).getMaterial() instanceof MaterialLiquid + && (par1World.getBlockMetadata(par8, par9, par10) == 0))) { return false; - } else - { - if ((block == Blocks.water || block == Blocks.flowing_water) && par1World.provider.isHellWorld) - { - par1World.playSoundEffect(par2 + 0.5D, par4 + 0.5D, par6 + 0.5D, "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F); + } else { + if ((block == Blocks.water || block == Blocks.flowing_water) && par1World.provider.isHellWorld) { + par1World.playSoundEffect( + par2 + 0.5D, + par4 + 0.5D, + par6 + 0.5D, + "random.fizz", + 0.5F, + 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F); - for (int l = 0; l < 8; ++l) - { - par1World.spawnParticle("largesmoke", (double) par8 + Math.random(), (double) par9 + Math.random(), (double) par10 + Math.random(), 0.0D, 0.0D, 0.0D); + for (int l = 0; l < 8; ++l) { + par1World.spawnParticle( + "largesmoke", + (double) par8 + Math.random(), + (double) par9 + Math.random(), + (double) par10 + Math.random(), + 0.0D, + 0.0D, + 0.0D); } - } else - { + } else { par1World.setBlock(par8, par9, par10, block, 0, 3); } @@ -558,12 +490,10 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } } - public ItemStack fillSelectedTank(ItemStack container, World world, EntityPlayer player) - { + public ItemStack fillSelectedTank(ItemStack container, World world, EntityPlayer player) { FluidStack fluid = this.getFluid(container); - if (fluid == null) - { + if (fluid == null) { return container; } @@ -571,22 +501,19 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil boolean flag = false; MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return container; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; TileEntity tile = world.getTileEntity(i, j, k); - if (tile instanceof IFluidHandler) - { - int amount = ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(movingobjectposition.sideHit), fluid, true); + if (tile instanceof IFluidHandler) { + int amount = ((IFluidHandler) tile) + .fill(ForgeDirection.getOrientation(movingobjectposition.sideHit), fluid, true); this.drain(container, amount, true); } @@ -596,34 +523,36 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil return container; } - public ItemStack drainSelectedTank(ItemStack container, World world, EntityPlayer player) - { + public ItemStack drainSelectedTank(ItemStack container, World world, EntityPlayer player) { float f = 1.0F; boolean flag = false; MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return container; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; TileEntity tile = world.getTileEntity(i, j, k); - if (tile instanceof IFluidHandler) - { - FluidStack fluidAmount = ((IFluidHandler) tile).drain(ForgeDirection.getOrientation(movingobjectposition.sideHit), this.getCapacity(container), false); + if (tile instanceof IFluidHandler) { + FluidStack fluidAmount = ((IFluidHandler) tile) + .drain( + ForgeDirection.getOrientation(movingobjectposition.sideHit), + this.getCapacity(container), + false); int amount = this.fill(container, fluidAmount, false); - if (amount > 0) - { - ((IFluidHandler) tile).drain(ForgeDirection.getOrientation(movingobjectposition.sideHit), this.getCapacity(container), true); + if (amount > 0) { + ((IFluidHandler) tile) + .drain( + ForgeDirection.getOrientation(movingobjectposition.sideHit), + this.getCapacity(container), + true); this.fill(container, fluidAmount, true); } @@ -636,62 +565,52 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil /* IFluidContainerItem */ @Override - public FluidStack getFluid(ItemStack container) - { - if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid")) - { + public FluidStack getFluid(ItemStack container) { + if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid")) { return null; } return FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); } @Override - public int getCapacity(ItemStack container) - { + public int getCapacity(ItemStack container) { return capacity; } @Override - public int fill(ItemStack container, FluidStack resource, boolean doFill) - { - if (resource == null) - { + public int fill(ItemStack container, FluidStack resource, boolean doFill) { + if (resource == null) { return 0; } - if (!doFill) - { - if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid")) - { + if (!doFill) { + if (container.getTagCompound() == null + || !container.getTagCompound().hasKey("Fluid")) { return Math.min(capacity, resource.amount); } - FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); + FluidStack stack = + FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); - if (stack == null || stack.amount <= 0) - { + if (stack == null || stack.amount <= 0) { return Math.min(capacity, resource.amount); } - if (!stack.isFluidEqual(resource)) - { + if (!stack.isFluidEqual(resource)) { return 0; } return Math.min(capacity - stack.amount, resource.amount); } - if (container.getTagCompound() == null) - { + if (container.getTagCompound() == null) { container.setTagCompound(new NBTTagCompound()); } - if (!container.getTagCompound().hasKey("Fluid")) - { + if (!container.getTagCompound().hasKey("Fluid")) { NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound()); - if (capacity < resource.amount) - { + if (capacity < resource.amount) { fluidTag.setInteger("Amount", capacity); container.getTagCompound().setTag("Fluid", fluidTag); return capacity; @@ -704,12 +623,10 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil NBTTagCompound fluidTag = container.getTagCompound().getCompoundTag("Fluid"); FluidStack stack = FluidStack.loadFluidStackFromNBT(fluidTag); - if (stack == null || stack.amount <= 0) - { + if (stack == null || stack.amount <= 0) { NBTTagCompound fluidTag1 = resource.writeToNBT(new NBTTagCompound()); - if (capacity < resource.amount) - { + if (capacity < resource.amount) { fluidTag1.setInteger("Amount", capacity); container.getTagCompound().setTag("Fluid", fluidTag1); return capacity; @@ -719,18 +636,15 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil return resource.amount; } - if (!stack.isFluidEqual(resource)) - { + if (!stack.isFluidEqual(resource)) { return 0; } int filled = capacity - stack.amount; - if (resource.amount < filled) - { + if (resource.amount < filled) { stack.amount += resource.amount; filled = resource.amount; - } else - { + } else { stack.amount = capacity; } @@ -739,28 +653,23 @@ public class SigilFluid extends Item implements IFluidContainerItem, ISigil } @Override - public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) - { - if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid")) - { + public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { + if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Fluid")) { return null; } - FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); - if (stack == null) - { + FluidStack stack = + FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); + if (stack == null) { return null; } stack.amount = Math.min(stack.amount, maxDrain); - if (doDrain) - { - if (maxDrain >= capacity) - { + if (doDrain) { + if (maxDrain >= capacity) { container.getTagCompound().removeTag("Fluid"); - if (container.getTagCompound().hasNoTags()) - { + if (container.getTagCompound().hasNoTags()) { container.setTagCompound(null); } return stack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilHarvest.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilHarvest.java index c1f0c4e3..fe86a465 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilHarvest.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilHarvest.java @@ -1,8 +1,14 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +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; @@ -11,23 +17,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade, ISigil -{ +public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; - public SigilHarvest() - { + public SigilHarvest() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilHarvestCost); @@ -35,95 +33,77 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade } @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.harvestsigil.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:HarvestGoddessSigil_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:HarvestGoddessSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:HarvestGoddessSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); 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); - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - tag.setBoolean("isActive", false); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + tag.setBoolean("isActive", false); } } - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -131,86 +111,71 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if ((!(par3Entity instanceof EntityPlayer)) || par2World.isRemote) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if ((!(par3Entity instanceof EntityPlayer)) || par2World.isRemote) { return; } - + EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { - int range = 3; + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { + int range = 3; int verticalRange = 1; int posX = (int) Math.round(par3Entity.posX - 0.5f); int posY = (int) par3Entity.posY; int posZ = (int) Math.round(par3Entity.posZ - 0.5f); - for (int ix = posX - range; ix <= posX + range; ix++) - { - for (int iz = posZ - range; iz <= posZ + range; iz++) - { - for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) - { + for (int ix = posX - range; ix <= posX + range; ix++) { + for (int iz = posZ - range; iz <= posZ + range; iz++) { + for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) { HarvestRegistry.harvestBlock(par2World, ix, iy, iz); } } } } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } } - @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - if(world.isRemote) - { - return; - } - int range = 3; + @Override + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { + if (world.isRemote) { + return; + } + int range = 3; int verticalRange = 1; int posX = (int) Math.round(player.posX - 0.5f); int posY = (int) player.posY; int posZ = (int) Math.round(player.posZ - 0.5f); - for (int ix = posX - range; ix <= posX + range; ix++) - { - for (int iz = posZ - range; iz <= posZ + range; iz++) - { - for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) - { + for (int ix = posX - range; ix <= posX + range; ix++) { + for (int iz = posZ - range; iz <= posZ + range; iz++) { + for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) { HarvestRegistry.harvestBlock(world, ix, iy, iz); } } } - } + } - @Override - public boolean isUpgrade() { - // TODO Auto-generated method stub - return true; - } + @Override + public boolean isUpgrade() { + // TODO Auto-generated method stub + return true; + } - @Override - public int getEnergyForTenSeconds() - { - // TODO Auto-generated method stub - return 500; - } -} \ No newline at end of file + @Override + public int getEnergyForTenSeconds() { + // TODO Auto-generated method stub + return 500; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilLava.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilLava.java index bd2c99ce..d80b26a0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilLava.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilLava.java @@ -1,9 +1,14 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyBattery; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.tileEntity.TESocket; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -20,23 +25,16 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.common.items.EnergyBattery; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil -{ +public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil { /** * field for checking if the bucket has been filled. */ private Block isFull = Blocks.lava; + private int energyUsed; - public SigilLava() - { + public SigilLava() { super(Blocks.lava); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilLavaCost); @@ -45,14 +43,12 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:LavaSigil"); } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { ItemStack copiedStack = itemStack.copy(); copiedStack.setItemDamage(copiedStack.getItemDamage() + getEnergyUsed()); copiedStack.stackSize = 1; @@ -60,95 +56,89 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil } @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.lavasigil.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.lavasigil.desc2")); - 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")); } } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) - { - return stack; + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + return stack; } - + @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { - if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) - { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { + if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) { return false; } - - if (!world.canMineBlock(player, x, y, z)) - { + + if (!world.canMineBlock(player, x, y, z)) { return false; } TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof IFluidHandler) - { + if (tile instanceof IFluidHandler) { FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000); int amount = ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(side), fluid, false); - if (amount > 0 && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { + if (amount > 0 && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(side), fluid, true); } return false; - } - else if (tile instanceof TESocket) - { + } else if (tile instanceof TESocket) { return false; } { - if (side == 0) - { + if (side == 0) { --y; } - if (side == 1) - { + if (side == 1) { ++y; } - if (side == 2) - { + if (side == 2) { --z; } - if (side == 3) - { + if (side == 3) { ++z; } - if (side == 4) - { + if (side == 4) { --x; } - if (side == 5) - { + if (side == 5) { ++x; } - if (!player.canPlayerEdit(x, y, z, side, stack)) - { + if (!player.canPlayerEdit(x, y, z, side, stack)) { return false; } - if(this.canPlaceContainedLiquid(world, x, y, z, x, y, z) && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { - return this.tryPlaceContainedLiquid(world, x, y, z, x, y, z); + if (this.canPlaceContainedLiquid(world, x, y, z, x, y, z) + && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { + return this.tryPlaceContainedLiquid(world, x, y, z, x, y, z); } } @@ -158,64 +148,56 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil /** * Attempts to place the liquid contained inside the bucket. */ - public boolean tryPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10) - { - if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) - { + public boolean tryPlaceContainedLiquid( + World par1World, double par2, double par4, double par6, int par8, int par9, int par10) { + if (!par1World.isAirBlock(par8, par9, par10) + && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) { return false; - } else if ((par1World.getBlock(par8, par9, par10) == Blocks.lava || par1World.getBlock(par8, par9, par10) == Blocks.flowing_lava) && par1World.getBlockMetadata(par8, par9, par10) == 0) - { + } else if ((par1World.getBlock(par8, par9, par10) == Blocks.lava + || par1World.getBlock(par8, par9, par10) == Blocks.flowing_lava) + && par1World.getBlockMetadata(par8, par9, par10) == 0) { return false; - } else - { + } else { par1World.setBlock(par8, par9, par10, this.isFull, 0, 3); return true; } } - - public boolean canPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10) - { - if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) - { + + public boolean canPlaceContainedLiquid( + World par1World, double par2, double par4, double par6, int par8, int par9, int par10) { + if (!par1World.isAirBlock(par8, par9, par10) + && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) { return false; - } else if ((par1World.getBlock(par8, par9, par10) == Blocks.lava || par1World.getBlock(par8, par9, par10) == Blocks.flowing_lava) && par1World.getBlockMetadata(par8, par9, par10) == 0) - { + } else if ((par1World.getBlock(par8, par9, par10) == Blocks.lava + || par1World.getBlock(par8, par9, par10) == Blocks.flowing_lava) + && par1World.getBlockMetadata(par8, par9, par10) == 0) { return false; - } else - { + } else { return true; } } - protected void setEnergyUsed(int par1int) - { + protected void setEnergyUsed(int par1int) { this.energyUsed = par1int; } - protected int getEnergyUsed() - { + protected int getEnergyUsed() { return this.energyUsed; } - protected boolean syphonBatteries(ItemStack ist, EntityPlayer player, int damageToBeDone) - { - if (!player.capabilities.isCreativeMode) - { + protected boolean syphonBatteries(ItemStack ist, EntityPlayer player, int damageToBeDone) { + if (!player.capabilities.isCreativeMode) { boolean usedBattery = false; IInventory inventory = player.inventory; - for (int slot = 0; slot < inventory.getSizeInventory(); slot++) - { + for (int slot = 0; slot < inventory.getSizeInventory(); slot++) { ItemStack stack = inventory.getStackInSlot(slot); - if (stack == null) - { + if (stack == null) { continue; } - if (stack.getItem() instanceof EnergyBattery && !usedBattery) - { - if (stack.getItemDamage() <= stack.getMaxDamage() - damageToBeDone) - { + if (stack.getItem() instanceof EnergyBattery && !usedBattery) { + if (stack.getItemDamage() <= stack.getMaxDamage() - damageToBeDone) { stack.setItemDamage(stack.getItemDamage() + damageToBeDone); usedBattery = true; } @@ -223,28 +205,24 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil } return usedBattery; - } else - { + } else { return true; } } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 9, true)); player.extinguish(); } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 100; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfElementalAffinity.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfElementalAffinity.java index 0aa6a0be..7dfa0c25 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfElementalAffinity.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfElementalAffinity.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.common.items.EnergyItems; 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; @@ -16,17 +17,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilOfElementalAffinity extends EnergyItems implements ISigil -{ +public class SigilOfElementalAffinity extends EnergyItems implements ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; - public SigilOfElementalAffinity() - { + public SigilOfElementalAffinity() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilElementalAffinityCost); @@ -34,90 +32,75 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil } @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.sigilofelementalaffinity.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofelementalaffinity.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfTheFastMiner"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:ElementalSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:ElementalSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive") && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { + if (tag.getBoolean("isActive") + && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true)); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -125,36 +108,30 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3EntityPlayer.fallDistance = 0; par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true)); } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfEnderSeverance.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfEnderSeverance.java index 4c19f239..b4dae2ff 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfEnderSeverance.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfEnderSeverance.java @@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; 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.EntityLiving; @@ -18,17 +19,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISigil -{ +public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; - public SigilOfEnderSeverance() - { + public SigilOfEnderSeverance() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilEnderSeveranceCost); @@ -36,95 +34,77 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig } @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.sigilofenderseverance.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSeverance_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSeverance_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSeverance_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); 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); - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - tag.setBoolean("isActive", false); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + tag.setBoolean("isActive", false); } } - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -132,42 +112,36 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { - List list = SpellHelper.getEntitiesInRange(par2World, par3Entity.posX, par3Entity.posY, par3Entity.posZ, 4.5, 4.5); - for (Entity entity : list) - { - if (!entity.equals(par3Entity) && entity instanceof EntityLiving) - { - ((EntityLiving) entity).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id, 5, 0)); + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { + List list = SpellHelper.getEntitiesInRange( + par2World, par3Entity.posX, par3Entity.posY, par3Entity.posZ, 4.5, 4.5); + for (Entity entity : list) { + if (!entity.equals(par3Entity) && entity instanceof EntityLiving) { + ((EntityLiving) entity) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id, 5, 0)); } } } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } return; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java index 3d34453e..80c90aa2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java @@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.IGrowable; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,19 +22,16 @@ import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.BonemealEvent; - -import java.util.List; - -public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil -{ +public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int tickDelay = 100; - public SigilOfGrowth() - { + public SigilOfGrowth() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilGrowthCost); @@ -41,77 +39,72 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil } @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.sigilofgrowth.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofgrowth.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:GrowthSigil_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:GrowthSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:GrowthSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @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 (EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) - { - if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, 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 (EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) { + if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer)) { EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed()); - if (par3World.isRemote) - { + if (par3World.isRemote) { par3World.playAuxSFX(2005, par4, par5, par6, 0); return true; } @@ -123,32 +116,27 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par2World.isRemote) - { + if (par2World.isRemote) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive") && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { + if (tag.getBoolean("isActive") + && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -156,25 +144,20 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer) || par2World.isRemote) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer) || par2World.isRemote) { return; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (par2World.getWorldTime() % tickDelay + == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) { + if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } int range = 3; @@ -183,19 +166,13 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil int posY = (int) par3Entity.posY; int posZ = (int) Math.round(par3Entity.posZ - 0.5f); - for (int ix = posX - range; ix <= posX + range; ix++) - { - for (int iz = posZ - range; iz <= posZ + range; iz++) - { - for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) - { + for (int ix = posX - range; ix <= posX + range; ix++) { + for (int iz = posZ - range; iz <= posZ + range; iz++) { + for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) { Block block = par2World.getBlock(ix, iy, iz); - - if (block instanceof IPlantable || block instanceof IGrowable) - { - if (par2World.rand.nextInt(50) == 0) - { + if (block instanceof IPlantable || block instanceof IGrowable) { + if (par2World.rand.nextInt(50) == 0) { block.updateTick(par2World, ix, iy, iz, par2World.rand); } } @@ -205,35 +182,32 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil } } - public static boolean applyBonemeal(ItemStack p_150919_0_, World p_150919_1_, int p_150919_2_, int p_150919_3_, int p_150919_4_, EntityPlayer player) - { + public static boolean applyBonemeal( + ItemStack p_150919_0_, + World p_150919_1_, + int p_150919_2_, + int p_150919_3_, + int p_150919_4_, + EntityPlayer player) { Block block = p_150919_1_.getBlock(p_150919_2_, p_150919_3_, p_150919_4_); BonemealEvent event = new BonemealEvent(player, p_150919_1_, block, p_150919_2_, p_150919_3_, p_150919_4_); - if (MinecraftForge.EVENT_BUS.post(event)) - { + if (MinecraftForge.EVENT_BUS.post(event)) { return false; } - if (event.getResult() == Result.ALLOW) - { + if (event.getResult() == Result.ALLOW) { return true; } - if (block instanceof IGrowable) - { + if (block instanceof IGrowable) { IGrowable igrowable = (IGrowable) block; - if (igrowable.func_149851_a(p_150919_1_, p_150919_2_, p_150919_3_, p_150919_4_, p_150919_1_.isRemote)) - { - if (!p_150919_1_.isRemote) - { - if (igrowable.func_149852_a(p_150919_1_, p_150919_1_.rand, p_150919_2_, p_150919_3_, p_150919_4_)) - { + if (igrowable.func_149851_a(p_150919_1_, p_150919_2_, p_150919_3_, p_150919_4_, p_150919_1_.isRemote)) { + if (!p_150919_1_.isRemote) { + if (igrowable.func_149852_a(p_150919_1_, p_150919_1_.rand, p_150919_2_, p_150919_3_, p_150919_4_)) { igrowable.func_149853_b(p_150919_1_, p_150919_1_.rand, p_150919_2_, p_150919_3_, p_150919_4_); } - - } return true; @@ -244,10 +218,8 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - if (world.isRemote) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { + if (world.isRemote) { return; } @@ -257,18 +229,13 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil int posY = (int) player.posY; int posZ = (int) Math.round(player.posZ - 0.5f); - for (int ix = posX - range; ix <= posX + range; ix++) - { - for (int iz = posZ - range; iz <= posZ + range; iz++) - { - for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) - { + for (int ix = posX - range; ix <= posX + range; ix++) { + for (int iz = posZ - range; iz <= posZ + range; iz++) { + for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) { Block block = world.getBlock(ix, iy, iz); - if (block instanceof IPlantable) - { - if (world.rand.nextInt(100) == 0) - { + if (block instanceof IPlantable) { + if (world.rand.nextInt(100) == 0) { block.updateTick(world, ix, iy, iz, world.rand); } } @@ -278,14 +245,12 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 50; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfHaste.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfHaste.java index 71de3004..a5ea7746 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfHaste.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfHaste.java @@ -6,6 +6,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.common.items.EnergyItems; 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; @@ -16,17 +17,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil -{ +public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; - public SigilOfHaste() - { + public SigilOfHaste() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilHasteCost); @@ -34,88 +32,73 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil } @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.sigilofhaste.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:HasteSigil_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:HasteSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:HasteSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive") && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { + if (tag.getBoolean("isActive") + && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1)); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -123,42 +106,34 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1)); } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -166,14 +141,12 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 150; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java index f11cc3a8..e53e8763 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java @@ -1,8 +1,13 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +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.item.EntityItem; @@ -14,23 +19,17 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHolding, ISigil -{ +public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHolding, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int tickDelay = 300; - public SigilOfMagnetism() - { + public SigilOfMagnetism() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilMagnetismCost); @@ -38,87 +37,72 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol } @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.sigilofmagnetism.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfMagnetism_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive") && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { + if (tag.getBoolean("isActive") + && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -126,27 +110,22 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (par2World.getWorldTime() % tickDelay + == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) { + if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } @@ -155,21 +134,25 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol float posX = Math.round(par3Entity.posX); float posY = (float) (par3Entity.posY - par3Entity.getEyeHeight()); float posZ = Math.round(par3Entity.posZ); - List entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); - List xpOrbs = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); + List entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(range, verticalRange, range)); + List xpOrbs = par3EntityPlayer.worldObj.getEntitiesWithinAABB( + EntityXPOrb.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(range, verticalRange, range)); - for (EntityItem entity : entities) - { - if (entity != null && !par2World.isRemote) - { + for (EntityItem entity : entities) { + if (entity != null && !par2World.isRemote) { entity.onCollideWithPlayer(par3EntityPlayer); } } - for (EntityXPOrb xpOrb : xpOrbs) - { - if (xpOrb != null && !par2World.isRemote) - { + for (EntityXPOrb xpOrb : xpOrbs) { + if (xpOrb != null && !par2World.isRemote) { xpOrb.onCollideWithPlayer(par3EntityPlayer); } } @@ -177,42 +160,43 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { int range = 5; int verticalRange = 5; float posX = Math.round(player.posX); float posY = (float) (player.posY - player.getEyeHeight()); float posZ = Math.round(player.posZ); - List entities = player.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); - List xpOrbs = player.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); + List entities = player.worldObj.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(range, verticalRange, range)); + List xpOrbs = player.worldObj.getEntitiesWithinAABB( + EntityXPOrb.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(range, verticalRange, range)); - for (EntityItem entity : entities) - { - if (entity != null && !world.isRemote) - { + for (EntityItem entity : entities) { + if (entity != null && !world.isRemote) { entity.onCollideWithPlayer(player); } } - for (EntityXPOrb xpOrb : xpOrbs) - { - if (xpOrb != null && !world.isRemote) - { + for (EntityXPOrb xpOrb : xpOrbs) { + if (xpOrb != null && !world.isRemote) { xpOrb.onCollideWithPlayer(player); } } } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 25; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfSupression.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfSupression.java index 419ba95c..1e5481f4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfSupression.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfSupression.java @@ -8,6 +8,7 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -20,19 +21,17 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import java.util.List; - -public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISigil -{ +public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int radius = 5; private int refresh = 100; - public SigilOfSupression() - { + public SigilOfSupression() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilSuppressionCost); @@ -40,102 +39,84 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi } @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.sigilofsupression.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSupression_deactivated"); activeIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSupression_activated"); passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfSupression_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - 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) { int tickDelay = 200; - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) - { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) + || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) { return par1ItemStack; } - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay); - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - tag.setBoolean("isActive", false); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + tag.setBoolean("isActive", false); } } - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -143,57 +124,44 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi } @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; } - if (SpellHelper.isFakePlayer(par2World, (EntityPlayer) par3Entity)) - { + if (SpellHelper.isFakePlayer(par2World, (EntityPlayer) par3Entity)) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive") && (!par2World.isRemote)) - { + if (par1ItemStack.getTagCompound().getBoolean("isActive") && (!par2World.isRemote)) { Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer); int x = (int) blockVec.xCoord; int y = (int) blockVec.yCoord; int z = (int) blockVec.zCoord; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) - { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { + if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) { continue; } Block block = par2World.getBlock(x + i, y + j, z + k); - if (SpellHelper.isBlockFluid(block)) - { - if (par2World.getTileEntity(x + i, y + j, z + k) != null) - { + if (SpellHelper.isBlockFluid(block)) { + if (par2World.getTileEntity(x + i, y + j, z + k) != null) { par2World.setBlockToAir(x + i, y + j, z + k); } TESpectralContainer.createSpectralBlockAtLocation(par2World, x + i, y + j, z + k, refresh); - } else - { + } else { TileEntity tile = par2World.getTileEntity(x + i, y + j, z + k); - if (tile instanceof TESpectralContainer) - { + if (tile instanceof TESpectralContainer) { ((TESpectralContainer) tile).resetDuration(refresh); } } @@ -202,52 +170,40 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi } } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { Vec3 blockVec = SpellHelper.getEntityBlockVector(player); int x = (int) blockVec.xCoord; int y = (int) blockVec.yCoord; int z = (int) blockVec.zCoord; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) - { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { + if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) { continue; } Block block = world.getBlock(x + i, y + j, z + k); - - if (SpellHelper.isBlockFluid(block)) - { - if (world.getTileEntity(x + i, y + j, z + k) != null) - { + if (SpellHelper.isBlockFluid(block)) { + if (world.getTileEntity(x + i, y + j, z + k) != null) { world.setBlockToAir(x + i, y + j, z + k); } TESpectralContainer.createSpectralBlockAtLocation(world, x + i, y + j, z + k, refresh); - } else - { + } else { TileEntity tile = world.getTileEntity(x + i, y + j, z + k); - if (tile instanceof TESpectralContainer) - { + if (tile instanceof TESpectralContainer) { ((TESpectralContainer) tile).resetDuration(refresh); } } @@ -257,14 +213,12 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 200; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheAssassin.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheAssassin.java index 4bfa7e8d..6585a95f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheAssassin.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheAssassin.java @@ -1,8 +1,14 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -20,18 +26,9 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, ISigil -{ - public SigilOfTheAssassin() - { +public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, ISigil { + public SigilOfTheAssassin() { super(); this.maxStackSize = 1; setEnergyUsed(100); @@ -39,24 +36,20 @@ public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, IS } @Override - public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (par1ItemStack.getTagCompound() == null) - { + public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterSigil"); } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { ItemStack copiedStack = itemStack.copy(); copiedStack.setItemDamage(copiedStack.getItemDamage() + 1); copiedStack.stackSize = 1; @@ -64,66 +57,69 @@ public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, IS } @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.sigiloftheassassin.desc")); - 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")); } } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - - float f = 10.0F; - MovingObjectPosition movingobjectposition = SpellHelper.raytraceFromEntity(par2World, par3EntityPlayer, false, f); + MovingObjectPosition movingobjectposition = + SpellHelper.raytraceFromEntity(par2World, par3EntityPlayer, false, f); - if (movingobjectposition == null) - { - AlchemicalWizardry.logger.info("I saw nothing."); + if (movingobjectposition == null) { + AlchemicalWizardry.logger.info("I saw nothing."); return par1ItemStack; - } else - { - AlchemicalWizardry.logger.info("Got something! Type of hit: " + movingobjectposition.typeOfHit); + } else { + AlchemicalWizardry.logger.info("Got something! Type of hit: " + movingobjectposition.typeOfHit); - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) - { - Entity hitEntity = movingobjectposition.entityHit; + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { + Entity hitEntity = movingobjectposition.entityHit; double x = hitEntity.posX; double y = hitEntity.posY; double z = hitEntity.posZ; - if(hitEntity instanceof EntityLivingBase) - { - AlchemicalWizardry.logger.info("It's a living entity!"); + if (hitEntity instanceof EntityLivingBase) { + AlchemicalWizardry.logger.info("It's a living entity!"); - - teleportTo(par3EntityPlayer, x, y, z, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ); + teleportTo( + par3EntityPlayer, + x, + y, + z, + par3EntityPlayer.posX, + par3EntityPlayer.posY, + par3EntityPlayer.posZ); } } return par1ItemStack; } } - - protected static boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ) - { + + protected static boolean teleportTo( + EntityLivingBase entityLiving, + double par1, + double par3, + double par5, + double lastX, + double lastY, + double lastZ) { EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0); - if (MinecraftForge.EVENT_BUS.post(event)) - { + if (MinecraftForge.EVENT_BUS.post(event)) { return false; } @@ -137,150 +133,157 @@ public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, IS int k = MathHelper.floor_double(entityLiving.posZ); Block l; - if (entityLiving.worldObj.blockExists(i, j, k)) - { + if (entityLiving.worldObj.blockExists(i, j, k)) { boolean flag1 = false; - while (!flag1 && j > 0) - { + while (!flag1 && j > 0) { l = entityLiving.worldObj.getBlock(i, j - 1, k); - if (l != null && l.getMaterial().blocksMovement()) - { + if (l != null && l.getMaterial().blocksMovement()) { flag1 = true; - } else - { + } else { --entityLiving.posY; --j; } } - if (flag1) - { - SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); + if (flag1) { + SpellTeleport.moveEntityViaTeleport( + entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); - if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) - { + if (entityLiving + .worldObj + .getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox) + .isEmpty() + && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) { flag = true; } } } - if (!flag) - { + if (!flag) { SpellTeleport.moveEntityViaTeleport(entityLiving, d3, d4, d5); return false; - } else - { + } else { short short1 = 128; - for (j = 0; j < short1; ++j) - { + for (j = 0; j < short1; ++j) { double d6 = (double) j / ((double) short1 - 1.0D); float f = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float f1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float f2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; - double d7 = d3 + (entityLiving.posX - d3) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; - double d8 = d4 + (entityLiving.posY - d4) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; - double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + double d7 = d3 + + (entityLiving.posX - d3) * d6 + + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + double d8 = d4 + + (entityLiving.posY - d4) * d6 + + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; + double d9 = d5 + + (entityLiving.posZ - d5) * d6 + + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); } return true; } } - - public MovingObjectPosition getMovingObjectPositionFromPlayer(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_, float reach) - { + + public MovingObjectPosition getMovingObjectPositionFromPlayer( + World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_, float reach) { float f = 1; float f1 = p_77621_2_.prevRotationPitch + (p_77621_2_.rotationPitch - p_77621_2_.prevRotationPitch) * f; float f2 = p_77621_2_.prevRotationYaw + (p_77621_2_.rotationYaw - p_77621_2_.prevRotationYaw) * f; - double d0 = p_77621_2_.prevPosX + (p_77621_2_.posX - p_77621_2_.prevPosX) * (double)f; - double d1 = p_77621_2_.prevPosY + (p_77621_2_.posY - p_77621_2_.prevPosY) * (double)f + (double)(p_77621_1_.isRemote ? p_77621_2_.getEyeHeight() - p_77621_2_.getDefaultEyeHeight() : p_77621_2_.getEyeHeight()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences - double d2 = p_77621_2_.prevPosZ + (p_77621_2_.posZ - p_77621_2_.prevPosZ) * (double)f; + double d0 = p_77621_2_.prevPosX + (p_77621_2_.posX - p_77621_2_.prevPosX) * (double) f; + double d1 = p_77621_2_.prevPosY + + (p_77621_2_.posY - p_77621_2_.prevPosY) * (double) f + + (double) + (p_77621_1_.isRemote + ? p_77621_2_.getEyeHeight() - p_77621_2_.getDefaultEyeHeight() + : p_77621_2_ + .getEyeHeight()); // isRemote check to revert changes to ray trace position due + // to adding the eye height clientside and player yOffset + // differences + double d2 = p_77621_2_.prevPosZ + (p_77621_2_.posZ - p_77621_2_.prevPosZ) * (double) f; Vec3 vec3 = SpellHelper.createVec3(d0, d1, d2); - float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); - float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); float f6 = MathHelper.sin(-f1 * 0.017453292F); float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 500.0D; - if (p_77621_2_ instanceof EntityPlayerMP) - { -// d3 = ((EntityPlayerMP)p_77621_2_).theItemInWorldManager.getBlockReachDistance(); + if (p_77621_2_ instanceof EntityPlayerMP) { + // d3 = ((EntityPlayerMP)p_77621_2_).theItemInWorldManager.getBlockReachDistance(); } - Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); + Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); } - -// public MovingObjectPosition movingObjectPositiongdsa(WOrld worldObj, int posX, int posY, int posZ) -// { -// Vec3 var17 = SpellHelper.createVec3(posX, posY, posZ); -// Vec3 var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); -// MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false); -// var17 = SpellHelper.createVec3(posX, posY, posZ); -// var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); -// -// if (var4 != null) -// { -// var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); -// } -// -// Entity var5 = null; -// List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); -// double var7 = 0.0D; -// Iterator var9 = var6.iterator(); -// float var11; -// -// while (var9.hasNext()) -// { -// Entity var10 = (Entity) var9.next(); -// -// if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) -// { -// var11 = 0.3F; -// AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11); -// MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); -// -// if (var13 != null) -// { -// double var14 = var17.distanceTo(var13.hitVec); -// -// if (var14 < var7 || var7 == 0.0D) -// { -// var5 = var10; -// var7 = var14; -// } -// } -// } -// } -// -// if (var5 != null) -// { -// var4 = new MovingObjectPosition(var5); -// } -// -// if (var4 != null) -// { -// this.onImpact(var4); -// } -// } + + // public MovingObjectPosition movingObjectPositiongdsa(WOrld worldObj, int posX, int posY, int posZ) + // { + // Vec3 var17 = SpellHelper.createVec3(posX, posY, posZ); + // Vec3 var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); + // MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false); + // var17 = SpellHelper.createVec3(posX, posY, posZ); + // var3 = SpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); + // + // if (var4 != null) + // { + // var3 = SpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); + // } + // + // Entity var5 = null; + // List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, + // motionZ).expand(1.0D, 1.0D, 1.0D)); + // double var7 = 0.0D; + // Iterator var9 = var6.iterator(); + // float var11; + // + // while (var9.hasNext()) + // { + // Entity var10 = (Entity) var9.next(); + // + // if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) + // { + // var11 = 0.3F; + // AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11); + // MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); + // + // if (var13 != null) + // { + // double var14 = var17.distanceTo(var13.hitVec); + // + // if (var14 < var7 || var7 == 0.0D) + // { + // var5 = var10; + // var7 = var14; + // } + // } + // } + // } + // + // if (var5 != null) + // { + // var4 = new MovingObjectPosition(var5); + // } + // + // if (var4 != null) + // { + // this.onImpact(var4); + // } + // } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 9, true)); } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 50; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheBridge.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheBridge.java index 33d39eb4..5fe7a057 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheBridge.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheBridge.java @@ -8,6 +8,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; @@ -19,18 +20,16 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISigil -{ +public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; + private int tickDelay = 200; - public SigilOfTheBridge() - { + public SigilOfTheBridge() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilBridgeCost); @@ -38,88 +37,73 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig } @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.sigilofthebridge.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofthebridge.desc2")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BridgeSigil_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:BridgeSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:BridgeSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive") && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { + if (tag.getBoolean("isActive") + && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -127,47 +111,39 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) - { - if(EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, this.getLPUsed(par1ItemStack))) - { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (par2World.getWorldTime() % tickDelay + == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) { + if (EnergyItems.syphonBatteries( + par1ItemStack, (EntityPlayer) par3Entity, this.getLPUsed(par1ItemStack))) { this.setLPUsed(par1ItemStack, 0); - }else - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + } else { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } - if (!par3EntityPlayer.onGround && !par3EntityPlayer.isSneaking()) - { + if (!par3EntityPlayer.onGround && !par3EntityPlayer.isSneaking()) { return; } int range = 2; int verticalOffset = -1; - if (par3EntityPlayer.isSneaking()) - { + if (par3EntityPlayer.isSneaking()) { verticalOffset--; } - if (par2World.isRemote) - { + if (par2World.isRemote) { verticalOffset--; } @@ -176,32 +152,25 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig int posZ = (int) Math.round(par3Entity.posZ - 0.5f); int incremented = 0; - for (int ix = posX - range; ix <= posX + range; ix++) - { - for (int iz = posZ - range; iz <= posZ + range; iz++) - { + for (int ix = posX - range; ix <= posX + range; ix++) { + for (int iz = posZ - range; iz <= posZ + range; iz++) { { Block block = par2World.getBlock(ix, posY + verticalOffset, iz); - if (par2World.isAirBlock(ix, posY + verticalOffset, iz)) - { + if (par2World.isAirBlock(ix, posY + verticalOffset, iz)) { par2World.setBlock(ix, posY + verticalOffset, iz, ModBlocks.spectralBlock, 0, 3); TileEntity tile = par2World.getTileEntity(ix, posY + verticalOffset, iz); - if (tile instanceof TESpectralBlock) - { + if (tile instanceof TESpectralBlock) { ((TESpectralBlock) tile).setDuration(100); } - if (par2World.rand.nextInt(2) == 0) - { + if (par2World.rand.nextInt(2) == 0) { incremented++; } - } else if (block == ModBlocks.spectralBlock) - { + } else if (block == ModBlocks.spectralBlock) { TileEntity tile = par2World.getTileEntity(ix, posY + verticalOffset, iz); - if (tile instanceof TESpectralBlock) - { + if (tile instanceof TESpectralBlock) { ((TESpectralBlock) tile).setDuration(100); } } @@ -213,30 +182,26 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig } } - public int getLPUsed(ItemStack par1ItemStack) - { - if (par1ItemStack.getTagCompound() == null) - { + public int getLPUsed(ItemStack par1ItemStack) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } return par1ItemStack.getTagCompound().getInteger("LPUsed"); } - public void incrimentLPUSed(ItemStack par1ItemStack, int addedLP) - { - if (par1ItemStack.getTagCompound() == null) - { + public void incrimentLPUSed(ItemStack par1ItemStack, int addedLP) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - par1ItemStack.getTagCompound().setInteger("LPUsed", par1ItemStack.getTagCompound().getInteger("LPUsed") + addedLP); + par1ItemStack + .getTagCompound() + .setInteger("LPUsed", par1ItemStack.getTagCompound().getInteger("LPUsed") + addedLP); } - public void setLPUsed(ItemStack par1ItemStack, int newLP) - { - if (par1ItemStack.getTagCompound() == null) - { + public void setLPUsed(ItemStack par1ItemStack, int newLP) { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } @@ -244,44 +209,35 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - if (!player.onGround && !player.isSneaking()) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { + if (!player.onGround && !player.isSneaking()) { return; } int range = 2; int verticalOffset = -2; - if (player.isSneaking()) - { + if (player.isSneaking()) { verticalOffset--; } int posX = (int) Math.round(player.posX - 0.5f); int posY = (int) player.posY; int posZ = (int) Math.round(player.posZ - 0.5f); - for (int ix = posX - range; ix <= posX + range; ix++) - { - for (int iz = posZ - range; iz <= posZ + range; iz++) - { + for (int ix = posX - range; ix <= posX + range; ix++) { + for (int iz = posZ - range; iz <= posZ + range; iz++) { Block block = world.getBlock(ix, posY + verticalOffset, iz); - if (world.isAirBlock(ix, posY + verticalOffset, iz)) - { + if (world.isAirBlock(ix, posY + verticalOffset, iz)) { world.setBlock(ix, posY + verticalOffset, iz, ModBlocks.spectralBlock, 0, 3); TileEntity tile = world.getTileEntity(ix, posY + verticalOffset, iz); - if (tile instanceof TESpectralBlock) - { + if (tile instanceof TESpectralBlock) { ((TESpectralBlock) tile).setDuration(100); } - } else if (block == ModBlocks.spectralBlock) - { + } else if (block == ModBlocks.spectralBlock) { TileEntity tile = world.getTileEntity(ix, posY + verticalOffset, iz); - if (tile instanceof TESpectralBlock) - { + if (tile instanceof TESpectralBlock) { ((TESpectralBlock) tile).setDuration(100); } } @@ -290,14 +246,12 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 100; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheFastMiner.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheFastMiner.java index 0144f94a..0282fbed 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheFastMiner.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfTheFastMiner.java @@ -6,6 +6,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.common.items.EnergyItems; 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,17 +18,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, ISigil -{ +public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; - public SigilOfTheFastMiner() - { + public SigilOfTheFastMiner() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilFastMinerCost); @@ -35,88 +33,73 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I } @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.sigilofthefastminer.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive") && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { + if (tag.getBoolean("isActive") + && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true)); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -124,42 +107,34 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true)); } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -167,14 +142,12 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 50; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfWind.java index 1bfd8fbd..856a9e4b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfWind.java @@ -6,6 +6,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.common.items.EnergyItems; 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; @@ -16,17 +17,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil -{ +public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; - public SigilOfWind() - { + public SigilOfWind() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilWhirlwindCost); @@ -34,88 +32,73 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil } @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.sigilofwind.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WindSigil_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:WindSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:WindSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); tag.setBoolean("isActive", !(tag.getBoolean("isActive"))); - if (tag.getBoolean("isActive") && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { + if (tag.getBoolean("isActive") + && EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { par1ItemStack.setItemDamage(1); tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200); par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1)); - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -123,42 +106,34 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil } @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.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1)); } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } @@ -166,14 +141,12 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 150; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilPackRat.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilPackRat.java index f268178b..45bfc05b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilPackRat.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilPackRat.java @@ -1,8 +1,14 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.compress.CompressionRegistry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +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.item.EntityItem; @@ -12,23 +18,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.compress.CompressionRegistry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade, ISigil -{ +public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade, ISigil { @SideOnly(Side.CLIENT) private IIcon activeIcon; + @SideOnly(Side.CLIENT) private IIcon passiveIcon; - public SigilPackRat() - { + public SigilPackRat() { super(); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilCompressCost); @@ -36,95 +34,77 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade } @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.packratsigil.desc")); - if (!(par1ItemStack.getTagCompound() == null)) - { - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { + if (!(par1ItemStack.getTagCompound() == null)) { + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated")); - } else - { + } else { par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated")); } - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + par1ItemStack.getTagCompound().getString("ownerName")); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:CompressionSigil_deactivated"); this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:CompressionSigil_activated"); this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:CompressionSigil_deactivated"); } @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) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = stack.getTagCompound(); - if (tag.getBoolean("isActive")) - { + if (tag.getBoolean("isActive")) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (par1 == 1) - { + public IIcon getIconFromDamage(int par1) { + if (par1 == 1) { return this.activeIcon; - } else - { + } else { return this.passiveIcon; } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tag = par1ItemStack.getTagCompound(); 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); - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - tag.setBoolean("isActive", false); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + tag.setBoolean("isActive", false); } } - } else - { + } else { par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); } @@ -132,65 +112,55 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade } @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - if (!(par3Entity instanceof EntityPlayer) || par2World.isRemote) - { + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if (!(par3Entity instanceof EntityPlayer) || par2World.isRemote) { return; } EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; - if (par1ItemStack.getTagCompound() == null) - { + if (par1ItemStack.getTagCompound() == null) { par1ItemStack.setTagCompound(new NBTTagCompound()); } - if (par1ItemStack.getTagCompound().getBoolean("isActive")) - { - ItemStack stack = CompressionRegistry.compressInventory(par3EntityPlayer.inventory.mainInventory, par2World); - if(stack != null) - { - EntityItem entityItem = new EntityItem(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, stack); - par2World.spawnEntityInWorld(entityItem); - } + if (par1ItemStack.getTagCompound().getBoolean("isActive")) { + ItemStack stack = + CompressionRegistry.compressInventory(par3EntityPlayer.inventory.mainInventory, par2World); + if (stack != null) { + EntityItem entityItem = new EntityItem( + par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, stack); + par2World.spawnEntityInWorld(entityItem); + } } - if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") && par1ItemStack.getTagCompound().getBoolean("isActive")) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) - { - par1ItemStack.getTagCompound().setBoolean("isActive", false); + if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") + && par1ItemStack.getTagCompound().getBoolean("isActive")) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { + if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + par1ItemStack.getTagCompound().setBoolean("isActive", false); } } } } - @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - if(world.isRemote) - { - return; - } - ItemStack stack = CompressionRegistry.compressInventory(player.inventory.mainInventory, world); - if(stack != null) - { - EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, stack); - world.spawnEntityInWorld(entityItem); - } - } + @Override + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { + if (world.isRemote) { + return; + } + ItemStack stack = CompressionRegistry.compressInventory(player.inventory.mainInventory, world); + if (stack != null) { + EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, stack); + world.spawnEntityInWorld(entityItem); + } + } - @Override - public boolean isUpgrade() - { - return true; - } + @Override + public boolean isUpgrade() { + return true; + } - @Override - public int getEnergyForTenSeconds() - { - return 200; - } -} \ No newline at end of file + @Override + public int getEnergyForTenSeconds() { + return 200; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilSeer.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilSeer.java index cdca8941..04afd9ad 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilSeer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilSeer.java @@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.common.items.EnergyItems; 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.Item; @@ -15,12 +16,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - -public class SigilSeer extends Item implements IHolding, ArmourUpgrade, ISigil -{ - public SigilSeer() - { +public class SigilSeer extends Item implements IHolding, ArmourUpgrade, ISigil { + public SigilSeer() { super(); this.maxStackSize = 1; setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -28,34 +25,29 @@ public class SigilSeer extends Item implements IHolding, ArmourUpgrade, ISigil @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SeerSigil"); } @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.seersigil.desc")); - 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")); } } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) - { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) { return par1ItemStack; } NBTTagCompound itemTag = par1ItemStack.getTagCompound(); - if (itemTag == null || itemTag.getString("ownerName").equals("")) - { + if (itemTag == null || itemTag.getString("ownerName").equals("")) { return par1ItemStack; } @@ -63,19 +55,15 @@ public class SigilSeer extends Item implements IHolding, ArmourUpgrade, ISigil } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - } + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {} @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return false; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 0; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilVoid.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilVoid.java index a88add62..3e0a91e7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilVoid.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilVoid.java @@ -1,8 +1,13 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +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.ItemBucket; @@ -13,20 +18,12 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil -{ +public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil { private int isFull; private int energyUsed; - public SigilVoid() - { + public SigilVoid() { super(null); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilVoidCost); @@ -36,68 +33,67 @@ public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:VoidSigil"); } @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.voidsigil.desc")); - if (!(stack.getTagCompound() == null)) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + stack.getTagCompound().getString("ownerName")); + if (!(stack.getTagCompound() == null)) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + stack.getTagCompound().getString("ownerName")); } } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { ItemStack copiedStack = itemStack.copy(); copiedStack.setItemDamage(copiedStack.getItemDamage() + getEnergyUsed()); copiedStack.stackSize = 1; return copiedStack; } - protected void setEnergyUsed(int par1int) - { + protected void setEnergyUsed(int par1int) { this.energyUsed = par1int; } - protected int getEnergyUsed() - { + protected int getEnergyUsed() { return this.energyUsed; } - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) - { - return stack; + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + return stack; } - + @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { - if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) - { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { + if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) { return false; } float f = 1.0F; - if (!world.canMineBlock(player, x, y, z)) - { + if (!world.canMineBlock(player, x, y, z)) { return false; } TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof IFluidHandler) - { + if (tile instanceof IFluidHandler) { FluidStack amount = ((IFluidHandler) tile).drain(ForgeDirection.getOrientation(side), 1000, false); - if (amount != null && amount.amount > 0 && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { + if (amount != null && amount.amount > 0 && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { ((IFluidHandler) tile).drain(ForgeDirection.getOrientation(side), 1000, true); return true; } @@ -105,47 +101,39 @@ public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil return false; } - if (side == 0) - { + if (side == 0) { --y; } - if (side == 1) - { + if (side == 1) { ++y; } - if (side == 2) - { + if (side == 2) { --z; } - if (side == 3) - { + if (side == 3) { ++z; } - if (side == 4) - { + if (side == 4) { --x; } - if (side == 5) - { + if (side == 5) { ++x; } - - if (!player.canPlayerEdit(x, y, z, side, stack)) - { + + if (!player.canPlayerEdit(x, y, z, side, stack)) { return false; } - if (SpellHelper.isBlockFluid(world.getBlock(x, y, z)) && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { + if (SpellHelper.isBlockFluid(world.getBlock(x, y, z)) + && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { world.setBlockToAir(x, y, z); return true; } - return false; } @@ -153,25 +141,21 @@ public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil /** * Attempts to place the liquid contained inside the bucket. */ - public boolean tryPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10) - { + public boolean tryPlaceContainedLiquid( + World par1World, double par2, double par4, double par6, int par8, int par9, int par10) { return false; } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { - } + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {} @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 25; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilWater.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilWater.java index b39f9915..3c761b19 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilWater.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilWater.java @@ -1,9 +1,13 @@ package WayofTime.alchemicalWizardry.common.items.sigil; -import java.util.List; - +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.tileEntity.TESocket; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -20,19 +24,12 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil -{ +public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil { private Block isFull = Blocks.water; private int energyUsed; - public SigilWater() - { + public SigilWater() { super(Blocks.water); this.maxStackSize = 1; setEnergyUsed(AlchemicalWizardry.sigilWaterCost); @@ -40,147 +37,145 @@ public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil } @Override - public void onCreated(ItemStack stack, World world, EntityPlayer player) - { - if (stack.getTagCompound() == null) - { + public void onCreated(ItemStack stack, World world, EntityPlayer player) { + if (stack.getTagCompound() == null) { stack.setTagCompound(new NBTTagCompound()); } } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterSigil"); } @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + public ItemStack getContainerItem(ItemStack itemStack) { return itemStack; } @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.watersigil.desc")); - if (!(stack.getTagCompound() == null)) - { - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + stack.getTagCompound().getString("ownerName")); + if (!(stack.getTagCompound() == null)) { + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + + stack.getTagCompound().getString("ownerName")); } } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) - { - return stack; + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + return stack; } - + @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { - if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) - { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { + if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) { return false; } - - if (!world.canMineBlock(player, x, y, z)) - { + + if (!world.canMineBlock(player, x, y, z)) { return false; } TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof IFluidHandler) - { + if (tile instanceof IFluidHandler) { FluidStack fluid = new FluidStack(FluidRegistry.WATER, 1000); int amount = ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(side), fluid, false); - if (amount > 0 && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { + if (amount > 0 && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { ((IFluidHandler) tile).fill(ForgeDirection.getOrientation(side), fluid, true); } return false; - } - else if (tile instanceof TESocket) - { + } else if (tile instanceof TESocket) { return false; } { - if (side == 0) - { + if (side == 0) { --y; } - if (side == 1) - { + if (side == 1) { ++y; } - if (side == 2) - { + if (side == 2) { --z; } - if (side == 3) - { + if (side == 3) { ++z; } - if (side == 4) - { + if (side == 4) { --x; } - if (side == 5) - { + if (side == 5) { ++x; } - if (!player.canPlayerEdit(x, y, z, side, stack)) - { + if (!player.canPlayerEdit(x, y, z, side, stack)) { return false; } - if(this.canPlaceContainedLiquid(world, x, y, z, x, y, z) && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) - { - return this.tryPlaceContainedLiquid(world, x, y, z, x, y, z); + if (this.canPlaceContainedLiquid(world, x, y, z, x, y, z) + && EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { + return this.tryPlaceContainedLiquid(world, x, y, z, x, y, z); } } - return false; - } /** * Attempts to place the liquid contained inside the bucket. */ - public boolean tryPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10) - { - if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) - { + public boolean tryPlaceContainedLiquid( + World par1World, double par2, double par4, double par6, int par8, int par9, int par10) { + if (!par1World.isAirBlock(par8, par9, par10) + && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) { return false; - } else if ((par1World.getBlock(par8, par9, par10) == Blocks.water || par1World.getBlock(par8, par9, par10) == Blocks.flowing_water) && par1World.getBlockMetadata(par8, par9, par10) == 0) - { + } else if ((par1World.getBlock(par8, par9, par10) == Blocks.water + || par1World.getBlock(par8, par9, par10) == Blocks.flowing_water) + && par1World.getBlockMetadata(par8, par9, par10) == 0) { return false; - } else - { - if (par1World.provider.isHellWorld) - { - par1World.playSoundEffect(par2 + 0.5D, par4 + 0.5D, par6 + 0.5D, "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F); + } else { + if (par1World.provider.isHellWorld) { + par1World.playSoundEffect( + par2 + 0.5D, + par4 + 0.5D, + par6 + 0.5D, + "random.fizz", + 0.5F, + 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F); - for (int l = 0; l < 8; ++l) - { - par1World.spawnParticle("largesmoke", (double) par8 + Math.random(), (double) par9 + Math.random(), (double) par10 + Math.random(), 0.0D, 0.0D, 0.0D); + for (int l = 0; l < 8; ++l) { + par1World.spawnParticle( + "largesmoke", + (double) par8 + Math.random(), + (double) par9 + Math.random(), + (double) par10 + Math.random(), + 0.0D, + 0.0D, + 0.0D); } - } else - { + } else { par1World.setBlock(par8, par9, par10, this.isFull, 0, 3); par1World.markBlockForUpdate(par8, par9, par10); } @@ -188,46 +183,41 @@ public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil return true; } } - - public boolean canPlaceContainedLiquid(World par1World, double par2, double par4, double par6, int par8, int par9, int par10) - { - if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) - { + + public boolean canPlaceContainedLiquid( + World par1World, double par2, double par4, double par6, int par8, int par9, int par10) { + if (!par1World.isAirBlock(par8, par9, par10) + && par1World.getBlock(par8, par9, par10).getMaterial().isSolid()) { return false; - } else if ((par1World.getBlock(par8, par9, par10) == Blocks.water || par1World.getBlock(par8, par9, par10) == Blocks.flowing_water) && par1World.getBlockMetadata(par8, par9, par10) == 0) - { + } else if ((par1World.getBlock(par8, par9, par10) == Blocks.water + || par1World.getBlock(par8, par9, par10) == Blocks.flowing_water) + && par1World.getBlockMetadata(par8, par9, par10) == 0) { return false; - } else - { + } else { return true; } } - protected void setEnergyUsed(int par1int) - { + protected void setEnergyUsed(int par1int) { this.energyUsed = par1int; } - protected int getEnergyUsed() - { + protected int getEnergyUsed() { return this.energyUsed; } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 9, true)); } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 50; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ContainerHolding.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ContainerHolding.java index c3d0e651..cfba7132 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ContainerHolding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ContainerHolding.java @@ -8,8 +8,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerHolding extends Container -{ +public class ContainerHolding extends Container { protected final int PLAYER_INVENTORY_ROWS = 3; protected final int PLAYER_INVENTORY_COLUMNS = 9; @@ -18,117 +17,99 @@ public class ContainerHolding extends Container private final EntityPlayer player; public final InventoryHolding inventoryHolding; - public ContainerHolding(EntityPlayer player, InventoryHolding inventoryHolding) - { + public ContainerHolding(EntityPlayer player, InventoryHolding 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 * 36, 15)); + for (int columnIndex = 0; columnIndex < inventoryColumns; ++columnIndex) { + this.addSlotToContainer( + new SlotHolding(this, inventoryHolding, player, columnIndex, 8 + columnIndex * 36, 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 SigilOfHolding) - { - 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 SigilOfHolding) { + 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,57 +119,53 @@ public class ContainerHolding 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 ContainerHolding containerHolding; - public SlotHolding(ContainerHolding containerHolding, IInventory inventory, EntityPlayer player, int slotIndex, int x, int y) - { + public SlotHolding( + ContainerHolding 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; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/GuiHolding.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/GuiHolding.java index 3abcf197..1ac9ae2c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/GuiHolding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/GuiHolding.java @@ -8,26 +8,22 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class GuiHolding extends GuiContainer -{ - public GuiHolding(EntityPlayer player, InventoryHolding inventoryHolding) - { +public class GuiHolding extends GuiContainer { + public GuiHolding(EntityPlayer player, InventoryHolding inventoryHolding) { super(new ContainerHolding(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 Holding", 52, 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("alchemicalwizardry", "gui/SigilOfHolding.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(test); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketHandler.java index 6da027bd..f5f23267 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketHandler.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 HoldingPacketHandler -{ +public class HoldingPacketHandler { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("SigilOfHolding"); - public static void init() - { + public static void init() { INSTANCE.registerMessage(HoldingPacketProcessor.class, HoldingPacketProcessor.class, 0, Side.SERVER); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketProcessor.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketProcessor.java index ad44abdf..00854154 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketProcessor.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/HoldingPacketProcessor.java @@ -6,47 +6,38 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; -public class HoldingPacketProcessor implements IMessage, IMessageHandler -{ +public class HoldingPacketProcessor implements IMessage, IMessageHandler { private int slot; private int mode; - public HoldingPacketProcessor() - { - } + public HoldingPacketProcessor() {} - public HoldingPacketProcessor(int slot, int mode) - { + public HoldingPacketProcessor(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(HoldingPacketProcessor message, MessageContext ctx) - { + public IMessage onMessage(HoldingPacketProcessor 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) { SigilOfHolding.cycleSigil(itemStack, message.mode); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/InventoryHolding.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/InventoryHolding.java index 81d06ae9..0f01a9e0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/InventoryHolding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/InventoryHolding.java @@ -1,16 +1,14 @@ package WayofTime.alchemicalWizardry.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 InventoryHolding implements IInventory -{ +public class InventoryHolding implements IInventory { public ItemStack parentItemStack; protected ItemStack[] inventory; @@ -18,8 +16,7 @@ public class InventoryHolding implements IInventory protected static String NBT_LEAST_SIG = "LeastSig"; protected static String NBT_ITEMS = "Items"; - public InventoryHolding(ItemStack itemStack) - { + public InventoryHolding(ItemStack itemStack) { parentItemStack = itemStack; inventory = new ItemStack[5]; @@ -27,29 +24,26 @@ public class InventoryHolding 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 InventoryHolding 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 InventoryHolding 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 InventoryHolding 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 "SigilOfHolding"; } @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 InventoryHolding 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,38 +184,31 @@ public class InventoryHolding 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); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ScrollHelper.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ScrollHelper.java index f816f868..ec8012f6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ScrollHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/ScrollHelper.java @@ -11,23 +11,18 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.MouseEvent; @SideOnly(Side.CLIENT) -public class ScrollHelper -{ +public class ScrollHelper { @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 SigilOfHolding) - { + if (item instanceof SigilOfHolding) { cycleSigil(stack, player, event.dwheel); event.setCanceled(true); } @@ -35,8 +30,7 @@ public class ScrollHelper } } - private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel) - { + private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel) { int mode = SigilOfHolding.getCurrentItem(stack); mode = dWheel < 0 ? SigilOfHolding.next(mode) : SigilOfHolding.prev(mode); SigilOfHolding.cycleSigil(stack, mode); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/SigilOfHolding.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/SigilOfHolding.java index 2ad813c0..10ba93f0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/SigilOfHolding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/holding/SigilOfHolding.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.items.sigil.holding; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +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,19 +15,13 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class SigilOfHolding extends EnergyItems -{ +public class SigilOfHolding extends EnergyItems { private static int invSize = 5; private static final String NBT_CURRENT_SIGIL = "CurrentSigil"; - public SigilOfHolding() - { + public SigilOfHolding() { super(); this.maxStackSize = 1; setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -32,27 +29,22 @@ public class SigilOfHolding extends EnergyItems @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfHolding"); } @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(); } } @@ -61,59 +53,62 @@ public class SigilOfHolding 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.sigilofholding.desc")); - 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)) - { - int currentSlot = getCurrentItem(par1ItemStack); + 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); @@ -124,29 +119,30 @@ public class SigilOfHolding 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()) { InventoryHolding.setUUID(par1ItemStack); - par3EntityPlayer.openGui(AlchemicalWizardry.instance, 3, par3EntityPlayer.worldObj, (int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ); + par3EntityPlayer.openGui( + AlchemicalWizardry.instance, + 3, + 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; } @@ -157,22 +153,28 @@ public class SigilOfHolding extends EnergyItems } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { - if (checkAndSetItemOwner(stack, player)) - { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { + if (checkAndSetItemOwner(stack, player)) { int currentSlot = getCurrentItem(stack); ItemStack[] inv = getInternalInventory(stack); - if (inv == null) - { + if (inv == null) { return false; } ItemStack itemUsed = inv[currentSlot]; - if (itemUsed == null) - { + if (itemUsed == null) { return false; } @@ -186,47 +188,38 @@ public class SigilOfHolding extends EnergyItems return false; } - public static int next(int mode) - { + public static int next(int mode) { int index = mode + 1; - if (index >= invSize) - { + if (index >= invSize) { 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 SigilOfHolding) - { + public static ItemStack getCurrentSigil(ItemStack itemStack) { + if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding) { ItemStack[] itemStacks = getInternalInventory(itemStack); int currentSlot = getCurrentItem(itemStack); - if (itemStacks != null) - { + if (itemStacks != null) { return itemStacks[currentSlot]; } } @@ -234,10 +227,8 @@ public class SigilOfHolding extends EnergyItems return null; } - public static int getCurrentItem(ItemStack itemStack) - { - if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding) - { + public static int getCurrentItem(ItemStack itemStack) { + if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding) { initModeTag(itemStack); int currentSigil = itemStack.stackTagCompound.getInteger(NBT_CURRENT_SIGIL); currentSigil = MathHelper.clamp_int(currentSigil, 0, invSize); @@ -247,31 +238,26 @@ public class SigilOfHolding extends EnergyItems return 4; } - 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(InventoryHolding.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); } } @@ -279,21 +265,17 @@ public class SigilOfHolding 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); @@ -304,37 +286,30 @@ public class SigilOfHolding extends EnergyItems itemTag.setTag(InventoryHolding.NBT_ITEMS, itemList); } - public static void cycleSigil(ItemStack itemStack, int mode) - { - if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding) - { + public static void cycleSigil(ItemStack itemStack, int mode) { + if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding) { 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/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java index 997740d9..b7cc29b9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java @@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; 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; @@ -21,21 +22,21 @@ import thaumcraft.api.IVisDiscountGear; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.nodes.IRevealer; -import java.util.List; - -public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGoggles, IVisDiscountGear, IRevealer, IRunicArmor, IRepairable -{ +public class ItemSanguineArmour extends ItemArmor + implements ArmourUpgrade, IGoggles, IVisDiscountGear, IRevealer, IRunicArmor, IRepairable { @SideOnly(Side.CLIENT) private IIcon helmetIcon; + @SideOnly(Side.CLIENT) private IIcon plateIcon; + @SideOnly(Side.CLIENT) private IIcon leggingsIcon; + @SideOnly(Side.CLIENT) private IIcon bootsIcon; - public ItemSanguineArmour(int armorType) - { + public ItemSanguineArmour(int armorType) { super(AlchemicalWizardry.sanguineArmourArmourMaterial, 0, armorType); setMaxDamage(1000); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -43,8 +44,7 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:SanguineHelmet"); this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:SanguinePlate"); @@ -53,25 +53,20 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog } @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) - { - if (this.equals(ModItems.sanguineHelmet)) - { + public IIcon getIconFromDamage(int par1) { + if (this.equals(ModItems.sanguineHelmet)) { return this.helmetIcon; } - if (this.equals(ModItems.sanguineRobe)) - { + if (this.equals(ModItems.sanguineRobe)) { return this.plateIcon; } - if (this.equals(ModItems.sanguinePants)) - { + if (this.equals(ModItems.sanguinePants)) { return this.leggingsIcon; } - if (this.equals(ModItems.sanguineBoots)) - { + if (this.equals(ModItems.sanguineBoots)) { return this.bootsIcon; } @@ -79,34 +74,27 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - if (this == ModItems.sanguineHelmet) - { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (this == ModItems.sanguineHelmet) { return "alchemicalwizardry:models/armor/sanguineArmour_layer_1.png"; } - if (this == ModItems.sanguineRobe || this == ModItems.sanguineBoots) - { + if (this == ModItems.sanguineRobe || this == ModItems.sanguineBoots) { return "alchemicalwizardry:models/armor/sanguineArmour_layer_1.png"; } - if (this == ModItems.sanguinePants) - { + if (this == ModItems.sanguinePants) { return "alchemicalwizardry:models/armor/sanguineArmour_layer_2.png"; - } else - { + } else { return null; } } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { int discount = 0; - switch (this.armorType) - { + switch (this.armorType) { case 0: discount = 6; break; @@ -121,8 +109,7 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog break; } - switch (this.armorType) - { + switch (this.armorType) { case 0: par3List.add(StatCollector.translateToLocal("tooltip.sanguinearmor.desc1")); break; @@ -138,34 +125,28 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog } @Override - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) - { + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { return; } @Override - public boolean isUpgrade() - { + public boolean isUpgrade() { return true; } @Override - public int getEnergyForTenSeconds() - { + public int getEnergyForTenSeconds() { return 0; } @Override - public boolean showNodes(ItemStack itemstack, EntityLivingBase player) - { + public boolean showNodes(ItemStack itemstack, EntityLivingBase player) { return true; } @Override - public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) - { - switch (this.armorType) - { + public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { + switch (this.armorType) { case 0: return 7; case 1: @@ -179,14 +160,12 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog } @Override - public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) - { + public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) { return true; } @Override - public int getRunicCharge(ItemStack itemstack) - { + public int getRunicCharge(ItemStack itemstack) { return 0; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/IEnchantmentGlyph.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/IEnchantmentGlyph.java index 5c189f92..6834cc65 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/IEnchantmentGlyph.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/IEnchantmentGlyph.java @@ -2,8 +2,8 @@ package WayofTime.alchemicalWizardry.common.omega; import net.minecraft.world.World; -public interface IEnchantmentGlyph extends IStabilityGlyph -{ - public int getEnchantability(World world, int x, int y, int z, int meta); - public int getEnchantmentLevel(World world, int x, int y, int z, int meta); +public interface IEnchantmentGlyph extends IStabilityGlyph { + public int getEnchantability(World world, int x, int y, int z, int meta); + + public int getEnchantmentLevel(World world, int x, int y, int z, int meta); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/IStabilityGlyph.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/IStabilityGlyph.java index 50252a94..8018fccc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/IStabilityGlyph.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/IStabilityGlyph.java @@ -2,7 +2,6 @@ package WayofTime.alchemicalWizardry.common.omega; import net.minecraft.world.World; -public interface IStabilityGlyph -{ - public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount); +public interface IStabilityGlyph { + public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java index c60b30d2..d62536f2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java @@ -1,166 +1,176 @@ package WayofTime.alchemicalWizardry.common.omega; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; import java.util.Random; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; -public class OmegaParadigm -{ - public OmegaArmour helmet; - public OmegaArmour chestPiece; - public OmegaArmour leggings; - public OmegaArmour boots; - - public ReagentRegenConfiguration config; - - public OmegaParadigm(Reagent reagent, OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots, ReagentRegenConfiguration config) - { - this.helmet = helmet; - this.chestPiece = chestPiece; - this.leggings = leggings; - this.boots = boots; - - this.helmet.setParadigm(this); - this.chestPiece.setParadigm(this); - this.leggings.setParadigm(this); - this.boots.setParadigm(this); - this.helmet.setReagent(reagent); - this.chestPiece.setReagent(reagent); - this.leggings.setReagent(reagent); - this.boots.setReagent(reagent); - - this.config = new ReagentRegenConfiguration(100, 1, 10); - } - - public boolean convertPlayerArmour(EntityPlayer player, int x, int y, int z, int stability, int affinity, int enchantability, int enchantmentLevel) - { - ItemStack[] armours = player.inventory.armorInventory; - - ItemStack helmetStack = armours[3]; - ItemStack chestStack = armours[2]; - ItemStack leggingsStack = armours[1]; - ItemStack bootsStack = armours[0]; - - if(helmetStack != null && helmetStack.getItem() == ModItems.boundHelmet && chestStack != null && chestStack.getItem() == ModItems.boundPlate && leggingsStack != null && leggingsStack.getItem() == ModItems.boundLeggings && bootsStack != null && bootsStack.getItem() == ModItems.boundBoots) - { - long worldSeed = player.worldObj.getSeed(); - Random rand = new Random(worldSeed + stability * (affinity + 7) * 94 + 84321*x - 17423*y + 76*z - 1623451*enchantability + 2 * enchantmentLevel); - ItemStack omegaHelmetStack = helmet.getSubstituteStack(helmetStack, stability, affinity, enchantability, enchantmentLevel, rand); - ItemStack omegaChestStack = chestPiece.getSubstituteStack(chestStack, stability, affinity, enchantability, enchantmentLevel, rand); - ItemStack omegaLeggingsStack = leggings.getSubstituteStack(leggingsStack, stability, affinity, enchantability, enchantmentLevel, rand); - ItemStack omegaBootsStack = boots.getSubstituteStack(bootsStack, stability, affinity, enchantability, enchantmentLevel, rand); - - armours[3] = omegaHelmetStack; - armours[2] = omegaChestStack; - armours[1] = omegaLeggingsStack; - armours[0] = omegaBootsStack; - - return true; - } - - return false; - } - - public ReagentRegenConfiguration getRegenConfig(EntityPlayer player) - { - return this.config; - } - - public int getMaxAdditionalHealth() - { - return 20; - } - - public boolean setOmegaStalling(EntityPlayer player, int duration) - { - ItemStack[] armours = player.inventory.armorInventory; - - ItemStack chestStack = armours[2]; - - if(chestStack != null && chestStack.getItem() == this.chestPiece) - { - ((OmegaArmour)chestStack.getItem()).setOmegaStallingDuration(chestStack, duration); - return true; - } - - return false; - } - - public float getCostPerTickOfUse(EntityPlayer player) - { - return 1; - } - - public boolean doDrainReagent(EntityPlayer player) - { - ItemStack[] armours = player.inventory.armorInventory; - - ItemStack chestStack = armours[2]; - - if(chestStack != null && chestStack.getItem() == this.chestPiece) - { - return !((OmegaArmour)chestStack.getItem()).hasOmegaStalling(chestStack); - } - return true; - } - - public boolean isPlayerWearingFullSet(EntityPlayer player) - { - ItemStack[] armours = player.inventory.armorInventory; - - ItemStack helmetStack = armours[3]; - ItemStack chestStack = armours[2]; - ItemStack leggingsStack = armours[1]; - ItemStack bootsStack = armours[0]; - - return helmetStack != null && helmetStack.getItem() == helmet && chestStack != null && chestStack.getItem() == chestPiece && leggingsStack != null && leggingsStack.getItem() == leggings && bootsStack != null && bootsStack.getItem() == boots; - } - - public void onUpdate(World world, EntityPlayer player, ItemStack stack) - { - - } - - public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) - { - - } - - public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) - { - return false; - } +public class OmegaParadigm { + public OmegaArmour helmet; + public OmegaArmour chestPiece; + public OmegaArmour leggings; + public OmegaArmour boots; - public boolean onHPBarDepleted(EntityPlayer player, ItemStack stack) - { - return false; - } - - /** - * - * @param stack - * @param player - * @param entity - * @return False if it does not do damage - */ - public boolean onBoundSwordLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { - return true; - } - - public void onEmptyHandEntityInteract(EntityPlayer player, Entity entity) - { - - } - - public void onBoundSwordInteractWithEntity(EntityPlayer player, Entity entity) - { - - } + public ReagentRegenConfiguration config; + + public OmegaParadigm( + Reagent reagent, + OmegaArmour helmet, + OmegaArmour chestPiece, + OmegaArmour leggings, + OmegaArmour boots, + ReagentRegenConfiguration config) { + this.helmet = helmet; + this.chestPiece = chestPiece; + this.leggings = leggings; + this.boots = boots; + + this.helmet.setParadigm(this); + this.chestPiece.setParadigm(this); + this.leggings.setParadigm(this); + this.boots.setParadigm(this); + this.helmet.setReagent(reagent); + this.chestPiece.setReagent(reagent); + this.leggings.setReagent(reagent); + this.boots.setReagent(reagent); + + this.config = new ReagentRegenConfiguration(100, 1, 10); + } + + public boolean convertPlayerArmour( + EntityPlayer player, + int x, + int y, + int z, + int stability, + int affinity, + int enchantability, + int enchantmentLevel) { + ItemStack[] armours = player.inventory.armorInventory; + + ItemStack helmetStack = armours[3]; + ItemStack chestStack = armours[2]; + ItemStack leggingsStack = armours[1]; + ItemStack bootsStack = armours[0]; + + if (helmetStack != null + && helmetStack.getItem() == ModItems.boundHelmet + && chestStack != null + && chestStack.getItem() == ModItems.boundPlate + && leggingsStack != null + && leggingsStack.getItem() == ModItems.boundLeggings + && bootsStack != null + && bootsStack.getItem() == ModItems.boundBoots) { + long worldSeed = player.worldObj.getSeed(); + Random rand = new Random(worldSeed + + stability * (affinity + 7) * 94 + + 84321 * x + - 17423 * y + + 76 * z + - 1623451 * enchantability + + 2 * enchantmentLevel); + ItemStack omegaHelmetStack = + helmet.getSubstituteStack(helmetStack, stability, affinity, enchantability, enchantmentLevel, rand); + ItemStack omegaChestStack = chestPiece.getSubstituteStack( + chestStack, stability, affinity, enchantability, enchantmentLevel, rand); + ItemStack omegaLeggingsStack = leggings.getSubstituteStack( + leggingsStack, stability, affinity, enchantability, enchantmentLevel, rand); + ItemStack omegaBootsStack = + boots.getSubstituteStack(bootsStack, stability, affinity, enchantability, enchantmentLevel, rand); + + armours[3] = omegaHelmetStack; + armours[2] = omegaChestStack; + armours[1] = omegaLeggingsStack; + armours[0] = omegaBootsStack; + + return true; + } + + return false; + } + + public ReagentRegenConfiguration getRegenConfig(EntityPlayer player) { + return this.config; + } + + public int getMaxAdditionalHealth() { + return 20; + } + + public boolean setOmegaStalling(EntityPlayer player, int duration) { + ItemStack[] armours = player.inventory.armorInventory; + + ItemStack chestStack = armours[2]; + + if (chestStack != null && chestStack.getItem() == this.chestPiece) { + ((OmegaArmour) chestStack.getItem()).setOmegaStallingDuration(chestStack, duration); + return true; + } + + return false; + } + + public float getCostPerTickOfUse(EntityPlayer player) { + return 1; + } + + public boolean doDrainReagent(EntityPlayer player) { + ItemStack[] armours = player.inventory.armorInventory; + + ItemStack chestStack = armours[2]; + + if (chestStack != null && chestStack.getItem() == this.chestPiece) { + return !((OmegaArmour) chestStack.getItem()).hasOmegaStalling(chestStack); + } + return true; + } + + public boolean isPlayerWearingFullSet(EntityPlayer player) { + ItemStack[] armours = player.inventory.armorInventory; + + ItemStack helmetStack = armours[3]; + ItemStack chestStack = armours[2]; + ItemStack leggingsStack = armours[1]; + ItemStack bootsStack = armours[0]; + + return helmetStack != null + && helmetStack.getItem() == helmet + && chestStack != null + && chestStack.getItem() == chestPiece + && leggingsStack != null + && leggingsStack.getItem() == leggings + && bootsStack != null + && bootsStack.getItem() == boots; + } + + public void onUpdate(World world, EntityPlayer player, ItemStack stack) {} + + public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) {} + + public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) { + return false; + } + + public boolean onHPBarDepleted(EntityPlayer player, ItemStack stack) { + return false; + } + + /** + * + * @param stack + * @param player + * @param entity + * @return False if it does not do damage + */ + public boolean onBoundSwordLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { + return true; + } + + public void onEmptyHandEntityInteract(EntityPlayer player, Entity entity) {} + + public void onBoundSwordInteractWithEntity(EntityPlayer player, Entity entity) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmEarth.java index 65283945..2ff3674a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmEarth.java @@ -1,59 +1,53 @@ package WayofTime.alchemicalWizardry.common.omega; -import net.minecraft.block.material.Material; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; -public class OmegaParadigmEarth extends OmegaParadigm -{ - public OmegaParadigmEarth(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) - { - super(ReagentRegistry.terraeReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10)); - } - - @Override - public float getCostPerTickOfUse(EntityPlayer player) - { -// if(player.isBurning()) -// { -// return 0.5f; -// } - return 1; - } - - @Override - public void onUpdate(World world, EntityPlayer player, ItemStack stack) - { - if(world.getWorldTime() % 100 == 0 && !world.isRemote) - { - if(player.posY < 50 && player.getHealth() < player.getMaxHealth()) - { - player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0, true)); - } - } - - if(player.posY > 100) - { - player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, 200, 0, true)); - } - } - - @Override - public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) - { - return true; - } - - @Override - public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) - { +public class OmegaParadigmEarth extends OmegaParadigm { + public OmegaParadigmEarth(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) { + super( + ReagentRegistry.terraeReagent, + helmet, + chestPiece, + leggings, + boots, + new ReagentRegenConfiguration(50, 1, 10)); + } - } + @Override + public float getCostPerTickOfUse(EntityPlayer player) { + // if(player.isBurning()) + // { + // return 0.5f; + // } + return 1; + } + + @Override + public void onUpdate(World world, EntityPlayer player, ItemStack stack) { + if (world.getWorldTime() % 100 == 0 && !world.isRemote) { + if (player.posY < 50 && player.getHealth() < player.getMaxHealth()) { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0, true)); + } + } + + if (player.posY > 100) { + player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, 200, 0, true)); + } + } + + @Override + public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) { + return true; + } + + @Override + public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java index 4802841f..ad399095 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.common.omega; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -7,65 +9,56 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; -public class OmegaParadigmFire extends OmegaParadigm -{ - public OmegaParadigmFire(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) - { - super(ReagentRegistry.incendiumReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10)); - } - - @Override - public float getCostPerTickOfUse(EntityPlayer player) - { - if(player.isBurning()) - { - return 0.5f; - } - return 1; - } - - @Override - public void onUpdate(World world, EntityPlayer player, ItemStack stack) - { - if(world.getWorldTime() % 100 == 0 && !world.isRemote) - { - boolean isInLava = player.isInsideOfMaterial(Material.lava); - if(player.isBurning() && player.getHealth() < player.getMaxHealth()) - { - player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, isInLava ? 1 : 0, true)); - } - - if(player.isBurning()) - { - player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, isInLava ? 400 : 200, isInLava ? 1 : 0, true)); - } - - if(player.isInWater()) - { - player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 200, 2, true)); - player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2, true)); - player.addPotionEffect(new PotionEffect(Potion.weakness.id, 200, 1, true)); - } - } - - if(player.isBurning()) - { - player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 200, 0, true)); - } - } - - @Override - public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) - { - return true; - } - - @Override - public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) - { +public class OmegaParadigmFire extends OmegaParadigm { + public OmegaParadigmFire(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) { + super( + ReagentRegistry.incendiumReagent, + helmet, + chestPiece, + leggings, + boots, + new ReagentRegenConfiguration(50, 1, 10)); + } - } + @Override + public float getCostPerTickOfUse(EntityPlayer player) { + if (player.isBurning()) { + return 0.5f; + } + return 1; + } + + @Override + public void onUpdate(World world, EntityPlayer player, ItemStack stack) { + if (world.getWorldTime() % 100 == 0 && !world.isRemote) { + boolean isInLava = player.isInsideOfMaterial(Material.lava); + if (player.isBurning() && player.getHealth() < player.getMaxHealth()) { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, isInLava ? 1 : 0, true)); + } + + if (player.isBurning()) { + player.addPotionEffect( + new PotionEffect(Potion.damageBoost.id, isInLava ? 400 : 200, isInLava ? 1 : 0, true)); + } + + if (player.isInWater()) { + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 200, 2, true)); + player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2, true)); + player.addPotionEffect(new PotionEffect(Potion.weakness.id, 200, 1, true)); + } + } + + if (player.isBurning()) { + player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 200, 0, true)); + } + } + + @Override + public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) { + return true; + } + + @Override + public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWater.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWater.java index 941f82cd..7aa2cf61 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWater.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWater.java @@ -1,5 +1,9 @@ package WayofTime.alchemicalWizardry.common.omega; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -8,75 +12,65 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; -import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock; -public class OmegaParadigmWater extends OmegaParadigm -{ - public OmegaParadigmWater(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) - { - super(ReagentRegistry.aquasalusReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10)); - } - - @Override - public float getCostPerTickOfUse(EntityPlayer player) - { - if(player.isInWater()) - { - return 0.5f; - }else - { - return 1; - } - } - - @Override - public void onUpdate(World world, EntityPlayer player, ItemStack stack) - { - player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 3, 0, true)); - player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionAmphibian.id, 3, 0, true)); - - if(world.getWorldTime() % 100 == 0 && !world.isRemote) - { - if(player.isInWater() && player.getHealth() < player.getMaxHealth()) - { - player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0, true)); - } - } - } - - @Override - public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) - { - if(entity instanceof EntityLivingBase) - { - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 1, true)); - } - return true; - } - - @Override - public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) - { - World world = player.worldObj; - - int x = (int) Math.round(player.posX); - int y = (int) Math.round(player.posY); - int z = (int) Math.round(player.posZ); +public class OmegaParadigmWater extends OmegaParadigm { + public OmegaParadigmWater(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) { + super( + ReagentRegistry.aquasalusReagent, + helmet, + chestPiece, + leggings, + boots, + new ReagentRegenConfiguration(50, 1, 10)); + } - int range = 3; - - for(int i=-range; i<=range; i++) - { - for(int j=-range; j<=range; j++) - { - for(int k=-range; k<=range; k++) - { - TEMimicBlock.createMimicBlockAtLocation(world, x+i, y+j, z+k, 300, Blocks.water, 0, ReagentRegistry.aquasalusReagent); - } - } - } - } + @Override + public float getCostPerTickOfUse(EntityPlayer player) { + if (player.isInWater()) { + return 0.5f; + } else { + return 1; + } + } + + @Override + public void onUpdate(World world, EntityPlayer player, ItemStack stack) { + player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 3, 0, true)); + player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionAmphibian.id, 3, 0, true)); + + if (world.getWorldTime() % 100 == 0 && !world.isRemote) { + if (player.isInWater() && player.getHealth() < player.getMaxHealth()) { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0, true)); + } + } + } + + @Override + public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) { + if (entity instanceof EntityLivingBase) { + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 1, true)); + } + return true; + } + + @Override + public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) { + World world = player.worldObj; + + int x = (int) Math.round(player.posX); + int y = (int) Math.round(player.posY); + int z = (int) Math.round(player.posZ); + + int range = 3; + + for (int i = -range; i <= range; i++) { + for (int j = -range; j <= range; j++) { + for (int k = -range; k <= range; k++) { + TEMimicBlock.createMimicBlockAtLocation( + world, x + i, y + j, z + k, 300, Blocks.water, 0, ReagentRegistry.aquasalusReagent); + } + } + } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java index 1276863c..5f22a559 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java @@ -1,53 +1,51 @@ package WayofTime.alchemicalWizardry.common.omega; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; -public class OmegaParadigmWind extends OmegaParadigm -{ - public OmegaParadigmWind(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) - { - super(ReagentRegistry.aetherReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10)); - } - - @Override - public float getCostPerTickOfUse(EntityPlayer player) - { - if(player.isAirBorne) - { - return 0.5f; - }else - { - return 1; - } - } - - @Override - public void onUpdate(World world, EntityPlayer player, ItemStack stack) - { - if(world.getWorldTime() % 100 == 0 && !world.isRemote && player.posY > 128 && player.getHealth() < player.getMaxHealth()) - { - player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, player.posY > 128 + 64 ? 1 : 0, true)); - } - - player.fallDistance = 0; - } - - @Override - public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) - { - return true; - } - - @Override - public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) - { +public class OmegaParadigmWind extends OmegaParadigm { + public OmegaParadigmWind(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) { + super( + ReagentRegistry.aetherReagent, + helmet, + chestPiece, + leggings, + boots, + new ReagentRegenConfiguration(50, 1, 10)); + } - } + @Override + public float getCostPerTickOfUse(EntityPlayer player) { + if (player.isAirBorne) { + return 0.5f; + } else { + return 1; + } + } + + @Override + public void onUpdate(World world, EntityPlayer player, ItemStack stack) { + if (world.getWorldTime() % 100 == 0 + && !world.isRemote + && player.posY > 128 + && player.getHealth() < player.getMaxHealth()) { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, player.posY > 128 + 64 ? 1 : 0, true)); + } + + player.fallDistance = 0; + } + + @Override + public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) { + return true; + } + + @Override + public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaRegistry.java index d8106b55..64c4ee5c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaRegistry.java @@ -1,42 +1,35 @@ package WayofTime.alchemicalWizardry.common.omega; -import java.util.HashMap; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; +import java.util.HashMap; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; -public class OmegaRegistry -{ - public static HashMap omegaList = new HashMap(); - - public static void registerParadigm(Reagent reagent, OmegaParadigm parad) - { - omegaList.put(reagent, parad); - } - - public static OmegaParadigm getParadigmForReagent(Reagent reagent) - { - return omegaList.get(reagent); - } - - public static boolean hasParadigm(Reagent reagent) - { - return omegaList.containsKey(reagent); - } - - public static OmegaParadigm getOmegaParadigmOfWeilder(EntityPlayer player) - { - ItemStack[] armours = player.inventory.armorInventory; - - ItemStack chestStack = armours[2]; - - if(chestStack != null && chestStack.getItem() instanceof OmegaArmour) - { - return ((OmegaArmour)chestStack.getItem()).getOmegaParadigm(); - } - - return null; +public class OmegaRegistry { + public static HashMap omegaList = new HashMap(); + + public static void registerParadigm(Reagent reagent, OmegaParadigm parad) { + omegaList.put(reagent, parad); + } + + public static OmegaParadigm getParadigmForReagent(Reagent reagent) { + return omegaList.get(reagent); + } + + public static boolean hasParadigm(Reagent reagent) { + return omegaList.containsKey(reagent); + } + + public static OmegaParadigm getOmegaParadigmOfWeilder(EntityPlayer player) { + ItemStack[] armours = player.inventory.armorInventory; + + ItemStack chestStack = armours[2]; + + if (chestStack != null && chestStack.getItem() instanceof OmegaArmour) { + return ((OmegaArmour) chestStack.getItem()).getOmegaParadigm(); + } + + return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureHandler.java index 7289c491..930448f5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureHandler.java @@ -1,31 +1,29 @@ package WayofTime.alchemicalWizardry.common.omega; -import net.minecraft.block.Block; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.api.Int3; +import net.minecraft.block.Block; +import net.minecraft.world.World; -public class OmegaStructureHandler -{ - public static final OmegaStructureParameters emptyParam = new OmegaStructureParameters(0, 0, 0); - - public static boolean isStructureIntact(World world, int x, int y, int z) - { - return true; - } - - public static OmegaStructureParameters getStructureStabilityFactor(World world, int x, int y, int z, int expLim, Int3 offset) - { - int range = expLim; +public class OmegaStructureHandler { + public static final OmegaStructureParameters emptyParam = new OmegaStructureParameters(0, 0, 0); - int[][][] boolList = new int[range * 2 + 1][range * 2 + 1][range * 2 + 1]; //0 indicates unchecked, 1 indicates checked and is air, -1 indicates checked to be right next to air blocks in question but is NOT air + public static boolean isStructureIntact(World world, int x, int y, int z) { + return true; + } - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { + public static OmegaStructureParameters getStructureStabilityFactor( + World world, int x, int y, int z, int expLim, Int3 offset) { + int range = expLim; + + int[][][] boolList = new int[range * 2 + 1][range * 2 + 1] + [range * 2 + + 1]; // 0 indicates unchecked, 1 indicates checked and is air, -1 indicates checked to be right + // next to air blocks in question but is NOT air + + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { boolList[i][j][k] = 0; } } @@ -34,117 +32,97 @@ public class OmegaStructureHandler boolList[range + offset.xCoord][range + offset.yCoord][range + offset.zCoord] = 1; boolean isReady = false; - while (!isReady) - { + while (!isReady) { isReady = true; - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { - if (boolList[i][j][k] == 1) - { - if (i - 1 >= 0 && !(boolList[i - 1][j][k] == 1 || boolList[i - 1][j][k] == -1)) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { + if (boolList[i][j][k] == 1) { + if (i - 1 >= 0 && !(boolList[i - 1][j][k] == 1 || boolList[i - 1][j][k] == -1)) { Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k); - if (world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer) - { - if(i - 1 == 0) //One of the found air blocks is at the range boundary, and thus the container is incomplete - { - return emptyParam; - } + if (world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) + || block == ModBlocks.blockSpectralContainer) { + if (i - 1 + == 0) // One of the found air blocks is at the range boundary, and thus the + // container is incomplete + { + return emptyParam; + } boolList[i - 1][j][k] = 1; isReady = false; - }else - { - boolList[i - 1][j][k] = -1; + } else { + boolList[i - 1][j][k] = -1; } } - if (j - 1 >= 0 && !(boolList[i][j - 1][k] == 1 || boolList[i][j - 1][k] == -1)) - { + if (j - 1 >= 0 && !(boolList[i][j - 1][k] == 1 || boolList[i][j - 1][k] == -1)) { Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k); - if (world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) || block == ModBlocks.blockSpectralContainer) - { - if(j - 1 == 0) - { - return emptyParam; - } + if (world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) + || block == ModBlocks.blockSpectralContainer) { + if (j - 1 == 0) { + return emptyParam; + } boolList[i][j - 1][k] = 1; isReady = false; - }else - { - boolList[i][j - 1][k] = -1; + } else { + boolList[i][j - 1][k] = -1; } } - if (k - 1 >= 0 && !(boolList[i][j][k - 1] == 1 || boolList[i][j][k - 1] == -1)) - { + if (k - 1 >= 0 && !(boolList[i][j][k - 1] == 1 || boolList[i][j][k - 1] == -1)) { Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1); - if (world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) || block == ModBlocks.blockSpectralContainer) - { - if(k - 1 == 0) - { - return emptyParam; - } + if (world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) + || block == ModBlocks.blockSpectralContainer) { + if (k - 1 == 0) { + return emptyParam; + } boolList[i][j][k - 1] = 1; isReady = false; - }else - { - boolList[i][j][k - 1] = -1; + } else { + boolList[i][j][k - 1] = -1; } } - if (i + 1 <= 2 * range && !(boolList[i + 1][j][k] == 1 || boolList[i + 1][j][k] == -1)) - { + if (i + 1 <= 2 * range && !(boolList[i + 1][j][k] == 1 || boolList[i + 1][j][k] == -1)) { Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k); - if (world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer) - { - if(i + 1 == range * 2) - { - return emptyParam; - } + if (world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) + || block == ModBlocks.blockSpectralContainer) { + if (i + 1 == range * 2) { + return emptyParam; + } boolList[i + 1][j][k] = 1; isReady = false; - }else - { - boolList[i + 1][j][k] = -1; + } else { + boolList[i + 1][j][k] = -1; } } - if (j + 1 <= 2 * range && !(boolList[i][j + 1][k] == 1 || boolList[i][j + 1][k] == -1)) - { + if (j + 1 <= 2 * range && !(boolList[i][j + 1][k] == 1 || boolList[i][j + 1][k] == -1)) { Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k); - if (world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) || block == ModBlocks.blockSpectralContainer) - { - if(j + 1 == range * 2) - { - return emptyParam; - } + if (world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) + || block == ModBlocks.blockSpectralContainer) { + if (j + 1 == range * 2) { + return emptyParam; + } boolList[i][j + 1][k] = 1; isReady = false; - }else - { - boolList[i][j + 1][k] = -1; + } else { + boolList[i][j + 1][k] = -1; } } - if (k + 1 <= 2 * range && !(boolList[i][j][k + 1] == 1 || boolList[i][j][k + 1] == -1)) - { + if (k + 1 <= 2 * range && !(boolList[i][j][k + 1] == 1 || boolList[i][j][k + 1] == -1)) { Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1); - if (world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) || block == ModBlocks.blockSpectralContainer) - { - if(k + 1 == range * 2) - { - return emptyParam; - } + if (world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) + || block == ModBlocks.blockSpectralContainer) { + if (k + 1 == range * 2) { + return emptyParam; + } boolList[i][j][k + 1] = 1; isReady = false; - }else - { - boolList[i][j][k + 1] = -1; + } else { + boolList[i][j][k + 1] = -1; } } } @@ -152,78 +130,70 @@ public class OmegaStructureHandler } } } - + int tally = 0; int enchantability = 0; int enchantmentLevel = 0; - - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { - if (boolList[i][j][k] != -1) - { + + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { + if (boolList[i][j][k] != -1) { continue; } - + int indTally = 0; - if (i - 1 >= 0 && boolList[i - 1][j][k] == 1) - { - indTally++; + if (i - 1 >= 0 && boolList[i - 1][j][k] == 1) { + indTally++; } - - if (j - 1 >= 0 && boolList[i][j - 1][k] == 1) - { - indTally++; + + if (j - 1 >= 0 && boolList[i][j - 1][k] == 1) { + indTally++; } - - if (k - 1 >= 0 && boolList[i][j][k - 1] == 1) - { - indTally++; + + if (k - 1 >= 0 && boolList[i][j][k - 1] == 1) { + indTally++; } - - if (i + 1 <= 2 * range && boolList[i + 1][j][k] == 1) - { - indTally++; + + if (i + 1 <= 2 * range && boolList[i + 1][j][k] == 1) { + indTally++; } - - if (j + 1 <= 2 * range && boolList[i][j + 1][k] == 1) - { - indTally++; + + if (j + 1 <= 2 * range && boolList[i][j + 1][k] == 1) { + indTally++; } - - if (k + 1 <= 2 * range && boolList[i][j][k + 1] == 1) - { - indTally++; + + if (k + 1 <= 2 * range && boolList[i][j][k + 1] == 1) { + indTally++; } - + Block block = world.getBlock(x - range + i, y - range + j, z - range + k); - int meta = world.getBlockMetadata(x - range + i, y - range + j, z - range + k); - - if(block instanceof IEnchantmentGlyph) - { - tally += ((IEnchantmentGlyph)block).getAdditionalStabilityForFaceCount(world, x-range+i, y-range+j, z-range+k, meta, indTally); - enchantability += ((IEnchantmentGlyph)block).getEnchantability(world, x-range+i, y-range+j, z-range+k, meta); - enchantmentLevel += ((IEnchantmentGlyph)block).getEnchantmentLevel(world, x-range+i, y-range+j, z-range+k, meta); - }else if(block instanceof IStabilityGlyph) - { - tally += ((IStabilityGlyph)block).getAdditionalStabilityForFaceCount(world, x-range+i, y-range+j, z-range+k, meta, indTally); - }else - { + int meta = world.getBlockMetadata(x - range + i, y - range + j, z - range + k); + + if (block instanceof IEnchantmentGlyph) { + tally += ((IEnchantmentGlyph) block) + .getAdditionalStabilityForFaceCount( + world, x - range + i, y - range + j, z - range + k, meta, indTally); + enchantability += ((IEnchantmentGlyph) block) + .getEnchantability(world, x - range + i, y - range + j, z - range + k, meta); + enchantmentLevel += ((IEnchantmentGlyph) block) + .getEnchantmentLevel(world, x - range + i, y - range + j, z - range + k, meta); + } else if (block instanceof IStabilityGlyph) { + tally += ((IStabilityGlyph) block) + .getAdditionalStabilityForFaceCount( + world, x - range + i, y - range + j, z - range + k, meta, indTally); + } else { tally += indTally; - } + } } } } - - return new OmegaStructureParameters(tally, enchantability, enchantmentLevel); - } - - public static OmegaStructureParameters getStructureStabilityFactor(World world, int x, int y, int z, int expLim) - { + + return new OmegaStructureParameters(tally, enchantability, enchantmentLevel); + } + + public static OmegaStructureParameters getStructureStabilityFactor(World world, int x, int y, int z, int expLim) { return getStructureStabilityFactor(world, x, y, z, expLim, new Int3(0, 0, 0)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureParameters.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureParameters.java index 2ecd32c4..1adbf41d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureParameters.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaStructureParameters.java @@ -1,15 +1,13 @@ package WayofTime.alchemicalWizardry.common.omega; -public class OmegaStructureParameters -{ - public final int stability; - public final int enchantability; - public final int enchantmentLevel; - - public OmegaStructureParameters(int stability, int enchantability, int enchantmentLevel) - { - this.stability = stability; - this.enchantability = enchantability; - this.enchantmentLevel = enchantmentLevel; - } +public class OmegaStructureParameters { + public final int stability; + public final int enchantability; + public final int enchantmentLevel; + + public OmegaStructureParameters(int stability, int enchantability, int enchantmentLevel) { + this.stability = stability; + this.enchantability = enchantability; + this.enchantmentLevel = enchantmentLevel; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/ReagentRegenConfiguration.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/ReagentRegenConfiguration.java index 0c6d4df1..67d0f609 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/ReagentRegenConfiguration.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/ReagentRegenConfiguration.java @@ -1,15 +1,13 @@ package WayofTime.alchemicalWizardry.common.omega; -public class ReagentRegenConfiguration -{ - public int tickRate; - public int healPerTick; - public float costPerPoint; - - public ReagentRegenConfiguration(int tickRate, int healPerTick, float costPerPoint) - { - this.tickRate = tickRate; - this.healPerTick = healPerTick; - this.costPerPoint = costPerPoint; - } +public class ReagentRegenConfiguration { + public int tickRate; + public int healPerTick; + public float costPerPoint; + + public ReagentRegenConfiguration(int tickRate, int healPerTick, float costPerPoint) { + this.tickRate = tickRate; + this.healPerTick = healPerTick; + this.costPerPoint = costPerPoint; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionAmphibian.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionAmphibian.java index 1e3afb29..93f115b5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionAmphibian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionAmphibian.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionAmphibian extends Potion -{ - public PotionAmphibian(int par1, boolean par2, int par3) - { +public class PotionAmphibian extends Potion { + public PotionAmphibian(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionBoost.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionBoost.java index 132205bb..dced43c5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionBoost.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionBoost.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionBoost extends Potion -{ - public PotionBoost(int par1, boolean par2, int par3) - { +public class PotionBoost extends Potion { + public PotionBoost(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDeaf.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDeaf.java index fc46e77b..03a5204e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDeaf.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDeaf.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionDeaf extends Potion -{ - public PotionDeaf(int par1, boolean par2, int par3) - { +public class PotionDeaf extends Potion { + public PotionDeaf(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDemonCloak.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDemonCloak.java index ea2045f4..88be3a0a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDemonCloak.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDemonCloak.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionDemonCloak extends Potion -{ - public PotionDemonCloak(int par1, boolean par2, int par3) - { +public class PotionDemonCloak extends Potion { + public PotionDemonCloak(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDrowning.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDrowning.java index 87558f26..cd1dee1a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDrowning.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionDrowning.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionDrowning extends Potion -{ - public PotionDrowning(int par1, boolean par2, int par3) - { +public class PotionDrowning extends Potion { + public PotionDrowning(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFeatherFall.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFeatherFall.java index 0c35263b..c935ce7b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFeatherFall.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFeatherFall.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionFeatherFall extends Potion -{ - public PotionFeatherFall(int par1, boolean par2, int par3) - { +public class PotionFeatherFall extends Potion { + public PotionFeatherFall(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFireFuse.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFireFuse.java index 8fe5d527..56299176 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFireFuse.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFireFuse.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionFireFuse extends Potion -{ - public PotionFireFuse(int par1, boolean par2, int par3) - { +public class PotionFireFuse extends Potion { + public PotionFireFuse(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlameCloak.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlameCloak.java index 46363b11..8e268d60 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlameCloak.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlameCloak.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionFlameCloak extends Potion -{ - public PotionFlameCloak(int par1, boolean par2, int par3) - { +public class PotionFlameCloak extends Potion { + public PotionFlameCloak(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlight.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlight.java index 23e93e57..d04d5a41 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlight.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionFlight.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionFlight extends Potion -{ - public PotionFlight(int par1, boolean par2, int par3) - { +public class PotionFlight extends Potion { + public PotionFlight(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionHeavyHeart.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionHeavyHeart.java index 952fb59c..87a71879 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionHeavyHeart.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionHeavyHeart.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionHeavyHeart extends Potion -{ - public PotionHeavyHeart(int par1, boolean par2, int par3) - { +public class PotionHeavyHeart extends Potion { + public PotionHeavyHeart(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionIceCloak.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionIceCloak.java index c2ba716a..ffbd9e9a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionIceCloak.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionIceCloak.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionIceCloak extends Potion -{ - public PotionIceCloak(int par1, boolean par2, int par3) - { +public class PotionIceCloak extends Potion { + public PotionIceCloak(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionInhibit.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionInhibit.java index 2214e105..c9a4431f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionInhibit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionInhibit.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionInhibit extends Potion -{ - public PotionInhibit(int par1, boolean par2, int par3) - { +public class PotionInhibit extends Potion { + public PotionInhibit(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionPlanarBinding.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionPlanarBinding.java index 54d6cd72..c2a16632 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionPlanarBinding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionPlanarBinding.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionPlanarBinding extends Potion -{ - public PotionPlanarBinding(int par1, boolean par2, int par3) - { +public class PotionPlanarBinding extends Potion { + public PotionPlanarBinding(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionProjectileProtect.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionProjectileProtect.java index 317edd54..0ac502cb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionProjectileProtect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionProjectileProtect.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionProjectileProtect extends Potion -{ - public PotionProjectileProtect(int par1, boolean par2, int par3) - { +public class PotionProjectileProtect extends Potion { + public PotionProjectileProtect(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionReciprocation.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionReciprocation.java index ddceed0b..14d7d7a2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionReciprocation.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionReciprocation.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionReciprocation extends Potion -{ - public PotionReciprocation(int par1, boolean par2, int par3) - { +public class PotionReciprocation extends Potion { + public PotionReciprocation(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulFray.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulFray.java index 304b0307..394c5eb2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulFray.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulFray.java @@ -1,34 +1,28 @@ package WayofTime.alchemicalWizardry.common.potion; +import java.util.ArrayList; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; -import java.util.ArrayList; - -public class PotionSoulFray extends Potion -{ - public PotionSoulFray(int par1, boolean par2, int par3) - { +public class PotionSoulFray extends Potion { + public PotionSoulFray(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; } @Override - public void performEffect(EntityLivingBase entityLivingBase, int level) - { + public void performEffect(EntityLivingBase entityLivingBase, int level) { entityLivingBase.getActivePotionEffect(this).setCurativeItems(new ArrayList()); } @Override - public boolean isReady(int duration, int level) - { + public boolean isReady(int duration, int level) { return true; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulHarden.java b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulHarden.java index 0ac24694..b2485ecc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulHarden.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulHarden.java @@ -2,16 +2,13 @@ package WayofTime.alchemicalWizardry.common.potion; import net.minecraft.potion.Potion; -public class PotionSoulHarden extends Potion -{ - public PotionSoulHarden(int par1, boolean par2, int par3) - { +public class PotionSoulHarden extends Potion { + public PotionSoulHarden(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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/AlchemyCircleRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/AlchemyCircleRenderer.java index d58f5581..119c127f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/AlchemyCircleRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/AlchemyCircleRenderer.java @@ -1,17 +1,15 @@ package WayofTime.alchemicalWizardry.common.renderer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; -public class AlchemyCircleRenderer extends MRSRenderer -{ - private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/TransCircle.png"); +public class AlchemyCircleRenderer extends MRSRenderer { + private ResourceLocation resourceLocation = + new ResourceLocation("alchemicalwizardry:textures/models/TransCircle.png"); private int colourRed; private int colourGreen; private int colourBlue; @@ -23,8 +21,18 @@ public class AlchemyCircleRenderer extends MRSRenderer private double initialY; private boolean renderWithoutReagents; - public AlchemyCircleRenderer(ResourceLocation resource, int red, int green, int blue, int intensity, double xOff, double initialY, double yOff, double zOff, double radius, boolean renderWithoutReagents) - { + public AlchemyCircleRenderer( + ResourceLocation resource, + int red, + int green, + int blue, + int intensity, + double xOff, + double initialY, + double yOff, + double zOff, + double radius, + boolean renderWithoutReagents) { this.resourceLocation = resource; this.colourRed = red; this.colourGreen = green; @@ -39,10 +47,8 @@ public class AlchemyCircleRenderer extends MRSRenderer } @Override - public void renderAt(IMasterRitualStone tile, double x, double y, double z) - { - if (tile.areTanksEmpty() && !renderWithoutReagents) - { + public void renderAt(IMasterRitualStone tile, double x, double y, double z) { + if (tile.areTanksEmpty() && !renderWithoutReagents) { return; } @@ -56,19 +62,22 @@ public class AlchemyCircleRenderer extends MRSRenderer GL11.glDisable(GL11.GL_CULL_FACE); float f2 = 0; float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F); -// GL11.glEnable(GL11.GL_BLEND); -// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + // GL11.glEnable(GL11.GL_BLEND); + // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); -// GL11.glDepthMask(false); + // GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity); - GL11.glTranslated(x + 0.5 + xOffset, y + 0.5 + (yOffset - initialY) * (tile.getRunningTime() / 100d) + initialY, z + 0.5 + zOffset); + GL11.glTranslated( + x + 0.5 + xOffset, + y + 0.5 + (yOffset - initialY) * (tile.getRunningTime() / 100d) + initialY, + z + 0.5 + zOffset); float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); - GL11.glRotatef(rotationAngle, 0F, 1F, 0F); //Rotate on planar axis + GL11.glRotatef(rotationAngle, 0F, 1F, 0F); // Rotate on planar axis tessellator.setBrightness(240); double finalRadius = (radius) * (tile.getRunningTime() / 100d); @@ -80,7 +89,7 @@ public class AlchemyCircleRenderer extends MRSRenderer tessellator.draw(); -// GL11.glDepthMask(true); + // GL11.glDepthMask(true); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/BeamRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/BeamRenderer.java index 06ddafd3..aeaa7034 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/BeamRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/BeamRenderer.java @@ -8,8 +8,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -public class BeamRenderer -{ +public class BeamRenderer { private static final ResourceLocation field_110629_a = new ResourceLocation("textures/entity/beacon_beam.png"); public int xInit; @@ -27,15 +26,13 @@ public class BeamRenderer public double size; - public void setInitialPosition(int x, int y, int z) - { + public void setInitialPosition(int x, int y, int z) { this.xInit = x; this.yInit = y; this.zInit = z; } - public void setColourAndFinalPosition(ColourAndCoords col) - { + public void setColourAndFinalPosition(ColourAndCoords col) { this.colourRed = col.colourRed; this.colourGreen = col.colourGreen; this.colourBlue = col.colourBlue; @@ -46,31 +43,27 @@ public class BeamRenderer this.zFinal = col.zCoord; } - public void setSize(double size) - { + public void setSize(double size) { this.size = size; } - protected static void bindTexture(ResourceLocation p_147499_1_) - { + protected static void bindTexture(ResourceLocation p_147499_1_) { TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; - if (texturemanager != null) - { + if (texturemanager != null) { texturemanager.bindTexture(p_147499_1_); } } - public void render(double d0, double d1, double d2) - { + public void render(double d0, double d1, double d2) { int xDiff = this.xFinal - this.xInit; int yDiff = this.yFinal - this.yInit; int zDiff = this.zFinal - this.zInit; - float planarAngle = (float) (Math.atan2(-zDiff, xDiff) * 180d / Math.PI); //Radians + float planarAngle = (float) (Math.atan2(-zDiff, xDiff) * 180d / Math.PI); // Radians float verticalAngle = (float) (Math.atan2(yDiff, Math.sqrt(xDiff * xDiff + zDiff + zDiff)) * 180d / Math.PI); - float distance = (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff); //Total distance + float distance = (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff); // Total distance GL11.glPushMatrix(); float f1 = 1.0f; @@ -85,7 +78,6 @@ public class BeamRenderer GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDepthMask(false); tessellator.startDrawingQuads(); @@ -102,7 +94,7 @@ public class BeamRenderer double d23 = outside; double d24 = outside; double d25 = outside; - double d26 = (double) (distance * f1);// + 0.2; + double d26 = (double) (distance * f1); // + 0.2; double d27 = 0.0D; double d28 = 1.0D; double d29 = (double) (-1.0F + f3); @@ -110,9 +102,9 @@ public class BeamRenderer GL11.glTranslated(d0 + 0.5, d1 + 0.5, d2 + 0.5); - GL11.glRotatef(planarAngle, 0F, 1F, 0F); //Rotate on planar axis - GL11.glRotatef(verticalAngle, 0F, 0F, 1F); //Rotate vertical axis - //GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically + GL11.glRotatef(planarAngle, 0F, 1F, 0F); // Rotate on planar axis + GL11.glRotatef(verticalAngle, 0F, 0F, 1F); // Rotate vertical axis + // GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically double offset = 0; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderAlchemicCalcinator.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderAlchemicCalcinator.java index e36e6da4..32f16ea3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderAlchemicCalcinator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderAlchemicCalcinator.java @@ -19,20 +19,16 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer -{ +public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer { private final RenderItem customRenderItem; private ModelAlchemicalCalcinator modelConduit = new ModelAlchemicalCalcinator(); private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png"); - public RenderAlchemicCalcinator() - { - customRenderItem = new RenderItem() - { + public RenderAlchemicCalcinator() { + customRenderItem = new RenderItem() { @Override - public boolean shouldBob() - { + public boolean shouldBob() { return false; } }; @@ -40,10 +36,8 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer } @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEAlchemicCalcinator) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEAlchemicCalcinator) { TEAlchemicCalcinator tileAltar = (TEAlchemicCalcinator) tileEntity; GL11.glPushMatrix(); @@ -58,8 +52,7 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer GL11.glPushMatrix(); - if (tileAltar.getStackInSlot(1) != null) - { + if (tileAltar.getStackInSlot(1) != null) { boolean fancySaved = Minecraft.isFancyGraphicsEnabled(); Minecraft.getMinecraft().gameSettings.fancyGraphics = true; @@ -70,17 +63,17 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(1)); float displacement = 0.2F; - if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) - { + if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F); - } else - { - GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f * 2f); + } else { + GL11.glTranslatef( + (float) d0 + 0.5F, + (float) d1 + displacement + 10.4f / 16.0f, + (float) d2 + 0.5F - 0.0625f * 2f); } GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); - if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) - { + if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) { GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F); } @@ -88,12 +81,10 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer Minecraft.getMinecraft().gameSettings.fancyGraphics = fancySaved; } - GL11.glPopMatrix(); GL11.glPushMatrix(); - if (tileAltar.getStackInSlot(0) != null) - { + if (tileAltar.getStackInSlot(0) != null) { boolean fancySaved = Minecraft.isFancyGraphicsEnabled(); Minecraft.getMinecraft().gameSettings.fancyGraphics = true; @@ -104,17 +95,17 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0)); float displacement = -0.5F; - if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) - { + if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F); - } else - { - GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f * 2f); + } else { + GL11.glTranslatef( + (float) d0 + 0.5F, + (float) d1 + displacement + 10.4f / 16.0f, + (float) d2 + 0.5F - 0.0625f * 2f); } GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); - if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) - { + if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) { GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F); } @@ -124,23 +115,27 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer GL11.glPopMatrix(); - ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN); - if (info.length >= 1 && info[0] != null) - { + if (info.length >= 1 && info[0] != null) { ReagentStack reagentStack = info[0].reagent; int capacity = info[0].capacity; - if (reagentStack != null && reagentStack.reagent != null) - { + if (reagentStack != null && reagentStack.reagent != null) { Reagent reagent = reagentStack.reagent; - this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity); + this.renderTankContents( + d0, + d1, + d2, + reagent.getColourRed(), + reagent.getColourGreen(), + reagent.getColourBlue(), + 200 * reagentStack.amount / capacity); } } } } - private void renderTankContents(double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity) - { + private void renderTankContents( + double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity) { GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; this.bindTexture(resourceLocation); @@ -196,16 +191,12 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer GL11.glPopMatrix(); } - private float getGhostItemScaleFactor(ItemStack itemStack) - { + private float getGhostItemScaleFactor(ItemStack itemStack) { float scaleFactor = 1.5F; - if (itemStack != null) - { - if (itemStack.getItem() instanceof ItemBlock) - { - switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) - { + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBlock) { + switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) { case 1: return 0.90F * scaleFactor; @@ -224,10 +215,8 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer default: return 0.90F * scaleFactor; } - } else - { - switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) - { + } else { + switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) { case 1: return 0.65F * scaleFactor; @@ -249,10 +238,8 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer return scaleFactor; } - private float getXDisplacementForSlot(int slot) - { - switch (slot) - { + private float getXDisplacementForSlot(int slot) { + switch (slot) { case 0: return 0.0f; @@ -276,10 +263,8 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer } } - private float getYDisplacementForSlot(int slot) - { - switch (slot) - { + private float getYDisplacementForSlot(int slot) { + switch (slot) { case 0: return 0.4f; @@ -294,10 +279,8 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer } } - private float getZDisplacementForSlot(int slot) - { - switch (slot) - { + private float getZDisplacementForSlot(int slot) { + switch (slot) { case 0: return 0.0f; @@ -321,111 +304,88 @@ public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer } } - private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) - { - if (ghostItemStack != null) - { - if (ghostItemStack.getItem() instanceof ItemBlock) - { - switch (forgeDirection) - { - case DOWN: - { + private void translateGhostItemByOrientation( + ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) { + if (ghostItemStack != null) { + if (ghostItemStack.getItem() instanceof ItemBlock) { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } - } else - { - switch (forgeDirection) - { - case DOWN: - { + } else { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } } } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderConduit.java index 07a1ffd8..1f934f7d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderConduit.java @@ -9,15 +9,12 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -public class RenderConduit extends TileEntitySpecialRenderer -{ +public class RenderConduit extends TileEntitySpecialRenderer { private ModelConduit modelConduit = new ModelConduit(); @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEConduit) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEConduit) { TEConduit tileConduit = (TEConduit) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); @@ -25,9 +22,18 @@ public class RenderConduit extends TileEntitySpecialRenderer FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileConduit.getInputDirection(), tileConduit.getOutputDirection()); + this.modelConduit.render( + (Entity) null, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0625F, + tileConduit.getInputDirection(), + tileConduit.getOutputDirection()); GL11.glPopMatrix(); GL11.glPopMatrix(); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderCrystalBelljar.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderCrystalBelljar.java index b37b9391..213cc292 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderCrystalBelljar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderCrystalBelljar.java @@ -14,18 +14,14 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -public class RenderCrystalBelljar extends TileEntitySpecialRenderer -{ +public class RenderCrystalBelljar extends TileEntitySpecialRenderer { private ModelCrystalBelljar modelConduit = new ModelCrystalBelljar(); private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png"); - @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEBellJar) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEBellJar) { TEBellJar tileAltar = (TEBellJar) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); @@ -38,21 +34,26 @@ public class RenderCrystalBelljar extends TileEntitySpecialRenderer GL11.glPopMatrix(); ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN); - if (info.length >= 1 && info[0] != null) - { + if (info.length >= 1 && info[0] != null) { ReagentStack reagentStack = info[0].reagent; int capacity = info[0].capacity; - if (reagentStack != null && reagentStack.reagent != null) - { + if (reagentStack != null && reagentStack.reagent != null) { Reagent reagent = reagentStack.reagent; - this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity); + this.renderTankContents( + d0, + d1, + d2, + reagent.getColourRed(), + reagent.getColourGreen(), + reagent.getColourBlue(), + 200 * reagentStack.amount / capacity); } } } } - private void renderTankContents(double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity) - { + private void renderTankContents( + double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity) { GL11.glPushMatrix(); float f1 = 1.0f; Tessellator tessellator = Tessellator.instance; @@ -113,4 +114,4 @@ public class RenderCrystalBelljar extends TileEntitySpecialRenderer GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderMasterStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderMasterStone.java index 968ddf3e..34a9f0a6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderMasterStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderMasterStone.java @@ -6,20 +6,16 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; -public class RenderMasterStone extends TileEntitySpecialRenderer -{ +public class RenderMasterStone extends TileEntitySpecialRenderer { @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEMasterStone) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEMasterStone) { String str = ((TEMasterStone) tileEntity).getCurrentRitual(); MRSRenderer renderer = Rituals.getRendererForKey(str); - if (renderer != null) - { + if (renderer != null) { renderer.renderAt(((TEMasterStone) tileEntity), d0, d1, d2); } } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java index 42c92c88..ae8c6af4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java @@ -15,18 +15,14 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -public class RenderPedestal extends TileEntitySpecialRenderer -{ +public class RenderPedestal extends TileEntitySpecialRenderer { private ModelPedestal modelPedestal = new ModelPedestal(); private final RenderItem customRenderItem; - public RenderPedestal() - { - customRenderItem = new RenderItem() - { + public RenderPedestal() { + customRenderItem = new RenderItem() { @Override - public boolean shouldBob() - { + public boolean shouldBob() { return false; } }; @@ -34,10 +30,8 @@ public class RenderPedestal extends TileEntitySpecialRenderer } @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEPedestal) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEPedestal) { TEPedestal tileAltar = (TEPedestal) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); @@ -50,21 +44,20 @@ public class RenderPedestal extends TileEntitySpecialRenderer GL11.glPopMatrix(); GL11.glPushMatrix(); - if (tileAltar.getStackInSlot(0) != null) - { + if (tileAltar.getStackInSlot(0) != null) { float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0)); - float rotationAngle = Minecraft.isFancyGraphicsEnabled() ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0; + float rotationAngle = Minecraft.isFancyGraphicsEnabled() + ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) + : 0; EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj()); ghostEntityItem.hoverStart = 0.0F; ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0)); float displacement = 0.2F; - if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) - { + if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F); - } else - { + } else { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.6F, (float) d2 + 0.5F); } GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); @@ -74,7 +67,6 @@ public class RenderPedestal extends TileEntitySpecialRenderer GL11.glPopMatrix(); - GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); @@ -86,16 +78,12 @@ public class RenderPedestal extends TileEntitySpecialRenderer } } - private float getGhostItemScaleFactor(ItemStack itemStack) - { + private float getGhostItemScaleFactor(ItemStack itemStack) { float scaleFactor = 1.0F; - if (itemStack != null) - { - if (itemStack.getItem() instanceof ItemBlock) - { - switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) - { + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBlock) { + switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) { case 1: return 0.90F; @@ -114,10 +102,8 @@ public class RenderPedestal extends TileEntitySpecialRenderer default: return 0.90F; } - } else - { - switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) - { + } else { + switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) { case 1: return 0.65F; @@ -139,111 +125,88 @@ public class RenderPedestal extends TileEntitySpecialRenderer return scaleFactor; } - private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) - { - if (ghostItemStack != null) - { - if (ghostItemStack.getItem() instanceof ItemBlock) - { - switch (forgeDirection) - { - case DOWN: - { + private void translateGhostItemByOrientation( + ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) { + if (ghostItemStack != null) { + if (ghostItemStack.getItem() instanceof ItemBlock) { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } - } else - { - switch (forgeDirection) - { - case DOWN: - { + } else { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } } } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPlinth.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPlinth.java index 28deb98c..646ddca2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPlinth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPlinth.java @@ -15,18 +15,14 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -public class RenderPlinth extends TileEntitySpecialRenderer -{ +public class RenderPlinth extends TileEntitySpecialRenderer { private ModelPlinth modelPlinth = new ModelPlinth(); private final RenderItem customRenderItem; - public RenderPlinth() - { - customRenderItem = new RenderItem() - { + public RenderPlinth() { + customRenderItem = new RenderItem() { @Override - public boolean shouldBob() - { + public boolean shouldBob() { return false; } }; @@ -34,10 +30,8 @@ public class RenderPlinth extends TileEntitySpecialRenderer } @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEPlinth) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEPlinth) { TEPlinth tilePlinth = (TEPlinth) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); @@ -50,8 +44,7 @@ public class RenderPlinth extends TileEntitySpecialRenderer GL11.glPopMatrix(); GL11.glPushMatrix(); - if (tilePlinth.getStackInSlot(0) != null) - { + if (tilePlinth.getStackInSlot(0) != null) { boolean fancySaved = Minecraft.isFancyGraphicsEnabled(); Minecraft.getMinecraft().gameSettings.fancyGraphics = true; @@ -62,17 +55,15 @@ public class RenderPlinth extends TileEntitySpecialRenderer ghostEntityItem.setEntityItemStack(tilePlinth.getStackInSlot(0)); float displacement = 0.2F; - if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) - { + if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F); - } else - { - GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.1875f); + } else { + GL11.glTranslatef( + (float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.1875f); } GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); - if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) - { + if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) { GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F); } @@ -85,16 +76,12 @@ public class RenderPlinth extends TileEntitySpecialRenderer } } - private float getGhostItemScaleFactor(ItemStack itemStack) - { + private float getGhostItemScaleFactor(ItemStack itemStack) { float scaleFactor = 2.0F / 0.9F; - if (itemStack != null) - { - if (itemStack.getItem() instanceof ItemBlock) - { - switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) - { + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBlock) { + switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) { case 1: return 0.90F * scaleFactor / 2; @@ -113,10 +100,8 @@ public class RenderPlinth extends TileEntitySpecialRenderer default: return 0.90F * scaleFactor / 2; } - } else - { - switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) - { + } else { + switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) { case 1: return 0.65F * scaleFactor; @@ -138,108 +123,85 @@ public class RenderPlinth extends TileEntitySpecialRenderer return scaleFactor; } - private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) - { - if (ghostItemStack != null) - { - if (ghostItemStack.getItem() instanceof ItemBlock) - { - switch (forgeDirection) - { - case DOWN: - { + private void translateGhostItemByOrientation( + ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) { + if (ghostItemStack != null) { + if (ghostItemStack.getItem() instanceof ItemBlock) { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } - } else - { - switch (forgeDirection) - { - case DOWN: - { + } else { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderReagentConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderReagentConduit.java index 3ab80b7e..67e4582e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderReagentConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderReagentConduit.java @@ -6,18 +6,15 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; -public class RenderReagentConduit extends TileEntitySpecialRenderer -{ - private static final ResourceLocation field_110629_a = new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"); +public class RenderReagentConduit extends TileEntitySpecialRenderer { + private static final ResourceLocation field_110629_a = + new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"); @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEReagentConduit) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEReagentConduit) { int renderCount = ((TEReagentConduit) tileEntity).renderCount; float key1 = (tileEntity.xCoord * 54f - tileEntity.yCoord * 38.72f + tileEntity.zCoord * 10.432f); float key2 = (tileEntity.xCoord * 21.43f - tileEntity.yCoord * 9.96f + tileEntity.zCoord * 12.8f); @@ -35,9 +32,9 @@ public class RenderReagentConduit extends TileEntitySpecialRenderer tessellator.startDrawingQuads(); tessellator.setColorRGBA(colourMap.xCoord, colourMap.yCoord, colourMap.zCoord, 200); GL11.glTranslated(d0 + 0.5, d1 + 0.5, d2 + 0.5); - GL11.glRotatef(tileEntity.getWorldObj().getWorldTime() / 3.0f, 0F, 1F, 0F); //Rotate on planar axis - GL11.glRotatef(renderCount + key1, 0F, 0F, 1F); //Rotate vertical axis - GL11.glRotatef(renderCount * 2f + key2, 1F, 0F, 0F); //Rotate cylindrically + GL11.glRotatef(tileEntity.getWorldObj().getWorldTime() / 3.0f, 0F, 1F, 0F); // Rotate on planar axis + GL11.glRotatef(renderCount + key1, 0F, 0F, 1F); // Rotate vertical axis + GL11.glRotatef(renderCount * 2f + key2, 1F, 0F, 0F); // Rotate cylindrically tessellator.setBrightness(240); tessellator.addVertexWithUV(-0.5d, 0, -0.5d, 0.0d, 0.0d); tessellator.addVertexWithUV(0.5d, 0, -0.5d, 1.0d, 0.0d); @@ -54,4 +51,4 @@ public class RenderReagentConduit extends TileEntitySpecialRenderer GL11.glPopMatrix(); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEffectBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEffectBlock.java index 555fb5f7..a94740a5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEffectBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEffectBlock.java @@ -8,29 +8,36 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -public class RenderSpellEffectBlock extends TileEntitySpecialRenderer -{ +public class RenderSpellEffectBlock extends TileEntitySpecialRenderer { private ModelSpellEffectBlock modelSpellEffectBlock = new ModelSpellEffectBlock(); @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TESpellEffectBlock) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TESpellEffectBlock) { TESpellEffectBlock tileSpellBlock = (TESpellEffectBlock) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); ResourceLocation test; - int meta = tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + int meta = + tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); String resource = tileSpellBlock.getResourceLocationForMeta(meta); test = new ResourceLocation(resource); FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellEffectBlock.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileSpellBlock.getInputDirection(), tileSpellBlock.getOutputDirection()); + this.modelSpellEffectBlock.render( + null, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0625F, + tileSpellBlock.getInputDirection(), + tileSpellBlock.getOutputDirection()); GL11.glPopMatrix(); GL11.glPopMatrix(); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEnhancementBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEnhancementBlock.java index 2f2d0ff3..7de1b873 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEnhancementBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellEnhancementBlock.java @@ -8,29 +8,36 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -public class RenderSpellEnhancementBlock extends TileEntitySpecialRenderer -{ +public class RenderSpellEnhancementBlock extends TileEntitySpecialRenderer { private ModelSpellEnhancementBlock modelSpellEnhancementBlock = new ModelSpellEnhancementBlock(); @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TESpellEnhancementBlock) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TESpellEnhancementBlock) { TESpellEnhancementBlock tileSpellBlock = (TESpellEnhancementBlock) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); ResourceLocation test; - int meta = tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + int meta = + tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); String resource = tileSpellBlock.getResourceLocationForMeta(meta); test = new ResourceLocation(resource); FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellEnhancementBlock.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileSpellBlock.getInputDirection(), tileSpellBlock.getOutputDirection()); + this.modelSpellEnhancementBlock.render( + null, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0625F, + tileSpellBlock.getInputDirection(), + tileSpellBlock.getOutputDirection()); GL11.glPopMatrix(); GL11.glPopMatrix(); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellModifierBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellModifierBlock.java index 0a972266..f8bc9723 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellModifierBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellModifierBlock.java @@ -8,29 +8,36 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -public class RenderSpellModifierBlock extends TileEntitySpecialRenderer -{ +public class RenderSpellModifierBlock extends TileEntitySpecialRenderer { private ModelSpellModifierBlock modelSpellModifierBlock = new ModelSpellModifierBlock(); @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TESpellModifierBlock) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TESpellModifierBlock) { TESpellModifierBlock tileSpellBlock = (TESpellModifierBlock) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); ResourceLocation test; - int meta = tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + int meta = + tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); String resource = tileSpellBlock.getResourceLocationForMeta(meta); test = new ResourceLocation(resource); FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellModifierBlock.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileSpellBlock.getInputDirection(), tileSpellBlock.getOutputDirection()); + this.modelSpellModifierBlock.render( + null, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0625F, + tileSpellBlock.getInputDirection(), + tileSpellBlock.getOutputDirection()); GL11.glPopMatrix(); GL11.glPopMatrix(); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellParadigmBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellParadigmBlock.java index ca0f9336..28105cdc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellParadigmBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderSpellParadigmBlock.java @@ -8,29 +8,36 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -public class RenderSpellParadigmBlock extends TileEntitySpecialRenderer -{ +public class RenderSpellParadigmBlock extends TileEntitySpecialRenderer { private ModelSpellParadigmBlock modelSpellParadigmBlock = new ModelSpellParadigmBlock(); @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TESpellParadigmBlock) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TESpellParadigmBlock) { TESpellParadigmBlock tileSpellBlock = (TESpellParadigmBlock) tileEntity; GL11.glPushMatrix(); GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); ResourceLocation test; - int meta = tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + int meta = + tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); String resource = tileSpellBlock.getResourceLocationForMeta(meta); test = new ResourceLocation(resource); FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellParadigmBlock.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileSpellBlock.getInputDirection(), tileSpellBlock.getOutputDirection()); + this.modelSpellParadigmBlock.render( + null, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + 0.0625F, + tileSpellBlock.getInputDirection(), + tileSpellBlock.getOutputDirection()); GL11.glPopMatrix(); GL11.glPopMatrix(); } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderWritingTable.java index c9f36674..1350185c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderWritingTable.java @@ -13,21 +13,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -public class RenderWritingTable extends TileEntitySpecialRenderer -{ +public class RenderWritingTable extends TileEntitySpecialRenderer { private ModelWritingTable modelWritingTable = new ModelWritingTable(); private final RenderItem customRenderItem; - public RenderWritingTable() - { - customRenderItem = new RenderItem() - { + public RenderWritingTable() { + customRenderItem = new RenderItem() { @Override - public boolean shouldBob() - { + public boolean shouldBob() { return false; } }; @@ -35,10 +30,8 @@ public class RenderWritingTable extends TileEntitySpecialRenderer } @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEWritingTable) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEWritingTable) { TEWritingTable tileAltar = (TEWritingTable) tileEntity; GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); @@ -51,14 +44,14 @@ public class RenderWritingTable extends TileEntitySpecialRenderer GL11.glPopMatrix(); GL11.glPopMatrix(); - for (int i = 1; i <= 6; i++) - { + for (int i = 1; i <= 6; i++) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_LIGHTING); - if (tileAltar.getStackInSlot(i) != null) - { + if (tileAltar.getStackInSlot(i) != null) { float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(i)); - float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0; + float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics + ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) + : 0; EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj()); ghostEntityItem.hoverStart = 0.0F; ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(i)); @@ -66,12 +59,16 @@ public class RenderWritingTable extends TileEntitySpecialRenderer float displacementY = getYDisplacementForSlot(i); float displacementZ = getZDisplacementForSlot(i); - if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) - { - GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.7F, (float) d2 + 0.5F + displacementZ); - } else - { - GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.6F, (float) d2 + 0.5F + displacementZ); + if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) { + GL11.glTranslatef( + (float) d0 + 0.5F + displacementX, + (float) d1 + displacementY + 0.7F, + (float) d2 + 0.5F + displacementZ); + } else { + GL11.glTranslatef( + (float) d0 + 0.5F + displacementX, + (float) d1 + displacementY + 0.6F, + (float) d2 + 0.5F + displacementZ); } GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); @@ -83,16 +80,12 @@ public class RenderWritingTable extends TileEntitySpecialRenderer } } - private float getGhostItemScaleFactor(ItemStack itemStack) - { + private float getGhostItemScaleFactor(ItemStack itemStack) { float scaleFactor = 0.8F; - if (itemStack != null) - { - if (itemStack.getItem() instanceof ItemBlock) - { - switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) - { + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBlock) { + switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) { case 1: return 0.90F * scaleFactor; @@ -111,10 +104,8 @@ public class RenderWritingTable extends TileEntitySpecialRenderer default: return 0.90F * scaleFactor; } - } else - { - switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) - { + } else { + switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) { case 1: return 0.65F * scaleFactor; @@ -136,10 +127,8 @@ public class RenderWritingTable extends TileEntitySpecialRenderer return scaleFactor; } - private float getXDisplacementForSlot(int slot) - { - switch (slot) - { + private float getXDisplacementForSlot(int slot) { + switch (slot) { case 0: return 0.0f; @@ -163,10 +152,8 @@ public class RenderWritingTable extends TileEntitySpecialRenderer } } - private float getYDisplacementForSlot(int slot) - { - switch (slot) - { + private float getYDisplacementForSlot(int slot) { + switch (slot) { case 0: return 0.4f; @@ -181,10 +168,8 @@ public class RenderWritingTable extends TileEntitySpecialRenderer } } - private float getZDisplacementForSlot(int slot) - { - switch (slot) - { + private float getZDisplacementForSlot(int slot) { + switch (slot) { case 0: return 0.0f; @@ -208,111 +193,88 @@ public class RenderWritingTable extends TileEntitySpecialRenderer } } - private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) - { - if (ghostItemStack != null) - { - if (ghostItemStack.getItem() instanceof ItemBlock) - { - switch (forgeDirection) - { - case DOWN: - { + private void translateGhostItemByOrientation( + ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) { + if (ghostItemStack != null) { + if (ghostItemStack.getItem() instanceof ItemBlock) { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } - } else - { - switch (forgeDirection) - { - case DOWN: - { + } else { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { - + default: { } } } } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/TEAltarRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/TEAltarRenderer.java index 0f706f6f..b6afb745 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/TEAltarRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/TEAltarRenderer.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.common.renderer.block; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; @@ -9,24 +11,16 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar; -import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; - -public class TEAltarRenderer extends TileEntitySpecialRenderer -{ +public class TEAltarRenderer extends TileEntitySpecialRenderer { private ModelBloodAltar modelBloodAltar = new ModelBloodAltar(); private final RenderItem customRenderItem; - public TEAltarRenderer() - { - customRenderItem = new RenderItem() - { + public TEAltarRenderer() { + customRenderItem = new RenderItem() { @Override - public boolean shouldBob() - { + public boolean shouldBob() { return false; } }; @@ -34,33 +28,30 @@ public class TEAltarRenderer extends TileEntitySpecialRenderer } @Override - public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) - { - if (tileEntity instanceof TEAltar) - { + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) { + if (tileEntity instanceof TEAltar) { modelBloodAltar.renderBloodAltar((TEAltar) tileEntity, d0, d1, d2); - if (((TEAltar)tileEntity).getCurrentBlood() > 0) + if (((TEAltar) tileEntity).getCurrentBlood() > 0) modelBloodAltar.renderBloodLevel((TEAltar) tileEntity, d0, d1, d2); TEAltar tileAltar = (TEAltar) tileEntity; GL11.glPushMatrix(); - if (tileAltar.getStackInSlot(0) != null) - { + if (tileAltar.getStackInSlot(0) != null) { float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0)); - float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0; + float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics + ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) + : 0; EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj()); ghostEntityItem.hoverStart = 0.0F; ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0)); float displacement = 0.2F; - if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) - { + if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F); - } else - { + } else { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.6F, (float) d2 + 0.5F); } GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); @@ -72,16 +63,12 @@ public class TEAltarRenderer extends TileEntitySpecialRenderer } } - private float getGhostItemScaleFactor(ItemStack itemStack) - { + private float getGhostItemScaleFactor(ItemStack itemStack) { float scaleFactor = 1.0F; - if (itemStack != null) - { - if (itemStack.getItem() instanceof ItemBlock) - { - switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) - { + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBlock) { + switch (customRenderItem.getMiniBlockCount(itemStack, (byte) 1)) { case 1: return 0.90F; @@ -100,10 +87,8 @@ public class TEAltarRenderer extends TileEntitySpecialRenderer default: return 0.90F; } - } else - { - switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) - { + } else { + switch (customRenderItem.getMiniItemCount(itemStack, (byte) 1)) { case 1: return 0.65F; @@ -125,107 +110,86 @@ public class TEAltarRenderer extends TileEntitySpecialRenderer return scaleFactor; } - private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) - { - if (ghostItemStack != null) - { - if (ghostItemStack.getItem() instanceof ItemBlock) - { - switch (forgeDirection) - { - case DOWN: - { + private void translateGhostItemByOrientation( + ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) { + if (ghostItemStack != null) { + if (ghostItemStack.getItem() instanceof ItemBlock) { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { + default: { return; } } - } else - { - switch (forgeDirection) - { - case DOWN: - { + } else { + switch (forgeDirection) { + case DOWN: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F); return; } - case UP: - { + case UP: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F); return; } - case NORTH: - { + case NORTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F); return; } - case SOUTH: - { + case SOUTH: { GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F); return; } - case EAST: - { + case EAST: { GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F); return; } - case WEST: - { + case WEST: { GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F); return; } - case UNKNOWN: - { + case UNKNOWN: { return; } - default: - { + default: { return; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAlchemicalCalcinatorItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAlchemicalCalcinatorItemRenderer.java index 22c6c645..01555384 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAlchemicalCalcinatorItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAlchemicalCalcinatorItemRenderer.java @@ -1,22 +1,18 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.IItemRenderer; - -import org.lwjgl.opengl.GL11; - import WayofTime.alchemicalWizardry.common.renderer.model.ModelAlchemicalCalcinator; import cpw.mods.fml.client.FMLClientHandler; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import org.lwjgl.opengl.GL11; -public class TEAlchemicalCalcinatorItemRenderer implements IItemRenderer -{ +public class TEAlchemicalCalcinatorItemRenderer implements IItemRenderer { private ModelAlchemicalCalcinator modelConduit = new ModelAlchemicalCalcinator(); - private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) - { + private void renderConduitItem( + RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix(); GL11.glTranslatef(translateX + 0.5F, translateY + 1.5F, translateZ + 0.5F); ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/AlchemicalCalcinator.png"); @@ -28,15 +24,12 @@ public class TEAlchemicalCalcinatorItemRenderer implements IItemRenderer GL11.glPopMatrix(); } - /** * IItemRenderer implementation * */ @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - switch (type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { case ENTITY: return true; case EQUIPPED: @@ -50,19 +43,14 @@ public class TEAlchemicalCalcinatorItemRenderer implements IItemRenderer } } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - switch (type) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { case ENTITY: renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); break; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAltarItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAltarItemRenderer.java index df81d2d7..f8ef4e20 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAltarItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEAltarItemRenderer.java @@ -8,33 +8,27 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -public class TEAltarItemRenderer implements IItemRenderer -{ +public class TEAltarItemRenderer implements IItemRenderer { private ModelBloodAltar modelBloodAltar; - public TEAltarItemRenderer() - { + public TEAltarItemRenderer() { modelBloodAltar = new ModelBloodAltar(); } @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { float scale = 0.08f; - switch (type) - { + switch (type) { case ENTITY: renderBloodAltar((RenderBlocks) data[0], item, 0, 0, 0, scale); break; @@ -53,8 +47,7 @@ public class TEAltarItemRenderer implements IItemRenderer } } - private void renderBloodAltar(RenderBlocks render, ItemStack item, float x, float y, float z, float scale) - { + private void renderBloodAltar(RenderBlocks render, ItemStack item, float x, float y, float z, float scale) { GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glScalef(scale, scale, scale); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEBellJarItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEBellJarItemRenderer.java index b9826145..00889ad8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEBellJarItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEBellJarItemRenderer.java @@ -1,31 +1,29 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.IItemRenderer; - -import org.lwjgl.opengl.GL11; - import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; import WayofTime.alchemicalWizardry.common.renderer.model.ModelCrystalBelljar; import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar; import cpw.mods.fml.client.FMLClientHandler; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import org.lwjgl.opengl.GL11; -public class TEBellJarItemRenderer implements IItemRenderer -{ +public class TEBellJarItemRenderer implements IItemRenderer { ItemRenderer d; private ModelCrystalBelljar modelConduit = new ModelCrystalBelljar(); - private ResourceLocation mainResource = new ResourceLocation("alchemicalwizardry:textures/models/CrystalBelljar.png"); + private ResourceLocation mainResource = + new ResourceLocation("alchemicalwizardry:textures/models/CrystalBelljar.png"); private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png"); - private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) - { + private void renderConduitItem( + RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix(); GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(mainResource); @@ -36,17 +34,22 @@ public class TEBellJarItemRenderer implements IItemRenderer GL11.glPopMatrix(); ReagentContainerInfo[] info = TEBellJar.getContainerInfoFromItem(item); - if (info.length >= 1 && info[0] != null) - { + if (info.length >= 1 && info[0] != null) { ReagentStack reagentStack = info[0].reagent; int capacity = info[0].capacity; - if (reagentStack != null && reagentStack.reagent != null) - { + if (reagentStack != null && reagentStack.reagent != null) { Reagent reagent = reagentStack.reagent; - this.renderTankContents(translateX, translateY, translateZ, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity); + this.renderTankContents( + translateX, + translateY, + translateZ, + reagent.getColourRed(), + reagent.getColourGreen(), + reagent.getColourBlue(), + 200 * reagentStack.amount / capacity); } } - + GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -64,8 +67,8 @@ public class TEBellJarItemRenderer implements IItemRenderer GL11.glDisable(GL11.GL_BLEND); } - private void renderTankContents(double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity) - { + private void renderTankContents( + double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity) { GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; FMLClientHandler.instance().getClient().renderEngine.bindTexture(resourceLocation); @@ -133,10 +136,8 @@ public class TEBellJarItemRenderer implements IItemRenderer * IItemRenderer implementation * */ @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - switch (type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { case ENTITY: return true; case EQUIPPED: @@ -150,19 +151,14 @@ public class TEBellJarItemRenderer implements IItemRenderer } } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - switch (type) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { case ENTITY: renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); break; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEConduitItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEConduitItemRenderer.java index e0e4a79d..5ed9ecde 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEConduitItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEConduitItemRenderer.java @@ -1,43 +1,38 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelConduit; +import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelConduit; -import cpw.mods.fml.client.FMLClientHandler; - -public class TEConduitItemRenderer implements IItemRenderer -{ +public class TEConduitItemRenderer implements IItemRenderer { private ModelConduit modelConduit = new ModelConduit(); - private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) - { + private void renderConduitItem( + RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix(); GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F); ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/Conduit.png"); FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); + this.modelConduit.render( + (Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); GL11.glPopMatrix(); GL11.glPopMatrix(); } - /** * IItemRenderer implementation * */ @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - switch (type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { case ENTITY: return true; case EQUIPPED: @@ -51,19 +46,14 @@ public class TEConduitItemRenderer implements IItemRenderer } } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - switch (type) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { case ENTITY: renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); break; @@ -79,4 +69,4 @@ public class TEConduitItemRenderer implements IItemRenderer default: } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEffectBlockItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEffectBlockItemRenderer.java index 9f481de1..5a9db90d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEffectBlockItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEffectBlockItemRenderer.java @@ -1,23 +1,20 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellEffectBlock; +import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellEffectBlock; -import cpw.mods.fml.client.FMLClientHandler; - -public class TESpellEffectBlockItemRenderer implements IItemRenderer -{ +public class TESpellEffectBlockItemRenderer implements IItemRenderer { private ModelSpellEffectBlock modelSpellBlock = new ModelSpellEffectBlock(); - private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) - { + private void renderConduitItem( + RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix(); GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F); ResourceLocation test = new ResourceLocation(this.getResourceLocationForMeta(item.getItemDamage())); @@ -25,20 +22,18 @@ public class TESpellEffectBlockItemRenderer implements IItemRenderer FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellBlock.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); + this.modelSpellBlock.render( + (Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); GL11.glPopMatrix(); GL11.glPopMatrix(); } - /** * IItemRenderer implementation * */ @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - switch (type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { case ENTITY: return true; case EQUIPPED: @@ -52,19 +47,14 @@ public class TESpellEffectBlockItemRenderer implements IItemRenderer } } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - switch (type) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { case ENTITY: renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); break; @@ -81,10 +71,8 @@ public class TESpellEffectBlockItemRenderer implements IItemRenderer } } - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { + public String getResourceLocationForMeta(int meta) { + switch (meta) { case 0: return "alchemicalwizardry:textures/models/SpellEffectFire.png"; case 1: diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEnhancementBlockItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEnhancementBlockItemRenderer.java index 0fbd6e01..c9c67657 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEnhancementBlockItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellEnhancementBlockItemRenderer.java @@ -1,23 +1,20 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellEnhancementBlock; +import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellEnhancementBlock; -import cpw.mods.fml.client.FMLClientHandler; - -public class TESpellEnhancementBlockItemRenderer implements IItemRenderer -{ +public class TESpellEnhancementBlockItemRenderer implements IItemRenderer { private ModelSpellEnhancementBlock modelSpellBlock = new ModelSpellEnhancementBlock(); - private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) - { + private void renderConduitItem( + RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix(); GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F); ResourceLocation test = new ResourceLocation(this.getResourceLocationForMeta(item.getItemDamage())); @@ -25,20 +22,18 @@ public class TESpellEnhancementBlockItemRenderer implements IItemRenderer FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellBlock.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); + this.modelSpellBlock.render( + (Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); GL11.glPopMatrix(); GL11.glPopMatrix(); } - /** * IItemRenderer implementation * */ @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - switch (type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { case ENTITY: return true; case EQUIPPED: @@ -52,19 +47,14 @@ public class TESpellEnhancementBlockItemRenderer implements IItemRenderer } } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - switch (type) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { case ENTITY: renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); break; @@ -81,35 +71,32 @@ public class TESpellEnhancementBlockItemRenderer implements IItemRenderer } } - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { - case 0: - return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png"; - case 1: - return "alchemicalwizardry:textures/models/SpellEnhancementPower2.png"; - case 2: - return "alchemicalwizardry:textures/models/SpellEnhancementPower3.png"; - case 3: - return "alchemicalwizardry:textures/models/SpellEnhancementPower4.png"; - case 5: - return "alchemicalwizardry:textures/models/SpellEnhancementCost1.png"; - case 6: - return "alchemicalwizardry:textures/models/SpellEnhancementCost2.png"; - case 7: - return "alchemicalwizardry:textures/models/SpellEnhancementCost3.png"; - case 8: - return "alchemicalwizardry:textures/models/SpellEnhancementCost4.png"; - case 10: - return "alchemicalwizardry:textures/models/SpellEnhancementPotency1.png"; - case 11: - return "alchemicalwizardry:textures/models/SpellEnhancementPotency2.png"; - case 12: - return "alchemicalwizardry:textures/models/SpellEnhancementPotency3.png"; - case 13: - return "alchemicalwizardry:textures/models/SpellEnhancementPotency4.png"; - + public String getResourceLocationForMeta(int meta) { + switch (meta) { + case 0: + return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png"; + case 1: + return "alchemicalwizardry:textures/models/SpellEnhancementPower2.png"; + case 2: + return "alchemicalwizardry:textures/models/SpellEnhancementPower3.png"; + case 3: + return "alchemicalwizardry:textures/models/SpellEnhancementPower4.png"; + case 5: + return "alchemicalwizardry:textures/models/SpellEnhancementCost1.png"; + case 6: + return "alchemicalwizardry:textures/models/SpellEnhancementCost2.png"; + case 7: + return "alchemicalwizardry:textures/models/SpellEnhancementCost3.png"; + case 8: + return "alchemicalwizardry:textures/models/SpellEnhancementCost4.png"; + case 10: + return "alchemicalwizardry:textures/models/SpellEnhancementPotency1.png"; + case 11: + return "alchemicalwizardry:textures/models/SpellEnhancementPotency2.png"; + case 12: + return "alchemicalwizardry:textures/models/SpellEnhancementPotency3.png"; + case 13: + return "alchemicalwizardry:textures/models/SpellEnhancementPotency4.png"; } return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png"; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellModifierBlockItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellModifierBlockItemRenderer.java index 7fc7dc63..e5ef0cc6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellModifierBlockItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellModifierBlockItemRenderer.java @@ -1,23 +1,20 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellModifierBlock; +import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellModifierBlock; -import cpw.mods.fml.client.FMLClientHandler; - -public class TESpellModifierBlockItemRenderer implements IItemRenderer -{ +public class TESpellModifierBlockItemRenderer implements IItemRenderer { private ModelSpellModifierBlock modelSpellBlock = new ModelSpellModifierBlock(); - private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) - { + private void renderConduitItem( + RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix(); GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F); ResourceLocation test = new ResourceLocation(this.getResourceLocationForMeta(item.getItemDamage())); @@ -25,20 +22,18 @@ public class TESpellModifierBlockItemRenderer implements IItemRenderer FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellBlock.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); + this.modelSpellBlock.render( + (Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); GL11.glPopMatrix(); GL11.glPopMatrix(); } - /** * IItemRenderer implementation * */ @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - switch (type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { case ENTITY: return true; case EQUIPPED: @@ -52,19 +47,14 @@ public class TESpellModifierBlockItemRenderer implements IItemRenderer } } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - switch (type) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { case ENTITY: renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); break; @@ -81,10 +71,8 @@ public class TESpellModifierBlockItemRenderer implements IItemRenderer } } - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { + public String getResourceLocationForMeta(int meta) { + switch (meta) { case 0: return "alchemicalwizardry:textures/models/SpellModifierDefault.png"; case 1: diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellParadigmBlockItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellParadigmBlockItemRenderer.java index 8bf4da84..93272438 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellParadigmBlockItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TESpellParadigmBlockItemRenderer.java @@ -1,43 +1,38 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender; +import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellParadigmBlock; +import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.common.renderer.model.ModelSpellParadigmBlock; -import cpw.mods.fml.client.FMLClientHandler; - -public class TESpellParadigmBlockItemRenderer implements IItemRenderer -{ +public class TESpellParadigmBlockItemRenderer implements IItemRenderer { private ModelSpellParadigmBlock modelSpellBlock = new ModelSpellParadigmBlock(); - private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) - { + private void renderConduitItem( + RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix(); GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F); ResourceLocation test = new ResourceLocation(this.getResourceLocationForMeta(item.getItemDamage())); FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - this.modelSpellBlock.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); + this.modelSpellBlock.render( + (Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ForgeDirection.DOWN, ForgeDirection.UP); GL11.glPopMatrix(); GL11.glPopMatrix(); } - /** * IItemRenderer implementation * */ @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - switch (type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { case ENTITY: return true; case EQUIPPED: @@ -51,19 +46,14 @@ public class TESpellParadigmBlockItemRenderer implements IItemRenderer } } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - switch (type) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { case ENTITY: renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); break; @@ -80,10 +70,8 @@ public class TESpellParadigmBlockItemRenderer implements IItemRenderer } } - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { + public String getResourceLocationForMeta(int meta) { + switch (meta) { case 0: return "alchemicalwizardry:textures/models/SpellParadigmProjectile.png"; case 1: diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEWritingTableItemRenderer.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEWritingTableItemRenderer.java index b618b248..271328ed 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEWritingTableItemRenderer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/block/itemRender/TEWritingTableItemRenderer.java @@ -8,47 +8,38 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -public class TEWritingTableItemRenderer implements IItemRenderer -{ +public class TEWritingTableItemRenderer implements IItemRenderer { private ModelWritingTable model; - public TEWritingTableItemRenderer() - { + public TEWritingTableItemRenderer() { model = new ModelWritingTable(); } @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { float scale = 0.08f; - switch (type) - { - case ENTITY: - { + switch (type) { + case ENTITY: { renderBloodAltar(0f, 0f, 0f, scale); return; } - case EQUIPPED: - { + case EQUIPPED: { renderBloodAltar(0f, 0f, 0f, scale); return; } - case INVENTORY: - { + case INVENTORY: { renderBloodAltar(0f, -0.25f, 0f, scale); return; } @@ -58,8 +49,7 @@ public class TEWritingTableItemRenderer implements IItemRenderer } } - private void renderBloodAltar(float x, float y, float z, float scale) - { + private void renderBloodAltar(float x, float y, float z, float scale) { GL11.glPushMatrix(); // Disable Lighting Calculations GL11.glDisable(GL11.GL_LIGHTING); @@ -73,4 +63,4 @@ public class TEWritingTableItemRenderer implements IItemRenderer GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBileDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBileDemon.java index 6e7674a3..96773ed3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBileDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBileDemon.java @@ -6,22 +6,19 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderBileDemon extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/BileDemon.png"); +public class RenderBileDemon extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/BileDemon.png"); - public RenderBileDemon(ModelBase par1ModelBase, float par2) - { + public RenderBileDemon(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityBileDemon par1EntityBileDemon) - { + public ResourceLocation func_110832_a(EntityBileDemon par1EntityBileDemon) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityBileDemon) par1Entity); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBoulderFist.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBoulderFist.java index 8ff9516f..5799e1a3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBoulderFist.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderBoulderFist.java @@ -6,22 +6,19 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderBoulderFist extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/BoulderFist.png"); +public class RenderBoulderFist extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/BoulderFist.png"); - public RenderBoulderFist(ModelBase par1ModelBase, float par2) - { + public RenderBoulderFist(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityBoulderFist par1EntityBoulderFist) - { + public ResourceLocation func_110832_a(EntityBoulderFist par1EntityBoulderFist) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityBoulderFist) par1Entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java index 91d92f8d..7e631390 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java @@ -6,57 +6,53 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderElemental extends RenderLiving -{ - private static final ResourceLocation airBeacon = new ResourceLocation("alchemicalwizardry", "textures/models/AirFloatingBeacon.png"); - private static final ResourceLocation waterBeacon = new ResourceLocation("alchemicalwizardry", "textures/models/WaterFloatingBeacon.png"); - private static final ResourceLocation earthBeacon = new ResourceLocation("alchemicalwizardry", "textures/models/EarthFloatingBeacon.png"); - private static final ResourceLocation fireBeacon = new ResourceLocation("alchemicalwizardry", "textures/models/FireFloatingBeacon.png"); - private static final ResourceLocation shadeBeacon = new ResourceLocation("alchemicalwizardry", "textures/models/DarkFloatingBeacon.png"); - private static final ResourceLocation holyBeacon = new ResourceLocation("alchemicalwizardry", "textures/models/HolyFloatingBeacon.png"); +public class RenderElemental extends RenderLiving { + private static final ResourceLocation airBeacon = + new ResourceLocation("alchemicalwizardry", "textures/models/AirFloatingBeacon.png"); + private static final ResourceLocation waterBeacon = + new ResourceLocation("alchemicalwizardry", "textures/models/WaterFloatingBeacon.png"); + private static final ResourceLocation earthBeacon = + new ResourceLocation("alchemicalwizardry", "textures/models/EarthFloatingBeacon.png"); + private static final ResourceLocation fireBeacon = + new ResourceLocation("alchemicalwizardry", "textures/models/FireFloatingBeacon.png"); + private static final ResourceLocation shadeBeacon = + new ResourceLocation("alchemicalwizardry", "textures/models/DarkFloatingBeacon.png"); + private static final ResourceLocation holyBeacon = + new ResourceLocation("alchemicalwizardry", "textures/models/HolyFloatingBeacon.png"); - public RenderElemental(ModelBase par1ModelBase, float par2) - { + public RenderElemental(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityElemental par1EntityElemental) - { - if (par1EntityElemental instanceof EntityAirElemental) - { + public ResourceLocation func_110832_a(EntityElemental par1EntityElemental) { + if (par1EntityElemental instanceof EntityAirElemental) { return airBeacon; } - if (par1EntityElemental instanceof EntityWaterElemental) - { + if (par1EntityElemental instanceof EntityWaterElemental) { return waterBeacon; } - if (par1EntityElemental instanceof EntityEarthElemental) - { + if (par1EntityElemental instanceof EntityEarthElemental) { return earthBeacon; } - if (par1EntityElemental instanceof EntityFireElemental) - { + if (par1EntityElemental instanceof EntityFireElemental) { return fireBeacon; } - if (par1EntityElemental instanceof EntityShadeElemental) - { + if (par1EntityElemental instanceof EntityShadeElemental) { return shadeBeacon; } - if (par1EntityElemental instanceof EntityHolyElemental) - { + if (par1EntityElemental instanceof EntityHolyElemental) { return holyBeacon; } return airBeacon; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityElemental) par1Entity); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderFallenAngel.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderFallenAngel.java index 24c69cf9..b9e07a67 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderFallenAngel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderFallenAngel.java @@ -9,22 +9,19 @@ import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) -public class RenderFallenAngel extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/WingedAngel.png"); +public class RenderFallenAngel extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/WingedAngel.png"); - public RenderFallenAngel(ModelBase par1ModelBase, float par2) - { + public RenderFallenAngel(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityFallenAngel par1EntityFallenAngel) - { + public ResourceLocation func_110832_a(EntityFallenAngel par1EntityFallenAngel) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityFallenAngel) par1Entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderIceDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderIceDemon.java index 4b36e492..17896de4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderIceDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderIceDemon.java @@ -6,22 +6,19 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderIceDemon extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/IceDemon.png"); +public class RenderIceDemon extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/IceDemon.png"); - public RenderIceDemon(ModelBase par1ModelBase, float par2) - { + public RenderIceDemon(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityIceDemon par1EntityIceDemon) - { + public ResourceLocation func_110832_a(EntityIceDemon par1EntityIceDemon) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityIceDemon) par1Entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderLowerGuardian.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderLowerGuardian.java index a1c39675..e72a396c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderLowerGuardian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderLowerGuardian.java @@ -6,22 +6,19 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderLowerGuardian extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/LowerGuardian.png"); +public class RenderLowerGuardian extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/LowerGuardian.png"); - public RenderLowerGuardian(ModelBase par1ModelBase, float par2) - { + public RenderLowerGuardian(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityLowerGuardian par1EntityLowerGuardian) - { + public ResourceLocation func_110832_a(EntityLowerGuardian par1EntityLowerGuardian) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityLowerGuardian) par1Entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGrunt.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGrunt.java index 284f6f4d..127b6e56 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGrunt.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGrunt.java @@ -1,49 +1,46 @@ package WayofTime.alchemicalWizardry.common.renderer.mob; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; -public class RenderMinorDemonGrunt extends RenderLiving -{ - private static final ResourceLocation normalTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_normal.png"); - private static final ResourceLocation fireTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_fire.png"); - private static final ResourceLocation iceTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_ice.png"); - private static final ResourceLocation windTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_wind.png"); - private static final ResourceLocation earthTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_earth.png"); +public class RenderMinorDemonGrunt extends RenderLiving { + private static final ResourceLocation normalTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_normal.png"); + private static final ResourceLocation fireTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_fire.png"); + private static final ResourceLocation iceTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_ice.png"); + private static final ResourceLocation windTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_wind.png"); + private static final ResourceLocation earthTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_earth.png"); - public RenderMinorDemonGrunt(ModelBase par1ModelBase, float par2) - { + public RenderMinorDemonGrunt(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityMinorDemonGrunt entity) - { - if(entity instanceof EntityMinorDemonGruntFire) - { + public ResourceLocation func_110832_a(EntityMinorDemonGrunt entity) { + if (entity instanceof EntityMinorDemonGruntFire) { return fireTexture; - }else if(entity instanceof EntityMinorDemonGruntWind) - { - return windTexture; - }else if(entity instanceof EntityMinorDemonGruntIce) - { - return iceTexture; - }else if(entity instanceof EntityMinorDemonGruntEarth) - { - return earthTexture; - } - + } else if (entity instanceof EntityMinorDemonGruntWind) { + return windTexture; + } else if (entity instanceof EntityMinorDemonGruntIce) { + return iceTexture; + } else if (entity instanceof EntityMinorDemonGruntEarth) { + return earthTexture; + } + return normalTexture; } - public ResourceLocation getEntityTexture(Entity entity) - { + public ResourceLocation getEntityTexture(Entity entity) { return this.func_110832_a((EntityMinorDemonGrunt) entity); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGruntGuardian.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGruntGuardian.java index a2a70bb3..81d83f37 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGruntGuardian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderMinorDemonGruntGuardian.java @@ -1,49 +1,46 @@ package WayofTime.alchemicalWizardry.common.renderer.mob; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardian; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianEarth; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianFire; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianIce; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianWind; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; -public class RenderMinorDemonGruntGuardian extends RenderLiving -{ - private static final ResourceLocation normalTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_normal.png"); - private static final ResourceLocation fireTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_fire.png"); - private static final ResourceLocation iceTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_ice.png"); - private static final ResourceLocation windTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_wind.png"); - private static final ResourceLocation earthTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_earth.png"); +public class RenderMinorDemonGruntGuardian extends RenderLiving { + private static final ResourceLocation normalTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_normal.png"); + private static final ResourceLocation fireTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_fire.png"); + private static final ResourceLocation iceTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_ice.png"); + private static final ResourceLocation windTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_wind.png"); + private static final ResourceLocation earthTexture = + new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGruntGuardian_earth.png"); - public RenderMinorDemonGruntGuardian(ModelBase par1ModelBase, float par2) - { + public RenderMinorDemonGruntGuardian(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityMinorDemonGruntGuardian entity) - { - if(entity instanceof EntityMinorDemonGruntGuardianFire) - { + public ResourceLocation func_110832_a(EntityMinorDemonGruntGuardian entity) { + if (entity instanceof EntityMinorDemonGruntGuardianFire) { return fireTexture; - }else if(entity instanceof EntityMinorDemonGruntGuardianWind) - { - return windTexture; - }else if(entity instanceof EntityMinorDemonGruntGuardianIce) - { - return iceTexture; - }else if(entity instanceof EntityMinorDemonGruntGuardianEarth) - { - return earthTexture; - } - + } else if (entity instanceof EntityMinorDemonGruntGuardianWind) { + return windTexture; + } else if (entity instanceof EntityMinorDemonGruntGuardianIce) { + return iceTexture; + } else if (entity instanceof EntityMinorDemonGruntGuardianEarth) { + return earthTexture; + } + return normalTexture; } - public ResourceLocation getEntityTexture(Entity entity) - { + public ResourceLocation getEntityTexture(Entity entity) { return this.func_110832_a((EntityMinorDemonGruntGuardian) entity); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderShade.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderShade.java index afd4f230..f28ba22d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderShade.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderShade.java @@ -6,22 +6,19 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderShade extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/ShadeMob.png"); +public class RenderShade extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/ShadeMob.png"); - public RenderShade(ModelBase par1ModelBase, float par2) - { + public RenderShade(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityShade par1EntityShade) - { + public ResourceLocation func_110832_a(EntityShade par1EntityShade) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityShade) par1Entity); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderSmallEarthGolem.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderSmallEarthGolem.java index 3e87ac76..39b9417a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderSmallEarthGolem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderSmallEarthGolem.java @@ -6,22 +6,19 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderSmallEarthGolem extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/SmallEarthGolem.png"); +public class RenderSmallEarthGolem extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/SmallEarthGolem.png"); - public RenderSmallEarthGolem(ModelBase par1ModelBase, float par2) - { + public RenderSmallEarthGolem(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntitySmallEarthGolem par1EntitySmallEarthGolem) - { + public ResourceLocation func_110832_a(EntitySmallEarthGolem par1EntitySmallEarthGolem) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntitySmallEarthGolem) par1Entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderWingedFireDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderWingedFireDemon.java index 8a385f76..a9f28324 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderWingedFireDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderWingedFireDemon.java @@ -6,22 +6,19 @@ import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class RenderWingedFireDemon extends RenderLiving -{ - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/WingedFireDemon.png"); +public class RenderWingedFireDemon extends RenderLiving { + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/WingedFireDemon.png"); - public RenderWingedFireDemon(ModelBase par1ModelBase, float par2) - { + public RenderWingedFireDemon(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } - public ResourceLocation func_110832_a(EntityWingedFireDemon par1EntityWingedFireDemon) - { + public ResourceLocation func_110832_a(EntityWingedFireDemon par1EntityWingedFireDemon) { return field_110833_a; } - public ResourceLocation getEntityTexture(Entity par1Entity) - { + public ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110832_a((EntityWingedFireDemon) par1Entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelAlchemicalCalcinator.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelAlchemicalCalcinator.java index 1724a715..580c07af 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelAlchemicalCalcinator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelAlchemicalCalcinator.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelAlchemicalCalcinator extends ModelBase -{ - //fields +public class ModelAlchemicalCalcinator extends ModelBase { + // fields ModelRenderer top1; ModelRenderer top2; ModelRenderer top3; @@ -21,8 +20,7 @@ public class ModelAlchemicalCalcinator extends ModelBase ModelRenderer Shape4; ModelRenderer Shape5; - public ModelAlchemicalCalcinator() - { + public ModelAlchemicalCalcinator() { textureWidth = 128; textureHeight = 128; @@ -106,8 +104,7 @@ public class ModelAlchemicalCalcinator extends ModelBase setRotation(Shape5, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); top1.render(f5); @@ -125,16 +122,13 @@ public class ModelAlchemicalCalcinator extends ModelBase Shape5.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBileDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBileDemon.java index e09db58e..ff154603 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBileDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBileDemon.java @@ -6,9 +6,8 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; -public class ModelBileDemon extends ModelBase -{ - //fields +public class ModelBileDemon extends ModelBase { + // fields ModelRenderer belly; ModelRenderer chest; ModelRenderer head; @@ -24,8 +23,7 @@ public class ModelBileDemon extends ModelBase ModelRenderer rightArmSpacer; ModelRenderer rightArm; - public ModelBileDemon() - { + public ModelBileDemon() { textureWidth = 128; textureHeight = 64; belly = new ModelRenderer(this, 0, 31); @@ -124,8 +122,7 @@ public class ModelBileDemon extends ModelBase rightArm.mirror = false; } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); float scale = 1.3f; @@ -147,15 +144,13 @@ public class ModelBileDemon extends ModelBase rightArm.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.head.rotateAngleX = f4 / (180F / (float) Math.PI); this.head.rotateAngleY = f3 / (180F / (float) Math.PI); @@ -178,4 +173,4 @@ public class ModelBileDemon extends ModelBase this.nose.rotateAngleX = this.head.rotateAngleX; this.nose.rotateAngleY = this.head.rotateAngleY; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBloodAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBloodAltar.java index b8a1679f..5321571e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBloodAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBloodAltar.java @@ -1,5 +1,8 @@ package WayofTime.alchemicalWizardry.common.renderer.model; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; @@ -7,31 +10,24 @@ import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; -import cpw.mods.fml.client.FMLClientHandler; +public class ModelBloodAltar extends ModelBase { + private static final ResourceLocation altar_texture = + new ResourceLocation("alchemicalwizardry:textures/models/altar.png"); -public class ModelBloodAltar extends ModelBase -{ - private static final ResourceLocation altar_texture = new ResourceLocation("alchemicalwizardry:textures/models/altar.png"); - private IModelCustom modelBloodAltar; - public ModelBloodAltar() - { - modelBloodAltar = AdvancedModelLoader.loadModel(new ResourceLocation("alchemicalwizardry:models/bloodaltar-fixeUV.obj")); + public ModelBloodAltar() { + modelBloodAltar = + AdvancedModelLoader.loadModel(new ResourceLocation("alchemicalwizardry:models/bloodaltar-fixeUV.obj")); } - public void renderBloodAltar() - { + public void renderBloodAltar() { modelBloodAltar.renderAll(); } - public void renderBloodAltar(TEAltar altar, double x, double y, double z) - { + public void renderBloodAltar(TEAltar altar, double x, double y, double z) { float scale = 0.1f; // Push a blank matrix onto the stack GL11.glPushMatrix(); @@ -47,18 +43,16 @@ public class ModelBloodAltar extends ModelBase GL11.glPopMatrix(); } - public void renderBloodLevel(TEAltar altar, double x, double y, double z) - { + public void renderBloodLevel(TEAltar altar, double x, double y, double z) { GL11.glPushMatrix(); float level = altar.getFluidAmount(); - GL11.glTranslatef((float) x , (float) y + 0.6499f + 0.12f * (level / altar.getCapacity()), (float) z); + GL11.glTranslatef((float) x, (float) y + 0.6499f + 0.12f * (level / altar.getCapacity()), (float) z); FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureMap.locationBlocksTexture); renderBloodLevel(AlchemicalWizardry.lifeEssenceFluid.getStillIcon()); GL11.glPopMatrix(); } - - public void renderBloodLevel(IIcon icon) - { + + public void renderBloodLevel(IIcon icon) { Tessellator tessellator = Tessellator.instance; double minU = (double) icon.getInterpolatedU(0); @@ -74,4 +68,4 @@ public class ModelBloodAltar extends ModelBase tessellator.addVertexWithUV(0, 0, 1, minU, maxV); tessellator.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBoulderFist.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBoulderFist.java index a2cebd46..185b84ef 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBoulderFist.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelBoulderFist.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelBoulderFist extends ModelBase -{ - //fields +public class ModelBoulderFist extends ModelBase { + // fields ModelRenderer leftFist; ModelRenderer leftArm; ModelRenderer body; @@ -21,8 +20,7 @@ public class ModelBoulderFist extends ModelBase ModelRenderer rightFoot; ModelRenderer head; - public ModelBoulderFist() - { + public ModelBoulderFist() { textureWidth = 64; textureHeight = 64; leftFist = new ModelRenderer(this, 33, 52); @@ -109,8 +107,7 @@ public class ModelBoulderFist extends ModelBase setRotation(head, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); leftFist.render(f5); @@ -127,15 +124,13 @@ public class ModelBoulderFist extends ModelBase head.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.head.rotateAngleX = f4 / (180F / (float) Math.PI); this.head.rotateAngleY = f3 / (180F / (float) Math.PI); @@ -150,4 +145,4 @@ public class ModelBoulderFist extends ModelBase this.leftFist.rotateAngleX = leftArm.rotateAngleX; this.rightFist.rotateAngleX = rightArm.rotateAngleX; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelConduit.java index a6a510c4..73b5e664 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelConduit.java @@ -1,19 +1,18 @@ package WayofTime.alchemicalWizardry.common.renderer.model; -//Date: 11/26/2013 1:57:16 PM -//Template version 1.1 -//Java generated by Techne -//Keep in mind that you still need to fill in some blanks -//- ZeuX +// Date: 11/26/2013 1:57:16 PM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.common.util.ForgeDirection; -public class ModelConduit extends ModelBase -{ - //fields +public class ModelConduit extends ModelBase { + // fields ModelRenderer curvedInput; ModelRenderer curvedOutput; ModelRenderer straightBar1; @@ -33,8 +32,7 @@ public class ModelConduit extends ModelBase ModelRenderer spacer7; ModelRenderer spacer8; - public ModelConduit() - { + public ModelConduit() { textureWidth = 64; textureHeight = 32; curvedInput = new ModelRenderer(this, 0, 0); @@ -147,8 +145,16 @@ public class ModelConduit extends ModelBase setRotation(spacer8, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ForgeDirection input, ForgeDirection output) - { + public void render( + Entity entity, + float f, + float f1, + float f2, + float f3, + float f4, + float f5, + ForgeDirection input, + ForgeDirection output) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); float xInputRot = 0.0f; @@ -158,8 +164,7 @@ public class ModelConduit extends ModelBase float yOutputRot = 0.0f; float zOutputRot = 0.0f; - switch (input) - { + switch (input) { case NORTH: xInputRot = 0.0f; yInputRot = 0.0f; @@ -200,8 +205,7 @@ public class ModelConduit extends ModelBase break; } - switch (output) - { + switch (output) { case NORTH: xOutputRot = 0.0f; yOutputRot = (float) (0.5f * Math.PI); @@ -254,7 +258,7 @@ public class ModelConduit extends ModelBase this.setRotation(curvedBar4, xOutputRot, yOutputRot, zOutputRot); curvedInput.render(f5); curvedOutput.render(f5); - //setRotation(curvedOutput,0F,-(float)(Math.PI/2),0F); + // setRotation(curvedOutput,0F,-(float)(Math.PI/2),0F); straightBar1.render(f5); curvedBar1.render(f5); spacer1.render(f5); @@ -273,15 +277,13 @@ public class ModelConduit extends ModelBase spacer8.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelCrystalBelljar.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelCrystalBelljar.java index 58a9b1d1..0fa13168 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelCrystalBelljar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelCrystalBelljar.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelCrystalBelljar extends ModelBase -{ - //fields +public class ModelCrystalBelljar extends ModelBase { + // fields ModelRenderer handle1; ModelRenderer handle2; ModelRenderer jar1; @@ -16,8 +15,7 @@ public class ModelCrystalBelljar extends ModelBase ModelRenderer jar4; ModelRenderer jar5; - public ModelCrystalBelljar() - { + public ModelCrystalBelljar() { textureWidth = 128; textureHeight = 64; @@ -71,8 +69,7 @@ public class ModelCrystalBelljar extends ModelBase setRotation(jar5, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); handle1.render(f5); @@ -85,15 +82,12 @@ public class ModelCrystalBelljar extends ModelBase jar5.render(f5); } - public void renderSpecialItem(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, int part) - { + public void renderSpecialItem(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, int part) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); - if (part == 0) - { + if (part == 0) { woodBottom.render(f5); - } else - { + } else { handle1.render(f5); handle2.render(f5); jar1.render(f5); @@ -104,16 +98,13 @@ public class ModelCrystalBelljar extends ModelBase } } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelElemental.java index 10ce54be..c2a0cca2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelElemental.java @@ -5,16 +5,14 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.world.World; -public class ModelElemental extends ModelBase -{ - //fields +public class ModelElemental extends ModelBase { + // fields ModelRenderer body; ModelRenderer Shape2; ModelRenderer Shape1; ModelRenderer Shape3; - public ModelElemental() - { + public ModelElemental() { textureWidth = 64; textureHeight = 32; body = new ModelRenderer(this, 33, 0); @@ -43,8 +41,7 @@ public class ModelElemental extends ModelBase setRotation(Shape3, ((float) Math.PI / 4F), 0F, ((float) Math.PI / 4F)); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); body.render(f5); @@ -53,20 +50,17 @@ public class ModelElemental extends ModelBase Shape3.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); World world = entity.worldObj; - if (world == null) - { + if (world == null) { return; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelEnergyBazookaMainProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelEnergyBazookaMainProjectile.java index de8e7e6b..44f7fd4f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelEnergyBazookaMainProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelEnergyBazookaMainProjectile.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelEnergyBazookaMainProjectile extends ModelBase -{ - //fields +public class ModelEnergyBazookaMainProjectile extends ModelBase { + // fields ModelRenderer thirdWarHead; ModelRenderer firstWarHead; ModelRenderer secondWarHead; @@ -19,8 +18,7 @@ public class ModelEnergyBazookaMainProjectile extends ModelBase ModelRenderer base2; ModelRenderer base3; - public ModelEnergyBazookaMainProjectile() - { + public ModelEnergyBazookaMainProjectile() { textureWidth = 64; textureHeight = 32; thirdWarHead = new ModelRenderer(this, 43, 0); @@ -91,8 +89,7 @@ public class ModelEnergyBazookaMainProjectile extends ModelBase setRotation(base3, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); thirdWarHead.render(f5); @@ -108,15 +105,13 @@ public class ModelEnergyBazookaMainProjectile extends ModelBase base3.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelFallenAngel.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelFallenAngel.java index aacef80d..5fe2b3a7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelFallenAngel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelFallenAngel.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelFallenAngel extends ModelBase -{ - //fields +public class ModelFallenAngel extends ModelBase { + // fields ModelRenderer leftWing; ModelRenderer rightWing; ModelRenderer head; @@ -17,8 +16,7 @@ public class ModelFallenAngel extends ModelBase ModelRenderer rightleg; ModelRenderer leftleg; - public ModelFallenAngel() - { + public ModelFallenAngel() { textureWidth = 64; textureHeight = 32; leftWing = new ModelRenderer(this, 33, 8); @@ -77,8 +75,7 @@ public class ModelFallenAngel extends ModelBase setRotation(leftleg, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); leftWing.render(f5); @@ -91,15 +88,13 @@ public class ModelFallenAngel extends ModelBase leftleg.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.head.rotateAngleX = f4 / (180F / (float) Math.PI); this.head.rotateAngleY = f3 / (180F / (float) Math.PI); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelIceDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelIceDemon.java index 9c6d3c32..19a7ce23 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelIceDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelIceDemon.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelIceDemon extends ModelBase -{ - //fields +public class ModelIceDemon extends ModelBase { + // fields ModelRenderer head; ModelRenderer leftHorn; ModelRenderer rightHorn; @@ -26,8 +25,7 @@ public class ModelIceDemon extends ModelBase ModelRenderer rightLeg; ModelRenderer Shape1; - public ModelIceDemon() - { + public ModelIceDemon() { textureWidth = 64; textureHeight = 64; head = new ModelRenderer(this, 40, 0); @@ -142,8 +140,7 @@ public class ModelIceDemon extends ModelBase setRotation(Shape1, 0.5948578F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); head.render(f5); @@ -165,15 +162,13 @@ public class ModelIceDemon extends ModelBase Shape1.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.head.rotateAngleX = f4 / (180F / (float) Math.PI); this.head.rotateAngleY = f3 / (180F / (float) Math.PI); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelLowerGuardian.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelLowerGuardian.java index 61d7b85d..c8699940 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelLowerGuardian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelLowerGuardian.java @@ -7,9 +7,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.MathHelper; -public class ModelLowerGuardian extends ModelBase -{ - //fields +public class ModelLowerGuardian extends ModelBase { + // fields ModelRenderer Body; ModelRenderer Torso; ModelRenderer Head; @@ -26,8 +25,7 @@ public class ModelLowerGuardian extends ModelBase ModelRenderer hornAppendage3; ModelRenderer hornAppendage4; - public ModelLowerGuardian() - { + public ModelLowerGuardian() { textureWidth = 64; textureHeight = 64; Body = new ModelRenderer(this, 0, 0); @@ -134,8 +132,7 @@ public class ModelLowerGuardian extends ModelBase hornAppendage4.mirror = false; } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Body.render(f5); @@ -155,33 +152,28 @@ public class ModelLowerGuardian extends ModelBase hornAppendage4.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) - { + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) { EntityLowerGuardian entityLowerGuardian = (EntityLowerGuardian) par1EntityLivingBase; int i = entityLowerGuardian.getAttackTimer(); - if (i > 0) - { + if (i > 0) { this.rightLeg.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float) i - par4, 10.0F); this.rightFoot.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float) i - par4, 10.0F); - //this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F); + // this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F); } } - private float func_78172_a(float par1, float par2) - { + private float func_78172_a(float par1, float par2) { return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F); } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.Head.rotateAngleX = f4 / (180F / (float) Math.PI); this.Head.rotateAngleY = f3 / (180F / (float) Math.PI); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMeteor.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMeteor.java index 26a94989..e6120c41 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMeteor.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMeteor.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelMeteor extends ModelBase -{ - //fields +public class ModelMeteor extends ModelBase { + // fields ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; @@ -15,8 +14,7 @@ public class ModelMeteor extends ModelBase ModelRenderer Shape6; ModelRenderer Shape7; - public ModelMeteor() - { + public ModelMeteor() { textureWidth = 64; textureHeight = 64; Shape1 = new ModelRenderer(this, 0, 0); @@ -63,8 +61,7 @@ public class ModelMeteor extends ModelBase setRotation(Shape7, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Shape1.render(f5); @@ -76,15 +73,13 @@ public class ModelMeteor extends ModelBase Shape7.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGrunt.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGrunt.java index 4519617d..612094e8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGrunt.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGrunt.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelMinorDemonGrunt extends ModelBase -{ - //fields +public class ModelMinorDemonGrunt extends ModelBase { + // fields ModelRenderer head; ModelRenderer chest; ModelRenderer midrift; @@ -16,98 +15,93 @@ public class ModelMinorDemonGrunt extends ModelBase ModelRenderer rightleg; ModelRenderer leftleg; ModelRenderer middle; - - public ModelMinorDemonGrunt() - { - textureWidth = 128; - textureHeight = 64; - - head = new ModelRenderer(this, 0, 0); - head.addBox(-4F, -8F, -4F, 8, 8, 8); - head.setRotationPoint(0F, 0F, 0F); - head.setTextureSize(128, 64); - head.mirror = true; - setRotation(head, 0F, 0F, 0F); - chest = new ModelRenderer(this, 16, 16); - chest.addBox(-5F, 0F, -3.5F, 10, 7, 7); - chest.setRotationPoint(0F, 0F, 0F); - chest.setTextureSize(128, 64); - chest.mirror = true; - setRotation(chest, 0F, 0F, 0F); - midrift = new ModelRenderer(this, 16, 33); - midrift.addBox(-4F, 7F, -2F, 8, 5, 4); - midrift.setRotationPoint(0F, 0F, 0F); - midrift.setTextureSize(128, 64); - midrift.mirror = true; - setRotation(midrift, 0F, 0F, 0F); - rightarm = new ModelRenderer(this, 50, 16); - rightarm.mirror = true; - rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); - rightarm.setRotationPoint(-6F, 2F, 0F); - rightarm.setTextureSize(128, 64); - rightarm.mirror = true; - setRotation(rightarm, 0F, 0F, 0F); - rightarm.mirror = false; - leftarm = new ModelRenderer(this, 50, 16); - leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); - leftarm.setRotationPoint(6F, 2F, 0F); - leftarm.setTextureSize(128, 64); - leftarm.mirror = true; - setRotation(leftarm, 0F, 0F, 0F); - rightleg = new ModelRenderer(this, 0, 16); - rightleg.mirror = true; - rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); - rightleg.setRotationPoint(-2F, 12F, 0F); - rightleg.setTextureSize(128, 64); - rightleg.mirror = true; - setRotation(rightleg, 0F, 0F, 0F); - rightleg.mirror = false; - leftleg = new ModelRenderer(this, 0, 16); - leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); - leftleg.setRotationPoint(2F, 12F, 0F); - leftleg.setTextureSize(128, 64); - leftleg.mirror = true; - setRotation(leftleg, 0F, 0F, 0F); - middle = new ModelRenderer(this, 16, 43); - middle.addBox(-2F, 7F, -3F, 4, 3, 1); - middle.setRotationPoint(0F, 0F, 0F); - middle.setTextureSize(128, 64); - middle.mirror = true; - setRotation(middle, 0F, 0F, 0F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - head.render(f5); - chest.render(f5); - midrift.render(f5); - rightarm.render(f5); - leftarm.render(f5); - rightleg.render(f5); - leftleg.render(f5); - middle.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - - this.head.rotateAngleX = f4 / (180F / (float) Math.PI); - this.head.rotateAngleY = f3 / (180F / (float) Math.PI); - this.leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; - this.rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; - this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; - this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; - } + public ModelMinorDemonGrunt() { + textureWidth = 128; + textureHeight = 64; + head = new ModelRenderer(this, 0, 0); + head.addBox(-4F, -8F, -4F, 8, 8, 8); + head.setRotationPoint(0F, 0F, 0F); + head.setTextureSize(128, 64); + head.mirror = true; + setRotation(head, 0F, 0F, 0F); + chest = new ModelRenderer(this, 16, 16); + chest.addBox(-5F, 0F, -3.5F, 10, 7, 7); + chest.setRotationPoint(0F, 0F, 0F); + chest.setTextureSize(128, 64); + chest.mirror = true; + setRotation(chest, 0F, 0F, 0F); + midrift = new ModelRenderer(this, 16, 33); + midrift.addBox(-4F, 7F, -2F, 8, 5, 4); + midrift.setRotationPoint(0F, 0F, 0F); + midrift.setTextureSize(128, 64); + midrift.mirror = true; + setRotation(midrift, 0F, 0F, 0F); + rightarm = new ModelRenderer(this, 50, 16); + rightarm.mirror = true; + rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); + rightarm.setRotationPoint(-6F, 2F, 0F); + rightarm.setTextureSize(128, 64); + rightarm.mirror = true; + setRotation(rightarm, 0F, 0F, 0F); + rightarm.mirror = false; + leftarm = new ModelRenderer(this, 50, 16); + leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); + leftarm.setRotationPoint(6F, 2F, 0F); + leftarm.setTextureSize(128, 64); + leftarm.mirror = true; + setRotation(leftarm, 0F, 0F, 0F); + rightleg = new ModelRenderer(this, 0, 16); + rightleg.mirror = true; + rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); + rightleg.setRotationPoint(-2F, 12F, 0F); + rightleg.setTextureSize(128, 64); + rightleg.mirror = true; + setRotation(rightleg, 0F, 0F, 0F); + rightleg.mirror = false; + leftleg = new ModelRenderer(this, 0, 16); + leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); + leftleg.setRotationPoint(2F, 12F, 0F); + leftleg.setTextureSize(128, 64); + leftleg.mirror = true; + setRotation(leftleg, 0F, 0F, 0F); + middle = new ModelRenderer(this, 16, 43); + middle.addBox(-2F, 7F, -3F, 4, 3, 1); + middle.setRotationPoint(0F, 0F, 0F); + middle.setTextureSize(128, 64); + middle.mirror = true; + setRotation(middle, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + head.render(f5); + chest.render(f5); + midrift.render(f5); + rightarm.render(f5); + leftarm.render(f5); + rightleg.render(f5); + leftleg.render(f5); + middle.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + + this.head.rotateAngleX = f4 / (180F / (float) Math.PI); + this.head.rotateAngleY = f3 / (180F / (float) Math.PI); + + this.leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; + this.rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; + this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; + this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGruntGuardian.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGruntGuardian.java index 663d5db1..440a629c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGruntGuardian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelMinorDemonGruntGuardian.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelMinorDemonGruntGuardian extends ModelBase -{ - //fields +public class ModelMinorDemonGruntGuardian extends ModelBase { + // fields ModelRenderer head; ModelRenderer chest; ModelRenderer midrift; @@ -23,159 +22,155 @@ public class ModelMinorDemonGruntGuardian extends ModelBase ModelRenderer rightShoulder; ModelRenderer bar1; ModelRenderer bar2; - - public ModelMinorDemonGruntGuardian() - { - textureWidth = 128; - textureHeight = 64; - - head = new ModelRenderer(this, 0, 0); - head.addBox(-4F, -8F, -4F, 8, 8, 8); - head.setRotationPoint(0F, 0F, 0F); - head.setTextureSize(128, 64); - head.mirror = true; - setRotation(head, 0F, 0F, 0F); - chest = new ModelRenderer(this, 16, 16); - chest.addBox(-5F, 0F, -3.5F, 10, 7, 7); - chest.setRotationPoint(0F, 0F, 0F); - chest.setTextureSize(128, 64); - chest.mirror = true; - setRotation(chest, 0F, 0F, 0F); - midrift = new ModelRenderer(this, 16, 33); - midrift.addBox(-4F, 7F, -2F, 8, 5, 4); - midrift.setRotationPoint(0F, 0F, 0F); - midrift.setTextureSize(128, 64); - midrift.mirror = true; - setRotation(midrift, 0F, 0F, 0F); - rightarm = new ModelRenderer(this, 50, 16); - rightarm.mirror = true; - rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); - rightarm.setRotationPoint(-6F, 2F, 0F); - rightarm.setTextureSize(128, 64); - rightarm.mirror = true; - setRotation(rightarm, 0F, 0F, 0F); - rightarm.mirror = false; - leftarm = new ModelRenderer(this, 50, 16); - leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); - leftarm.setRotationPoint(6F, 2F, 0F); - leftarm.setTextureSize(128, 64); - leftarm.mirror = true; - setRotation(leftarm, 0F, 0F, 0F); - rightleg = new ModelRenderer(this, 0, 16); - rightleg.mirror = true; - rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); - rightleg.setRotationPoint(-2F, 12F, 0F); - rightleg.setTextureSize(128, 64); - rightleg.mirror = true; - setRotation(rightleg, 0F, 0F, 0F); - rightleg.mirror = false; - leftleg = new ModelRenderer(this, 0, 16); - leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); - leftleg.setRotationPoint(2F, 12F, 0F); - leftleg.setTextureSize(128, 64); - leftleg.mirror = true; - setRotation(leftleg, 0F, 0F, 0F); - middle = new ModelRenderer(this, 16, 43); - middle.addBox(-2F, 7F, -3F, 4, 3, 1); - middle.setRotationPoint(0F, 0F, 0F); - middle.setTextureSize(128, 64); - middle.mirror = true; - setRotation(middle, 0F, 0F, 0F); - helmet = new ModelRenderer(this, 67, 0); - helmet.addBox(-4.5F, -8.5F, -4.5F, 9, 9, 9); - helmet.setRotationPoint(0F, 0F, 0F); - helmet.setTextureSize(128, 64); - helmet.mirror = true; - setRotation(helmet, 0F, 0F, 0F); - leftClaw = new ModelRenderer(this, 67, 23); - leftClaw.addBox(1.5F, 6F, -2.5F, 2, 6, 5); - leftClaw.setRotationPoint(6F, 2F, 0F); - leftClaw.setTextureSize(128, 64); - leftClaw.mirror = true; - setRotation(leftClaw, 0F, 0F, 0F); - rightClaw = new ModelRenderer(this, 67, 23); - rightClaw.mirror = true; - rightClaw.addBox(-3.5F, 6F, -2.5F, 2, 6, 5); - rightClaw.setRotationPoint(-6F, 2F, 0F); - rightClaw.setTextureSize(128, 64); - rightClaw.mirror = true; - setRotation(rightClaw, 0F, 0F, 0F); - rightClaw.mirror = false; - leftShoulder = new ModelRenderer(this, 67, 35); - leftShoulder.addBox(-1F, -2.5F, -2.5F, 5, 4, 5); - leftShoulder.setRotationPoint(6F, 2F, 0F); - leftShoulder.setTextureSize(128, 64); - leftShoulder.mirror = true; - setRotation(leftShoulder, 0F, 0F, 0F); - rightShoulder = new ModelRenderer(this, 67, 35); - rightShoulder.mirror = true; - rightShoulder.addBox(-4F, -2.5F, -2.5F, 5, 4, 5); - rightShoulder.setRotationPoint(-6F, 2F, 0F); - rightShoulder.setTextureSize(128, 64); - rightShoulder.mirror = true; - setRotation(rightShoulder, 0F, 0F, 0F); - rightShoulder.mirror = false; - bar1 = new ModelRenderer(this, 67, 20); - bar1.addBox(-3F, 3F, 4F, 14, 1, 1); - bar1.setRotationPoint(0F, 0F, 0F); - bar1.setTextureSize(128, 64); - bar1.mirror = true; - setRotation(bar1, 0F, 0F, 0.7853982F); - bar2 = new ModelRenderer(this, 67, 20); - bar2.addBox(-11F, 3F, 4F, 14, 1, 1); - bar2.setRotationPoint(0F, 0F, 0F); - bar2.setTextureSize(128, 64); - bar2.mirror = true; - setRotation(bar2, 0F, 0F, -0.7853982F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - head.render(f5); - chest.render(f5); - midrift.render(f5); - rightarm.render(f5); - leftarm.render(f5); - rightleg.render(f5); - leftleg.render(f5); - middle.render(f5); - helmet.render(f5); - leftClaw.render(f5); - rightClaw.render(f5); - leftShoulder.render(f5); - rightShoulder.render(f5); - bar1.render(f5); - bar2.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - - this.head.rotateAngleX = f4 / (180F / (float) Math.PI); - this.head.rotateAngleY = f3 / (180F / (float) Math.PI); - - this.helmet.rotateAngleX = this.head.rotateAngleX; - this.helmet.rotateAngleY = this.head.rotateAngleY; - this.leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; - this.rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; - this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; - this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; - - this.leftClaw.rotateAngleX = this.leftarm.rotateAngleX; - this.leftShoulder.rotateAngleX = this.leftarm.rotateAngleX; - - this.rightClaw.rotateAngleX = this.rightarm.rotateAngleX; - this.rightShoulder.rotateAngleX = this.rightarm.rotateAngleX; - } -} \ No newline at end of file + public ModelMinorDemonGruntGuardian() { + textureWidth = 128; + textureHeight = 64; + + head = new ModelRenderer(this, 0, 0); + head.addBox(-4F, -8F, -4F, 8, 8, 8); + head.setRotationPoint(0F, 0F, 0F); + head.setTextureSize(128, 64); + head.mirror = true; + setRotation(head, 0F, 0F, 0F); + chest = new ModelRenderer(this, 16, 16); + chest.addBox(-5F, 0F, -3.5F, 10, 7, 7); + chest.setRotationPoint(0F, 0F, 0F); + chest.setTextureSize(128, 64); + chest.mirror = true; + setRotation(chest, 0F, 0F, 0F); + midrift = new ModelRenderer(this, 16, 33); + midrift.addBox(-4F, 7F, -2F, 8, 5, 4); + midrift.setRotationPoint(0F, 0F, 0F); + midrift.setTextureSize(128, 64); + midrift.mirror = true; + setRotation(midrift, 0F, 0F, 0F); + rightarm = new ModelRenderer(this, 50, 16); + rightarm.mirror = true; + rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); + rightarm.setRotationPoint(-6F, 2F, 0F); + rightarm.setTextureSize(128, 64); + rightarm.mirror = true; + setRotation(rightarm, 0F, 0F, 0F); + rightarm.mirror = false; + leftarm = new ModelRenderer(this, 50, 16); + leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); + leftarm.setRotationPoint(6F, 2F, 0F); + leftarm.setTextureSize(128, 64); + leftarm.mirror = true; + setRotation(leftarm, 0F, 0F, 0F); + rightleg = new ModelRenderer(this, 0, 16); + rightleg.mirror = true; + rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); + rightleg.setRotationPoint(-2F, 12F, 0F); + rightleg.setTextureSize(128, 64); + rightleg.mirror = true; + setRotation(rightleg, 0F, 0F, 0F); + rightleg.mirror = false; + leftleg = new ModelRenderer(this, 0, 16); + leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); + leftleg.setRotationPoint(2F, 12F, 0F); + leftleg.setTextureSize(128, 64); + leftleg.mirror = true; + setRotation(leftleg, 0F, 0F, 0F); + middle = new ModelRenderer(this, 16, 43); + middle.addBox(-2F, 7F, -3F, 4, 3, 1); + middle.setRotationPoint(0F, 0F, 0F); + middle.setTextureSize(128, 64); + middle.mirror = true; + setRotation(middle, 0F, 0F, 0F); + helmet = new ModelRenderer(this, 67, 0); + helmet.addBox(-4.5F, -8.5F, -4.5F, 9, 9, 9); + helmet.setRotationPoint(0F, 0F, 0F); + helmet.setTextureSize(128, 64); + helmet.mirror = true; + setRotation(helmet, 0F, 0F, 0F); + leftClaw = new ModelRenderer(this, 67, 23); + leftClaw.addBox(1.5F, 6F, -2.5F, 2, 6, 5); + leftClaw.setRotationPoint(6F, 2F, 0F); + leftClaw.setTextureSize(128, 64); + leftClaw.mirror = true; + setRotation(leftClaw, 0F, 0F, 0F); + rightClaw = new ModelRenderer(this, 67, 23); + rightClaw.mirror = true; + rightClaw.addBox(-3.5F, 6F, -2.5F, 2, 6, 5); + rightClaw.setRotationPoint(-6F, 2F, 0F); + rightClaw.setTextureSize(128, 64); + rightClaw.mirror = true; + setRotation(rightClaw, 0F, 0F, 0F); + rightClaw.mirror = false; + leftShoulder = new ModelRenderer(this, 67, 35); + leftShoulder.addBox(-1F, -2.5F, -2.5F, 5, 4, 5); + leftShoulder.setRotationPoint(6F, 2F, 0F); + leftShoulder.setTextureSize(128, 64); + leftShoulder.mirror = true; + setRotation(leftShoulder, 0F, 0F, 0F); + rightShoulder = new ModelRenderer(this, 67, 35); + rightShoulder.mirror = true; + rightShoulder.addBox(-4F, -2.5F, -2.5F, 5, 4, 5); + rightShoulder.setRotationPoint(-6F, 2F, 0F); + rightShoulder.setTextureSize(128, 64); + rightShoulder.mirror = true; + setRotation(rightShoulder, 0F, 0F, 0F); + rightShoulder.mirror = false; + bar1 = new ModelRenderer(this, 67, 20); + bar1.addBox(-3F, 3F, 4F, 14, 1, 1); + bar1.setRotationPoint(0F, 0F, 0F); + bar1.setTextureSize(128, 64); + bar1.mirror = true; + setRotation(bar1, 0F, 0F, 0.7853982F); + bar2 = new ModelRenderer(this, 67, 20); + bar2.addBox(-11F, 3F, 4F, 14, 1, 1); + bar2.setRotationPoint(0F, 0F, 0F); + bar2.setTextureSize(128, 64); + bar2.mirror = true; + setRotation(bar2, 0F, 0F, -0.7853982F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + head.render(f5); + chest.render(f5); + midrift.render(f5); + rightarm.render(f5); + leftarm.render(f5); + rightleg.render(f5); + leftleg.render(f5); + middle.render(f5); + helmet.render(f5); + leftClaw.render(f5); + rightClaw.render(f5); + leftShoulder.render(f5); + rightShoulder.render(f5); + bar1.render(f5); + bar2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + + this.head.rotateAngleX = f4 / (180F / (float) Math.PI); + this.head.rotateAngleY = f3 / (180F / (float) Math.PI); + + this.helmet.rotateAngleX = this.head.rotateAngleX; + this.helmet.rotateAngleY = this.head.rotateAngleY; + + this.leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; + this.rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; + this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1; + this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; + + this.leftClaw.rotateAngleX = this.leftarm.rotateAngleX; + this.leftShoulder.rotateAngleX = this.leftarm.rotateAngleX; + + this.rightClaw.rotateAngleX = this.rightarm.rotateAngleX; + this.rightShoulder.rotateAngleX = this.rightarm.rotateAngleX; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaArmour.java index f09589aa..6436bbff 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaArmour.java @@ -4,14 +4,13 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelOmegaArmour extends ModelBiped -{ +public class ModelOmegaArmour extends ModelBiped { // ModelRenderer head; -// ModelRenderer body; -// ModelRenderer rightarm; -// ModelRenderer leftarm; -// ModelRenderer rightleg; -// ModelRenderer leftleg; + // ModelRenderer body; + // ModelRenderer rightarm; + // ModelRenderer leftarm; + // ModelRenderer rightleg; + // ModelRenderer leftleg; ModelRenderer leftFacePlate; ModelRenderer rightFacePlate; ModelRenderer facePlate1; @@ -86,58 +85,57 @@ public class ModelOmegaArmour extends ModelBiped ModelRenderer rightLegPlate3; ModelRenderer rightLegPlate4; - public ModelOmegaArmour(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) - { + public ModelOmegaArmour(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) { super(f, 0.0f, 128, 128); textureWidth = 128; textureHeight = 128; -// boolean addHelmet = true; -// boolean addChestPiece = true; -// boolean addLeggings = true; -// boolean addBoots = true; - - /* Duplicate player model */ + // boolean addHelmet = true; + // boolean addChestPiece = true; + // boolean addLeggings = true; + // boolean addBoots = true; + + /* Duplicate player model */ { -// head = new ModelRenderer(this, 0, 0); -// head.addBox(-4F, -8F, -4F, 8, 8, 8); -// head.setRotationPoint(0F, 0F, 0F); -// head.setTextureSize(128, 128); -// head.mirror = true; -// setRotation(head, 0F, 0F, 0F); -// body = new ModelRenderer(this, 16, 16); -// body.addBox(-4F, 0F, -2F, 8, 12, 4); -// body.setRotationPoint(0F, 0F, 0F); -// body.setTextureSize(128, 128); -// body.mirror = true; -// setRotation(body, 0F, 0F, 0F); -// rightarm = new ModelRenderer(this, 40, 16); -// rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); -// rightarm.setRotationPoint(0F, 0F, 0F); -// rightarm.setTextureSize(128, 128); -// rightarm.mirror = true; -// setRotation(rightarm, 0F, 0F, 0F); -// leftarm = new ModelRenderer(this, 40, 16); -// leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); -// leftarm.setRotationPoint(0F, 0F, 0F); -// leftarm.setTextureSize(128, 128); -// leftarm.mirror = true; -// setRotation(leftarm, 0F, 0F, 0F); -// rightleg = new ModelRenderer(this, 0, 16); -// rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); -// rightleg.setRotationPoint(-2F, 12F, 0F); -// rightleg.setTextureSize(128, 128); -// rightleg.mirror = true; -// setRotation(rightleg, 0F, 0F, 0F); -// leftleg = new ModelRenderer(this, 0, 16); -// leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); -// leftleg.setRotationPoint(2F, 12F, 0F); -// leftleg.setTextureSize(128, 128); -// leftleg.mirror = true; -// setRotation(leftleg, 0F, 0F, 0F); + // head = new ModelRenderer(this, 0, 0); + // head.addBox(-4F, -8F, -4F, 8, 8, 8); + // head.setRotationPoint(0F, 0F, 0F); + // head.setTextureSize(128, 128); + // head.mirror = true; + // setRotation(head, 0F, 0F, 0F); + // body = new ModelRenderer(this, 16, 16); + // body.addBox(-4F, 0F, -2F, 8, 12, 4); + // body.setRotationPoint(0F, 0F, 0F); + // body.setTextureSize(128, 128); + // body.mirror = true; + // setRotation(body, 0F, 0F, 0F); + // rightarm = new ModelRenderer(this, 40, 16); + // rightarm.addBox(-3F, -2F, -2F, 4, 12, 4); + // rightarm.setRotationPoint(0F, 0F, 0F); + // rightarm.setTextureSize(128, 128); + // rightarm.mirror = true; + // setRotation(rightarm, 0F, 0F, 0F); + // leftarm = new ModelRenderer(this, 40, 16); + // leftarm.addBox(-1F, -2F, -2F, 4, 12, 4); + // leftarm.setRotationPoint(0F, 0F, 0F); + // leftarm.setTextureSize(128, 128); + // leftarm.mirror = true; + // setRotation(leftarm, 0F, 0F, 0F); + // rightleg = new ModelRenderer(this, 0, 16); + // rightleg.addBox(-2F, 0F, -2F, 4, 12, 4); + // rightleg.setRotationPoint(-2F, 12F, 0F); + // rightleg.setTextureSize(128, 128); + // rightleg.mirror = true; + // setRotation(rightleg, 0F, 0F, 0F); + // leftleg = new ModelRenderer(this, 0, 16); + // leftleg.addBox(-2F, 0F, -2F, 4, 12, 4); + // leftleg.setRotationPoint(2F, 12F, 0F); + // leftleg.setTextureSize(128, 128); + // leftleg.mirror = true; + // setRotation(leftleg, 0F, 0F, 0F); } - /* Helmet */ + /* Helmet */ { leftFacePlate = new ModelRenderer(this, 66, 52); leftFacePlate.addBox(-2F, -5F, -5F, 5, 4, 1); @@ -284,8 +282,8 @@ public class ModelOmegaArmour extends ModelBiped eyePlate.mirror = true; setRotation(eyePlate, 0F, 0F, 0F); } - - /* Right arm */ + + /* Right arm */ { rightArmMain = new ModelRenderer(this, 0, 33); rightArmMain.mirror = true; @@ -372,8 +370,8 @@ public class ModelOmegaArmour extends ModelBiped rightShoulder3.setTextureSize(128, 128); setRotation(rightShoulder3, 0F, 0F, 0.6981317F); } - - /* Chest piece main body */ + + /* Chest piece main body */ { mainPlate = new ModelRenderer(this, 31, 33); mainPlate.addBox(-4.5F, -0.5F, -3F, 9, 12, 6); @@ -421,8 +419,8 @@ public class ModelOmegaArmour extends ModelBiped chestPlate6.setTextureSize(128, 128); setRotation(chestPlate6, 0.3490659F, 0F, 0.2617994F); } - - /* Left arm */ + + /* Left arm */ { leftArmMain = new ModelRenderer(this, 0, 33); leftArmMain.addBox(-1.5F, -2.533333F, -2.5F, 5, 11, 5); @@ -508,8 +506,8 @@ public class ModelOmegaArmour extends ModelBiped leftShoulder3.mirror = true; setRotation(leftShoulder3, 0F, 0F, -0.6981317F); } - - /* Left boot */ + + /* Left boot */ { leftBootBottom = new ModelRenderer(this, 0, 84); leftBootBottom.addBox(-2.5F, 9.5F, -5.5F, 6, 3, 8); @@ -546,9 +544,8 @@ public class ModelOmegaArmour extends ModelBiped leftBootWing2.mirror = true; setRotation(leftBootWing2, 0.2617994F, 0.1745329F, 0F); } - - - /* Right boot */ + + /* Right boot */ { rightBootBottom = new ModelRenderer(this, 0, 84); rightBootBottom.mirror = true; @@ -585,8 +582,8 @@ public class ModelOmegaArmour extends ModelBiped rightBootWing2.setTextureSize(128, 128); setRotation(rightBootWing2, 0.2617994F, -0.1745329F, 0F); } - - /* Main legs */ + + /* Main legs */ { belt = new ModelRenderer(this, 31, 52); belt.addBox(-5F, 9.5F, -3.5F, 10, 2, 7); @@ -595,8 +592,8 @@ public class ModelOmegaArmour extends ModelBiped belt.mirror = true; setRotation(belt, 0F, 0F, 0F); } - - /* Left leg */ + + /* Left leg */ { leftLegSidePlate = new ModelRenderer(this, 40, 93); leftLegSidePlate.addBox(-0.5F, 12F, -3F, 1, 6, 6); @@ -640,8 +637,8 @@ public class ModelOmegaArmour extends ModelBiped leftLegPlate4.mirror = true; setRotation(leftLegPlate4, 0.1745329F, 0F, 0F); } - - /* Right leg */ + + /* Right leg */ { rightLegSidePlate = new ModelRenderer(this, 31, 71); rightLegSidePlate.mirror = true; @@ -688,8 +685,7 @@ public class ModelOmegaArmour extends ModelBiped this.bipedHead.cubeList.clear(); this.bipedHeadwear.cubeList.clear(); - if (addHelmet) - { + if (addHelmet) { this.bipedHead.addChild(this.leftFacePlate); this.bipedHead.addChild(this.rightFacePlate); this.bipedHead.addChild(this.facePlate1); @@ -712,8 +708,7 @@ public class ModelOmegaArmour extends ModelBiped } this.bipedBody.cubeList.clear(); - if (addChestPiece) - { + if (addChestPiece) { this.bipedBody.addChild(this.chestPlate1); this.bipedBody.addChild(this.chestPlate2); this.bipedBody.addChild(this.chestPlate3); @@ -722,14 +717,12 @@ public class ModelOmegaArmour extends ModelBiped this.bipedBody.addChild(this.chestPlate6); this.bipedBody.addChild(this.mainPlate); } - if (addLeggings) - { + if (addLeggings) { this.bipedBody.addChild(this.belt); } this.bipedRightArm.cubeList.clear(); - if (addChestPiece) - { + if (addChestPiece) { this.bipedRightArm.addChild(rightArmMain); this.bipedRightArm.addChild(this.rightKnucklePlate); this.bipedRightArm.addChild(this.rightKnuckleBrace); @@ -746,8 +739,7 @@ public class ModelOmegaArmour extends ModelBiped } this.bipedLeftArm.cubeList.clear(); - if (addChestPiece) - { + if (addChestPiece) { this.bipedLeftArm.addChild(leftArmMain); this.bipedLeftArm.addChild(this.leftKnucklePlate); this.bipedLeftArm.addChild(this.leftKnuckleBrace); @@ -764,16 +756,14 @@ public class ModelOmegaArmour extends ModelBiped } this.bipedLeftLeg.cubeList.clear(); - if (addBoots) - { + if (addBoots) { this.bipedLeftLeg.addChild(this.leftBootBottom); this.bipedLeftLeg.addChild(this.leftBootBrace); this.bipedLeftLeg.addChild(this.leftBootPlate); this.bipedLeftLeg.addChild(this.leftBootWing1); this.bipedLeftLeg.addChild(this.leftBootWing2); } - if (addLeggings) - { + if (addLeggings) { this.bipedLeftLeg.addChild(this.leftLegMain); this.bipedLeftLeg.addChild(this.leftLegSidePlate); this.bipedLeftLeg.addChild(this.leftLegPlate1); @@ -783,16 +773,14 @@ public class ModelOmegaArmour extends ModelBiped } this.bipedRightLeg.cubeList.clear(); - if (addBoots) - { + if (addBoots) { this.bipedRightLeg.addChild(this.rightBootBottom); this.bipedRightLeg.addChild(this.rightBootBrace); this.bipedRightLeg.addChild(this.rightBootPlate); this.bipedRightLeg.addChild(this.rightBootWing1); this.bipedRightLeg.addChild(this.rightBootWing2); } - if (addLeggings) - { + if (addLeggings) { this.bipedRightLeg.addChild(this.rightLegMain); this.bipedRightLeg.addChild(this.rightLegSidePlate); this.bipedRightLeg.addChild(this.rightLegPlate1); @@ -802,10 +790,8 @@ public class ModelOmegaArmour extends ModelBiped } } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { -// super.render(entity, f, f1, f2, f3, f4, f5); - + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + // super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); @@ -816,83 +802,81 @@ public class ModelOmegaArmour extends ModelBiped this.bipedLeftLeg.render(f5); this.bipedRightLeg.render(f5); -// head.render(f5); -// body.render(f5); -// rightarm.render(f5); -// leftarm.render(f5); -// rightleg.render(f5); -// leftleg.render(f5); -// rightArmMain.render(f5); -// rightKnucklePlate.render(f5); -// rightKnuckleBrace.render(f5); -// rightKnuckle1.render(f5); -// rightKnuckle2.render(f5); -// rightKnuckle3.render(f5); -// rightKnuckle4.render(f5); -// rightKnuckle5.render(f5); -// rightKnuckle6.render(f5); -// rightShoulder1.render(f5); -// rightShoulder2.render(f5); -// rightShoulder3.render(f5); -// mainPlate.render(f5); -// chestPlate1.render(f5); -// chestPlate2.render(f5); -// chestPlate3.render(f5); -// chestPlate4.render(f5); -// chestPlate5.render(f5); -// chestPlate6.render(f5); -// belt.render(f5); -// leftArmMain.render(f5); -// leftKnucklePlate.render(f5); -// leftKnuckleBrace.render(f5); -// leftKnuckle1.render(f5); -// leftKnuckle2.render(f5); -// leftKnuckle3.render(f5); -// leftKnuckle4.render(f5); -// leftKnuckle5.render(f5); -// leftKnuckle6.render(f5); -// leftShoulder1.render(f5); -// leftShoulder2.render(f5); -// leftShoulder3.render(f5); -// leftBootBottom.render(f5); -// leftBootPlate.render(f5); -// leftBootBrace.render(f5); -// leftBootWing1.render(f5); -// leftBootWing2.render(f5); -// rightBootBottom.render(f5); -// rightBootPlate.render(f5); -// rightBootBrace.render(f5); -// rightBootWing1.render(f5); -// rightBootWing2.render(f5); -// -// { -// leftLegSidePlate.render(f5); -// leftLegMain.render(f5); -// leftLegPlate1.render(f5); -// leftLegPlate2.render(f5); -// leftLegPlate3.render(f5); -// leftLegPlate4.render(f5); -// } -// -// { -// rightLegSidePlate.render(f5); -// rightLegMain.render(f5); -// rightLegPlate1.render(f5); -// rightLegPlate2.render(f5); -// rightLegPlate3.render(f5); -// rightLegPlate4.render(f5); -// } + // head.render(f5); + // body.render(f5); + // rightarm.render(f5); + // leftarm.render(f5); + // rightleg.render(f5); + // leftleg.render(f5); + // rightArmMain.render(f5); + // rightKnucklePlate.render(f5); + // rightKnuckleBrace.render(f5); + // rightKnuckle1.render(f5); + // rightKnuckle2.render(f5); + // rightKnuckle3.render(f5); + // rightKnuckle4.render(f5); + // rightKnuckle5.render(f5); + // rightKnuckle6.render(f5); + // rightShoulder1.render(f5); + // rightShoulder2.render(f5); + // rightShoulder3.render(f5); + // mainPlate.render(f5); + // chestPlate1.render(f5); + // chestPlate2.render(f5); + // chestPlate3.render(f5); + // chestPlate4.render(f5); + // chestPlate5.render(f5); + // chestPlate6.render(f5); + // belt.render(f5); + // leftArmMain.render(f5); + // leftKnucklePlate.render(f5); + // leftKnuckleBrace.render(f5); + // leftKnuckle1.render(f5); + // leftKnuckle2.render(f5); + // leftKnuckle3.render(f5); + // leftKnuckle4.render(f5); + // leftKnuckle5.render(f5); + // leftKnuckle6.render(f5); + // leftShoulder1.render(f5); + // leftShoulder2.render(f5); + // leftShoulder3.render(f5); + // leftBootBottom.render(f5); + // leftBootPlate.render(f5); + // leftBootBrace.render(f5); + // leftBootWing1.render(f5); + // leftBootWing2.render(f5); + // rightBootBottom.render(f5); + // rightBootPlate.render(f5); + // rightBootBrace.render(f5); + // rightBootWing1.render(f5); + // rightBootWing2.render(f5); + // + // { + // leftLegSidePlate.render(f5); + // leftLegMain.render(f5); + // leftLegPlate1.render(f5); + // leftLegPlate2.render(f5); + // leftLegPlate3.render(f5); + // leftLegPlate4.render(f5); + // } + // + // { + // rightLegSidePlate.render(f5); + // rightLegMain.render(f5); + // rightLegPlate1.render(f5); + // rightLegPlate2.render(f5); + // rightLegPlate3.render(f5); + // rightLegPlate4.render(f5); + // } } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaEarth.java index 4af279d5..6cb0d80c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaEarth.java @@ -8,7 +8,7 @@ import net.minecraft.entity.Entity; * OmegaEarth.tcn - TechneToTabulaImporter * Created using Tabula 4.1.0 */ -public class ModelOmegaEarth extends ModelBiped{ +public class ModelOmegaEarth extends ModelBiped { public ModelRenderer backPlate; public ModelRenderer topPlate; @@ -82,8 +82,7 @@ public class ModelOmegaEarth extends ModelBiped{ public ModelRenderer leftBoot2; public ModelRenderer leftBoot3; - public ModelOmegaEarth(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) - { + public ModelOmegaEarth(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) { super(f, 0.0f, 256, 128); this.leftShoulder = new ModelRenderer(this, 29, 33); this.leftShoulder.setRotationPoint(0.0F, 0.0F, 0.0F); @@ -101,7 +100,7 @@ public class ModelOmegaEarth extends ModelBiped{ this.setRotateAngle(facePlate3, -0.17453292012214658F, -0.15707963705062866F, 0.0F); this.leftArm = new ModelRenderer(this, 29, 45); this.leftArm.setRotationPoint(0.0F, 0.0F, 0.0F); - this.leftArm.addBox(-1.0F-0.5f, 2.0F, -2.5F, 5, 9, 5, 0.0F); + this.leftArm.addBox(-1.0F - 0.5f, 2.0F, -2.5F, 5, 9, 5, 0.0F); this.leftLegPlate11 = new ModelRenderer(this, 0, 91); this.leftLegPlate11.setRotationPoint(0.0F, 0.0F, 0.0F); this.leftLegPlate11.addBox(1.0F, 1.5F, -2.5F, 1, 3, 5, 0.0F); @@ -164,7 +163,7 @@ public class ModelOmegaEarth extends ModelBiped{ this.setRotateAngle(facePlate2, 0.05235987901687623F, 0.34906584024429316F, 0.0F); this.rightArm = new ModelRenderer(this, 29, 45); this.rightArm.mirror = true; - this.rightArm.setRotationPoint(0.0F+0.5f, 0.0F, 0.0F); + this.rightArm.setRotationPoint(0.0F + 0.5f, 0.0F, 0.0F); this.rightArm.addBox(-4.0F, 2.0F, -2.5F, 5, 9, 5, 0.0F); this.rightLegPlate11 = new ModelRenderer(this, 0, 91); @@ -189,7 +188,7 @@ public class ModelOmegaEarth extends ModelBiped{ this.rightArmSymbol = new ModelRenderer(this, 50, 45); this.rightArmSymbol.mirror = true; this.rightArmSymbol.setRotationPoint(0.0F, 0.0F, 0.0F); - this.rightArmSymbol.addBox(-5.0F+0.5f, 4.0F, -2.0F, 1, 4, 4, 0.0F); + this.rightArmSymbol.addBox(-5.0F + 0.5f, 4.0F, -2.0F, 1, 4, 4, 0.0F); this.leftLegPlate1 = new ModelRenderer(this, 0, 86); this.leftLegPlate1.setRotationPoint(0.0F, 0.0F, 0.0F); this.leftLegPlate1.addBox(-2.5F, 1.5F, -2.3F, 5, 3, 1, 0.0F); @@ -301,7 +300,7 @@ public class ModelOmegaEarth extends ModelBiped{ this.setRotateAngle(rightBoot3, 0.10471975511965977F, -0.0F, 0.2617993877991494F); this.leftArmSymbol = new ModelRenderer(this, 50, 45); this.leftArmSymbol.setRotationPoint(0.0F, 0.0F, 0.0F); - this.leftArmSymbol.addBox(4.0F-0.5f, 4.0F, -2.0F, 1, 4, 4, 0.0F); + this.leftArmSymbol.addBox(4.0F - 0.5f, 4.0F, -2.0F, 1, 4, 4, 0.0F); this.sidePlate6 = new ModelRenderer(this, 13, 110); this.sidePlate6.setRotationPoint(0.0F, 0.5F, 6.0F); this.sidePlate6.addBox(4.0F, -8.5F, -5.0F, 1, 7, 4, 0.0F); @@ -389,7 +388,7 @@ public class ModelOmegaEarth extends ModelBiped{ this.leftLegPlate2.setRotationPoint(0.0F, 2.5F, 0.0F); this.leftLegPlate2.addBox(-2.5F, 1.5F, -2.3F, 5, 3, 1, 0.0F); this.setRotateAngle(leftLegPlate2, -0.40142572795869574F, -0.0F, 0.0F); - + this.bipedBody.cubeList.clear(); this.bipedHead.cubeList.clear(); this.bipedHeadwear.cubeList.clear(); @@ -397,9 +396,8 @@ public class ModelOmegaEarth extends ModelBiped{ this.bipedLeftLeg.cubeList.clear(); this.bipedRightArm.cubeList.clear(); this.bipedRightLeg.cubeList.clear(); - - if(addChestPiece) - { + + if (addChestPiece) { this.bipedLeftArm.addChild(this.leftShoulder); this.bipedLeftArm.addChild(this.leftArm); this.bipedLeftArm.addChild(this.leftArmPlate1); @@ -424,9 +422,8 @@ public class ModelOmegaEarth extends ModelBiped{ this.bipedRightArm.addChild(this.rightArmPlate3); this.bipedRightArm.addChild(this.rightArmPlate2); } - - if(addLeggings) - { + + if (addLeggings) { this.bipedLeftLeg.addChild(this.leftLegPlate9); this.bipedLeftLeg.addChild(this.leftLegPlate11); this.bipedLeftLeg.addChild(this.leftLegPlate5); @@ -457,9 +454,8 @@ public class ModelOmegaEarth extends ModelBiped{ this.bipedLeftLeg.addChild(this.leftLegPlate6); this.bipedRightLeg.addChild(this.rightLegPlate9); } - - if(addBoots) - { + + if (addBoots) { this.bipedLeftLeg.addChild(this.leftBoot1); this.bipedLeftLeg.addChild(this.leftBoot3); this.bipedRightLeg.addChild(this.rightBoot2); @@ -467,9 +463,8 @@ public class ModelOmegaEarth extends ModelBiped{ this.bipedRightLeg.addChild(this.rightBoot1); this.bipedRightLeg.addChild(this.rightBoot3); } - - if(addHelmet) - { + + if (addHelmet) { this.bipedHead.addChild(this.facePlate3); this.bipedHead.addChild(this.facePlate2); this.bipedHead.addChild(this.backPlate); @@ -487,9 +482,8 @@ public class ModelOmegaEarth extends ModelBiped{ } @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - setRotationAngles(f, f1, f2, f3, f4, f5, entity); + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.bipedLeftArm.render(f5); this.bipedRightArm.render(f5); this.bipedLeftLeg.render(f5); @@ -506,4 +500,4 @@ public class ModelOmegaEarth extends ModelBiped{ modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaFire.java index 2d8a2c79..ee69159d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaFire.java @@ -8,8 +8,7 @@ import net.minecraft.entity.Entity; * OmegaFire - WayofTime * Created using Tabula 4.1.0 */ -public class ModelOmegaFire extends ModelBiped -{ +public class ModelOmegaFire extends ModelBiped { public ModelRenderer facePlate1; public ModelRenderer facePlate2; public ModelRenderer facePlate3; @@ -72,8 +71,7 @@ public class ModelOmegaFire extends ModelBiped public ModelRenderer rightBoot2; public ModelRenderer rightBoot3; - public ModelOmegaFire(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) - { + public ModelOmegaFire(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) { super(f, 0.0f, 128, 128); this.textureWidth = 128; this.textureHeight = 128; @@ -330,9 +328,8 @@ public class ModelOmegaFire extends ModelBiped this.bipedLeftLeg.cubeList.clear(); this.bipedRightArm.cubeList.clear(); this.bipedRightLeg.cubeList.clear(); - - if(addChestPiece) - { + + if (addChestPiece) { this.bipedBody.addChild(this.bodyPlate5); this.bipedBody.addChild(this.leftSpacer1); this.bipedBody.addChild(this.bodyPlate2); @@ -360,12 +357,11 @@ public class ModelOmegaFire extends ModelBiped this.bipedBody.addChild(this.rightSpacer1); this.bipedBody.addChild(this.bodyPlate1); this.bipedBody.addChild(this.bodyPlate4); - this.bipedBody.addChild(this.bodyPlate3); + this.bipedBody.addChild(this.bodyPlate3); this.bipedBody.addChild(this.chestMain); } - - if(addLeggings) - { + + if (addLeggings) { this.bipedBody.addChild(this.belt); this.bipedRightLeg.addChild(this.rightLeg); this.bipedRightLeg.addChild(this.rightLegPlate3); @@ -384,9 +380,8 @@ public class ModelOmegaFire extends ModelBiped this.bipedRightLeg.addChild(this.rightLegPlate5); this.bipedLeftLeg.addChild(this.leftLegPlate1); } - - if(addBoots) - { + + if (addBoots) { this.bipedLeftLeg.addChild(this.leftBoot1); this.bipedRightLeg.addChild(this.rightBoot1); this.bipedRightLeg.addChild(this.rightBoot2); @@ -394,10 +389,9 @@ public class ModelOmegaFire extends ModelBiped this.bipedLeftLeg.addChild(this.leftBoot2); this.bipedRightLeg.addChild(this.rightBoot3); } - - if(addHelmet) - { - this.bipedHead.addChild(this.facePlate3); + + if (addHelmet) { + this.bipedHead.addChild(this.facePlate3); this.bipedHead.addChild(this.facePlate1); this.bipedHead.addChild(this.facePlate6); this.bipedHead.addChild(this.facePlate2); @@ -407,13 +401,12 @@ public class ModelOmegaFire extends ModelBiped this.bipedHead.addChild(this.backPlate); this.bipedHead.addChild(this.facePlate4); this.bipedHead.addChild(this.facePlate7); - } + } } @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - setRotationAngles(f, f1, f2, f3, f4, f5, entity); + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.bipedRightLeg.render(f5); this.bipedRightArm.render(f5); this.bipedLeftArm.render(f5); @@ -425,8 +418,7 @@ public class ModelOmegaFire extends ModelBiped /** * This is a helper function from Tabula to set the rotation of model parts */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWater.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWater.java index b46da158..a9c02c25 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWater.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWater.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelOmegaWater extends ModelBiped -{ - //fields +public class ModelOmegaWater extends ModelBiped { + // fields ModelRenderer belt; ModelRenderer chestMain; @@ -51,450 +50,434 @@ public class ModelOmegaWater extends ModelBiped ModelRenderer rightPlate2; ModelRenderer rightPlate3; ModelRenderer rightPlate4; - - public ModelOmegaWater(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) - { + + public ModelOmegaWater(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) { super(f, 0.0f, 256, 128); - textureWidth = 256; - textureHeight = 128; - - belt = new ModelRenderer(this, 29, 42); - belt.addBox(-5F, 0F, -3F, 10, 2, 6); - belt.setRotationPoint(0F, 11F, 0F); - belt.setTextureSize(256, 128); - belt.mirror = true; - setRotation(belt, 0F, 0F, 0F); - - chestMain = new ModelRenderer(this, 0, 42); - chestMain.addBox(-4.5F, -0.5F, -2.5F, 9, 13, 5); - chestMain.setRotationPoint(0F, 0F, 0F); - chestMain.setTextureSize(256, 128); - chestMain.mirror = true; - setRotation(chestMain, 0F, 0F, 0F); - - chestPlate1 = new ModelRenderer(this, 0, 60); - chestPlate1.addBox(-4F, 1F, -2.5F, 8, 3, 2); - chestPlate1.setRotationPoint(0F, 0F, 0F); - chestPlate1.setTextureSize(256, 128); - chestPlate1.mirror = true; - setRotation(chestPlate1, -0.3490659F, 0F, 0F); - - chestPlate2 = new ModelRenderer(this, 0, 66); - chestPlate2.mirror = true; - chestPlate2.addBox(-4.5F, 2.5F, -3.5F, 3, 3, 1); - chestPlate2.setRotationPoint(0F, 0F, 0F); - chestPlate2.setTextureSize(256, 128); - chestPlate2.mirror = true; - setRotation(chestPlate2, 0F, 0F, 0F); - chestPlate2.mirror = false; - - chestPlate3 = new ModelRenderer(this, 0, 66); - chestPlate3.addBox(1.5F, 2.5F, -3.5F, 3, 3, 1); - chestPlate3.setRotationPoint(0F, 0F, 0F); - chestPlate3.setTextureSize(256, 128); - chestPlate3.mirror = true; - setRotation(chestPlate3, 0F, 0F, 0F); - - chestPlate4 = new ModelRenderer(this, 0, 71); - chestPlate4.addBox(-1.5F, 4.5F, -3.5F, 3, 5, 1); - chestPlate4.setRotationPoint(0F, 0F, 0F); - chestPlate4.setTextureSize(256, 128); - chestPlate4.mirror = true; - setRotation(chestPlate4, 0F, 0F, 0F); - - leftTank = new ModelRenderer(this, 9, 66); - leftTank.addBox(1F, 1F, 2.5F, 2, 8, 1); - leftTank.setRotationPoint(0F, 0F, 0F); - leftTank.setTextureSize(256, 128); - leftTank.mirror = true; - setRotation(leftTank, 0F, 0F, 0F); - - rightTank = new ModelRenderer(this, 9, 66); - rightTank.addBox(-3F, 1F, 2.5F, 2, 8, 1); - rightTank.setRotationPoint(0F, 0F, 0F); - rightTank.setTextureSize(256, 128); - rightTank.mirror = true; - setRotation(rightTank, 0F, 0F, 0F); - - tankBrace = new ModelRenderer(this, 0, 78); - tankBrace.addBox(-4F, 1.5F, 2F, 8, 2, 1); - tankBrace.setRotationPoint(0F, 0F, 0F); - tankBrace.setTextureSize(256, 128); - tankBrace.mirror = true; - setRotation(tankBrace, 0F, 0F, 0F); - - leftArmPlate1 = new ModelRenderer(this, 0, 82); - leftArmPlate1.addBox(-0.4F-4F, -2F-3F, -4F-1, 6, 3, 1); - leftArmPlate1.setRotationPoint(5F, 2F, 0F); - leftArmPlate1.setTextureSize(256, 128); - leftArmPlate1.mirror = true; - setRotation(leftArmPlate1, -0.3490659F, 0F, -0.2617994F); - - leftArmPlate2 = new ModelRenderer(this, 0, 82); - leftArmPlate2.addBox(-0.4F-4F, -2F-3F, -4F-1, 6, 3, 1); - leftArmPlate2.setRotationPoint(5F, 4F, 0F); - leftArmPlate2.setTextureSize(256, 128); - leftArmPlate2.mirror = true; - setRotation(leftArmPlate2, -0.3490659F, 0F, -0.2617994F); - - leftShoulder = new ModelRenderer(this, 21, 82); - leftShoulder.addBox(-1F-5F, -3F-2F, -3F, 6, 5, 6); - leftShoulder.setRotationPoint(5F, 2F, 0F); - leftShoulder.setTextureSize(256, 128); - leftShoulder.mirror = true; - setRotation(leftShoulder, 0F, 0F, 0F); - - leftArm = new ModelRenderer(this, 0, 87); - leftArm.addBox(-1F-5.5F, 1.5F-2F, -2.5F, 5, 9, 5); - leftArm.setRotationPoint(5F, 2F, 0F); - leftArm.setTextureSize(256, 128); - leftArm.mirror = true; - setRotation(leftArm, 0F, 0F, 0F); - - rightArm = new ModelRenderer(this, 0, 87); - rightArm.mirror = true; - rightArm.addBox(-4F+5.5F, 1.5F-2F, -2.5F, 5, 9, 5); - rightArm.setRotationPoint(-5F, 2F, 0F); - rightArm.setTextureSize(256, 128); - rightArm.mirror = true; - setRotation(rightArm, 0F, 0F, 0F); - rightArm.mirror = false; - - rightArmPlate1 = new ModelRenderer(this, 0, 82); - rightArmPlate1.mirror = true; - rightArmPlate1.addBox(-4.6F+4F, -2.2F-3F, -4F-1, 6, 3, 1); - rightArmPlate1.setRotationPoint(-6F, 2F, 0F); - rightArmPlate1.setTextureSize(256, 128); - rightArmPlate1.mirror = true; - setRotation(rightArmPlate1, -0.3490659F, 0F, 0.2617994F); - rightArmPlate1.mirror = false; - - rightArmPlate2 = new ModelRenderer(this, 0, 82); - rightArmPlate2.mirror = true; - rightArmPlate2.addBox(-4.6F+4F, -2.2F-3F, -4F-1, 6, 3, 1); - rightArmPlate2.setRotationPoint(-6F, 4F, 0F); - rightArmPlate2.setTextureSize(256, 128); - rightArmPlate2.mirror = true; - setRotation(rightArmPlate2, -0.3490659F, 0F, 0.2617994F); - rightArmPlate2.mirror = false; - - rightShoulder = new ModelRenderer(this, 21, 82); - rightShoulder.mirror = true; - rightShoulder.addBox(-4F+5F, -3F-2F, -3F, 6, 5, 6); - rightShoulder.setRotationPoint(-6F, 2F, 0F); - rightShoulder.setTextureSize(256, 128); - rightShoulder.mirror = true; - setRotation(rightShoulder, 0F, 0F, 0F); - rightShoulder.mirror = false; - - leftLeg = new ModelRenderer(this, 29, 51); - leftLeg.addBox(-4.5F, -12F, -2.5F, 5, 10, 5); - leftLeg.setRotationPoint(2F, 12F, 0F); - leftLeg.setTextureSize(256, 128); - leftLeg.mirror = true; - setRotation(leftLeg, 0F, 0F, 0F); - - leftLegBrace = new ModelRenderer(this, 38, 67); - leftLegBrace.addBox(-2F, -7F, -3F, 3, 1, 6); - leftLegBrace.setRotationPoint(2F, 12F, 0F); - leftLegBrace.setTextureSize(256, 128); - leftLegBrace.mirror = true; - setRotation(leftLegBrace, 0F, 0F, 0F); - - leftLegPouch = new ModelRenderer(this, 29, 67); - leftLegPouch.addBox(0.5F, 3F-12F, -1.5F, 1, 4, 3); - leftLegPouch.setRotationPoint(2F, 12F, 0F); - leftLegPouch.setTextureSize(256, 128); - leftLegPouch.mirror = true; - setRotation(leftLegPouch, 0F, 0F, 0F); - - rightLeg = new ModelRenderer(this, 29, 51); - rightLeg.mirror = true; - rightLeg.addBox(-0.5F, 0F-12F, -2.5F, 5, 10, 5); - rightLeg.setRotationPoint(-2F, 12F, 0F); - rightLeg.setTextureSize(256, 128); - rightLeg.mirror = true; - setRotation(rightLeg, 0F, 0F, 0F); - rightLeg.mirror = false; - - leftFoot = new ModelRenderer(this, 21, 103); - leftFoot.addBox(-4F, 9.5F-12F, -5F, 5, 3, 8); - leftFoot.setRotationPoint(2F, 12F, 0F); - leftFoot.setTextureSize(256, 128); - leftFoot.mirror = true; - setRotation(leftFoot, 0F, 0F, 0F); - - leftFootBrace = new ModelRenderer(this, 21, 94); - leftFootBrace.addBox(-4F, 7.5F-12F, -3F, 5, 2, 6); - leftFootBrace.setRotationPoint(2F, 12F, 0F); - leftFootBrace.setTextureSize(256, 128); - leftFootBrace.mirror = true; - setRotation(leftFootBrace, 0F, 0F, 0F); - - leftFootPlate = new ModelRenderer(this, 21, 115); - leftFootPlate.addBox(-3.5F, 7F-8F, 4F-9F, 4, 3, 1); - leftFootPlate.setRotationPoint(2F, 12F, 0F); - leftFootPlate.setTextureSize(256, 128); - leftFootPlate.mirror = true; - setRotation(leftFootPlate, -0.8726646F, 0F, 0F); - - rightFoot = new ModelRenderer(this, 21, 103); - rightFoot.mirror = true; - rightFoot.addBox(-1F, 9.5F-12F, -5F, 5, 3, 8); - rightFoot.setRotationPoint(-2F, 12F, 0F); - rightFoot.setTextureSize(256, 128); - rightFoot.mirror = true; - setRotation(rightFoot, 0F, 0F, 0F); - rightFoot.mirror = false; - - rightFootBrace = new ModelRenderer(this, 21, 94); - rightFootBrace.mirror = true; - rightFootBrace.addBox(-1F, 7.5F-12F, -3F, 5, 2, 6); - rightFootBrace.setRotationPoint(-2F, 12F, 0F); - rightFootBrace.setTextureSize(256, 128); - rightFootBrace.mirror = true; - setRotation(rightFootBrace, 0F, 0F, 0F); - rightFootBrace.mirror = false; - - rightFootPlate = new ModelRenderer(this, 21, 115); - rightFootPlate.mirror = true; - rightFootPlate.addBox(-0.5F, 7F-8F, 4F-9F, 4, 3, 1); - rightFootPlate.setRotationPoint(-2F, 12F, 0F); - rightFootPlate.setTextureSize(256, 128); - rightFootPlate.mirror = true; - setRotation(rightFootPlate, -0.8726646F, 0F, 0F); - rightFootPlate.mirror = false; - - topHeadPlate = new ModelRenderer(this, 58, 19); - topHeadPlate.addBox(-4F, -8.5F, -4.5F, 8, 1, 9); - topHeadPlate.setRotationPoint(0F, 0F, 0F); - topHeadPlate.setTextureSize(256, 128); - topHeadPlate.mirror = true; - setRotation(topHeadPlate, 0F, 0F, 0F); - - facePlate1 = new ModelRenderer(this, 58, 0); - facePlate1.addBox(-4F, -8.5F, -5F, 8, 4, 1); - facePlate1.setRotationPoint(0F, 0F, 0F); - facePlate1.setTextureSize(256, 128); - facePlate1.mirror = true; - setRotation(facePlate1, 0F, 0F, 0F); - - facePlate2 = new ModelRenderer(this, 58, 6); - facePlate2.addBox(-1F, -4.5F, -5F, 2, 2, 1); - facePlate2.setRotationPoint(0F, 0F, 0F); - facePlate2.setTextureSize(256, 128); - facePlate2.mirror = true; - setRotation(facePlate2, 0F, 0F, 0F); - - facePlate3 = new ModelRenderer(this, 58, 15); - facePlate3.addBox(-4F, -4.5F, -4.5F, 8, 2, 1); - facePlate3.setRotationPoint(0F, 0F, 0F); - facePlate3.setTextureSize(256, 128); - facePlate3.mirror = true; - setRotation(facePlate3, 0F, 0F, 0F); - - facePlate4 = new ModelRenderer(this, 58, 10); - facePlate4.mirror = true; - facePlate4.addBox(-2F, -3.5F, -5.5F, 4, 3, 1); - facePlate4.setRotationPoint(0F, 0.5F, 0F); - facePlate4.setTextureSize(256, 128); - facePlate4.mirror = true; - setRotation(facePlate4, 0.0523599F, 0.3490659F, 0F); - facePlate4.mirror = false; - - facePlate5 = new ModelRenderer(this, 58, 10); - facePlate5.addBox(-2F, -3.5F, -5.5F, 4, 3, 1); - facePlate5.setRotationPoint(0F, 0.5F, 0F); - facePlate5.setTextureSize(256, 128); - facePlate5.mirror = true; - setRotation(facePlate5, 0.0523599F, -0.3490659F, 0F); - - leftPlate1 = new ModelRenderer(this, 77, 0); - leftPlate1.addBox(4.5F, -5.2F, -4.6F, 1, 3, 9); - leftPlate1.setRotationPoint(0F, -2F, 0F); - leftPlate1.setTextureSize(256, 128); - leftPlate1.mirror = true; - setRotation(leftPlate1, 0F, 0F, -0.1919862F); - - leftPlate2 = new ModelRenderer(this, 77, 0); - leftPlate2.addBox(4.5F, -5.2F, -4.6F, 1, 3, 9); - leftPlate2.setRotationPoint(0F, 0F, 0F); - leftPlate2.setTextureSize(256, 128); - leftPlate2.mirror = true; - setRotation(leftPlate2, 0F, 0F, -0.1919862F); - - leftPlate3 = new ModelRenderer(this, 77, 0); - leftPlate3.addBox(4.5F, -5.2F, -4.6F, 1, 3, 9); - leftPlate3.setRotationPoint(0F, 2F, 0F); - leftPlate3.setTextureSize(256, 128); - leftPlate3.mirror = true; - setRotation(leftPlate3, 0F, 0F, -0.1919862F); - - backPlate2 = new ModelRenderer(this, 98, 0); - backPlate2.addBox(-4F, -5.5F, 4.5F, 8, 4, 1); - backPlate2.setRotationPoint(0F, 2F, 0F); - backPlate2.setTextureSize(256, 128); - backPlate2.mirror = true; - setRotation(backPlate2, 0.122173F, 0F, 0F); - - leftPlate4 = new ModelRenderer(this, 98, 6); - leftPlate4.addBox(3.5F, -5.8F, -4.6F, 1, 2, 9); - leftPlate4.setRotationPoint(0F, 4F, 0F); - leftPlate4.setTextureSize(256, 128); - leftPlate4.mirror = true; - setRotation(leftPlate4, 0F, 0F, 0F); - - backPlate1 = new ModelRenderer(this, 98, 0); - backPlate1.addBox(-4F, -5.5F, 4.5F, 8, 4, 1); - backPlate1.setRotationPoint(0F, -2F, 0F); - backPlate1.setTextureSize(256, 128); - backPlate1.mirror = true; - setRotation(backPlate1, 0.122173F, 0F, 0F); - - rightPlate1 = new ModelRenderer(this, 77, 0); - rightPlate1.mirror = true; - rightPlate1.addBox(-5.5F, -5.2F, -4.6F, 1, 3, 9); - rightPlate1.setRotationPoint(0F, -2F, 0F); - rightPlate1.setTextureSize(256, 128); - rightPlate1.mirror = true; - setRotation(rightPlate1, 0F, 0F, 0.1919862F); - rightPlate1.mirror = false; - - rightPlate2 = new ModelRenderer(this, 77, 0); - rightPlate2.mirror = true; - rightPlate2.addBox(-5.5F, -5.2F, -4.6F, 1, 3, 9); - rightPlate2.setRotationPoint(0F, 0F, 0F); - rightPlate2.setTextureSize(256, 128); - rightPlate2.mirror = true; - setRotation(rightPlate2, 0F, 0F, 0.1919862F); - rightPlate2.mirror = false; - - rightPlate3 = new ModelRenderer(this, 77, 0); - rightPlate3.mirror = true; - rightPlate3.addBox(-5.5F, -5.2F, -4.6F, 1, 3, 9); - rightPlate3.setRotationPoint(0F, 2F, 0F); - rightPlate3.setTextureSize(256, 128); - rightPlate3.mirror = true; - setRotation(rightPlate3, 0F, 0F, 0.1919862F); - rightPlate3.mirror = false; - - rightPlate4 = new ModelRenderer(this, 98, 6); - rightPlate4.mirror = true; - rightPlate4.addBox(-4.5F, -5.8F, -4.6F, 1, 2, 9); - rightPlate4.setRotationPoint(0F, 4F, 0F); - rightPlate4.setTextureSize(256, 128); - rightPlate4.mirror = true; - setRotation(rightPlate4, 0F, 0F, 0F); - rightPlate4.mirror = false; - - this.bipedHead.cubeList.clear(); - this.bipedHeadwear.cubeList.clear(); - if (addHelmet) - { - this.bipedHead.addChild(this.facePlate1); - this.bipedHead.addChild(this.facePlate2); - this.bipedHead.addChild(this.facePlate3); - this.bipedHead.addChild(this.facePlate4); - this.bipedHead.addChild(this.facePlate5); - this.bipedHead.addChild(this.topHeadPlate); - this.bipedHead.addChild(this.leftPlate1); - this.bipedHead.addChild(this.rightPlate1); - this.bipedHead.addChild(this.leftPlate2); - this.bipedHead.addChild(this.rightPlate2); - this.bipedHead.addChild(this.leftPlate3); - this.bipedHead.addChild(this.rightPlate3); - this.bipedHead.addChild(this.leftPlate4); - this.bipedHead.addChild(this.rightPlate4); - this.bipedHead.addChild(this.backPlate1); - this.bipedHead.addChild(this.backPlate2); - - } + textureWidth = 256; + textureHeight = 128; - this.bipedBody.cubeList.clear(); - if (addChestPiece) - { - this.bipedBody.addChild(this.chestMain); - this.bipedBody.addChild(this.chestPlate1); - this.bipedBody.addChild(this.chestPlate2); - this.bipedBody.addChild(this.chestPlate3); - this.bipedBody.addChild(this.chestPlate4); - this.bipedBody.addChild(this.leftTank); - this.bipedBody.addChild(this.rightTank); - this.bipedBody.addChild(this.tankBrace); - } - if (addLeggings) - { - this.bipedBody.addChild(this.belt); - } + belt = new ModelRenderer(this, 29, 42); + belt.addBox(-5F, 0F, -3F, 10, 2, 6); + belt.setRotationPoint(0F, 11F, 0F); + belt.setTextureSize(256, 128); + belt.mirror = true; + setRotation(belt, 0F, 0F, 0F); - this.bipedRightArm.cubeList.clear(); - if (addChestPiece) - { - this.bipedRightArm.addChild(this.rightArm); - this.bipedRightArm.addChild(this.rightShoulder); - this.bipedRightArm.addChild(this.rightArmPlate1); - this.bipedRightArm.addChild(this.rightArmPlate2); + chestMain = new ModelRenderer(this, 0, 42); + chestMain.addBox(-4.5F, -0.5F, -2.5F, 9, 13, 5); + chestMain.setRotationPoint(0F, 0F, 0F); + chestMain.setTextureSize(256, 128); + chestMain.mirror = true; + setRotation(chestMain, 0F, 0F, 0F); - } + chestPlate1 = new ModelRenderer(this, 0, 60); + chestPlate1.addBox(-4F, 1F, -2.5F, 8, 3, 2); + chestPlate1.setRotationPoint(0F, 0F, 0F); + chestPlate1.setTextureSize(256, 128); + chestPlate1.mirror = true; + setRotation(chestPlate1, -0.3490659F, 0F, 0F); - this.bipedLeftArm.cubeList.clear(); - if (addChestPiece) - { - this.bipedLeftArm.addChild(this.leftArm); - this.bipedLeftArm.addChild(this.leftShoulder); - this.bipedLeftArm.addChild(this.leftArmPlate1); - this.bipedLeftArm.addChild(this.leftArmPlate2); - } + chestPlate2 = new ModelRenderer(this, 0, 66); + chestPlate2.mirror = true; + chestPlate2.addBox(-4.5F, 2.5F, -3.5F, 3, 3, 1); + chestPlate2.setRotationPoint(0F, 0F, 0F); + chestPlate2.setTextureSize(256, 128); + chestPlate2.mirror = true; + setRotation(chestPlate2, 0F, 0F, 0F); + chestPlate2.mirror = false; - this.bipedLeftLeg.cubeList.clear(); - if (addBoots) - { - this.bipedLeftLeg.addChild(this.leftFoot); - this.bipedLeftLeg.addChild(this.leftFootBrace); - this.bipedLeftLeg.addChild(this.leftFootPlate); - } - if (addLeggings) - { - this.bipedLeftLeg.addChild(this.leftLeg); - this.bipedLeftLeg.addChild(this.leftLegBrace); - this.bipedLeftLeg.addChild(this.leftLegPouch); - } + chestPlate3 = new ModelRenderer(this, 0, 66); + chestPlate3.addBox(1.5F, 2.5F, -3.5F, 3, 3, 1); + chestPlate3.setRotationPoint(0F, 0F, 0F); + chestPlate3.setTextureSize(256, 128); + chestPlate3.mirror = true; + setRotation(chestPlate3, 0F, 0F, 0F); - this.bipedRightLeg.cubeList.clear(); - if (addBoots) - { - this.bipedRightLeg.addChild(this.rightFoot); - this.bipedRightLeg.addChild(this.rightFootBrace); - this.bipedRightLeg.addChild(this.rightFootPlate); - } - if (addLeggings) - { - this.bipedRightLeg.addChild(this.rightLeg); - } - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - setRotationAngles(f, f1, f2, f3, f4, f5, entity); + chestPlate4 = new ModelRenderer(this, 0, 71); + chestPlate4.addBox(-1.5F, 4.5F, -3.5F, 3, 5, 1); + chestPlate4.setRotationPoint(0F, 0F, 0F); + chestPlate4.setTextureSize(256, 128); + chestPlate4.mirror = true; + setRotation(chestPlate4, 0F, 0F, 0F); - this.bipedHead.render(f5); - this.bipedBody.render(f5); - this.bipedLeftArm.render(f5); - this.bipedRightArm.render(f5); - this.bipedLeftLeg.render(f5); - this.bipedRightLeg.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } + leftTank = new ModelRenderer(this, 9, 66); + leftTank.addBox(1F, 1F, 2.5F, 2, 8, 1); + leftTank.setRotationPoint(0F, 0F, 0F); + leftTank.setTextureSize(256, 128); + leftTank.mirror = true; + setRotation(leftTank, 0F, 0F, 0F); + rightTank = new ModelRenderer(this, 9, 66); + rightTank.addBox(-3F, 1F, 2.5F, 2, 8, 1); + rightTank.setRotationPoint(0F, 0F, 0F); + rightTank.setTextureSize(256, 128); + rightTank.mirror = true; + setRotation(rightTank, 0F, 0F, 0F); + + tankBrace = new ModelRenderer(this, 0, 78); + tankBrace.addBox(-4F, 1.5F, 2F, 8, 2, 1); + tankBrace.setRotationPoint(0F, 0F, 0F); + tankBrace.setTextureSize(256, 128); + tankBrace.mirror = true; + setRotation(tankBrace, 0F, 0F, 0F); + + leftArmPlate1 = new ModelRenderer(this, 0, 82); + leftArmPlate1.addBox(-0.4F - 4F, -2F - 3F, -4F - 1, 6, 3, 1); + leftArmPlate1.setRotationPoint(5F, 2F, 0F); + leftArmPlate1.setTextureSize(256, 128); + leftArmPlate1.mirror = true; + setRotation(leftArmPlate1, -0.3490659F, 0F, -0.2617994F); + + leftArmPlate2 = new ModelRenderer(this, 0, 82); + leftArmPlate2.addBox(-0.4F - 4F, -2F - 3F, -4F - 1, 6, 3, 1); + leftArmPlate2.setRotationPoint(5F, 4F, 0F); + leftArmPlate2.setTextureSize(256, 128); + leftArmPlate2.mirror = true; + setRotation(leftArmPlate2, -0.3490659F, 0F, -0.2617994F); + + leftShoulder = new ModelRenderer(this, 21, 82); + leftShoulder.addBox(-1F - 5F, -3F - 2F, -3F, 6, 5, 6); + leftShoulder.setRotationPoint(5F, 2F, 0F); + leftShoulder.setTextureSize(256, 128); + leftShoulder.mirror = true; + setRotation(leftShoulder, 0F, 0F, 0F); + + leftArm = new ModelRenderer(this, 0, 87); + leftArm.addBox(-1F - 5.5F, 1.5F - 2F, -2.5F, 5, 9, 5); + leftArm.setRotationPoint(5F, 2F, 0F); + leftArm.setTextureSize(256, 128); + leftArm.mirror = true; + setRotation(leftArm, 0F, 0F, 0F); + + rightArm = new ModelRenderer(this, 0, 87); + rightArm.mirror = true; + rightArm.addBox(-4F + 5.5F, 1.5F - 2F, -2.5F, 5, 9, 5); + rightArm.setRotationPoint(-5F, 2F, 0F); + rightArm.setTextureSize(256, 128); + rightArm.mirror = true; + setRotation(rightArm, 0F, 0F, 0F); + rightArm.mirror = false; + + rightArmPlate1 = new ModelRenderer(this, 0, 82); + rightArmPlate1.mirror = true; + rightArmPlate1.addBox(-4.6F + 4F, -2.2F - 3F, -4F - 1, 6, 3, 1); + rightArmPlate1.setRotationPoint(-6F, 2F, 0F); + rightArmPlate1.setTextureSize(256, 128); + rightArmPlate1.mirror = true; + setRotation(rightArmPlate1, -0.3490659F, 0F, 0.2617994F); + rightArmPlate1.mirror = false; + + rightArmPlate2 = new ModelRenderer(this, 0, 82); + rightArmPlate2.mirror = true; + rightArmPlate2.addBox(-4.6F + 4F, -2.2F - 3F, -4F - 1, 6, 3, 1); + rightArmPlate2.setRotationPoint(-6F, 4F, 0F); + rightArmPlate2.setTextureSize(256, 128); + rightArmPlate2.mirror = true; + setRotation(rightArmPlate2, -0.3490659F, 0F, 0.2617994F); + rightArmPlate2.mirror = false; + + rightShoulder = new ModelRenderer(this, 21, 82); + rightShoulder.mirror = true; + rightShoulder.addBox(-4F + 5F, -3F - 2F, -3F, 6, 5, 6); + rightShoulder.setRotationPoint(-6F, 2F, 0F); + rightShoulder.setTextureSize(256, 128); + rightShoulder.mirror = true; + setRotation(rightShoulder, 0F, 0F, 0F); + rightShoulder.mirror = false; + + leftLeg = new ModelRenderer(this, 29, 51); + leftLeg.addBox(-4.5F, -12F, -2.5F, 5, 10, 5); + leftLeg.setRotationPoint(2F, 12F, 0F); + leftLeg.setTextureSize(256, 128); + leftLeg.mirror = true; + setRotation(leftLeg, 0F, 0F, 0F); + + leftLegBrace = new ModelRenderer(this, 38, 67); + leftLegBrace.addBox(-2F, -7F, -3F, 3, 1, 6); + leftLegBrace.setRotationPoint(2F, 12F, 0F); + leftLegBrace.setTextureSize(256, 128); + leftLegBrace.mirror = true; + setRotation(leftLegBrace, 0F, 0F, 0F); + + leftLegPouch = new ModelRenderer(this, 29, 67); + leftLegPouch.addBox(0.5F, 3F - 12F, -1.5F, 1, 4, 3); + leftLegPouch.setRotationPoint(2F, 12F, 0F); + leftLegPouch.setTextureSize(256, 128); + leftLegPouch.mirror = true; + setRotation(leftLegPouch, 0F, 0F, 0F); + + rightLeg = new ModelRenderer(this, 29, 51); + rightLeg.mirror = true; + rightLeg.addBox(-0.5F, 0F - 12F, -2.5F, 5, 10, 5); + rightLeg.setRotationPoint(-2F, 12F, 0F); + rightLeg.setTextureSize(256, 128); + rightLeg.mirror = true; + setRotation(rightLeg, 0F, 0F, 0F); + rightLeg.mirror = false; + + leftFoot = new ModelRenderer(this, 21, 103); + leftFoot.addBox(-4F, 9.5F - 12F, -5F, 5, 3, 8); + leftFoot.setRotationPoint(2F, 12F, 0F); + leftFoot.setTextureSize(256, 128); + leftFoot.mirror = true; + setRotation(leftFoot, 0F, 0F, 0F); + + leftFootBrace = new ModelRenderer(this, 21, 94); + leftFootBrace.addBox(-4F, 7.5F - 12F, -3F, 5, 2, 6); + leftFootBrace.setRotationPoint(2F, 12F, 0F); + leftFootBrace.setTextureSize(256, 128); + leftFootBrace.mirror = true; + setRotation(leftFootBrace, 0F, 0F, 0F); + + leftFootPlate = new ModelRenderer(this, 21, 115); + leftFootPlate.addBox(-3.5F, 7F - 8F, 4F - 9F, 4, 3, 1); + leftFootPlate.setRotationPoint(2F, 12F, 0F); + leftFootPlate.setTextureSize(256, 128); + leftFootPlate.mirror = true; + setRotation(leftFootPlate, -0.8726646F, 0F, 0F); + + rightFoot = new ModelRenderer(this, 21, 103); + rightFoot.mirror = true; + rightFoot.addBox(-1F, 9.5F - 12F, -5F, 5, 3, 8); + rightFoot.setRotationPoint(-2F, 12F, 0F); + rightFoot.setTextureSize(256, 128); + rightFoot.mirror = true; + setRotation(rightFoot, 0F, 0F, 0F); + rightFoot.mirror = false; + + rightFootBrace = new ModelRenderer(this, 21, 94); + rightFootBrace.mirror = true; + rightFootBrace.addBox(-1F, 7.5F - 12F, -3F, 5, 2, 6); + rightFootBrace.setRotationPoint(-2F, 12F, 0F); + rightFootBrace.setTextureSize(256, 128); + rightFootBrace.mirror = true; + setRotation(rightFootBrace, 0F, 0F, 0F); + rightFootBrace.mirror = false; + + rightFootPlate = new ModelRenderer(this, 21, 115); + rightFootPlate.mirror = true; + rightFootPlate.addBox(-0.5F, 7F - 8F, 4F - 9F, 4, 3, 1); + rightFootPlate.setRotationPoint(-2F, 12F, 0F); + rightFootPlate.setTextureSize(256, 128); + rightFootPlate.mirror = true; + setRotation(rightFootPlate, -0.8726646F, 0F, 0F); + rightFootPlate.mirror = false; + + topHeadPlate = new ModelRenderer(this, 58, 19); + topHeadPlate.addBox(-4F, -8.5F, -4.5F, 8, 1, 9); + topHeadPlate.setRotationPoint(0F, 0F, 0F); + topHeadPlate.setTextureSize(256, 128); + topHeadPlate.mirror = true; + setRotation(topHeadPlate, 0F, 0F, 0F); + + facePlate1 = new ModelRenderer(this, 58, 0); + facePlate1.addBox(-4F, -8.5F, -5F, 8, 4, 1); + facePlate1.setRotationPoint(0F, 0F, 0F); + facePlate1.setTextureSize(256, 128); + facePlate1.mirror = true; + setRotation(facePlate1, 0F, 0F, 0F); + + facePlate2 = new ModelRenderer(this, 58, 6); + facePlate2.addBox(-1F, -4.5F, -5F, 2, 2, 1); + facePlate2.setRotationPoint(0F, 0F, 0F); + facePlate2.setTextureSize(256, 128); + facePlate2.mirror = true; + setRotation(facePlate2, 0F, 0F, 0F); + + facePlate3 = new ModelRenderer(this, 58, 15); + facePlate3.addBox(-4F, -4.5F, -4.5F, 8, 2, 1); + facePlate3.setRotationPoint(0F, 0F, 0F); + facePlate3.setTextureSize(256, 128); + facePlate3.mirror = true; + setRotation(facePlate3, 0F, 0F, 0F); + + facePlate4 = new ModelRenderer(this, 58, 10); + facePlate4.mirror = true; + facePlate4.addBox(-2F, -3.5F, -5.5F, 4, 3, 1); + facePlate4.setRotationPoint(0F, 0.5F, 0F); + facePlate4.setTextureSize(256, 128); + facePlate4.mirror = true; + setRotation(facePlate4, 0.0523599F, 0.3490659F, 0F); + facePlate4.mirror = false; + + facePlate5 = new ModelRenderer(this, 58, 10); + facePlate5.addBox(-2F, -3.5F, -5.5F, 4, 3, 1); + facePlate5.setRotationPoint(0F, 0.5F, 0F); + facePlate5.setTextureSize(256, 128); + facePlate5.mirror = true; + setRotation(facePlate5, 0.0523599F, -0.3490659F, 0F); + + leftPlate1 = new ModelRenderer(this, 77, 0); + leftPlate1.addBox(4.5F, -5.2F, -4.6F, 1, 3, 9); + leftPlate1.setRotationPoint(0F, -2F, 0F); + leftPlate1.setTextureSize(256, 128); + leftPlate1.mirror = true; + setRotation(leftPlate1, 0F, 0F, -0.1919862F); + + leftPlate2 = new ModelRenderer(this, 77, 0); + leftPlate2.addBox(4.5F, -5.2F, -4.6F, 1, 3, 9); + leftPlate2.setRotationPoint(0F, 0F, 0F); + leftPlate2.setTextureSize(256, 128); + leftPlate2.mirror = true; + setRotation(leftPlate2, 0F, 0F, -0.1919862F); + + leftPlate3 = new ModelRenderer(this, 77, 0); + leftPlate3.addBox(4.5F, -5.2F, -4.6F, 1, 3, 9); + leftPlate3.setRotationPoint(0F, 2F, 0F); + leftPlate3.setTextureSize(256, 128); + leftPlate3.mirror = true; + setRotation(leftPlate3, 0F, 0F, -0.1919862F); + + backPlate2 = new ModelRenderer(this, 98, 0); + backPlate2.addBox(-4F, -5.5F, 4.5F, 8, 4, 1); + backPlate2.setRotationPoint(0F, 2F, 0F); + backPlate2.setTextureSize(256, 128); + backPlate2.mirror = true; + setRotation(backPlate2, 0.122173F, 0F, 0F); + + leftPlate4 = new ModelRenderer(this, 98, 6); + leftPlate4.addBox(3.5F, -5.8F, -4.6F, 1, 2, 9); + leftPlate4.setRotationPoint(0F, 4F, 0F); + leftPlate4.setTextureSize(256, 128); + leftPlate4.mirror = true; + setRotation(leftPlate4, 0F, 0F, 0F); + + backPlate1 = new ModelRenderer(this, 98, 0); + backPlate1.addBox(-4F, -5.5F, 4.5F, 8, 4, 1); + backPlate1.setRotationPoint(0F, -2F, 0F); + backPlate1.setTextureSize(256, 128); + backPlate1.mirror = true; + setRotation(backPlate1, 0.122173F, 0F, 0F); + + rightPlate1 = new ModelRenderer(this, 77, 0); + rightPlate1.mirror = true; + rightPlate1.addBox(-5.5F, -5.2F, -4.6F, 1, 3, 9); + rightPlate1.setRotationPoint(0F, -2F, 0F); + rightPlate1.setTextureSize(256, 128); + rightPlate1.mirror = true; + setRotation(rightPlate1, 0F, 0F, 0.1919862F); + rightPlate1.mirror = false; + + rightPlate2 = new ModelRenderer(this, 77, 0); + rightPlate2.mirror = true; + rightPlate2.addBox(-5.5F, -5.2F, -4.6F, 1, 3, 9); + rightPlate2.setRotationPoint(0F, 0F, 0F); + rightPlate2.setTextureSize(256, 128); + rightPlate2.mirror = true; + setRotation(rightPlate2, 0F, 0F, 0.1919862F); + rightPlate2.mirror = false; + + rightPlate3 = new ModelRenderer(this, 77, 0); + rightPlate3.mirror = true; + rightPlate3.addBox(-5.5F, -5.2F, -4.6F, 1, 3, 9); + rightPlate3.setRotationPoint(0F, 2F, 0F); + rightPlate3.setTextureSize(256, 128); + rightPlate3.mirror = true; + setRotation(rightPlate3, 0F, 0F, 0.1919862F); + rightPlate3.mirror = false; + + rightPlate4 = new ModelRenderer(this, 98, 6); + rightPlate4.mirror = true; + rightPlate4.addBox(-4.5F, -5.8F, -4.6F, 1, 2, 9); + rightPlate4.setRotationPoint(0F, 4F, 0F); + rightPlate4.setTextureSize(256, 128); + rightPlate4.mirror = true; + setRotation(rightPlate4, 0F, 0F, 0F); + rightPlate4.mirror = false; + + this.bipedHead.cubeList.clear(); + this.bipedHeadwear.cubeList.clear(); + if (addHelmet) { + this.bipedHead.addChild(this.facePlate1); + this.bipedHead.addChild(this.facePlate2); + this.bipedHead.addChild(this.facePlate3); + this.bipedHead.addChild(this.facePlate4); + this.bipedHead.addChild(this.facePlate5); + this.bipedHead.addChild(this.topHeadPlate); + this.bipedHead.addChild(this.leftPlate1); + this.bipedHead.addChild(this.rightPlate1); + this.bipedHead.addChild(this.leftPlate2); + this.bipedHead.addChild(this.rightPlate2); + this.bipedHead.addChild(this.leftPlate3); + this.bipedHead.addChild(this.rightPlate3); + this.bipedHead.addChild(this.leftPlate4); + this.bipedHead.addChild(this.rightPlate4); + this.bipedHead.addChild(this.backPlate1); + this.bipedHead.addChild(this.backPlate2); + } + + this.bipedBody.cubeList.clear(); + if (addChestPiece) { + this.bipedBody.addChild(this.chestMain); + this.bipedBody.addChild(this.chestPlate1); + this.bipedBody.addChild(this.chestPlate2); + this.bipedBody.addChild(this.chestPlate3); + this.bipedBody.addChild(this.chestPlate4); + this.bipedBody.addChild(this.leftTank); + this.bipedBody.addChild(this.rightTank); + this.bipedBody.addChild(this.tankBrace); + } + if (addLeggings) { + this.bipedBody.addChild(this.belt); + } + + this.bipedRightArm.cubeList.clear(); + if (addChestPiece) { + this.bipedRightArm.addChild(this.rightArm); + this.bipedRightArm.addChild(this.rightShoulder); + this.bipedRightArm.addChild(this.rightArmPlate1); + this.bipedRightArm.addChild(this.rightArmPlate2); + } + + this.bipedLeftArm.cubeList.clear(); + if (addChestPiece) { + this.bipedLeftArm.addChild(this.leftArm); + this.bipedLeftArm.addChild(this.leftShoulder); + this.bipedLeftArm.addChild(this.leftArmPlate1); + this.bipedLeftArm.addChild(this.leftArmPlate2); + } + + this.bipedLeftLeg.cubeList.clear(); + if (addBoots) { + this.bipedLeftLeg.addChild(this.leftFoot); + this.bipedLeftLeg.addChild(this.leftFootBrace); + this.bipedLeftLeg.addChild(this.leftFootPlate); + } + if (addLeggings) { + this.bipedLeftLeg.addChild(this.leftLeg); + this.bipedLeftLeg.addChild(this.leftLegBrace); + this.bipedLeftLeg.addChild(this.leftLegPouch); + } + + this.bipedRightLeg.cubeList.clear(); + if (addBoots) { + this.bipedRightLeg.addChild(this.rightFoot); + this.bipedRightLeg.addChild(this.rightFootBrace); + this.bipedRightLeg.addChild(this.rightFootPlate); + } + if (addLeggings) { + this.bipedRightLeg.addChild(this.rightLeg); + } + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + + this.bipedHead.render(f5); + this.bipedBody.render(f5); + this.bipedLeftArm.render(f5); + this.bipedRightArm.render(f5); + this.bipedLeftLeg.render(f5); + this.bipedRightLeg.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWind.java index 6dfb7dc8..a057eadc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelOmegaWind.java @@ -8,8 +8,7 @@ import net.minecraft.entity.Entity; * OmegaWind.tcn - TechneToTabulaImporter * Created using Tabula 4.1.0 */ -public class ModelOmegaWind extends ModelBiped -{ +public class ModelOmegaWind extends ModelBiped { public ModelRenderer facePlate1; public ModelRenderer facePlate2; public ModelRenderer facePlate3; @@ -66,8 +65,7 @@ public class ModelOmegaWind extends ModelBiped public ModelRenderer leftFoot2; public ModelRenderer leftFootPlate; - public ModelOmegaWind(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) - { + public ModelOmegaWind(float f, boolean addHelmet, boolean addChestPiece, boolean addLeggings, boolean addBoots) { super(f, 0.0f, 128, 128); this.rightWingPlate2 = new ModelRenderer(this, 33, 82); this.rightWingPlate2.mirror = true; @@ -309,9 +307,8 @@ public class ModelOmegaWind extends ModelBiped this.bipedLeftLeg.cubeList.clear(); this.bipedRightArm.cubeList.clear(); this.bipedRightLeg.cubeList.clear(); - - if(addChestPiece) - { + + if (addChestPiece) { this.bipedLeftArm.addChild(this.leftFloater1); this.bipedRightArm.addChild(this.rightArmPlate1); this.bipedLeftArm.addChild(this.leftShoulder); @@ -339,9 +336,8 @@ public class ModelOmegaWind extends ModelBiped this.bipedBody.addChild(this.chestPlate5); this.bipedLeftArm.addChild(this.leftArmPlate1); } - - if(addLeggings) - { + + if (addLeggings) { this.bipedLeftLeg.addChild(this.leftLegFloater3); this.bipedLeftLeg.addChild(this.leftLegFloater1); this.bipedRightLeg.addChild(this.rightLegFloater2); @@ -352,9 +348,8 @@ public class ModelOmegaWind extends ModelBiped this.bipedLeftLeg.addChild(this.leftLegFloater2); this.bipedLeftLeg.addChild(this.leftLeg); } - - if(addBoots) - { + + if (addBoots) { this.bipedLeftLeg.addChild(this.leftFoot1); this.bipedRightLeg.addChild(this.rightFoot2); this.bipedRightLeg.addChild(this.rightFootPlate); @@ -362,9 +357,8 @@ public class ModelOmegaWind extends ModelBiped this.bipedLeftLeg.addChild(this.leftFoot2); this.bipedLeftLeg.addChild(this.leftFootPlate); } - - if(addHelmet) - { + + if (addHelmet) { this.bipedHead.addChild(this.rightWingPlate2); this.bipedHead.addChild(this.leftWingPlate3); this.bipedHead.addChild(this.topPlate); @@ -383,9 +377,8 @@ public class ModelOmegaWind extends ModelBiped } @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.bipedBody.render(f5); this.bipedRightLeg.render(f5); this.bipedLeftLeg.render(f5); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPedestal.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPedestal.java index 753df6a5..05cf5c46 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPedestal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPedestal.java @@ -4,15 +4,13 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelPedestal extends ModelBase -{ - //fields +public class ModelPedestal extends ModelBase { + // fields ModelRenderer base; ModelRenderer top; ModelRenderer middle; - public ModelPedestal() - { + public ModelPedestal() { textureWidth = 64; textureHeight = 32; base = new ModelRenderer(this, 0, 0); @@ -35,8 +33,7 @@ public class ModelPedestal extends ModelBase setRotation(middle, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); base.render(f5); @@ -44,15 +41,13 @@ public class ModelPedestal extends ModelBase middle.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPlinth.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPlinth.java index f4190b5d..87186268 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPlinth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelPlinth.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelPlinth extends ModelBase -{ - //fields +public class ModelPlinth extends ModelBase { + // fields ModelRenderer base; ModelRenderer table; ModelRenderer pillar; @@ -15,8 +14,7 @@ public class ModelPlinth extends ModelBase ModelRenderer edge3; ModelRenderer edge4; - public ModelPlinth() - { + public ModelPlinth() { textureWidth = 64; textureHeight = 64; base = new ModelRenderer(this, 0, 16); @@ -63,8 +61,7 @@ public class ModelPlinth extends ModelBase setRotation(edge4, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); base.render(f5); @@ -76,15 +73,13 @@ public class ModelPlinth extends ModelBase edge4.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelShade.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelShade.java index 8a7f2632..4582deb1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelShade.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelShade.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelShade extends ModelBase -{ - //fields +public class ModelShade extends ModelBase { + // fields ModelRenderer body; ModelRenderer tail1; ModelRenderer leftArm; @@ -14,8 +13,7 @@ public class ModelShade extends ModelBase ModelRenderer tail2; ModelRenderer head; - public ModelShade() - { + public ModelShade() { textureWidth = 64; textureHeight = 64; body = new ModelRenderer(this, 0, 45); @@ -58,8 +56,7 @@ public class ModelShade extends ModelBase setRotation(head, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); body.render(f5); @@ -70,15 +67,13 @@ public class ModelShade extends ModelBase head.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.head.rotateAngleX = f4 / (180F / (float) Math.PI); this.head.rotateAngleY = f3 / (180F / (float) Math.PI); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSmallEarthGolem.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSmallEarthGolem.java index 45a232de..e51d4838 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSmallEarthGolem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSmallEarthGolem.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelSmallEarthGolem extends ModelBase -{ - //fields +public class ModelSmallEarthGolem extends ModelBase { + // fields ModelRenderer leftLeg; ModelRenderer rightLeg; ModelRenderer body; @@ -19,8 +18,7 @@ public class ModelSmallEarthGolem extends ModelBase ModelRenderer rightArm; ModelRenderer back1; - public ModelSmallEarthGolem() - { + public ModelSmallEarthGolem() { textureWidth = 32; textureHeight = 32; leftLeg = new ModelRenderer(this, 13, 0); @@ -91,8 +89,7 @@ public class ModelSmallEarthGolem extends ModelBase setRotation(back1, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); leftLeg.render(f5); @@ -107,15 +104,13 @@ public class ModelSmallEarthGolem extends ModelBase back1.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.head.rotateAngleX = f4 / (180F / (float) Math.PI); this.head.rotateAngleY = f3 / (180F / (float) Math.PI); @@ -124,4 +119,4 @@ public class ModelSmallEarthGolem extends ModelBase this.rightArm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1; this.leftArm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEffectBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEffectBlock.java index d816ae3d..0e805a02 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEffectBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEffectBlock.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.common.util.ForgeDirection; -public class ModelSpellEffectBlock extends ModelBase -{ - //fields +public class ModelSpellEffectBlock extends ModelBase { + // fields ModelRenderer core; ModelRenderer frame1; ModelRenderer frame2; @@ -33,8 +32,7 @@ public class ModelSpellEffectBlock extends ModelBase ModelRenderer outputSpacer3; ModelRenderer outputSpacer4; - public ModelSpellEffectBlock() - { + public ModelSpellEffectBlock() { textureWidth = 64; textureHeight = 64; @@ -184,8 +182,16 @@ public class ModelSpellEffectBlock extends ModelBase setRotation(outputSpacer4, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ForgeDirection input, ForgeDirection output) - { + public void render( + Entity entity, + float f, + float f1, + float f2, + float f3, + float f4, + float f5, + ForgeDirection input, + ForgeDirection output) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); float xInputRot = 0.0f; @@ -195,8 +201,7 @@ public class ModelSpellEffectBlock extends ModelBase float yOutputRot = 0.0f; float zOutputRot = 0.0f; - switch (input) - { + switch (input) { case NORTH: xInputRot = 0.0f; yInputRot = 0.0f; @@ -237,8 +242,7 @@ public class ModelSpellEffectBlock extends ModelBase break; } - switch (output) - { + switch (output) { case NORTH: xOutputRot = 0.0f; yOutputRot = (float) (0.5f * Math.PI); @@ -317,16 +321,13 @@ public class ModelSpellEffectBlock extends ModelBase outputSpacer4.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEnhancementBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEnhancementBlock.java index e83b4084..5ff6102c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEnhancementBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellEnhancementBlock.java @@ -5,10 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.common.util.ForgeDirection; - -public class ModelSpellEnhancementBlock extends ModelBase -{ - //fields +public class ModelSpellEnhancementBlock extends ModelBase { + // fields ModelRenderer core; ModelRenderer frame1; ModelRenderer frame2; @@ -34,8 +32,7 @@ public class ModelSpellEnhancementBlock extends ModelBase ModelRenderer input4; ModelRenderer outputSecond; - public ModelSpellEnhancementBlock() - { + public ModelSpellEnhancementBlock() { textureWidth = 128; textureHeight = 64; @@ -185,8 +182,16 @@ public class ModelSpellEnhancementBlock extends ModelBase setRotation(outputSecond, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ForgeDirection input, ForgeDirection output) - { + public void render( + Entity entity, + float f, + float f1, + float f2, + float f3, + float f4, + float f5, + ForgeDirection input, + ForgeDirection output) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); @@ -197,8 +202,7 @@ public class ModelSpellEnhancementBlock extends ModelBase float yOutputRot = 0.0f; float zOutputRot = 0.0f; - switch (input) - { + switch (input) { case NORTH: xInputRot = 0.0f; yInputRot = 0.0f; @@ -239,8 +243,7 @@ public class ModelSpellEnhancementBlock extends ModelBase break; } - switch (output) - { + switch (output) { case NORTH: xOutputRot = 0.0f; yOutputRot = (float) (0.5f * Math.PI); @@ -319,16 +322,13 @@ public class ModelSpellEnhancementBlock extends ModelBase outputSecond.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellModifierBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellModifierBlock.java index a879889b..e670d493 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellModifierBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellModifierBlock.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.common.util.ForgeDirection; -public class ModelSpellModifierBlock extends ModelBase -{ - //fields +public class ModelSpellModifierBlock extends ModelBase { + // fields ModelRenderer core; ModelRenderer inputMain; ModelRenderer Shape2; @@ -28,8 +27,7 @@ public class ModelSpellModifierBlock extends ModelBase ModelRenderer output3; ModelRenderer output4; - public ModelSpellModifierBlock() - { + public ModelSpellModifierBlock() { textureWidth = 64; textureHeight = 64; @@ -149,8 +147,16 @@ public class ModelSpellModifierBlock extends ModelBase setRotation(output4, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ForgeDirection input, ForgeDirection output) - { + public void render( + Entity entity, + float f, + float f1, + float f2, + float f3, + float f4, + float f5, + ForgeDirection input, + ForgeDirection output) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); @@ -161,8 +167,7 @@ public class ModelSpellModifierBlock extends ModelBase float yOutputRot = 0.0f; float zOutputRot = 0.0f; - switch (input) - { + switch (input) { case NORTH: xInputRot = 0.0f; yInputRot = 0.0f; @@ -203,8 +208,7 @@ public class ModelSpellModifierBlock extends ModelBase break; } - switch (output) - { + switch (output) { case NORTH: xOutputRot = 0.0f; yOutputRot = (float) (0.5f * Math.PI); @@ -265,7 +269,6 @@ public class ModelSpellModifierBlock extends ModelBase this.setRotation(output3, xOutputRot, yOutputRot, zOutputRot); this.setRotation(output4, xOutputRot, yOutputRot, zOutputRot); - core.render(f5); inputMain.render(f5); Shape2.render(f5); @@ -287,17 +290,13 @@ public class ModelSpellModifierBlock extends ModelBase output4.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - } - diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellParadigmBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellParadigmBlock.java index 9fd4d551..6b2e7301 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellParadigmBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelSpellParadigmBlock.java @@ -1,20 +1,18 @@ package WayofTime.alchemicalWizardry.common.renderer.model; -//Date: 07/03/2014 9:30:25 PM -//Template version 1.1 -//Java generated by Techne -//Keep in mind that you still need to fill in some blanks -//- ZeuX - +// Date: 07/03/2014 9:30:25 PM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraftforge.common.util.ForgeDirection; -public class ModelSpellParadigmBlock extends ModelBase -{ - //fields +public class ModelSpellParadigmBlock extends ModelBase { + // fields ModelRenderer core; ModelRenderer outputMain; ModelRenderer output1; @@ -27,8 +25,7 @@ public class ModelSpellParadigmBlock extends ModelBase ModelRenderer Shape4; ModelRenderer Shape5; - public ModelSpellParadigmBlock() - { + public ModelSpellParadigmBlock() { textureWidth = 64; textureHeight = 64; @@ -100,8 +97,16 @@ public class ModelSpellParadigmBlock extends ModelBase setRotation(Shape5, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, ForgeDirection input, ForgeDirection output) - { + public void render( + Entity entity, + float f, + float f1, + float f2, + float f3, + float f4, + float f5, + ForgeDirection input, + ForgeDirection output) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); float xInputRot = 0.0f; @@ -111,8 +116,7 @@ public class ModelSpellParadigmBlock extends ModelBase float yOutputRot = 0.0f; float zOutputRot = 0.0f; - switch (input) - { + switch (input) { case NORTH: xInputRot = 0.0f; yInputRot = 0.0f; @@ -153,8 +157,7 @@ public class ModelSpellParadigmBlock extends ModelBase break; } - switch (output) - { + switch (output) { case NORTH: xOutputRot = 0.0f; yOutputRot = (float) (0.5f * Math.PI); @@ -218,16 +221,13 @@ public class ModelSpellParadigmBlock extends ModelBase Shape5.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWingedFireDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWingedFireDemon.java index 07164ffd..519dda3c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWingedFireDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWingedFireDemon.java @@ -5,9 +5,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelWingedFireDemon extends ModelBase -{ - //fields +public class ModelWingedFireDemon extends ModelBase { + // fields ModelRenderer leftLegPlate; ModelRenderer leftLeg; ModelRenderer codPiece; @@ -26,8 +25,7 @@ public class ModelWingedFireDemon extends ModelBase ModelRenderer leftHorn2; ModelRenderer rightHorn2; - public ModelWingedFireDemon() - { + public ModelWingedFireDemon() { textureWidth = 64; textureHeight = 64; leftLegPlate = new ModelRenderer(this, 40, 36); @@ -150,8 +148,7 @@ public class ModelWingedFireDemon extends ModelBase rightHorn2.mirror = false; } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); leftLegPlate.render(f5); @@ -173,15 +170,13 @@ public class ModelWingedFireDemon extends ModelBase rightHorn2.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.head.rotateAngleX = f4 / (180F / (float) Math.PI); this.head.rotateAngleY = f3 / (180F / (float) Math.PI); @@ -200,4 +195,4 @@ public class ModelWingedFireDemon extends ModelBase this.leftShoulder.rotateAngleX = this.leftArm.rotateAngleX; this.rightShoulder.rotateAngleX = this.rightArm.rotateAngleX; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWritingTable.java index 15dede34..96d28357 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/model/ModelWritingTable.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelWritingTable extends ModelBase -{ - //fields +public class ModelWritingTable extends ModelBase { + // fields ModelRenderer base; ModelRenderer support; ModelRenderer appendage1; @@ -21,8 +20,7 @@ public class ModelWritingTable extends ModelBase ModelRenderer input3; ModelRenderer Shape1; - public ModelWritingTable() - { + public ModelWritingTable() { textureWidth = 64; textureHeight = 64; base = new ModelRenderer(this, 0, 0); @@ -105,8 +103,7 @@ public class ModelWritingTable extends ModelBase setRotation(Shape1, 0F, 0F, 0F); } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); base.render(f5); @@ -124,15 +121,13 @@ public class ModelWritingTable extends ModelBase Shape1.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) - { + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBazookaMainProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBazookaMainProjectile.java index fce17323..8f2364be 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBazookaMainProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBazookaMainProjectile.java @@ -8,30 +8,32 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -public class RenderEnergyBazookaMainProjectile extends Render -{ +public class RenderEnergyBazookaMainProjectile extends Render { public ModelBase model = new ModelEnergyBazookaMainProjectile(); - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/EnergyBazookaMainProjectile.png"); + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/EnergyBazookaMainProjectile.png"); private float scale = 1.0f; @Override - public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) - { + public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { GL11.glPushMatrix(); GL11.glTranslatef((float) d0, (float) d1, (float) d2); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(scale, scale, scale); this.bindTexture(this.getEntityTexture(entity)); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f1, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0f - entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f1, 1.0F, 0.0F, 0.0f); + GL11.glRotatef( + 180.0f - entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f1, + 1.0F, + 0.0F, + 0.0f); model.render(entity, 0, (float) d0, (float) d1, (float) d2, f, f1); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + protected ResourceLocation getEntityTexture(Entity entity) { // TODO Auto-generated method stub return field_110833_a; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java index d0e067e1..ca4518fd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java @@ -12,10 +12,9 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) -public class RenderEnergyBlastProjectile extends Render -{ - public void doRenderEnergyBlastProjectile(Entity entityShot, double par2, double par4, double par6, float par8, float par9) - { +public class RenderEnergyBlastProjectile extends Render { + public void doRenderEnergyBlastProjectile( + Entity entityShot, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); @@ -36,54 +35,43 @@ public class RenderEnergyBlastProjectile extends Render } @Override - public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) - { - if (par1Entity instanceof IProjectile) - { + public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { + if (par1Entity instanceof IProjectile) { this.doRenderEnergyBlastProjectile(par1Entity, par2, par4, par6, par8, par9); } } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - if (entity instanceof IceProjectile) - { + protected ResourceLocation getEntityTexture(Entity entity) { + if (entity instanceof IceProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/iceProjectile.png"); } - if (entity instanceof FireProjectile) - { + if (entity instanceof FireProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/fireProjectile.png"); } - if (entity instanceof ExplosionProjectile) - { + if (entity instanceof ExplosionProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/explosionProjectile.png"); } - if (entity instanceof HolyProjectile) - { + if (entity instanceof HolyProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/holyProjectile.png"); } - if (entity instanceof WindGustProjectile) - { + if (entity instanceof WindGustProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/windGustProjectile.png"); } - if (entity instanceof LightningBoltProjectile) - { + if (entity instanceof LightningBoltProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/lightningProjectile.png"); } - if (entity instanceof WaterProjectile) - { + if (entity instanceof WaterProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/waterProjectile.png"); } - if (entity instanceof MudProjectile) - { + if (entity instanceof MudProjectile) { return new ResourceLocation("alchemicalwizardry", "textures/entities/mudProjectile.png"); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderFireProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderFireProjectile.java index cda739fe..0d314397 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderFireProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderFireProjectile.java @@ -4,38 +4,38 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RenderFireProjectile -{ -// public void doRenderProjectile(FireProjectile entityShot, double par2, double par4, double par6, float par8, float par9) -// { -// GL11.glPushMatrix(); -// GL11.glTranslatef((float)par2, (float)par4, (float)par6); -// GL11.glEnable(GL12.GL_RESCALE_NORMAL); -// GL11.glScalef(0.1F, 0.1F, 0.1F); -// this.func_110776_a(this.func_110775_a(entityShot)); -// Tessellator var12 = Tessellator.instance; -// GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F); -// GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F); -// var12.startDrawingQuads(); -// var12.setNormal(0.0F, 1.0F, 0.0F); -// var12.addVertexWithUV(-0.5F, -0.25F, 0.0D, 0, 1); -// var12.addVertexWithUV(0.5F, -0.25F, 0.0D, 1, 1); -// var12.addVertexWithUV(0.5F, 0.75F, 0.0D, 1, 0); -// var12.addVertexWithUV(-0.5F, 0.75F, 0.0D, 0, 0); -// var12.draw(); -// GL11.glDisable(GL12.GL_RESCALE_NORMAL); -// GL11.glPopMatrix(); -// } -// -// @Override -// public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) -// { -// this.doRenderProjectile((FireProjectile)par1Entity, par2, par4, par6, par8, par9); -// } -// -// @Override -// protected ResourceLocation func_110775_a(Entity entity) -// { -// return new ResourceLocation("alchemicalwizardry:/textures/entities/fireProjectile.png"); -// } +public class RenderFireProjectile { + // public void doRenderProjectile(FireProjectile entityShot, double par2, double par4, double par6, float par8, + // float par9) + // { + // GL11.glPushMatrix(); + // GL11.glTranslatef((float)par2, (float)par4, (float)par6); + // GL11.glEnable(GL12.GL_RESCALE_NORMAL); + // GL11.glScalef(0.1F, 0.1F, 0.1F); + // this.func_110776_a(this.func_110775_a(entityShot)); + // Tessellator var12 = Tessellator.instance; + // GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + // GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + // var12.startDrawingQuads(); + // var12.setNormal(0.0F, 1.0F, 0.0F); + // var12.addVertexWithUV(-0.5F, -0.25F, 0.0D, 0, 1); + // var12.addVertexWithUV(0.5F, -0.25F, 0.0D, 1, 1); + // var12.addVertexWithUV(0.5F, 0.75F, 0.0D, 1, 0); + // var12.addVertexWithUV(-0.5F, 0.75F, 0.0D, 0, 0); + // var12.draw(); + // GL11.glDisable(GL12.GL_RESCALE_NORMAL); + // GL11.glPopMatrix(); + // } + // + // @Override + // public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) + // { + // this.doRenderProjectile((FireProjectile)par1Entity, par2, par4, par6, par8, par9); + // } + // + // @Override + // protected ResourceLocation func_110775_a(Entity entity) + // { + // return new ResourceLocation("alchemicalwizardry:/textures/entities/fireProjectile.png"); + // } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderMeteor.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderMeteor.java index 95c6bd49..e5d221f4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderMeteor.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderMeteor.java @@ -8,30 +8,32 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -public class RenderMeteor extends Render -{ +public class RenderMeteor extends Render { public ModelBase model = new ModelMeteor(); - private static final ResourceLocation field_110833_a = new ResourceLocation("alchemicalwizardry", "textures/models/Meteor.png"); + private static final ResourceLocation field_110833_a = + new ResourceLocation("alchemicalwizardry", "textures/models/Meteor.png"); private float scale = 1.0f; @Override - public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) - { + public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { GL11.glPushMatrix(); GL11.glTranslatef((float) d0, (float) d1, (float) d2); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(scale, scale, scale); this.bindTexture(this.getEntityTexture(entity)); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f1, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0f - entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f1, 1.0F, 0.0F, 0.0f); + GL11.glRotatef( + 180.0f - entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f1, + 1.0F, + 0.0F, + 0.0f); model.render(entity, 0, (float) d0, (float) d1, (float) d2, f, f1); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + protected ResourceLocation getEntityTexture(Entity entity) { return field_110833_a; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/LocalStorageAlphaPact.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/LocalStorageAlphaPact.java index 2c762aa9..7dd6aff1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/LocalStorageAlphaPact.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/LocalStorageAlphaPact.java @@ -1,25 +1,20 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.HashSet; -import java.util.Set; - import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon; +import java.util.HashSet; +import java.util.Set; -public class LocalStorageAlphaPact extends LocalRitualStorage -{ +public class LocalStorageAlphaPact extends LocalRitualStorage { public static Set hoardList = new HashSet(); - - public void thrallDemon(IHoardDemon demon) - { - if(demon instanceof IHoardDemon) - { - boolean enthrall = ((IHoardDemon) demon).thrallDemon(new Int3(this.xCoord, this.yCoord, this.zCoord)); - if(enthrall) - { - this.hoardList.add((IHoardDemon)demon); - } - } - } + + public void thrallDemon(IHoardDemon demon) { + if (demon instanceof IHoardDemon) { + boolean enthrall = ((IHoardDemon) demon).thrallDemon(new Int3(this.xCoord, this.yCoord, this.zCoord)); + if (enthrall) { + this.hoardList.add((IHoardDemon) demon); + } + } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAlphaPact.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAlphaPact.java index 4ce93209..855c2f65 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAlphaPact.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAlphaPact.java @@ -1,13 +1,5 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; @@ -15,14 +7,19 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class RitualEffectAlphaPact extends RitualEffect { + Random rand = new Random(); -public class RitualEffectAlphaPact extends RitualEffect -{ - Random rand = new Random(); - @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -31,125 +28,110 @@ public class RitualEffectAlphaPact extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (world.getWorldTime() % 20 != 0) - { + if (world.getWorldTime() % 20 != 0) { return; } - + LocalRitualStorage stor = ritualStone.getLocalStorage(); - if(stor instanceof LocalStorageAlphaPact) - { - LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor; - - Object[] demonList = storage.hoardList.toArray(); - - for(Object demon : demonList) - { - if(demon instanceof EntityLivingBase) - { - if(!((EntityLivingBase) demon).isEntityAlive()) - { - System.out.println(storage.hoardList.remove(demon)); - } - } - } - + if (stor instanceof LocalStorageAlphaPact) { + LocalStorageAlphaPact storage = (LocalStorageAlphaPact) stor; + + Object[] demonList = storage.hoardList.toArray(); + + for (Object demon : demonList) { + if (demon instanceof EntityLivingBase) { + if (!((EntityLivingBase) demon).isEntityAlive()) { + System.out.println(storage.hoardList.remove(demon)); + } + } + } + System.out.println("Hi!"); - int summons = 0; - - int horizontalRange = 25; - int verticalRange = 20; - - if(storage.hoardList.isEmpty()) - { - IHoardDemon demon = this.getRandomDemonForStage(world, x, y, z, horizontalRange, verticalRange); - if(demon instanceof EntityLivingBase) - { - world.spawnEntityInWorld((EntityLivingBase)demon); - storage.thrallDemon(demon); - } - }else - { - } + int summons = 0; + + int horizontalRange = 25; + int verticalRange = 20; + + if (storage.hoardList.isEmpty()) { + IHoardDemon demon = this.getRandomDemonForStage(world, x, y, z, horizontalRange, verticalRange); + if (demon instanceof EntityLivingBase) { + world.spawnEntityInWorld((EntityLivingBase) demon); + storage.thrallDemon(demon); + } + } else { + } } } - - public IHoardDemon getRandomDemonForStage(World world, int x, int y, int z, int horizontalRange, int verticalRange) - { - EntityLivingBase entityLiving = new EntityMinorDemonGrunt(world); - - boolean isGood = false; - for(int n=0; n<100; n++) - { - double newX = x + (rand.nextInt(horizontalRange) - horizontalRange) + 0.5; + + public IHoardDemon getRandomDemonForStage( + World world, int x, int y, int z, int horizontalRange, int verticalRange) { + EntityLivingBase entityLiving = new EntityMinorDemonGrunt(world); + + boolean isGood = false; + for (int n = 0; n < 100; n++) { + double newX = x + (rand.nextInt(horizontalRange) - horizontalRange) + 0.5; double newY = y + (double) (rand.nextInt((int) verticalRange)); double newZ = z + (rand.nextInt(horizontalRange) - horizontalRange) + 0.5; - + entityLiving.posX = newX; entityLiving.posY = newY; entityLiving.posZ = newZ; - + int i = MathHelper.floor_double(entityLiving.posX); int j = MathHelper.floor_double(entityLiving.posY); int k = MathHelper.floor_double(entityLiving.posZ); Block l; - if (entityLiving.worldObj.blockExists(i, j, k)) - { - boolean flag1 = false; + if (entityLiving.worldObj.blockExists(i, j, k)) { + boolean flag1 = false; - while (!flag1 && j > 0) - { + while (!flag1 && j > 0) { l = entityLiving.worldObj.getBlock(i, j - 1, k); - if (l != null && l.getMaterial().blocksMovement()) - { + if (l != null && l.getMaterial().blocksMovement()) { flag1 = true; - } else - { + } else { --entityLiving.posY; --j; } } } - - if(entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) - { - entityLiving.setPositionAndUpdate(newX, newY, newZ); - isGood = true; - } - } - - if(isGood = false) - { - return null; - } - return (IHoardDemon)entityLiving; + if (entityLiving + .worldObj + .getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox) + .isEmpty() + && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) { + entityLiving.setPositionAndUpdate(newX, newY, newZ); + isGood = true; + } + } + + if (isGood = false) { + return null; + } + + return (IHoardDemon) entityLiving; } - - public int spawnMoreDemons(LocalStorageAlphaPact storage) - { - return 5; + + public int spawnMoreDemons(LocalStorageAlphaPact storage) { + return 5; } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 1; } - - public LocalRitualStorage getNewLocalStorage() - { - return new LocalStorageAlphaPact(); + + public LocalRitualStorage getNewLocalStorage() { + return new LocalStorageAlphaPact(); } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList omegaRitual = new ArrayList(); - + this.addCornerRunes(omegaRitual, 1, 0, RitualComponent.BLANK); this.addOffsetRunes(omegaRitual, 2, 1, 0, RitualComponent.FIRE); this.addParallelRunes(omegaRitual, 4, 0, RitualComponent.WATER); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAnimalGrowth.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAnimalGrowth.java index 63dc5064..4defa319 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAnimalGrowth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAnimalGrowth.java @@ -6,6 +6,8 @@ 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.List; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.inventory.IInventory; @@ -14,18 +16,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectAnimalGrowth extends RitualEffect -{ +public class RitualEffectAnimalGrowth extends RitualEffect { public static final int breedingCost = 50; public static final int reductusDrain = 1; public static final int virtusDrain = 10; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -34,37 +31,34 @@ public class RitualEffectAnimalGrowth extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (world.getWorldTime() % 20 != 0) - { + if (world.getWorldTime() % 20 != 0) { return; } double range = 2; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)).expand(range, 0, range); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + (double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)) + .expand(range, 0, range); List list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb); int entityCount = 0; boolean flag = false; - if (currentEssence < this.getCostPerRefresh() * list.size()) - { + if (currentEssence < this.getCostPerRefresh() * list.size()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + } else { + boolean hasReductus = + this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - for (EntityAgeable entity : list) - { - if (entity.getGrowingAge() < 0) - { + for (EntityAgeable entity : list) { + if (entity.getGrowingAge() < 0) { entity.addGrowth(5); entityCount++; - } else - { - hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - if (hasReductus && entity instanceof EntityAnimal && entity.getGrowingAge() > 0) - { + } else { + hasReductus = hasReductus + && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + if (hasReductus && entity instanceof EntityAnimal && entity.getGrowingAge() > 0) { EntityAnimal animal = (EntityAnimal) entity; entity.setGrowingAge(Math.max(0, animal.getGrowingAge() - 20 * 2)); this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); @@ -78,41 +72,33 @@ public class RitualEffectAnimalGrowth extends RitualEffect boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); - if (hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost)) - { + if (hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost)) { List animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axisalignedbb); TileEntity tile = world.getTileEntity(x, y + 1, z); IInventory inventory = null; - if (tile instanceof IInventory) - { + if (tile instanceof IInventory) { inventory = (IInventory) tile; - } else - { + } else { tile = world.getTileEntity(x, y - 1, z); - if (tile instanceof IInventory) - { + if (tile instanceof IInventory) { inventory = (IInventory) tile; } } - if (inventory != null) - { - for (EntityAnimal entityAnimal : animalList) - { - if (entityAnimal.isInLove() || entityAnimal.isChild() || entityAnimal.getGrowingAge() > 0) - { + if (inventory != null) { + for (EntityAnimal entityAnimal : animalList) { + if (entityAnimal.isInLove() || entityAnimal.isChild() || entityAnimal.getGrowingAge() > 0) { continue; } - hasVirtus = hasVirtus && this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); + hasVirtus = hasVirtus + && this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); boolean hasLP = SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost); - for (int i = 0; i < inventory.getSizeInventory(); i++) - { + for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack stack = inventory.getStackInSlot(i); - if (stack != null && entityAnimal.isBreedingItem(stack)) - { + if (stack != null && entityAnimal.isBreedingItem(stack)) { inventory.decrStackSize(i, 1); entityAnimal.func_146082_f(null); this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); @@ -126,14 +112,12 @@ public class RitualEffectAnimalGrowth extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostAnimalGrowth[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList animalGrowthRitual = new ArrayList(); animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.DUSK)); animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.DUSK)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectApiaryOverclock.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectApiaryOverclock.java index f222840d..88aaf1af 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectApiaryOverclock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectApiaryOverclock.java @@ -5,26 +5,22 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; 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 RitualEffectApiaryOverclock extends RitualEffect -{ +public class RitualEffectApiaryOverclock 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); } @@ -35,13 +31,10 @@ public class RitualEffectApiaryOverclock extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner == null) - { + if (entityOwner == null) { return; } @@ -50,14 +43,12 @@ public class RitualEffectApiaryOverclock extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return 10; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList apiaryRitual = new ArrayList(); apiaryRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK)); apiaryRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java index 1cd9fca6..5bcc4ad1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java @@ -1,16 +1,6 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.oredict.OreDictionary; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; @@ -19,16 +9,23 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.oredict.OreDictionary; -public class RitualEffectAutoAlchemy extends RitualEffect -{ +public class RitualEffectAutoAlchemy extends RitualEffect { public static final boolean fillToOne = true; public static final int potentiaDrain = 2; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -37,31 +34,27 @@ public class RitualEffectAutoAlchemy extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh() * 6) - { + if (currentEssence < this.getCostPerRefresh() * 6) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); + } else { + boolean hasPotentia = + this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); int flag = 0; TileEntity topEntity = world.getTileEntity(x, y + 1, z); - if (!(topEntity instanceof IBloodAltar) || !(topEntity instanceof IBloodAltar)) - { + if (!(topEntity instanceof IBloodAltar) || !(topEntity instanceof IBloodAltar)) { return; } IBloodAltar altar = (IBloodAltar) topEntity; - ItemStack targetStack = ((IInventory)altar).getStackInSlot(0); - if (targetStack == null) - { + ItemStack targetStack = ((IInventory) altar).getStackInSlot(0); + if (targetStack == null) { return; } ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(targetStack); - if (recipe != null) - { + if (recipe != null) { TEWritingTable alchemyEntity; IInventory outputInv = null; IInventory inputInv1 = null; @@ -72,113 +65,87 @@ public class RitualEffectAutoAlchemy extends RitualEffect TileEntity eastEntity = world.getTileEntity(x + 1, y, z); TileEntity westEntity = world.getTileEntity(x - 1, y, z); - if (northEntity instanceof TEWritingTable) - { + if (northEntity instanceof TEWritingTable) { alchemyEntity = (TEWritingTable) northEntity; - if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) - { + if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) { outputInv = (IInventory) southEntity; } - if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) - { + if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) { inputInv1 = (IInventory) eastEntity; } - if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) - { + if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) { inputInv2 = (IInventory) westEntity; } - } else if (southEntity instanceof TEWritingTable) - { + } else if (southEntity instanceof TEWritingTable) { alchemyEntity = (TEWritingTable) southEntity; - if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) - { + if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) { outputInv = (IInventory) northEntity; } - if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) - { + if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) { inputInv1 = (IInventory) eastEntity; } - if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) - { + if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) { inputInv2 = (IInventory) westEntity; } - } else if (eastEntity instanceof TEWritingTable) - { + } else if (eastEntity instanceof TEWritingTable) { alchemyEntity = (TEWritingTable) eastEntity; - if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) - { + if (westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) { outputInv = (IInventory) westEntity; } - if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) - { + if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) { inputInv1 = (IInventory) northEntity; } - if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) - { + if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) { inputInv2 = (IInventory) southEntity; } - } else if (westEntity instanceof TEWritingTable) - { + } else if (westEntity instanceof TEWritingTable) { alchemyEntity = (TEWritingTable) westEntity; - if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) - { + if (eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) { outputInv = (IInventory) eastEntity; } - if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) - { + if (northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) { inputInv1 = (IInventory) northEntity; } - if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) - { + if (southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) { inputInv2 = (IInventory) southEntity; } - } else - { + } else { return; } - if (alchemyEntity != null && hasPotentia) - { + if (alchemyEntity != null && hasPotentia) { alchemyEntity.setAccelerationTime(5); - if (alchemyEntity.isWorking()) - { + if (alchemyEntity.isWorking()) { this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } } - if (outputInv != null) - { + if (outputInv != null) { ItemStack outputStack = alchemyEntity.getStackInSlot(6); - if (outputStack != null) - { - for (int i = 0; i < outputInv.getSizeInventory(); i++) - { + if (outputStack != null) { + for (int i = 0; i < outputInv.getSizeInventory(); i++) { ItemStack curStack = outputInv.getStackInSlot(i); - if (curStack == null) - { + if (curStack == null) { ItemStack copyStack = outputStack.copy(); copyStack.stackSize = 1; outputStack.stackSize--; - if (outputStack.stackSize <= 0) - { + if (outputStack.stackSize <= 0) { alchemyEntity.setInventorySlotContents(6, null); - } else - { + } else { alchemyEntity.setInventorySlotContents(6, outputStack); } outputInv.setInventorySlotContents(i, copyStack); flag++; break; - } else if (curStack.isItemEqual(outputStack) && curStack.stackSize < curStack.getMaxStackSize() && ItemStack.areItemStackTagsEqual(outputStack, curStack)) - { + } else if (curStack.isItemEqual(outputStack) + && curStack.stackSize < curStack.getMaxStackSize() + && ItemStack.areItemStackTagsEqual(outputStack, curStack)) { outputStack.stackSize--; - if (outputStack.stackSize <= 0) - { + if (outputStack.stackSize <= 0) { alchemyEntity.setInventorySlotContents(6, null); - } else - { + } else { alchemyEntity.setInventorySlotContents(6, outputStack); } @@ -190,48 +157,40 @@ public class RitualEffectAutoAlchemy extends RitualEffect } } - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { ItemStack recItem; - if (recipe.length <= i) - { + if (recipe.length <= i) { recItem = null; - } else - { + } else { recItem = recipe[i]; } ItemStack alchStack = alchemyEntity.getStackInSlot(i + 1); - if ((recItem == null && alchStack != null) || (alchStack != null && !(areItemStacksEqualWithWildcard(recItem, alchStack)))) - { - for (int j = 0; j < outputInv.getSizeInventory(); j++) - { + if ((recItem == null && alchStack != null) + || (alchStack != null && !(areItemStacksEqualWithWildcard(recItem, alchStack)))) { + for (int j = 0; j < outputInv.getSizeInventory(); j++) { ItemStack curStack = outputInv.getStackInSlot(j); - if (curStack == null) - { + if (curStack == null) { ItemStack copyStack = alchStack.copy(); copyStack.stackSize = 1; alchStack.stackSize--; - if (alchStack.stackSize <= 0) - { + if (alchStack.stackSize <= 0) { alchemyEntity.setInventorySlotContents(i + 1, null); - } else - { + } else { alchemyEntity.setInventorySlotContents(i + 1, alchStack); } outputInv.setInventorySlotContents(j, copyStack); flag++; break; - } else if (curStack.isItemEqual(alchStack) && curStack.stackSize < curStack.getMaxStackSize() && ItemStack.areItemStackTagsEqual(alchStack, curStack)) - { + } else if (curStack.isItemEqual(alchStack) + && curStack.stackSize < curStack.getMaxStackSize() + && ItemStack.areItemStackTagsEqual(alchStack, curStack)) { alchStack.stackSize--; - if (alchStack.stackSize <= 0) - { + if (alchStack.stackSize <= 0) { alchemyEntity.setInventorySlotContents(i + 1, null); - } else - { + } else { alchemyEntity.setInventorySlotContents(i + 1, alchStack); } @@ -244,71 +203,60 @@ public class RitualEffectAutoAlchemy extends RitualEffect continue; } } - } - if (world.getWorldTime() % 10 == 0) - { - if (flag == 0 && inputInv1 != null) - { - for (int i = 0; i < recipe.length; i++) - { + if (world.getWorldTime() % 10 == 0) { + if (flag == 0 && inputInv1 != null) { + for (int i = 0; i < recipe.length; i++) { ItemStack recItem = recipe[i]; - if (recItem == null) - { + if (recItem == null) { continue; } ItemStack alchStack = alchemyEntity.getStackInSlot(i + 1); - if (alchStack != null && ((!areItemStacksEqualWithWildcard(recItem, alchStack)) || alchStack.stackSize >= (fillToOne ? 1 : alchStack.getMaxStackSize()))) - { + if (alchStack != null + && ((!areItemStacksEqualWithWildcard(recItem, alchStack)) + || alchStack.stackSize >= (fillToOne ? 1 : alchStack.getMaxStackSize()))) { continue; } - for (int j = 0; j < inputInv1.getSizeInventory(); j++) - { + for (int j = 0; j < inputInv1.getSizeInventory(); j++) { ItemStack curItem = inputInv1.getStackInSlot(j); - if (curItem == null) - { + if (curItem == null) { continue; } - - if(!inputInv1.isItemValidForSlot(j, curItem) || (inputInv1 instanceof ISidedInventory && !((ISidedInventory) inputInv1).canExtractItem(j, curItem, ForgeDirection.DOWN.ordinal()))) - { - continue; - } - - if (areItemStacksEqualWithWildcard(recItem, curItem)) - { - if (alchStack == null) - { + + if (!inputInv1.isItemValidForSlot(j, curItem) + || (inputInv1 instanceof ISidedInventory + && !((ISidedInventory) inputInv1) + .canExtractItem(j, curItem, ForgeDirection.DOWN.ordinal()))) { + continue; + } + + if (areItemStacksEqualWithWildcard(recItem, curItem)) { + if (alchStack == null) { ItemStack copyStack = recItem.copy(); copyStack.stackSize = 1; alchemyEntity.setInventorySlotContents(i + 1, copyStack); curItem.stackSize--; - if (curItem.stackSize <= 0) - { + if (curItem.stackSize <= 0) { inputInv1.setInventorySlotContents(j, null); - } else - { + } else { inputInv1.setInventorySlotContents(j, curItem); } flag++; break; - } else - { + } else { alchStack.stackSize++; alchemyEntity.setInventorySlotContents(i + 1, alchStack); curItem.stackSize--; - if (curItem.stackSize <= 0) - { + if (curItem.stackSize <= 0) { inputInv1.setInventorySlotContents(j, null); - } else - { + } else { inputInv1.setInventorySlotContents(j, curItem); } @@ -319,59 +267,48 @@ public class RitualEffectAutoAlchemy extends RitualEffect } } } - if (flag == 0 && inputInv2 != null) - { - for (int i = 0; i < recipe.length; i++) - { + if (flag == 0 && inputInv2 != null) { + for (int i = 0; i < recipe.length; i++) { ItemStack recItem = recipe[i]; - if (recItem == null) - { + if (recItem == null) { continue; } ItemStack alchStack = alchemyEntity.getStackInSlot(i + 1); - if (alchStack != null && ((!areItemStacksEqualWithWildcard(recItem, alchStack)) || alchStack.stackSize >= (fillToOne ? 1 : alchStack.getMaxStackSize()))) - { + if (alchStack != null + && ((!areItemStacksEqualWithWildcard(recItem, alchStack)) + || alchStack.stackSize >= (fillToOne ? 1 : alchStack.getMaxStackSize()))) { continue; } - for (int j = 0; j < inputInv2.getSizeInventory(); j++) - { + for (int j = 0; j < inputInv2.getSizeInventory(); j++) { ItemStack curItem = inputInv2.getStackInSlot(j); - if (curItem == null) - { + if (curItem == null) { continue; } - if (areItemStacksEqualWithWildcard(recItem, curItem)) - { - if (alchStack == null) - { + if (areItemStacksEqualWithWildcard(recItem, curItem)) { + if (alchStack == null) { ItemStack copyStack = recItem.copy(); copyStack.stackSize = 1; alchemyEntity.setInventorySlotContents(i + 1, copyStack); curItem.stackSize--; - if (curItem.stackSize <= 0) - { + if (curItem.stackSize <= 0) { inputInv2.setInventorySlotContents(j, null); - } else - { + } else { inputInv2.setInventorySlotContents(j, curItem); } flag++; break; - } else - { + } else { alchStack.stackSize++; alchemyEntity.setInventorySlotContents(i + 1, alchStack); curItem.stackSize--; - if (curItem.stackSize <= 0) - { + if (curItem.stackSize <= 0) { inputInv2.setInventorySlotContents(j, null); - } else - { + } else { inputInv2.setInventorySlotContents(j, curItem); } @@ -385,8 +322,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect } } - if (flag > 0) - { + if (flag > 0) { world.markBlockForUpdate(x, y, z + 1); world.markBlockForUpdate(x, y, z - 1); world.markBlockForUpdate(x + 1, y, z); @@ -397,14 +333,12 @@ public class RitualEffectAutoAlchemy extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostBalladOfAlchemy[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList autoAlchemyRitual = new ArrayList(); autoAlchemyRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK)); autoAlchemyRitual.add(new RitualComponent(1, 0, -1, RitualComponent.DUSK)); @@ -425,8 +359,9 @@ public class RitualEffectAutoAlchemy extends RitualEffect return autoAlchemyRitual; } - public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack) - { - return recipeStack.isItemEqual(comparedStack) || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && recipeStack.getItem() == comparedStack.getItem()); + public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack) { + return recipeStack.isItemEqual(comparedStack) + || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE + && recipeStack.getItem() == comparedStack.getItem()); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBinding.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBinding.java index 3fd78b13..8d93de8e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBinding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBinding.java @@ -7,6 +7,9 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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.entity.player.EntityPlayer; @@ -16,15 +19,9 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class RitualEffectBinding extends RitualEffect -{ +public class RitualEffectBinding extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -33,67 +30,58 @@ public class RitualEffectBinding extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner == null) - { + if (entityOwner == null) { return; } entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); - } 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 (BindingRegistry.isRequiredItemValid(itemStack)) - { + if (BindingRegistry.isRequiredItemValid(itemStack)) { ritualStone.setVar1(BindingRegistry.getIndexForItem(itemStack) + 1); itemStack.stackSize--; world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z)); ritualStone.setCooldown(ritualStone.getCooldown() - 1); - if(itemStack.stackSize <= 0) - { + if (itemStack.stackSize <= 0) { item.setDead(); } 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); } } SoulNetworkHandler.syphonFromNetwork(owner, getCostPerRefresh()); - } else - { + } else { ritualStone.setCooldown(ritualStone.getCooldown() - 1); - if (world.rand.nextInt(20) == 0) - { + if (world.rand.nextInt(20) == 0) { int lightningPoint = world.rand.nextInt(8); - switch (lightningPoint) - { + switch (lightningPoint) { case 0: world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 3, z)); break; @@ -128,13 +116,11 @@ public class RitualEffectBinding extends RitualEffect } } - if (ritualStone.getCooldown() <= 0) - { + if (ritualStone.getCooldown() <= 0) { ItemStack spawnedItem = BindingRegistry.getOutputForIndex(ritualStone.getVar1() - 1); - if (spawnedItem != null) - { + if (spawnedItem != null) { EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, spawnedItem.copy()); world.spawnEntityInWorld(newItem); } @@ -146,20 +132,17 @@ public class RitualEffectBinding extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostBinding[1]; } @Override - public int getInitialCooldown() - { + public int getInitialCooldown() { return 200; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList boundSoulRitual = new ArrayList(); boundSoulRitual.add(new RitualComponent(3, 0, 0, 2)); boundSoulRitual.add(new RitualComponent(-3, 0, 0, 2)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java index 1e90cf21..7ff4ba60 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java @@ -8,6 +8,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; @@ -23,14 +25,9 @@ import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectBiomeChanger extends RitualEffect -{ +public class RitualEffectBiomeChanger extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int cooldown = ritualStone.getCooldown(); @@ -38,13 +35,12 @@ public class RitualEffectBiomeChanger extends RitualEffect int x = ritualStone.getXCoord(); int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (cooldown > 0) - { + if (cooldown > 0) { ritualStone.setCooldown(cooldown - 1); - if (world.rand.nextInt(15) == 0) - { - world.addWeatherEffect(new EntityLightningBolt(world, x - 1 + world.rand.nextInt(3), y + 1, z - 1 + world.rand.nextInt(3))); + if (world.rand.nextInt(15) == 0) { + world.addWeatherEffect(new EntityLightningBolt( + world, x - 1 + world.rand.nextInt(3), y + 1, z - 1 + world.rand.nextInt(3))); } return; @@ -52,27 +48,21 @@ public class RitualEffectBiomeChanger extends RitualEffect int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); - int range = 10; - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner == null) - { + if (entityOwner == null) { return; } entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); - } else - { + } else { boolean[][] boolList = new boolean[range * 2 + 1][range * 2 + 1]; - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { boolList[i][j] = false; } } @@ -80,55 +70,47 @@ public class RitualEffectBiomeChanger extends RitualEffect boolList[range][range] = true; boolean isReady = false; - while (!isReady) - { + while (!isReady) { isReady = true; - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - if (boolList[i][j]) - { - if (i - 1 >= 0 && !boolList[i - 1][j]) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + if (boolList[i][j]) { + if (i - 1 >= 0 && !boolList[i - 1][j]) { Block block = world.getBlock(x - range + i - 1, y + 1, z - range + j); - if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block)) - { + if (!ModBlocks.largeBloodStoneBrick.equals(block) + && !ModBlocks.bloodStoneBrick.equals(block)) { boolList[i - 1][j] = true; isReady = false; } } - if (j - 1 >= 0 && !boolList[i][j - 1]) - { + if (j - 1 >= 0 && !boolList[i][j - 1]) { Block block = world.getBlock(x - range + i, y + 1, z - range + j - 1); - if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block)) - { + if (!ModBlocks.largeBloodStoneBrick.equals(block) + && !ModBlocks.bloodStoneBrick.equals(block)) { boolList[i][j - 1] = true; isReady = false; } } - if (i + 1 <= 2 * range && !boolList[i + 1][j]) - { + if (i + 1 <= 2 * range && !boolList[i + 1][j]) { Block block = world.getBlock(x - range + i + 1, y + 1, z - range + j); - if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block)) - { + if (!ModBlocks.largeBloodStoneBrick.equals(block) + && !ModBlocks.bloodStoneBrick.equals(block)) { boolList[i + 1][j] = true; isReady = false; } } - if (j + 1 <= 2 * range && !boolList[i][j + 1]) - { + if (j + 1 <= 2 * range && !boolList[i][j + 1]) { Block block = world.getBlock(x - range + i, y + 1, z - range + j + 1); - if (!ModBlocks.largeBloodStoneBrick.equals(block) && !ModBlocks.bloodStoneBrick.equals(block)) - { + if (!ModBlocks.largeBloodStoneBrick.equals(block) + && !ModBlocks.bloodStoneBrick.equals(block)) { boolList[i][j + 1] = true; isReady = false; } @@ -143,99 +125,77 @@ public class RitualEffectBiomeChanger extends RitualEffect float acceptableRange = 0.1f; int biomeSkip = 0; - for (int i = -1; i <= 1; i++) - { - for (int j = -1; j <= 1; j++) - { - if (i == 0 && j == 0) - { + for (int i = -1; i <= 1; i++) { + for (int j = -1; j <= 1; j++) { + if (i == 0 && j == 0) { continue; } boolean isItemConsumed = false; TileEntity tileEntity = world.getTileEntity(x + i, y, z + j); - if (!(tileEntity instanceof TEPlinth)) - { + if (!(tileEntity instanceof TEPlinth)) { continue; } TEPlinth tilePlinth = (TEPlinth) tileEntity; ItemStack itemStack = tilePlinth.getStackInSlot(0); - if (itemStack != null) - { + if (itemStack != null) { Item itemTest = itemStack.getItem(); - if (itemTest != null) - { - if (itemTest instanceof ItemBlock) - { + if (itemTest != null) { + if (itemTest instanceof ItemBlock) { Block item = ((ItemBlock) itemTest).field_150939_a; - if (item == (Blocks.sand)) - { + if (item == (Blocks.sand)) { humidity -= 0.1f; isItemConsumed = true; - } else if (item == (Blocks.lapis_block)) - { + } else if (item == (Blocks.lapis_block)) { humidity += 0.4f; isItemConsumed = true; - } else if (item == (Blocks.sand)) - { + } else if (item == (Blocks.sand)) { humidity -= 0.1f; isItemConsumed = true; - } else if (item == (Blocks.sandstone)) - { + } else if (item == (Blocks.sandstone)) { humidity -= 0.2f; isItemConsumed = true; - } else if (item == (Blocks.netherrack)) - { + } else if (item == (Blocks.netherrack)) { humidity -= 0.4f; isItemConsumed = true; - } else if (item == (Blocks.coal_block)) - { + } else if (item == (Blocks.coal_block)) { temperature += 0.2f; isItemConsumed = true; - } else if (item == (Blocks.ice)) - { + } else if (item == (Blocks.ice)) { temperature -= 0.4f; isItemConsumed = true; - } else if (item == (Blocks.snow)) - { + } else if (item == (Blocks.snow)) { temperature -= 0.2f; isItemConsumed = true; - } else if (item == (Blocks.wool)) - { + } else if (item == (Blocks.wool)) { int skip = itemStack.getItemDamage() + 1; biomeSkip += skip; isItemConsumed = true; } - } else if (itemTest.equals(Items.dye) && itemStack.getItemDamage() == 4) - { + } else if (itemTest.equals(Items.dye) && itemStack.getItemDamage() == 4) { humidity += 0.1f; isItemConsumed = true; - } else if (itemTest.equals(Items.lava_bucket)) - { + } else if (itemTest.equals(Items.lava_bucket)) { temperature += 0.4f; isItemConsumed = true; - } else if (itemTest.equals(Items.water_bucket)) - { + } else if (itemTest.equals(Items.water_bucket)) { humidity += 0.2f; isItemConsumed = true; - } else if (itemTest.equals(Items.coal)) - { + } else if (itemTest.equals(Items.coal)) { temperature += 0.1f; isItemConsumed = true; - } else if (itemTest.equals(Items.snowball)) - { + } else if (itemTest.equals(Items.snowball)) { temperature -= 0.1f; isItemConsumed = true; } } } - if (isItemConsumed) - { + if (isItemConsumed) { tilePlinth.setInventorySlotContents(0, null); world.markBlockForUpdate(x + i, y, z + j); world.addWeatherEffect(new EntityLightningBolt(world, x + i, y + 1, z + j)); @@ -249,10 +209,8 @@ public class RitualEffectBiomeChanger extends RitualEffect BiomeGenBase[] biomeList = BiomeGenBase.getBiomeGenArray(); int iteration = 0; - for (BiomeGenBase biome : biomeList) - { - if (biome == null) - { + for (BiomeGenBase biome : biomeList) { + if (biome == null) { continue; } @@ -261,45 +219,36 @@ public class RitualEffectBiomeChanger extends RitualEffect temperature = Math.min(2.0f, Math.max(0.0f, temperature)); humidity = Math.min(2.0f, Math.max(0.0f, humidity)); - if (Math.abs(rainfall - humidity) < acceptableRange && Math.abs(temperature - temp) < acceptableRange) - { + if (Math.abs(rainfall - humidity) < acceptableRange && Math.abs(temperature - temp) < acceptableRange) { biomeID = iteration; - if (biomeSkip == 0) - { + if (biomeSkip == 0) { break; - } else - { + } else { biomeSkip--; } } iteration++; } - + // Default to Plains if too much biome skip is used - if (biomeSkip != 0) - { + if (biomeSkip != 0) { biomeID = 1; } - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - if (boolList[i][j]) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + if (boolList[i][j]) { Chunk chunk = world.getChunkFromBlockCoords(x - range + i, z - range + j); byte[] byteArray = chunk.getBiomeArray(); int moduX = (x - range + i) % 16; int moduZ = (z - range + j) % 16; - if (moduX < 0) - { + if (moduX < 0) { moduX = moduX + 16; } - if (moduZ < 0) - { + if (moduZ < 0) { moduZ = moduZ + 16; } @@ -315,20 +264,17 @@ public class RitualEffectBiomeChanger extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostGaia[1]; } @Override - public int getInitialCooldown() - { + public int getInitialCooldown() { return 200; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList biomeChangerRitual = new ArrayList(); biomeChangerRitual.add(new RitualComponent(1, 0, -2, RitualComponent.AIR)); biomeChangerRitual.add(new RitualComponent(1, 0, -3, RitualComponent.AIR)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectContainment.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectContainment.java index 1002c436..2602c557 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectContainment.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectContainment.java @@ -8,6 +8,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import cpw.mods.fml.relauncher.ReflectionHelper; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityCreeper; @@ -15,16 +17,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectContainment extends RitualEffect -{ - public final String[] TIME_SINCE_IGNITED = new String[]{"timeSinceIgnited", "field_70833_d", "bq"}; +public class RitualEffectContainment extends RitualEffect { + public final String[] TIME_SINCE_IGNITED = new String[] {"timeSinceIgnited", "field_70833_d", "bq"}; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -33,33 +30,30 @@ public class RitualEffectContainment extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { final int crepitousDrain = 1; final int terraeDrain = 5; final int magicalesDrain = 10; boolean flag = false; - boolean hasCrepitous = this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false); + boolean hasCrepitous = + this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false); boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); - boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false); + boolean hasMagicales = + this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false); int d0 = hasTerrae ? 10 : 5; List entityList = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, d0, d0); - for (Entity entity : entityList) - { - if (!(entity instanceof EntityLivingBase)) - { + for (Entity entity : entityList) { + if (!(entity instanceof EntityLivingBase)) { continue; } EntityLivingBase livingEntity = (EntityLivingBase) entity; - if (livingEntity instanceof EntityPlayer) - { + if (livingEntity instanceof EntityPlayer) { continue; } @@ -73,42 +67,39 @@ public class RitualEffectContainment extends RitualEffect livingEntity.fallDistance = 0; - if (hasMagicales && this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false)) - { - if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)) - { - livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id, 100, 0)); + if (hasMagicales + && this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false)) { + if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)) { + livingEntity.addPotionEffect( + new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id, 100, 0)); this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true); } } - if (hasCrepitous && this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false)) - { - if (entity instanceof EntityCreeper) - { - ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, TIME_SINCE_IGNITED); + if (hasCrepitous + && this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false)) { + if (entity instanceof EntityCreeper) { + ReflectionHelper.setPrivateValue( + EntityCreeper.class, (EntityCreeper) entity, 2, TIME_SINCE_IGNITED); ((EntityCreeper) entity).setAttackTarget(null); this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, true); } } } - if (world.getWorldTime() % 2 == 0 && flag) - { + if (world.getWorldTime() % 2 == 0 && flag) { SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostContainment[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList containmentRitual = new ArrayList(); containmentRitual.add(new RitualComponent(1, 0, 0, 3)); containmentRitual.add(new RitualComponent(-1, 0, 0, 3)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java index dae5bad9..858dd128 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java @@ -1,12 +1,18 @@ package WayofTime.alchemicalWizardry.common.rituals; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.Int3; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; - -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; @@ -19,25 +25,16 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; -import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class RitualEffectCrafting extends RitualEffect -{ +public class RitualEffectCrafting extends RitualEffect { public static final boolean limitToSingleStack = true; public static final int potentiaDrain = 2; public static final int virtusDrain = 2; @Override - public void performEffect(IMasterRitualStone ritualStone) - { -// long startTime = System.nanoTime(); - + public void performEffect(IMasterRitualStone ritualStone) { + // long startTime = System.nanoTime(); + String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -47,350 +44,307 @@ public class RitualEffectCrafting extends RitualEffect int z = ritualStone.getZCoord(); boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); - - if(world.getWorldTime() % (hasPotentia ? 1 : 4) != 0) - { - return; - } - - if (currentEssence < this.getCostPerRefresh()) - { - SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - NBTTagCompound tag = ritualStone.getCustomRitualTag(); - if(tag == null) - { - ritualStone.setCustomRitualTag(new NBTTagCompound()); - tag = ritualStone.getCustomRitualTag(); - } - - boolean lastFailed = tag.getBoolean("didLastCraftFail"); - + if (world.getWorldTime() % (hasPotentia ? 1 : 4) != 0) { + return; + } + + if (currentEssence < this.getCostPerRefresh()) { + SoulNetworkHandler.causeNauseaToPlayer(owner); + } else { + NBTTagCompound tag = ritualStone.getCustomRitualTag(); + + if (tag == null) { + ritualStone.setCustomRitualTag(new NBTTagCompound()); + tag = ritualStone.getCustomRitualTag(); + } + + boolean lastFailed = tag.getBoolean("didLastCraftFail"); + int slotDesignation = tag.getInteger("slotDesignation"); - if(lastFailed) - { - slotDesignation++; - tag.setInteger("slotDesignation", slotDesignation); - tag.setBoolean("didLastCraftFail", false); + if (lastFailed) { + slotDesignation++; + tag.setInteger("slotDesignation", slotDesignation); + tag.setBoolean("didLastCraftFail", false); } int direction = ritualStone.getDirection(); - - boolean canContinue = false; - - ItemStack[] recipe = new ItemStack[9]; - InventoryCrafting inventory = new InventoryCrafting(new Container() - { - public boolean canInteractWith(EntityPlayer player) - { - return false; - } - }, 3, 3); - - for(int i=-1; i<=1; i++) - { - for(int j=-1; j<=1; j++) - { - int gridSpace = (i+1)*3 + (j+1); - Int3 pos = this.getSlotPositionForDirection(gridSpace, direction); - TileEntity inv = world.getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord); - if(inv instanceof IInventory) - { - if(((IInventory) inv).getSizeInventory() <= slotDesignation || !((IInventory) inv).isItemValidForSlot(slotDesignation, ((IInventory) inv).getStackInSlot(slotDesignation))) - { - continue; - }else - { - ItemStack invStack = ((IInventory) inv).getStackInSlot(slotDesignation); - if(invStack != null) - { - inventory.setInventorySlotContents(gridSpace, invStack); - recipe[gridSpace] = invStack; - canContinue = true; - } - } - } - } + boolean canContinue = false; + + ItemStack[] recipe = new ItemStack[9]; + InventoryCrafting inventory = new InventoryCrafting( + new Container() { + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 3, + 3); + + for (int i = -1; i <= 1; i++) { + for (int j = -1; j <= 1; j++) { + int gridSpace = (i + 1) * 3 + (j + 1); + + Int3 pos = this.getSlotPositionForDirection(gridSpace, direction); + TileEntity inv = world.getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord); + if (inv instanceof IInventory) { + if (((IInventory) inv).getSizeInventory() <= slotDesignation + || !((IInventory) inv) + .isItemValidForSlot( + slotDesignation, ((IInventory) inv).getStackInSlot(slotDesignation))) { + continue; + } else { + ItemStack invStack = ((IInventory) inv).getStackInSlot(slotDesignation); + if (invStack != null) { + inventory.setInventorySlotContents(gridSpace, invStack); + recipe[gridSpace] = invStack; + canContinue = true; + } + } + } + } } - - if(!canContinue) - { - tag.setInteger("slotDesignation", 0); - return; + + if (!canContinue) { + tag.setInteger("slotDesignation", 0); + return; } - + ItemStack returnStack = CraftingManager.getInstance().findMatchingRecipe(inventory, world); - - if (returnStack == null) - { - tag.setBoolean("didLastCraftFail", true); - }else - { - boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); - boolean addOutputToInputs = hasVirtus; + + if (returnStack == null) { + tag.setBoolean("didLastCraftFail", true); + } else { + boolean hasVirtus = + this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); + boolean addOutputToInputs = hasVirtus; IInventory outputInv = null; - + List invList = new ArrayList(); - TileEntity northEntity = world.getTileEntity(x, y-1, z - 2); - TileEntity southEntity = world.getTileEntity(x, y-1, z + 2); - TileEntity eastEntity = world.getTileEntity(x + 2, y-1, z); - TileEntity westEntity = world.getTileEntity(x - 2, y-1, z); - - switch(direction) - { - case 1: - if(southEntity instanceof IInventory) - { - outputInv = (IInventory)southEntity; - }else - { - return; - } + TileEntity northEntity = world.getTileEntity(x, y - 1, z - 2); + TileEntity southEntity = world.getTileEntity(x, y - 1, z + 2); + TileEntity eastEntity = world.getTileEntity(x + 2, y - 1, z); + TileEntity westEntity = world.getTileEntity(x - 2, y - 1, z); - if(northEntity instanceof IInventory) - { - invList.add((IInventory)northEntity); - } - if(eastEntity instanceof IInventory) - { - invList.add((IInventory)eastEntity); - } - if(westEntity instanceof IInventory) - { - invList.add((IInventory)westEntity); - } - - break; - - case 2: - if(westEntity instanceof IInventory) - { - outputInv = (IInventory)westEntity; - }else - { - return; - } + switch (direction) { + case 1: + if (southEntity instanceof IInventory) { + outputInv = (IInventory) southEntity; + } else { + return; + } - if(northEntity instanceof IInventory) - { - invList.add((IInventory)northEntity); - } - if(eastEntity instanceof IInventory) - { - invList.add((IInventory)eastEntity); - } - if(southEntity instanceof IInventory) - { - invList.add((IInventory)southEntity); - } - - break; - - case 3: - if(northEntity instanceof IInventory) - { - outputInv = (IInventory)northEntity; - }else - { - return; - } + if (northEntity instanceof IInventory) { + invList.add((IInventory) northEntity); + } + if (eastEntity instanceof IInventory) { + invList.add((IInventory) eastEntity); + } + if (westEntity instanceof IInventory) { + invList.add((IInventory) westEntity); + } - if(eastEntity instanceof IInventory) - { - invList.add((IInventory)eastEntity); - } - if(southEntity instanceof IInventory) - { - invList.add((IInventory)southEntity); - } - if(westEntity instanceof IInventory) - { - invList.add((IInventory)westEntity); - } - - break; - - case 4: - if(eastEntity instanceof IInventory) - { - outputInv = (IInventory)eastEntity; - }else - { - return; - } + break; - if(northEntity instanceof IInventory) - { - invList.add((IInventory)northEntity); - } - if(southEntity instanceof IInventory) - { - invList.add((IInventory)southEntity); - } - if(westEntity instanceof IInventory) - { - invList.add((IInventory)westEntity); - } - - break; + case 2: + if (westEntity instanceof IInventory) { + outputInv = (IInventory) westEntity; + } else { + return; + } + + if (northEntity instanceof IInventory) { + invList.add((IInventory) northEntity); + } + if (eastEntity instanceof IInventory) { + invList.add((IInventory) eastEntity); + } + if (southEntity instanceof IInventory) { + invList.add((IInventory) southEntity); + } + + break; + + case 3: + if (northEntity instanceof IInventory) { + outputInv = (IInventory) northEntity; + } else { + return; + } + + if (eastEntity instanceof IInventory) { + invList.add((IInventory) eastEntity); + } + if (southEntity instanceof IInventory) { + invList.add((IInventory) southEntity); + } + if (westEntity instanceof IInventory) { + invList.add((IInventory) westEntity); + } + + break; + + case 4: + if (eastEntity instanceof IInventory) { + outputInv = (IInventory) eastEntity; + } else { + return; + } + + if (northEntity instanceof IInventory) { + invList.add((IInventory) northEntity); + } + if (southEntity instanceof IInventory) { + invList.add((IInventory) southEntity); + } + if (westEntity instanceof IInventory) { + invList.add((IInventory) westEntity); + } + + break; } - if (outputInv != null) - { - if(!(!limitToSingleStack ? SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN) : SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN, true, returnStack.getMaxStackSize()))) - { - tag.setBoolean("didLastCraftFail", true); - return; - } - - if(addOutputToInputs) - { - invList.add(outputInv); - } - - Map> syphonMap = new HashMap(); //Inventory, Slot, how much claimed - - for(int n = 0; n < recipe.length; n++) //Look for the correct items - { - ItemStack recipeStack = recipe[n]; - if(recipeStack == null) - { - continue; - } - - boolean isItemTaken = false; - - for(int i = 0; i < invList.size(); i++) - { - if(isItemTaken) - { - break; - } - IInventory inputInv = invList.get(i); - if(inputInv == null) - { - continue; - } - - for(int j = 0; j < inputInv.getSizeInventory(); j++) - { - if(!inputInv.isItemValidForSlot(j, recipeStack)) - { - continue; - } - - ItemStack invItem = inputInv.getStackInSlot(j); - if(invItem == null) - { - continue; - } + if (outputInv != null) { + if (!(!limitToSingleStack + ? SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN) + : SpellHelper.canInsertStackFullyIntoInventory( + returnStack, + outputInv, + ForgeDirection.DOWN, + true, + returnStack.getMaxStackSize()))) { + tag.setBoolean("didLastCraftFail", true); + return; + } + + if (addOutputToInputs) { + invList.add(outputInv); + } + + Map> syphonMap = new HashMap(); // Inventory, Slot, how much claimed + + for (int n = 0; n < recipe.length; n++) // Look for the correct items + { + ItemStack recipeStack = recipe[n]; + if (recipeStack == null) { + continue; + } + + boolean isItemTaken = false; + + for (int i = 0; i < invList.size(); i++) { + if (isItemTaken) { + break; + } + IInventory inputInv = invList.get(i); + if (inputInv == null) { + continue; + } + + for (int j = 0; j < inputInv.getSizeInventory(); j++) { + if (!inputInv.isItemValidForSlot(j, recipeStack)) { + continue; + } + + ItemStack invItem = inputInv.getStackInSlot(j); + if (invItem == null) { + continue; + } + + if (this.areItemsEqualForCrafting(recipeStack, invItem)) { + // TODO + inventory.setInventorySlotContents(n, invItem); + // ItemStack returnedStack = + // CraftingManager.getInstance().findMatchingRecipe(inventory, world); + // if(returnedStack == null || returnedStack.getItem() == null + // || returnedStack.getItem() != returnStack.getItem()) + // { + // continue; + // } + Map slotMap = syphonMap.get(i); + if (slotMap == null) { + slotMap = new HashMap(); + syphonMap.put(i, slotMap); + } + + if (slotMap.containsKey(j)) { + int syphoned = slotMap.get(j); + if (invItem.stackSize - syphoned > 0) { + slotMap.put(j, syphoned + 1); + isItemTaken = true; + break; + } + } else { + slotMap.put(j, 1); + isItemTaken = true; + break; + } + } + } + } + + if (!isItemTaken) { + tag.setBoolean("didLastCraftFail", true); + return; + } + } + + /* The recipe is valid and the items have been found */ + + SpellHelper.insertStackIntoInventory( + CraftingManager.getInstance().findMatchingRecipe(inventory, world), + outputInv, + ForgeDirection.DOWN); + + for (Entry> entry1 : syphonMap.entrySet()) { + IInventory inputInv = invList.get(entry1.getKey()); + for (Entry entry2 : entry1.getValue().entrySet()) { + ItemStack drainedStack = inputInv.getStackInSlot(entry2.getKey()); + Item item = drainedStack.getItem(); + if (item.hasContainerItem(drainedStack)) { + inputInv.setInventorySlotContents(entry2.getKey(), item.getContainerItem(drainedStack)); + } else { + drainedStack.stackSize -= entry2.getValue(); + if (drainedStack.stackSize <= 0) { + inputInv.setInventorySlotContents(entry2.getKey(), null); + } + } + } + } + + if (addOutputToInputs && syphonMap.containsKey(invList.size())) { + this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); + } - if(this.areItemsEqualForCrafting(recipeStack, invItem)) - { - //TODO - inventory.setInventorySlotContents(n, invItem); -// ItemStack returnedStack = CraftingManager.getInstance().findMatchingRecipe(inventory, world); -// if(returnedStack == null || returnedStack.getItem() == null || returnedStack.getItem() != returnStack.getItem()) -// { -// continue; -// } - Map slotMap = syphonMap.get(i); - if(slotMap == null) - { - slotMap = new HashMap(); - syphonMap.put(i, slotMap); - } - - if(slotMap.containsKey(j)) - { - int syphoned = slotMap.get(j); - if(invItem.stackSize - syphoned > 0) - { - slotMap.put(j, syphoned + 1); - isItemTaken = true; - break; - } - }else - { - slotMap.put(j, 1); - isItemTaken = true; - break; - } - } - } - } - - if(!isItemTaken) - { - tag.setBoolean("didLastCraftFail", true); - return; - } - } - - /* The recipe is valid and the items have been found */ - - SpellHelper.insertStackIntoInventory(CraftingManager.getInstance().findMatchingRecipe(inventory, world), outputInv, ForgeDirection.DOWN); - - for(Entry> entry1 : syphonMap.entrySet()) - { - IInventory inputInv = invList.get(entry1.getKey()); - for(Entry entry2 : entry1.getValue().entrySet()) - { - ItemStack drainedStack = inputInv.getStackInSlot(entry2.getKey()); - Item item = drainedStack.getItem(); - if(item.hasContainerItem(drainedStack)) - { - inputInv.setInventorySlotContents(entry2.getKey(), item.getContainerItem(drainedStack)); - }else - { - drainedStack.stackSize -= entry2.getValue(); - if(drainedStack.stackSize <= 0) - { - inputInv.setInventorySlotContents(entry2.getKey(), null); - } - } - } - } - - if(addOutputToInputs && syphonMap.containsKey(invList.size())) - { - this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); - } - SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); - - if(hasPotentia) - { - this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); + + if (hasPotentia) { + this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } - - world.markBlockForUpdate(x, y-1, z + 2); - world.markBlockForUpdate(x, y-1, z - 2); - world.markBlockForUpdate(x + 2, y-1, z); - world.markBlockForUpdate(x - 2, y-1, z); - -// long endTime = System.nanoTime(); -// -// long duration = (endTime - startTime); //divide by 1000000 to get milliseconds. -// System.out.println("(Total) method time in ms: " + (float)(duration)/1000000.0); + + world.markBlockForUpdate(x, y - 1, z + 2); + world.markBlockForUpdate(x, y - 1, z - 2); + world.markBlockForUpdate(x + 2, y - 1, z); + world.markBlockForUpdate(x - 2, y - 1, z); + + // long endTime = System.nanoTime(); + // + // long duration = (endTime - startTime); //divide by 1000000 to get milliseconds. + // System.out.println("(Total) method time in ms: " + (float)(duration)/1000000.0); } - } + } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostCrafting[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList autoCraftingRitual = new ArrayList(); this.addCornerRunes(autoCraftingRitual, 1, 1, RitualComponent.EARTH); @@ -403,45 +357,43 @@ public class RitualEffectCrafting extends RitualEffect autoCraftingRitual.add(new RitualComponent(0, -1, -1, RitualComponent.EARTH)); autoCraftingRitual.add(new RitualComponent(0, -1, 0, RitualComponent.FIRE)); autoCraftingRitual.add(new RitualComponent(0, -1, 1, RitualComponent.WATER)); - + return autoCraftingRitual; } - - public boolean areItemsEqualForCrafting(ItemStack stack1, ItemStack stack2) - { - if (stack1 == null || stack2 == null) - { + + public boolean areItemsEqualForCrafting(ItemStack stack1, ItemStack stack2) { + if (stack1 == null || stack2 == null) { return false; } -// -// if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable()) -// { -// return false; -// } + // + // if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable()) + // { + // return false; + // } - return stack1.getItem() == stack2.getItem() && !stack1.getItem().getHasSubtypes() || stack1.getItemDamage() == stack2.getItemDamage(); + return stack1.getItem() == stack2.getItem() && !stack1.getItem().getHasSubtypes() + || stack1.getItemDamage() == stack2.getItemDamage(); } - public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack) - { - return recipeStack.isItemEqual(comparedStack) || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && recipeStack.getItem() == comparedStack.getItem()); + public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack) { + return recipeStack.isItemEqual(comparedStack) + || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE + && recipeStack.getItem() == comparedStack.getItem()); } - - public Int3 getSlotPositionForDirection(int slot, int direction) - { - int x = slot % 3 - 1; - int z = slot / 3 - 1; - switch(direction) - { - case 1: //NORTH-facing - return new Int3(x, 2, z); - case 2: //EAST-facing - return new Int3(z, 2, -x); - case 3: //SOUTH-facing - return new Int3(-x, 2, -z); - case 4: //WEST-facing - return new Int3(-z, 2, x); - } - return new Int3(0,0,0); + + public Int3 getSlotPositionForDirection(int slot, int direction) { + int x = slot % 3 - 1; + int z = slot / 3 - 1; + switch (direction) { + case 1: // NORTH-facing + return new Int3(x, 2, z); + case 2: // EAST-facing + return new Int3(z, 2, -x); + case 3: // SOUTH-facing + return new Int3(-x, 2, -z); + case 4: // WEST-facing + return new Int3(-z, 2, x); + } + return new Int3(0, 0, 0); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrushing.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrushing.java index c1215226..44fdfff1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrushing.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrushing.java @@ -1,9 +1,15 @@ package WayofTime.alchemicalWizardry.common.rituals; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.ArrayList; import java.util.List; - -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; @@ -14,16 +20,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class RitualEffectCrushing extends RitualEffect -{ +public class RitualEffectCrushing extends RitualEffect { public static final int crystallosDrain = 10; public static final int orbisTerraeDrain = 10; public static final int potentiaDrain = 10; @@ -31,15 +29,13 @@ public class RitualEffectCrushing extends RitualEffect public static final int incendiumDrain = 10; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); World world = ritualStone.getWorld(); - if (world.getWorldTime() % 10 != 5) - { + if (world.getWorldTime() % 10 != 5) { return; } @@ -49,133 +45,128 @@ public class RitualEffectCrushing 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 < tileEntity.getSizeInventory(); i++) - { - if (tileEntity.getStackInSlot(i) == null) - { + for (int i = 0; i < tileEntity.getSizeInventory(); i++) { + if (tileEntity.getStackInSlot(i) == null) { hasRoom = true; break; } } - if (!hasRoom) - { - return; //Prevents overflow + if (!hasRoom) { + return; // Prevents overflow } - boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); - boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); + boolean hasCrystallos = + this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); + boolean hasOrbisTerrae = + this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); - boolean hasIncendium = this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false); + boolean hasIncendium = + this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false); boolean isSilkTouch = hasCrystallos; int fortuneLevel = 0; - if (hasOrbisTerrae) - { + if (hasOrbisTerrae) { fortuneLevel++; } - if (hasPotentia) - { + if (hasPotentia) { fortuneLevel++; } - if (hasVirtus) - { + if (hasVirtus) { fortuneLevel++; } - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - for (int j = -3; j < 0; j++) - { - for (int i = -1; i <= 1; i++) - { - for (int k = -1; k <= 1; k++) - { + } else { + for (int j = -3; j < 0; j++) { + for (int i = -1; i <= 1; i++) { + for (int k = -1; k <= 1; k++) { Block block = world.getBlock(x + i, y + j, z + k); int meta = world.getBlockMetadata(x + i, y + j, z + k); - if(block.getBlockHardness(world, x + i, y + j, z + k) == -1) - { - continue; + if (block.getBlockHardness(world, x + i, y + j, z + k) == -1) { + continue; } - if (block != null && !world.isAirBlock(x + i, y + j, z + k)) - { - if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)) || SpellHelper.isBlockFluid(block)) - { + if (block != null && !world.isAirBlock(x + i, y + j, z + k)) { + if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)) + || SpellHelper.isBlockFluid(block)) { continue; } - if (isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta)) - { + if (isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta)) { ItemStack item = new ItemStack(block, 1, meta); ItemStack copyStack = item.copyItemStack(item); SpellHelper.insertStackIntoInventory(copyStack, tileEntity, ForgeDirection.DOWN); - if (copyStack.stackSize > 0) - { + if (copyStack.stackSize > 0) { world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack)); } - if (hasCrystallos) - { - this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true); + if (hasCrystallos) { + this.canDrainReagent( + ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true); } - } else - { - ArrayList itemDropList = block.getDrops(world, x + i, y + j, z + k, meta, fortuneLevel); + } else { + ArrayList itemDropList = + block.getDrops(world, x + i, y + j, z + k, meta, fortuneLevel); - if (itemDropList != null) - { + if (itemDropList != null) { int invSize = tileEntity.getSizeInventory(); - for (ItemStack item : itemDropList) - { - hasIncendium = hasIncendium && this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false); + for (ItemStack item : itemDropList) { + hasIncendium = hasIncendium + && this.canDrainReagent( + ritualStone, + ReagentRegistry.incendiumReagent, + incendiumDrain, + false); ItemStack copyStack = item.copyItemStack(item); - if (this.usesIncendium(copyStack)) - { + if (this.usesIncendium(copyStack)) { copyStack = this.transformToNewItem(copyStack, hasIncendium, false); - this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, true); + this.canDrainReagent( + ritualStone, + ReagentRegistry.incendiumReagent, + incendiumDrain, + true); } - SpellHelper.insertStackIntoInventory(copyStack, tileEntity, ForgeDirection.DOWN); - if (copyStack.stackSize > 0) - { - world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack)); - } + SpellHelper.insertStackIntoInventory( + copyStack, tileEntity, ForgeDirection.DOWN); + if (copyStack.stackSize > 0) { + world.spawnEntityInWorld( + new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack)); + } } - - if (hasOrbisTerrae) - { - this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true); + + if (hasOrbisTerrae) { + this.canDrainReagent( + ritualStone, + ReagentRegistry.orbisTerraeReagent, + orbisTerraeDrain, + true); } - if (hasPotentia) - { - this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); + if (hasPotentia) { + this.canDrainReagent( + ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } - if (hasVirtus) - { - this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); + if (hasVirtus) { + this.canDrainReagent( + ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); } } } @@ -192,48 +183,37 @@ public class RitualEffectCrushing extends RitualEffect } } - private boolean usesIncendium(ItemStack stack) - { - if (stack != null) - { + private boolean usesIncendium(ItemStack stack) { + if (stack != null) { Item item = stack.getItem(); - if (item instanceof ItemBlock) - { + if (item instanceof ItemBlock) { Block block = ((ItemBlock) item).field_150939_a; - if (block == Blocks.cobblestone || block == Blocks.stone) - { + if (block == Blocks.cobblestone || block == Blocks.stone) { return true; } - } else - { + } else { } } return false; } - private ItemStack transformToNewItem(ItemStack stack, boolean hasIncendium, boolean hasCrepitous) - { - if (stack != null) - { + private ItemStack transformToNewItem(ItemStack stack, boolean hasIncendium, boolean hasCrepitous) { + if (stack != null) { ItemStack copyStack = ItemStack.copyItemStack(stack); int stackSize = copyStack.stackSize; Item item = stack.getItem(); - if (item instanceof ItemBlock) - { + if (item instanceof ItemBlock) { Block block = ((ItemBlock) item).field_150939_a; - if (hasIncendium) - { - if (block == Blocks.cobblestone || block == Blocks.stone) - { + if (hasIncendium) { + if (block == Blocks.cobblestone || block == Blocks.stone) { copyStack = new ItemStack(Blocks.netherrack, stackSize, 0); } } - } else - { + } else { } @@ -242,21 +222,16 @@ public class RitualEffectCrushing extends RitualEffect return stack; } - public boolean isSilkTouch(World world, int x, int y, int z) - { + public boolean isSilkTouch(World world, int x, int y, int z) { int index = 0; - for (int i = -2; i <= 2; i++) - { - for (int j = -2; j <= 2; j++) - { + for (int i = -2; i <= 2; i++) { + for (int j = -2; j <= 2; j++) { int index1 = Math.abs(i); int index2 = Math.abs(j); - if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2)) - { + if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2)) { Block block = world.getBlock(x + i, y + 1, z + j); - if (block == Blocks.gold_block) - { + if (block == Blocks.gold_block) { index++; } } @@ -266,35 +241,27 @@ public class RitualEffectCrushing extends RitualEffect return index >= 12; } - public int getFortuneLevel(World world, int x, int y, int z) - { + public int getFortuneLevel(World world, int x, int y, int z) { int index = 0; - for (int i = -2; i <= 2; i++) - { - for (int j = -2; j <= 2; j++) - { + for (int i = -2; i <= 2; i++) { + for (int j = -2; j <= 2; j++) { int index1 = Math.abs(i); int index2 = Math.abs(j); - if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2)) - { + if ((index1 == 2 && (index2 == 2 || index2 == 1)) || (index1 == 1 && index2 == 2)) { Block block = world.getBlock(x + i, y + 1, z + j); - if (block == Blocks.emerald_block || block == Blocks.diamond_block) - { + if (block == Blocks.emerald_block || block == Blocks.diamond_block) { index++; } } } } - if (index >= 12) - { + if (index >= 12) { return 3; - } else if (index >= 8) - { + } else if (index >= 8) { return 2; - } else if (index >= 4) - { + } else if (index >= 4) { return 1; } @@ -302,14 +269,12 @@ public class RitualEffectCrushing extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostCrusher[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList crushingRitual = new ArrayList(); crushingRitual.add(new RitualComponent(0, 0, 1, RitualComponent.EARTH)); crushingRitual.add(new RitualComponent(1, 0, 0, RitualComponent.EARTH)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectDemonPortal.java index 41d3dd36..7dc91a4c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectDemonPortal.java @@ -1,16 +1,6 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; @@ -19,21 +9,46 @@ 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 WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; +import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.World; -public class RitualEffectDemonPortal extends RitualEffect -{ - public static final int neededAmount = 16000; - public static final Random rand = new Random(); - public static final int drainRate = 50; - public static final Reagent[] reagents = new Reagent[]{ReagentRegistry.aetherReagent, ReagentRegistry.aquasalusReagent, ReagentRegistry.terraeReagent, ReagentRegistry.incendiumReagent, ReagentRegistry.sanctusReagent, ReagentRegistry.tenebraeReagent, ReagentRegistry.magicalesReagent, ReagentRegistry.potentiaReagent}; - public static final Int3[] jarLocations = new Int3[]{new Int3(4, 5, 4), new Int3(-4, 5, 4), new Int3(4, 5, -4), new Int3(-4, 5, -4), new Int3(0, 5, 6), new Int3(0, 5, -6), new Int3(6, 5, 0), new Int3(-6, 5, 0)}; +public class RitualEffectDemonPortal extends RitualEffect { + public static final int neededAmount = 16000; + public static final Random rand = new Random(); + public static final int drainRate = 50; + public static final Reagent[] reagents = new Reagent[] { + ReagentRegistry.aetherReagent, + ReagentRegistry.aquasalusReagent, + ReagentRegistry.terraeReagent, + ReagentRegistry.incendiumReagent, + ReagentRegistry.sanctusReagent, + ReagentRegistry.tenebraeReagent, + ReagentRegistry.magicalesReagent, + ReagentRegistry.potentiaReagent + }; + public static final Int3[] jarLocations = new Int3[] { + new Int3(4, 5, 4), + new Int3(-4, 5, 4), + new Int3(4, 5, -4), + new Int3(-4, 5, -4), + new Int3(0, 5, 6), + new Int3(0, 5, -6), + new Int3(6, 5, 0), + new Int3(-6, 5, 0) + }; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -42,126 +57,116 @@ public class RitualEffectDemonPortal extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - NBTTagCompound tag = ritualStone.getCustomRitualTag(); - - boolean reagentsFulfilled = true; - - for(Reagent reagent : reagents) - { - int reagentAmount = tag.getInteger(ReagentRegistry.getKeyForReagent(reagent)); - if(reagentAmount < neededAmount) - { - reagentsFulfilled = false; -// System.out.println("Reagents not fulfilled. Missing: " + ReagentRegistry.getKeyForReagent(reagent)); - int drainAmount = Math.min(drainRate, neededAmount - reagentAmount); - - if(drainAmount <= 0) - { - continue; - } - - if(this.canDrainReagent(ritualStone, reagent, drainAmount, true)) - { - if(rand.nextInt(10) == 0) - { - this.createRandomLightning(world, x, y, z); - } - reagentAmount += drainAmount; - - tag.setInteger(ReagentRegistry.getKeyForReagent(reagent), reagentAmount); - break; - } - } - } - - ritualStone.setCustomRitualTag(tag); - - if(reagentsFulfilled && checkCreatePortal(ritualStone)) - { - world.setBlock(x, y+1, z, ModBlocks.blockDemonPortal); - - TEDemonPortal portal = (TEDemonPortal) world.getTileEntity(x, y + 1, z); - portal.start(); - - ritualStone.setActive(false); - } - + } else { + NBTTagCompound tag = ritualStone.getCustomRitualTag(); + + boolean reagentsFulfilled = true; + + for (Reagent reagent : reagents) { + int reagentAmount = tag.getInteger(ReagentRegistry.getKeyForReagent(reagent)); + if (reagentAmount < neededAmount) { + reagentsFulfilled = false; + // System.out.println("Reagents not fulfilled. Missing: " + + // ReagentRegistry.getKeyForReagent(reagent)); + int drainAmount = Math.min(drainRate, neededAmount - reagentAmount); + + if (drainAmount <= 0) { + continue; + } + + if (this.canDrainReagent(ritualStone, reagent, drainAmount, true)) { + if (rand.nextInt(10) == 0) { + this.createRandomLightning(world, x, y, z); + } + reagentAmount += drainAmount; + + tag.setInteger(ReagentRegistry.getKeyForReagent(reagent), reagentAmount); + break; + } + } + } + + ritualStone.setCustomRitualTag(tag); + + if (reagentsFulfilled && checkCreatePortal(ritualStone)) { + world.setBlock(x, y + 1, z, ModBlocks.blockDemonPortal); + + TEDemonPortal portal = (TEDemonPortal) world.getTileEntity(x, y + 1, z); + portal.start(); + + ritualStone.setActive(false); + } + SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); } } - public boolean checkCreatePortal(IMasterRitualStone ritualStone) - { - TileEntity entity = ritualStone.getWorld().getTileEntity(ritualStone.getXCoord(), ritualStone.getYCoord() + 1, ritualStone.getZCoord()); - if(entity instanceof IBloodAltar) - { - IBloodAltar altar = (IBloodAltar)entity; - if(altar.hasDemonBlood() && ritualStone.getWorld().isAirBlock(ritualStone.getXCoord(), ritualStone.getYCoord() + 2, ritualStone.getZCoord())) - { - return true; - } - } - return false; + public boolean checkCreatePortal(IMasterRitualStone ritualStone) { + TileEntity entity = ritualStone + .getWorld() + .getTileEntity(ritualStone.getXCoord(), ritualStone.getYCoord() + 1, ritualStone.getZCoord()); + if (entity instanceof IBloodAltar) { + IBloodAltar altar = (IBloodAltar) entity; + if (altar.hasDemonBlood() + && ritualStone + .getWorld() + .isAirBlock( + ritualStone.getXCoord(), ritualStone.getYCoord() + 2, ritualStone.getZCoord())) { + return true; + } + } + return false; } - + @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostConvocation[1]; } - - public void createRandomLightning(World world, int x, int y, int z) - { - world.addWeatherEffect(new EntityLightningBolt(world, x + rand.nextInt(10) - rand.nextInt(10), y + 1, z + rand.nextInt(10) - rand.nextInt(10))); + + public void createRandomLightning(World world, int x, int y, int z) { + world.addWeatherEffect(new EntityLightningBolt( + world, x + rand.nextInt(10) - rand.nextInt(10), y + 1, z + rand.nextInt(10) - rand.nextInt(10))); } - + @Override - public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player) - { + public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player) { for (int dim : AlchemicalWizardry.demonRitualDimensionBlacklist) { if (player.dimension == dim) return false; } - if(!checkJars(ritualStone)) - { - player.addChatMessage(new ChatComponentTranslation("message.ritualdemonportal.missingjar")); - return false; - } + if (!checkJars(ritualStone)) { + player.addChatMessage(new ChatComponentTranslation("message.ritualdemonportal.missingjar")); + return false; + } return true; } - - public boolean checkJars(IMasterRitualStone ritualStone) - { - int x = ritualStone.getXCoord(); - int y = ritualStone.getYCoord(); - int z = ritualStone.getZCoord(); - - for(Int3 pos : jarLocations) - { - if(!(ritualStone.getWorld().getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord) instanceof TEBellJar)) - { - return false; - } - } - - return true; + + public boolean checkJars(IMasterRitualStone ritualStone) { + int x = ritualStone.getXCoord(); + int y = ritualStone.getYCoord(); + int z = ritualStone.getZCoord(); + + for (Int3 pos : jarLocations) { + if (!(ritualStone.getWorld().getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord) + instanceof TEBellJar)) { + return false; + } + } + + return true; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList demonRitual = new ArrayList(); this.addParallelRunes(demonRitual, 3, 0, RitualComponent.FIRE); this.addParallelRunes(demonRitual, 5, 0, RitualComponent.FIRE); this.addCornerRunes(demonRitual, 2, 0, RitualComponent.AIR); this.addCornerRunes(demonRitual, 3, 0, RitualComponent.DUSK); this.addOffsetRunes(demonRitual, 3, 4, 0, RitualComponent.AIR); - + this.addCornerRunes(demonRitual, 4, 1, RitualComponent.BLANK); this.addCornerRunes(demonRitual, 4, 2, RitualComponent.EARTH); this.addCornerRunes(demonRitual, 4, 3, RitualComponent.EARTH); @@ -178,7 +183,7 @@ public class RitualEffectDemonPortal extends RitualEffect this.addOffsetRunes(demonRitual, 2, 9, 1, RitualComponent.BLANK); this.addOffsetRunes(demonRitual, 1, 9, 1, RitualComponent.AIR); this.addParallelRunes(demonRitual, 9, 2, RitualComponent.DUSK); - + this.addCornerRunes(demonRitual, 6, 3, RitualComponent.BLANK); this.addOffsetRunes(demonRitual, 6, 7, 3, RitualComponent.BLANK); this.addOffsetRunes(demonRitual, 5, 7, 3, RitualComponent.AIR); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEllipsoid.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEllipsoid.java index 4183c065..0d597827 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEllipsoid.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEllipsoid.java @@ -1,9 +1,14 @@ package WayofTime.alchemicalWizardry.common.rituals; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.Int3; +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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.ArrayList; import java.util.List; - -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -14,18 +19,10 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.Int3; -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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class RitualEffectEllipsoid extends RitualEffect -{ +public class RitualEffectEllipsoid extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -36,8 +33,7 @@ public class RitualEffectEllipsoid extends RitualEffect TileEntity tile = world.getTileEntity(x, y + 1, z); - if (!(tile instanceof IInventory) || ((IInventory) tile).getSizeInventory() < 3) - { + if (!(tile instanceof IInventory) || ((IInventory) tile).getSizeInventory() < 3) { return; } @@ -51,155 +47,145 @@ public class RitualEffectEllipsoid extends RitualEffect int cost = 5; - if (currentEssence < cost) - { + if (currentEssence < cost) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner == null) - { + if (entityOwner == null) { return; } entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); - } else - { - tile = world.getTileEntity(x, y-1, z); - if(!(tile instanceof IInventory)) - { - return; - } - - ItemBlock placedBlock = null; - ItemStack stack = null; - int slot = 0; - IInventory inv = (IInventory)tile; + } else { + tile = world.getTileEntity(x, y - 1, z); + if (!(tile instanceof IInventory)) { + return; + } + + ItemBlock placedBlock = null; + ItemStack stack = null; + int slot = 0; + IInventory inv = (IInventory) tile; + + while (slot < inv.getSizeInventory()) { + stack = inv.getStackInSlot(slot); + if (stack == null) { + slot++; + continue; + } + + if (stack.getItem() instanceof ItemBlock) { + placedBlock = (ItemBlock) stack.getItem(); + break; + } + + slot++; + } + + if (placedBlock == null || stack == null || slot >= inv.getSizeInventory()) { + return; + } - while(slot < inv.getSizeInventory()) - { - stack = inv.getStackInSlot(slot); - if(stack == null) - { - slot++; - continue; - } - - if(stack.getItem() instanceof ItemBlock) - { - placedBlock = (ItemBlock)stack.getItem(); - break; - } - - slot++; - } - - if(placedBlock == null || stack == null || slot >= inv.getSizeInventory()) - { - return; - } - int count = 10; - + Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag()); - - int i = -xSize; - int j = -ySize; - int k = -zSize; - - if(lastPos != null) - { - i = Math.min(xSize, Math.max(-xSize, lastPos.xCoord)); - j = Math.min(ySize, Math.max(-ySize, lastPos.yCoord)); - k = Math.min(zSize, Math.max(-zSize, lastPos.zCoord)); - } - - boolean incrementNext = false; - - while(j <= ySize) - { - if(y + j < 0) - { - j++; - continue; - } - while(i <= xSize) - { - while(k <= zSize) - { - if (Math.pow(i * (ySize - 0.50f) * (zSize - 0.50f), 2) + Math.pow(j * (xSize - 0.50f) * (zSize - 0.50f), 2) + Math.pow(k * (xSize - 0.50f) * (ySize - 0.50f), 2) <= Math.pow((xSize - 1 + 0.50f) * (ySize - 1 + 0.50f) * (zSize - 1 + 0.50f), 2)) - { - k++; + + int i = -xSize; + int j = -ySize; + int k = -zSize; + + if (lastPos != null) { + i = Math.min(xSize, Math.max(-xSize, lastPos.xCoord)); + j = Math.min(ySize, Math.max(-ySize, lastPos.yCoord)); + k = Math.min(zSize, Math.max(-zSize, lastPos.zCoord)); + } + + boolean incrementNext = false; + + while (j <= ySize) { + if (y + j < 0) { + j++; + continue; + } + while (i <= xSize) { + while (k <= zSize) { + if (Math.pow(i * (ySize - 0.50f) * (zSize - 0.50f), 2) + + Math.pow(j * (xSize - 0.50f) * (zSize - 0.50f), 2) + + Math.pow(k * (xSize - 0.50f) * (ySize - 0.50f), 2) + <= Math.pow((xSize - 1 + 0.50f) * (ySize - 1 + 0.50f) * (zSize - 1 + 0.50f), 2)) { + k++; continue; } - if (Math.pow(i * (ySize + 0.50f) * (zSize + 0.50f), 2) + Math.pow(j * (xSize + 0.50f) * (zSize + 0.50f), 2) + Math.pow(k * (xSize + 0.50f) * (ySize + 0.50f), 2) >= Math.pow((xSize + 0.50f) * (ySize + 0.50f) * (zSize + 0.50f), 2)) - { - k++; + if (Math.pow(i * (ySize + 0.50f) * (zSize + 0.50f), 2) + + Math.pow(j * (xSize + 0.50f) * (zSize + 0.50f), 2) + + Math.pow(k * (xSize + 0.50f) * (ySize + 0.50f), 2) + >= Math.pow((xSize + 0.50f) * (ySize + 0.50f) * (zSize + 0.50f), 2)) { + k++; continue; } - - if(incrementNext || count <= 0) - { - this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); - return; - } - + + if (incrementNext || count <= 0) { + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); + return; + } + count--; Block block = world.getBlock(x + i, y + j, z + k); - - if (!block.isAir(world, x + i, y + j, z + k)) - { - k++; - continue; - } else - { - //This is pulled from the ItemBlock's placing calls - int i1 = placedBlock.getMetadata(stack.getItemDamage()); - int j1 = placedBlock.field_150939_a.onBlockPlaced(world, x + i, y + j, z + k, 0, 0, 0, 0, i1); - if (placedBlock.placeBlockAt(stack, null, world, x + i, y + j, z + k, 0, 0, 0, 0, j1)) - { - world.playSoundEffect((double)(x + i + 0.5F), (double)(y + j + 0.5F), (double)(z + k + 0.5F), placedBlock.field_150939_a.stepSound.func_150496_b(), (placedBlock.field_150939_a.stepSound.getVolume() + 1.0F) / 2.0F, placedBlock.field_150939_a.stepSound.getPitch() * 0.8F); - --stack.stackSize; - if(stack.stackSize <= 0) - { - inv.setInventorySlotContents(slot, null); - } - - this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); - - incrementNext = true; - SoulNetworkHandler.syphonFromNetwork(owner, cost); - - } - -// world.setBlock(x + i, y + j, z + k, Blocks.stone); - + if (!block.isAir(world, x + i, y + j, z + k)) { k++; - } + continue; + } else { + // This is pulled from the ItemBlock's placing calls + int i1 = placedBlock.getMetadata(stack.getItemDamage()); + int j1 = placedBlock.field_150939_a.onBlockPlaced( + world, x + i, y + j, z + k, 0, 0, 0, 0, i1); + + if (placedBlock.placeBlockAt(stack, null, world, x + i, y + j, z + k, 0, 0, 0, 0, j1)) { + world.playSoundEffect( + (double) (x + i + 0.5F), + (double) (y + j + 0.5F), + (double) (z + k + 0.5F), + placedBlock.field_150939_a.stepSound.func_150496_b(), + (placedBlock.field_150939_a.stepSound.getVolume() + 1.0F) / 2.0F, + placedBlock.field_150939_a.stepSound.getPitch() * 0.8F); + --stack.stackSize; + if (stack.stackSize <= 0) { + inv.setInventorySlotContents(slot, null); + } + + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); + + incrementNext = true; + SoulNetworkHandler.syphonFromNetwork(owner, cost); + } + + // world.setBlock(x + i, y + j, z + k, Blocks.stone); + + k++; + } } k = -zSize; i++; } - i = -xSize; - j++; + i = -xSize; + j++; this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); return; } - + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(-xSize, -ySize, -zSize)); } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostEllipsoid[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList ellipsoidRitual = new ArrayList(); ellipsoidRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK)); @@ -245,23 +231,19 @@ public class RitualEffectEllipsoid extends RitualEffect return ellipsoidRitual; } - - public Int3 getLastPosition(NBTTagCompound tag) - { - if(tag != null && tag.getBoolean("hasWorked")) - { - return Int3.readFromNBT(tag); - } - - return null; + + public Int3 getLastPosition(NBTTagCompound tag) { + if (tag != null && tag.getBoolean("hasWorked")) { + return Int3.readFromNBT(tag); + } + + return null; } - - public void setLastPosition(NBTTagCompound tag, Int3 pos) - { - if(tag != null) - { - pos.writeToNBT(tag); - tag.setBoolean("hasWorked", true); - } + + public void setLastPosition(NBTTagCompound tag, Int3 pos) { + if (tag != null) { + pos.writeToNBT(tag); + tag.setBoolean("hasWorked", true); + } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEvaporation.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEvaporation.java index 293ab79b..05544545 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEvaporation.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEvaporation.java @@ -7,6 +7,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -14,14 +16,9 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectEvaporation extends RitualEffect -{ +public class RitualEffectEvaporation extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -30,29 +27,23 @@ public class RitualEffectEvaporation extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < 0) - { + if (currentEssence < 0) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner == null) - { + if (entityOwner == null) { return; } entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); - } else - { + } else { Block block1 = world.getBlock(x, y - 1, z); int range = this.getRadiusForModifierBlock(block1); boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1]; - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { boolList[i][j][k] = false; } } @@ -61,73 +52,62 @@ public class RitualEffectEvaporation extends RitualEffect boolList[range][range][range] = true; boolean isReady = false; - while (!isReady) - { + while (!isReady) { isReady = true; - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { - if (boolList[i][j][k]) - { - if (i - 1 >= 0 && !boolList[i - 1][j][k]) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { + if (boolList[i][j][k]) { + if (i - 1 >= 0 && !boolList[i - 1][j][k]) { Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k); - if (world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer) - { + if (world.isAirBlock(x - range + i - 1, y - range + j, z - range + k) + || block == ModBlocks.blockSpectralContainer) { boolList[i - 1][j][k] = true; isReady = false; } } - if (j - 1 >= 0 && !boolList[i][j - 1][k]) - { + if (j - 1 >= 0 && !boolList[i][j - 1][k]) { Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k); - if (world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) || block == ModBlocks.blockSpectralContainer) - { + if (world.isAirBlock(x - range + i, y - range + j - 1, z - range + k) + || block == ModBlocks.blockSpectralContainer) { boolList[i][j - 1][k] = true; isReady = false; } } - if (k - 1 >= 0 && !boolList[i][j][k - 1]) - { + if (k - 1 >= 0 && !boolList[i][j][k - 1]) { Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1); - if (world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) || block == ModBlocks.blockSpectralContainer) - { + if (world.isAirBlock(x - range + i, y - range + j, z - range + k - 1) + || block == ModBlocks.blockSpectralContainer) { boolList[i][j][k - 1] = true; isReady = false; } } - if (i + 1 <= 2 * range && !boolList[i + 1][j][k]) - { + if (i + 1 <= 2 * range && !boolList[i + 1][j][k]) { Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k); - if (world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) || block == ModBlocks.blockSpectralContainer) - { + if (world.isAirBlock(x - range + i + 1, y - range + j, z - range + k) + || block == ModBlocks.blockSpectralContainer) { boolList[i + 1][j][k] = true; isReady = false; } } - if (j + 1 <= 2 * range && !boolList[i][j + 1][k]) - { + if (j + 1 <= 2 * range && !boolList[i][j + 1][k]) { Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k); - if (world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) || block == ModBlocks.blockSpectralContainer) - { + if (world.isAirBlock(x - range + i, y - range + j + 1, z - range + k) + || block == ModBlocks.blockSpectralContainer) { boolList[i][j + 1][k] = true; isReady = false; } } - if (k + 1 <= 2 * range && !boolList[i][j][k + 1]) - { + if (k + 1 <= 2 * range && !boolList[i][j][k + 1]) { Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1); - if (world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) || block == ModBlocks.blockSpectralContainer) - { + if (world.isAirBlock(x - range + i, y - range + j, z - range + k + 1) + || block == ModBlocks.blockSpectralContainer) { boolList[i][j][k + 1] = true; isReady = false; } @@ -138,21 +118,16 @@ public class RitualEffectEvaporation extends RitualEffect } } - for (int i = 0; i < 2 * range + 1; i++) - { - for (int j = 0; j < 2 * range + 1; j++) - { - for (int k = 0; k < 2 * range + 1; k++) - { - if (!boolList[i][j][k]) - { + for (int i = 0; i < 2 * range + 1; i++) { + for (int j = 0; j < 2 * range + 1; j++) { + for (int k = 0; k < 2 * range + 1; k++) { + if (!boolList[i][j][k]) { continue; } Block block = world.getBlock(x + i - range, y + j - range, z + k - range); - if (block == ModBlocks.blockSpectralContainer) - { + if (block == ModBlocks.blockSpectralContainer) { world.setBlockToAir(x + i - range, y + j - range, z + k - range); } } @@ -166,14 +141,12 @@ public class RitualEffectEvaporation extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostEvaporation[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList ellipsoidRitual = new ArrayList(); ellipsoidRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.DUSK)); @@ -220,25 +193,20 @@ public class RitualEffectEvaporation extends RitualEffect return ellipsoidRitual; } - public int getRadiusForModifierBlock(Block block) - { - if (block == null) - { + public int getRadiusForModifierBlock(Block block) { + if (block == null) { return 10; } - if (block == Blocks.diamond_block) - { + if (block == Blocks.diamond_block) { return 30; } - if (block == Blocks.gold_block) - { + if (block == Blocks.gold_block) { return 20; } - if (block == Blocks.iron_block) - { + if (block == Blocks.iron_block) { return 15; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectExpulsion.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectExpulsion.java index 4ea8f20a..0e2d8484 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectExpulsion.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectExpulsion.java @@ -10,6 +10,9 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,26 +20,19 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class RitualEffectExpulsion extends RitualEffect -{ +public class RitualEffectExpulsion extends RitualEffect { public static final int virtusDrain = 10; public static final int potentiaDrain = 10; public static final int tennebraeDrain = 5; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -45,65 +41,56 @@ public class RitualEffectExpulsion extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); - boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); + boolean hasPotentia = + this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); int teleportDistance = hasVirtus ? 300 : 100; int range = hasPotentia ? 50 : 25; - List playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); + List playerList = + SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); boolean flag = false; TileEntity tile = world.getTileEntity(x, y + 1, z); IInventory inventoryTile = null; - if (tile instanceof IInventory) - { + if (tile instanceof IInventory) { inventoryTile = (IInventory) tile; } - for (EntityPlayer entityplayer : playerList) - { - if(entityplayer.capabilities.isCreativeMode) - { - continue; - } + for (EntityPlayer entityplayer : playerList) { + if (entityplayer.capabilities.isCreativeMode) { + continue; + } String playerString = SpellHelper.getUsername(entityplayer); - if (!playerString.equals(owner)) - { - if (inventoryTile != null) - { - boolean test = false; - for (int i = 0; i < inventoryTile.getSizeInventory(); i++) - { + if (!playerString.equals(owner)) { + if (inventoryTile != null) { + boolean test = false; + for (int i = 0; i < inventoryTile.getSizeInventory(); i++) { ItemStack stack = inventoryTile.getStackInSlot(i); - if (stack != null && stack.getItem() instanceof IBindable && EnergyItems.getOwnerName(stack).equals(playerString)) - { + if (stack != null + && stack.getItem() instanceof IBindable + && EnergyItems.getOwnerName(stack).equals(playerString)) { test = true; } } - - if(test) - { - continue; + + if (test) { + continue; } } flag = teleportRandomly(entityplayer, teleportDistance) || flag; } } - if (flag) - { - if (hasVirtus) - { + if (flag) { + if (hasVirtus) { this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); } - if (hasPotentia) - { + if (hasPotentia) { this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } @@ -111,36 +98,33 @@ public class RitualEffectExpulsion extends RitualEffect } } - boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false); - if (hasTennebrae && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, 1000)) - { + boolean hasTennebrae = + this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false); + if (hasTennebrae && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, 1000)) { boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); - boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); + boolean hasPotentia = + this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); int teleportDistance = hasVirtus ? 300 : 100; int range = hasPotentia ? 50 : 25; - List livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); + List livingList = + SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); boolean flag = false; - for (EntityLivingBase livingEntity : livingList) - { - if (livingEntity instanceof EntityPlayer) - { + for (EntityLivingBase livingEntity : livingList) { + if (livingEntity instanceof EntityPlayer) { continue; } flag = teleportRandomly(livingEntity, teleportDistance) || flag; } - if (flag) - { - if (hasVirtus) - { + if (flag) { + if (hasVirtus) { this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); } - if (hasPotentia) - { + if (hasPotentia) { this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } @@ -152,17 +136,14 @@ public class RitualEffectExpulsion extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostExpulsion[1]; } - public boolean teleportRandomly(EntityLivingBase entityLiving, double distance) - { + public boolean teleportRandomly(EntityLivingBase entityLiving, double distance) { if (entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityLiving; - if (player.capabilities.isCreativeMode) - return false; + if (player.capabilities.isCreativeMode) return false; } double x = entityLiving.posX; @@ -174,28 +155,31 @@ public class RitualEffectExpulsion extends RitualEffect double d2 = z + (rand.nextDouble() - 0.5D) * distance; int i = 0; - while (!teleportTo(entityLiving, d0, d1, d2, x, y, z) && i < 100) - { + while (!teleportTo(entityLiving, d0, d1, d2, x, y, z) && i < 100) { d0 = x + (rand.nextDouble() - 0.5D) * distance; d1 = y + (double) (rand.nextInt((int) distance) - (distance) / 2); d2 = z + (rand.nextDouble() - 0.5D) * distance; i++; } - if (i >= 100) - { + if (i >= 100) { return false; } return true; } - public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ) - { + public boolean teleportTo( + EntityLivingBase entityLiving, + double par1, + double par3, + double par5, + double lastX, + double lastY, + double lastZ) { EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0); - if (MinecraftForge.EVENT_BUS.post(event)) - { + if (MinecraftForge.EVENT_BUS.post(event)) { return false; } @@ -209,89 +193,83 @@ public class RitualEffectExpulsion extends RitualEffect int k = MathHelper.floor_double(entityLiving.posZ); int l; - if (entityLiving.worldObj.blockExists(i, j, k)) - { + if (entityLiving.worldObj.blockExists(i, j, k)) { boolean flag1 = false; - while (!flag1 && j > 0) - { + while (!flag1 && j > 0) { Block block = entityLiving.worldObj.getBlock(i, j - 1, k); - if (block != null && block.getMaterial().blocksMovement()) - { + if (block != null && block.getMaterial().blocksMovement()) { flag1 = true; - } else - { + } else { --entityLiving.posY; --j; } } - if (flag1) - { - SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); + if (flag1) { + SpellTeleport.moveEntityViaTeleport( + entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); - if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) - { + if (entityLiving + .worldObj + .getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox) + .isEmpty() + && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) { flag = true; } } } - if (!flag) - { + if (!flag) { SpellTeleport.moveEntityViaTeleport(entityLiving, d3, d4, d5); return false; - } else - { + } else { short short1 = 128; - for (l = 0; l < short1; ++l) - { + for (l = 0; l < short1; ++l) { double d6 = (double) l / ((double) short1 - 1.0D); float f = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float f1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float f2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; - double d7 = d3 + (entityLiving.posX - d3) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; - double d8 = d4 + (entityLiving.posY - d4) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; - double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + double d7 = d3 + + (entityLiving.posX - d3) * d6 + + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + double d8 = d4 + + (entityLiving.posY - d4) * d6 + + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; + double d9 = d5 + + (entityLiving.posZ - d5) * d6 + + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); } return true; } } - public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z) - { - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving != null && entityLiving instanceof EntityPlayerMP) - { + public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z) { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving != null && entityLiving instanceof EntityPlayerMP) { EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving; - if (entityplayermp.worldObj == entityLiving.worldObj) - { + if (entityplayermp.worldObj == entityLiving.worldObj) { EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F); - if (!MinecraftForge.EVENT_BUS.post(event)) - { - if (entityLiving.isRiding()) - { + if (!MinecraftForge.EVENT_BUS.post(event)) { + if (entityLiving.isRiding()) { entityLiving.mountEntity((Entity) null); } entityLiving.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); } } } - } else if (entityLiving != null) - { + } else if (entityLiving != null) { entityLiving.setPosition(x, y, z); } } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList expulsionRitual = new ArrayList(); expulsionRitual.add(new RitualComponent(2, 0, 2, RitualComponent.EARTH)); expulsionRitual.add(new RitualComponent(2, 0, 1, RitualComponent.EARTH)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredEarth.java index df7a4af2..006b50f4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredEarth.java @@ -6,15 +6,14 @@ 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.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fall damage in the area of effect +public class RitualEffectFeatheredEarth extends RitualEffect // Nullifies all fall damage in the area of effect { public static final int terraeDrain = 1; public static final int orbisTerraeDrain = 1; @@ -23,8 +22,7 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal public static final int costCooldown = 10; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -33,8 +31,7 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (ritualStone.getCooldown() > 0) - { + if (ritualStone.getCooldown() > 0) { world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z + 4)); world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z - 4)); world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 5, z - 4)); @@ -43,45 +40,40 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal } boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); - boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); + boolean hasOrbisTerrae = + this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); int range = this.getHorizontalRangeForReagent(hasTerrae, hasOrbisTerrae); int verticalRange = hasAether ? 60 : 30; - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range)); + List entities = world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range)); int entityCount = 0; boolean flag = false; - for (EntityLivingBase entity : entities) - { + for (EntityLivingBase entity : entities) { entityCount++; } - if (currentEssence < this.getCostPerRefresh() * entityCount) - { + if (currentEssence < this.getCostPerRefresh() * entityCount) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - for (EntityLivingBase entity : entities) - { + } else { + for (EntityLivingBase entity : entities) { entity.fallDistance = 0; flag = true; } SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount); - if (flag && world.getWorldTime() % costCooldown == 0) - { - if (hasTerrae) - { + if (flag && world.getWorldTime() % costCooldown == 0) { + if (hasTerrae) { this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true); } - if (hasOrbisTerrae) - { + if (hasOrbisTerrae) { this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true); } - if (hasAether) - { + if (hasAether) { this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true); } } @@ -89,20 +81,17 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostFeatheredEarth[1]; } @Override - public int getInitialCooldown() - { + public int getInitialCooldown() { return 1; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList featheredEarthRitual = new ArrayList(); featheredEarthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK)); featheredEarthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK)); @@ -147,24 +136,17 @@ public class RitualEffectFeatheredEarth extends RitualEffect //Nullifies all fal return featheredEarthRitual; } - public int getHorizontalRangeForReagent(boolean hasTerrae, boolean hasOrbisTerrae) - { - if (hasOrbisTerrae) - { - if (hasTerrae) - { + public int getHorizontalRangeForReagent(boolean hasTerrae, boolean hasOrbisTerrae) { + if (hasOrbisTerrae) { + if (hasTerrae) { return 64; - } else - { + } else { return 45; } - } else - { - if (hasTerrae) - { + } else { + if (hasTerrae) { return 30; - } else - { + } else { return 20; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java index 91e3975c..3d525cbd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java @@ -1,8 +1,5 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; @@ -11,11 +8,12 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class RitualEffectFeatheredKnife extends RitualEffect -{ +public class RitualEffectFeatheredKnife extends RitualEffect { public final int amount = AlchemicalWizardry.lpPerSelfSacrificeFeatheredKnife; public static final int sanctusDrain = 5; @@ -24,8 +22,7 @@ public class RitualEffectFeatheredKnife extends RitualEffect public static final int potentiaDrain = 5; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -38,22 +35,17 @@ public class RitualEffectFeatheredKnife extends RitualEffect int timeDelay = hasPotentia ? 10 : 20; - if (world.getWorldTime() % timeDelay != 0) - { + if (world.getWorldTime() % timeDelay != 0) { return; } IBloodAltar tileAltar = null; boolean testFlag = false; - for (int i = -5; i <= 5; i++) - { - for (int j = -5; j <= 5; j++) - { - for (int k = -10; k <= 10; k++) - { - if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) - { + for (int i = -5; i <= 5; i++) { + for (int j = -5; j <= 5; j++) { + for (int k = -10; k <= 10; k++) { + if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) { tileAltar = (IBloodAltar) world.getTileEntity(x + i, y + k, z + j); testFlag = true; } @@ -61,8 +53,7 @@ public class RitualEffectFeatheredKnife extends RitualEffect } } - if (!testFlag) - { + if (!testFlag) { return; } @@ -75,36 +66,31 @@ public class RitualEffectFeatheredKnife extends RitualEffect int entityCount = 0; boolean flag = false; - if (currentEssence < this.getCostPerRefresh() * list.size()) - { + if (currentEssence < this.getCostPerRefresh() * list.size()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false); + } else { + boolean hasMagicales = + this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false); boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); EntityPlayer ownerPlayer = SpellHelper.getPlayerForUsername(owner); - for (EntityPlayer player : list) - { - hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); + for (EntityPlayer player : list) { + hasSanctus = hasSanctus + && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); double threshold = hasSanctus ? 0.7d : 0.3d; - if ((hasMagicales && player == ownerPlayer) || !hasMagicales) - { - if (!SpellHelper.isFakePlayer(world, player)) - { - if (player.getHealth() / player.getMaxHealth() > threshold) - { + if ((hasMagicales && player == ownerPlayer) || !hasMagicales) { + if (!SpellHelper.isFakePlayer(world, player)) { + if (player.getHealth() / player.getMaxHealth() > threshold) { player.setHealth(player.getHealth() - 1); entityCount++; tileAltar.sacrificialDaggerCall(this.amount, false); - if (hasSanctus) - { + if (hasSanctus) { this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true); } - if (hasMagicales) - { - this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true); + if (hasMagicales) { + this.canDrainReagent( + ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true); break; } } @@ -112,14 +98,11 @@ public class RitualEffectFeatheredKnife extends RitualEffect } } - if (entityCount > 0) - { - if (hasReductus) - { + if (entityCount > 0) { + if (hasReductus) { this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } - if (hasPotentia) - { + if (hasPotentia) { this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } @@ -129,14 +112,12 @@ public class RitualEffectFeatheredKnife extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostFeatheredKnife[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList featheredKnifeRitual = new ArrayList(); featheredKnifeRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK)); featheredKnifeRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFlight.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFlight.java index 67a9c3a1..d0359d00 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFlight.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFlight.java @@ -7,23 +7,20 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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.player.EntityPlayer; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectFlight extends RitualEffect -{ +public class RitualEffectFlight extends RitualEffect { public static final int aetherDrain = 10; public static final int reductusDrain = 5; public static final int reagentCooldown = 50; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -34,7 +31,8 @@ public class RitualEffectFlight extends RitualEffect int range = 20; int verticalRange = 30; - AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range); + AxisAlignedBB axis = + AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range); axis.maxY = 256; axis.minY = 0; List entities = world.getEntitiesWithinAABB(EntityPlayer.class, axis); @@ -43,36 +41,29 @@ public class RitualEffectFlight extends RitualEffect boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - for (EntityPlayer entity : entities) - { + for (EntityPlayer entity : entities) { entityCount++; } - if (currentEssence < this.getCostPerRefresh() * entityCount) - { + if (currentEssence < this.getCostPerRefresh() * entityCount) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { entityCount = 0; EntityPlayer ownerEntity = SpellHelper.getPlayerForUsername(owner); - for (EntityPlayer entity : entities) - { - if (hasReductus && entity != ownerEntity) - { + for (EntityPlayer entity : entities) { + if (hasReductus && entity != ownerEntity) { continue; } - entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, hasAether ? 30 * 20 : 20, 0)); + entity.addPotionEffect( + new PotionEffect(AlchemicalWizardry.customPotionFlight.id, hasAether ? 30 * 20 : 20, 0)); entityCount++; } - if (entityCount > 0 && world.getWorldTime() % reagentCooldown == 0) - { - if (hasAether) - { + if (entityCount > 0 && world.getWorldTime() % reagentCooldown == 0) { + if (hasAether) { this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true); } - if (hasReductus) - { + if (hasReductus) { this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } } @@ -82,20 +73,17 @@ public class RitualEffectFlight extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostCondor[1]; } @Override - public int getInitialCooldown() - { + public int getInitialCooldown() { return 1; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList flightRitual = new ArrayList(); flightRitual.add(new RitualComponent(1, 0, 0, RitualComponent.DUSK)); flightRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.DUSK)); @@ -146,8 +134,7 @@ public class RitualEffectFlight extends RitualEffect flightRitual.add(new RitualComponent(0, 0, 5, RitualComponent.DUSK)); flightRitual.add(new RitualComponent(0, 0, -5, RitualComponent.DUSK)); - for (int i = 2; i <= 4; i++) - { + for (int i = 2; i <= 4; i++) { flightRitual.add(new RitualComponent(-i, 2, 0, RitualComponent.EARTH)); flightRitual.add(new RitualComponent(i, 2, 0, RitualComponent.EARTH)); flightRitual.add(new RitualComponent(0, 2, -i, RitualComponent.EARTH)); @@ -171,8 +158,7 @@ public class RitualEffectFlight extends RitualEffect flightRitual.add(new RitualComponent(4, 2, -4, RitualComponent.FIRE)); flightRitual.add(new RitualComponent(-4, 2, 4, RitualComponent.FIRE)); - for (int i = -1; i <= 1; i++) - { + for (int i = -1; i <= 1; i++) { flightRitual.add(new RitualComponent(3, 4, i, RitualComponent.EARTH)); flightRitual.add(new RitualComponent(-3, 4, i, RitualComponent.EARTH)); flightRitual.add(new RitualComponent(i, 4, 3, RitualComponent.EARTH)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFullStomach.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFullStomach.java index 9845c5fc..de31f704 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFullStomach.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFullStomach.java @@ -1,9 +1,13 @@ package WayofTime.alchemicalWizardry.common.rituals; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.ArrayList; import java.util.List; - -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemFood; @@ -12,18 +16,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.FoodStats; import net.minecraft.world.World; -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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class RitualEffectFullStomach extends RitualEffect -{ +public class RitualEffectFullStomach extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -32,66 +29,55 @@ public class RitualEffectFullStomach extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (world.getWorldTime() % 20 != 0) - { + if (world.getWorldTime() % 20 != 0) { return; } double horizRange = 16; double vertRange = 16; - List playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, horizRange, vertRange); + List playerList = + SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, horizRange, vertRange); - if (playerList == null) - { + if (playerList == null) { return; } - if (currentEssence < this.getCostPerRefresh() * playerList.size()) - { + if (currentEssence < this.getCostPerRefresh() * playerList.size()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { TileEntity tile = world.getTileEntity(x, y + 1, z); IInventory inventory = null; - if (tile instanceof IInventory) - { + if (tile instanceof IInventory) { inventory = (IInventory) tile; - } else - { + } else { tile = world.getTileEntity(x, y - 1, z); - if (tile instanceof IInventory) - { + if (tile instanceof IInventory) { inventory = (IInventory) tile; } } int count = 0; - if (inventory != null) - { - for (EntityPlayer player : playerList) - { + if (inventory != null) { + for (EntityPlayer player : playerList) { FoodStats foodStats = player.getFoodStats(); float satLevel = foodStats.getSaturationLevel(); - for (int i = 0; i < inventory.getSizeInventory(); i++) - { + for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack stack = inventory.getStackInSlot(i); - if (stack != null && stack.getItem() instanceof ItemFood) - { + if (stack != null && stack.getItem() instanceof ItemFood) { ItemFood foodItem = (ItemFood) stack.getItem(); int regularHeal = foodItem.func_150905_g(stack); float saturatedHeal = foodItem.func_150906_h(stack) * regularHeal * 2.0f; - if (saturatedHeal + satLevel <= 20) - { - NBTTagCompound nbt = new NBTTagCompound(); - foodStats.writeNBT(nbt); - nbt.setFloat("foodSaturationLevel", saturatedHeal + satLevel); - foodStats.readNBT(nbt); + if (saturatedHeal + satLevel <= 20) { + NBTTagCompound nbt = new NBTTagCompound(); + foodStats.writeNBT(nbt); + nbt.setFloat("foodSaturationLevel", saturatedHeal + satLevel); + foodStats.readNBT(nbt); inventory.decrStackSize(i, 1); count++; @@ -107,14 +93,12 @@ public class RitualEffectFullStomach extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostFullStomach[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList fullRitual = new ArrayList(); fullRitual.add(new RitualComponent(0, 0, 3, RitualComponent.FIRE)); fullRitual.add(new RitualComponent(0, 0, -3, RitualComponent.FIRE)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectGrowth.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectGrowth.java index 9abdccb9..5e0cefdf 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectGrowth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectGrowth.java @@ -7,24 +7,21 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import net.minecraft.block.Block; -import net.minecraft.world.World; -import net.minecraftforge.common.IPlantable; -import net.minecraft.block.IGrowable; - import java.util.ArrayList; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.IGrowable; +import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; -public class RitualEffectGrowth extends RitualEffect -{ +public class RitualEffectGrowth extends RitualEffect { private static final int aquasalusDrain = 10; private static final int terraeDrain = 20; private static final int orbisTerraeDrain = 20; private static final int virtusDrain = 10; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -33,36 +30,30 @@ public class RitualEffectGrowth extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh() * 9) - { + if (currentEssence < this.getCostPerRefresh() * 9) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); - boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); + boolean hasOrbisTerrae = + this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); int speed = this.getSpeedForReagents(hasTerrae, hasOrbisTerrae); - if (world.getWorldTime() % speed != 0) - { + if (world.getWorldTime() % speed != 0) { return; } - if (this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false)) - { + if (this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false)) { int hydrationRange = hasVirtus ? 4 : 1; - for (int i = -hydrationRange; i <= hydrationRange; i++) - { - for (int j = -hydrationRange; j <= hydrationRange; j++) - { - for (int k = -hydrationRange; k <= hydrationRange; k++) - { - - if (this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false)) - { - if (SpellHelper.hydrateSoil(world, x + i, y + k, z + j)) - { - this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true); + for (int i = -hydrationRange; i <= hydrationRange; i++) { + for (int j = -hydrationRange; j <= hydrationRange; j++) { + for (int k = -hydrationRange; k <= hydrationRange; k++) { + + if (this.canDrainReagent( + ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false)) { + if (SpellHelper.hydrateSoil(world, x + i, y + k, z + j)) { + this.canDrainReagent( + ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true); } } } @@ -73,20 +64,17 @@ public class RitualEffectGrowth extends RitualEffect int flag = 0; int range = hasVirtus ? 4 : 1; - for (int i = -range; i <= range; i++) - { - for (int j = -range; j <= range; j++) - { - - for (int k = -range; k <= range; k++) - { - + for (int i = -range; i <= range; i++) { + for (int j = -range; j <= range; j++) { + + for (int k = -range; k <= range; k++) { + Block block = world.getBlock(x + i, y + k, z + j); - - if (block instanceof IPlantable || block instanceof IGrowable) - { + + if (block instanceof IPlantable || block instanceof IGrowable) { { - SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z); + SpellHelper.sendIndexedParticleToAllAround( + world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z); block.updateTick(world, x + i, y + k, z + j, world.rand); flag++; } @@ -95,14 +83,11 @@ public class RitualEffectGrowth extends RitualEffect } } - if (flag > 0) - { - if (hasTerrae) - this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true); + if (flag > 0) { + if (hasTerrae) this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true); if (hasOrbisTerrae) this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true); - if (hasVirtus) - this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); + if (hasVirtus) this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag); } @@ -110,14 +95,12 @@ public class RitualEffectGrowth extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostGreenGrove[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList growthRitual = new ArrayList(); growthRitual.add(new RitualComponent(1, 0, 0, 1)); growthRitual.add(new RitualComponent(-1, 0, 0, 1)); @@ -130,24 +113,17 @@ public class RitualEffectGrowth extends RitualEffect return growthRitual; } - public int getSpeedForReagents(boolean hasTerrae, boolean hasOrbisTerrae) - { - if (hasOrbisTerrae) - { - if (hasTerrae) - { + public int getSpeedForReagents(boolean hasTerrae, boolean hasOrbisTerrae) { + if (hasOrbisTerrae) { + if (hasTerrae) { return 10; - } else - { + } else { return 15; } - } else - { - if (hasTerrae) - { + } else { + if (hasTerrae) { return 20; - } else - { + } else { return 30; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHarvest.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHarvest.java index 9e3b3e26..09ff7959 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHarvest.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHarvest.java @@ -7,6 +7,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -14,14 +16,9 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectHarvest extends RitualEffect -{ +public class RitualEffectHarvest extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -31,20 +28,16 @@ public class RitualEffectHarvest extends RitualEffect int z = ritualStone.getZCoord(); int maxCount = 100; - if (currentEssence < this.getCostPerRefresh() * maxCount) - { + if (currentEssence < this.getCostPerRefresh() * maxCount) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner == null) - { + if (entityOwner == null) { return; } entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); - } else - { - if (world.getWorldTime() % 5 != 0) - { + } else { + if (world.getWorldTime() % 5 != 0) { return; } @@ -53,52 +46,41 @@ public class RitualEffectHarvest extends RitualEffect int range = this.getRadiusForModifierBlock(block); int vertRange = 4; - for (int i = -range; i <= range; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -range; k <= range; k++) - { - if (HarvestRegistry.harvestBlock(world, x + i, y + j, z + k) && flag < maxCount) - { + for (int i = -range; i <= range; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -range; k <= range; k++) { + if (HarvestRegistry.harvestBlock(world, x + i, y + j, z + k) && flag < maxCount) { flag++; } } } } - if (flag > 0) - { + if (flag > 0) { SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * Math.min(maxCount, flag)); } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostHarvest[1]; } - public int getRadiusForModifierBlock(Block block) - { - if (block == null) - { + public int getRadiusForModifierBlock(Block block) { + if (block == null) { return 4; } - if (block == Blocks.diamond_block) - { + if (block == Blocks.diamond_block) { return 15; } - if (block == Blocks.gold_block) - { + if (block == Blocks.gold_block) { return 10; } - if (block == Blocks.iron_block) - { + if (block == Blocks.iron_block) { return 6; } @@ -106,8 +88,7 @@ public class RitualEffectHarvest extends RitualEffect } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList harvestRitual = new ArrayList(); harvestRitual.add(new RitualComponent(1, 0, 1, RitualComponent.DUSK)); @@ -135,7 +116,6 @@ public class RitualEffectHarvest extends RitualEffect harvestRitual.add(new RitualComponent(-2, 0, -3, RitualComponent.WATER)); harvestRitual.add(new RitualComponent(-3, 0, -2, RitualComponent.WATER)); - return harvestRitual; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHealing.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHealing.java index 4d6c919d..d7581ef2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHealing.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHealing.java @@ -7,24 +7,21 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectHealing extends RitualEffect -{ +public class RitualEffectHealing extends RitualEffect { public static final int reductusDrain = 10; public static final int virtusDrain = 10; public static final int praesidiumDrain = 2; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -35,27 +32,25 @@ public class RitualEffectHealing extends RitualEffect int timeDelay = 50; - if (world.getWorldTime() % timeDelay != 0) - { + if (world.getWorldTime() % timeDelay != 0) { return; } - boolean hasPraesidium = this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, false); + boolean hasPraesidium = + this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, false); 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; boolean flag = false; - for (EntityLivingBase livingEntity : list) - { - if (livingEntity instanceof EntityPlayer) - { + for (EntityLivingBase livingEntity : list) { + if (livingEntity instanceof EntityPlayer) { entityCount += 10; - } else - { + } else { entityCount++; } } @@ -65,45 +60,42 @@ public class RitualEffectHealing extends RitualEffect int cost = this.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 = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + boolean hasReductus = + this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - for (EntityLivingBase livingEntity : list) - { - hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - if (hasReductus && !(livingEntity instanceof EntityPlayer)) - { + for (EntityLivingBase livingEntity : list) { + hasReductus = hasReductus + && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + if (hasReductus && !(livingEntity instanceof EntityPlayer)) { continue; } - if (livingEntity.getHealth() + 0.1f < livingEntity.getMaxHealth()) - { + if (livingEntity.getHealth() + 0.1f < livingEntity.getMaxHealth()) { PotionEffect effect = livingEntity.getActivePotionEffect(Potion.regeneration); - if (effect == null || (effect != null && effect.getAmplifier() <= potency && effect.getDuration() <= timeDelay)) - { - if (!hasVirtus || (this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false))) - { - livingEntity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, potency)); - if (hasReductus) - { + if (effect == null + || (effect != null + && effect.getAmplifier() <= potency + && effect.getDuration() <= timeDelay)) { + if (!hasVirtus + || (this.canDrainReagent( + ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false))) { + livingEntity.addPotionEffect( + new PotionEffect(Potion.regeneration.id, timeDelay + 2, potency)); + if (hasReductus) { this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } - if (hasVirtus) - { + if (hasVirtus) { this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); } - if (livingEntity instanceof EntityPlayer) - { + if (livingEntity instanceof EntityPlayer) { entityCount += 10; - } else - { + } else { entityCount++; } } @@ -111,10 +103,8 @@ public class RitualEffectHealing extends RitualEffect } } - if (entityCount > 0) - { - if (hasPraesidium) - { + if (entityCount > 0) { + if (hasPraesidium) { this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, true); } SoulNetworkHandler.syphonFromNetwork(owner, cost * entityCount); @@ -123,14 +113,12 @@ public class RitualEffectHealing extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostRegen[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList healingRitual = new ArrayList(); healingRitual.add(new RitualComponent(4, 0, 0, RitualComponent.AIR)); healingRitual.add(new RitualComponent(5, 0, -1, RitualComponent.AIR)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectInterdiction.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectInterdiction.java index aa781c50..9f5c461b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectInterdiction.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectInterdiction.java @@ -7,23 +7,20 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectInterdiction extends RitualEffect -{ +public class RitualEffectInterdiction extends RitualEffect { public static final int aetherDrain = 1; public static final int magicalesDrain = 1; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -32,23 +29,22 @@ public class RitualEffectInterdiction extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { int d0 = 5; - List list = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, d0, d0); + List list = + SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, d0, d0); boolean flag = false; - boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false); + boolean hasOffensa = + this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false); boolean playerFlag = false; - for (EntityLivingBase entityLiving : list) - { - if (!((!hasOffensa && entityLiving instanceof EntityPlayer) && (SpellHelper.getUsername((EntityPlayer) entityLiving).equals(owner)))) - { + for (EntityLivingBase entityLiving : list) { + if (!((!hasOffensa && entityLiving instanceof EntityPlayer) + && (SpellHelper.getUsername((EntityPlayer) entityLiving).equals(owner)))) { double xDif = entityLiving.posX - x; double yDif = entityLiving.posY - (y + 1); double zDif = entityLiving.posZ - z; @@ -56,9 +52,9 @@ public class RitualEffectInterdiction extends RitualEffect entityLiving.motionY = 0.1 * yDif; entityLiving.motionZ = 0.1 * zDif; - if (hasOffensa && entityLiving instanceof EntityPlayer) - { - SpellHelper.setPlayerSpeedFromServer((EntityPlayer) entityLiving, 0.1 * xDif, 0.1 * yDif, 0.1 * zDif); + if (hasOffensa && entityLiving instanceof EntityPlayer) { + SpellHelper.setPlayerSpeedFromServer( + (EntityPlayer) entityLiving, 0.1 * xDif, 0.1 * yDif, 0.1 * zDif); playerFlag = true; } entityLiving.fallDistance = 0; @@ -66,27 +62,26 @@ public class RitualEffectInterdiction extends RitualEffect } } - if (playerFlag) - { + if (playerFlag) { this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true); } boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); - if (hasAether) - { + if (hasAether) { int aetherDrainRate = 10; int horizontalRadius = 5; int verticalRadius = 5; - List itemList = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(horizontalRadius, verticalRadius, horizontalRadius)); + List itemList = world.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1) + .expand(horizontalRadius, verticalRadius, horizontalRadius)); - if (itemList != null) - { + if (itemList != null) { boolean itemFlag = false; - for (EntityItem entity : itemList) - { + for (EntityItem entity : itemList) { double xDif = entity.posX - x; double yDif = entity.posY - (y + 1); double zDif = entity.posZ - z; @@ -97,34 +92,28 @@ public class RitualEffectInterdiction extends RitualEffect itemFlag = true; } - if (itemFlag) - { + if (itemFlag) { flag = true; - if (world.getWorldTime() % aetherDrainRate == 0) - { + if (world.getWorldTime() % aetherDrainRate == 0) { this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true); } } } } - - if (world.getWorldTime() % 2 == 0 && flag) - { + if (world.getWorldTime() % 2 == 0 && flag) { SoulNetworkHandler.syphonFromNetwork(owner, getCostPerRefresh()); } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostInterdiction[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList interdictionRitual = new ArrayList(); interdictionRitual.add(new RitualComponent(1, 0, 0, 4)); interdictionRitual.add(new RitualComponent(-1, 0, 0, 4)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java index 63fb3523..c6bc9699 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemRouting.java @@ -1,18 +1,6 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.RoutingFocusParadigm; import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing; @@ -23,14 +11,23 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.items.routing.InputRoutingFocus; import WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class RitualEffectItemRouting extends RitualEffect { + Random rand = new Random(); -public class RitualEffectItemRouting extends RitualEffect -{ - Random rand = new Random(); - @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -39,216 +36,217 @@ public class RitualEffectItemRouting extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (world.getWorldTime() % 20 != 0) - { + if (world.getWorldTime() % 20 != 0) { return; } - + Map tileMap = new HashMap(); - + List outputList = new ArrayList(); - for(int i=0; i<4; i++) //Check output foci chests, return if none available + for (int i = 0; i < 4; i++) // Check output foci chests, return if none available { - Int3 outputFocusChest = this.getOutputBufferChestLocation(i); - TileEntity outputFocusInv = world.getTileEntity(x + outputFocusChest.xCoord, y + outputFocusChest.yCoord, z + outputFocusChest.zCoord); - if(outputFocusInv instanceof IInventory) - { - outputList.add((IInventory)outputFocusInv); - } + Int3 outputFocusChest = this.getOutputBufferChestLocation(i); + TileEntity outputFocusInv = world.getTileEntity( + x + outputFocusChest.xCoord, y + outputFocusChest.yCoord, z + outputFocusChest.zCoord); + if (outputFocusInv instanceof IInventory) { + outputList.add((IInventory) outputFocusInv); + } } - - if(outputList.isEmpty()) - { - return; + + if (outputList.isEmpty()) { + return; } - - for(IInventory outputFocusInventory : outputList) - { - { - OutputRoutingFocus outputFocus;; - - RoutingFocusParadigm parad = new RoutingFocusParadigm(); - - TileEntity outputChest = null; //Destination - ForgeDirection inputDirection; - - { - IInventory outputChestInventory = null; - - boolean lastItemWasFocus = true; - - for(int j=0; j getRitualComponentList() - { + public List getRitualComponentList() { ArrayList omegaRitual = new ArrayList(); - + this.addCornerRunes(omegaRitual, 1, 0, RitualComponent.BLANK); this.addOffsetRunes(omegaRitual, 2, 1, 0, RitualComponent.FIRE); this.addParallelRunes(omegaRitual, 4, 0, RitualComponent.WATER); @@ -257,6 +255,4 @@ public class RitualEffectItemRouting extends RitualEffect return omegaRitual; } - - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java index 1b74bd41..e47239c3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java @@ -1,31 +1,28 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; 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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class RitualEffectItemSuction extends RitualEffect -{ +public class RitualEffectItemSuction extends RitualEffect { public static final int reductusDrain = 1; public static final int timeDelayMin = 60; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -37,84 +34,72 @@ public class RitualEffectItemSuction 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; } - if (currentEssence < this.getCostPerRefresh() * 100) - { + if (currentEssence < this.getCostPerRefresh() * 100) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { List itemDropList = SpellHelper.getItemsInRange(world, x + 0.5f, y + 0.5f, z + 0.5f, 10, 10); - boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + boolean hasReductus = + this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); int count = 0; - if (itemDropList != null) - { + if (itemDropList != null) { int invSize = tileEntity.getSizeInventory(); - for (EntityItem itemEntity : itemDropList) - { - hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - if (hasReductus && itemEntity.age < this.timeDelayMin) - { + for (EntityItem itemEntity : itemDropList) { + hasReductus = hasReductus + && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + if (hasReductus && itemEntity.age < this.timeDelayMin) { continue; } ItemStack item = itemEntity.getEntityItem(); ItemStack copyStack = itemEntity.getEntityItem().copy(); int pastAmount = copyStack.stackSize; - ItemStack newStack = SpellHelper.insertStackIntoInventory(copyStack, tileEntity, ForgeDirection.DOWN); + ItemStack newStack = + SpellHelper.insertStackIntoInventory(copyStack, tileEntity, ForgeDirection.DOWN); - if (newStack != null && newStack.stackSize < pastAmount) - { + if (newStack != null && newStack.stackSize < pastAmount) { count++; - if (newStack.stackSize <= 0) - { + if (newStack.stackSize <= 0) { itemEntity.setDead(); itemEntity.getEntityItem().stackSize = newStack.stackSize; } - if (newStack.stackSize > 0) - { + if (newStack.stackSize > 0) { itemEntity.getEntityItem().stackSize = newStack.stackSize; } - if (hasReductus) - { + if (hasReductus) { this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } } } } - if (count > 0) - { + if (count > 0) { SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * Math.min(count, 100)); } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostZephyr[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList suctionRitual = new ArrayList(); suctionRitual.add(new RitualComponent(2, 0, 0, RitualComponent.AIR)); suctionRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.AIR)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectJumping.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectJumping.java index e3be069a..643fe6bf 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectJumping.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectJumping.java @@ -7,22 +7,19 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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.PotionEffect; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectJumping extends RitualEffect -{ +public class RitualEffectJumping extends RitualEffect { public static final int aetherDrain = 10; public static final int terraeDrain = 10; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -32,77 +29,69 @@ public class RitualEffectJumping extends RitualEffect int z = ritualStone.getZCoord(); double range = 0.5; - List livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range); + List livingList = + SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range); - if (currentEssence < this.getCostPerRefresh() * livingList.size()) - { + if (currentEssence < this.getCostPerRefresh() * livingList.size()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { int flag = 0; boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); - for (EntityLivingBase livingEntity : livingList) - { - if (livingEntity.isSneaking()) - { + for (EntityLivingBase livingEntity : livingList) { + if (livingEntity.isSneaking()) { continue; } - hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); - hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); + hasAether = hasAether + && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); + hasTerrae = hasTerrae + && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); double motionY = 1.5 * (hasAether ? 2 : 1); - if (livingEntity instanceof EntityPlayer) - { - SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, livingEntity.motionX, motionY, livingEntity.motionZ); + if (livingEntity instanceof EntityPlayer) { + SpellHelper.setPlayerSpeedFromServer( + (EntityPlayer) livingEntity, livingEntity.motionX, motionY, livingEntity.motionZ); livingEntity.motionY = motionY; livingEntity.fallDistance = 0; flag++; - } else - { + } else { livingEntity.motionY = motionY; livingEntity.fallDistance = 0; flag++; } - if (hasAether) - { + if (hasAether) { this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true); } - if (hasTerrae) - { - if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) - { - livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 5 * 20, 0)); + if (hasTerrae) { + if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) { + livingEntity.addPotionEffect( + new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 5 * 20, 0)); this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true); } } } - if (flag > 0) - { + if (flag > 0) { SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag); } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostHighJump[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList jumpingRitual = new ArrayList(); - for (int i = -1; i <= 1; i++) - { + for (int i = -1; i <= 1; i++) { jumpingRitual.add(new RitualComponent(1, i, 1, RitualComponent.AIR)); jumpingRitual.add(new RitualComponent(-1, i, 1, RitualComponent.AIR)); jumpingRitual.add(new RitualComponent(-1, i, -1, RitualComponent.AIR)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLava.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLava.java index faf2a232..113c3972 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLava.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLava.java @@ -8,6 +8,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -20,11 +22,7 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectLava extends RitualEffect -{ +public class RitualEffectLava extends RitualEffect { public static final int sanctusDrain = 20; public static final int offensaDrain = 50; public static final int reductusDrain = 5; @@ -32,8 +30,7 @@ public class RitualEffectLava extends RitualEffect public static final int fireFuseCost = 1000; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -42,26 +39,27 @@ public class RitualEffectLava extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - - if (this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost)) - { - boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + if (this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) + && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost)) { + boolean hasReductus = + this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); boolean drainReductus = world.getWorldTime() % 100 == 0; int range = 5; - List entityList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); + List entityList = + SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); EntityPlayer player = SpellHelper.getPlayerForUsername(owner); - for (EntityLivingBase entity : entityList) - { - if (entity != player && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost) && !entity.isPotionActive(AlchemicalWizardry.customPotionFireFuse)) - { - if (hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false)) - { - if (entity instanceof EntityPlayer) - { - if (drainReductus) - { + for (EntityLivingBase entity : entityList) { + if (entity != player + && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) + && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost) + && !entity.isPotionActive(AlchemicalWizardry.customPotionFireFuse)) { + if (hasReductus + && this.canDrainReagent( + ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false)) { + if (entity instanceof EntityPlayer) { + if (drainReductus) { this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } @@ -78,34 +76,28 @@ public class RitualEffectLava extends RitualEffect Block block = world.getBlock(x, y + 1, z); - if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer)) - { - if (currentEssence < this.getCostPerRefresh()) - { + if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer)) { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - for (int i = 0; i < 10; i++) - { - SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z); + } else { + for (int i = 0; i < 10; i++) { + SpellHelper.sendIndexedParticleToAllAround( + world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z); } world.setBlock(x, y + 1, z, Blocks.lava, 0, 3); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); } - } else - { + } else { boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); - if (!hasSanctus) - { + if (!hasSanctus) { return; } TileEntity tile = world.getTileEntity(x, y + 1, z); - if (tile instanceof IFluidHandler) - { - int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), false); - if (amount >= 1000) - { + if (tile instanceof IFluidHandler) { + int amount = ((IFluidHandler) tile) + .fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), false); + if (amount >= 1000) { ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), true); this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true); @@ -114,19 +106,15 @@ public class RitualEffectLava extends RitualEffect } } } - - } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostLava[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList lavaRitual = new ArrayList(); lavaRitual.add(new RitualComponent(1, 0, 0, 2)); lavaRitual.add(new RitualComponent(-1, 0, 0, 2)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLeap.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLeap.java index be9ce25a..112a436d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLeap.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLeap.java @@ -7,16 +7,14 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; 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.PotionEffect; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectLeap extends RitualEffect -{ +public class RitualEffectLeap extends RitualEffect { public static final int aetherDrain = 10; public static final int terraeDrain = 10; public static final int reductusDrain = 10; @@ -24,8 +22,7 @@ public class RitualEffectLeap extends RitualEffect public static final int sanctusDrain = 10; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -36,53 +33,53 @@ public class RitualEffectLeap extends RitualEffect double range = 2.0; - List livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); + List livingList = + SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); - if (livingList == null) - { + if (livingList == null) { return; } - if (currentEssence < this.getCostPerRefresh() * livingList.size()) - { + if (currentEssence < this.getCostPerRefresh() * livingList.size()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); - boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - boolean hasTenebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false); + boolean hasReductus = + this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + boolean hasTenebrae = + this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false); boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); int direction = ritualStone.getDirection(); int flag = 0; - for (EntityLivingBase livingEntity : livingList) - { - if (livingEntity.isSneaking()) - { + for (EntityLivingBase livingEntity : livingList) { + if (livingEntity.isSneaking()) { continue; } - hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); - hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); - hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); - hasTenebrae = hasTenebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false); - hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); + hasAether = hasAether + && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); + hasTerrae = hasTerrae + && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); + hasReductus = hasReductus + && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + hasTenebrae = hasTenebrae + && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false); + hasSanctus = hasSanctus + && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); double motionY = hasTerrae ? 0.6 : 1.2; double speed = hasAether ? 6.0 : 3.0; - if (!(hasTenebrae || hasSanctus) || livingEntity instanceof EntityPlayer) - { + if (!(hasTenebrae || hasSanctus) || livingEntity instanceof EntityPlayer) { livingEntity.motionY = motionY; livingEntity.fallDistance = 0; - if(livingEntity instanceof EntityPlayer) - { - switch (direction) - { + if (livingEntity instanceof EntityPlayer) { + switch (direction) { case 1: SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, 0, motionY, -speed); break; @@ -99,12 +96,10 @@ public class RitualEffectLeap extends RitualEffect SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, -speed, motionY, 0); break; } - }else - { - livingEntity.motionY = motionY; + } else { + livingEntity.motionY = motionY; - switch (direction) - { + switch (direction) { case 1: livingEntity.motionX = 0.0; livingEntity.motionZ = -speed; @@ -126,20 +121,16 @@ public class RitualEffectLeap extends RitualEffect break; } } - flag++; - } else - { - if ((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild())) - { + } else { + if ((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild())) { continue; } livingEntity.motionY = motionY; - switch (direction) - { + switch (direction) { case 1: livingEntity.motionX = 0.0; livingEntity.motionZ = -speed; @@ -161,12 +152,10 @@ public class RitualEffectLeap extends RitualEffect break; } - if (hasTenebrae) - { + if (hasTenebrae) { this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, true); } - if (hasSanctus) - { + if (hasSanctus) { this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true); } @@ -174,48 +163,40 @@ public class RitualEffectLeap extends RitualEffect flag++; } - if (hasAether) - { + if (hasAether) { this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true); } - if (hasTerrae) - { + if (hasTerrae) { this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true); } - if (hasReductus) - { - if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) - { - livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3 * 20, 0)); + if (hasReductus) { + if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) { + livingEntity.addPotionEffect( + new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3 * 20, 0)); this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } } - } - if (flag > 0) - { + if (flag > 0) { SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag); } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostSpeed[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList leapingRitual = new ArrayList(); leapingRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK)); leapingRitual.add(new RitualComponent(1, 0, -1, RitualComponent.AIR)); leapingRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.AIR)); - for (int i = 0; i <= 2; i++) - { + for (int i = 0; i <= 2; i++) { leapingRitual.add(new RitualComponent(2, 0, i, RitualComponent.AIR)); leapingRitual.add(new RitualComponent(-2, 0, i, RitualComponent.AIR)); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLifeConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLifeConduit.java index 1ed32ef1..dfef107c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLifeConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectLifeConduit.java @@ -1,13 +1,5 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; @@ -15,12 +7,17 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; -public class RitualEffectLifeConduit extends RitualEffect -{ +public class RitualEffectLifeConduit extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -32,14 +29,10 @@ public class RitualEffectLifeConduit extends RitualEffect IBloodAltar tileAltar = null; boolean testFlag = false; - for (int i = -5; i <= 5; i++) - { - for (int j = -5; j <= 5; j++) - { - for (int k = -10; k <= 10; k++) - { - if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) - { + for (int i = -5; i <= 5; i++) { + for (int j = -5; j <= 5; j++) { + for (int k = -10; k <= 10; k++) { + if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) { tileAltar = (IBloodAltar) world.getTileEntity(x + i, y + k, z + j); testFlag = true; } @@ -47,41 +40,39 @@ public class RitualEffectLifeConduit extends RitualEffect } } - if (!testFlag) - { + if (!testFlag) { return; } - - if(!(tileAltar instanceof IFluidHandler)) - { - return; + + if (!(tileAltar instanceof IFluidHandler)) { + return; } - + int d0 = 15; int vertRange = 20; EntityPlayer entityOwner = null; List list = SpellHelper.getPlayersInRange(world, x, y, z, d0, vertRange); - for (EntityPlayer player : list) - { - if (SpellHelper.getUsername(player).equals(owner)) - { + for (EntityPlayer player : list) { + if (SpellHelper.getUsername(player).equals(owner)) { entityOwner = player; } } - if (entityOwner == null) - { + if (entityOwner == null) { return; } - int fillAmount = Math.min(currentEssence / 2, ((IFluidHandler)tileAltar).fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 10000), false)); + int fillAmount = Math.min( + currentEssence / 2, + ((IFluidHandler) tileAltar) + .fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 10000), false)); { - ((IFluidHandler)tileAltar).fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fillAmount), true); - if (entityOwner.getHealth() > 2.0f && fillAmount != 0) - { + ((IFluidHandler) tileAltar) + .fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fillAmount), true); + if (entityOwner.getHealth() > 2.0f && fillAmount != 0) { entityOwner.setHealth(2.0f); } SoulNetworkHandler.syphonFromNetwork(owner, fillAmount * 2); @@ -89,14 +80,12 @@ public class RitualEffectLifeConduit extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostConduit[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList conduitRitual = new ArrayList(); conduitRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.FIRE)); @@ -104,8 +93,7 @@ public class RitualEffectLifeConduit extends RitualEffect conduitRitual.add(new RitualComponent(1, 0, 1, RitualComponent.FIRE)); conduitRitual.add(new RitualComponent(1, 0, -1, RitualComponent.FIRE)); - for (int i = 0; i < 4; i++) - { + for (int i = 0; i < 4; i++) { conduitRitual.add(new RitualComponent(-2, i, -2, RitualComponent.AIR)); conduitRitual.add(new RitualComponent(-2, i, 2, RitualComponent.AIR)); conduitRitual.add(new RitualComponent(2, i, 2, RitualComponent.AIR)); @@ -125,9 +113,7 @@ public class RitualEffectLifeConduit extends RitualEffect conduitRitual.add(new RitualComponent(-3, 1, -4, RitualComponent.EARTH)); conduitRitual.add(new RitualComponent(-4, 1, -3, RitualComponent.EARTH)); - - for (int i = 0; i < 2; i++) - { + for (int i = 0; i < 2; i++) { conduitRitual.add(new RitualComponent(4, i + 2, 4, RitualComponent.WATER)); conduitRitual.add(new RitualComponent(4, i + 2, -4, RitualComponent.WATER)); conduitRitual.add(new RitualComponent(-4, i + 2, -4, RitualComponent.WATER)); @@ -148,16 +134,14 @@ public class RitualEffectLifeConduit extends RitualEffect conduitRitual.add(new RitualComponent(-6, 0, -5, RitualComponent.FIRE)); conduitRitual.add(new RitualComponent(-5, 0, -6, RitualComponent.FIRE)); - for (int i = 0; i < 2; i++) - { + for (int i = 0; i < 2; i++) { conduitRitual.add(new RitualComponent(6, i, 6, RitualComponent.FIRE)); conduitRitual.add(new RitualComponent(6, i, -6, RitualComponent.FIRE)); conduitRitual.add(new RitualComponent(-6, i, 6, RitualComponent.FIRE)); conduitRitual.add(new RitualComponent(-6, i, -6, RitualComponent.FIRE)); } - for (int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { conduitRitual.add(new RitualComponent(6, i + 2, 6, RitualComponent.BLANK)); conduitRitual.add(new RitualComponent(6, i + 2, -6, RitualComponent.BLANK)); conduitRitual.add(new RitualComponent(-6, i + 2, 6, RitualComponent.BLANK)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java index 4068674f..8eeb57c0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java @@ -1,19 +1,6 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.block.Block; -import net.minecraft.block.BlockOre; -import net.minecraft.block.BlockRedstoneOre; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; @@ -22,49 +9,52 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.ItemType; import WayofTime.alchemicalWizardry.common.block.BlockTeleposer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.BlockOre; +import net.minecraft.block.BlockRedstoneOre; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; -public class RitualEffectMagnetic extends RitualEffect -{ +public class RitualEffectMagnetic extends RitualEffect { private static final int potentiaDrain = 10; private static final int terraeDrain = 10; private static final int orbisTerraeDrain = 10; private static final Map oreBlockCache = new HashMap(); - - public static boolean isBlockOre(Block block, int meta) - { - //Special case for lit redstone ore - if (block instanceof BlockOre || block instanceof BlockRedstoneOre) - return true; - - if (block == null || Item.getItemFromBlock(block) == null) - return false; - + + public static boolean isBlockOre(Block block, int meta) { + // Special case for lit redstone ore + if (block instanceof BlockOre || block instanceof BlockRedstoneOre) return true; + + if (block == null || Item.getItemFromBlock(block) == null) return false; + ItemType type = new ItemType(block, meta); Boolean result = oreBlockCache.get(type); - if (result == null) - { + if (result == null) { result = computeIsItemOre(type); oreBlockCache.put(type, result); } return result; } - - private static boolean computeIsItemOre(ItemType type) - { + + private static boolean computeIsItemOre(ItemType type) { ItemStack itemStack = type.createStack(1); - for (int id : OreDictionary.getOreIDs(itemStack)) - { + for (int id : OreDictionary.getOreIDs(itemStack)) { String oreName = OreDictionary.getOreName(id); - if (oreName.contains("ore")) - return true; + if (oreName.contains("ore")) return true; } return false; } - + @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -75,35 +65,29 @@ public class RitualEffectMagnetic extends RitualEffect boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); - if (world.getWorldTime() % (hasPotentia ? 10 : 40) != 0) - { + if (world.getWorldTime() % (hasPotentia ? 10 : 40) != 0) { return; } boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false); - boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); + boolean hasOrbisTerrae = + this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false); int radius = this.getRadiusForReagents(hasTerrae, hasOrbisTerrae); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { int xRep = 0; int yRep = 0; int zRep = 0; boolean replace = false; outer: - for (int j = 1; j <= 3; j++) - { - for (int i = -1; i <= 1; i++) - { - for (int k = -1; k <= 1; k++) - { - if ((!replace) && world.isAirBlock(x + i, y + j, z + k)) - { + for (int j = 1; j <= 3; j++) { + for (int i = -1; i <= 1; i++) { + for (int k = -1; k <= 1; k++) { + if ((!replace) && world.isAirBlock(x + i, y + j, z + k)) { xRep = x + i; yRep = y + j; zRep = z + k; @@ -114,51 +98,44 @@ public class RitualEffectMagnetic extends RitualEffect } } - if (replace) - { - Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag()); - - int j = y - 1; - int i = 0; - int k = 0; - - if(lastPos != null) - { - j = lastPos.yCoord; - i = Math.min(radius, Math.max(-radius, lastPos.xCoord)); - k = Math.min(radius, Math.max(-radius, lastPos.zCoord)); - } - - while(j >= 0) - { - while(i <= radius) - { - while(k <= radius) - { + if (replace) { + Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag()); + + int j = y - 1; + int i = 0; + int k = 0; + + if (lastPos != null) { + j = lastPos.yCoord; + i = Math.min(radius, Math.max(-radius, lastPos.xCoord)); + k = Math.min(radius, Math.max(-radius, lastPos.zCoord)); + } + + while (j >= 0) { + while (i <= radius) { + while (k <= radius) { Block block = world.getBlock(x + i, j, z + k); int meta = world.getBlockMetadata(x + i, j, z + k); - if (isBlockOre(block, meta)) - { - //Allow swapping code. This means the searched block is an ore. + if (isBlockOre(block, meta)) { + // Allow swapping code. This means the searched block is an ore. BlockTeleposer.swapBlocks(this, world, world, x + i, j, z + k, xRep, yRep, zRep); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); - if (hasPotentia) - { - this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); + if (hasPotentia) { + this.canDrainReagent( + ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } - if (hasTerrae) - { + if (hasTerrae) { this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true); } - if (hasOrbisTerrae) - { - this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true); + if (hasOrbisTerrae) { + this.canDrainReagent( + ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true); } - + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); return; @@ -173,7 +150,7 @@ public class RitualEffectMagnetic extends RitualEffect this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); return; } - + j = y - 1; this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); return; @@ -182,32 +159,26 @@ public class RitualEffectMagnetic extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostMagnetism[1]; } - - public Int3 getLastPosition(NBTTagCompound tag) - { - if(tag != null) - { - return Int3.readFromNBT(tag); - } - - return new Int3(0, 0, 0); + + public Int3 getLastPosition(NBTTagCompound tag) { + if (tag != null) { + return Int3.readFromNBT(tag); + } + + return new Int3(0, 0, 0); } - - public void setLastPosition(NBTTagCompound tag, Int3 pos) - { - if(tag != null) - { - pos.writeToNBT(tag); - } + + public void setLastPosition(NBTTagCompound tag, Int3 pos) { + if (tag != null) { + pos.writeToNBT(tag); + } } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList magneticRitual = new ArrayList(); magneticRitual.add(new RitualComponent(1, 0, 1, RitualComponent.EARTH)); magneticRitual.add(new RitualComponent(1, 0, -1, RitualComponent.EARTH)); @@ -228,24 +199,17 @@ public class RitualEffectMagnetic extends RitualEffect return magneticRitual; } - public int getRadiusForReagents(boolean hasTerrae, boolean hasOrbisTerrae) - { - if (hasTerrae) - { - if (hasOrbisTerrae) - { + public int getRadiusForReagents(boolean hasTerrae, boolean hasOrbisTerrae) { + if (hasTerrae) { + if (hasOrbisTerrae) { return 31; - } else - { + } else { return 7; } - } else - { - if (hasOrbisTerrae) - { + } else { + if (hasOrbisTerrae) { return 12; - } else - { + } else { return 3; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaStalling.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaStalling.java index 046a6561..769cb65f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaStalling.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaStalling.java @@ -1,13 +1,6 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityBeacon; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; @@ -17,12 +10,16 @@ import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityBeacon; +import net.minecraft.world.World; -public class RitualEffectOmegaStalling extends RitualEffect -{ +public class RitualEffectOmegaStalling extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -31,51 +28,45 @@ public class RitualEffectOmegaStalling extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (world.getWorldTime() % 20 != 0) - { + if (world.getWorldTime() % 20 != 0) { return; } - + TileEntity tile = world.getTileEntity(x, y + 5, z); - if(tile instanceof TileEntityBeacon) - { - int levels = ((TileEntityBeacon) tile).getLevels(); - if(levels >= 4) - { - int horizontalRadius = 100; + if (tile instanceof TileEntityBeacon) { + int levels = ((TileEntityBeacon) tile).getLevels(); + if (levels >= 4) { + int horizontalRadius = 100; int verticalRadius = 100; - - List playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, horizontalRadius, verticalRadius); - - for(EntityPlayer player : playerList) - { - if(SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, getCostPerRefresh())) - { - Reagent reagent = APISpellHelper.getPlayerReagentType(player); - OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent); - if(parad != null) - { - float costOffset = parad.getCostPerTickOfUse(player); - parad.setOmegaStalling(player, 100); - SoulNetworkHandler.syphonFromNetwork(owner, (int)(getCostPerRefresh() * Math.min(costOffset, 1))); - } - } + + List playerList = SpellHelper.getPlayersInRange( + world, x + 0.5, y + 0.5, z + 0.5, horizontalRadius, verticalRadius); + + for (EntityPlayer player : playerList) { + if (SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, getCostPerRefresh())) { + Reagent reagent = APISpellHelper.getPlayerReagentType(player); + OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent); + if (parad != null) { + float costOffset = parad.getCostPerTickOfUse(player); + parad.setOmegaStalling(player, 100); + SoulNetworkHandler.syphonFromNetwork( + owner, (int) (getCostPerRefresh() * Math.min(costOffset, 1))); + } + } } - } - } + } + } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostStalling[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList omegaRitual = new ArrayList(); - + this.addCornerRunes(omegaRitual, 1, 0, RitualComponent.FIRE); this.addOffsetRunes(omegaRitual, 2, 1, 0, RitualComponent.DUSK); this.addParallelRunes(omegaRitual, 4, 0, RitualComponent.WATER); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaTest.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaTest.java index 81bf7fe3..d8806f76 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaTest.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectOmegaTest.java @@ -1,18 +1,6 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; @@ -29,15 +17,24 @@ import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; import WayofTime.alchemicalWizardry.common.omega.OmegaStructureHandler; import WayofTime.alchemicalWizardry.common.omega.OmegaStructureParameters; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class RitualEffectOmegaTest extends RitualEffect { + public static final boolean isTesting = false; + public static final int drainTotal = 32 * 1000; -public class RitualEffectOmegaTest extends RitualEffect -{ - public static final boolean isTesting = false; - public static final int drainTotal = 32 * 1000; - @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -46,133 +43,123 @@ public class RitualEffectOmegaTest extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (world.getWorldTime() % 200 != 0) - { + if (world.getWorldTime() % 200 != 0) { return; } - OmegaStructureParameters param = OmegaStructureHandler.getStructureStabilityFactor(world, x, y, z, 5, new Int3(0,1,0)); + OmegaStructureParameters param = + OmegaStructureHandler.getStructureStabilityFactor(world, x, y, z, 5, new Int3(0, 1, 0)); int stab = param.stability; int enchantability = param.enchantability; int enchantmentLevel = param.enchantmentLevel; - - if(stab <= 0) - { - return; + + if (stab <= 0) { + return; } - -// System.out.println("Stability: " + stab + ", Enchantability: " + enchantability + ", Enchantment Level: " + enchantmentLevel); - + + // System.out.println("Stability: " + stab + ", Enchantability: " + enchantability + ", Enchantment + // Level: " + enchantmentLevel); + double range = 0.5; List playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range); - + Reagent reagent = null; - + Map reagentMap = new HashMap(); - for(int i=0; i<4; i++) - { - Int3 jarLoc = this.getJarLocation(i); - TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord); - if(tile instanceof IReagentHandler) - { - IReagentHandler container = (IReagentHandler)tile; - ReagentContainerInfo[] containerInfoArray = container.getContainerInfo(ForgeDirection.UP); - if(containerInfoArray == null) - { - continue; - } - - for(ReagentContainerInfo containerInfo : containerInfoArray) - { - ReagentStack containedReagent = containerInfo.reagent; - if(containedReagent == null) - { - continue; - } - Reagent rea = containedReagent.reagent; - int amt = containedReagent.amount; - if(reagentMap.containsKey(rea)) - { - reagentMap.put(rea, reagentMap.get(rea) + amt); - }else - { - reagentMap.put(rea, amt); - } - } - } - } - - for(Entry entry : reagentMap.entrySet()) - { - if(entry.getValue() >= drainTotal) - { - reagent = entry.getKey(); - break; - } - } - - if(reagent == null) - { - return; - } - - int tickDuration = isTesting ? 20 * 30 : 15 * 20 * 60 + (int)((15 * 20 * 60) * Math.sqrt(stab / 700)); - - int affinity = 0; - - for(EntityPlayer player : playerList) - { - OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent); - if(waterParadigm != null && waterParadigm.convertPlayerArmour(player, x, y, z, stab, affinity, enchantability, enchantmentLevel)) - { - APISpellHelper.setPlayerCurrentReagentAmount(player, tickDuration); - APISpellHelper.setPlayerMaxReagentAmount(player, tickDuration); - APISpellHelper.setPlayerReagentType(player, reagent); - APISpellHelper.setCurrentAdditionalMaxHP(player, waterParadigm.getMaxAdditionalHealth()); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(reagent, APISpellHelper.getPlayerCurrentReagentAmount(player), APISpellHelper.getPlayerMaxReagentAmount(player)), (EntityPlayerMP)player); - - if(!isTesting) - { - int drainLeft = this.drainTotal; - for(int i = 0; i < 4; i++) - { - if(drainLeft <= 0) - { - break; - } - Int3 jarLoc = this.getJarLocation(i); - TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord); - if(tile instanceof IReagentHandler) - { - IReagentHandler container = (IReagentHandler)tile; - ReagentStack drained = container.drain(ForgeDirection.UP, new ReagentStack(reagent, drainLeft), true); - if(drained != null) - { - drainLeft -= drained.amount; - world.markBlockForUpdate(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord); - world.addWeatherEffect(new EntityLightningBolt(world, x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord)); - } - } - } - - ritualStone.setActive(false); - } - - break; - } + for (int i = 0; i < 4; i++) { + Int3 jarLoc = this.getJarLocation(i); + TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord); + if (tile instanceof IReagentHandler) { + IReagentHandler container = (IReagentHandler) tile; + ReagentContainerInfo[] containerInfoArray = container.getContainerInfo(ForgeDirection.UP); + if (containerInfoArray == null) { + continue; + } + + for (ReagentContainerInfo containerInfo : containerInfoArray) { + ReagentStack containedReagent = containerInfo.reagent; + if (containedReagent == null) { + continue; + } + Reagent rea = containedReagent.reagent; + int amt = containedReagent.amount; + if (reagentMap.containsKey(rea)) { + reagentMap.put(rea, reagentMap.get(rea) + amt); + } else { + reagentMap.put(rea, amt); + } + } + } + } + + for (Entry entry : reagentMap.entrySet()) { + if (entry.getValue() >= drainTotal) { + reagent = entry.getKey(); + break; + } + } + + if (reagent == null) { + return; + } + + int tickDuration = isTesting ? 20 * 30 : 15 * 20 * 60 + (int) ((15 * 20 * 60) * Math.sqrt(stab / 700)); + + int affinity = 0; + + for (EntityPlayer player : playerList) { + OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent); + if (waterParadigm != null + && waterParadigm.convertPlayerArmour( + player, x, y, z, stab, affinity, enchantability, enchantmentLevel)) { + APISpellHelper.setPlayerCurrentReagentAmount(player, tickDuration); + APISpellHelper.setPlayerMaxReagentAmount(player, tickDuration); + APISpellHelper.setPlayerReagentType(player, reagent); + APISpellHelper.setCurrentAdditionalMaxHP(player, waterParadigm.getMaxAdditionalHealth()); + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getReagentBarPacket( + reagent, + APISpellHelper.getPlayerCurrentReagentAmount(player), + APISpellHelper.getPlayerMaxReagentAmount(player)), + (EntityPlayerMP) player); + + if (!isTesting) { + int drainLeft = this.drainTotal; + for (int i = 0; i < 4; i++) { + if (drainLeft <= 0) { + break; + } + Int3 jarLoc = this.getJarLocation(i); + TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord); + if (tile instanceof IReagentHandler) { + IReagentHandler container = (IReagentHandler) tile; + ReagentStack drained = + container.drain(ForgeDirection.UP, new ReagentStack(reagent, drainLeft), true); + if (drained != null) { + drainLeft -= drained.amount; + world.markBlockForUpdate(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord); + world.addWeatherEffect(new EntityLightningBolt( + world, x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord)); + } + } + } + + ritualStone.setActive(false); + } + + break; + } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostSymmetry[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList omegaRitual = new ArrayList(); this.addCornerRunes(omegaRitual, 1, 0, RitualComponent.DUSK); this.addCornerRunes(omegaRitual, 2, 0, RitualComponent.DUSK); @@ -186,30 +173,28 @@ public class RitualEffectOmegaTest extends RitualEffect this.addOffsetRunes(omegaRitual, 1, 3, 0, RitualComponent.DUSK); this.addOffsetRunes(omegaRitual, 1, 5, 0, RitualComponent.DUSK); - for(int i=2; i<=4; i++) - { - omegaRitual.add(new RitualComponent(-5, 0, i, RitualComponent.WATER)); - omegaRitual.add(new RitualComponent(-5, 0, -i, RitualComponent.WATER)); - omegaRitual.add(new RitualComponent(5, 0, i, RitualComponent.FIRE)); - omegaRitual.add(new RitualComponent(5, 0, -i, RitualComponent.FIRE)); - omegaRitual.add(new RitualComponent(i, 0, -5, RitualComponent.EARTH)); - omegaRitual.add(new RitualComponent(-i, 0, -5, RitualComponent.EARTH)); - omegaRitual.add(new RitualComponent(i, 0, 5, RitualComponent.AIR)); - omegaRitual.add(new RitualComponent(-i, 0, 5, RitualComponent.AIR)); + for (int i = 2; i <= 4; i++) { + omegaRitual.add(new RitualComponent(-5, 0, i, RitualComponent.WATER)); + omegaRitual.add(new RitualComponent(-5, 0, -i, RitualComponent.WATER)); + omegaRitual.add(new RitualComponent(5, 0, i, RitualComponent.FIRE)); + omegaRitual.add(new RitualComponent(5, 0, -i, RitualComponent.FIRE)); + omegaRitual.add(new RitualComponent(i, 0, -5, RitualComponent.EARTH)); + omegaRitual.add(new RitualComponent(-i, 0, -5, RitualComponent.EARTH)); + omegaRitual.add(new RitualComponent(i, 0, 5, RitualComponent.AIR)); + omegaRitual.add(new RitualComponent(-i, 0, 5, RitualComponent.AIR)); } - - for(int i=2; i<=3; i++) - { - omegaRitual.add(new RitualComponent(4, 0, i, RitualComponent.WATER)); - omegaRitual.add(new RitualComponent(4, 0, -i, RitualComponent.WATER)); - omegaRitual.add(new RitualComponent(-4, 0, i, RitualComponent.FIRE)); - omegaRitual.add(new RitualComponent(-4, 0, -i, RitualComponent.FIRE)); - omegaRitual.add(new RitualComponent(i, 0, 4, RitualComponent.EARTH)); - omegaRitual.add(new RitualComponent(-i, 0, 4, RitualComponent.EARTH)); - omegaRitual.add(new RitualComponent(i, 0, -4, RitualComponent.AIR)); - omegaRitual.add(new RitualComponent(-i, 0, -4, RitualComponent.AIR)); + + for (int i = 2; i <= 3; i++) { + omegaRitual.add(new RitualComponent(4, 0, i, RitualComponent.WATER)); + omegaRitual.add(new RitualComponent(4, 0, -i, RitualComponent.WATER)); + omegaRitual.add(new RitualComponent(-4, 0, i, RitualComponent.FIRE)); + omegaRitual.add(new RitualComponent(-4, 0, -i, RitualComponent.FIRE)); + omegaRitual.add(new RitualComponent(i, 0, 4, RitualComponent.EARTH)); + omegaRitual.add(new RitualComponent(-i, 0, 4, RitualComponent.EARTH)); + omegaRitual.add(new RitualComponent(i, 0, -4, RitualComponent.AIR)); + omegaRitual.add(new RitualComponent(-i, 0, -4, RitualComponent.AIR)); } - + omegaRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR)); omegaRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR)); omegaRitual.add(new RitualComponent(-4, 0, 1, RitualComponent.AIR)); @@ -226,7 +211,7 @@ public class RitualEffectOmegaTest extends RitualEffect omegaRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.WATER)); omegaRitual.add(new RitualComponent(1, 0, -4, RitualComponent.WATER)); omegaRitual.add(new RitualComponent(-1, 0, -4, RitualComponent.WATER)); - + omegaRitual.add(new RitualComponent(-3, 0, 2, RitualComponent.FIRE)); omegaRitual.add(new RitualComponent(-3, 0, -2, RitualComponent.FIRE)); omegaRitual.add(new RitualComponent(3, 0, 2, RitualComponent.WATER)); @@ -235,24 +220,22 @@ public class RitualEffectOmegaTest extends RitualEffect omegaRitual.add(new RitualComponent(2, 0, -3, RitualComponent.AIR)); omegaRitual.add(new RitualComponent(-2, 0, 3, RitualComponent.EARTH)); omegaRitual.add(new RitualComponent(2, 0, 3, RitualComponent.EARTH)); - + return omegaRitual; } - - public Int3 getJarLocation(int i) - { - switch(i) - { - case 0: - return new Int3(-3,0,0); - case 1: - return new Int3(3,0,0); - case 2: - return new Int3(0,0,-3); - case 3: - return new Int3(0,0,3); - default: - return new Int3(0,0,0); - } + + public Int3 getJarLocation(int i) { + switch (i) { + case 0: + return new Int3(-3, 0, 0); + case 1: + return new Int3(3, 0, 0); + case 2: + return new Int3(0, 0, -3); + case 3: + return new Int3(0, 0, 3); + default: + return new Int3(0, 0, 0); + } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSpawnWard.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSpawnWard.java index 2fdf7780..70057c27 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSpawnWard.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSpawnWard.java @@ -7,17 +7,14 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks; import WayofTime.alchemicalWizardry.common.CoordAndRange; -import net.minecraft.world.World; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import net.minecraft.world.World; -public class RitualEffectSpawnWard extends RitualEffect -{ +public class RitualEffectSpawnWard extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -26,32 +23,25 @@ public class RitualEffectSpawnWard extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { int horizRange = 32; int vertRange = 32; int dimension = world.provider.dimensionId; - if (AlchemicalWizardryEventHooks.respawnMap.containsKey(new Integer(dimension))) - { + if (AlchemicalWizardryEventHooks.respawnMap.containsKey(new Integer(dimension))) { List list = AlchemicalWizardryEventHooks.respawnMap.get(new Integer(dimension)); - if (list != null) - { - if (!list.contains(new CoordAndRange(x, y, z, horizRange, vertRange))) - { + if (list != null) { + if (!list.contains(new CoordAndRange(x, y, z, horizRange, vertRange))) { boolean hasFoundAndRemoved = false; - for (CoordAndRange coords : list) - { + for (CoordAndRange coords : list) { int xLocation = coords.xCoord; int yLocation = coords.yCoord; int zLocation = coords.zCoord; - if (xLocation == x && yLocation == y && zLocation == z) - { + if (xLocation == x && yLocation == y && zLocation == z) { list.remove(coords); hasFoundAndRemoved = true; break; @@ -59,39 +49,32 @@ public class RitualEffectSpawnWard extends RitualEffect } list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); } - } else - { + } else { list = new LinkedList(); list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list); } - } else - { + } else { List list = new LinkedList(); list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list); } - SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostSpawnWard[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList wardRitualRitual = new ArrayList(); - for (int i = 2; i <= 4; i++) - { - if (i <= 3) - { + for (int i = 2; i <= 4; i++) { + if (i <= 3) { wardRitualRitual.add(new RitualComponent(0, 0, i, RitualComponent.AIR)); wardRitualRitual.add(new RitualComponent(0, 0, -i, RitualComponent.AIR)); wardRitualRitual.add(new RitualComponent(i, 0, 0, RitualComponent.AIR)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSphereCreator.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSphereCreator.java index 6478abb9..c63ec5ac 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSphereCreator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSphereCreator.java @@ -1,16 +1,6 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; @@ -19,16 +9,23 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.block.BlockTeleposer; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; -public class RitualEffectSphereCreator extends RitualEffect -{ -// private static final int potentiaDrain = 10; - public static int MAX_RADIUS = 32; - private static final int terraeDrain = 1; +public class RitualEffectSphereCreator extends RitualEffect { + // private static final int potentiaDrain = 10; + public static int MAX_RADIUS = 32; + private static final int terraeDrain = 1; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -37,121 +34,103 @@ public class RitualEffectSphereCreator extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); -// boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); + // boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, + // potentiaDrain, false); - if (world.getWorldTime() % 1 != 0) - { + if (world.getWorldTime() % 1 != 0) { return; } - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - TileEntity tile = world.getTileEntity(x, y+1, z); - if(!(tile instanceof IInventory)) - { - return; - } - - int negYOffset = 0; - int radius = 0; - IInventory inv = (IInventory)tile; - - int invSize = inv.getSizeInventory(); - if(invSize < 1) - { - return; - }else - { - if(invSize >= 2) - { - ItemStack invStack2 = inv.getStackInSlot(1); - if(invStack2 != null) - { - negYOffset = invStack2.stackSize; - } - } - - ItemStack invStack1 = inv.getStackInSlot(0); - if(invStack1 == null) - { - return; - } + } else { + TileEntity tile = world.getTileEntity(x, y + 1, z); + if (!(tile instanceof IInventory)) { + return; + } - radius = invStack1.stackSize; + int negYOffset = 0; + int radius = 0; + IInventory inv = (IInventory) tile; + + int invSize = inv.getSizeInventory(); + if (invSize < 1) { + return; + } else { + if (invSize >= 2) { + ItemStack invStack2 = inv.getStackInSlot(1); + if (invStack2 != null) { + negYOffset = invStack2.stackSize; + } + } + + ItemStack invStack1 = inv.getStackInSlot(0); + if (invStack1 == null) { + return; + } + + radius = invStack1.stackSize; } - - if(radius <= 0) - { - return; + + if (radius <= 0) { + return; } - + radius = Math.min(radius, MAX_RADIUS); - - if(negYOffset < radius + 3) - { - negYOffset = radius + 3; + + if (negYOffset < radius + 3) { + negYOffset = radius + 3; } - - Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag(), radius); - - int j = -radius; - int i = -radius; - int k = -radius; - - if(lastPos != null) - { - j = Math.min(radius, Math.max(-radius, lastPos.yCoord)); - i = Math.min(radius, Math.max(-radius, lastPos.xCoord)); - k = Math.min(radius, Math.max(-radius, lastPos.zCoord)); - } - - int yP = y + negYOffset; - int yN = y - negYOffset; - - boolean incrementNext = false; - - - while(i <= radius) - { - while(j <= radius) - { - while(k <= radius) - { - if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) - { - k++; - continue; - } - - if(incrementNext) - { - this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); - return; - } - - Block blk = world.getBlock(x + i, yP + j, z + k); - if (world.isAirBlock(x + i, yN + j, z + k) || (!world.isAirBlock(x + i, yP + j, z + k) && !SpellHelper.isBlockFluid(blk))) - { - - k++; + Int3 lastPos = this.getLastPosition(ritualStone.getCustomRitualTag(), radius); + + int j = -radius; + int i = -radius; + int k = -radius; + + if (lastPos != null) { + j = Math.min(radius, Math.max(-radius, lastPos.yCoord)); + i = Math.min(radius, Math.max(-radius, lastPos.xCoord)); + k = Math.min(radius, Math.max(-radius, lastPos.zCoord)); + } + + int yP = y + negYOffset; + int yN = y - negYOffset; + + boolean incrementNext = false; + + while (i <= radius) { + while (j <= radius) { + while (k <= radius) { + if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) { + k++; continue; } - if(BlockTeleposer.swapBlocks(this, world, world, x + i, yN + j, z + k, x + i, yP + j, z + k, false, 2)) - { + if (incrementNext) { + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); + return; + } + + Block blk = world.getBlock(x + i, yP + j, z + k); + + if (world.isAirBlock(x + i, yN + j, z + k) + || (!world.isAirBlock(x + i, yP + j, z + k) && !SpellHelper.isBlockFluid(blk))) { + + k++; + continue; + } + + if (BlockTeleposer.swapBlocks( + this, world, world, x + i, yN + j, z + k, x + i, yP + j, z + k, false, 2)) { SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); - if(this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true)) - { - world.setBlock(x + i, yN + j, z + k, Blocks.dirt, 0, 2); - } + if (this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true)) { + world.setBlock(x + i, yN + j, z + k, Blocks.dirt, 0, 2); + } } - + this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); - + incrementNext = true; k++; @@ -161,43 +140,37 @@ public class RitualEffectSphereCreator extends RitualEffect } j = -radius; i++; -// this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); -// return; + // this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); + // return; } - + ritualStone.setActive(false); this.setLastPosition(ritualStone.getCustomRitualTag(), new Int3(i, j, k)); } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostSphereIsland[1]; } - - public Int3 getLastPosition(NBTTagCompound tag, int radius) - { - if(tag != null && tag.getBoolean("hasWorked")) - { - return Int3.readFromNBT(tag); - } - - return new Int3(-radius, -radius, -radius); + + public Int3 getLastPosition(NBTTagCompound tag, int radius) { + if (tag != null && tag.getBoolean("hasWorked")) { + return Int3.readFromNBT(tag); + } + + return new Int3(-radius, -radius, -radius); } - - public void setLastPosition(NBTTagCompound tag, Int3 pos) - { - if(tag != null) - { - pos.writeToNBT(tag); - tag.setBoolean("hasWorked", true); - } + + public void setLastPosition(NBTTagCompound tag, Int3 pos) { + if (tag != null) { + pos.writeToNBT(tag); + tag.setBoolean("hasWorked", true); + } } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList magneticRitual = new ArrayList(); magneticRitual.add(new RitualComponent(1, 0, 1, RitualComponent.EARTH)); magneticRitual.add(new RitualComponent(1, 0, -1, RitualComponent.EARTH)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSummonMeteor.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSummonMeteor.java index ac647ed6..c3c7748f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSummonMeteor.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSummonMeteor.java @@ -9,6 +9,8 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; @@ -16,14 +18,9 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectSummonMeteor extends RitualEffect -{ +public class RitualEffectSummonMeteor extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -36,10 +33,10 @@ public class RitualEffectSummonMeteor extends RitualEffect ritualStone.setCooldown(0); } - List entities = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1)); + List entities = world.getEntitiesWithinAABB( + EntityItem.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1)); - if (entities == null) - return; + if (entities == null) return; for (EntityItem entityItem : entities) { if (entityItem != null && MeteorRegistry.isValidParadigmItem(entityItem.getEntityItem())) { @@ -48,8 +45,7 @@ public class RitualEffectSummonMeteor extends RitualEffect if (currentEssence < cost) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner != null) - entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); + if (entityOwner != null) entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); return; } @@ -82,14 +78,12 @@ public class RitualEffectSummonMeteor extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostFallingTower[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList meteorRitual = new ArrayList(); meteorRitual.add(new RitualComponent(2, 0, 0, RitualComponent.FIRE)); meteorRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.FIRE)); @@ -124,8 +118,7 @@ public class RitualEffectSummonMeteor extends RitualEffect meteorRitual.add(new RitualComponent(4, 0, 4, RitualComponent.DUSK)); meteorRitual.add(new RitualComponent(4, 0, -4, RitualComponent.DUSK)); - for (int i = 4; i <= 6; i++) - { + for (int i = 4; i <= 6; i++) { meteorRitual.add(new RitualComponent(i, 0, 0, RitualComponent.EARTH)); meteorRitual.add(new RitualComponent(-i, 0, 0, RitualComponent.EARTH)); meteorRitual.add(new RitualComponent(0, 0, i, RitualComponent.EARTH)); @@ -165,8 +158,7 @@ public class RitualEffectSummonMeteor extends RitualEffect meteorRitual.add(new RitualComponent(0, 4, 5, RitualComponent.AIR)); meteorRitual.add(new RitualComponent(0, 4, -5, RitualComponent.AIR)); - for (int i = -1; i <= 1; i++) - { + for (int i = -1; i <= 1; i++) { meteorRitual.add(new RitualComponent(i, 4, 4, RitualComponent.AIR)); meteorRitual.add(new RitualComponent(i, 4, -4, RitualComponent.AIR)); meteorRitual.add(new RitualComponent(4, 4, i, RitualComponent.AIR)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSupression.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSupression.java index 73c48824..7be7fea5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSupression.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectSupression.java @@ -8,6 +8,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; @@ -15,17 +17,12 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectSupression extends RitualEffect -{ +public class RitualEffectSupression extends RitualEffect { public static final int aquasalusDrain = 15; public static final int aetherDrain = 15; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -36,7 +33,8 @@ public class RitualEffectSupression extends RitualEffect Block blockish = world.getBlock(x, y - 1, z); - boolean hasAquasalus = this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false); + boolean hasAquasalus = + this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false); boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false); int costMod = this.getCostModifier(blockish); @@ -46,47 +44,36 @@ public class RitualEffectSupression extends RitualEffect int yIndex = (int) (world.getWorldTime() % (2 * radius + 1)) - radius; boolean expansion = false; - if (ritualStone.getVar1() < (radius + 1)) - { + if (ritualStone.getVar1() < (radius + 1)) { expansion = true; radius = ritualStone.getVar1(); ritualStone.setVar1(ritualStone.getVar1() + 1); } - if (currentEssence < this.getCostPerRefresh() * costMod) - { + if (currentEssence < this.getCostPerRefresh() * costMod) { EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner); - if (entityOwner == null) - { + if (entityOwner == null) { return; } entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); - } else - { - for (int i = -radius; i <= radius; i++) - { - for (int j = (expansion ? -radius : yIndex); j <= (expansion ? radius : yIndex); j++) - { - for (int k = -radius; k <= radius; k++) - { - if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) - { + } else { + for (int i = -radius; i <= radius; i++) { + for (int j = (expansion ? -radius : yIndex); j <= (expansion ? radius : yIndex); j++) { + for (int k = -radius; k <= radius; k++) { + if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) { continue; } Block block = world.getBlock(x + i, y + j, z + k); - - if (SpellHelper.isBlockFluid(block)) - { - TESpectralContainer.createSpectralBlockAtLocation(world, x + i, y + j, z + k, 3 * masterRadius); - } else - { + if (SpellHelper.isBlockFluid(block)) { + TESpectralContainer.createSpectralBlockAtLocation( + world, x + i, y + j, z + k, 3 * masterRadius); + } else { TileEntity tile = world.getTileEntity(x + i, y + j, z + k); - if (tile instanceof TESpectralContainer) - { + if (tile instanceof TESpectralContainer) { ((TESpectralContainer) tile).resetDuration(3 * masterRadius); } } @@ -94,17 +81,13 @@ public class RitualEffectSupression extends RitualEffect } } - SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * costMod); - if (world.getWorldTime() % 100 == 0) - { - if (hasAquasalus) - { + if (world.getWorldTime() % 100 == 0) { + if (hasAquasalus) { this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true); } - if (hasAether) - { + if (hasAether) { this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true); } } @@ -112,14 +95,12 @@ public class RitualEffectSupression extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostSuppression[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList supressionRitual = new ArrayList(); supressionRitual.add(new RitualComponent(2, 0, 2, RitualComponent.WATER)); supressionRitual.add(new RitualComponent(2, 0, -2, RitualComponent.WATER)); @@ -136,29 +117,21 @@ public class RitualEffectSupression extends RitualEffect return supressionRitual; } - public int getCostModifier(Block block) - { + public int getCostModifier(Block block) { return 1; } - public int getRadiusForReagents(boolean hasAether, boolean hasAquasalus) - { - if (hasAether) - { - if (hasAquasalus) - { + public int getRadiusForReagents(boolean hasAether, boolean hasAquasalus) { + if (hasAether) { + if (hasAquasalus) { return 30; - } else - { + } else { return 20; } - } else - { - if (hasAquasalus) - { + } else { + if (hasAquasalus) { return 15; - } else - { + } else { return 10; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectUnbinding.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectUnbinding.java index c30bb8ed..5037e110 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectUnbinding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectUnbinding.java @@ -13,22 +13,18 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; 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.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -public class RitualEffectUnbinding extends RitualEffect -{ +public class RitualEffectUnbinding extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -37,35 +33,34 @@ public class RitualEffectUnbinding extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { 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; boolean drain = false; - while (iterator.hasNext()) - { + while (iterator.hasNext()) { final int sanctusDrain = 1000; item = (EntityItem) iterator.next(); ItemStack itemStack = item.getEntityItem(); - if (itemStack == null) - { + if (itemStack == null) { continue; } - boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); - if (hasSanctus) - { - if (itemStack.getItem() instanceof IBindable && !EnergyItems.getOwnerName(itemStack).equals("")) - { + boolean hasSanctus = + this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); + if (hasSanctus) { + if (itemStack.getItem() instanceof IBindable + && !EnergyItems.getOwnerName(itemStack).equals("")) { world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z - 5)); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z + 5)); world.addWeatherEffect(new EntityLightningBolt(world, x - 5, y + 1, z)); @@ -79,72 +74,56 @@ public class RitualEffectUnbinding extends RitualEffect } } - if (itemStack.getItem() == ModItems.boundHelmet) - { + if (itemStack.getItem() == ModItems.boundHelmet) { ritualStone.setVar1(5); - } else if (itemStack.getItem() == ModItems.boundPlate) - { + } else if (itemStack.getItem() == ModItems.boundPlate) { ritualStone.setVar1(8); - } else if (itemStack.getItem() == ModItems.boundLeggings) - { + } else if (itemStack.getItem() == ModItems.boundLeggings) { ritualStone.setVar1(7); - } else if (itemStack.getItem() == ModItems.boundBoots) - { + } else if (itemStack.getItem() == ModItems.boundBoots) { ritualStone.setVar1(4); - } - else if (UnbindingRegistry.isRequiredItemValid(itemStack)) - { + } else if (UnbindingRegistry.isRequiredItemValid(itemStack)) { ritualStone.setVar1(UnbindingRegistry.getIndexForItem(itemStack) + 9); } - if (ritualStone.getVar1() > 0 && ritualStone.getVar1() <= 8) - { + if (ritualStone.getVar1() > 0 && ritualStone.getVar1() <= 8) { item.setDead(); doLightning(world, x, y, z); ItemStack[] inv = ((BoundArmour) itemStack.getItem()).getInternalInventory(itemStack); int bloodSockets = 0; - if (itemStack.getItem() == ModItems.boundHelmet) - { + if (itemStack.getItem() == ModItems.boundHelmet) { bloodSockets = 5; - } else if (itemStack.getItem() == ModItems.boundPlate) - { + } else if (itemStack.getItem() == ModItems.boundPlate) { bloodSockets = 8; - } else if (itemStack.getItem() == ModItems.boundLeggings) - { + } else if (itemStack.getItem() == ModItems.boundLeggings) { bloodSockets = 7; - } else if (itemStack.getItem() == ModItems.boundBoots) - { + } else if (itemStack.getItem() == ModItems.boundBoots) { bloodSockets = 4; } - if (inv != null) - { - for (ItemStack internalItem : inv) - { - if (internalItem != null) - { + if (inv != null) { + for (ItemStack internalItem : inv) { + if (internalItem != null) { doLightning(world, x, y, z); - EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, internalItem.copy()); + EntityItem newItem = + new EntityItem(world, x + 0.5, y + 1, z + 0.5, internalItem.copy()); world.spawnEntityInWorld(newItem); } } } - EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, new ItemStack(ModBlocks.bloodSocket, bloodSockets)); + EntityItem newItem = new EntityItem( + world, x + 0.5, y + 1, z + 0.5, new ItemStack(ModBlocks.bloodSocket, bloodSockets)); world.spawnEntityInWorld(newItem); ritualStone.setActive(false); drain = true; break; - } - else if (ritualStone.getVar1() >= 9) - { + } else if (ritualStone.getVar1() >= 9) { item.setDead(); doLightning(world, x, y, z); List spawnedItem = UnbindingRegistry.getOutputForIndex(ritualStone.getVar1() - 9); - if (spawnedItem != null) - { - for (ItemStack itemStack1 : spawnedItem) - { + if (spawnedItem != null) { + for (ItemStack itemStack1 : spawnedItem) { EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, itemStack1.copy()); world.spawnEntityInWorld(newItem); } @@ -154,7 +133,6 @@ public class RitualEffectUnbinding extends RitualEffect drain = true; break; } - } if (drain) { @@ -162,14 +140,12 @@ public class RitualEffectUnbinding extends RitualEffect } } - if (world.rand.nextInt(10) == 0) - { + if (world.rand.nextInt(10) == 0) { SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 1, x, y, z); } } - private void doLightning(World world, int x, int y, int z) - { + private void doLightning(World world, int x, int y, int z) { world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z - 5)); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z + 5)); world.addWeatherEffect(new EntityLightningBolt(world, x - 5, y + 1, z)); @@ -177,14 +153,12 @@ public class RitualEffectUnbinding extends RitualEffect } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostUnbinding[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList unbindingRitual = new ArrayList(); unbindingRitual.add(new RitualComponent(-2, 0, 0, 4)); unbindingRitual.add(new RitualComponent(2, 0, 0, 4)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectVeilOfEvil.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectVeilOfEvil.java index 133ce006..5d200b7c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectVeilOfEvil.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectVeilOfEvil.java @@ -7,17 +7,14 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks; import WayofTime.alchemicalWizardry.common.CoordAndRange; -import net.minecraft.world.World; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import net.minecraft.world.World; -public class RitualEffectVeilOfEvil extends RitualEffect -{ +public class RitualEffectVeilOfEvil extends RitualEffect { @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -26,32 +23,25 @@ public class RitualEffectVeilOfEvil extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (currentEssence < this.getCostPerRefresh()) - { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { + } else { int horizRange = 32; int vertRange = 32; int dimension = world.provider.dimensionId; - if (AlchemicalWizardryEventHooks.forceSpawnMap.containsKey(new Integer(dimension))) - { + if (AlchemicalWizardryEventHooks.forceSpawnMap.containsKey(new Integer(dimension))) { List list = AlchemicalWizardryEventHooks.forceSpawnMap.get(new Integer(dimension)); - if (list != null) - { - if (!list.contains(new CoordAndRange(x, y, z, horizRange, vertRange))) - { + if (list != null) { + if (!list.contains(new CoordAndRange(x, y, z, horizRange, vertRange))) { boolean hasFoundAndRemoved = false; - for (CoordAndRange coords : list) - { + for (CoordAndRange coords : list) { int xLocation = coords.xCoord; int yLocation = coords.yCoord; int zLocation = coords.zCoord; - if (xLocation == x && yLocation == y && zLocation == z) - { + if (xLocation == x && yLocation == y && zLocation == z) { list.remove(coords); hasFoundAndRemoved = true; break; @@ -59,33 +49,28 @@ public class RitualEffectVeilOfEvil extends RitualEffect } list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); } - } else - { + } else { list = new LinkedList(); list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list); } - } else - { + } else { List list = new LinkedList(); list.add(new CoordAndRange(x, y, z, horizRange, vertRange)); AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list); } - SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostVeilOfEvil[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList veilRitual = new ArrayList(); veilRitual.add(new RitualComponent(1, 0, 2, RitualComponent.DUSK)); @@ -102,8 +87,7 @@ public class RitualEffectVeilOfEvil extends RitualEffect veilRitual.add(new RitualComponent(3, 0, -3, RitualComponent.FIRE)); veilRitual.add(new RitualComponent(-3, 0, -3, RitualComponent.FIRE)); - for (int i = 0; i <= 1; i++) - { + for (int i = 0; i <= 1; i++) { veilRitual.add(new RitualComponent((4 + i), i, 0, RitualComponent.DUSK)); veilRitual.add(new RitualComponent((4 + i), i, -1, RitualComponent.BLANK)); veilRitual.add(new RitualComponent((4 + i), i, 1, RitualComponent.BLANK)); @@ -137,4 +121,4 @@ public class RitualEffectVeilOfEvil extends RitualEffect return veilRitual; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWater.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWater.java index f5a29dfd..aa3eaafd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWater.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWater.java @@ -8,6 +8,8 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -21,19 +23,14 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -import java.util.ArrayList; -import java.util.List; - -public class RitualEffectWater extends RitualEffect -{ +public class RitualEffectWater extends RitualEffect { public static final int aquasalusDrain = 5; public static final int offensaDrain = 20; public static final int sanctusDrain = 5; public static final int reductusDrain = 2; public static final int crystallosDrain = 10; - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -42,23 +39,20 @@ public class RitualEffectWater extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); - boolean hasAquasalus = this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false); + boolean hasCrystallos = + this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); + boolean hasAquasalus = + this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false); boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false); - if (hasAquasalus) - { + if (hasAquasalus) { int hydrationRange = 4; int vertRange = 3; - for (int i = -hydrationRange; i <= hydrationRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -hydrationRange; k <= hydrationRange; k++) - { - if (SpellHelper.hydrateSoil(world, x + i, y + j, z + k)) - { + for (int i = -hydrationRange; i <= hydrationRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -hydrationRange; k <= hydrationRange; k++) { + if (SpellHelper.hydrateSoil(world, x + i, y + j, z + k)) { this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true); } } @@ -66,30 +60,26 @@ public class RitualEffectWater extends RitualEffect } } - if (hasOffensa) - { - boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); + if (hasOffensa) { + boolean hasReductus = + this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false); boolean drainReductus = world.getWorldTime() % 100 == 0; int range = 10; List list = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range); - for (Entity entity : list) - { - if (entity instanceof EntityLivingBase) - { + for (Entity entity : list) { + if (entity instanceof EntityLivingBase) { EntityLivingBase livingEntity = (EntityLivingBase) entity; - if (livingEntity == SpellHelper.getPlayerForUsername(owner)) - { + if (livingEntity == SpellHelper.getPlayerForUsername(owner)) { continue; } - if (hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false)) - { - if (livingEntity instanceof EntityPlayer) - { - if (drainReductus) - { + if (hasReductus + && this.canDrainReagent( + ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false)) { + if (livingEntity instanceof EntityPlayer) { + if (drainReductus) { this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true); } @@ -97,9 +87,9 @@ public class RitualEffectWater extends RitualEffect } } - if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionDrowning)) - { - livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 0)); + if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionDrowning)) { + livingEntity.addPotionEffect( + new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, 0)); this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true); } } @@ -108,34 +98,28 @@ public class RitualEffectWater extends RitualEffect Block block = world.getBlock(x, y + 1, z); - if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer)) - { - if (currentEssence < this.getCostPerRefresh()) - { + if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer)) { + if (currentEssence < this.getCostPerRefresh()) { SoulNetworkHandler.causeNauseaToPlayer(owner); - } else - { - for (int i = 0; i < 10; i++) - { - SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z); + } else { + for (int i = 0; i < 10; i++) { + SpellHelper.sendIndexedParticleToAllAround( + world, x, y, z, 20, world.provider.dimensionId, 3, x, y, z); } world.setBlock(x, y + 1, z, Blocks.water, 0, 3); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); } - } else - { + } else { boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false); - if (!hasSanctus) - { + if (!hasSanctus) { return; } TileEntity tile = world.getTileEntity(x, y + 1, z); - if (tile instanceof IFluidHandler) - { - int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), false); - if (amount >= 1000) - { + if (tile instanceof IFluidHandler) { + int amount = ((IFluidHandler) tile) + .fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), false); + if (amount >= 1000) { ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), true); this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true); @@ -145,34 +129,30 @@ public class RitualEffectWater extends RitualEffect } } - if (hasCrystallos) - { + if (hasCrystallos) { int range = 2; - for (int i = -range; i <= range; i++) - { - for (int j = -range; j <= range; j++) - { - for (int k = -range; k <= range; k++) - { - hasCrystallos = hasCrystallos && this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); + for (int i = -range; i <= range; i++) { + for (int j = -range; j <= range; j++) { + for (int k = -range; k <= range; k++) { + hasCrystallos = hasCrystallos + && this.canDrainReagent( + ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false); - if (hasCrystallos) - { + if (hasCrystallos) { boolean success = false; - if (!world.isAirBlock(x + i, y + j, z + k) && SpellHelper.freezeWaterBlock(world, x + i, y + j, z + k)) - { + if (!world.isAirBlock(x + i, y + j, z + k) + && SpellHelper.freezeWaterBlock(world, x + i, y + j, z + k)) { success = true; - } else - { - if (world.rand.nextInt(100) == 0 && world.isSideSolid(x + i, y + j - 1, z + k, ForgeDirection.UP)) - { + } else { + if (world.rand.nextInt(100) == 0 + && world.isSideSolid(x + i, y + j - 1, z + k, ForgeDirection.UP)) { success = true; } } - if (success) - { - this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true); + if (success) { + this.canDrainReagent( + ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true); } } } @@ -181,14 +161,12 @@ public class RitualEffectWater extends RitualEffect } } - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostWater[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList waterRitual = new ArrayList(); waterRitual.add(new RitualComponent(-1, 0, 1, 1)); waterRitual.add(new RitualComponent(-1, 0, -1, 1)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java index f910ad45..4c116a7d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java @@ -1,8 +1,5 @@ package WayofTime.alchemicalWizardry.common.rituals; -import java.util.ArrayList; -import java.util.List; - import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; @@ -10,14 +7,15 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class RitualEffectWellOfSuffering extends RitualEffect -{ +public class RitualEffectWellOfSuffering extends RitualEffect { public static final int timeDelay = 25; public static final int amount = AlchemicalWizardry.lpPerSacrificeWellOfSuffering; @@ -26,8 +24,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect private static final int offensaDrain = 3; @Override - public void performEffect(IMasterRitualStone ritualStone) - { + public void performEffect(IMasterRitualStone ritualStone) { String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -36,22 +33,17 @@ public class RitualEffectWellOfSuffering extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if (world.getWorldTime() % this.timeDelay != 0) - { + if (world.getWorldTime() % this.timeDelay != 0) { return; } IBloodAltar tileAltar = null; boolean testFlag = false; - for (int i = -5; i <= 5; i++) - { - for (int j = -5; j <= 5; j++) - { - for (int k = -10; k <= 10; k++) - { - if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) - { + for (int i = -5; i <= 5; i++) { + for (int j = -5; j <= 5; j++) { + for (int k = -10; k <= 10; k++) { + if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) { tileAltar = (IBloodAltar) world.getTileEntity(x + i, y + k, z + j); testFlag = true; } @@ -59,8 +51,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect } } - if (!testFlag) - { + if (!testFlag) { return; } @@ -68,31 +59,32 @@ public class RitualEffectWellOfSuffering 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); int entityCount = 0; - boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false); + boolean hasTennebrae = + this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false); boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false); - 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; } - hasOffensa = hasOffensa && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true); - - if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, hasOffensa ? 2 : 1)) - { - hasTennebrae = hasTennebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true); + hasOffensa = hasOffensa + && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true); + if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, hasOffensa ? 2 : 1)) { + hasTennebrae = hasTennebrae + && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true); entityCount++; tileAltar.sacrificialDaggerCall(this.amount * (hasTennebrae ? 2 : 1) * (hasOffensa ? 2 : 1), true); @@ -101,22 +93,19 @@ public class RitualEffectWellOfSuffering extends RitualEffect SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount); - if(hasPotentia) - { - this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); + if (hasPotentia) { + this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); } } } @Override - public int getCostPerRefresh() - { + public int getCostPerRefresh() { return AlchemicalWizardry.ritualCostSuffering[1]; } @Override - public List getRitualComponentList() - { + public List getRitualComponentList() { ArrayList wellOfSufferingRitual = new ArrayList(); wellOfSufferingRitual.add(new RitualComponent(1, 0, 1, RitualComponent.FIRE)); wellOfSufferingRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.FIRE)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicIgnMeta.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicIgnMeta.java index 7fb2f489..a41943af 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicIgnMeta.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicIgnMeta.java @@ -3,11 +3,9 @@ package WayofTime.alchemicalWizardry.common.routing; import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; import net.minecraft.item.ItemStack; -public class RoutingFocusLogicIgnMeta extends RoutingFocusLogic -{ - @Override - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() : false); - } +public class RoutingFocusLogicIgnMeta extends RoutingFocusLogic { + @Override + public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) { + return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() : false); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimit.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimit.java index 26fb3495..1f479cec 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimit.java @@ -3,10 +3,8 @@ package WayofTime.alchemicalWizardry.common.routing; import WayofTime.alchemicalWizardry.api.ILimitingLogic; import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; -public class RoutingFocusLogicLimit extends RoutingFocusLogic implements ILimitingLogic -{ - public int getRoutingLimit() - { - return 0; - } +public class RoutingFocusLogicLimit extends RoutingFocusLogic implements ILimitingLogic { + public int getRoutingLimit() { + return 0; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitDefault.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitDefault.java index 7c485ef9..8adabbd6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitDefault.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitDefault.java @@ -1,26 +1,21 @@ package WayofTime.alchemicalWizardry.common.routing; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.common.items.routing.ILimitedRoutingFocus; +import net.minecraft.item.ItemStack; -public class RoutingFocusLogicLimitDefault extends RoutingFocusLogicLimit -{ - public int limit = 0; - - public RoutingFocusLogicLimitDefault(ItemStack stack) - { - if(stack != null && stack.getItem() instanceof ILimitedRoutingFocus) - { - limit = ((ILimitedRoutingFocus)stack.getItem()).getRoutingFocusLimit(stack); - }else - { - limit = 0; - } - } - - @Override - public int getRoutingLimit() - { - return limit; - } +public class RoutingFocusLogicLimitDefault extends RoutingFocusLogicLimit { + public int limit = 0; + + public RoutingFocusLogicLimitDefault(ItemStack stack) { + if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) { + limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack); + } else { + limit = 0; + } + } + + @Override + public int getRoutingLimit() { + return limit; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitGlobal.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitGlobal.java index 0e370db0..73bc4297 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitGlobal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitGlobal.java @@ -1,32 +1,26 @@ package WayofTime.alchemicalWizardry.common.routing; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.common.items.routing.ILimitedRoutingFocus; +import net.minecraft.item.ItemStack; -public class RoutingFocusLogicLimitGlobal extends RoutingFocusLogicLimit -{ - public int limit = 0; - - public RoutingFocusLogicLimitGlobal(ItemStack stack) - { - if(stack != null && stack.getItem() instanceof ILimitedRoutingFocus) - { - limit = ((ILimitedRoutingFocus)stack.getItem()).getRoutingFocusLimit(stack); - }else - { - limit = 0; - } - } - - @Override - public int getRoutingLimit() - { - return limit; - } - - @Override - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - return true; - } -} \ No newline at end of file +public class RoutingFocusLogicLimitGlobal extends RoutingFocusLogicLimit { + public int limit = 0; + + public RoutingFocusLogicLimitGlobal(ItemStack stack) { + if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) { + limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack); + } else { + limit = 0; + } + } + + @Override + public int getRoutingLimit() { + return limit; + } + + @Override + public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) { + return true; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitIgnMeta.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitIgnMeta.java index 74124d9e..827eda11 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitIgnMeta.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitIgnMeta.java @@ -1,27 +1,22 @@ package WayofTime.alchemicalWizardry.common.routing; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.api.ILimitingLogic; import WayofTime.alchemicalWizardry.common.items.routing.ILimitedRoutingFocus; +import net.minecraft.item.ItemStack; -public class RoutingFocusLogicLimitIgnMeta extends RoutingFocusLogicIgnMeta implements ILimitingLogic -{ - public int limit = 0; - - public RoutingFocusLogicLimitIgnMeta(ItemStack stack) - { - if(stack != null && stack.getItem() instanceof ILimitedRoutingFocus) - { - limit = ((ILimitedRoutingFocus)stack.getItem()).getRoutingFocusLimit(stack); - }else - { - limit = 0; - } - } - - @Override - public int getRoutingLimit() - { - return limit; - } +public class RoutingFocusLogicLimitIgnMeta extends RoutingFocusLogicIgnMeta implements ILimitingLogic { + public int limit = 0; + + public RoutingFocusLogicLimitIgnMeta(ItemStack stack) { + if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) { + limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack); + } else { + limit = 0; + } + } + + @Override + public int getRoutingLimit() { + return limit; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitMatchNBT.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitMatchNBT.java index f7887a01..e3fe2c5b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitMatchNBT.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitMatchNBT.java @@ -1,27 +1,22 @@ package WayofTime.alchemicalWizardry.common.routing; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.api.ILimitingLogic; import WayofTime.alchemicalWizardry.common.items.routing.ILimitedRoutingFocus; +import net.minecraft.item.ItemStack; -public class RoutingFocusLogicLimitMatchNBT extends RoutingFocusLogicMatchNBT implements ILimitingLogic -{ - public int limit = 0; - - public RoutingFocusLogicLimitMatchNBT(ItemStack stack) - { - if(stack != null && stack.getItem() instanceof ILimitedRoutingFocus) - { - limit = ((ILimitedRoutingFocus)stack.getItem()).getRoutingFocusLimit(stack); - }else - { - limit = 0; - } - } - - @Override - public int getRoutingLimit() - { - return limit; - } -} \ No newline at end of file +public class RoutingFocusLogicLimitMatchNBT extends RoutingFocusLogicMatchNBT implements ILimitingLogic { + public int limit = 0; + + public RoutingFocusLogicLimitMatchNBT(ItemStack stack) { + if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) { + limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack); + } else { + limit = 0; + } + } + + @Override + public int getRoutingLimit() { + return limit; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitModItems.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitModItems.java index 907e925c..9438abba 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicLimitModItems.java @@ -1,27 +1,22 @@ package WayofTime.alchemicalWizardry.common.routing; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.api.ILimitingLogic; import WayofTime.alchemicalWizardry.common.items.routing.ILimitedRoutingFocus; +import net.minecraft.item.ItemStack; -public class RoutingFocusLogicLimitModItems extends RoutingFocusLogicModItems implements ILimitingLogic -{ - public int limit = 0; - - public RoutingFocusLogicLimitModItems(ItemStack stack) - { - if(stack != null && stack.getItem() instanceof ILimitedRoutingFocus) - { - limit = ((ILimitedRoutingFocus)stack.getItem()).getRoutingFocusLimit(stack); - }else - { - limit = 0; - } - } - - @Override - public int getRoutingLimit() - { - return limit; - } -} \ No newline at end of file +public class RoutingFocusLogicLimitModItems extends RoutingFocusLogicModItems implements ILimitingLogic { + public int limit = 0; + + public RoutingFocusLogicLimitModItems(ItemStack stack) { + if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) { + limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack); + } else { + limit = 0; + } + } + + @Override + public int getRoutingLimit() { + return limit; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicMatchNBT.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicMatchNBT.java index 382511b1..74267741 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicMatchNBT.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicMatchNBT.java @@ -3,16 +3,20 @@ package WayofTime.alchemicalWizardry.common.routing; import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; import net.minecraft.item.ItemStack; -public class RoutingFocusLogicMatchNBT extends RoutingFocusLogic -{ - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() && (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage() : true) && keyStack.areItemStackTagsEqual(keyStack, checkedStack) : false); - } - - @Override - public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) - { - return previous && this.getDefaultMatch(keyStack, checkedStack); - } +public class RoutingFocusLogicMatchNBT extends RoutingFocusLogic { + public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) { + return (keyStack != null + ? checkedStack != null + && keyStack.getItem() == checkedStack.getItem() + && (keyStack.getItem().getHasSubtypes() + ? keyStack.getItemDamage() == checkedStack.getItemDamage() + : true) + && keyStack.areItemStackTagsEqual(keyStack, checkedStack) + : false); + } + + @Override + public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) { + return previous && this.getDefaultMatch(keyStack, checkedStack); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicModItems.java b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicModItems.java index dd37a1ac..508742b9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/routing/RoutingFocusLogicModItems.java @@ -1,37 +1,31 @@ package WayofTime.alchemicalWizardry.common.routing; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; import cpw.mods.fml.common.registry.GameData; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; -public class RoutingFocusLogicModItems extends RoutingFocusLogic -{ - @Override - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - if(keyStack != null && checkedStack != null && keyStack.getItem() != null && checkedStack.getItem() != null) - { - String keyId = getModID(keyStack.getItem()); - String checkedId = getModID(checkedStack.getItem()); - return keyId.equals(checkedId); - } - - return false; - } - - public String getModID(Item itm) - { - String str = GameData.getItemRegistry().getNameForObject(itm); - if(!str.isEmpty()) - { - String[] strs = str.split(":"); - if(strs != null && strs.length >= 1) - { - return strs[0]; - } - } - - return ""; - } +public class RoutingFocusLogicModItems extends RoutingFocusLogic { + @Override + public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) { + if (keyStack != null && checkedStack != null && keyStack.getItem() != null && checkedStack.getItem() != null) { + String keyId = getModID(keyStack.getItem()); + String checkedId = getModID(checkedStack.getItem()); + return keyId.equals(checkedId); + } + + return false; + } + + public String getModID(Item itm) { + String str = GameData.getItemRegistry().getNameForObject(itm); + if (!str.isEmpty()) { + String[] strs = str.split(":"); + if (strs != null && strs.length >= 1) { + return strs[0]; + } + } + + return ""; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/OutputRoutingFocusModItems.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/OutputRoutingFocusModItems.java index 334cd450..6a4f1a7c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/OutputRoutingFocusModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/OutputRoutingFocusModItems.java @@ -4,16 +4,13 @@ import WayofTime.alchemicalWizardry.api.RoutingFocusLogic; import WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus; import WayofTime.alchemicalWizardry.common.routing.RoutingFocusLogicModItems; -public class OutputRoutingFocusModItems extends OutputRoutingFocus -{ - @Override - public String getFocusDescription() - { - return "Only accepts items that are the same modID"; - } - - public RoutingFocusLogic getLogic() - { - return new RoutingFocusLogicModItems(); - } +public class OutputRoutingFocusModItems extends OutputRoutingFocus { + @Override + public String getFocusDescription() { + return "Only accepts items that are the same modID"; + } + + public RoutingFocusLogic getLogic() { + return new RoutingFocusLogicModItems(); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java index e11b898e..d3a228c5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java @@ -1,11 +1,19 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; +import WayofTime.alchemicalWizardry.api.items.interfaces.ILPGauge; +import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; +import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination; +import cpw.mods.fml.common.FMLCommonHandler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.regex.Pattern; - import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.enchantment.Enchantment; @@ -43,96 +51,80 @@ import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.oredict.OreDictionary; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; -import WayofTime.alchemicalWizardry.api.items.interfaces.ILPGauge; -import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.common.NewPacketHandler; -import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination; -import cpw.mods.fml.common.FMLCommonHandler; -public class SpellHelper -{ +public class SpellHelper { public static Random rand = new Random(); public static final double root2 = Math.sqrt(2); - public static boolean canEntityBeSeen(Entity entity, Entity entity2) - { - return entity.worldObj.rayTraceBlocks(SpellHelper.createVec3(entity.posX, entity.posY, entity.posZ), SpellHelper.createVec3(entity2.posX, entity2.posY, entity2.posZ), false) == null; + public static boolean canEntityBeSeen(Entity entity, Entity entity2) { + return entity.worldObj.rayTraceBlocks( + SpellHelper.createVec3(entity.posX, entity.posY, entity.posZ), + SpellHelper.createVec3(entity2.posX, entity2.posY, entity2.posZ), + false) + == null; } - public static Vec3 createVec3(double x, double y, double z) - { - return APISpellHelper.createVec3(x, y, z); + public static Vec3 createVec3(double x, double y, double z) { + return APISpellHelper.createVec3(x, y, z); } - - public static void smeltBlockInWorld(World world, int posX, int posY, int posZ) - { + + public static void smeltBlockInWorld(World world, int posX, int posY, int posZ) { FurnaceRecipes recipes = FurnaceRecipes.smelting(); Block block = world.getBlock(posX, posY, posZ); - if (block == null) - { + if (block == null) { return; } int meta = world.getBlockMetadata(posX, posY, posZ); ItemStack smeltedStack = recipes.getSmeltingResult(new ItemStack(block, 1, meta)); - if (smeltedStack != null && smeltedStack.getItem() instanceof ItemBlock) - { - world.setBlock(posX, posY, posZ, ((ItemBlock) (smeltedStack.getItem())).field_150939_a, smeltedStack.getItemDamage(), 3); + if (smeltedStack != null && smeltedStack.getItem() instanceof ItemBlock) { + world.setBlock( + posX, + posY, + posZ, + ((ItemBlock) (smeltedStack.getItem())).field_150939_a, + smeltedStack.getItemDamage(), + 3); } } - public static boolean canPlayerSeeAlchemy(EntityPlayer player) - { - if (player != null) - { + public static boolean canPlayerSeeAlchemy(EntityPlayer player) { + if (player != null) { ItemStack stack = player.getCurrentArmor(3); - if (stack != null) - { + if (stack != null) { Item item = stack.getItem(); - if (item instanceof IAlchemyGoggles && ((IAlchemyGoggles) item).showIngameHUD(player.worldObj, stack, player)) - { + if (item instanceof IAlchemyGoggles + && ((IAlchemyGoggles) item).showIngameHUD(player.worldObj, stack, player)) { return true; } } ItemStack heldStack = player.getHeldItem(); - if (heldStack != null && heldStack.getItem() instanceof IReagentManipulator) - { + if (heldStack != null && heldStack.getItem() instanceof IReagentManipulator) { return true; } } return false; } - - public static boolean canPlayerSeeLPBar(EntityPlayer player) - { - if (player != null) - { - for(int i=0; i<4; i++) - { - ItemStack stack = player.getCurrentArmor(i); - if (stack != null) - { + + public static boolean canPlayerSeeLPBar(EntityPlayer player) { + if (player != null) { + for (int i = 0; i < 4; i++) { + ItemStack stack = player.getCurrentArmor(i); + if (stack != null) { Item item = stack.getItem(); - if (item instanceof ILPGauge && ((ILPGauge) item).canSeeLPBar(stack)) - { + if (item instanceof ILPGauge && ((ILPGauge) item).canSeeLPBar(stack)) { return true; } } + } - } - ItemStack heldStack = player.getHeldItem(); - - if (heldStack != null && heldStack.getItem() instanceof SigilDivination) - { + + if (heldStack != null && heldStack.getItem() instanceof SigilDivination) { return true; } } @@ -140,33 +132,47 @@ public class SpellHelper return false; } - public static List getEntitiesInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) - { - return world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius)); + public static List getEntitiesInRange( + World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) { + return world.getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(horizontalRadius, verticalRadius, horizontalRadius)); } - public static List getLivingEntitiesInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) - { - return world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius)); + public static List getLivingEntitiesInRange( + World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) { + return world.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(horizontalRadius, verticalRadius, horizontalRadius)); } - public static List getItemsInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) - { - return world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius)); + public static List getItemsInRange( + World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) { + return world.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(horizontalRadius, verticalRadius, horizontalRadius)); } - public static List getPlayersInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) - { - return world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius)); + public static List getPlayersInRange( + World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius) { + return world.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox( + posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f) + .expand(horizontalRadius, verticalRadius, horizontalRadius)); } - public static double gaussian(double d) - { + public static double gaussian(double d) { return d * ((rand.nextFloat() - 0.5D)); } - public static Vec3 getEntityBlockVector(Entity entity) - { + public static Vec3 getEntityBlockVector(Entity entity) { int posX = (int) Math.round(entity.posX - 0.5f); int posY = (int) entity.posY; int posZ = (int) Math.round(entity.posZ - 0.5f); @@ -174,52 +180,42 @@ public class SpellHelper return entity.getLookVec().createVectorHelper(posX, posY, posZ); } - public static ForgeDirection getDirectionForLookVector(Vec3 lookVec) - { + public static ForgeDirection getDirectionForLookVector(Vec3 lookVec) { double distance = lookVec.lengthVector(); - if (lookVec.yCoord > distance * 0.9) - { + if (lookVec.yCoord > distance * 0.9) { return ForgeDirection.UP; } - if (lookVec.yCoord < distance * -0.9) - { + if (lookVec.yCoord < distance * -0.9) { return ForgeDirection.DOWN; } return getCompassDirectionForLookVector(lookVec); } - public static ForgeDirection getCompassDirectionForLookVector(Vec3 lookVec) - { + public static ForgeDirection getCompassDirectionForLookVector(Vec3 lookVec) { double radius = Math.sqrt(Math.pow(lookVec.xCoord, 2) + Math.pow(lookVec.zCoord, 2)); - if (lookVec.zCoord > radius * 1 / root2) - { + if (lookVec.zCoord > radius * 1 / root2) { return ForgeDirection.SOUTH; } - if (lookVec.zCoord < -radius * 1 / root2) - { + if (lookVec.zCoord < -radius * 1 / root2) { return ForgeDirection.NORTH; } - if (lookVec.xCoord > radius * 1 / root2) - { + if (lookVec.xCoord > radius * 1 / root2) { return ForgeDirection.EAST; } - if (lookVec.xCoord < -radius * 1 / root2) - { + if (lookVec.xCoord < -radius * 1 / root2) { return ForgeDirection.WEST; } return ForgeDirection.EAST; } - public static boolean freezeWaterBlock(World world, int posX, int posY, int posZ) - { + public static boolean freezeWaterBlock(World world, int posX, int posY, int posZ) { Block block = world.getBlock(posX, posY, posZ); - if (block == Blocks.water || block == Blocks.flowing_water) - { + if (block == Blocks.water || block == Blocks.flowing_water) { world.setBlock(posX, posY, posZ, Blocks.ice); return true; } @@ -227,36 +223,65 @@ public class SpellHelper return false; } - public static String getUsername(EntityPlayer player) - { + public static String getUsername(EntityPlayer player) { return SoulNetworkHandler.getUsername(player); } - public static EntityPlayer getPlayerForUsername(String str) - { + public static EntityPlayer getPlayerForUsername(String str) { return SoulNetworkHandler.getPlayerForUsername(str); } - public static void sendParticleToPlayer(EntityPlayer player, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel) - { - if (player instanceof EntityPlayerMP) - { - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getParticlePacket(str, xCoord, yCoord, zCoord, xVel, yVel, zVel), (EntityPlayerMP) player); + public static void sendParticleToPlayer( + EntityPlayer player, + String str, + double xCoord, + double yCoord, + double zCoord, + double xVel, + double yVel, + double zVel) { + if (player instanceof EntityPlayerMP) { + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getParticlePacket(str, xCoord, yCoord, zCoord, xVel, yVel, zVel), + (EntityPlayerMP) player); } } - public static void sendIndexedParticleToPlayer(EntityPlayer player, int index, double xCoord, double yCoord, double zCoord) - { - switch (index) - { + public static void sendIndexedParticleToPlayer( + EntityPlayer player, int index, double xCoord, double yCoord, double zCoord) { + switch (index) { case 1: - SpellHelper.sendParticleToPlayer(player, "mobSpell", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 0.5117D, 0.0117D, 0.0117D); + SpellHelper.sendParticleToPlayer( + player, + "mobSpell", + xCoord + 0.5D + rand.nextGaussian() / 8, + yCoord + 1.1D, + zCoord + 0.5D + rand.nextGaussian() / 8, + 0.5117D, + 0.0117D, + 0.0117D); break; case 2: - SpellHelper.sendParticleToPlayer(player, "reddust", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 0.82D, 0.941D, 0.91D); + SpellHelper.sendParticleToPlayer( + player, + "reddust", + xCoord + 0.5D + rand.nextGaussian() / 8, + yCoord + 1.1D, + zCoord + 0.5D + rand.nextGaussian() / 8, + 0.82D, + 0.941D, + 0.91D); break; case 3: - SpellHelper.sendParticleToPlayer(player, "mobSpell", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 1.0D, 0.371D, 0.371D); + SpellHelper.sendParticleToPlayer( + player, + "mobSpell", + xCoord + 0.5D + rand.nextGaussian() / 8, + yCoord + 1.1D, + zCoord + 0.5D + rand.nextGaussian() / 8, + 1.0D, + 0.371D, + 0.371D); break; case 4: float f = 1.0F; @@ -264,116 +289,127 @@ public class SpellHelper float f2 = f * f * 0.7F - 0.5F; float f3 = f * f * 0.6F - 0.7F; - for (int l = 0; l < 8; ++l) - { - SpellHelper.sendParticleToPlayer(player, "reddust", xCoord + Math.random() - Math.random(), yCoord + Math.random() - Math.random(), zCoord + Math.random() - Math.random(), f1, f2, f3); + for (int l = 0; l < 8; ++l) { + SpellHelper.sendParticleToPlayer( + player, + "reddust", + xCoord + Math.random() - Math.random(), + yCoord + Math.random() - Math.random(), + zCoord + Math.random() - Math.random(), + f1, + f2, + f3); } break; } } - public static void sendParticleToAllAround(World world, double xPos, double yPos, double zPos, int radius, int dimension, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel) - { + public static void sendParticleToAllAround( + World world, + double xPos, + double yPos, + double zPos, + int radius, + int dimension, + String str, + double xCoord, + double yCoord, + double zCoord, + double xVel, + double yVel, + double zVel) { List entities = SpellHelper.getPlayersInRange(world, xPos, yPos, zPos, radius, radius); - if (entities == null) - { + if (entities == null) { return; } - for (EntityPlayer player : entities) - { + for (EntityPlayer player : entities) { SpellHelper.sendParticleToPlayer(player, str, xCoord, yCoord, zCoord, xVel, yVel, zVel); } } - public static void sendIndexedParticleToAllAround(World world, double xPos, double yPos, double zPos, int radius, int dimension, int index, double xCoord, double yCoord, double zCoord) - { + public static void sendIndexedParticleToAllAround( + World world, + double xPos, + double yPos, + double zPos, + int radius, + int dimension, + int index, + double xCoord, + double yCoord, + double zCoord) { List entities = SpellHelper.getPlayersInRange(world, xPos, yPos, zPos, radius, radius); - if (entities == null) - { + if (entities == null) { return; } - for (EntityPlayer player : entities) - { + for (EntityPlayer player : entities) { SpellHelper.sendIndexedParticleToPlayer(player, index, xCoord, yCoord, zCoord); } } - public static void setPlayerSpeedFromServer(EntityPlayer player, double motionX, double motionY, double motionZ) - { - if (player instanceof EntityPlayerMP) - { - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getVelSettingPacket(motionX, motionY, motionZ), (EntityPlayerMP) player); + public static void setPlayerSpeedFromServer(EntityPlayer player, double motionX, double motionY, double motionZ) { + if (player instanceof EntityPlayerMP) { + NewPacketHandler.INSTANCE.sendTo( + NewPacketHandler.getVelSettingPacket(motionX, motionY, motionZ), (EntityPlayerMP) player); } } - public static boolean isFakePlayer(World world, EntityPlayer player) - { + public static boolean isFakePlayer(World world, EntityPlayer player) { return !world.isRemote && isFakePlayer(player); } - private static final Pattern FAKE_PLAYER_PATTERN = Pattern.compile("^(?:\\[.*\\])|(?:ComputerCraft)$"); - public static boolean isFakePlayer(EntityPlayer player) - { - return player instanceof FakePlayer || FAKE_PLAYER_PATTERN.matcher(SpellHelper.getUsername(player)).matches(); + private static final Pattern FAKE_PLAYER_PATTERN = Pattern.compile("^(?:\\[.*\\])|(?:ComputerCraft)$"); + + public static boolean isFakePlayer(EntityPlayer player) { + return player instanceof FakePlayer + || FAKE_PLAYER_PATTERN.matcher(SpellHelper.getUsername(player)).matches(); } - public static void smashBlock(World world, int posX, int posY, int posZ) - { + public static void smashBlock(World world, int posX, int posY, int posZ) { Block block = world.getBlock(posX, posY, posZ); - if (block == Blocks.stone) - { + if (block == Blocks.stone) { world.setBlock(posX, posY, posZ, Blocks.cobblestone); - } else if (block == Blocks.cobblestone) - { + } else if (block == Blocks.cobblestone) { world.setBlock(posX, posY, posZ, Blocks.gravel); - } else if (block == Blocks.gravel) - { + } else if (block == Blocks.gravel) { world.setBlock(posX, posY, posZ, Blocks.sand); } } - public static boolean isBlockFluid(Block block) - { + public static boolean isBlockFluid(Block block) { return block instanceof IFluidBlock || block instanceof BlockLiquid; } - public static void evaporateWaterBlock(World world, int posX, int posY, int posZ) - { + public static void evaporateWaterBlock(World world, int posX, int posY, int posZ) { Block block = world.getBlock(posX, posY, posZ); - if (block == Blocks.water || block == Blocks.flowing_water) - { + if (block == Blocks.water || block == Blocks.flowing_water) { world.setBlockToAir(posX, posY, posZ); } } - public static ItemStack getDustForOre(ItemStack item) - { + public static ItemStack getDustForOre(ItemStack item) { String oreName = OreDictionary.getOreName(OreDictionary.getOreID(item)); - if (oreName.contains("ore")) - { + if (oreName.contains("ore")) { String lowercaseOre = oreName.toLowerCase(); boolean isAllowed = false; - for (String str : AlchemicalWizardry.allowedCrushedOresArray) - { + for (String str : AlchemicalWizardry.allowedCrushedOresArray) { String testStr = str.toLowerCase(); - if (lowercaseOre.contains(testStr)) - { + if (lowercaseOre.contains(testStr)) { isAllowed = true; break; } } - if (!isAllowed) - { + if (!isAllowed) { return null; } @@ -381,8 +417,7 @@ public class SpellHelper ArrayList items = OreDictionary.getOres(dustName); - if (items != null && items.size() >= 1) - { + if (items != null && items.size() >= 1) { return (items.get(0).copy()); } } @@ -390,25 +425,21 @@ public class SpellHelper return null; } - public static List getItemsFromBlock(World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune) - { + public static List getItemsFromBlock( + World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune) { return APISpellHelper.getItemsFromBlock(world, block, x, y, z, meta, silkTouch, fortune); } - public static void spawnItemListInWorld(List items, World world, float x, float y, float z) - { + public static void spawnItemListInWorld(List items, World world, float x, float y, float z) { APISpellHelper.spawnItemListInWorld(items, world, x, y, z); } - public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) - { + public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) { return APISpellHelper.raytraceFromEntity(world, player, par3, range); } - public static String getNumeralForInt(int num) - { - switch (num) - { + public static String getNumeralForInt(int num) { + switch (num) { case 1: return "I"; case 2: @@ -441,24 +472,22 @@ public class SpellHelper * @param stack2 Slot content that stack1 is placed into * @return True if they can be combined */ - public static boolean canCombine(ItemStack stack1, ItemStack stack2) - { - if (stack1 == null) - { + public static boolean canCombine(ItemStack stack1, ItemStack stack2) { + if (stack1 == null) { return false; } - if (stack2 == null) - { + if (stack2 == null) { return true; } - if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable()) - { + if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable()) { return false; } - return stack1.getItem() == stack2.getItem() && stack1.getItemDamage() == stack2.getItemDamage() && ItemStack.areItemStackTagsEqual(stack1, stack2); + return stack1.getItem() == stack2.getItem() + && stack1.getItemDamage() == stack2.getItemDamage() + && ItemStack.areItemStackTagsEqual(stack1, stack2); } /** @@ -466,52 +495,20 @@ public class SpellHelper * @param stack2 Slot content that stack1 is placed into * @return Stacks after stacking */ - public static ItemStack[] combineStacks(ItemStack stack1, ItemStack stack2, int transferMax) - { + public static ItemStack[] combineStacks(ItemStack stack1, ItemStack stack2, int transferMax) { ItemStack[] returned = new ItemStack[2]; - if (canCombine(stack1, stack2)) - { - int transferedAmount = Math.min(transferMax, stack2 == null ? stack1.stackSize : Math.min(stack2.getMaxStackSize() - stack2.stackSize, stack1.stackSize)); - if (transferedAmount > 0) - { + if (canCombine(stack1, stack2)) { + int transferedAmount = Math.min( + transferMax, + stack2 == null + ? stack1.stackSize + : Math.min(stack2.getMaxStackSize() - stack2.stackSize, stack1.stackSize)); + if (transferedAmount > 0) { ItemStack copyStack = stack1.splitStack(transferedAmount); - if (stack2 == null) - { + if (stack2 == null) { stack2 = copyStack; - } else - { - stack2.stackSize += transferedAmount; - } - } - } - - returned[0] = stack1; - returned[1] = stack2; - - return returned; - } - - /** - * @param stack1 Stack that is placed into a slot - * @param stack2 Slot content that stack1 is placed into - * @return Stacks after stacking - */ - public static ItemStack[] combineStacks(ItemStack stack1, ItemStack stack2) - { - ItemStack[] returned = new ItemStack[2]; - - if (canCombine(stack1, stack2)) - { - int transferedAmount = stack2 == null ? stack1.stackSize : Math.min(stack2.getMaxStackSize() - stack2.stackSize, stack1.stackSize); - if (transferedAmount > 0) - { - ItemStack copyStack = stack1.splitStack(transferedAmount); - if (stack2 == null) - { - stack2 = copyStack; - } else - { + } else { stack2.stackSize += transferedAmount; } } @@ -523,250 +520,233 @@ public class SpellHelper return returned; } - public static ItemStack insertStackIntoInventory(ItemStack stack, IInventory inventory, ForgeDirection dir) - { - if (stack == null) - { + /** + * @param stack1 Stack that is placed into a slot + * @param stack2 Slot content that stack1 is placed into + * @return Stacks after stacking + */ + public static ItemStack[] combineStacks(ItemStack stack1, ItemStack stack2) { + ItemStack[] returned = new ItemStack[2]; + + if (canCombine(stack1, stack2)) { + int transferedAmount = stack2 == null + ? stack1.stackSize + : Math.min(stack2.getMaxStackSize() - stack2.stackSize, stack1.stackSize); + if (transferedAmount > 0) { + ItemStack copyStack = stack1.splitStack(transferedAmount); + if (stack2 == null) { + stack2 = copyStack; + } else { + stack2.stackSize += transferedAmount; + } + } + } + + returned[0] = stack1; + returned[1] = stack2; + + return returned; + } + + public static ItemStack insertStackIntoInventory(ItemStack stack, IInventory inventory, ForgeDirection dir) { + if (stack == null) { return null; } boolean[] canBeInserted = new boolean[inventory.getSizeInventory()]; - - if(inventory instanceof ISidedInventory) - { - int[] array = ((ISidedInventory)inventory).getAccessibleSlotsFromSide(dir.ordinal()); - for(int in : array) - { - canBeInserted[in] = inventory.isItemValidForSlot(in, stack) && ((ISidedInventory)inventory).canInsertItem(in, stack, dir.ordinal()); - } - }else - { - for(int i=0; i= limit) - { - return stack; + + if (numberMatching >= limit) { + return stack; } - + int newLimit = limit - numberMatching; - - for (int i = 0; i < inventory.getSizeInventory(); i++) - { - if(!canBeInserted[i]) - { - continue; - } - - int prevStackSize = stack.stackSize; - + + for (int i = 0; i < inventory.getSizeInventory(); i++) { + if (!canBeInserted[i]) { + continue; + } + + int prevStackSize = stack.stackSize; + ItemStack[] combinedStacks = combineStacks(stack, inventory.getStackInSlot(i), newLimit); stack = combinedStacks[0]; inventory.setInventorySlotContents(i, combinedStacks[1]); newLimit -= (prevStackSize - stack.stackSize); - - if (newLimit <= 0 || stack.stackSize <= 0) - { + + if (newLimit <= 0 || stack.stackSize <= 0) { return stack; } } return stack; } - - public static int getNumberOfItemsInInventory(IInventory inventory, ForgeDirection dir) - { + + public static int getNumberOfItemsInInventory(IInventory inventory, ForgeDirection dir) { boolean[] canBeInserted = new boolean[inventory.getSizeInventory()]; - if(inventory instanceof ISidedInventory) - { - int[] array = ((ISidedInventory)inventory).getAccessibleSlotsFromSide(dir.ordinal()); - for(int in : array) - { - canBeInserted[in] = true; - } - }else - { - for(int i=0; i potion = player.getActivePotionEffects().iterator(); potion.hasNext(); ) - { - player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next())); + for (Iterator potion = + player.getActivePotionEffects().iterator(); + potion.hasNext(); ) { + player.playerNetServerHandler.sendPacket( + new S1DPacketEntityEffect(player.getEntityId(), potion.next())); } - player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); - FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldWorldServer.provider.dimensionId, player.dimension); + player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience( + player.experience, player.experienceTotal, player.experienceLevel)); + FMLCommonHandler.instance() + .firePlayerChangedDimensionEvent( + player, oldWorldServer.provider.dimensionId, player.dimension); player.timeUntilPortal = 150; } player.worldObj.theProfiler.endSection(); newWorldServer.playSoundEffect(d, e, f, "mob.endermen.portal", 1.0F, 1.0F); return player; - } else - { + } else { NBTTagCompound tag = new NBTTagCompound(); entity.writeToNBTOptional(tag); entity.setDead(); oldWorld.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F); Entity teleportedEntity = EntityList.createEntityFromNBT(tag, newWorldServer); - if (teleportedEntity != null) - { + if (teleportedEntity != null) { teleportedEntity.setLocationAndAngles(d, e, f, entity.rotationYaw, entity.rotationPitch); teleportedEntity.forceSpawn = true; newWorldServer.spawnEntityInWorld(teleportedEntity); @@ -877,104 +859,91 @@ public class SpellHelper } return null; } - - public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) - { - return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound())); + + public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) { + return stack.isItemEqual(compressedStack) + && (stack.getTagCompound() == null + ? compressedStack.getTagCompound() == null + : stack.getTagCompound().equals(compressedStack.getTagCompound())); } - + /* * Ripped from EntityLivingBase, since it decided to be a scrub and make the method protected. */ - public static float applyPotionDamageCalculations(EntityLivingBase entity, DamageSource p_70672_1_, float p_70672_2_) - { -// if (p_70672_1_.isDamageAbsolute()) -// { -// return p_70672_2_; -// } -// else + public static float applyPotionDamageCalculations( + EntityLivingBase entity, DamageSource p_70672_1_, float p_70672_2_) { + // if (p_70672_1_.isDamageAbsolute()) + // { + // return p_70672_2_; + // } + // else { -// if (entity instanceof EntityZombie) + // if (entity instanceof EntityZombie) { - //par2 = par2; // Forge: Noop Warning + // par2 = par2; // Forge: Noop Warning } int i; int j; float f1; - if (entity.isPotionActive(Potion.resistance) && p_70672_1_ != DamageSource.outOfWorld) - { + if (entity.isPotionActive(Potion.resistance) && p_70672_1_ != DamageSource.outOfWorld) { i = (entity.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5; j = 25 - i; - f1 = p_70672_2_ * (float)j; + f1 = p_70672_2_ * (float) j; p_70672_2_ = f1 / 25.0F; } - if (p_70672_2_ <= 0.0F) - { + if (p_70672_2_ <= 0.0F) { return 0.0F; - } - else - { + } else { return applySpecialProtection(entity, p_70672_1_, p_70672_2_); } } } - + public static double protCoeff = 0.875; public static double scalCoeff = 0.8; - - public static float applySpecialProtection(EntityLivingBase entity, DamageSource source, float damage) - { - ItemStack[] armour = entity.getLastActiveItems(); - - if(armour == null) - { - return damage; - } - - int total = 0; - for(int i = 0; i < armour.length; i++) - { - ItemStack stack = armour[i]; - if(stack != null) - { - NBTTagList nbttaglist = stack.getEnchantmentTagList(); - - if(nbttaglist != null) - { - for(int j = 0; j < nbttaglist.tagCount(); ++j) - { - short short1 = nbttaglist.getCompoundTagAt(i).getShort("id"); + + public static float applySpecialProtection(EntityLivingBase entity, DamageSource source, float damage) { + ItemStack[] armour = entity.getLastActiveItems(); + + if (armour == null) { + return damage; + } + + int total = 0; + for (int i = 0; i < armour.length; i++) { + ItemStack stack = armour[i]; + if (stack != null) { + NBTTagList nbttaglist = stack.getEnchantmentTagList(); + + if (nbttaglist != null) { + for (int j = 0; j < nbttaglist.tagCount(); ++j) { + short short1 = nbttaglist.getCompoundTagAt(i).getShort("id"); short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl"); - if (Enchantment.enchantmentsList[short1] != null) - { - Enchantment ench = Enchantment.enchantmentsList[short1]; - if(ench instanceof EnchantmentProtection) - { - total += ench.calcModifierDamage(short2, source); - } + if (Enchantment.enchantmentsList[short1] != null) { + Enchantment ench = Enchantment.enchantmentsList[short1]; + if (ench instanceof EnchantmentProtection) { + total += ench.calcModifierDamage(short2, source); + } } - } - } - } - } - - if(total > 0) - { - total = (total + 1 >> + 1) + rand.nextInt(total + 1 >> + 1); - if(total <= 20) - { - return damage * (25 - total) / 25; - }else - { - float factor = (float)(0.8 + 0.2 * (1 - Math.pow(protCoeff, Math.pow((total - 20), scalCoeff)))); - return damage * (1 - factor); - } - } - - return damage; + } + } + } + } + + if (total > 0) { + total = (total + 1 >> +1) + rand.nextInt(total + 1 >> +1); + if (total <= 20) { + return damage * (25 - total) / 25; + } else { + float factor = (float) (0.8 + 0.2 * (1 - Math.pow(protCoeff, Math.pow((total - 20), scalCoeff)))); + return damage * (1 - factor); + } + } + + return damage; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefaultEarth.java index 81f24122..5a3fcf92 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefaultEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeDefaultEarth; -public class CSEMeleeDefaultEarth extends ComplexSpellEffect -{ - public CSEMeleeDefaultEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); - } - - public CSEMeleeDefaultEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefaultEarth extends ComplexSpellEffect { + public CSEMeleeDefaultEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addWorldEffect(new MeleeDefaultEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeDefaultEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefaultEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeDefaultEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (50 * Math.pow(1.5 * this.potencyEnhancement + 1, 3) * (0.5 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefaultEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (50 + * Math.pow(1.5 * this.potencyEnhancement + 1, 3) + * (0.5 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefensiveEarth.java index 53aae894..22c43c85 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeDefensiveEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeDefensiveEarth; -public class CSEMeleeDefensiveEarth extends ComplexSpellEffect -{ - public CSEMeleeDefensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); - } - - public CSEMeleeDefensiveEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefensiveEarth extends ComplexSpellEffect { + public CSEMeleeDefensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addWorldEffect(new MeleeDefensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeDefensiveEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefensiveEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeDefensiveEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (5 * (1.2 * this.powerEnhancement + 1) * (1.0f / 3.0f * Math.pow(this.potencyEnhancement, 2) + 2 + 1.0f / 2.0f * this.potencyEnhancement) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefensiveEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (5 + * (1.2 * this.powerEnhancement + 1) + * (1.0f / 3.0f * Math.pow(this.potencyEnhancement, 2) + 2 + 1.0f / 2.0f * this.potencyEnhancement) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeEnvironmentalEarth.java index dc558fb7..dfd1b688 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeEnvironmentalEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeEnvironmentalEarth; -public class CSEMeleeEnvironmentalEarth extends ComplexSpellEffect -{ - public CSEMeleeEnvironmentalEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEMeleeEnvironmentalEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeEnvironmentalEarth extends ComplexSpellEffect { + public CSEMeleeEnvironmentalEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addWorldEffect(new MeleeEnvironmentalEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeEnvironmentalEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeEnvironmentalEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeEnvironmentalEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (500 * Math.pow(2 * this.potencyEnhancement + 1, 3) * (0.25 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeEnvironmentalEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (500 + * Math.pow(2 * this.potencyEnhancement + 1, 3) + * (0.25 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeOffensiveEarth.java index 9b9b2409..3b35dded 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEMeleeOffensiveEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeOffensiveEarth; -public class CSEMeleeOffensiveEarth extends ComplexSpellEffect -{ - public CSEMeleeOffensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); - } - - public CSEMeleeOffensiveEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeOffensiveEarth extends ComplexSpellEffect { + public CSEMeleeOffensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addWorldEffect(new MeleeOffensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeOffensiveEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeOffensiveEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeOffensiveEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (20 * Math.pow(1.5 * this.powerEnhancement + 1, 3) * (0.25 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeOffensiveEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (20 + * Math.pow(1.5 * this.powerEnhancement + 1, 3) + * (0.25 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefaultEarth.java index 60226c72..ac4b1531 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefaultEarth.java @@ -7,39 +7,34 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileDefaultEarth; -public class CSEProjectileDefaultEarth extends ComplexSpellEffect -{ - public CSEProjectileDefaultEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); - } - - public CSEProjectileDefaultEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefaultEarth extends ComplexSpellEffect { + public CSEProjectileDefaultEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileDefaultEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileDefaultEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefaultEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileDefaultEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefaultEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (10 * Math.pow((0.5 * (this.powerEnhancement) + 1) * 2 + 1, 3) * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefensiveEarth.java index 503fdd2a..4a8c2d6c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileDefensiveEarth.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileDefensiveEarth; -public class CSEProjectileDefensiveEarth extends ComplexSpellEffect -{ - public CSEProjectileDefensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); - } - - public CSEProjectileDefensiveEarth(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefensiveEarth extends ComplexSpellEffect { + public CSEProjectileDefensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileDefensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileDefensiveEarth(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefensiveEarth(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (3 * Math.pow((this.powerEnhancement * 2 + 1), 2) * (this.potencyEnhancement * 2 + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileDefensiveEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefensiveEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (3 + * Math.pow((this.powerEnhancement * 2 + 1), 2) + * (this.potencyEnhancement * 2 + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileEnvironmentalEarth.java index ec1362a6..071e979d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileEnvironmentalEarth.java @@ -7,39 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileEnvironmentalEarth; -public class CSEProjectileEnvironmentalEarth extends ComplexSpellEffect -{ - public CSEProjectileEnvironmentalEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEProjectileEnvironmentalEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileEnvironmentalEarth extends ComplexSpellEffect { + public CSEProjectileEnvironmentalEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addUpdateEffect(new ProjectileEnvironmentalEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileEnvironmentalEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileEnvironmentalEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addUpdateEffect(new ProjectileEnvironmentalEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (10 * 2 * (0.1d * (this.potencyEnhancement + 1)) * Math.pow(3.47, this.potencyEnhancement) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileEnvironmentalEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (10 + * 2 + * (0.1d * (this.potencyEnhancement + 1)) + * Math.pow(3.47, this.potencyEnhancement) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileOffensiveEarth.java index 6ff81d50..6d5a01cb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEProjectileOffensiveEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileOffensiveEarth; -public class CSEProjectileOffensiveEarth extends ComplexSpellEffect -{ - public CSEProjectileOffensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); - } - - public CSEProjectileOffensiveEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileOffensiveEarth extends ComplexSpellEffect { + public CSEProjectileOffensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileOffensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileOffensiveEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileOffensiveEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileOffensiveEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (10 * (1.5 * this.potencyEnhancement + 1) * (Math.pow(1 * this.powerEnhancement + 1, 2)) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileOffensiveEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (10 + * (1.5 * this.potencyEnhancement + 1) + * (Math.pow(1 * this.powerEnhancement + 1, 2)) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefaultEarth.java index 424be92e..58c6683a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefaultEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfDefaultEarth; -public class CSESelfDefaultEarth extends ComplexSpellEffect -{ - public CSESelfDefaultEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); - } - - public CSESelfDefaultEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefaultEarth extends ComplexSpellEffect { + public CSESelfDefaultEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfDefaultEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfDefaultEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefaultEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect( + new SelfDefaultEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (20 * Math.pow(1.5 * powerEnhancement + 1, 2) * (2 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefaultEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (20 + * Math.pow(1.5 * powerEnhancement + 1, 2) + * (2 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefensiveEarth.java index 90794fc8..fc935587 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfDefensiveEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfDefensiveEarth; -public class CSESelfDefensiveEarth extends ComplexSpellEffect -{ - public CSESelfDefensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); - } - - public CSESelfDefensiveEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefensiveEarth extends ComplexSpellEffect { + public CSESelfDefensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfDefensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfDefensiveEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefensiveEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfDefensiveEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (750 * (1.1 * this.powerEnhancement + 1) * (0.5 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefensiveEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (750 + * (1.1 * this.powerEnhancement + 1) + * (0.5 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfEnvironmentalEarth.java index 1c5daa18..fff202fd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfEnvironmentalEarth.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfEnvironmentalEarth; -public class CSESelfEnvironmentalEarth extends ComplexSpellEffect -{ - public CSESelfEnvironmentalEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSESelfEnvironmentalEarth(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfEnvironmentalEarth extends ComplexSpellEffect { + public CSESelfEnvironmentalEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfEnvironmentalEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfEnvironmentalEarth(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfEnvironmentalEarth(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (250 * (1.2 * this.potencyEnhancement + 1) * (3 * this.powerEnhancement + 2.5) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfEnvironmentalEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfEnvironmentalEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (250 + * (1.2 * this.potencyEnhancement + 1) + * (3 * this.powerEnhancement + 2.5) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfOffensiveEarth.java index 51312610..b62c795f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSESelfOffensiveEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfOffensiveEarth; -public class CSESelfOffensiveEarth extends ComplexSpellEffect -{ - public CSESelfOffensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); - } - - public CSESelfOffensiveEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfOffensiveEarth extends ComplexSpellEffect { + public CSESelfOffensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfOffensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfOffensiveEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfOffensiveEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfOffensiveEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (10 * Math.pow(2 * this.powerEnhancement + 1, 2) * (this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfOffensiveEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (10 + * Math.pow(2 * this.powerEnhancement + 1, 2) + * (this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefaultEarth.java index ef1dd1b4..a46ca643 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefaultEarth.java @@ -6,66 +6,61 @@ import WayofTime.alchemicalWizardry.api.spell.ComplexSpellType; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; -public class CSEToolDefaultEarth extends ComplexSpellEffect -{ - public CSEToolDefaultEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); - } - - public CSEToolDefaultEarth(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefaultEarth extends ComplexSpellEffect { + public CSEToolDefaultEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - String toolClass = "pickaxe"; + public CSEToolDefaultEarth(int power, int cost, int potency) { + this(); - float digSpeed = 7.0f; + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - switch (this.powerEnhancement) - { - case 1: - digSpeed = 9.0f; - break; - case 2: - digSpeed = 12.0f; - break; - case 3: - digSpeed = 16.0f; - break; - case 4: - digSpeed = 21.0f; - break; - case 5: - digSpeed = 27.0f; - break; - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + String toolClass = "pickaxe"; - ((SpellParadigmTool)parad).setDigSpeed(toolClass, digSpeed); + float digSpeed = 7.0f; - int hlvl = this.potencyEnhancement + 2; - ((SpellParadigmTool)parad).setHarvestLevel(toolClass, hlvl); - } - } + switch (this.powerEnhancement) { + case 1: + digSpeed = 9.0f; + break; + case 2: + digSpeed = 12.0f; + break; + case 3: + digSpeed = 16.0f; + break; + case 4: + digSpeed = 21.0f; + break; + case 5: + digSpeed = 27.0f; + break; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefaultEarth(power, cost, potency); - } + ((SpellParadigmTool) parad).setDigSpeed(toolClass, digSpeed); - @Override - public int getCostOfEffect() - { - return (int) (1000 * (1 + this.potencyEnhancement * 0.1f) * (1 + this.powerEnhancement * 0.2f) * Math.pow(0.85, costEnhancement)); - } + int hlvl = this.potencyEnhancement + 2; + ((SpellParadigmTool) parad).setHarvestLevel(toolClass, hlvl); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefaultEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (1000 + * (1 + this.potencyEnhancement * 0.1f) + * (1 + this.powerEnhancement * 0.2f) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefensiveEarth.java index 98416506..581a4471 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolDefensiveEarth.java @@ -6,70 +6,61 @@ import WayofTime.alchemicalWizardry.api.spell.ComplexSpellType; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; -public class CSEToolDefensiveEarth extends ComplexSpellEffect -{ - public CSEToolDefensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); - } - - public CSEToolDefensiveEarth(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefensiveEarth extends ComplexSpellEffect { + public CSEToolDefensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - String toolClass = "shovel"; + public CSEToolDefensiveEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - float digSpeed = 7.0f; + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + String toolClass = "shovel"; + float digSpeed = 7.0f; - switch (this.powerEnhancement) - { - case 1: - digSpeed = 9.0f; - break; - case 2: - digSpeed = 12.0f; - break; - case 3: - digSpeed = 16.0f; - break; - case 4: - digSpeed = 21.0f; - break; - case 5: - digSpeed = 27.0f; - break; - } + switch (this.powerEnhancement) { + case 1: + digSpeed = 9.0f; + break; + case 2: + digSpeed = 12.0f; + break; + case 3: + digSpeed = 16.0f; + break; + case 4: + digSpeed = 21.0f; + break; + case 5: + digSpeed = 27.0f; + break; + } + ((SpellParadigmTool) parad).setDigSpeed(toolClass, digSpeed); - ((SpellParadigmTool)parad).setDigSpeed(toolClass, digSpeed); + int hlvl = this.potencyEnhancement + 2; + ((SpellParadigmTool) parad).setHarvestLevel(toolClass, hlvl); + } + } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefensiveEarth(power, cost, potency); + } - int hlvl = this.potencyEnhancement + 2; - ((SpellParadigmTool)parad).setHarvestLevel(toolClass, hlvl); - } - } - - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefensiveEarth(power, cost, potency); - } - - @Override - public int getCostOfEffect() - { - return (int) (1000 * (1 + this.potencyEnhancement * 0.1f) * (1 + this.powerEnhancement * 0.2f) * Math.pow(0.85, costEnhancement)); - } + @Override + public int getCostOfEffect() { + return (int) (1000 + * (1 + this.potencyEnhancement * 0.1f) + * (1 + this.powerEnhancement * 0.2f) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolEnvironmentalEarth.java index 1536fbff..8b62e5f9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolEnvironmentalEarth.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ToolEnvironmentalEarth; -public class CSEToolEnvironmentalEarth extends ComplexSpellEffect -{ - public CSEToolEnvironmentalEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEToolEnvironmentalEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolEnvironmentalEarth extends ComplexSpellEffect { + public CSEToolEnvironmentalEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addDigAreaEffect(new ToolEnvironmentalEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEToolEnvironmentalEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolEnvironmentalEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addDigAreaEffect(new ToolEnvironmentalEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (10 * (1 + this.potencyEnhancement * 0.8) * Math.pow(1.5 * this.powerEnhancement + 3, 2) * Math.pow(0.85, this.costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolEnvironmentalEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (10 + * (1 + this.potencyEnhancement * 0.8) + * Math.pow(1.5 * this.powerEnhancement + 3, 2) + * Math.pow(0.85, this.costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolOffensiveEarth.java index 9b7e0c84..9c0e39a2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/earth/CSEToolOffensiveEarth.java @@ -7,39 +7,34 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ToolOffensiveEarth; -public class CSEToolOffensiveEarth extends ComplexSpellEffect -{ - public CSEToolOffensiveEarth() - { - super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); - } - - public CSEToolOffensiveEarth(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolOffensiveEarth extends ComplexSpellEffect { + public CSEToolOffensiveEarth() { + super(ComplexSpellType.EARTH, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addItemManipulatorEffect(new ToolOffensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEToolOffensiveEarth(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolOffensiveEarth(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addItemManipulatorEffect(new ToolOffensiveEarth( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolOffensiveEarth(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return 1000; - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefaultFire.java index 7c4513aa..72be77a2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefaultFire.java @@ -7,40 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeDefaultFire; -public class CSEMeleeDefaultFire extends ComplexSpellEffect -{ - public CSEMeleeDefaultFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); - } - - public CSEMeleeDefaultFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefaultFire extends ComplexSpellEffect { + public CSEMeleeDefaultFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee) parad).addEntityEffect(new MeleeDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEMeleeDefaultFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefaultFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (25 * (1.2 * this.potencyEnhancement + 1) * (2.5 * this.powerEnhancement + 2) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect(new MeleeDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefaultFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (25 + * (1.2 * this.potencyEnhancement + 1) + * (2.5 * this.powerEnhancement + 2) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefensiveFire.java index 65915f0a..f6224a28 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeDefensiveFire.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeDefensiveFire; -public class CSEMeleeDefensiveFire extends ComplexSpellEffect -{ - public CSEMeleeDefensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); - } - - public CSEMeleeDefensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefensiveFire extends ComplexSpellEffect { + public CSEMeleeDefensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee) parad).addWorldEffect(new MeleeDefensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEMeleeDefensiveFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefensiveFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (30 * (1.5 * potencyEnhancement + 1) * (3 * powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeDefensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) + (30 * (1.5 * potencyEnhancement + 1) * (3 * powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeEnvironmentalFire.java index f8851c7a..08d0ca34 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeEnvironmentalFire.java @@ -7,40 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeEnvironmentalFire; -public class CSEMeleeEnvironmentalFire extends ComplexSpellEffect -{ - public CSEMeleeEnvironmentalFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEMeleeEnvironmentalFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeEnvironmentalFire extends ComplexSpellEffect { + public CSEMeleeEnvironmentalFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee) parad).addWorldEffect(new MeleeEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEMeleeEnvironmentalFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeEnvironmentalFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (25 * Math.pow(1.5 * this.powerEnhancement + 1, 3) * (0.25 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeEnvironmentalFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (25 + * Math.pow(1.5 * this.powerEnhancement + 1, 3) + * (0.25 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeOffensiveFire.java index e90b6a01..b792ba32 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEMeleeOffensiveFire.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeOffensiveFire; -public class CSEMeleeOffensiveFire extends ComplexSpellEffect -{ - public CSEMeleeOffensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); - } - - public CSEMeleeOffensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeOffensiveFire extends ComplexSpellEffect { + public CSEMeleeOffensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee) parad).addEntityEffect(new MeleeOffensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEMeleeOffensiveFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeOffensiveFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (500 * (1 + this.potencyEnhancement) * (this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect(new MeleeOffensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeOffensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) + (500 * (1 + this.potencyEnhancement) * (this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefaultFire.java index e87d633a..3ab872cf 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefaultFire.java @@ -7,41 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefaultFire; -public class CSEProjectileDefaultFire extends ComplexSpellEffect -{ - public CSEProjectileDefaultFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); - } - - public CSEProjectileDefaultFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefaultFire extends ComplexSpellEffect { + public CSEProjectileDefaultFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile) parad).addImpactEffect(new ProjectileDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); - ((SpellParadigmProjectile) parad).damage += this.potencyEnhancement; - } - } + public CSEProjectileDefaultFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefaultFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) ((5 * Math.pow(1.5 * this.powerEnhancement + 1, 2) * (1.5 * this.potencyEnhancement + 1) + this.potencyEnhancement * 15) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); + ((SpellParadigmProjectile) parad).damage += this.potencyEnhancement; + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefaultFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) ((5 * Math.pow(1.5 * this.powerEnhancement + 1, 2) * (1.5 * this.potencyEnhancement + 1) + + this.potencyEnhancement * 15) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefensiveFire.java index 4739c7f0..a095cf9f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileDefensiveFire.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefensiveFire; -public class CSEProjectileDefensiveFire extends ComplexSpellEffect -{ - public CSEProjectileDefensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); - } - - public CSEProjectileDefensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefensiveFire extends ComplexSpellEffect { + public CSEProjectileDefensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile) parad).addImpactEffect(new ProjectileDefensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEProjectileDefensiveFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefensiveFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (25 * Math.pow(1 * this.powerEnhancement + 1, 2) * (1 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect( + new ProjectileDefensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (25 + * Math.pow(1 * this.powerEnhancement + 1, 2) + * (1 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileEnvironmentalFire.java index be379e54..4c2e6533 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileEnvironmentalFire.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileEnvironmentalFire; -public class CSEProjectileEnvironmentalFire extends ComplexSpellEffect -{ - public CSEProjectileEnvironmentalFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEProjectileEnvironmentalFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileEnvironmentalFire extends ComplexSpellEffect { + public CSEProjectileEnvironmentalFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile) parad).addUpdateEffect(new ProjectileEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEProjectileEnvironmentalFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileEnvironmentalFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (75 * (0.5 * this.powerEnhancement + 1) * (0.5 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addUpdateEffect( + new ProjectileEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileEnvironmentalFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (75 + * (0.5 * this.powerEnhancement + 1) + * (0.5 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileOffensiveFire.java index 5637e353..9473dcfc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEProjectileOffensiveFire.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileOffensiveFire; -public class CSEProjectileOffensiveFire extends ComplexSpellEffect -{ - public CSEProjectileOffensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); - } - - public CSEProjectileOffensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileOffensiveFire extends ComplexSpellEffect { + public CSEProjectileOffensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile) parad).addImpactEffect(new ProjectileOffensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEProjectileOffensiveFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileOffensiveFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (10 * Math.pow((this.powerEnhancement) * 1.3 + 1, 2) * ((1.5 * this.potencyEnhancement + 1)) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect( + new ProjectileOffensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileOffensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (10 + * Math.pow((this.powerEnhancement) * 1.3 + 1, 2) + * ((1.5 * this.potencyEnhancement + 1)) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefaultFire.java index 8cfe7696..659b6ea6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefaultFire.java @@ -7,40 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefaultFire; -public class CSESelfDefaultFire extends ComplexSpellEffect -{ - public CSESelfDefaultFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); - } - - public CSESelfDefaultFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefaultFire extends ComplexSpellEffect { + public CSESelfDefaultFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf) parad).addSelfSpellEffect(new SelfDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSESelfDefaultFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefaultFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return 10 * (int) (10 * Math.pow(1.5, this.powerEnhancement + 1.5 * this.potencyEnhancement) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefaultFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return 10 + * (int) (10 + * Math.pow(1.5, this.powerEnhancement + 1.5 * this.potencyEnhancement) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefensiveFire.java index 3bc43070..c3222462 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfDefensiveFire.java @@ -7,40 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefensiveFire; -public class CSESelfDefensiveFire extends ComplexSpellEffect -{ - public CSESelfDefensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); - } - - public CSESelfDefensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefensiveFire extends ComplexSpellEffect { + public CSESelfDefensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf) parad).addSelfSpellEffect(new SelfDefensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSESelfDefensiveFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefensiveFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (25 * (3 * this.potencyEnhancement + 1) * (2 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfDefensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (25 + * (3 * this.potencyEnhancement + 1) + * (2 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfEnvironmentalFire.java index 116ae6d0..ca0cb265 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfEnvironmentalFire.java @@ -7,40 +7,36 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfEnvironmentalFire; -public class CSESelfEnvironmentalFire extends ComplexSpellEffect -{ - public CSESelfEnvironmentalFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSESelfEnvironmentalFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfEnvironmentalFire extends ComplexSpellEffect { + public CSESelfEnvironmentalFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf) parad).addSelfSpellEffect(new SelfEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSESelfEnvironmentalFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfEnvironmentalFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) ((15 * Math.pow(1.7, powerEnhancement) + 10 * Math.pow(potencyEnhancement, 1.8)) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect( + new SelfEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfEnvironmentalFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) ((15 * Math.pow(1.7, powerEnhancement) + 10 * Math.pow(potencyEnhancement, 1.8)) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfOffensiveFire.java index c63b8539..3f2ceb5f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSESelfOffensiveFire.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfOffensiveFire; -public class CSESelfOffensiveFire extends ComplexSpellEffect -{ - public CSESelfOffensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); - } - - public CSESelfOffensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfOffensiveFire extends ComplexSpellEffect { + public CSESelfOffensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf) parad).addSelfSpellEffect(new SelfOffensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSESelfOffensiveFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfOffensiveFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (300 * (3 * powerEnhancement + 1) * (2 * potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfOffensiveFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfOffensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) + (300 * (3 * powerEnhancement + 1) * (2 * potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefaultFire.java index 9885e23e..491ae311 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefaultFire.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ToolDefaultFire; -public class CSEToolDefaultFire extends ComplexSpellEffect -{ - public CSEToolDefaultFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); - } - - public CSEToolDefaultFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefaultFire extends ComplexSpellEffect { + public CSEToolDefaultFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool) parad).addItemManipulatorEffect(new ToolDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); - } - } + public CSEToolDefaultFire(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefaultFire(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addItemManipulatorEffect( + new ToolDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefaultFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return 1000; - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefensiveFire.java index d6244e78..9a1242f9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolDefensiveFire.java @@ -7,44 +7,42 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class CSEToolDefensiveFire extends ComplexSpellEffect -{ - public CSEToolDefensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); - } - - public CSEToolDefensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefensiveFire extends ComplexSpellEffect { + public CSEToolDefensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addCritChance("defFire", this.potencyEnhancement); + public CSEToolDefensiveFire(int power, int cost, int potency) { + this(); - ((SpellParadigmTool)parad).addDuration("defFire", 1200 * this.powerEnhancement); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - ((SpellParadigmTool)parad).addToolString("defFire", "Unbreaking" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); - } - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad).addCritChance("defFire", this.potencyEnhancement); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefensiveFire(power, cost, potency); - } + ((SpellParadigmTool) parad).addDuration("defFire", 1200 * this.powerEnhancement); - @Override - public int getCostOfEffect() - { - return (int) (500 * (1 + this.powerEnhancement * 0.5f) * (1 + this.potencyEnhancement) * Math.pow(0.85, costEnhancement)); - } + ((SpellParadigmTool) parad) + .addToolString( + "defFire", "Unbreaking" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (500 + * (1 + this.powerEnhancement * 0.5f) + * (1 + this.potencyEnhancement) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolEnvironmentalFire.java index b60e1477..bc00d14f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolEnvironmentalFire.java @@ -8,42 +8,39 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ToolEnvironmentalFire; -public class CSEToolEnvironmentalFire extends ComplexSpellEffect -{ - public CSEToolEnvironmentalFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEToolEnvironmentalFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolEnvironmentalFire extends ComplexSpellEffect { + public CSEToolEnvironmentalFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addBlockBreakEffect(new ToolEnvironmentalFire(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + public CSEToolEnvironmentalFire(int power, int cost, int potency) { + this(); - ((SpellParadigmTool)parad).addToolString("envFire", "Magma Plume" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); - } - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolEnvironmentalFire(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addBlockBreakEffect(new ToolEnvironmentalFire( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - @Override - public int getCostOfEffect() - { - return 0; - } + ((SpellParadigmTool) parad) + .addToolString( + "envFire", "Magma Plume" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolEnvironmentalFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return 0; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolOffensiveFire.java index f8b5bab2..19d24d7c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/fire/CSEToolOffensiveFire.java @@ -8,42 +8,42 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ToolOffensiveFire; -public class CSEToolOffensiveFire extends ComplexSpellEffect -{ - public CSEToolOffensiveFire() - { - super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); - } - - public CSEToolOffensiveFire(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolOffensiveFire extends ComplexSpellEffect { + public CSEToolOffensiveFire() { + super(ComplexSpellType.FIRE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addLeftClickEffect(new ToolOffensiveFire(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + public CSEToolOffensiveFire(int power, int cost, int potency) { + this(); - ((SpellParadigmTool)parad).addToolString("offFire", "Fire Aspect" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); - } - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolOffensiveFire(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addLeftClickEffect(new ToolOffensiveFire( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - @Override - public int getCostOfEffect() - { - return (int) (1000 * (1 + this.powerEnhancement * 0.3f) * (1 + this.potencyEnhancement * 0.2f) * Math.pow(0.85, costEnhancement)); - } + ((SpellParadigmTool) parad) + .addToolString( + "offFire", "Fire Aspect" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolOffensiveFire(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (1000 + * (1 + this.powerEnhancement * 0.3f) + * (1 + this.potencyEnhancement * 0.2f) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefaultIce.java index fde18f3c..d17a8ef6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefaultIce.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeDefaultIce; -public class CSEMeleeDefaultIce extends ComplexSpellEffect -{ - public CSEMeleeDefaultIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); - } - - public CSEMeleeDefaultIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefaultIce extends ComplexSpellEffect { + public CSEMeleeDefaultIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addEntityEffect(new MeleeDefaultIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeDefaultIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefaultIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect( + new MeleeDefaultIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefaultIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (250 * (potencyEnhancement + 1) * (1.5 * powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefensiveIce.java index 180e5c29..65b3e9e6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeDefensiveIce.java @@ -7,40 +7,39 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeDefensiveIce; -public class CSEMeleeDefensiveIce extends ComplexSpellEffect -{ - public CSEMeleeDefensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); - } - - public CSEMeleeDefensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefensiveIce extends ComplexSpellEffect { + public CSEMeleeDefensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addWorldEffect(new MeleeDefensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeDefensiveIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefensiveIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (50 * (0.5 * potencyEnhancement + 1) * (0.7 * powerEnhancement + 1) * (0.5 * powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeDefensiveIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (50 + * (0.5 * potencyEnhancement + 1) + * (0.7 * powerEnhancement + 1) + * (0.5 * powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeEnvironmentalIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeEnvironmentalIce.java index 807d79f8..87aeac22 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeEnvironmentalIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeEnvironmentalIce.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeEnvironmentalIce; -public class CSEMeleeEnvironmentalIce extends ComplexSpellEffect -{ - public CSEMeleeEnvironmentalIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEMeleeEnvironmentalIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeEnvironmentalIce extends ComplexSpellEffect { + public CSEMeleeEnvironmentalIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addEntityEffect(new MeleeEnvironmentalIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeEnvironmentalIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeEnvironmentalIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (20 * (0.5 * potencyEnhancement + 1) * 1 * Math.pow(0.85, costEnhancement)); //where the lone 1 is: (0 * potencyEnhancement + 1) - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect(new MeleeEnvironmentalIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeEnvironmentalIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (20 + * (0.5 * potencyEnhancement + 1) + * 1 + * Math.pow(0.85, costEnhancement)); // where the lone 1 is: (0 * potencyEnhancement + 1) + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeOffensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeOffensiveIce.java index 02da02af..01fdd9ea 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeOffensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEMeleeOffensiveIce.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeOffensiveIce; -public class CSEMeleeOffensiveIce extends ComplexSpellEffect -{ - public CSEMeleeOffensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); - } - - public CSEMeleeOffensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeOffensiveIce extends ComplexSpellEffect { + public CSEMeleeOffensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addEntityEffect(new MeleeOffensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeOffensiveIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeOffensiveIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (40 * (1.5 * potencyEnhancement + 1) * Math.pow(1.5, powerEnhancement) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect(new MeleeOffensiveIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeOffensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (40 + * (1.5 * potencyEnhancement + 1) + * Math.pow(1.5, powerEnhancement) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefaultIce.java index 469f4e76..e8213c94 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefaultIce.java @@ -7,41 +7,36 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileDefaultIce; -public class CSEProjectileDefaultIce extends ComplexSpellEffect -{ - public CSEProjectileDefaultIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); - } - - public CSEProjectileDefaultIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefaultIce extends ComplexSpellEffect { + public CSEProjectileDefaultIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).damage += this.potencyEnhancement; - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileDefaultIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileDefaultIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefaultIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad).damage += this.potencyEnhancement; + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileDefaultIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefaultIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) ((30) * (this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefensiveIce.java index e83e9071..b624fc84 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileDefensiveIce.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileDefensiveIce; -public class CSEProjectileDefensiveIce extends ComplexSpellEffect -{ - public CSEProjectileDefensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); - } - - public CSEProjectileDefensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefensiveIce extends ComplexSpellEffect { + public CSEProjectileDefensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileDefensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileDefensiveIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefensiveIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (75 * (2 * this.powerEnhancement + 1) * (this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileDefensiveIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (75 + * (2 * this.powerEnhancement + 1) + * (this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileEnvironmentalIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileEnvironmentalIce.java index 90b73e16..d377c314 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileEnvironmentalIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileEnvironmentalIce.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileEnvironmentalIce; -public class CSEProjectileEnvironmentalIce extends ComplexSpellEffect -{ - public CSEProjectileEnvironmentalIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEProjectileEnvironmentalIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileEnvironmentalIce extends ComplexSpellEffect { + public CSEProjectileEnvironmentalIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addUpdateEffect(new ProjectileEnvironmentalIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileEnvironmentalIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileEnvironmentalIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (200 * (2 * this.powerEnhancement + 1) * (2 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addUpdateEffect(new ProjectileEnvironmentalIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileEnvironmentalIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (200 + * (2 * this.powerEnhancement + 1) + * (2 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileOffensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileOffensiveIce.java index a671096a..0040e0eb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileOffensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEProjectileOffensiveIce.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileOffensiveIce; -public class CSEProjectileOffensiveIce extends ComplexSpellEffect -{ - public CSEProjectileOffensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); - } - - public CSEProjectileOffensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileOffensiveIce extends ComplexSpellEffect { + public CSEProjectileOffensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileOffensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileOffensiveIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileOffensiveIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) ((60) * (this.powerEnhancement + 1) * (3 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileOffensiveIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileOffensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) ((60) + * (this.powerEnhancement + 1) + * (3 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefaultIce.java index 494f1559..c8c05620 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefaultIce.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefaultIce; -public class CSESelfDefaultIce extends ComplexSpellEffect -{ - public CSESelfDefaultIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); - } - - public CSESelfDefaultIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefaultIce extends ComplexSpellEffect { + public CSESelfDefaultIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfDefaultIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfDefaultIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefaultIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect( + new SelfDefaultIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefaultIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (20 * (this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefensiveIce.java index 8ecf92eb..2a722893 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfDefensiveIce.java @@ -7,40 +7,36 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefensiveIce; -public class CSESelfDefensiveIce extends ComplexSpellEffect -{ - public CSESelfDefensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); - } - - public CSESelfDefensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefensiveIce extends ComplexSpellEffect { + public CSESelfDefensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfDefensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfDefensiveIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefensiveIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (200 * (3 * powerEnhancement + 1) * (2 * potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect( + new SelfDefensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) + (200 * (3 * powerEnhancement + 1) * (2 * potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfEnvironmentalIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfEnvironmentalIce.java index 1e0b9b95..ba57840b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfEnvironmentalIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfEnvironmentalIce.java @@ -7,40 +7,36 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfEnvironmentalIce; -public class CSESelfEnvironmentalIce extends ComplexSpellEffect -{ - public CSESelfEnvironmentalIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSESelfEnvironmentalIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfEnvironmentalIce extends ComplexSpellEffect { + public CSESelfEnvironmentalIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfEnvironmentalIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfEnvironmentalIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfEnvironmentalIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (10 * (1.5 * potencyEnhancement + 1) * (3 * powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfEnvironmentalIce( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfEnvironmentalIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) + (10 * (1.5 * potencyEnhancement + 1) * (3 * powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfOffensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfOffensiveIce.java index da5daafe..beff6a64 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfOffensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSESelfOffensiveIce.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfOffensiveIce; -public class CSESelfOffensiveIce extends ComplexSpellEffect -{ - public CSESelfOffensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); - } - - public CSESelfOffensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfOffensiveIce extends ComplexSpellEffect { + public CSESelfOffensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfOffensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfOffensiveIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfOffensiveIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (100 * (2 * this.powerEnhancement + 1) * (2 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect( + new SelfOffensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfOffensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (100 + * (2 * this.powerEnhancement + 1) + * (2 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefaultIce.java index 14fe0ea0..be41013b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefaultIce.java @@ -8,44 +8,45 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ToolDefaultIce; -public class CSEToolDefaultIce extends ComplexSpellEffect -{ - public CSEToolDefaultIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); - } - - public CSEToolDefaultIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefaultIce extends ComplexSpellEffect { + public CSEToolDefaultIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addLeftClickEffect(new ToolDefaultIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + public CSEToolDefaultIce(int power, int cost, int potency) { + this(); - ((SpellParadigmTool)parad).addToolString("FrostTouch", "FrostTouch" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement + 1))); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - ((SpellParadigmTool)parad).addCritChance("FrostCrit", this.potencyEnhancement * 0.5f); - } - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addLeftClickEffect( + new ToolDefaultIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefaultIce(power, cost, potency); - } + ((SpellParadigmTool) parad) + .addToolString( + "FrostTouch", + "FrostTouch" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement + 1))); - @Override - public int getCostOfEffect() - { - return (int) (500 * (1 + this.powerEnhancement * 0.3f) * (1 + this.potencyEnhancement * 0.1f) * Math.pow(0.85, costEnhancement)); - } + ((SpellParadigmTool) parad).addCritChance("FrostCrit", this.potencyEnhancement * 0.5f); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefaultIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (500 + * (1 + this.powerEnhancement * 0.3f) + * (1 + this.potencyEnhancement * 0.1f) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefensiveIce.java index 34ab2daf..56402307 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolDefensiveIce.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ToolDefensiveIce; -public class CSEToolDefensiveIce extends ComplexSpellEffect -{ - public CSEToolDefensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); - } - - public CSEToolDefensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefensiveIce extends ComplexSpellEffect { + public CSEToolDefensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addToolSummonEffect(new ToolDefensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEToolDefensiveIce(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefensiveIce(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (500 * (1 + this.powerEnhancement * 0.2) * (1 + this.potencyEnhancement * 0.5) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addToolSummonEffect( + new ToolDefensiveIce(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (500 + * (1 + this.powerEnhancement * 0.2) + * (1 + this.potencyEnhancement * 0.5) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolEnvironmentalIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolEnvironmentalIce.java index ac27a2a2..e62cfae7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolEnvironmentalIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolEnvironmentalIce.java @@ -7,42 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class CSEToolEnvironmentalIce extends ComplexSpellEffect -{ - public CSEToolEnvironmentalIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEToolEnvironmentalIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolEnvironmentalIce extends ComplexSpellEffect { + public CSEToolEnvironmentalIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addToolString("SilkTouch", "Silk Touch" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement + 1))); + public CSEToolEnvironmentalIce(int power, int cost, int potency) { + this(); - ((SpellParadigmTool)parad).setSilkTouch(true); - } - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolEnvironmentalIce(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addToolString( + "SilkTouch", + "Silk Touch" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement + 1))); - @Override - public int getCostOfEffect() - { + ((SpellParadigmTool) parad).setSilkTouch(true); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolEnvironmentalIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (1000 * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolOffensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolOffensiveIce.java index 15b3fd72..fdfda609 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolOffensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/ice/CSEToolOffensiveIce.java @@ -7,44 +7,42 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class CSEToolOffensiveIce extends ComplexSpellEffect -{ - public CSEToolOffensiveIce() - { - super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); - } - - public CSEToolOffensiveIce(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolOffensiveIce extends ComplexSpellEffect { + public CSEToolOffensiveIce() { + super(ComplexSpellType.ICE, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addDamageToHash("Sharpness", (this.powerEnhancement + 1) * 1.5f); + public CSEToolOffensiveIce(int power, int cost, int potency) { + this(); - ((SpellParadigmTool)parad).addToolString("Sharpness", "Sharpness" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement + 1))); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - ((SpellParadigmTool)parad).addCritChance("SharpCrit", this.potencyEnhancement); - } - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad).addDamageToHash("Sharpness", (this.powerEnhancement + 1) * 1.5f); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolOffensiveIce(power, cost, potency); - } + ((SpellParadigmTool) parad) + .addToolString( + "Sharpness", "Sharpness" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement + 1))); - @Override - public int getCostOfEffect() - { - return (int) (1000 * (1 + this.powerEnhancement * 0.3f) * (1 + this.potencyEnhancement * 0.2f) * Math.pow(0.85, costEnhancement)); - } + ((SpellParadigmTool) parad).addCritChance("SharpCrit", this.potencyEnhancement); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolOffensiveIce(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (1000 + * (1 + this.powerEnhancement * 0.3f) + * (1 + this.potencyEnhancement * 0.2f) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefaultWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefaultWind.java index e39030de..3769f781 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefaultWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefaultWind.java @@ -7,39 +7,37 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeDefaultWind; -public class CSEMeleeDefaultWind extends ComplexSpellEffect -{ - public CSEMeleeDefaultWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); - } - - public CSEMeleeDefaultWind(int power, int cost, int potency) - { - this(); - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefaultWind extends ComplexSpellEffect { + public CSEMeleeDefaultWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addEntityEffect(new MeleeDefaultWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeDefaultWind(int power, int cost, int potency) { + this(); + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefaultWind(power, cost, potency); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect( + new MeleeDefaultWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } - @Override - public int getCostOfEffect() - { - return (int) (350 * (1.0 * this.potencyEnhancement + 1) * (1.2 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefaultWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (350 + * (1.0 * this.potencyEnhancement + 1) + * (1.2 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefensiveWind.java index c4a05d55..bd1e8471 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeDefensiveWind.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeDefensiveWind; -public class CSEMeleeDefensiveWind extends ComplexSpellEffect -{ - public CSEMeleeDefensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); - } - - public CSEMeleeDefensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeDefensiveWind extends ComplexSpellEffect { + public CSEMeleeDefensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addEntityEffect(new MeleeDefensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeDefensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeDefensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (150 * (1.0 * this.potencyEnhancement + 1) * (0.7 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect(new MeleeDefensiveWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeDefensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (150 + * (1.0 * this.potencyEnhancement + 1) + * (0.7 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeEnvironmentalWind.java index e47152f4..b9fc3aa8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeEnvironmentalWind.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeEnvironmentalWind; -public class CSEMeleeEnvironmentalWind extends ComplexSpellEffect -{ - public CSEMeleeEnvironmentalWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEMeleeEnvironmentalWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeEnvironmentalWind extends ComplexSpellEffect { + public CSEMeleeEnvironmentalWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addWorldEffect(new MeleeEnvironmentalWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeEnvironmentalWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeEnvironmentalWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (100 * (1.0 * this.potencyEnhancement + 1) * (0.7 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addWorldEffect(new MeleeEnvironmentalWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeEnvironmentalWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (100 + * (1.0 * this.potencyEnhancement + 1) + * (0.7 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeOffensiveWind.java index 4af53a16..240cd283 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEMeleeOffensiveWind.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeOffensiveWind; -public class CSEMeleeOffensiveWind extends ComplexSpellEffect -{ - public CSEMeleeOffensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); - } - - public CSEMeleeOffensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEMeleeOffensiveWind extends ComplexSpellEffect { + public CSEMeleeOffensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmMelee) - { - ((SpellParadigmMelee)parad).addEntityEffect(new MeleeOffensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEMeleeOffensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEMeleeOffensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (250 * (1.0 * this.potencyEnhancement + 1) * (0.7 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmMelee) { + ((SpellParadigmMelee) parad) + .addEntityEffect(new MeleeOffensiveWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEMeleeOffensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (250 + * (1.0 * this.potencyEnhancement + 1) + * (0.7 * this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefaultWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefaultWind.java index 387892bd..41a65561 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefaultWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefaultWind.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileDefaultWind; -public class CSEProjectileDefaultWind extends ComplexSpellEffect -{ - public CSEProjectileDefaultWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); - } - - public CSEProjectileDefaultWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefaultWind extends ComplexSpellEffect { + public CSEProjectileDefaultWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileDefaultWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileDefaultWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefaultWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileDefaultWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefaultWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (100 * (this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefensiveWind.java index 15f1be6e..2941db05 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileDefensiveWind.java @@ -6,40 +6,33 @@ import WayofTime.alchemicalWizardry.api.spell.ComplexSpellType; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; -public class CSEProjectileDefensiveWind extends ComplexSpellEffect -{ - public CSEProjectileDefensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); - } - - public CSEProjectileDefensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileDefensiveWind extends ComplexSpellEffect { + public CSEProjectileDefensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).isSilkTouch = true; - } - } + public CSEProjectileDefensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileDefensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad).isSilkTouch = true; + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileDefensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (100 * (this.potencyEnhancement + 1)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileEnvironmentalWind.java index 154865f2..26422ca2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileEnvironmentalWind.java @@ -7,40 +7,36 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileEnvironmentalWind; -public class CSEProjectileEnvironmentalWind extends ComplexSpellEffect -{ - public CSEProjectileEnvironmentalWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEProjectileEnvironmentalWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileEnvironmentalWind extends ComplexSpellEffect { + public CSEProjectileEnvironmentalWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addUpdateEffect(new ProjectileEnvironmentalWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileEnvironmentalWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileEnvironmentalWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (50 * (this.powerEnhancement + 1) * (this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addUpdateEffect(new ProjectileEnvironmentalWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileEnvironmentalWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) + (50 * (this.powerEnhancement + 1) * (this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileOffensiveWind.java index b215b6be..d1c93093 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEProjectileOffensiveWind.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileOffensiveWind; -public class CSEProjectileOffensiveWind extends ComplexSpellEffect -{ - public CSEProjectileOffensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); - } - - public CSEProjectileOffensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEProjectileOffensiveWind extends ComplexSpellEffect { + public CSEProjectileOffensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmProjectile) - { - ((SpellParadigmProjectile)parad).addImpactEffect(new ProjectileOffensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEProjectileOffensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEProjectileOffensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (100 * (0.5 * this.potencyEnhancement + 1) * (this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmProjectile) { + ((SpellParadigmProjectile) parad) + .addImpactEffect(new ProjectileOffensiveWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEProjectileOffensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (100 + * (0.5 * this.potencyEnhancement + 1) + * (this.powerEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefaultWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefaultWind.java index 4641e662..981ea168 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefaultWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefaultWind.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfDefaultWind; -public class CSESelfDefaultWind extends ComplexSpellEffect -{ - public CSESelfDefaultWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); - } - - public CSESelfDefaultWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefaultWind extends ComplexSpellEffect { + public CSESelfDefaultWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfDefaultWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfDefaultWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefaultWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect( + new SelfDefaultWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefaultWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (100 * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefensiveWind.java index 7538b1d8..f86bc4f2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfDefensiveWind.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfDefensiveWind; -public class CSESelfDefensiveWind extends ComplexSpellEffect -{ - public CSESelfDefensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); - } - - public CSESelfDefensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfDefensiveWind extends ComplexSpellEffect { + public CSESelfDefensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfDefensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfDefensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfDefensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (500 * (0.7d * this.powerEnhancement + 1) * (0.8 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfDefensiveWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfDefensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (500 + * (0.7d * this.powerEnhancement + 1) + * (0.8 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfEnvironmentalWind.java index 46d3ae38..2cc6a4a3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfEnvironmentalWind.java @@ -7,40 +7,38 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfEnvironmentalWind; -public class CSESelfEnvironmentalWind extends ComplexSpellEffect -{ - public CSESelfEnvironmentalWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSESelfEnvironmentalWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfEnvironmentalWind extends ComplexSpellEffect { + public CSESelfEnvironmentalWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfEnvironmentalWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfEnvironmentalWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfEnvironmentalWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (500 * (0.7d * this.powerEnhancement + 1) * (0.2 * this.potencyEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfEnvironmentalWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfEnvironmentalWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (500 + * (0.7d * this.powerEnhancement + 1) + * (0.2 * this.potencyEnhancement + 1) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfOffensiveWind.java index 78a5a021..0dbbbe9f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSESelfOffensiveWind.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfOffensiveWind; -public class CSESelfOffensiveWind extends ComplexSpellEffect -{ - public CSESelfOffensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); - } - - public CSESelfOffensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSESelfOffensiveWind extends ComplexSpellEffect { + public CSESelfOffensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmSelf) - { - ((SpellParadigmSelf)parad).addSelfSpellEffect(new SelfOffensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSESelfOffensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSESelfOffensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmSelf) { + ((SpellParadigmSelf) parad) + .addSelfSpellEffect(new SelfOffensiveWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSESelfOffensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (100 * (0.5 * this.powerEnhancement + 1) * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefaultWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefaultWind.java index 041e9b12..941b4563 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefaultWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefaultWind.java @@ -6,66 +6,61 @@ import WayofTime.alchemicalWizardry.api.spell.ComplexSpellType; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; -public class CSEToolDefaultWind extends ComplexSpellEffect -{ - public CSEToolDefaultWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); - } - - public CSEToolDefaultWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefaultWind extends ComplexSpellEffect { + public CSEToolDefaultWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFAULT); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - String toolClass = "axe"; + public CSEToolDefaultWind(int power, int cost, int potency) { + this(); - float digSpeed = 7.0f; + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - switch (this.powerEnhancement) - { - case 1: - digSpeed = 9.0f; - break; - case 2: - digSpeed = 12.0f; - break; - case 3: - digSpeed = 16.0f; - break; - case 4: - digSpeed = 21.0f; - break; - case 5: - digSpeed = 27.0f; - break; - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + String toolClass = "axe"; - ((SpellParadigmTool)parad).setDigSpeed(toolClass, digSpeed); + float digSpeed = 7.0f; - int hlvl = this.potencyEnhancement + 2; - ((SpellParadigmTool)parad).setHarvestLevel(toolClass, hlvl); - } - } + switch (this.powerEnhancement) { + case 1: + digSpeed = 9.0f; + break; + case 2: + digSpeed = 12.0f; + break; + case 3: + digSpeed = 16.0f; + break; + case 4: + digSpeed = 21.0f; + break; + case 5: + digSpeed = 27.0f; + break; + } - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefaultWind(power, cost, potency); - } + ((SpellParadigmTool) parad).setDigSpeed(toolClass, digSpeed); - @Override - public int getCostOfEffect() - { - return (int) (1000 * (1 + this.potencyEnhancement * 0.1f) * (1 + this.powerEnhancement * 0.2f) * Math.pow(0.85, costEnhancement)); - } + int hlvl = this.potencyEnhancement + 2; + ((SpellParadigmTool) parad).setHarvestLevel(toolClass, hlvl); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefaultWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (1000 + * (1 + this.potencyEnhancement * 0.1f) + * (1 + this.powerEnhancement * 0.2f) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefensiveWind.java index c0e6aa1f..4c9550a4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolDefensiveWind.java @@ -8,41 +8,41 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ToolDefensiveWind; -public class CSEToolDefensiveWind extends ComplexSpellEffect -{ - public CSEToolDefensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); - } - - public CSEToolDefensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolDefensiveWind extends ComplexSpellEffect { + public CSEToolDefensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.DEFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addLeftClickEffect(new ToolDefensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - ((SpellParadigmTool)parad).addToolString("DefWind", "Knockback" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); - } - } + public CSEToolDefensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolDefensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return (int) (150 * (1 + this.powerEnhancement * 0.4f) * (1 + this.potencyEnhancement * 0.3f) * Math.pow(0.85, costEnhancement)); - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addLeftClickEffect(new ToolDefensiveWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + ((SpellParadigmTool) parad) + .addToolString( + "DefWind", "Knockback" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolDefensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return (int) (150 + * (1 + this.powerEnhancement * 0.4f) + * (1 + this.potencyEnhancement * 0.3f) + * Math.pow(0.85, costEnhancement)); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolEnvironmentalWind.java index 06a63676..b422f0b4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolEnvironmentalWind.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ToolEnvironmentalWind; -public class CSEToolEnvironmentalWind extends ComplexSpellEffect -{ - public CSEToolEnvironmentalWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); - } - - public CSEToolEnvironmentalWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolEnvironmentalWind extends ComplexSpellEffect { + public CSEToolEnvironmentalWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.ENVIRONMENTAL); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addBlockBreakEffect(new ToolEnvironmentalWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEToolEnvironmentalWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolEnvironmentalWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addBlockBreakEffect(new ToolEnvironmentalWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolEnvironmentalWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { return (int) (150 * (1 + this.powerEnhancement) * Math.pow(0.85, costEnhancement)); - } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolOffensiveWind.java index b648c24f..5d8b430a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/cse/wind/CSEToolOffensiveWind.java @@ -7,40 +7,35 @@ import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ToolOffensiveWind; -public class CSEToolOffensiveWind extends ComplexSpellEffect -{ - public CSEToolOffensiveWind() - { - super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); - } - - public CSEToolOffensiveWind(int power, int cost, int potency) - { - this(); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } +public class CSEToolOffensiveWind extends ComplexSpellEffect { + public CSEToolOffensiveWind() { + super(ComplexSpellType.WIND, ComplexSpellModifier.OFFENSIVE); + } - @Override - public void modifyParadigm(SpellParadigm parad) - { - if(parad instanceof SpellParadigmTool) - { - ((SpellParadigmTool)parad).addLeftClickEffect(new ToolOffensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); - } - } + public CSEToolOffensiveWind(int power, int cost, int potency) { + this(); - @Override - public ComplexSpellEffect copy(int power, int cost, int potency) - { - return new CSEToolOffensiveWind(power, cost, potency); - } + this.powerEnhancement = power; + this.costEnhancement = cost; + this.potencyEnhancement = potency; + } - @Override - public int getCostOfEffect() - { - return 0; //Cost is on the attack method - } + @Override + public void modifyParadigm(SpellParadigm parad) { + if (parad instanceof SpellParadigmTool) { + ((SpellParadigmTool) parad) + .addLeftClickEffect(new ToolOffensiveWind( + this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); + } + } + + @Override + public ComplexSpellEffect copy(int power, int cost, int potency) { + return new CSEToolOffensiveWind(power, cost, potency); + } + + @Override + public int getCostOfEffect() { + return 0; // Cost is on the attack method + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefaultEarth.java index 7ca0d401..fcff2d75 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefaultEarth.java @@ -6,36 +6,30 @@ import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class MeleeDefaultEarth extends MeleeSpellCenteredWorldEffect -{ - public MeleeDefaultEarth(int power, int potency, int cost) - { +public class MeleeDefaultEarth extends MeleeSpellCenteredWorldEffect { + public MeleeDefaultEarth(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 * power + 2); } @Override - public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) - { + public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) { int radius = this.potencyUpgrades; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k) && world.getTileEntity(posX + i, posY + j, posZ + k) == null) - { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k) + && world.getTileEntity(posX + i, posY + j, posZ + k) == null) { Block block = world.getBlock(posX + i, posY + j, posZ + k); - if (block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1) - { + if (block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1) { continue; } int meta = world.getBlockMetadata(posX + i, posY + j, posZ + k); - EntityFallingBlock entity = new EntityFallingBlock(world, posX + i + 0.5f, posY + j + 0.5f, posZ + k + 0.5f, block, meta); + EntityFallingBlock entity = new EntityFallingBlock( + world, posX + i + 0.5f, posY + j + 0.5f, posZ + k + 0.5f, block, meta); world.spawnEntityInWorld(entity); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java index d82ca011..1938b748 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java @@ -7,30 +7,35 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class MeleeDefensiveEarth extends MeleeSpellCenteredWorldEffect -{ - public MeleeDefensiveEarth(int power, int potency, int cost) - { +public class MeleeDefensiveEarth extends MeleeSpellCenteredWorldEffect { + public MeleeDefensiveEarth(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 * power + 2); } @Override - public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) - { + public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) { ForgeDirection dir = SpellHelper.getDirectionForLookVector(player.getLook(1)); - int vertRadius = (int) (2 + 1.0f / 2.0f * Math.pow(this.potencyUpgrades, 2) + 1.0f / 2.0f * this.potencyUpgrades); + int vertRadius = + (int) (2 + 1.0f / 2.0f * Math.pow(this.potencyUpgrades, 2) + 1.0f / 2.0f * this.potencyUpgrades); int horizRadius = this.potencyUpgrades + 1; int xOff = dir.offsetX; int zOff = dir.offsetZ; - for (int i = -horizRadius; i <= horizRadius; i++) - { - for (int j = 0; j < vertRadius; j++) - { - BlockTeleposer.swapBlocks(this, world, world, posX + i * zOff, posY + j, posZ + i * xOff, posX + i * zOff, posY + j - vertRadius, posZ + i * xOff); + for (int i = -horizRadius; i <= horizRadius; i++) { + for (int j = 0; j < vertRadius; j++) { + BlockTeleposer.swapBlocks( + this, + world, + world, + posX + i * zOff, + posY + j, + posZ + i * xOff, + posX + i * zOff, + posY + j - vertRadius, + posZ + i * xOff); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeEnvironmentalEarth.java index 32291181..f9c86e74 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeEnvironmentalEarth.java @@ -7,33 +7,29 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class MeleeEnvironmentalEarth extends MeleeSpellCenteredWorldEffect -{ - public MeleeEnvironmentalEarth(int power, int potency, int cost) - { +public class MeleeEnvironmentalEarth extends MeleeSpellCenteredWorldEffect { + public MeleeEnvironmentalEarth(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 * power + 2); } @Override - public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) - { + public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) { int radius = this.potencyUpgrades; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k) && world.getTileEntity(posX + i, posY + j, posZ + k) == null) - { - ItemStack stack = new ItemStack(world.getBlock(posX + i, posY + j, posZ + k), 1, world.getBlockMetadata(posX + i, posY + j, posZ + k)); + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k) + && world.getTileEntity(posX + i, posY + j, posZ + k) == null) { + ItemStack stack = new ItemStack( + world.getBlock(posX + i, posY + j, posZ + k), + 1, + world.getBlockMetadata(posX + i, posY + j, posZ + k)); ItemStack dustStack = SpellHelper.getDustForOre(stack); - if (dustStack != null) - { + if (dustStack != null) { dustStack.stackSize *= 3; world.spawnEntityInWorld(new EntityItem(world, posX, posY, posZ, dustStack)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeOffensiveEarth.java index d13ab19c..ec2f8d44 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeOffensiveEarth.java @@ -5,25 +5,19 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class MeleeOffensiveEarth extends MeleeSpellCenteredWorldEffect -{ - public MeleeOffensiveEarth(int power, int potency, int cost) - { +public class MeleeOffensiveEarth extends MeleeSpellCenteredWorldEffect { + public MeleeOffensiveEarth(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 * power + 2); } @Override - public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) - { + public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) { int radius = this.potencyUpgrades; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { SpellHelper.smashBlock(world, posX + i, posY + j, posZ + k); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefaultEarth.java index 8437f6d8..9655636d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefaultEarth.java @@ -7,21 +7,16 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ProjectileDefaultEarth extends ProjectileImpactEffect -{ - public ProjectileDefaultEarth(int power, int potency, int cost) - { +public class ProjectileDefaultEarth extends ProjectileImpactEffect { + public ProjectileDefaultEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { - } + public void onEntityImpact(Entity mop, Entity proj) {} @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { + public void onTileImpact(World world, MovingObjectPosition mop) { int horizRange = (int) (0.5 * (this.powerUpgrades) + 1); int vertRange = (int) (0.5 * (this.powerUpgrades) + 1); @@ -29,27 +24,23 @@ public class ProjectileDefaultEarth extends ProjectileImpactEffect int posY = mop.blockY; int posZ = mop.blockZ; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k)) { Block block = world.getBlock(posX + i, posY + j, posZ + k); - if (block == null || block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1 || SpellHelper.isBlockFluid(block)) - { + if (block == null + || block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1 + || SpellHelper.isBlockFluid(block)) { continue; } - //block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, posY+j, posZ+k)); - //world.destroyBlock(posX+i, posY+j, posZ+k, true); + // block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, + // posY+j, posZ+k)); + // world.destroyBlock(posX+i, posY+j, posZ+k, true); world.func_147480_a(posX + i, posY + j, posZ + k, false); } } } } - } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefensiveEarth.java index e2d53a60..767a1113 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileDefensiveEarth.java @@ -7,21 +7,16 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ProjectileDefensiveEarth extends ProjectileImpactEffect -{ - public ProjectileDefensiveEarth(int power, int potency, int cost) - { +public class ProjectileDefensiveEarth extends ProjectileImpactEffect { + public ProjectileDefensiveEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { - } + public void onEntityImpact(Entity mop, Entity proj) {} @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { + public void onTileImpact(World world, MovingObjectPosition mop) { int horizRange = this.powerUpgrades; int vertRange = this.potencyUpgrades; @@ -29,30 +24,23 @@ public class ProjectileDefensiveEarth extends ProjectileImpactEffect int posY = mop.blockY; int posZ = mop.blockZ; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k)) { Block block = world.getBlock(posX + i, posY + j, posZ + k); - if (block == null || block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1) - { + if (block == null || block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1) { continue; } - //block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, posY+j, posZ+k)); - //world.destroyBlock(posX+i, posY+j, posZ+k, true); - if (world.rand.nextFloat() < 0.6f) - { + // block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, + // posY+j, posZ+k)); + // world.destroyBlock(posX+i, posY+j, posZ+k, true); + if (world.rand.nextFloat() < 0.6f) { SpellHelper.smashBlock(world, posX + i, posY + j, posZ + k); } } } } } - } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileEnvironmentalEarth.java index 721edd40..fa7e2bed 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileEnvironmentalEarth.java @@ -10,16 +10,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class ProjectileEnvironmentalEarth extends ProjectileUpdateEffect -{ - public ProjectileEnvironmentalEarth(int power, int potency, int cost) - { +public class ProjectileEnvironmentalEarth extends ProjectileUpdateEffect { + public ProjectileEnvironmentalEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onUpdateEffect(Entity projectile) - { + public void onUpdateEffect(Entity projectile) { Vec3 posVec = SpellHelper.getEntityBlockVector(projectile); int horizRange = this.powerUpgrades + 1; @@ -32,38 +29,39 @@ public class ProjectileEnvironmentalEarth extends ProjectileUpdateEffect World worldObj = projectile.worldObj; - if (projectile instanceof EntitySpellProjectile) - { + if (projectile instanceof EntitySpellProjectile) { int blocksBroken = ((EntitySpellProjectile) projectile).getBlocksBroken(); - if (blocksBroken >= maxBlocks) - { + if (blocksBroken >= maxBlocks) { return; } - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (!worldObj.isAirBlock(posX + i, posY + j, posZ + k) && blocksBroken < maxBlocks) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (!worldObj.isAirBlock(posX + i, posY + j, posZ + k) && blocksBroken < maxBlocks) { Block block = worldObj.getBlock(posX + i, posY + j, posZ + k); int meta = worldObj.getBlockMetadata(posX + i, posY + j, posZ + k); - if (block == null || block.getBlockHardness(worldObj, posX + i, posY + j, posZ + k) == -1 || SpellHelper.isBlockFluid(block)) - { + if (block == null + || block.getBlockHardness(worldObj, posX + i, posY + j, posZ + k) == -1 + || SpellHelper.isBlockFluid(block)) { continue; } - if (((EntitySpellProjectile) projectile).getIsSilkTouch() && block.canSilkHarvest(worldObj, ((EntitySpellProjectile) projectile).shootingEntity, posX + i, posY + j, posZ + k, meta)) - { + if (((EntitySpellProjectile) projectile).getIsSilkTouch() + && block.canSilkHarvest( + worldObj, + ((EntitySpellProjectile) projectile).shootingEntity, + posX + i, + posY + j, + posZ + k, + meta)) { ItemStack stack = new ItemStack(block, 1, meta); - EntityItem itemEntity = new EntityItem(worldObj, posX + i + 0.5, posY + j + 0.5, posZ + k + 0.5, stack); + EntityItem itemEntity = + new EntityItem(worldObj, posX + i + 0.5, posY + j + 0.5, posZ + k + 0.5, stack); worldObj.spawnEntityInWorld(itemEntity); worldObj.setBlockToAir(posX + i, posY + j, posZ + k); - } else - { + } else { worldObj.func_147480_a(posX + i, posY + j, posZ + k, true); } blocksBroken++; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileOffensiveEarth.java index 67b2d424..230d3f59 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ProjectileOffensiveEarth.java @@ -9,16 +9,13 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class ProjectileOffensiveEarth extends ProjectileImpactEffect -{ - public ProjectileOffensiveEarth(int power, int potency, int cost) - { +public class ProjectileOffensiveEarth extends ProjectileImpactEffect { + public ProjectileOffensiveEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { + public void onEntityImpact(Entity mop, Entity proj) { int horizRange = this.powerUpgrades; int vertDepth = 3 * this.potencyUpgrades + 1; @@ -30,21 +27,20 @@ public class ProjectileOffensiveEarth extends ProjectileImpactEffect World world = mop.worldObj; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertDepth; j < 0; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertDepth; j < 0; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k)) { Block block = world.getBlock(posX + i, posY + j, posZ + k); - if (block == null || block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1) - { + if (block == null || block.getBlockHardness(world, posX + i, posY + j, posZ + k) == -1) { continue; } - if (block == Blocks.stone || block == Blocks.cobblestone || block == Blocks.sand || block == Blocks.gravel || block == Blocks.grass || block == Blocks.dirt) - { + if (block == Blocks.stone + || block == Blocks.cobblestone + || block == Blocks.sand + || block == Blocks.gravel + || block == Blocks.grass + || block == Blocks.dirt) { world.setBlockToAir(posX + i, posY + j, posZ + k); } } @@ -54,7 +50,5 @@ public class ProjectileOffensiveEarth extends ProjectileImpactEffect } @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { - } + public void onTileImpact(World world, MovingObjectPosition mop) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java index 53b038c0..506f0fdf 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java @@ -7,17 +7,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class SelfDefaultEarth extends SelfSpellEffect -{ +public class SelfDefaultEarth extends SelfSpellEffect { - public SelfDefaultEarth(int power, int potency, int cost) - { + public SelfDefaultEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { int horizRadius = this.powerUpgrades; int vertRange = 5 + 10 * this.potencyUpgrades; @@ -27,20 +24,17 @@ public class SelfDefaultEarth extends SelfSpellEffect int posY = (int) (blockVec.yCoord) - 1; int posZ = (int) (blockVec.zCoord); - for (int i = -horizRadius; i <= horizRadius; i++) - { - for (int k = -horizRadius; k <= horizRadius; k++) - { - if (!world.isAirBlock(posX + i, posY, posZ + k)) - { + for (int i = -horizRadius; i <= horizRadius; i++) { + for (int k = -horizRadius; k <= horizRadius; k++) { + if (!world.isAirBlock(posX + i, posY, posZ + k)) { continue; } - for (int j = -1; j >= -vertRange; j--) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k) && !SpellHelper.isBlockFluid(world.getBlock(posX + i, posY + j, posZ + k))) - { - BlockTeleposer.swapBlocks(this, world, world, posX + i, posY, posZ + k, posX + i, posY + j, posZ + k); + for (int j = -1; j >= -vertRange; j--) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k) + && !SpellHelper.isBlockFluid(world.getBlock(posX + i, posY + j, posZ + k))) { + BlockTeleposer.swapBlocks( + this, world, world, posX + i, posY, posZ + k, posX + i, posY + j, posZ + k); break; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefensiveEarth.java index cc3892b1..b552c28e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefensiveEarth.java @@ -7,17 +7,14 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class SelfDefensiveEarth extends SelfSpellEffect -{ +public class SelfDefensiveEarth extends SelfSpellEffect { - public SelfDefensiveEarth(int power, int potency, int cost) - { + public SelfDefensiveEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { int pot = 2 * this.potencyUpgrades + 1; int duration = 20 * 60 * (this.powerUpgrades + 1); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfEnvironmentalEarth.java index 803cf07a..f9a66ce6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfEnvironmentalEarth.java @@ -1,36 +1,32 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth; +import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class SelfEnvironmentalEarth extends SelfSpellEffect -{ - public SelfEnvironmentalEarth(int power, int potency, int cost) - { +public class SelfEnvironmentalEarth extends SelfSpellEffect { + public SelfEnvironmentalEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { float radius = this.powerUpgrades * 2 + 1.5f; int dur = this.powerUpgrades * 5 * 20 + 60; - List entities = SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ, radius, radius); + List entities = + SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ, radius, radius); - for (Entity entity : entities) - { - if (entity instanceof EntityLivingBase) - { - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, dur, this.potencyUpgrades)); + for (Entity entity : entities) { + if (entity instanceof EntityLivingBase) { + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect(Potion.weakness.id, dur, this.potencyUpgrades)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfOffensiveEarth.java index c43ed78b..5bae1f71 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfOffensiveEarth.java @@ -6,16 +6,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class SelfOffensiveEarth extends SelfSpellEffect -{ - public SelfOffensiveEarth(int power, int potency, int cost) - { +public class SelfOffensiveEarth extends SelfSpellEffect { + public SelfOffensiveEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { int horizRadius = this.powerUpgrades; int vertRadius = this.potencyUpgrades + 1; @@ -25,14 +22,10 @@ public class SelfOffensiveEarth extends SelfSpellEffect int posY = (int) (blockVec.yCoord); int posZ = (int) (blockVec.zCoord); - for (int i = -horizRadius; i <= horizRadius; i++) - { - for (int j = -vertRadius; j < 0; j++) - { - for (int k = -horizRadius; k <= horizRadius; k++) - { - if (world.rand.nextFloat() < 0.7f) - { + for (int i = -horizRadius; i <= horizRadius; i++) { + for (int j = -vertRadius; j < 0; j++) { + for (int k = -horizRadius; k <= horizRadius; k++) { + if (world.rand.nextFloat() < 0.7f) { SpellHelper.smashBlock(world, posX + i, posY + j, posZ + k); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java index cd62fd34..4f841efa 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java @@ -8,18 +8,22 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class ToolEnvironmentalEarth extends DigAreaEffect -{ - public ToolEnvironmentalEarth(int power, int potency, int cost) - { +public class ToolEnvironmentalEarth extends DigAreaEffect { + public ToolEnvironmentalEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool) - { - if (!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) - { + public int digSurroundingArea( + ItemStack container, + World world, + EntityPlayer player, + MovingObjectPosition blockPos, + String usedToolClass, + float blockHardness, + int harvestLvl, + ItemSpellMultiTool itemTool) { + if (!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) { return 0; } @@ -40,8 +44,7 @@ public class ToolEnvironmentalEarth extends DigAreaEffect int posZ = radius; int negZ = radius; - switch (sidehit) - { + switch (sidehit) { case UP: posY = 0; negY = depth; @@ -70,12 +73,9 @@ public class ToolEnvironmentalEarth extends DigAreaEffect default: } - for (int xPos = x - negX; xPos <= x + posX; xPos++) - { - for (int yPos = y - negY; yPos <= y + posY; yPos++) - { - for (int zPos = z - negZ; zPos <= z + posZ; zPos++) - { + for (int xPos = x - negX; xPos <= x + posX; xPos++) { + for (int yPos = y - negY; yPos <= y + posY; yPos++) { + for (int zPos = z - negZ; zPos <= z + posZ; zPos++) { this.breakBlock(container, world, player, blockHardness, xPos, yPos, zPos, itemTool); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolOffensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolOffensiveEarth.java index 7ad0c879..16322a6e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolOffensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolOffensiveEarth.java @@ -1,32 +1,29 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.ItemManipulator; +import java.util.LinkedList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import java.util.LinkedList; -import java.util.List; +public class ToolOffensiveEarth extends ItemManipulator { + public static Block[] mundaneList = + new Block[] {Blocks.stone, Blocks.cobblestone, Blocks.sand, Blocks.gravel, Blocks.netherrack, Blocks.dirt}; -public class ToolOffensiveEarth extends ItemManipulator -{ - public static Block[] mundaneList = new Block[]{Blocks.stone, Blocks.cobblestone, Blocks.sand, Blocks.gravel, Blocks.netherrack, Blocks.dirt}; - - public ToolOffensiveEarth(int power, int potency, int cost) - { + public ToolOffensiveEarth(int power, int potency, int cost) { super(power, potency, cost); } @Override - public List handleItemsOnBlockBroken(ItemStack toolStack, List itemList) - { + public List handleItemsOnBlockBroken(ItemStack toolStack, List itemList) { List newList = new LinkedList(); - for (ItemStack stack : itemList) - { - if (stack != null && stack.getItem() instanceof ItemBlock && !this.isMundaneBlock(((ItemBlock) stack.getItem()).field_150939_a)) - { + for (ItemStack stack : itemList) { + if (stack != null + && stack.getItem() instanceof ItemBlock + && !this.isMundaneBlock(((ItemBlock) stack.getItem()).field_150939_a)) { newList.add(stack); } } @@ -34,13 +31,9 @@ public class ToolOffensiveEarth extends ItemManipulator return newList; } - - public boolean isMundaneBlock(Block block) - { - for (Block test : mundaneList) - { - if (test.equals(block)) - { + public boolean isMundaneBlock(Block block) { + for (Block test : mundaneList) { + if (test.equals(block)) { return true; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefaultFire.java index b045a199..2b3f609c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefaultFire.java @@ -6,10 +6,8 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class MeleeDefaultFire extends ExtrapolatedMeleeEntityEffect -{ - public MeleeDefaultFire(int power, int potency, int cost) - { +public class MeleeDefaultFire extends ExtrapolatedMeleeEntityEffect { + public MeleeDefaultFire(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 + 0.3f * potency); this.setRadius(2 + 0.3f * potency); @@ -17,10 +15,8 @@ public class MeleeDefaultFire extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) - { - if (entity instanceof EntityLiving) - { + protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) { + if (entity instanceof EntityLiving) { entity.setFire(3 * this.powerUpgrades + 3); return true; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefensiveFire.java index 30ae1449..0dfe3afd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefensiveFire.java @@ -8,16 +8,13 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class MeleeDefensiveFire extends MeleeSpellWorldEffect -{ - public MeleeDefensiveFire(int power, int potency, int cost) - { +public class MeleeDefensiveFire extends MeleeSpellWorldEffect { + public MeleeDefensiveFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onWorldEffect(World world, EntityPlayer entityPlayer) - { + public void onWorldEffect(World world, EntityPlayer entityPlayer) { ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(entityPlayer.getLookVec()); int width = this.potencyUpgrades + 1; @@ -32,15 +29,18 @@ public class MeleeDefensiveFire extends MeleeSpellWorldEffect int zStart = (int) (lookVec.zCoord) + 1 * zOffset; int yStart = (int) (lookVec.yCoord) - 1; - for (int i = -width; i <= width; i++) - { - for (int j = 0; j < length; j++) - { - for (int k = 0; k < 3; k++) - { - if (world.isAirBlock(xStart + i * (zOffset) + j * (xOffset), yStart + k, zStart + i * (xOffset) + j * (zOffset))) - { - world.setBlock(xStart + i * (zOffset) + j * (xOffset), yStart + k, zStart + i * (xOffset) + j * (zOffset), Blocks.fire); + for (int i = -width; i <= width; i++) { + for (int j = 0; j < length; j++) { + for (int k = 0; k < 3; k++) { + if (world.isAirBlock( + xStart + i * (zOffset) + j * (xOffset), + yStart + k, + zStart + i * (xOffset) + j * (zOffset))) { + world.setBlock( + xStart + i * (zOffset) + j * (xOffset), + yStart + k, + zStart + i * (xOffset) + j * (zOffset), + Blocks.fire); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeEnvironmentalFire.java index 9ef25810..a5f92abd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeEnvironmentalFire.java @@ -5,25 +5,19 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class MeleeEnvironmentalFire extends MeleeSpellCenteredWorldEffect -{ - public MeleeEnvironmentalFire(int power, int potency, int cost) - { +public class MeleeEnvironmentalFire extends MeleeSpellCenteredWorldEffect { + public MeleeEnvironmentalFire(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 * power + 2); } @Override - public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) - { + public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) { int radius = this.potencyUpgrades; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { SpellHelper.evaporateWaterBlock(world, posX + i, posY + j, posZ + k); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeOffensiveFire.java index af02b553..eed3b5a1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeOffensiveFire.java @@ -1,17 +1,15 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect; -public class MeleeOffensiveFire extends ExtrapolatedMeleeEntityEffect -{ - public MeleeOffensiveFire(int power, int potency, int cost) - { +public class MeleeOffensiveFire extends ExtrapolatedMeleeEntityEffect { + public MeleeOffensiveFire(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 + 0.3f * potency); this.setRadius(2 + 0.3f * potency); @@ -19,11 +17,13 @@ public class MeleeOffensiveFire extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) - { - if (entity instanceof EntityLivingBase) - { - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFireFuse.id, 20 * (7 - this.powerUpgrades), this.potencyUpgrades)); + protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) { + if (entity instanceof EntityLivingBase) { + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect( + AlchemicalWizardry.customPotionFireFuse.id, + 20 * (7 - this.powerUpgrades), + this.potencyUpgrades)); return true; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefaultFire.java index 0f1316a3..7159243d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefaultFire.java @@ -8,16 +8,13 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class ProjectileDefaultFire extends ProjectileImpactEffect -{ - public ProjectileDefaultFire(int power, int potency, int cost) - { +public class ProjectileDefaultFire extends ProjectileImpactEffect { + public ProjectileDefaultFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { + public void onEntityImpact(Entity mop, Entity proj) { Vec3 blockVec = SpellHelper.getEntityBlockVector(mop); int x = (int) (blockVec.xCoord); @@ -28,14 +25,10 @@ public class ProjectileDefaultFire extends ProjectileImpactEffect int horizRange = 0; int vertRange = 0; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (world.isAirBlock(x + i, y + j, z + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (world.isAirBlock(x + i, y + j, z + k)) { world.setBlock(x + i, y + j, z + k, Blocks.fire); } } @@ -44,8 +37,7 @@ public class ProjectileDefaultFire extends ProjectileImpactEffect } @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { + public void onTileImpact(World world, MovingObjectPosition mop) { int x = mop.blockX; int y = mop.blockY; int z = mop.blockZ; @@ -53,14 +45,10 @@ public class ProjectileDefaultFire extends ProjectileImpactEffect int horizRange = 0; int vertRange = 0; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (world.isAirBlock(x + i, y + j, z + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (world.isAirBlock(x + i, y + j, z + k)) { world.setBlock(x + i, y + j, z + k, Blocks.fire); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefensiveFire.java index ddaa2fcf..c16990c4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileDefensiveFire.java @@ -6,22 +6,18 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ProjectileDefensiveFire extends ProjectileImpactEffect -{ - public ProjectileDefensiveFire(int power, int potency, int cost) - { +public class ProjectileDefensiveFire extends ProjectileImpactEffect { + public ProjectileDefensiveFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { + public void onEntityImpact(Entity mop, Entity proj) { mop.setFire(3 * (this.potencyUpgrades + 1)); } @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { + public void onTileImpact(World world, MovingObjectPosition mop) { int horizRange = this.powerUpgrades; int vertRange = this.powerUpgrades; @@ -29,14 +25,10 @@ public class ProjectileDefensiveFire extends ProjectileImpactEffect int posY = mop.blockY; int posZ = mop.blockZ; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k)) { SpellHelper.smeltBlockInWorld(world, posX + i, posY + j, posZ + k); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileEnvironmentalFire.java index dea915b5..f8736a75 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileEnvironmentalFire.java @@ -6,16 +6,13 @@ import net.minecraft.entity.Entity; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class ProjectileEnvironmentalFire extends ProjectileUpdateEffect -{ - public ProjectileEnvironmentalFire(int power, int potency, int cost) - { +public class ProjectileEnvironmentalFire extends ProjectileUpdateEffect { + public ProjectileEnvironmentalFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onUpdateEffect(Entity projectile) - { + public void onUpdateEffect(Entity projectile) { Vec3 posVec = SpellHelper.getEntityBlockVector(projectile); int horizRange = this.powerUpgrades + 1; @@ -27,14 +24,10 @@ public class ProjectileEnvironmentalFire extends ProjectileUpdateEffect World worldObj = projectile.worldObj; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (!worldObj.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (!worldObj.isAirBlock(posX + i, posY + j, posZ + k)) { SpellHelper.evaporateWaterBlock(worldObj, posX + i, posY + j, posZ + k); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileOffensiveFire.java index ed95e428..06465889 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ProjectileOffensiveFire.java @@ -8,16 +8,13 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class ProjectileOffensiveFire extends ProjectileImpactEffect -{ - public ProjectileOffensiveFire(int power, int potency, int cost) - { +public class ProjectileOffensiveFire extends ProjectileImpactEffect { + public ProjectileOffensiveFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { + public void onEntityImpact(Entity mop, Entity proj) { int horizRange = this.powerUpgrades; int vertDepth = 3 * this.potencyUpgrades + 1; @@ -29,14 +26,10 @@ public class ProjectileOffensiveFire extends ProjectileImpactEffect World world = mop.worldObj; - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertDepth; j < 0; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertDepth; j < 0; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (world.isAirBlock(posX + i, posY + j, posZ + k)) { world.setBlock(posX + i, posY + j, posZ + k, Blocks.flowing_lava, 7, 3); } } @@ -45,7 +38,5 @@ public class ProjectileOffensiveFire extends ProjectileImpactEffect } @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { - } + public void onTileImpact(World world, MovingObjectPosition mop) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java index a5bc740b..074d8996 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java @@ -4,16 +4,13 @@ import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class SelfDefaultFire extends SelfSpellEffect -{ - public SelfDefaultFire(int power, int potency, int cost) - { +public class SelfDefaultFire extends SelfSpellEffect { + public SelfDefaultFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { player.setFire((int) (10 * Math.pow(1.5, powerUpgrades + 1.5 * potencyUpgrades))); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java index f0826849..2cee8043 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java @@ -7,17 +7,14 @@ import net.minecraft.init.Blocks; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class SelfDefensiveFire extends SelfSpellEffect -{ +public class SelfDefensiveFire extends SelfSpellEffect { - public SelfDefensiveFire(int power, int potency, int cost) - { + public SelfDefensiveFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { int horizRange = this.powerUpgrades; int vertDepth = 3 * this.potencyUpgrades + 1; @@ -27,14 +24,10 @@ public class SelfDefensiveFire extends SelfSpellEffect int posY = (int) (blockVector.yCoord); int posZ = (int) (blockVector.zCoord); - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertDepth; j < 0; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { - if (world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertDepth; j < 0; j++) { + for (int k = -horizRange; k <= horizRange; k++) { + if (world.isAirBlock(posX + i, posY + j, posZ + k)) { world.setBlock(posX + i, posY + j, posZ + k, Blocks.flowing_lava, 7, 3); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfEnvironmentalFire.java index e933e17d..d5de43d3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfEnvironmentalFire.java @@ -6,16 +6,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class SelfEnvironmentalFire extends SelfSpellEffect -{ - public SelfEnvironmentalFire(int power, int potency, int cost) - { +public class SelfEnvironmentalFire extends SelfSpellEffect { + public SelfEnvironmentalFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { int posX = (int) Math.round(player.posX - 0.5f); int posY = (int) player.posY; int posZ = (int) Math.round(player.posZ - 0.5f); @@ -23,34 +20,24 @@ public class SelfEnvironmentalFire extends SelfSpellEffect int powRadius = this.powerUpgrades; int potRadius = this.potencyUpgrades - 1; - for (int i = -powRadius; i <= powRadius; i++) - { - for (int j = -powRadius; j <= powRadius; j++) - { - for (int k = -powRadius; k <= powRadius; k++) - { - if (world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -powRadius; i <= powRadius; i++) { + for (int j = -powRadius; j <= powRadius; j++) { + for (int k = -powRadius; k <= powRadius; k++) { + if (world.isAirBlock(posX + i, posY + j, posZ + k)) { world.setBlock(posX + i, posY + j, posZ + k, Blocks.fire); - } } } } - for (int i = -potRadius; i <= potRadius; i++) - { - for (int j = -potRadius; j <= potRadius; j++) - { - for (int k = -potRadius; k <= potRadius; k++) - { - if (!world.isAirBlock(posX + i, posY + j, posZ + k)) - { + for (int i = -potRadius; i <= potRadius; i++) { + for (int j = -potRadius; j <= potRadius; j++) { + for (int k = -potRadius; k <= potRadius; k++) { + if (!world.isAirBlock(posX + i, posY + j, posZ + k)) { SpellHelper.smeltBlockInWorld(world, posX + i, posY + j, posZ + k); } } } } - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java index 08641a38..675ba157 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java @@ -6,16 +6,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class SelfOffensiveFire extends SelfSpellEffect -{ - public SelfOffensiveFire(int power, int potency, int cost) - { +public class SelfOffensiveFire extends SelfSpellEffect { + public SelfOffensiveFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { - player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlameCloak.id, 300 * (2 * this.powerUpgrades + 1), this.potencyUpgrades)); + public void onSelfUse(World world, EntityPlayer player) { + player.addPotionEffect(new PotionEffect( + AlchemicalWizardry.customPotionFlameCloak.id, + 300 * (2 * this.powerUpgrades + 1), + this.potencyUpgrades)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolDefaultFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolDefaultFire.java index c6d7478b..db99384f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolDefaultFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolDefaultFire.java @@ -1,36 +1,28 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.ItemManipulator; +import java.util.LinkedList; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; -import java.util.LinkedList; -import java.util.List; - -public class ToolDefaultFire extends ItemManipulator -{ - public ToolDefaultFire(int power, int potency, int cost) - { +public class ToolDefaultFire extends ItemManipulator { + public ToolDefaultFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public List handleItemsOnBlockBroken(ItemStack toolStack, List itemList) - { + public List handleItemsOnBlockBroken(ItemStack toolStack, List itemList) { LinkedList newList = new LinkedList(); - for (ItemStack item : itemList) - { + for (ItemStack item : itemList) { ItemStack newItem = FurnaceRecipes.smelting().getSmeltingResult(item); - if (newItem != null) - { + if (newItem != null) { newList.add(newItem); - } else - { + } else { newList.add(item); } } return newList; } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolEnvironmentalFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolEnvironmentalFire.java index 518ccc2d..b2ab58b0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolEnvironmentalFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolEnvironmentalFire.java @@ -1,6 +1,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.OnBreakBlockEffect; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -8,33 +9,36 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Random; - -public class ToolEnvironmentalFire extends OnBreakBlockEffect -{ - public ToolEnvironmentalFire(int power, int potency, int cost) - { +public class ToolEnvironmentalFire extends OnBreakBlockEffect { + public ToolEnvironmentalFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken) - { + public int onBlockBroken( + ItemStack container, + World world, + EntityPlayer player, + Block block, + int meta, + int x, + int y, + int z, + ForgeDirection sideBroken) { int amount = 0; int cost = (int) (250 * (1 - 0.1f * powerUpgrades) * Math.pow(0.85, costUpgrades)); int radius = this.powerUpgrades; float chance = 0.35f + 0.15f * this.potencyUpgrades; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { Block blockAffected = world.getBlock(x + i - sideBroken.offsetX, y + j, z + k - sideBroken.offsetZ); - if ((new Random().nextFloat() <= chance) && (blockAffected == Blocks.gravel || blockAffected == Blocks.stone || blockAffected == Blocks.cobblestone)) - { + if ((new Random().nextFloat() <= chance) + && (blockAffected == Blocks.gravel + || blockAffected == Blocks.stone + || blockAffected == Blocks.cobblestone)) { world.setBlock(x + i - sideBroken.offsetX, y + j, z + k - sideBroken.offsetZ, Blocks.lava); amount += cost; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolOffensiveFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolOffensiveFire.java index c7a94579..007a33bd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolOffensiveFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/ToolOffensiveFire.java @@ -4,16 +4,13 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.to import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public class ToolOffensiveFire extends LeftClickEffect -{ - public ToolOffensiveFire(int power, int potency, int cost) - { +public class ToolOffensiveFire extends LeftClickEffect { + public ToolOffensiveFire(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) - { + public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) { attacked.setFire(3 + 4 * this.powerUpgrades); return (int) (10 * (1 + this.powerUpgrades) * Math.pow(0.85, this.costUpgrades)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefaultIce.java index cd546753..a4e243bb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefaultIce.java @@ -5,10 +5,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class MeleeDefaultIce extends ExtrapolatedMeleeEntityEffect -{ - public MeleeDefaultIce(int power, int potency, int cost) - { +public class MeleeDefaultIce extends ExtrapolatedMeleeEntityEffect { + public MeleeDefaultIce(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 + 0.3f * potency); this.setRadius(2 + 0.3f * potency); @@ -16,10 +14,8 @@ public class MeleeDefaultIce extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) - { - if (entity.hurtResistantTime > 0) - { + protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) { + if (entity.hurtResistantTime > 0) { entity.hurtResistantTime = Math.max(0, -(potencyUpgrades + 1) + entity.hurtResistantTime); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefensiveIce.java index 0eb02f85..5a78a43c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeDefensiveIce.java @@ -8,16 +8,13 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class MeleeDefensiveIce extends MeleeSpellWorldEffect -{ - public MeleeDefensiveIce(int power, int potency, int cost) - { +public class MeleeDefensiveIce extends MeleeSpellWorldEffect { + public MeleeDefensiveIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onWorldEffect(World world, EntityPlayer entityPlayer) - { + public void onWorldEffect(World world, EntityPlayer entityPlayer) { ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(entityPlayer.getLookVec()); int width = this.powerUpgrades; @@ -34,12 +31,9 @@ public class MeleeDefensiveIce extends MeleeSpellWorldEffect int zStart = (int) (lookVec.zCoord) + range * zOffset; int yStart = (int) (lookVec.yCoord); - for (int i = -width; i <= width; i++) - { - for (int j = 0; j < height; j++) - { - if (world.isAirBlock(xStart + i * (zOffset), yStart + j, zStart + i * (xOffset))) - { + for (int i = -width; i <= width; i++) { + for (int j = 0; j < height; j++) { + if (world.isAirBlock(xStart + i * (zOffset), yStart + j, zStart + i * (xOffset))) { world.setBlock(xStart + i * (zOffset), yStart + j, zStart + i * (xOffset), Blocks.ice); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java index 1f735537..ba6ae394 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java @@ -6,10 +6,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.world.World; -public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect -{ - public MeleeEnvironmentalIce(int power, int potency, int cost) - { +public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect { + public MeleeEnvironmentalIce(int power, int potency, int cost) { super(power, potency, cost); this.setMaxNumberHit(1 + potency); this.setRadius(2); @@ -17,16 +15,15 @@ public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) - { - //TODO Change to an Ice Cage - for (int i = 0; i <= this.powerUpgrades; i++) - { + protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) { + // TODO Change to an Ice Cage + for (int i = 0; i <= this.powerUpgrades; i++) { double randX = (world.rand.nextDouble() - world.rand.nextDouble()) * 3; double randY = -world.rand.nextDouble() * 3; double randZ = (world.rand.nextDouble() - world.rand.nextDouble()) * 3; - EntitySnowball snowball = new EntitySnowball(world, entity.posX - 3 * randX, entity.posY - 3 * randY, entity.posZ - 3 * randZ); + EntitySnowball snowball = new EntitySnowball( + world, entity.posX - 3 * randX, entity.posY - 3 * randY, entity.posZ - 3 * randZ); snowball.motionX = randX; snowball.motionY = randY; snowball.motionZ = randZ; @@ -36,5 +33,4 @@ public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect return true; } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java index 3245ba16..f8eef147 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java @@ -8,10 +8,8 @@ import net.minecraft.init.Blocks; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect -{ - public MeleeOffensiveIce(int power, int potency, int cost) - { +public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect { + public MeleeOffensiveIce(int power, int potency, int cost) { super(power, potency, cost); this.setMaxNumberHit(1 + potency); this.setRadius(2); @@ -19,8 +17,7 @@ public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) - { + protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) { Vec3 blockVector = SpellHelper.getEntityBlockVector(entity); int posX = (int) (blockVector.xCoord); @@ -29,10 +26,8 @@ public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect entity.motionY = 1 * (0.3 * this.powerUpgrades + 0.90); - for (int i = 0; i < 2; i++) - { - if (world.isAirBlock(posX, posY + i, posZ)) - { + for (int i = 0; i < 2; i++) { + if (world.isAirBlock(posX, posY + i, posZ)) { world.setBlock(posX, posY + i, posZ, Blocks.ice); } } @@ -40,5 +35,4 @@ public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect entity.fallDistance = 0.0f; return true; } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefaultIce.java index 1f4c7831..07b5d592 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefaultIce.java @@ -7,30 +7,23 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class ProjectileDefaultIce extends ProjectileImpactEffect -{ - public ProjectileDefaultIce(int power, int potency, int cost) - { +public class ProjectileDefaultIce extends ProjectileImpactEffect { + public ProjectileDefaultIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { - - } + public void onEntityImpact(Entity mop, Entity proj) {} @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { + public void onTileImpact(World world, MovingObjectPosition mop) { ForgeDirection sideHit = ForgeDirection.getOrientation(mop.sideHit); int posX = mop.blockX + sideHit.offsetX; int posY = mop.blockY + sideHit.offsetY; int posZ = mop.blockZ + sideHit.offsetZ; - if (world.isAirBlock(posX, posY, posZ)) - { + if (world.isAirBlock(posX, posY, posZ)) { world.setBlock(posX, posY, posZ, Blocks.ice); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java index 655439e3..982e664f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java @@ -7,22 +7,16 @@ import net.minecraft.init.Blocks; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ProjectileDefensiveIce extends ProjectileImpactEffect -{ - public ProjectileDefensiveIce(int power, int potency, int cost) - { +public class ProjectileDefensiveIce extends ProjectileImpactEffect { + public ProjectileDefensiveIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { - - } + public void onEntityImpact(Entity mop, Entity proj) {} @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { + public void onTileImpact(World world, MovingObjectPosition mop) { int horizRadius = this.powerUpgrades + 1; int vertRadius = this.potencyUpgrades; @@ -30,16 +24,13 @@ public class ProjectileDefensiveIce extends ProjectileImpactEffect int posY = mop.blockY; int posZ = mop.blockZ; - for (int i = -horizRadius; i <= horizRadius; i++) - { - for (int k = -horizRadius; k <= horizRadius; k++) - { - for (int j = -vertRadius; j <= vertRadius; j++) - { + for (int i = -horizRadius; i <= horizRadius; i++) { + for (int k = -horizRadius; k <= horizRadius; k++) { + for (int j = -vertRadius; j <= vertRadius; j++) { SpellHelper.freezeWaterBlock(world, posX + i, posY + j, posZ + k); - if (world.isAirBlock(posX + i, posY + j, posZ + k) && !world.isAirBlock(posX + i, posY + j - 1, posZ + k)) - { + if (world.isAirBlock(posX + i, posY + j, posZ + k) + && !world.isAirBlock(posX + i, posY + j - 1, posZ + k)) { world.setBlock(posX + i, posY + j, posZ + k, Blocks.snow); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java index ad7a3ab6..ace6c95b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java @@ -5,17 +5,14 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.Entity; import net.minecraft.util.Vec3; -public class ProjectileEnvironmentalIce extends ProjectileUpdateEffect -{ +public class ProjectileEnvironmentalIce extends ProjectileUpdateEffect { - public ProjectileEnvironmentalIce(int power, int potency, int cost) - { + public ProjectileEnvironmentalIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onUpdateEffect(Entity projectile) - { + public void onUpdateEffect(Entity projectile) { Vec3 posVec = SpellHelper.getEntityBlockVector(projectile); int horizRange = this.powerUpgrades + 1; @@ -25,12 +22,9 @@ public class ProjectileEnvironmentalIce extends ProjectileUpdateEffect int posY = (int) (posVec.yCoord); int posZ = (int) (posVec.zCoord); - for (int i = -horizRange; i <= horizRange; i++) - { - for (int j = -vertRange; j <= vertRange; j++) - { - for (int k = -horizRange; k <= horizRange; k++) - { + for (int i = -horizRange; i <= horizRange; i++) { + for (int j = -vertRange; j <= vertRange; j++) { + for (int k = -horizRange; k <= horizRange; k++) { SpellHelper.freezeWaterBlock(projectile.worldObj, posX + i, posY + j, posZ + k); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java index ce770091..93b5c4d1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java @@ -8,25 +8,20 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ProjectileOffensiveIce extends ProjectileImpactEffect -{ - public ProjectileOffensiveIce(int power, int potency, int cost) - { +public class ProjectileOffensiveIce extends ProjectileImpactEffect { + public ProjectileOffensiveIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { - if (mop instanceof EntityLivingBase) - { - ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 60 * (this.powerUpgrades + 1), this.potencyUpgrades)); + public void onEntityImpact(Entity mop, Entity proj) { + if (mop instanceof EntityLivingBase) { + ((EntityLivingBase) mop) + .addPotionEffect(new PotionEffect( + Potion.moveSlowdown.id, 60 * (this.powerUpgrades + 1), this.potencyUpgrades)); } } @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { - - } + public void onTileImpact(World world, MovingObjectPosition mop) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefaultIce.java index 8361a4f0..b5811aee 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefaultIce.java @@ -7,16 +7,13 @@ import net.minecraft.init.Blocks; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class SelfDefaultIce extends SelfSpellEffect -{ - public SelfDefaultIce(int power, int potency, int cost) - { +public class SelfDefaultIce extends SelfSpellEffect { + public SelfDefaultIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { Vec3 blockVector = SpellHelper.getEntityBlockVector(player); int posX = (int) (blockVector.xCoord); @@ -26,10 +23,8 @@ public class SelfDefaultIce extends SelfSpellEffect double yVel = 1 * (0.4 * this.powerUpgrades + 0.75); SpellHelper.setPlayerSpeedFromServer(player, player.motionX, yVel, player.motionZ); - for (int i = 0; i < 2; i++) - { - if (world.isAirBlock(posX, posY + i, posZ)) - { + for (int i = 0; i < 2; i++) { + if (world.isAirBlock(posX, posY + i, posZ)) { world.setBlock(posX, posY + i, posZ, Blocks.ice); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefensiveIce.java index cc9ab9e3..2cdbfa60 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfDefensiveIce.java @@ -6,16 +6,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class SelfDefensiveIce extends SelfSpellEffect -{ - public SelfDefensiveIce(int power, int potency, int cost) - { +public class SelfDefensiveIce extends SelfSpellEffect { + public SelfDefensiveIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { - player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionIceCloak.id, 300 * (2 * this.powerUpgrades + 1), this.potencyUpgrades)); + public void onSelfUse(World world, EntityPlayer player) { + player.addPotionEffect(new PotionEffect( + AlchemicalWizardry.customPotionIceCloak.id, 300 * (2 * this.powerUpgrades + 1), this.potencyUpgrades)); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfEnvironmentalIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfEnvironmentalIce.java index 871fbc0a..12ad8f3a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfEnvironmentalIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfEnvironmentalIce.java @@ -8,16 +8,13 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class SelfEnvironmentalIce extends SelfSpellEffect -{ - public SelfEnvironmentalIce(int power, int potency, int cost) - { +public class SelfEnvironmentalIce extends SelfSpellEffect { + public SelfEnvironmentalIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(player.getLookVec()); int width = this.potencyUpgrades + 1; @@ -32,13 +29,15 @@ public class SelfEnvironmentalIce extends SelfSpellEffect int zStart = (int) (lookVec.zCoord); int yStart = (int) (lookVec.yCoord) - 1; - for (int i = -width; i <= width; i++) - { - for (int j = 0; j < length; j++) - { - if (world.isAirBlock(xStart + i * (zOffset) + j * (xOffset), yStart, zStart + i * (xOffset) + j * (zOffset))) - { - world.setBlock(xStart + i * (zOffset) + j * (xOffset), yStart, zStart + i * (xOffset) + j * (zOffset), Blocks.ice); + for (int i = -width; i <= width; i++) { + for (int j = 0; j < length; j++) { + if (world.isAirBlock( + xStart + i * (zOffset) + j * (xOffset), yStart, zStart + i * (xOffset) + j * (zOffset))) { + world.setBlock( + xStart + i * (zOffset) + j * (xOffset), + yStart, + zStart + i * (xOffset) + j * (zOffset), + Blocks.ice); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfOffensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfOffensiveIce.java index 95072ab6..f0889ded 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfOffensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/SelfOffensiveIce.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.i import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -9,41 +10,35 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.List; - -public class SelfOffensiveIce extends SelfSpellEffect -{ - public SelfOffensiveIce(int power, int potency, int cost) - { +public class SelfOffensiveIce extends SelfSpellEffect { + public SelfOffensiveIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { double horizRadius = this.powerUpgrades + 1; double vertRadius = 0.5 * this.powerUpgrades + 1; - List entities = SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ, horizRadius, vertRadius); + List entities = + SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ, horizRadius, vertRadius); - if (entities == null) - { + if (entities == null) { return; } int i = 0; int number = this.powerUpgrades + 1; - for (Entity entity : entities) - { - if (i >= number) - { + for (Entity entity : entities) { + if (i >= number) { continue; } - if (entity instanceof EntityLivingBase && !entity.equals(player)) - { - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 60 * (1 + this.powerUpgrades), this.potencyUpgrades)); + if (entity instanceof EntityLivingBase && !entity.equals(player)) { + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect( + Potion.moveSlowdown.id, 60 * (1 + this.powerUpgrades), this.potencyUpgrades)); i++; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefaultIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefaultIce.java index a4aa47e7..2df8e36f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefaultIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefaultIce.java @@ -6,16 +6,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -public class ToolDefaultIce extends LeftClickEffect -{ - public ToolDefaultIce(int power, int potency, int cost) - { +public class ToolDefaultIce extends LeftClickEffect { + public ToolDefaultIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) - { + public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) { int duration = 200; attacked.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration, this.powerUpgrades)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java index 37070d7c..c06ee036 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.i import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.SummonToolEffect; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; @@ -12,27 +13,22 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - -public class ToolDefensiveIce extends SummonToolEffect -{ - public ToolDefensiveIce(int power, int potency, int cost) - { +public class ToolDefensiveIce extends SummonToolEffect { + public ToolDefensiveIce(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onSummonTool(ItemStack toolStack, World world, Entity entity) - { + public int onSummonTool(ItemStack toolStack, World world, Entity entity) { int horizRadius = this.powerUpgrades * 2 + 2; int vertRadius = this.powerUpgrades * 3 + 2; - List entityList = SpellHelper.getEntitiesInRange(world, entity.posX, entity.posY, entity.posZ, horizRadius, vertRadius); + List entityList = + SpellHelper.getEntitiesInRange(world, entity.posX, entity.posY, entity.posZ, horizRadius, vertRadius); - for (Entity ent : entityList) - { - if (ent instanceof EntityLivingBase && !ent.equals(entity)) - { - ((EntityLivingBase) ent).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, this.potencyUpgrades * 2)); + for (Entity ent : entityList) { + if (ent instanceof EntityLivingBase && !ent.equals(entity)) { + ((EntityLivingBase) ent) + .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, this.potencyUpgrades * 2)); } } @@ -42,15 +38,12 @@ public class ToolDefensiveIce extends SummonToolEffect int y = (int) (blockVec.yCoord); int z = (int) (blockVec.zCoord); - for (int posX = x - horizRadius; posX <= x + horizRadius; posX++) - { - for (int posY = y - vertRadius; posY <= y + vertRadius; posY++) - { - for (int posZ = z - horizRadius; posZ <= z + horizRadius; posZ++) - { + for (int posX = x - horizRadius; posX <= x + horizRadius; posX++) { + for (int posY = y - vertRadius; posY <= y + vertRadius; posY++) { + for (int posZ = z - horizRadius; posZ <= z + horizRadius; posZ++) { SpellHelper.freezeWaterBlock(world, posX, posY, posZ); - if (world.isSideSolid(posX, posY, posZ, ForgeDirection.UP) && world.isAirBlock(posX, posY + 1, posZ)) - { + if (world.isSideSolid(posX, posY, posZ, ForgeDirection.UP) + && world.isAirBlock(posX, posY + 1, posZ)) { world.setBlock(posX, posY + 1, posZ, Blocks.snow_layer); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java index eac176c4..1a923156 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaEffect.java @@ -4,33 +4,35 @@ import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.api.spell.IDigAreaEffect; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; 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.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - -public class DigAreaEffect implements IDigAreaEffect -{ +public class DigAreaEffect implements IDigAreaEffect { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public DigAreaEffect(int power, int potency, int cost) - { + public DigAreaEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; } @Override - public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool) - { - if (!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) - { + public int digSurroundingArea( + ItemStack container, + World world, + EntityPlayer player, + MovingObjectPosition blockPos, + String usedToolClass, + float blockHardness, + int harvestLvl, + ItemSpellMultiTool itemTool) { + if (!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) { return 0; } @@ -38,12 +40,9 @@ public class DigAreaEffect implements IDigAreaEffect int y = blockPos.blockY; int z = blockPos.blockZ; - for (int xPos = x - 1; xPos <= x + 1; xPos++) - { - for (int yPos = y - 1; yPos <= y + 1; yPos++) - { - for (int zPos = z - 1; zPos <= z + 1; zPos++) - { + for (int xPos = x - 1; xPos <= x + 1; xPos++) { + for (int yPos = y - 1; yPos <= y + 1; yPos++) { + for (int zPos = z - 1; zPos <= z + 1; zPos++) { this.breakBlock(container, world, player, blockHardness, xPos, yPos, zPos, itemTool); } } @@ -52,8 +51,15 @@ public class DigAreaEffect implements IDigAreaEffect return 0; } - public void breakBlock(ItemStack container, World world, EntityPlayer player, float blockHardness, int x, int y, int z, ItemSpellMultiTool itemTool) - { + public void breakBlock( + ItemStack container, + World world, + EntityPlayer player, + float blockHardness, + int x, + int y, + int z, + ItemSpellMultiTool itemTool) { int hlvl = -1; Block localBlock = world.getBlock(x, y, z); int localMeta = world.getBlockMetadata(x, y, z); @@ -64,57 +70,56 @@ public class DigAreaEffect implements IDigAreaEffect float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z); - if (hlvl <= toolLevel && localHardness - this.getHardnessDifference() <= blockHardness) - { + if (hlvl <= toolLevel && localHardness - this.getHardnessDifference() <= blockHardness) { boolean cancelHarvest = false; - if (!cancelHarvest) - { - if (localBlock != null && !(localHardness < 0)) - { + if (!cancelHarvest) { + if (localBlock != null && !(localHardness < 0)) { boolean isEffective = false; String localToolClass = itemTool.getToolClassForMaterial(localBlock.getMaterial()); - if (localToolClass != null && itemTool.getHarvestLevel(container, toolClass) >= localBlock.getHarvestLevel(localMeta)) - { + if (localToolClass != null + && itemTool.getHarvestLevel(container, toolClass) + >= localBlock.getHarvestLevel(localMeta)) { isEffective = true; } - if (localBlock.getMaterial().isToolNotRequired()) - { + if (localBlock.getMaterial().isToolNotRequired()) { isEffective = true; } - if (!player.capabilities.isCreativeMode) - { - if (isEffective) - { - if (localBlock.removedByPlayer(world, player, x, y, z)) - { + if (!player.capabilities.isCreativeMode) { + if (isEffective) { + if (localBlock.removedByPlayer(world, player, x, y, z)) { localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta); } localBlock.onBlockHarvested(world, x, y, z, localMeta, player); if (localHardness > 0f) itemTool.onBlockDestroyed(container, world, localBlock, x, y, z, player); - List items = SpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, itemTool.getSilkTouch(container), itemTool.getFortuneLevel(container)); + List items = SpellHelper.getItemsFromBlock( + world, + localBlock, + x, + y, + z, + localMeta, + itemTool.getSilkTouch(container), + itemTool.getFortuneLevel(container)); SpellParadigmTool parad = itemTool.loadParadigmFromStack(container); items = parad.handleItemList(container, items); - if (!world.isRemote) - { + if (!world.isRemote) { SpellHelper.spawnItemListInWorld(items, world, x + 0.5f, y + 0.5f, z + 0.5f); } world.func_147479_m(x, y, z); - } else - { + } else { } - } else - { + } else { world.setBlockToAir(x, y, z); world.func_147479_m(x, y, z); } @@ -123,8 +128,7 @@ public class DigAreaEffect implements IDigAreaEffect } } - public float getHardnessDifference() - { + public float getHardnessDifference() { return 1.5f; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java index ce304d09..d2e7e5da 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/DigAreaTunnel.java @@ -1,33 +1,36 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.LinkedList; import java.util.List; import java.util.Random; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class DigAreaTunnel extends DigAreaEffect -{ +public class DigAreaTunnel extends DigAreaEffect { Random rand = new Random(); - public DigAreaTunnel(int power, int potency, int cost) - { + public DigAreaTunnel(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool) - { - if (!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) - { + public int digSurroundingArea( + ItemStack container, + World world, + EntityPlayer player, + MovingObjectPosition blockPos, + String usedToolClass, + float blockHardness, + int harvestLvl, + ItemSpellMultiTool itemTool) { + if (!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) { return 0; } @@ -43,7 +46,8 @@ public class DigAreaTunnel extends DigAreaEffect double initialLength = this.getRandomVectorLength(); - Vec3 initialVector = SpellHelper.createVec3(opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); + Vec3 initialVector = SpellHelper.createVec3( + opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); Vec3 lastVec = SpellHelper.createVec3(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord); vectorLine.add(initialVector); @@ -51,15 +55,17 @@ public class DigAreaTunnel extends DigAreaEffect double currentLength = lastVec.lengthVector(); double totalLength = this.totalLength(); - while (currentLength < totalLength - 0.01) - { + while (currentLength < totalLength - 0.01) { Vec3 tempVec = lastVec.addVector(0, 0, 0); tempVec = tempVec.normalize(); double varr = this.varyRate(); - tempVec = tempVec.addVector(varr * (rand.nextFloat() - rand.nextFloat()), varr * (rand.nextFloat() - rand.nextFloat()), varr * (rand.nextFloat() - rand.nextFloat())); + tempVec = tempVec.addVector( + varr * (rand.nextFloat() - rand.nextFloat()), + varr * (rand.nextFloat() - rand.nextFloat()), + varr * (rand.nextFloat() - rand.nextFloat())); tempVec = tempVec.normalize(); @@ -76,8 +82,7 @@ public class DigAreaTunnel extends DigAreaEffect currentLength += tempVec.lengthVector(); } - for (Vec3 testVec : vectorLine) - { + for (Vec3 testVec : vectorLine) { this.travelVector(testVec, world, initialX, initialY, initialZ); initialX += testVec.xCoord; @@ -90,46 +95,35 @@ public class DigAreaTunnel extends DigAreaEffect return 0; } - public double totalLength() - { + public double totalLength() { return 100; } - public double getStepSize() - { + public double getStepSize() { return 1; } - public double varyRate() - { + public double varyRate() { return 0.5; } - public double getRandomVectorLength() - { + public double getRandomVectorLength() { return 10; } - public double getRandomStepLength() - { + public double getRandomStepLength() { return 0.5; } - public int getRandomRadius() - { + public int getRandomRadius() { return 3; } - public void destroySphereOfMundane(World world, double x, double y, double z, int radius) - { - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) - { + public void destroySphereOfMundane(World world, double x, double y, double z, int radius) { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { + if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) { continue; } @@ -143,13 +137,11 @@ public class DigAreaTunnel extends DigAreaEffect } } - public void destroyMunadeAt(World world, int x, int y, int z) - { + public void destroyMunadeAt(World world, int x, int y, int z) { world.setBlockToAir(x, y, z); } - public void travelVector(Vec3 vector, World world, double x, double y, double z) - { + public void travelVector(Vec3 vector, World world, double x, double y, double z) { double vecLength = vector.lengthVector(); AlchemicalWizardry.logger.info(vecLength); Vec3 normVec = SpellHelper.createVec3(vector.xCoord, vector.yCoord, vector.zCoord); @@ -158,14 +150,14 @@ public class DigAreaTunnel extends DigAreaEffect Vec3 prevVec = SpellHelper.createVec3(0, 0, 0); double distanceTravelled = 0; - while (distanceTravelled < vecLength) - { + while (distanceTravelled < vecLength) { AlchemicalWizardry.logger.info(distanceTravelled); double stepLength = this.getRandomStepLength(); prevVec = prevVec.addVector(stepLength * normVec.xCoord, stepLength * normVec.yCoord, normVec.zCoord); - this.destroySphereOfMundane(world, prevVec.xCoord + x, prevVec.yCoord + y, prevVec.zCoord + z, this.getRandomRadius()); + this.destroySphereOfMundane( + world, prevVec.xCoord + x, prevVec.yCoord + y, prevVec.zCoord + z, this.getRandomRadius()); distanceTravelled = prevVec.lengthVector(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java index 4fe6295b..2d33017e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/ItemManipulator.java @@ -1,19 +1,15 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.api.spell.IItemManipulator; +import java.util.List; import net.minecraft.item.ItemStack; -import java.util.List; - -import WayofTime.alchemicalWizardry.api.spell.IItemManipulator; - -public abstract class ItemManipulator implements IItemManipulator -{ +public abstract class ItemManipulator implements IItemManipulator { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public ItemManipulator(int power, int potency, int cost) - { + public ItemManipulator(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java index 3cbfd2fc..bfbfff3c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/LeftClickEffect.java @@ -4,14 +4,12 @@ import WayofTime.alchemicalWizardry.api.spell.ILeftClickEffect; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public abstract class LeftClickEffect implements ILeftClickEffect -{ +public abstract class LeftClickEffect implements ILeftClickEffect { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public LeftClickEffect(int power, int potency, int cost) - { + public LeftClickEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java index a6af2688..e00f53d1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/OnBreakBlockEffect.java @@ -2,14 +2,12 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.t import WayofTime.alchemicalWizardry.api.spell.IOnBreakBlock; -public abstract class OnBreakBlockEffect implements IOnBreakBlock -{ +public abstract class OnBreakBlockEffect implements IOnBreakBlock { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public OnBreakBlockEffect(int power, int potency, int cost) - { + public OnBreakBlockEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java index 5eb7b5ae..3ebe89cc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickEffect.java @@ -2,14 +2,12 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.t import WayofTime.alchemicalWizardry.api.spell.IRightClickEffect; -public abstract class RightClickEffect implements IRightClickEffect -{ +public abstract class RightClickEffect implements IRightClickEffect { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public RightClickEffect(int power, int potency, int cost) - { + public RightClickEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java index 6d53b912..752bfadc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/RightClickTunnel.java @@ -1,35 +1,29 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.LinkedList; import java.util.List; import java.util.Random; - import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class RightClickTunnel extends RightClickEffect -{ +public class RightClickTunnel extends RightClickEffect { Random rand = new Random(); - public RightClickTunnel(int power, int potency, int cost) - { + public RightClickTunnel(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onRightClickBlock(ItemStack stack, EntityLivingBase weilder, World world, MovingObjectPosition mop) - { - if (weilder.worldObj.isRemote) - { + public int onRightClickBlock(ItemStack stack, EntityLivingBase weilder, World world, MovingObjectPosition mop) { + if (weilder.worldObj.isRemote) { return 0; } - if (!mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) - { + if (!mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) { return 0; } @@ -43,7 +37,8 @@ public class RightClickTunnel extends RightClickEffect double initialLength = this.getRandomVectorLength(); - Vec3 initialVector = SpellHelper.createVec3(opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); + Vec3 initialVector = SpellHelper.createVec3( + opposite.offsetX * initialLength, opposite.offsetY * initialLength, opposite.offsetZ * initialLength); Vec3 lastVec = SpellHelper.createVec3(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord); vectorLine.add(initialVector); @@ -51,15 +46,17 @@ public class RightClickTunnel extends RightClickEffect double currentLength = lastVec.lengthVector(); double totalLength = this.totalLength(); - while (currentLength < totalLength - 0.01) - { + while (currentLength < totalLength - 0.01) { Vec3 tempVec = lastVec.addVector(0, 0, 0); tempVec = tempVec.normalize(); double varr = this.varyRate(); - tempVec = tempVec.addVector(varr * (rand.nextFloat() - rand.nextFloat()), varr * (rand.nextFloat() - rand.nextFloat()), varr * (rand.nextFloat() - rand.nextFloat())); + tempVec = tempVec.addVector( + varr * (rand.nextFloat() - rand.nextFloat()), + varr * (rand.nextFloat() - rand.nextFloat()), + varr * (rand.nextFloat() - rand.nextFloat())); tempVec = tempVec.normalize(); @@ -76,8 +73,7 @@ public class RightClickTunnel extends RightClickEffect currentLength += tempVec.lengthVector(); } - for (Vec3 testVec : vectorLine) - { + for (Vec3 testVec : vectorLine) { this.travelVector(testVec, world, initialX, initialY, initialZ); initialX += testVec.xCoord; @@ -91,51 +87,39 @@ public class RightClickTunnel extends RightClickEffect } @Override - public int onRightClickAir(ItemStack stack, EntityLivingBase weilder) - { + public int onRightClickAir(ItemStack stack, EntityLivingBase weilder) { return 0; } - public double totalLength() - { + public double totalLength() { return 100; } - public double getStepSize() - { + public double getStepSize() { return 1; } - public double varyRate() - { + public double varyRate() { return 0.5; } - public double getRandomVectorLength() - { + public double getRandomVectorLength() { return 10; } - public double getRandomStepLength() - { + public double getRandomStepLength() { return 0.5; } - public int getRandomRadius() - { + public int getRandomRadius() { return 3; } - public void destroySphereOfMundane(World world, double x, double y, double z, int radius) - { - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) - { + public void destroySphereOfMundane(World world, double x, double y, double z, int radius) { + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { + if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) { continue; } @@ -149,13 +133,11 @@ public class RightClickTunnel extends RightClickEffect } } - public void destroyMunadeAt(World world, int x, int y, int z) - { + public void destroyMunadeAt(World world, int x, int y, int z) { world.setBlockToAir(x, y, z); } - public void travelVector(Vec3 vector, World world, double x, double y, double z) - { + public void travelVector(Vec3 vector, World world, double x, double y, double z) { double vecLength = vector.lengthVector(); Vec3 normVec = SpellHelper.createVec3(vector.xCoord, vector.yCoord, vector.zCoord); @@ -164,13 +146,13 @@ public class RightClickTunnel extends RightClickEffect Vec3 prevVec = SpellHelper.createVec3(0, 0, 0); double distanceTravelled = 0; - while (distanceTravelled < vecLength) - { + while (distanceTravelled < vecLength) { double stepLength = this.getRandomStepLength(); prevVec = prevVec.addVector(stepLength * normVec.xCoord, stepLength * normVec.yCoord, normVec.zCoord); - this.destroySphereOfMundane(world, prevVec.xCoord + x, prevVec.yCoord + y, prevVec.zCoord + z, this.getRandomRadius()); + this.destroySphereOfMundane( + world, prevVec.xCoord + x, prevVec.yCoord + y, prevVec.zCoord + z, this.getRandomRadius()); distanceTravelled = prevVec.lengthVector(); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java index 8a14beb0..55a10bc6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/tool/SummonToolEffect.java @@ -2,14 +2,12 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.t import WayofTime.alchemicalWizardry.api.spell.IOnSummonTool; -public abstract class SummonToolEffect implements IOnSummonTool -{ +public abstract class SummonToolEffect implements IOnSummonTool { protected int powerUpgrades; protected int potencyUpgrades; protected int costUpgrades; - public SummonToolEffect(int power, int potency, int cost) - { + public SummonToolEffect(int power, int potency, int cost) { this.powerUpgrades = power; this.potencyUpgrades = potency; this.costUpgrades = cost; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefaultWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefaultWind.java index 803acb7e..7b4ee1bc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefaultWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefaultWind.java @@ -1,15 +1,13 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind; +import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect; -public class MeleeDefaultWind extends ExtrapolatedMeleeEntityEffect -{ - public MeleeDefaultWind(int power, int potency, int cost) - { +public class MeleeDefaultWind extends ExtrapolatedMeleeEntityEffect { + public MeleeDefaultWind(int power, int potency, int cost) { super(power, potency, cost); this.setRange(4 + 2.0f * potency); this.setRadius(4 + 2.0f * potency); @@ -17,12 +15,10 @@ public class MeleeDefaultWind extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer player) - { + protected boolean entityEffect(World world, Entity entity, EntityPlayer player) { double wantedVel = -(0.5d + 0.7d * this.powerUpgrades); - if (entity instanceof EntityLivingBase) - { + if (entity instanceof EntityLivingBase) { double dist = Math.sqrt(entity.getDistanceToEntity(player)); double xVel = wantedVel * (entity.posX - player.posX) / dist; double yVel = wantedVel * (entity.posY - player.posY) / dist; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefensiveWind.java index 34aef636..99cb4883 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeDefensiveWind.java @@ -6,10 +6,8 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class MeleeDefensiveWind extends ExtrapolatedMeleeEntityEffect -{ - public MeleeDefensiveWind(int power, int potency, int cost) - { +public class MeleeDefensiveWind extends ExtrapolatedMeleeEntityEffect { + public MeleeDefensiveWind(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 + 0.3f * potency); this.setRadius(2 + 0.3f * potency); @@ -17,12 +15,10 @@ public class MeleeDefensiveWind extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer player) - { + protected boolean entityEffect(World world, Entity entity, EntityPlayer player) { double wantedVel = 0.5d + 0.5d * this.powerUpgrades; - if (entity instanceof EntityLiving) - { + if (entity instanceof EntityLiving) { entity.motionY = wantedVel; return true; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeEnvironmentalWind.java index ddd90274..a87b5f35 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeEnvironmentalWind.java @@ -2,32 +2,26 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.w import WayofTime.alchemicalWizardry.api.spell.MeleeSpellCenteredWorldEffect; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import java.util.List; - -public class MeleeEnvironmentalWind extends MeleeSpellCenteredWorldEffect -{ - public MeleeEnvironmentalWind(int power, int potency, int cost) - { +public class MeleeEnvironmentalWind extends MeleeSpellCenteredWorldEffect { + public MeleeEnvironmentalWind(int power, int potency, int cost) { super(power, potency, cost); this.setRange(5 * power + 5); } @Override - public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) - { + public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ) { int radius = 5 * this.potencyUpgrades + 3; List entities = SpellHelper.getEntitiesInRange(world, posX, posY, posZ, radius, radius); - for (Entity entity : entities) - { - if (entity instanceof EntityItem) - { + for (Entity entity : entities) { + if (entity instanceof EntityItem) { ((EntityItem) entity).delayBeforeCanPickup = 0; entity.onCollideWithPlayer(player); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java index 8dd15f71..bd636822 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java @@ -1,15 +1,13 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind; +import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect; -public class MeleeOffensiveWind extends ExtrapolatedMeleeEntityEffect -{ - public MeleeOffensiveWind(int power, int potency, int cost) - { +public class MeleeOffensiveWind extends ExtrapolatedMeleeEntityEffect { + public MeleeOffensiveWind(int power, int potency, int cost) { super(power, potency, cost); this.setRange(3 + 0.3f * potency); this.setRadius(2 + 0.3f * potency); @@ -17,12 +15,10 @@ public class MeleeOffensiveWind extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity, EntityPlayer player) - { + protected boolean entityEffect(World world, Entity entity, EntityPlayer player) { double wantedVel = 1.0d + 1.0d * this.powerUpgrades; - if (entity instanceof EntityLivingBase) - { + if (entity instanceof EntityLivingBase) { double dist = Math.sqrt(entity.getDistanceToEntity(player)); double xVel = wantedVel * (entity.posX - player.posX) / dist; double yVel = wantedVel * (entity.posY - player.posY + 0.5f) / dist; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileDefaultWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileDefaultWind.java index 111028dd..f561be1f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileDefaultWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileDefaultWind.java @@ -5,23 +5,17 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ProjectileDefaultWind extends ProjectileImpactEffect -{ - public ProjectileDefaultWind(int power, int potency, int cost) - { +public class ProjectileDefaultWind extends ProjectileImpactEffect { + public ProjectileDefaultWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { + public void onEntityImpact(Entity mop, Entity proj) { mop.motionX = proj.motionX; mop.motionZ = proj.motionZ; } @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { - - } + public void onTileImpact(World world, MovingObjectPosition mop) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileEnvironmentalWind.java index e9d53d3d..d67a87b3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileEnvironmentalWind.java @@ -3,40 +3,32 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.w import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile; import WayofTime.alchemicalWizardry.api.spell.ProjectileUpdateEffect; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import java.util.List; - -public class ProjectileEnvironmentalWind extends ProjectileUpdateEffect -{ - public ProjectileEnvironmentalWind(int power, int potency, int cost) - { +public class ProjectileEnvironmentalWind extends ProjectileUpdateEffect { + public ProjectileEnvironmentalWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onUpdateEffect(Entity projectile) - { + public void onUpdateEffect(Entity projectile) { int horizRange = this.powerUpgrades + 1; int vertRange = 1 * this.potencyUpgrades + 1; World worldObj = projectile.worldObj; - if (projectile instanceof EntitySpellProjectile) - { + if (projectile instanceof EntitySpellProjectile) { Entity shooter = ((EntitySpellProjectile) projectile).shootingEntity; - if (shooter instanceof EntityPlayer) - { - List entitylist = SpellHelper.getEntitiesInRange(worldObj, projectile.posX, projectile.posY, projectile.posZ, horizRange, vertRange); - if (entitylist != null) - { - for (Entity entity : entitylist) - { - if (entity instanceof EntityItem) - { + if (shooter instanceof EntityPlayer) { + List entitylist = SpellHelper.getEntitiesInRange( + worldObj, projectile.posX, projectile.posY, projectile.posZ, horizRange, vertRange); + if (entitylist != null) { + for (Entity entity : entitylist) { + if (entity instanceof EntityItem) { ((EntityItem) entity).delayBeforeCanPickup = 0; entity.onCollideWithPlayer((EntityPlayer) shooter); } @@ -44,7 +36,5 @@ public class ProjectileEnvironmentalWind extends ProjectileUpdateEffect } } } - - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileOffensiveWind.java index 691f8cdd..d519ec3e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ProjectileOffensiveWind.java @@ -1,33 +1,29 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.spell.ProjectileImpactEffect; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.PotionEffect; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.spell.ProjectileImpactEffect; -public class ProjectileOffensiveWind extends ProjectileImpactEffect -{ - public ProjectileOffensiveWind(int power, int potency, int cost) - { +public class ProjectileOffensiveWind extends ProjectileImpactEffect { + public ProjectileOffensiveWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onEntityImpact(Entity mop, Entity proj) - { - if (mop instanceof EntityLivingBase) - { - ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, (100 * (2 * this.powerUpgrades + 1) * (1 / (this.potencyUpgrades + 1))), this.potencyUpgrades)); + public void onEntityImpact(Entity mop, Entity proj) { + if (mop instanceof EntityLivingBase) { + ((EntityLivingBase) mop) + .addPotionEffect(new PotionEffect( + AlchemicalWizardry.customPotionHeavyHeart.id, + (100 * (2 * this.powerUpgrades + 1) * (1 / (this.potencyUpgrades + 1))), + this.potencyUpgrades)); } } @Override - public void onTileImpact(World world, MovingObjectPosition mop) - { - - } + public void onTileImpact(World world, MovingObjectPosition mop) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefaultWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefaultWind.java index 9c8dff52..17e8f07d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefaultWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefaultWind.java @@ -4,16 +4,13 @@ import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class SelfDefaultWind extends SelfSpellEffect -{ - public SelfDefaultWind(int power, int potency, int cost) - { +public class SelfDefaultWind extends SelfSpellEffect { + public SelfDefaultWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { player.extinguish(); player.fallDistance = 0; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefensiveWind.java index 819fdcd2..7b4d6379 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfDefensiveWind.java @@ -3,24 +3,20 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.w import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import java.util.List; - -public class SelfDefensiveWind extends SelfSpellEffect -{ - public SelfDefensiveWind(int power, int potency, int cost) - { +public class SelfDefensiveWind extends SelfSpellEffect { + public SelfDefensiveWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { double radius = 1.5d * this.powerUpgrades + 1.5d; double posX = player.posX; double posY = player.posY; @@ -28,11 +24,11 @@ public class SelfDefensiveWind extends SelfSpellEffect List entities = SpellHelper.getEntitiesInRange(world, posX, posY, posZ, radius, radius); - for (Entity entity : entities) - { - if ((!entity.equals(player)) && entity instanceof EntityLiving) - { - ((EntityLiving) entity).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, 200, this.potencyUpgrades)); + for (Entity entity : entities) { + if ((!entity.equals(player)) && entity instanceof EntityLiving) { + ((EntityLiving) entity) + .addPotionEffect(new PotionEffect( + AlchemicalWizardry.customPotionHeavyHeart.id, 200, this.potencyUpgrades)); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java index efbe60ea..af967d15 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java @@ -1,24 +1,20 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind; +import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class SelfEnvironmentalWind extends SelfSpellEffect -{ - public SelfEnvironmentalWind(int power, int potency, int cost) - { +public class SelfEnvironmentalWind extends SelfSpellEffect { + public SelfEnvironmentalWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { double radius = 1.5d * this.potencyUpgrades + 1; double posX = player.posX; double posY = player.posY - 0.7d; @@ -27,10 +23,8 @@ public class SelfEnvironmentalWind extends SelfSpellEffect List entities = SpellHelper.getEntitiesInRange(world, posX, posY, posZ, radius, radius); - for (Entity entity : entities) - { - if ((!entity.equals(player)) && entity instanceof EntityLivingBase) - { + for (Entity entity : entities) { + if ((!entity.equals(player)) && entity instanceof EntityLivingBase) { double dist = Math.sqrt(entity.getDistanceToEntity(player)); double xVel = wantedVel * (entity.posX - posX) / dist; double yVel = wantedVel * (entity.posY - posY) / dist; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfOffensiveWind.java index 6fafe165..33846b0f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfOffensiveWind.java @@ -6,20 +6,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class SelfOffensiveWind extends SelfSpellEffect -{ - public SelfOffensiveWind(int power, int potency, int cost) - { +public class SelfOffensiveWind extends SelfSpellEffect { + public SelfOffensiveWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public void onSelfUse(World world, EntityPlayer player) - { + public void onSelfUse(World world, EntityPlayer player) { Vec3 vec = player.getLookVec(); double wantedVelocity = 1.5 + this.powerUpgrades * 0.4; - SpellHelper.setPlayerSpeedFromServer(player, vec.xCoord * wantedVelocity, vec.yCoord * wantedVelocity, vec.zCoord * wantedVelocity); + SpellHelper.setPlayerSpeedFromServer( + player, vec.xCoord * wantedVelocity, vec.yCoord * wantedVelocity, vec.zCoord * wantedVelocity); player.fallDistance = 0; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolDefensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolDefensiveWind.java index 261209b5..f43cc648 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolDefensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolDefensiveWind.java @@ -5,16 +5,13 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.Vec3; -public class ToolDefensiveWind extends LeftClickEffect -{ - public ToolDefensiveWind(int power, int potency, int cost) - { +public class ToolDefensiveWind extends LeftClickEffect { + public ToolDefensiveWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) - { + public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) { Vec3 vec = weilder.getLookVec(); vec.yCoord = 0; vec.normalize(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolEnvironmentalWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolEnvironmentalWind.java index b325fc36..cb3c3f8c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolEnvironmentalWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolEnvironmentalWind.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.w import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.OnBreakBlockEffect; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -9,26 +10,29 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - -public class ToolEnvironmentalWind extends OnBreakBlockEffect -{ - public ToolEnvironmentalWind(int power, int potency, int cost) - { +public class ToolEnvironmentalWind extends OnBreakBlockEffect { + public ToolEnvironmentalWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken) - { + public int onBlockBroken( + ItemStack container, + World world, + EntityPlayer player, + Block block, + int meta, + int x, + int y, + int z, + ForgeDirection sideBroken) { double vertRange = 0.5 + (this.powerUpgrades * this.powerUpgrades + this.powerUpgrades) / 2; - List itemList = SpellHelper.getItemsInRange(world, x + 0.5f, y + 0.5f, z + 0.5f, vertRange, vertRange); + List itemList = + SpellHelper.getItemsInRange(world, x + 0.5f, y + 0.5f, z + 0.5f, vertRange, vertRange); - for (EntityItem entity : itemList) - { - if (!world.isRemote) - { + for (EntityItem entity : itemList) { + if (!world.isRemote) { entity.delayBeforeCanPickup = 0; entity.onCollideWithPlayer(player); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolOffensiveWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolOffensiveWind.java index df508e7d..e816d2bd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolOffensiveWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/ToolOffensiveWind.java @@ -6,17 +6,17 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; -public class ToolOffensiveWind extends LeftClickEffect -{ - public ToolOffensiveWind(int power, int potency, int cost) - { +public class ToolOffensiveWind extends LeftClickEffect { + public ToolOffensiveWind(int power, int potency, int cost) { super(power, potency, cost); } @Override - public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) - { - attacked.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, (100 * (2 * this.powerUpgrades + 1) * (1 / (this.potencyUpgrades + 1))), this.potencyUpgrades)); + public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) { + attacked.addPotionEffect(new PotionEffect( + AlchemicalWizardry.customPotionHeavyHeart.id, + (100 * (2 * this.powerUpgrades + 1) * (1 / (this.potencyUpgrades + 1))), + this.potencyUpgrades)); return (int) (100 * (0.5 * this.potencyUpgrades + 1) * (this.powerUpgrades + 1) * Math.pow(0.85, costUpgrades)); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpell.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpell.java index 30f3849b..b2ca3621 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpell.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpell.java @@ -5,100 +5,88 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public abstract class HomSpell implements ISimpleSpell -{ +public abstract class HomSpell implements ISimpleSpell { private int offensiveRangedEnergy; private int offensiveMeleeEnergy; private int defensiveEnergy; private int environmentalEnergy; - public HomSpell() - { - //super(id); - //this.setMaxStackSize(1); + public HomSpell() { + // super(id); + // this.setMaxStackSize(1); // TODO Auto-generated constructor stub } @Override - public abstract ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); + public abstract ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); @Override - public abstract ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); + public abstract ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); @Override - public abstract ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); + public abstract ItemStack onDefensiveRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); @Override - public abstract ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); + public abstract ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); - public int getOffensiveRangedEnergy() - { + public int getOffensiveRangedEnergy() { return offensiveRangedEnergy; } - public int getOffensiveMeleeEnergy() - { + public int getOffensiveMeleeEnergy() { return offensiveMeleeEnergy; } - public int getDefensiveEnergy() - { + public int getDefensiveEnergy() { return defensiveEnergy; } - public int getEnvironmentalEnergy() - { + public int getEnvironmentalEnergy() { return environmentalEnergy; } - public void setEnergies(int offensiveRanged, int offensiveMelee, int defensive, int environmental) - { + public void setEnergies(int offensiveRanged, int offensiveMelee, int defensive, int environmental) { this.offensiveRangedEnergy = offensiveRanged; this.offensiveMeleeEnergy = offensiveMelee; this.defensiveEnergy = defensive; this.environmentalEnergy = environmental; } - public void setSpellParadigm(ItemStack itemStack, int paradigm) - { - if (itemStack.getTagCompound() == null) - { + public void setSpellParadigm(ItemStack itemStack, int paradigm) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } itemStack.getTagCompound().setInteger("paradigm", paradigm); } - public int getSpellParadigm(ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public int getSpellParadigm(ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } return (itemStack.getTagCompound().getInteger("paradigm")); } - //@Override - public ItemStack useSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + // @Override + public ItemStack useSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { int paradigm = getSpellParadigm(par1ItemStack); - if (par3EntityPlayer.isSneaking()) - { - if (paradigm < 3) - { + if (par3EntityPlayer.isSneaking()) { + if (paradigm < 3) { this.setSpellParadigm(par1ItemStack, paradigm + 1); - } else - { + } else { this.setSpellParadigm(par1ItemStack, 0); } return par1ItemStack; } - switch (paradigm) - { + switch (paradigm) { case 0: return this.onOffensiveRangedRightClick(par1ItemStack, par2World, par3EntityPlayer); @@ -115,24 +103,23 @@ public abstract class HomSpell implements ISimpleSpell return par1ItemStack; } -// @Override -// public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) -// { -// if (!(par1ItemStack.getTagCompound() == null)) -// { -// if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) -// { -// par3List.add("Current owner: " + par1ItemStack.getTagCompound().getString("ownerName")); -// } -// -// par3List.add("Current paradigm: " + this.getSpellParadigm(par1ItemStack)); -// } -// } + // @Override + // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean + // par4) + // { + // if (!(par1ItemStack.getTagCompound() == null)) + // { + // if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) + // { + // par3List.add("Current owner: " + par1ItemStack.getTagCompound().getString("ownerName")); + // } + // + // par3List.add("Current paradigm: " + this.getSpellParadigm(par1ItemStack)); + // } + // } - public int getDimensionID(ItemStack itemStack) - { - if (itemStack.getTagCompound() == null) - { + public int getDimensionID(ItemStack itemStack) { + if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellComponent.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellComponent.java index d4b7e0bb..8256d487 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellComponent.java @@ -2,24 +2,20 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import net.minecraft.item.ItemStack; -public class HomSpellComponent -{ +public class HomSpellComponent { public HomSpell spell; public ItemStack item; - public HomSpellComponent(ItemStack item, HomSpell spell) - { + public HomSpellComponent(ItemStack item, HomSpell spell) { this.item = item; this.spell = spell; } - public HomSpell getSpell() - { + public HomSpell getSpell() { return spell; } - public ItemStack getItemStack() - { + public ItemStack getItemStack() { return this.item; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellRegistry.java index c4f5ac28..32cba0c4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellRegistry.java @@ -1,48 +1,35 @@ package WayofTime.alchemicalWizardry.common.spell.simple; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - import java.util.ArrayList; import java.util.List; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; -public class HomSpellRegistry -{ +public class HomSpellRegistry { public static List spellList = new ArrayList(); - public static void registerBasicSpell(ItemStack item, HomSpell spell) - { + public static void registerBasicSpell(ItemStack item, HomSpell spell) { spellList.add(new HomSpellComponent(item, spell)); } - public static HomSpell getSpellForItemStack(ItemStack testItem) - { - if (testItem == null) - { + public static HomSpell getSpellForItemStack(ItemStack testItem) { + if (testItem == null) { return null; } - for (HomSpellComponent hsc : spellList) - { + for (HomSpellComponent hsc : spellList) { ItemStack item = hsc.getItemStack(); - if (item != null) - { - if (item.getItem() instanceof ItemBlock) - { - if (testItem.getItem() instanceof ItemBlock) - { - if (testItem.getItem() == item.getItem()) - { + if (item != null) { + if (item.getItem() instanceof ItemBlock) { + if (testItem.getItem() instanceof ItemBlock) { + if (testItem.getItem() == item.getItem()) { return hsc.getSpell(); } } - } else - { - if (!(testItem.getItem() instanceof ItemBlock)) - { - if (testItem.getItem() == item.getItem()) - { + } else { + if (!(testItem.getItem() instanceof ItemBlock)) { + if (testItem.getItem() == item.getItem()) { return hsc.getSpell(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/ISimpleSpell.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/ISimpleSpell.java index 01c70978..04160548 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/ISimpleSpell.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/ISimpleSpell.java @@ -4,8 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface ISimpleSpell -{ +public interface ISimpleSpell { ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellEarthBender.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellEarthBender.java index 94d6bf35..73a3f6dd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellEarthBender.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellEarthBender.java @@ -3,35 +3,31 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.Random; - -public class SpellEarthBender extends HomSpell -{ +public class SpellEarthBender extends HomSpell { Random itemRand = new Random(); - public SpellEarthBender() - { + public SpellEarthBender() { super(); this.setEnergies(100, 150, 350, 200); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.spawnEntityInWorld(new MudProjectile(par2World, par3EntityPlayer, 8, false)); @@ -40,25 +36,31 @@ public class SpellEarthBender extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } - if (!par2World.isRemote) - { - for (int i = -1; i <= 1; i++) - { - for (int j = -1; j <= 1; j++) - { - par2World.spawnEntityInWorld(new MudProjectile(par2World, par3EntityPlayer, 3, 3, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 10F, par3EntityPlayer.rotationPitch + j * 5F, true)); + if (!par2World.isRemote) { + for (int i = -1; i <= 1; i++) { + for (int j = -1; j <= 1; j++) { + par2World.spawnEntityInWorld(new MudProjectile( + par2World, + par3EntityPlayer, + 3, + 3, + par3EntityPlayer.posX, + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), + par3EntityPlayer.posZ, + par3EntityPlayer.rotationYaw + i * 10F, + par3EntityPlayer.rotationPitch + j * 5F, + true)); } } } @@ -67,15 +69,12 @@ public class SpellEarthBender extends HomSpell } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } @@ -87,85 +86,97 @@ public class SpellEarthBender extends HomSpell int posZ = (int) zCoord; Block blockID = Blocks.stone; - if (par2World.isAirBlock(posX, posY + 3, posZ)) - { + if (par2World.isAirBlock(posX, posY + 3, posZ)) { par2World.setBlock(posX, posY + 3, posZ, Blocks.glass); } - for (int i = 0; i < 4; i++) - { - for (int j = 0; j < 4; j++) - { - if (par2World.isAirBlock(posX + i - 1, posY + j, posZ - 2)) - { + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + if (par2World.isAirBlock(posX + i - 1, posY + j, posZ - 2)) { par2World.setBlock(posX + i - 1, posY + j, posZ - 2, blockID); } - if (par2World.isAirBlock(posX + 2, posY + j, posZ - 1 + i)) - { + if (par2World.isAirBlock(posX + 2, posY + j, posZ - 1 + i)) { par2World.setBlock(posX + 2, posY + j, posZ - 1 + i, blockID); } - if (par2World.isAirBlock(posX - i + 1, posY + j, posZ + 2)) - { + if (par2World.isAirBlock(posX - i + 1, posY + j, posZ + 2)) { par2World.setBlock(posX - i + 1, posY + j, posZ + 2, blockID); } - if (par2World.isAirBlock(posX - 2, posY + j, posZ + 1 - i)) - { + if (par2World.isAirBlock(posX - 2, posY + j, posZ + 1 - i)) { par2World.setBlock(posX - 2, posY + j, posZ + 1 - i, blockID); } { - if (par2World.isAirBlock(posX - 1 + i, posY + 3, posZ - 1 + j)) - { + if (par2World.isAirBlock(posX - 1 + i, posY + 3, posZ - 1 + j)) { par2World.setBlock(posX - 1 + i, posY + 3, posZ - 1 + j, blockID); } } } } - for (int i = 0; i < 20; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F); + for (int i = 0; i < 20; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + 0.0F, + 0.410F, + 1.0F); } return par1ItemStack; } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } int range = 3; - if (!par2World.isRemote) - { - for (int i = -range; i <= range; i++) - { - for (int j = -1; j <= 1; j++) - { - for (int k = -range; k <= range; k++) - { - if (par2World.getBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k) == Blocks.water || par2World.getBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k) == Blocks.flowing_water) - { + if (!par2World.isRemote) { + for (int i = -range; i <= range; i++) { + for (int j = -1; j <= 1; j++) { + for (int k = -range; k <= range; k++) { + if (par2World.getBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k) + == Blocks.water + || par2World.getBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k) + == Blocks.flowing_water) { int x = par2World.rand.nextInt(2); - if (x == 0) - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.sand); - } else - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.dirt); + if (x == 0) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k, + Blocks.sand); + } else { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k, + Blocks.dirt); } } } @@ -177,9 +188,21 @@ public class SpellEarthBender extends HomSpell double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; - for (int i = 0; i < 16; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F); + for (int i = 0; i < 16; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + 0.0F, + 0.410F, + 1.0F); } return par1ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellExplosions.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellExplosions.java index 4bf48cf2..857cca9b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellExplosions.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellExplosions.java @@ -2,39 +2,34 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import java.util.Random; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.Random; - -public class SpellExplosions extends HomSpell -{ +public class SpellExplosions extends HomSpell { Random itemRand = new Random(); - public SpellExplosions() - { + public SpellExplosions() { super(); this.setEnergies(400, 500, 1900, 1500); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new ExplosionProjectile(par2World, par3EntityPlayer, 6, true)); } @@ -42,61 +37,72 @@ public class SpellExplosions extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } int distance = 4; double yaw = par3EntityPlayer.rotationYaw / 180 * Math.PI; double pitch = par3EntityPlayer.rotationPitch / 180 * Math.PI; - par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance), par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance, (float) (3), true); + par2World.createExplosion( + par3EntityPlayer, + par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance), + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, + par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance, + (float) (3), + true); return par1ItemStack; } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } int distance = 4; - par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, (float) (distance), false); + par2World.createExplosion( + par3EntityPlayer, + par3EntityPlayer.posX, + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), + par3EntityPlayer.posZ, + (float) (distance), + false); return par1ItemStack; } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } int radius = 3; - for (int i = 0; i < 360; i += 36) - { - par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX + Math.cos(i) * radius, par3EntityPlayer.posY, par3EntityPlayer.posZ + Math.sin(i) * radius, (float) (2), true); + for (int i = 0; i < 360; i += 36) { + par2World.createExplosion( + par3EntityPlayer, + par3EntityPlayer.posX + Math.cos(i) * radius, + par3EntityPlayer.posY, + par3EntityPlayer.posZ + Math.sin(i) * radius, + (float) (2), + true); } return null; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFireBurst.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFireBurst.java index 7e030d91..4058d04c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFireBurst.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFireBurst.java @@ -2,6 +2,9 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -10,37 +13,29 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public class SpellFireBurst extends HomSpell -{ +public class SpellFireBurst extends HomSpell { public Random itemRand = new Random(); - public SpellFireBurst() - { + public SpellFireBurst() { super(); this.setEnergies(100, 300, 400, 100); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { + if (!par2World.isRemote) { FireProjectile proj = new FireProjectile(par2World, par3EntityPlayer, 7); par2World.spawnEntityInWorld(proj); } @@ -49,27 +44,32 @@ public class SpellFireBurst extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { - for (int i = -1; i <= 1; i++) - { - for (int j = -1; j <= 1; j++) - { - par2World.spawnEntityInWorld(new FireProjectile(par2World, par3EntityPlayer, 8, 2, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 10F, par3EntityPlayer.rotationPitch + j * 10F)); + if (!par2World.isRemote) { + for (int i = -1; i <= 1; i++) { + for (int j = -1; j <= 1; j++) { + par2World.spawnEntityInWorld(new FireProjectile( + par2World, + par3EntityPlayer, + 8, + 2, + par3EntityPlayer.posX, + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), + par3EntityPlayer.posZ, + par3EntityPlayer.rotationYaw + i * 10F, + par3EntityPlayer.rotationPitch + j * 10F)); } } } @@ -78,32 +78,33 @@ public class SpellFireBurst extends HomSpell } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); int d0 = 2; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (par3EntityPlayer.posX + 1), (par3EntityPlayer.posY + 2), (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + par3EntityPlayer.posX, + par3EntityPlayer.posY, + par3EntityPlayer.posZ, + (par3EntityPlayer.posX + 1), + (par3EntityPlayer.posY + 2), + (par3EntityPlayer.posZ + 1)) + .expand(d0, d0, d0); List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { EntityLivingBase entityLiving = (EntityLivingBase) iterator.next(); - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.equals(par3EntityPlayer)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.equals(par3EntityPlayer)) { continue; } } @@ -115,31 +116,31 @@ public class SpellFireBurst extends HomSpell } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - for (int i = -1; i <= 1; i++) - { - for (int j = -1; j <= 1; j++) - { - for (int k = -1; k <= 1; k++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k)) - { - if (par2World.rand.nextFloat() < 0.8F) - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.fire); + for (int i = -1; i <= 1; i++) { + for (int j = -1; j <= 1; j++) { + for (int k = -1; k <= 1; k++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k)) { + if (par2World.rand.nextFloat() < 0.8F) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k, + Blocks.fire); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFrozenWater.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFrozenWater.java index 8d3e8873..13bbc762 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFrozenWater.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellFrozenWater.java @@ -2,41 +2,36 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.Random; - -public class SpellFrozenWater extends HomSpell -{ +public class SpellFrozenWater extends HomSpell { public Random itemRand = new Random(); - public SpellFrozenWater() - { + public SpellFrozenWater() { super(); this.setEnergies(100, 200, 150, 100); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new IceProjectile(par2World, par3EntityPlayer, 6)); } @@ -44,31 +39,36 @@ public class SpellFrozenWater extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } - for (int i = -2; i <= 2; i++) - { - par2World.spawnEntityInWorld(new IceProjectile(par2World, par3EntityPlayer, 6, 2, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 5F, par3EntityPlayer.rotationPitch)); + for (int i = -2; i <= 2; i++) { + par2World.spawnEntityInWorld(new IceProjectile( + par2World, + par3EntityPlayer, + 6, + 2, + par3EntityPlayer.posX, + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), + par3EntityPlayer.posZ, + par3EntityPlayer.rotationYaw + i * 5F, + par3EntityPlayer.rotationPitch)); } return par1ItemStack; } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, getDefensiveEnergy()); } @@ -76,29 +76,35 @@ public class SpellFrozenWater extends HomSpell float pitch = par3EntityPlayer.rotationPitch; int range = 2; - if (pitch > 40F) - { - for (int i = -range; i <= range; i++) - { - for (int j = -range; j <= range; j++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY - 1, (int) par3EntityPlayer.posZ + j)) - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY - 1, (int) par3EntityPlayer.posZ + j, Blocks.ice); + if (pitch > 40F) { + for (int i = -range; i <= range; i++) { + for (int j = -range; j <= range; j++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY - 1, + (int) par3EntityPlayer.posZ + j)) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY - 1, + (int) par3EntityPlayer.posZ + j, + Blocks.ice); } } } return par1ItemStack; - } else if (pitch < -40F) - { - for (int i = -range; i <= range; i++) - { - for (int j = -range; j <= range; j++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ + j)) - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ + j, Blocks.ice); + } else if (pitch < -40F) { + for (int i = -range; i <= range; i++) { + for (int j = -range; j <= range; j++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + 3, + (int) par3EntityPlayer.posZ + j)) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + 3, + (int) par3EntityPlayer.posZ + j, + Blocks.ice); } } } @@ -106,51 +112,63 @@ public class SpellFrozenWater extends HomSpell return par1ItemStack; } - if ((yaw >= 315 && yaw < 360) || (yaw >= 0 && yaw < 45)) - { - for (int i = -range; i <= range; i++) - { - for (int j = 0; j < range * 2 + 1; j++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + 2)) - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + 2, Blocks.ice); + if ((yaw >= 315 && yaw < 360) || (yaw >= 0 && yaw < 45)) { + for (int i = -range; i <= range; i++) { + for (int j = 0; j < range * 2 + 1; j++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + 2)) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + 2, + Blocks.ice); } } } - } else if (yaw >= 45 && yaw < 135) - { - for (int i = -range; i <= range; i++) - { - for (int j = 0; j < range * 2 + 1; j++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX - 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i)) - { - par2World.setBlock((int) par3EntityPlayer.posX - 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i, Blocks.ice); + } else if (yaw >= 45 && yaw < 135) { + for (int i = -range; i <= range; i++) { + for (int j = 0; j < range * 2 + 1; j++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX - 2, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + i)) { + par2World.setBlock( + (int) par3EntityPlayer.posX - 2, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + i, + Blocks.ice); } } } - } else if (yaw >= 135 && yaw < 225) - { - for (int i = -range; i <= range; i++) - { - for (int j = 0; j < range * 2 + 1; j++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ - 2)) - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ - 2, Blocks.ice); + } else if (yaw >= 135 && yaw < 225) { + for (int i = -range; i <= range; i++) { + for (int j = 0; j < range * 2 + 1; j++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ - 2)) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ - 2, + Blocks.ice); } } } - } else - { - for (int i = -range; i <= range; i++) - { - for (int j = 0; j < range * 2 + 1; j++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i)) - { - par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i, Blocks.ice); + } else { + for (int i = -range; i <= range; i++) { + for (int j = 0; j < range * 2 + 1; j++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX + 2, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + i)) { + par2World.setBlock( + (int) par3EntityPlayer.posX + 2, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + i, + Blocks.ice); } } } @@ -160,25 +178,27 @@ public class SpellFrozenWater extends HomSpell } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } int radius = 3; - for (int i = -radius; i <= radius; i++) - { - for (int j = -radius; j <= radius; j++) - { - for (int k = -radius; k <= radius; k++) - { - Block block = par2World.getBlock((int) par3EntityPlayer.posX + i - 1, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k); - if (block == Blocks.water || block == Blocks.flowing_water) - { - par2World.setBlock((int) par3EntityPlayer.posX + i - 1, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.ice); + for (int i = -radius; i <= radius; i++) { + for (int j = -radius; j <= radius; j++) { + for (int k = -radius; k <= radius; k++) { + Block block = par2World.getBlock( + (int) par3EntityPlayer.posX + i - 1, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k); + if (block == Blocks.water || block == Blocks.flowing_water) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i - 1, + (int) par3EntityPlayer.posY + j, + (int) par3EntityPlayer.posZ + k, + Blocks.ice); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellHolyBlast.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellHolyBlast.java index 3102ba88..b0e81d2f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellHolyBlast.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellHolyBlast.java @@ -3,6 +3,9 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -10,37 +13,29 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public class SpellHolyBlast extends HomSpell -{ +public class SpellHolyBlast extends HomSpell { Random itemRand = new Random(); - public SpellHolyBlast() - { + public SpellHolyBlast() { super(); this.setEnergies(100, 300, 500, 400); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new HolyProjectile(par2World, par3EntityPlayer, 8)); } @@ -48,16 +43,15 @@ public class SpellHolyBlast extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } int distance = 2; @@ -67,26 +61,29 @@ public class SpellHolyBlast extends HomSpell double yCoord = par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance; double zCoord = par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance; float d0 = 0.5f; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX - 0.5 + Math.sin(yaw) * Math.cos(pitch) * (-distance), par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, par3EntityPlayer.posZ - 0.5 + Math.cos(yaw) * Math.cos(pitch) * distance, par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance) + 0.5, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance + 1, par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance + 0.5).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + par3EntityPlayer.posX - 0.5 + Math.sin(yaw) * Math.cos(pitch) * (-distance), + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, + par3EntityPlayer.posZ - 0.5 + Math.cos(yaw) * Math.cos(pitch) * distance, + par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance) + 0.5, + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance + 1, + par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance + 0.5) + .expand(d0, d0, d0); List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { EntityLivingBase entityLiving = (EntityLivingBase) iterator.next(); - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.equals(par3EntityPlayer)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.equals(par3EntityPlayer)) { continue; } } int i = 1; - if (entityLiving.isEntityUndead()) - { + if (entityLiving.isEntityUndead()) { i = 3; } entityLiving.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 5 * i); @@ -94,32 +91,48 @@ public class SpellHolyBlast extends HomSpell par2World.createExplosion(par3EntityPlayer, xCoord, yCoord, zCoord, (float) (1), false); - for (int i = 0; i < 5; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F); + for (int i = 0; i < 5; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + itemRand.nextFloat() - itemRand.nextFloat(), + yCoord + itemRand.nextFloat() - itemRand.nextFloat(), + zCoord + itemRand.nextFloat() - itemRand.nextFloat(), + 1.0F, + 1.0F, + 1.0F); } return par1ItemStack; } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } - if (!par2World.isRemote) - { - for (int i = 0; i < 360; i += 18) - { - par2World.spawnEntityInWorld(new HolyProjectile(par2World, par3EntityPlayer, 8, 3, par3EntityPlayer.posX, par3EntityPlayer.posY + (par3EntityPlayer.height / 2), par3EntityPlayer.posZ, i, 0)); + if (!par2World.isRemote) { + for (int i = 0; i < 360; i += 18) { + par2World.spawnEntityInWorld(new HolyProjectile( + par2World, + par3EntityPlayer, + 8, + 3, + par3EntityPlayer.posX, + par3EntityPlayer.posY + (par3EntityPlayer.height / 2), + par3EntityPlayer.posZ, + i, + 0)); } } @@ -127,52 +140,71 @@ public class SpellHolyBlast extends HomSpell } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } int d0 = 3; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (par3EntityPlayer.posX + 1), (par3EntityPlayer.posY + 2), (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + par3EntityPlayer.posX, + par3EntityPlayer.posY, + par3EntityPlayer.posZ, + (par3EntityPlayer.posX + 1), + (par3EntityPlayer.posY + 2), + (par3EntityPlayer.posZ + 1)) + .expand(d0, d0, d0); List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { EntityLivingBase entityLiving = (EntityLivingBase) iterator.next(); - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.equals(par3EntityPlayer)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.equals(par3EntityPlayer)) { continue; } } int i = 1; - if (entityLiving.isEntityUndead()) - { + if (entityLiving.isEntityUndead()) { i = 3; } entityLiving.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 5 * i); } - par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float) (2), false); + par2World.createExplosion( + par3EntityPlayer, + par3EntityPlayer.posX, + par3EntityPlayer.posY, + par3EntityPlayer.posZ, + (float) (2), + false); double xCoord = par3EntityPlayer.posX; double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; - for (int i = 0; i < 20; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F); + for (int i = 0; i < 20; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + itemRand.nextFloat() - itemRand.nextFloat(), + yCoord + itemRand.nextFloat() - itemRand.nextFloat(), + zCoord + itemRand.nextFloat() - itemRand.nextFloat(), + 1.0F, + 1.0F, + 1.0F); } return par1ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java index 7dac5a82..6d57c4fc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java @@ -3,40 +3,35 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.LightningBoltProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.Random; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.Random; - -public class SpellLightningBolt extends HomSpell -{ +public class SpellLightningBolt extends HomSpell { Random itemRand = new Random(); - public SpellLightningBolt() - { + public SpellLightningBolt() { super(); this.setEnergies(75, 200, 700, 700); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new LightningBoltProjectile(par2World, par3EntityPlayer, 8, false)); } @@ -44,25 +39,23 @@ public class SpellLightningBolt extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - //TODO Make it work better...? - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + // TODO Make it work better...? + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } double xCoord = par3EntityPlayer.posX; double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; par2World.getWorldInfo().setRaining(true); - if(par2World.isRemote) - { + if (par2World.isRemote) { par2World.setRainStrength(1.0f); par2World.setThunderStrength(1.0f); } @@ -70,24 +63,33 @@ public class SpellLightningBolt extends HomSpell par2World.getWorldInfo().setThunderTime(0); par2World.getWorldInfo().setThundering(true); - for (int i = 0; i < 5; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F); + for (int i = 0; i < 5; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + itemRand.nextFloat() - itemRand.nextFloat(), + yCoord + itemRand.nextFloat() - itemRand.nextFloat(), + zCoord + itemRand.nextFloat() - itemRand.nextFloat(), + 1.0F, + 1.0F, + 1.0F); } return par1ItemStack; } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } @@ -95,37 +97,49 @@ public class SpellLightningBolt extends HomSpell double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; - for (int i = 0; i < 5; i++) - { - par2World.addWeatherEffect(new EntityLightningBolt(par2World, xCoord + itemRand.nextInt(64) - 32, yCoord + itemRand.nextInt(8) - 8, zCoord + itemRand.nextInt(64) - 32)); + for (int i = 0; i < 5; i++) { + par2World.addWeatherEffect(new EntityLightningBolt( + par2World, + xCoord + itemRand.nextInt(64) - 32, + yCoord + itemRand.nextInt(8) - 8, + zCoord + itemRand.nextInt(64) - 32)); } - for (int i = 0; i < 8; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F); + for (int i = 0; i < 8; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + itemRand.nextFloat() - itemRand.nextFloat(), + yCoord + itemRand.nextFloat() - itemRand.nextFloat(), + zCoord + itemRand.nextFloat() - itemRand.nextFloat(), + 1.0F, + 1.0F, + 1.0F); } return par1ItemStack; } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new LightningBoltProjectile(par2World, par3EntityPlayer, 8, true)); } return par1ItemStack; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellTeleport.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellTeleport.java index d588fcbe..70cbcdac 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellTeleport.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellTeleport.java @@ -3,6 +3,9 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.TeleportProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -14,31 +17,24 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public class SpellTeleport extends HomSpell -{ +public class SpellTeleport extends HomSpell { Random itemRand = new Random(); - public SpellTeleport() - { + public SpellTeleport() { super(); this.setEnergies(500, 300, 500, 1000); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.spawnEntityInWorld(new TeleportProjectile(par2World, par3EntityPlayer, 8, true)); @@ -47,16 +43,15 @@ public class SpellTeleport extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } par2World.spawnEntityInWorld(new TeleportProjectile(par2World, par3EntityPlayer, 8, false)); @@ -64,15 +59,12 @@ public class SpellTeleport extends HomSpell } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } @@ -81,42 +73,55 @@ public class SpellTeleport extends HomSpell double zCoord = par3EntityPlayer.posZ; SpellTeleport.teleportRandomly(par3EntityPlayer, 128); - for (int i = 0; i < 20; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "portal", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, itemRand.nextFloat(), itemRand.nextFloat(), itemRand.nextFloat()); + for (int i = 0; i < 20; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "portal", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, + itemRand.nextFloat(), + itemRand.nextFloat(), + itemRand.nextFloat()); } return par1ItemStack; } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { int d0 = 3; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (par3EntityPlayer.posX + 1), (par3EntityPlayer.posY + 2), (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + par3EntityPlayer.posX, + par3EntityPlayer.posY, + par3EntityPlayer.posZ, + (par3EntityPlayer.posX + 1), + (par3EntityPlayer.posY + 2), + (par3EntityPlayer.posZ + 1)) + .expand(d0, d0, d0); List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { EntityLivingBase entityLiving = (EntityLivingBase) iterator.next(); - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.equals(par3EntityPlayer)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.equals(par3EntityPlayer)) { continue; } } @@ -128,16 +133,27 @@ public class SpellTeleport extends HomSpell double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; - for (int i = 0; i < 32; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "portal", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, itemRand.nextFloat(), itemRand.nextFloat(), itemRand.nextFloat()); + for (int i = 0; i < 32; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "portal", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, + itemRand.nextFloat(), + itemRand.nextFloat(), + itemRand.nextFloat()); } return par1ItemStack; } - public static boolean teleportRandomly(EntityLivingBase entityLiving, double distance) - { + public static boolean teleportRandomly(EntityLivingBase entityLiving, double distance) { double x = entityLiving.posX; double y = entityLiving.posY; double z = entityLiving.posZ; @@ -147,28 +163,31 @@ public class SpellTeleport extends HomSpell double d2 = z + (rand.nextDouble() - 0.5D) * distance; int i = 0; - while (!SpellTeleport.teleportTo(entityLiving, d0, d1, d2, x, y, z) && i < 100) - { + while (!SpellTeleport.teleportTo(entityLiving, d0, d1, d2, x, y, z) && i < 100) { d0 = x + (rand.nextDouble() - 0.5D) * distance; d1 = y + (rand.nextInt((int) distance) - (distance) / 2); d2 = z + (rand.nextDouble() - 0.5D) * distance; i++; } - if (i >= 100) - { + if (i >= 100) { return false; } return true; } - private static boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ) - { + private static boolean teleportTo( + EntityLivingBase entityLiving, + double par1, + double par3, + double par5, + double lastX, + double lastY, + double lastZ) { EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0); - if (MinecraftForge.EVENT_BUS.post(event)) - { + if (MinecraftForge.EVENT_BUS.post(event)) { return false; } @@ -179,81 +198,76 @@ public class SpellTeleport extends HomSpell int k = MathHelper.floor_double(entityLiving.posZ); Block l; - if (entityLiving.worldObj.blockExists(i, j, k)) - { + if (entityLiving.worldObj.blockExists(i, j, k)) { boolean flag1 = false; - while (!flag1 && j > 0) - { + while (!flag1 && j > 0) { l = entityLiving.worldObj.getBlock(i, j - 1, k); - if (l != null && l.getMaterial().blocksMovement()) - { + if (l != null && l.getMaterial().blocksMovement()) { flag1 = true; - } else - { + } else { --entityLiving.posY; --j; } } - if (flag1) - { - SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); + if (flag1) { + SpellTeleport.moveEntityViaTeleport( + entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); - if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) - { + if (entityLiving + .worldObj + .getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox) + .isEmpty() + && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) { flag = true; } } } - if (!flag) - { + if (!flag) { SpellTeleport.moveEntityViaTeleport(entityLiving, lastX, lastY, lastZ); return false; - } else - { + } else { short short1 = 128; - for (j = 0; j < short1; ++j) - { + for (j = 0; j < short1; ++j) { double d6 = (double) j / ((double) short1 - 1.0D); float f = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float f1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float f2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; - double d7 = lastX + (entityLiving.posX - lastX) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; - double d8 = lastY + (entityLiving.posY - lastY) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; - double d9 = lastZ + (entityLiving.posZ - lastZ) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + double d7 = lastX + + (entityLiving.posX - lastX) * d6 + + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + double d8 = lastY + + (entityLiving.posY - lastY) * d6 + + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; + double d9 = lastZ + + (entityLiving.posZ - lastZ) * d6 + + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); } return true; } } - public static void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z) - { - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving != null && entityLiving instanceof EntityPlayerMP) - { + public static void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z) { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving != null && entityLiving instanceof EntityPlayerMP) { EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving; - if (entityplayermp.worldObj == entityLiving.worldObj) - { + if (entityplayermp.worldObj == entityLiving.worldObj) { EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F); - if (!MinecraftForge.EVENT_BUS.post(event)) - { - if (entityLiving.isRiding()) - { + if (!MinecraftForge.EVENT_BUS.post(event)) { + if (entityLiving.isRiding()) { entityLiving.mountEntity(null); } entityLiving.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); } } } - } else if (entityLiving != null) - { + } else if (entityLiving != null) { entityLiving.setPosition(x, y, z); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWateryGrave.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWateryGrave.java index 3b9bc15c..620bf7e1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWateryGrave.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWateryGrave.java @@ -4,6 +4,9 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -13,31 +16,24 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public class SpellWateryGrave extends HomSpell -{ +public class SpellWateryGrave extends HomSpell { Random itemRand = new Random(); - public SpellWateryGrave() - { + public SpellWateryGrave() { super(); this.setEnergies(250, 350, 500, 750); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.spawnEntityInWorld(new WaterProjectile(par2World, par3EntityPlayer, 8)); @@ -46,25 +42,30 @@ public class SpellWateryGrave extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } - if (!par2World.isRemote) - { - for (int i = -1; i <= 1; i++) - { - for (int j = -1; j <= 1; j++) - { - par2World.spawnEntityInWorld(new WaterProjectile(par2World, par3EntityPlayer, 3, 3, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 10F, par3EntityPlayer.rotationPitch + j * 5F)); + if (!par2World.isRemote) { + for (int i = -1; i <= 1; i++) { + for (int j = -1; j <= 1; j++) { + par2World.spawnEntityInWorld(new WaterProjectile( + par2World, + par3EntityPlayer, + 3, + 3, + par3EntityPlayer.posX, + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), + par3EntityPlayer.posZ, + par3EntityPlayer.rotationYaw + i * 10F, + par3EntityPlayer.rotationPitch + j * 5F)); } } } @@ -73,39 +74,39 @@ public class SpellWateryGrave extends HomSpell } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } int d0 = 3; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (par3EntityPlayer.posX + 1), (par3EntityPlayer.posY + 2), (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + par3EntityPlayer.posX, + par3EntityPlayer.posY, + par3EntityPlayer.posZ, + (par3EntityPlayer.posX + 1), + (par3EntityPlayer.posY + 2), + (par3EntityPlayer.posZ + 1)) + .expand(d0, d0, d0); List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { EntityLivingBase entityLiving = (EntityLivingBase) iterator.next(); - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.equals(par3EntityPlayer)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.equals(par3EntityPlayer)) { continue; } } int x = 1; - if (entityLiving.isImmuneToFire()) - { + if (entityLiving.isImmuneToFire()) { x = 2; } @@ -117,38 +118,51 @@ public class SpellWateryGrave extends HomSpell double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; - for (int i = 0; i < 20; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F); + for (int i = 0; i < 20; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + 0.0F, + 0.410F, + 1.0F); } return par1ItemStack; } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } int range = 2; - if (!par2World.isRemote) - { - for (int i = -range; i <= range; i++) - { - for (int j = -range; j <= range; j++) - { - if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ + j)) - { - par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ + j, Blocks.water); + if (!par2World.isRemote) { + for (int i = -range; i <= range; i++) { + for (int j = -range; j <= range; j++) { + if (par2World.isAirBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY, + (int) par3EntityPlayer.posZ + j)) { + par2World.setBlock( + (int) par3EntityPlayer.posX + i, + (int) par3EntityPlayer.posY, + (int) par3EntityPlayer.posZ + j, + Blocks.water); } } } @@ -158,9 +172,21 @@ public class SpellWateryGrave extends HomSpell double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; - for (int i = 0; i < 16; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F); + for (int i = 0; i < 16; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + 0.0F, + 0.410F, + 1.0F); } return par1ItemStack; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWindGust.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWindGust.java index 3541359a..4cdd6b42 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWindGust.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellWindGust.java @@ -3,6 +3,9 @@ package WayofTime.alchemicalWizardry.common.spell.simple; import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import java.util.Iterator; +import java.util.List; +import java.util.Random; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -10,37 +13,29 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public class SpellWindGust extends HomSpell -{ +public class SpellWindGust extends HomSpell { Random itemRand = new Random(); - public SpellWindGust() - { + public SpellWindGust() { super(); this.setEnergies(300, 400, 300, 500); } @Override - public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveRangedRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy()); } par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(new WindGustProjectile(par2World, par3EntityPlayer, 8)); } @@ -48,16 +43,15 @@ public class SpellWindGust extends HomSpell } @Override - public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onOffensiveMeleeRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); + if (!par3EntityPlayer.capabilities.isCreativeMode) { + EnergyItems.syphonAndDamageWhileInContainer( + par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy()); } int distance = 3; @@ -67,18 +61,22 @@ public class SpellWindGust extends HomSpell double yCoord = par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance; double zCoord = par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance; float d0 = 0.5f; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX - 0.5 + Math.sin(yaw) * Math.cos(pitch) * (-distance), par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, par3EntityPlayer.posZ - 0.5 + Math.cos(yaw) * Math.cos(pitch) * distance, par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance) + 0.5, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance + 1, par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance + 0.5).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + par3EntityPlayer.posX - 0.5 + Math.sin(yaw) * Math.cos(pitch) * (-distance), + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, + par3EntityPlayer.posZ - 0.5 + Math.cos(yaw) * Math.cos(pitch) * distance, + par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance) + 0.5, + par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance + 1, + par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance + 0.5) + .expand(d0, d0, d0); List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { + while (iterator.hasNext()) { EntityLivingBase entityLiving = (EntityLivingBase) iterator.next(); - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.equals(par3EntityPlayer)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.equals(par3EntityPlayer)) { continue; } } @@ -86,24 +84,32 @@ public class SpellWindGust extends HomSpell entityLiving.motionY = 2; entityLiving.motionZ = Math.cos(yaw) * 2; } - for (int i = 0; i < 5; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F); - + for (int i = 0; i < 5; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + 0.0F, + 0.410F, + 1.0F); } return par1ItemStack; } @Override - public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy()); } @@ -118,35 +124,58 @@ public class SpellWindGust extends HomSpell par3EntityPlayer.motionY = vec.yCoord * wantedVelocity; par3EntityPlayer.motionZ = vec.zCoord * wantedVelocity; SpellHelper.setPlayerSpeedFromServer(par3EntityPlayer, xVel, yVel, zVel); - par2World.playSoundEffect((double) ((float) par3EntityPlayer.posX + 0.5F), (double) ((float) par3EntityPlayer.posY + 0.5F), (double) ((float) par3EntityPlayer.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); + par2World.playSoundEffect( + (double) ((float) par3EntityPlayer.posX + 0.5F), + (double) ((float) par3EntityPlayer.posY + 0.5F), + (double) ((float) par3EntityPlayer.posZ + 0.5F), + "random.fizz", + 0.5F, + 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); par3EntityPlayer.fallDistance = 0; double xCoord = par3EntityPlayer.posX; double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; - for (int i = 0; i < 8; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F); + for (int i = 0; i < 8; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + 0.0F, + 0.410F, + 1.0F); } return par1ItemStack; } @Override - public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) - { + public ItemStack onEnvironmentalRightClick( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { return par1ItemStack; } - if (!par3EntityPlayer.capabilities.isCreativeMode) - { + if (!par3EntityPlayer.capabilities.isCreativeMode) { EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy()); } int d0 = 3; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (par3EntityPlayer.posX + 1), (par3EntityPlayer.posY + 2), (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( + par3EntityPlayer.posX, + par3EntityPlayer.posY, + par3EntityPlayer.posZ, + (par3EntityPlayer.posX + 1), + (par3EntityPlayer.posY + 2), + (par3EntityPlayer.posZ + 1)) + .expand(d0, d0, d0); List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); Iterator iterator = list.iterator(); double xCoord = par3EntityPlayer.posX; @@ -154,14 +183,11 @@ public class SpellWindGust extends HomSpell double zCoord = par3EntityPlayer.posZ; double wantedVel = 2; - while (iterator.hasNext()) - { + while (iterator.hasNext()) { EntityLivingBase entityLiving = (EntityLivingBase) iterator.next(); - if (entityLiving instanceof EntityPlayer) - { - if (entityLiving.equals(par3EntityPlayer)) - { + if (entityLiving instanceof EntityPlayer) { + if (entityLiving.equals(par3EntityPlayer)) { continue; } } @@ -175,11 +201,23 @@ public class SpellWindGust extends HomSpell entityLiving.motionY = posYDif * wantedVel / distance; entityLiving.motionZ = posZDif * wantedVel / distance; } - for (int i = 0; i < 20; i++) - { - SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F); + for (int i = 0; i < 20; i++) { + SpellHelper.sendParticleToAllAround( + par2World, + xCoord, + yCoord, + zCoord, + 30, + par2World.provider.dimensionId, + "mobSpell", + xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, + 0.0F, + 0.410F, + 1.0F); } return par1ItemStack; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningFallenAngel.java b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningFallenAngel.java index 1375c7ff..72d872fe 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningFallenAngel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningFallenAngel.java @@ -5,15 +5,12 @@ import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel; import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; -public class SummoningFallenAngel extends SummoningHelper -{ - public SummoningFallenAngel(String id) - { +public class SummoningFallenAngel extends SummoningHelper { + public SummoningFallenAngel(String id) { super(id); } - public EntityLivingBase getEntity(World worldObj) - { + public EntityLivingBase getEntity(World worldObj) { return new EntityFallenAngel(worldObj); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningHelperAW.java b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningHelperAW.java index c2df04ad..285d091d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningHelperAW.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/SummoningHelperAW.java @@ -1,8 +1,5 @@ package WayofTime.alchemicalWizardry.common.summoning; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.passive.EntityPig; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningHelper; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt; @@ -24,116 +21,96 @@ import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental; import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem; import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental; import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.world.World; -public class SummoningHelperAW extends SummoningHelper -{ - public SummoningHelperAW(String id) - { +public class SummoningHelperAW extends SummoningHelper { + public SummoningHelperAW(String id) { super(id); } - public EntityLivingBase getEntity(World worldObj) - { - if (this.id.equals(AlchemicalWizardry.entityFallenAngelID)) - { + public EntityLivingBase getEntity(World worldObj) { + if (this.id.equals(AlchemicalWizardry.entityFallenAngelID)) { return new EntityFallenAngel(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityLowerGuardianID)) - { + if (this.id.equals(AlchemicalWizardry.entityLowerGuardianID)) { return new EntityLowerGuardian(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityBileDemonID)) - { + if (this.id.equals(AlchemicalWizardry.entityBileDemonID)) { return new EntityBileDemon(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityWingedFireDemonID)) - { + if (this.id.equals(AlchemicalWizardry.entityWingedFireDemonID)) { return new EntityWingedFireDemon(worldObj); } - if (this.id.equals(AlchemicalWizardry.entitySmallEarthGolemID)) - { + if (this.id.equals(AlchemicalWizardry.entitySmallEarthGolemID)) { return new EntitySmallEarthGolem(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityIceDemonID)) - { + if (this.id.equals(AlchemicalWizardry.entityIceDemonID)) { return new EntityIceDemon(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityBoulderFistID)) - { + if (this.id.equals(AlchemicalWizardry.entityBoulderFistID)) { return new EntityBoulderFist(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityShadeID)) - { + if (this.id.equals(AlchemicalWizardry.entityShadeID)) { return new EntityShade(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityAirElementalID)) - { + if (this.id.equals(AlchemicalWizardry.entityAirElementalID)) { return new EntityAirElemental(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityWaterElementalID)) - { + if (this.id.equals(AlchemicalWizardry.entityWaterElementalID)) { return new EntityWaterElemental(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityEarthElementalID)) - { + if (this.id.equals(AlchemicalWizardry.entityEarthElementalID)) { return new EntityEarthElemental(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityFireElementalID)) - { + if (this.id.equals(AlchemicalWizardry.entityFireElementalID)) { return new EntityFireElemental(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityShadeElementalID)) - { + if (this.id.equals(AlchemicalWizardry.entityShadeElementalID)) { return new EntityShadeElemental(worldObj); } - if (this.id.equals(AlchemicalWizardry.entityHolyElementalID)) - { + if (this.id.equals(AlchemicalWizardry.entityHolyElementalID)) { return new EntityHolyElemental(worldObj); } - if(this.id.equals(AlchemicalWizardry.entityMinorDemonGruntID)) - { - return new EntityMinorDemonGrunt(worldObj); + if (this.id.equals(AlchemicalWizardry.entityMinorDemonGruntID)) { + return new EntityMinorDemonGrunt(worldObj); } - - if(this.id.equals(AlchemicalWizardry.entityMinorDemonGruntFireID)) - { - return new EntityMinorDemonGruntFire(worldObj); + + if (this.id.equals(AlchemicalWizardry.entityMinorDemonGruntFireID)) { + return new EntityMinorDemonGruntFire(worldObj); } - - if(this.id.equals(AlchemicalWizardry.entityMinorDemonGruntEarthID)) - { - return new EntityMinorDemonGruntEarth(worldObj); + + if (this.id.equals(AlchemicalWizardry.entityMinorDemonGruntEarthID)) { + return new EntityMinorDemonGruntEarth(worldObj); } - - if(this.id.equals(AlchemicalWizardry.entityMinorDemonGruntWindID)) - { - return new EntityMinorDemonGruntWind(worldObj); + + if (this.id.equals(AlchemicalWizardry.entityMinorDemonGruntWindID)) { + return new EntityMinorDemonGruntWind(worldObj); } - - if(this.id.equals(AlchemicalWizardry.entityMinorDemonGruntIceID)) - { - return new EntityMinorDemonGruntIce(worldObj); + + if (this.id.equals(AlchemicalWizardry.entityMinorDemonGruntIceID)) { + return new EntityMinorDemonGruntIce(worldObj); } - + return new EntityPig(worldObj); } - public String getSummoningHelperID() - { + public String getSummoningHelperID() { return id; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/Meteor.java b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/Meteor.java index d1849373..bd3809d9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/Meteor.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/Meteor.java @@ -1,17 +1,15 @@ package WayofTime.alchemicalWizardry.common.summoning.meteor; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import cpw.mods.fml.common.registry.GameRegistry; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; - public class Meteor { public String[] ores; public int radius; @@ -20,8 +18,7 @@ public class Meteor { public String focusName; public int focusMeta; - public static void loadConfig() - { + public static void loadConfig() { Gson gson = new GsonBuilder().setPrettyPrinting().create(); File file = new File("config/BloodMagic/meteors"); File[] files = file.listFiles(); @@ -30,10 +27,10 @@ public class Meteor { for (File f : files) { BufferedReader br = new BufferedReader(new FileReader(f)); Meteor m = gson.fromJson(br, Meteor.class); - MeteorRegistry.registerMeteorParadigm(findItemStack(m.focusModId, m.focusName, m.focusMeta), m.ores, m.radius, m.cost); + MeteorRegistry.registerMeteorParadigm( + findItemStack(m.focusModId, m.focusName, m.focusMeta), m.ores, m.radius, m.cost); } - } - catch (FileNotFoundException e) { + } catch (FileNotFoundException e) { e.printStackTrace(); } } @@ -41,8 +38,7 @@ public class Meteor { private static ItemStack findItemStack(String modid, String name, int meta) { ItemStack is = GameRegistry.findItemStack(modid, name, 1); - if (is == null) - return null; + if (is == null) return null; Items.feather.setDamage(is, meta); return is; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigm.java b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigm.java index d8dfd1b9..c079d5e3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigm.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigm.java @@ -1,20 +1,18 @@ package WayofTime.alchemicalWizardry.common.summoning.meteor; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import cpw.mods.fml.common.Optional; +import gregtech.common.blocks.GT_TileEntity_Ores; import java.util.ArrayList; import java.util.List; import java.util.Random; - -import cpw.mods.fml.common.Optional; -import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -public class MeteorParadigm -{ +public class MeteorParadigm { public List componentList = new ArrayList<>(); public ItemStack focusStack; public int radius; @@ -22,49 +20,41 @@ public class MeteorParadigm public static Random rand = new Random(); - public MeteorParadigm(ItemStack focusStack, int radius, int cost) - { + public MeteorParadigm(ItemStack focusStack, int radius, int cost) { this.focusStack = focusStack; this.radius = radius; this.cost = cost; } - public void parseStringArray(String[] oreArray) - { - for (int i = 0; i + 1 < oreArray.length; i += 2) - { + public void parseStringArray(String[] oreArray) { + for (int i = 0; i + 1 < oreArray.length; i += 2) { String oreName = oreArray[i]; int oreChance = Integer.parseInt(oreArray[i + 1]); MeteorParadigmComponent mpc = new MeteorParadigmComponent(oreName, oreChance); componentList.add(mpc); } } - - public int getTotalMeteorWeight() - { - int totalMeteorWeight = 0; - for (MeteorParadigmComponent mpc : componentList) - { - if (mpc == null || !mpc.isValidBlockParadigm()) - { + + public int getTotalMeteorWeight() { + int totalMeteorWeight = 0; + for (MeteorParadigmComponent mpc : componentList) { + if (mpc == null || !mpc.isValidBlockParadigm()) { continue; } totalMeteorWeight += mpc.getChance(); } - return totalMeteorWeight; + return totalMeteorWeight; } - public void createMeteorImpact(World world, int x, int y, int z, boolean[] flags) - { + public void createMeteorImpact(World world, int x, int y, int z, boolean[] flags) { boolean hasTerrae = false; boolean hasOrbisTerrae = false; boolean hasCrystallos = false; boolean hasIncendium = false; boolean hasTennebrae = false; - if (flags != null && flags.length >= 5) - { + if (flags != null && flags.length >= 5) { hasTerrae = flags[0]; hasOrbisTerrae = flags[1]; hasCrystallos = flags[2]; @@ -74,11 +64,9 @@ public class MeteorParadigm int newRadius = radius; - if (hasOrbisTerrae) - { + if (hasOrbisTerrae) { newRadius += 2; - } else if (hasTerrae) - { + } else if (hasTerrae) { newRadius += 1; } @@ -89,22 +77,17 @@ public class MeteorParadigm float obsidChance = hasTennebrae ? 1 : 0; float totalChance = iceChance + soulChance + obsidChance; - + int totalMeteorWeight = getTotalMeteorWeight(); - for (int i = -newRadius; i <= newRadius; i++) - { - for (int j = -newRadius; j <= newRadius; j++) - { - for (int k = -newRadius; k <= newRadius; k++) - { - if (i * i + j * j + k * k >= (newRadius + 0.50f) * (newRadius + 0.50f)) - { + for (int i = -newRadius; i <= newRadius; i++) { + for (int j = -newRadius; j <= newRadius; j++) { + for (int k = -newRadius; k <= newRadius; k++) { + if (i * i + j * j + k * k >= (newRadius + 0.50f) * (newRadius + 0.50f)) { continue; } - if (!world.isAirBlock(x + i, y + j, z + k)) - { + if (!world.isAirBlock(x + i, y + j, z + k)) { continue; } @@ -112,48 +95,53 @@ public class MeteorParadigm boolean hasPlacedBlock = false; - for (MeteorParadigmComponent mpc : componentList) - { - if (mpc == null || !mpc.isValidBlockParadigm()) - { + for (MeteorParadigmComponent mpc : componentList) { + if (mpc == null || !mpc.isValidBlockParadigm()) { continue; } randNum -= mpc.getChance(); - if (randNum < 0) - { + if (randNum < 0) { ItemStack blockStack = mpc.getValidBlockParadigm(); - if(blockStack != null && blockStack.getItem() instanceof ItemBlock) - { - ((ItemBlock)blockStack.getItem()).placeBlockAt(blockStack, null, world, x + i, y + j, z + k, 0, 0, 0, 0, blockStack.getItemDamage()); + if (blockStack != null && blockStack.getItem() instanceof ItemBlock) { + ((ItemBlock) blockStack.getItem()) + .placeBlockAt( + blockStack, + null, + world, + x + i, + y + j, + z + k, + 0, + 0, + 0, + 0, + blockStack.getItemDamage()); if (AlchemicalWizardry.isGregTechLoaded) setGTOresNaturalIfNeeded(world, x + i, y + j, z + k); - world.markBlockForUpdate(x + i, y + j, z + k); + world.markBlockForUpdate(x + i, y + j, z + k); hasPlacedBlock = true; break; } -// world.setBlock(x + i, y + j, z + k, Block.getBlockById(Item.getIdFromItem(blockStack.getItem())), blockStack.getItemDamage(), 3); -// hasPlacedBlock = true; -// break; + // world.setBlock(x + i, y + j, z + k, + // Block.getBlockById(Item.getIdFromItem(blockStack.getItem())), blockStack.getItemDamage(), + // 3); + // hasPlacedBlock = true; + // break; } } - if (!hasPlacedBlock) - { + if (!hasPlacedBlock) { float randChance = rand.nextFloat() * totalChance; - if (randChance < iceChance) - { + if (randChance < iceChance) { world.setBlock(x + i, y + j, z + k, Blocks.ice, 0, 3); - } else - { + } else { randChance -= iceChance; - if (randChance < soulChance) - { - switch (rand.nextInt(3)) - { + if (randChance < soulChance) { + switch (rand.nextInt(3)) { case 0: world.setBlock(x + i, y + j, z + k, Blocks.soul_sand, 0, 3); break; @@ -164,15 +152,12 @@ public class MeteorParadigm world.setBlock(x + i, y + j, z + k, Blocks.netherrack, 0, 3); break; } - } else - { + } else { randChance -= soulChance; - if (randChance < obsidChance) - { + if (randChance < obsidChance) { world.setBlock(x + i, y + j, z + k, Blocks.obsidian, 0, 3); - } else - { + } else { randChance -= obsidChance; world.setBlock(x + i, y + j, z + k, Blocks.stone, 0, 3); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigmComponent.java b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigmComponent.java index 0daa43a1..8c6b97cb 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigmComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorParadigmComponent.java @@ -1,50 +1,40 @@ package WayofTime.alchemicalWizardry.common.summoning.meteor; +import java.util.List; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.List; - -public class MeteorParadigmComponent -{ +public class MeteorParadigmComponent { public String oreDictName; public int chance; - public MeteorParadigmComponent(String dictName, int chance) - { + public MeteorParadigmComponent(String dictName, int chance) { this.oreDictName = dictName; this.chance = chance; } - public boolean isValidBlockParadigm() - { - if (this.getValidBlockParadigm() != null) - { + public boolean isValidBlockParadigm() { + if (this.getValidBlockParadigm() != null) { return true; } return false; } - public String getOreDictName() - { + public String getOreDictName() { return this.oreDictName; } - public int getChance() - { + public int getChance() { return this.chance; } - public ItemStack getValidBlockParadigm() - { + public ItemStack getValidBlockParadigm() { List list = OreDictionary.getOres(getOreDictName()); - for (ItemStack stack : list) - { - if (stack != null && stack.getItem() instanceof ItemBlock) - { + for (ItemStack stack : list) { + if (stack != null && stack.getItem() instanceof ItemBlock) { return stack; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorRegistry.java index 641ac50a..47c3b100 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/summoning/meteor/MeteorRegistry.java @@ -1,52 +1,44 @@ package WayofTime.alchemicalWizardry.common.summoning.meteor; +import java.util.ArrayList; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; -import java.util.List; - -public class MeteorRegistry -{ +public class MeteorRegistry { public static List paradigmList = new ArrayList<>(); - public static void registerMeteorParadigm(MeteorParadigm paradigm) - { + public static void registerMeteorParadigm(MeteorParadigm paradigm) { paradigmList.add(paradigm); } - public static void registerMeteorParadigm(ItemStack stack, String[] oreList, int radius, int cost) - { - if (stack != null && oreList != null) - { + public static void registerMeteorParadigm(ItemStack stack, String[] oreList, int radius, int cost) { + if (stack != null && oreList != null) { MeteorParadigm meteor = new MeteorParadigm(stack, radius, cost); meteor.parseStringArray(oreList); paradigmList.add(meteor); } } - public static void createMeteorImpact(World world, int x, int y, int z, int paradigmID, boolean[] flags) - { - if (paradigmID < paradigmList.size()) - { + public static void createMeteorImpact(World world, int x, int y, int z, int paradigmID, boolean[] flags) { + if (paradigmID < paradigmList.size()) { paradigmList.get(paradigmID).createMeteorImpact(world, x, y, z, flags); } } - public static int getParadigmIDForItem(ItemStack stack) - { - if (stack == null) - { + public static int getParadigmIDForItem(ItemStack stack) { + if (stack == null) { return -1; } - for (int i = 0; i < paradigmList.size(); i++) - { + for (int i = 0; i < paradigmList.size(); i++) { ItemStack focusStack = paradigmList.get(i).focusStack; - if (focusStack != null && focusStack.getItem() == stack.getItem() && (focusStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || focusStack.getItemDamage() == stack.getItemDamage())) - { + if (focusStack != null + && focusStack.getItem() == stack.getItem() + && (focusStack.getItemDamage() == OreDictionary.WILDCARD_VALUE + || focusStack.getItemDamage() == stack.getItemDamage())) { return i; } } @@ -54,8 +46,7 @@ public class MeteorRegistry return -1; } - public static boolean isValidParadigmItem(ItemStack stack) - { + public static boolean isValidParadigmItem(ItemStack stack) { return getParadigmIDForItem(stack) != -1; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java index d5891819..f28cd820 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java @@ -18,8 +18,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; -public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory -{ +public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory { protected ItemStack[] inv; protected ReagentContainer bufferTank = new ReagentContainer(Reagent.REAGENT_SIZE * 2); @@ -27,8 +26,7 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory public int progress; - public TEAlchemicCalcinator() - { + public TEAlchemicCalcinator() { super(1, Reagent.REAGENT_SIZE * 4); this.inv = new ItemStack[2]; this.tickRate = 20; @@ -37,8 +35,7 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); bufferTransferRate = tag.getInteger("bufferTransferRate"); progress = tag.getInteger("progress"); @@ -49,23 +46,19 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory NBTTagList tagList = tag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound savedTag = tagList.getCompoundTagAt(i); - if (savedTag.getBoolean("Empty")) - { + if (savedTag.getBoolean("Empty")) { inv[i] = null; - } else - { + } else { inv[i] = ItemStack.loadItemStackFromNBT(savedTag); } } } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setInteger("bufferTransferRate", bufferTransferRate); tag.setInteger("progress", progress); @@ -78,15 +71,12 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory NBTTagList itemList = new NBTTagList(); - for (int i = 0; i < inv.length; i++) - { + for (int i = 0; i < inv.length; i++) { NBTTagCompound savedTag = new NBTTagCompound(); - if (inv[i] != null) - { + if (inv[i] != null) { inv[i].writeToNBT(savedTag); - } else - { + } else { savedTag.setBoolean("Empty", true); } @@ -97,88 +87,75 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory } @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); - if (!worldObj.isRemote) - { + if (!worldObj.isRemote) { moveBufferToMain(); tickProgress(); } } - public void moveBufferToMain() - { + public void moveBufferToMain() { ReagentStack amountStack = this.bufferTank.drain(bufferTransferRate, false); int drainAmount = this.fill(ForgeDirection.UNKNOWN, amountStack, false); - if (drainAmount > 0) - { + if (drainAmount > 0) { ReagentStack drainedStack = this.bufferTank.drain(drainAmount, true); this.fill(ForgeDirection.UNKNOWN, drainedStack, true); } } - public void tickProgress() - { + public void tickProgress() { int lpPerTick = 10; int ticksPerReagent = 200; ItemStack reagentItemStack = this.getStackInSlot(1); - if (reagentItemStack == null) - { + if (reagentItemStack == null) { progress = 0; return; } ReagentStack possibleReagent = ReagentRegistry.getReagentStackForItem(reagentItemStack); - if (possibleReagent == null || !this.canReagentFitBuffer(possibleReagent)) - { + if (possibleReagent == null || !this.canReagentFitBuffer(possibleReagent)) { return; } ItemStack orbStack = this.getStackInSlot(0); - if (orbStack == null || !(orbStack.getItem() instanceof IBloodOrb)) - { + if (orbStack == null || !(orbStack.getItem() instanceof IBloodOrb)) { return; } - if (!SoulNetworkHandler.canSyphonFromOnlyNetwork(orbStack, lpPerTick)) - { + if (!SoulNetworkHandler.canSyphonFromOnlyNetwork(orbStack, lpPerTick)) { SoulNetworkHandler.causeNauseaToPlayer(orbStack); return; } - if(!SoulNetworkHandler.syphonFromNetworkWhileInContainer(orbStack, lpPerTick)) - { - return; + if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(orbStack, lpPerTick)) { + return; } - + progress++; - 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); } - if (progress >= ticksPerReagent) - { + if (progress >= ticksPerReagent) { progress = 0; this.bufferTank.fill(possibleReagent, true); this.decrStackSize(1, 1); } } - public boolean canReagentFitBuffer(ReagentStack stack) - { + public boolean canReagentFitBuffer(ReagentStack stack) { int amount = this.bufferTank.fill(stack, false); return amount >= stack.amount; } @Override - public void readClientNBT(NBTTagCompound tag) - { + public void readClientNBT(NBTTagCompound tag) { super.readClientNBT(tag); NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND); @@ -186,40 +163,33 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory 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 invTagList = tag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < invTagList.tagCount(); i++) - { + for (int i = 0; i < invTagList.tagCount(); i++) { NBTTagCompound savedTag = invTagList.getCompoundTagAt(i); - if (savedTag.getBoolean("Empty")) - { + if (savedTag.getBoolean("Empty")) { inv[i] = null; - } else - { + } else { inv[i] = ItemStack.loadItemStackFromNBT(savedTag); } } } @Override - public void writeClientNBT(NBTTagCompound tag) - { + public void writeClientNBT(NBTTagCompound tag) { super.writeClientNBT(tag); 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); @@ -229,15 +199,12 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory NBTTagList itemList = new NBTTagList(); - for (int i = 0; i < inv.length; i++) - { + for (int i = 0; i < inv.length; i++) { NBTTagCompound savedTag = new NBTTagCompound(); - if (inv[i] != null) - { + if (inv[i] != null) { inv[i].writeToNBT(savedTag); - } else - { + } else { savedTag.setBoolean("Empty", true); } @@ -248,39 +215,33 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory } @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 int getSizeInventory() - { + public int getSizeInventory() { return inv.length; } @Override - public ItemStack getStackInSlot(int slot) - { + public ItemStack getStackInSlot(int slot) { return inv[slot]; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) - { + public void setInventorySlotContents(int slot, ItemStack stack) { inv[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) - { + if (stack != null && stack.stackSize > getInventoryStackLimit()) { stack.stackSize = getInventoryStackLimit(); } @@ -288,21 +249,16 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory } @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); } } @@ -312,12 +268,10 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory } @Override - public ItemStack getStackInSlotOnClosing(int slot) - { + public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { + if (stack != null) { setInventorySlotContents(slot, null); } @@ -325,50 +279,40 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 64; } @Override - public boolean isUseableByPlayer(EntityPlayer player) - { - return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; + public boolean isUseableByPlayer(EntityPlayer player) { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this + && player.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() {} @Override - public String getInventoryName() - { + public String getInventoryName() { return "AlchemicCalcinator"; } @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return false; } @Override - public boolean isItemValidForSlot(int slot, ItemStack itemStack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemStack) { return true; } @Override - public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) - { - if (doFill && !worldObj.isRemote) - { + public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) { + if (doFill && !worldObj.isRemote) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java index 9b0e3012..de2642b1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java @@ -1,7 +1,16 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; +import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; +import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent; +import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars; +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.item.Item; @@ -23,28 +32,17 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidTank; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; -import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; -import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; -import WayofTime.alchemicalWizardry.common.NewPacketHandler; -import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent; -import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar -{ +public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar { public static final int sizeInv = 1; - + private int resultID; private int resultDamage; private int upgradeLevel; protected FluidStack fluid; public int capacity; private boolean isActive; - private int liquidRequired; //mB + private int liquidRequired; // mB private boolean canBeFilled; private int consumptionRate; private int drainRate; @@ -65,11 +63,10 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I private int lockdownDuration; private int demonBloodDuration; - + private int cooldownAfterCrafting = 500; - public TEAltar() - { + public TEAltar() { super(sizeInv); resultID = 0; resultDamage = 0; @@ -91,67 +88,60 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I this.lockdownDuration = 0; this.demonBloodDuration = 0; } - + /** - * + * * @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; + return filledAmount; } - public int getRSPowerOutput() - { + public int getRSPowerOutput() { return 5; } - - public void addToDemonBloodDuration(int dur) - { - this.demonBloodDuration += dur; + + public void addToDemonBloodDuration(int dur) { + this.demonBloodDuration += dur; } - - public boolean hasDemonBlood() - { - return this.demonBloodDuration > 0; + + public boolean hasDemonBlood() { + return this.demonBloodDuration > 0; } - - public void decrementDemonBlood() - { - this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1); + + public void decrementDemonBlood() { + this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1); } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); 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); } } @@ -180,44 +170,36 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I 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); par1NBTTagCompound.setInteger("resultID", resultID); par1NBTTagCompound.setInteger("resultDamage", resultDamage); - 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); } @@ -246,23 +228,19 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TEAltar"; } - //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; } @@ -270,198 +248,167 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I } @Override - public int getCapacity() - { + public int getCapacity() { return capacity; } @Override - public int getCurrentBlood() - { + public int getCurrentBlood() { return getFluidAmount(); } @Override - public int getTier() - { + public int getTier() { return upgradeLevel; } @Override - public int getProgress() - { + public int getProgress() { return progress; } @Override - public float getSacrificeMultiplier() - { + public float getSacrificeMultiplier() { return sacrificeEfficiencyMultiplier; } @Override - public float getSelfSacrificeMultiplier() - { + public float getSelfSacrificeMultiplier() { return selfSacrificeEfficiencyMultiplier; } @Override - public float getOrbMultiplier() - { + public float getOrbMultiplier() { return orbCapacityMultiplier; } @Override - public float getDislocationMultiplier() - { + public float getDislocationMultiplier() { return dislocationMultiplier; } @Override - public int getBufferCapacity() - { + public int getBufferCapacity() { return bufferCapacity; } @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.getFluidID() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluidID()) - { + if (resource.getFluidID() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluidID()) { 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)); + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent( + fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this)); } 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)); + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent( + fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this)); } 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)); + if (this != null) { + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent( + fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this)); } } - 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() - { - this.decrementDemonBlood(); - - if(this.hasDemonBlood() && !worldObj.isRemote) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); - } - - if (this.lockdownDuration > 0) - { + 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.lockdownDuration > 0) { this.lockdownDuration--; } - if(worldObj.isRemote) - { - return; + if (worldObj.isRemote) { + return; } - - 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); @@ -477,40 +424,41 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I 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) -// { -// PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); -// if (regenEffect != null && regenEffect.getAmplifier() > 0) -// { -// if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id)) -// { -// player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger"))); -// } -// player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2)); -// } -// } -// } + // 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) + // { + // if(AlchemicalWizardry.causeHungerChatMessage && + // !player.isPotionActive(Potion.hunger.id)) + // { + // player.addChatComponentMessage(new + // ChatComponentText(StatCollector.translateToLocal("message.altar.hunger"))); + // } + // player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, + // regenEffect.getAmplifier() * 2 - 2)); + // } + // } + // } } - - if(worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) - { - int syphonMax = (int) (20 * this.dislocationMultiplier); + + if (worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) { + int syphonMax = (int) (20 * this.dislocationMultiplier); int fluidInputted = 0; int fluidOutputted = 0; fluidInputted = Math.min(syphonMax, -this.fluid.amount + capacity); @@ -522,169 +470,186 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I this.fluidOutput.amount += fluidOutputted; 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) - { - cooldownAfterCrafting--; - } + 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 (!canBeFilled) - { - if (fluid != null && fluid.amount >= 1) - { + 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.getTagCompound(); - 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() - { + public void setActive() { isActive = false; } - 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 NewPacketHandler.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; } } @@ -701,20 +666,16 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I 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; @@ -724,27 +685,22 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I 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 (!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(); @@ -757,13 +713,11 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I isActive = false; } - public void checkAndSetAltar() - { + public void checkAndSetAltar() { boolean checkUpgrade = true; int upgradeState = UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord); - if (upgradeState <= 1) - { + if (upgradeState <= 1) { upgradeLevel = 1; isUpgraded = false; this.consumptionMultiplier = 0; @@ -779,8 +733,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I AltarUpgradeComponent upgrades = UpgradedAltars.getUpgrades(worldObj, xCoord, yCoord, zCoord, upgradeState); - if (upgrades == null) - { + if (upgrades == null) { upgradeLevel = 1; isUpgraded = false; this.consumptionMultiplier = 0; @@ -801,25 +754,23 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I this.efficiencyMultiplier = (float) Math.pow(0.80, upgrades.getSpeedUpgrades()); this.sacrificeEfficiencyMultiplier = (float) (0.12 * upgrades.getSacrificeUpgrades()); this.selfSacrificeEfficiencyMultiplier = (float) (0.12 * upgrades.getSelfSacrificeUpgrades()); - this.capacityMultiplier = (float) ((1 * Math.pow(1.14, upgrades.getBetterCapacitiveUpgrades()) + 0.35 * upgrades.getAltarCapacitiveUpgrades())); + this.capacityMultiplier = (float) ((1 * Math.pow(1.14, upgrades.getBetterCapacitiveUpgrades()) + + 0.35 * upgrades.getAltarCapacitiveUpgrades())); this.dislocationMultiplier = (float) (Math.pow(1.5, upgrades.getDisplacementUpgrades())); this.orbCapacityMultiplier = (float) (1 + 0.04 * upgrades.getOrbCapacitiveUpgrades()); this.capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier); this.bufferCapacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 1 * capacityMultiplier); this.accelerationUpgrades = upgrades.getAccelerationUpgrades(); - if (this.fluid.amount > this.capacity) - { + 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; } @@ -827,17 +778,14 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I } @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; } @@ -851,15 +799,12 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I } @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; } @@ -867,62 +812,51 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I } @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.getFluidID(); 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.getFluidID(); 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.getFluidID(); sortList[5] = this.fluidOutput.amount; } @@ -930,32 +864,36 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I return sortList; } - public void sendChatInfoToPlayer(EntityPlayer player) - { - player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.currentessence"), this.fluid.amount)); - player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.currenttier"), UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord))); - player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.capacity"), this.getCapacity())); + public void sendChatInfoToPlayer(EntityPlayer player) { + player.addChatMessage( + new ChatComponentTranslation(String.format("message.altar.currentessence"), this.fluid.amount)); + player.addChatMessage(new ChatComponentTranslation( + String.format("message.altar.currenttier"), + UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord))); + player.addChatMessage( + new ChatComponentTranslation(String.format("message.altar.capacity"), this.getCapacity())); } - 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.altar.progress") + " " + progress + "LP/" + liquidRequired * stackSize + "LP")); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.consumptionrate") + " " + (int) (consumptionRate * (1 + consumptionMultiplier)) + "LP/t")); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.progress") + " " + + progress + "LP/" + liquidRequired * stackSize + "LP")); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.consumptionrate") + + " " + (int) (consumptionRate * (1 + consumptionMultiplier)) + "LP/t")); } - player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.currentessence"), this.fluid.amount)); - player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.inputtank"), this.fluidInput.amount)); - player.addChatMessage(new ChatComponentTranslation(String.format("message.altar.outputtank"), this.fluidOutput.amount)); + player.addChatMessage( + new ChatComponentTranslation(String.format("message.altar.currentessence"), this.fluid.amount)); + player.addChatMessage( + new ChatComponentTranslation(String.format("message.altar.inputtank"), this.fluidInput.amount)); + player.addChatMessage( + new ChatComponentTranslation(String.format("message.altar.outputtank"), this.fluidOutput.amount)); } - @Override - public void requestPauseAfterCrafting(int amount) - { - if(this.isActive) - { - this.cooldownAfterCrafting = amount; - } - } + @Override + public void requestPauseAfterCrafting(int amount) { + if (this.isActive) { + this.cooldownAfterCrafting = amount; + } + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEBellJar.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEBellJar.java index 1126762a..87f460ad 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEBellJar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEBellJar.java @@ -11,36 +11,30 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.Constants; -public class TEBellJar extends TEReagentConduit -{ - public TEBellJar() - { +public class TEBellJar extends TEReagentConduit { + public TEBellJar() { super(1, 16000); this.maxConnextions = 1; this.affectedByRedstone = false; } - public int getRSPowerOutput() - { + public int getRSPowerOutput() { ReagentContainer thisTank = this.tanks[0]; - if (thisTank != null) - { + if (thisTank != null) { ReagentStack stack = thisTank.getReagent(); - if (stack != null) - { + if (stack != null) { return (15 * stack.amount / thisTank.getCapacity()); } } return 0; } - public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack) - { - if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).field_150939_a) - { + public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack) { + if (stack != null + && stack.getItem() instanceof ItemBlock + && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).field_150939_a) { NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) - { + if (tag != null) { NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND); int size = tagList.tagCount(); @@ -48,13 +42,11 @@ public class TEBellJar extends TEReagentConduit ReagentContainerInfo[] infos = new ReagentContainerInfo[size]; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { NBTTagCompound savedTag = tagList.getCompoundTagAt(i); tanks[i] = ReagentContainer.readFromNBT(savedTag); - if (tanks[i] != null) - { + if (tanks[i] != null) { infos[i] = tanks[i].getInfo(); } } @@ -66,29 +58,24 @@ public class TEBellJar extends TEReagentConduit return new ReagentContainerInfo[0]; } - public void readTankNBTOnPlace(NBTTagCompound tag) - { + public void readTankNBTOnPlace(NBTTagCompound tag) { NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND); 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); } } - public void writeTankNBT(NBTTagCompound tag) - { + public void writeTankNBT(NBTTagCompound tag) { 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); @@ -98,12 +85,10 @@ public class TEBellJar extends TEReagentConduit } @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); - if (hasChanged == 1) - { + if (hasChanged == 1) { Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord); block.onNeighborBlockChange(worldObj, xCoord + 1, yCoord, zCoord, block); block = worldObj.getBlock(xCoord - 1, yCoord, zCoord); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEConduit.java index 3c09f67a..e07ef6e1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEConduit.java @@ -3,30 +3,23 @@ package WayofTime.alchemicalWizardry.common.tileEntity; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import net.minecraft.nbt.NBTTagCompound; -public class TEConduit extends TESpellBlock -{ +public class TEConduit extends TESpellBlock { @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); } - //Logic for the actual block is under here + // Logic for the actual block is under here @Override - public void updateEntity() - { - - } + public void updateEntity() {} @Override - protected void applySpellChange(SpellParadigm parad) - { + protected void applySpellChange(SpellParadigm parad) { return; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TECrucible.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TECrucible.java index eae4f507..6285b2a5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TECrucible.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TECrucible.java @@ -1,8 +1,10 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.api.sacrifice.IIncense; +import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.List; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -13,132 +15,113 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import WayofTime.alchemicalWizardry.api.sacrifice.IIncense; -import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class TECrucible extends TEInventory -{ - private int radius = 5; - - public float rColour; - public float gColour; - public float bColour; - - public int ticksRemaining = 0; - public int minValue = 0; - public int maxValue = 0; - public float incrementValue = 0; - - public int state = 0; //0 is when it gives off gray particles, 1 is when it gives off white particles (player can't use this incense anymore), 2 is the normal colour of the incense, 3 means no particles (it is out) - - public TECrucible() - { - super(1); - float f = (float) 1.0F; +public class TECrucible extends TEInventory { + private int radius = 5; + + public float rColour; + public float gColour; + public float bColour; + + public int ticksRemaining = 0; + public int minValue = 0; + public int maxValue = 0; + public float incrementValue = 0; + + public int state = + 0; // 0 is when it gives off gray particles, 1 is when it gives off white particles (player can't use this + // incense anymore), 2 is the normal colour of the incense, 3 means no particles (it is out) + + public TECrucible() { + super(1); + float f = (float) 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; rColour = f1; gColour = f2; bColour = f3; - } - - @Override - public void updateEntity() - { - if(worldObj.isRemote) - return; - - boolean stateChanged = false; - - if(ticksRemaining <= 0) - { - ItemStack stack = this.getStackInSlot(0); - if(stack != null && stack.getItem() instanceof IIncense) - { - IIncense incense = (IIncense)stack.getItem(); - - rColour = incense.getRedColour(stack); - gColour = incense.getGreenColour(stack); - bColour = incense.getBlueColour(stack); - ticksRemaining = incense.getIncenseDuration(stack); - - minValue = incense.getMinLevel(stack); - maxValue = incense.getMaxLevel(stack); - - incrementValue = incense.getTickRate(stack); - - stack.stackSize--; - if(stack.stackSize <= 0) - { - this.setInventorySlotContents(0, null); - } - - stateChanged = true; - } - } + } - if(ticksRemaining > 0) - { - List playerList = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, radius, radius); - - if(playerList != null && !playerList.isEmpty()) - { - boolean allAreGood = true; - - for(EntityPlayer player : playerList) - { - if(ticksRemaining > 0 && PlayerSacrificeHandler.incrementIncense(player, minValue, maxValue, incrementValue)) - { - ticksRemaining--; - if(state != 2) - { - state = 2; - stateChanged = true; - } - - allAreGood = false; - } - } - - if(allAreGood && state != 1) - { - state = 1; - stateChanged = true; - } - - - }else - { - if(state != 0) - { - state = 0; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - updateNeighbors(); - } - } - }else - { - if(state != 0) - { - state = 0; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - updateNeighbors(); - } - } - - if(stateChanged) - { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + @Override + public void updateEntity() { + if (worldObj.isRemote) return; - updateNeighbors(); - } - } - - private void updateNeighbors() - { - Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord); + boolean stateChanged = false; + + if (ticksRemaining <= 0) { + ItemStack stack = this.getStackInSlot(0); + if (stack != null && stack.getItem() instanceof IIncense) { + IIncense incense = (IIncense) stack.getItem(); + + rColour = incense.getRedColour(stack); + gColour = incense.getGreenColour(stack); + bColour = incense.getBlueColour(stack); + ticksRemaining = incense.getIncenseDuration(stack); + + minValue = incense.getMinLevel(stack); + maxValue = incense.getMaxLevel(stack); + + incrementValue = incense.getTickRate(stack); + + stack.stackSize--; + if (stack.stackSize <= 0) { + this.setInventorySlotContents(0, null); + } + + stateChanged = true; + } + } + + if (ticksRemaining > 0) { + List playerList = + SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, radius, radius); + + if (playerList != null && !playerList.isEmpty()) { + boolean allAreGood = true; + + for (EntityPlayer player : playerList) { + if (ticksRemaining > 0 + && PlayerSacrificeHandler.incrementIncense(player, minValue, maxValue, incrementValue)) { + ticksRemaining--; + if (state != 2) { + state = 2; + stateChanged = true; + } + + allAreGood = false; + } + } + + if (allAreGood && state != 1) { + state = 1; + stateChanged = true; + } + + } else { + if (state != 0) { + state = 0; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + updateNeighbors(); + } + } + } else { + if (state != 0) { + state = 0; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + updateNeighbors(); + } + } + + if (stateChanged) { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + + updateNeighbors(); + } + } + + private void updateNeighbors() { + Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord); block.onNeighborBlockChange(worldObj, xCoord + 1, yCoord, zCoord, block); block = worldObj.getBlock(xCoord - 1, yCoord, zCoord); block.onNeighborBlockChange(worldObj, xCoord - 1, yCoord, zCoord, block); @@ -149,70 +132,91 @@ public class TECrucible extends TEInventory block = worldObj.getBlock(xCoord, yCoord, zCoord + 1); block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord + 1, block); block = worldObj.getBlock(xCoord, yCoord, zCoord - 1); - block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord - 1, block); - } - - public void spawnClientParticle(World world, int x, int y, int z, Random rand) - { - switch(state) - { - case 0: - world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, 0.15, 0.15, 0.15); - break; - - case 1: - world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, 1.0, 1.0, 1.0); - break; - - case 2: - world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.7D, z + 0.5D + rand.nextGaussian() / 8, rColour, gColour, bColour); - world.spawnParticle("flame", x + 0.5D + rand.nextGaussian() / 32, y + 0.7D, z + 0.5D + rand.nextGaussian() / 32, 0, 0.02, 0); - break; - - case 3: - //No particles - it is out - break; - } - } + block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord - 1, block); + } - @Override - public void writeToNBT(NBTTagCompound tag) - { + public void spawnClientParticle(World world, int x, int y, int z, Random rand) { + switch (state) { + case 0: + world.spawnParticle( + "reddust", + x + 0.5D + rand.nextGaussian() / 8, + y + 0.7D, + z + 0.5D + rand.nextGaussian() / 8, + 0.15, + 0.15, + 0.15); + break; + + case 1: + world.spawnParticle( + "reddust", + x + 0.5D + rand.nextGaussian() / 8, + y + 0.7D, + z + 0.5D + rand.nextGaussian() / 8, + 1.0, + 1.0, + 1.0); + break; + + case 2: + world.spawnParticle( + "reddust", + x + 0.5D + rand.nextGaussian() / 8, + y + 0.7D, + z + 0.5D + rand.nextGaussian() / 8, + rColour, + gColour, + bColour); + world.spawnParticle( + "flame", + x + 0.5D + rand.nextGaussian() / 32, + y + 0.7D, + z + 0.5D + rand.nextGaussian() / 32, + 0, + 0.02, + 0); + break; + + case 3: + // No particles - it is out + break; + } + } + + @Override + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); - - tag.setInteger("ticksRemaining", ticksRemaining); - tag.setInteger("minValue", minValue); - tag.setInteger("maxValue", maxValue); - tag.setFloat("increment", this.incrementValue); - + + tag.setInteger("ticksRemaining", ticksRemaining); + tag.setInteger("minValue", minValue); + tag.setInteger("maxValue", maxValue); + tag.setFloat("increment", this.incrementValue); + this.writeClientNBT(tag); } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); - - ticksRemaining = tag.getInteger("ticksRemaining"); - minValue = tag.getInteger("minValue"); - maxValue = tag.getInteger("maxValue"); - incrementValue = tag.getFloat("increment"); + + ticksRemaining = tag.getInteger("ticksRemaining"); + minValue = tag.getInteger("minValue"); + maxValue = tag.getInteger("maxValue"); + incrementValue = tag.getFloat("increment"); this.readClientNBT(tag); } - public void writeClientNBT(NBTTagCompound tag) - { - tag.setFloat("rColour", rColour); - tag.setFloat("gColour", gColour); - tag.setFloat("bColour", bColour); - tag.setInteger("state", state); - - NBTTagList invList = new NBTTagList(); - for (int i = 0; i < inv.length; i++) - { - if (inv[i] != null) - { + public void writeClientNBT(NBTTagCompound tag) { + tag.setFloat("rColour", rColour); + tag.setFloat("gColour", gColour); + tag.setFloat("bColour", bColour); + tag.setInteger("state", state); + + NBTTagList invList = new NBTTagList(); + for (int i = 0; i < inv.length; i++) { + if (inv[i] != null) { NBTTagCompound stackTag = new NBTTagCompound(); stackTag.setByte("Slot", (byte) i); inv[i].writeToNBT(stackTag); @@ -222,56 +226,46 @@ public class TECrucible extends TEInventory tag.setTag("Inventory", invList); } - - public void readClientNBT(NBTTagCompound tag) - { - rColour = tag.getFloat("rColour"); - gColour = tag.getFloat("gColour"); - bColour = tag.getFloat("bColour"); - state = tag.getInteger("state"); - - NBTTagList invList = tag.getTagList("Inventory", - Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < invList.tagCount(); i++) - { + + public void readClientNBT(NBTTagCompound tag) { + rColour = tag.getFloat("rColour"); + gColour = tag.getFloat("gColour"); + bColour = tag.getFloat("bColour"); + state = tag.getInteger("state"); + + NBTTagList invList = tag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < invList.tagCount(); i++) { NBTTagCompound stackTag = invList.getCompoundTagAt(i); int slot = stackTag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - inv[slot] = ItemStack.loadItemStackFromNBT(stackTag); + if (slot >= 0 && slot < inv.length) inv[slot] = ItemStack.loadItemStackFromNBT(stackTag); } } - @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeClientNBT(nbttagcompound); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, 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()); + readClientNBT(packet.func_148857_g()); } - @Override - public String getInventoryName() - { - return "TECrucible"; - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) - { + @Override + public String getInventoryName() { + return "TECrucible"; + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack) { return stack != null ? stack.getItem() instanceof IIncense : false; } - public int getRSPowerOutput() - { - return (state == 1 || state == 0) ? 0 : 15; - } + public int getRSPowerOutput() { + return (state == 1 || state == 0) ? 0 : 15; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEHomHeart.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEHomHeart.java index 2a8c0e79..63b15429 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEHomHeart.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEHomHeart.java @@ -1,34 +1,29 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.common.spell.simple.HomSpell; +import WayofTime.alchemicalWizardry.common.spell.simple.HomSpellRegistry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntitySkull; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.spell.simple.HomSpell; -import WayofTime.alchemicalWizardry.common.spell.simple.HomSpellRegistry; -public class TEHomHeart extends TileEntity -{ - public boolean canCastSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { +public class TEHomHeart extends TileEntity { + public boolean canCastSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return true; } - - public int getCostForSpell() - { - HomSpell spell = getSpell(); - if (spell != null) - { - switch (getModifiedParadigm()) - { + public int getCostForSpell() { + HomSpell spell = getSpell(); + + if (spell != null) { + switch (getModifiedParadigm()) { case 0: return spell.getOffensiveRangedEnergy(); case 1: return spell.getOffensiveMeleeEnergy(); - + case 2: return spell.getDefensiveEnergy(); @@ -40,14 +35,11 @@ public class TEHomHeart extends TileEntity return 0; } - public int castSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { + public int castSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { HomSpell spell = getSpell(); - if (spell != null) - { - switch (getModifiedParadigm()) - { + if (spell != null) { + switch (getModifiedParadigm()) { case 0: spell.onOffensiveRangedRightClick(par1ItemStack, par2World, par3EntityPlayer); return spell.getOffensiveRangedEnergy(); @@ -55,7 +47,7 @@ public class TEHomHeart extends TileEntity case 1: spell.onOffensiveMeleeRightClick(par1ItemStack, par2World, par3EntityPlayer); return spell.getOffensiveMeleeEnergy(); - + case 2: spell.onDefensiveRightClick(par1ItemStack, par2World, par3EntityPlayer); return spell.getDefensiveEnergy(); @@ -69,20 +61,16 @@ public class TEHomHeart extends TileEntity return 0; } - public HomSpell getSpell() - { + public HomSpell getSpell() { TileEntity tileEntity = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord); - if (tileEntity instanceof TEAltar) - { + if (tileEntity instanceof TEAltar) { ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0); - if (itemStack != null) - { + if (itemStack != null) { HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack); - if (spell != null) - { + if (spell != null) { return spell; } } @@ -90,16 +78,13 @@ public class TEHomHeart extends TileEntity tileEntity = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord); - if (tileEntity instanceof TEAltar) - { + if (tileEntity instanceof TEAltar) { ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0); - if (itemStack != null) - { + if (itemStack != null) { HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack); - if (spell != null) - { + if (spell != null) { return spell; } } @@ -107,16 +92,13 @@ public class TEHomHeart extends TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord, zCoord - 1); - if (tileEntity instanceof TEAltar) - { + if (tileEntity instanceof TEAltar) { ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0); - if (itemStack != null) - { + if (itemStack != null) { HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack); - if (spell != null) - { + if (spell != null) { return spell; } } @@ -124,16 +106,13 @@ public class TEHomHeart extends TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord, zCoord + 1); - if (tileEntity instanceof TEAltar) - { + if (tileEntity instanceof TEAltar) { ItemStack itemStack = ((TEAltar) tileEntity).getStackInSlot(0); - if (itemStack != null) - { + if (itemStack != null) { HomSpell spell = HomSpellRegistry.getSpellForItemStack(itemStack); - if (spell != null) - { + if (spell != null) { return spell; } } @@ -142,18 +121,15 @@ public class TEHomHeart extends TileEntity return null; } - public int getModifiedParadigm() - { - //TODO change so that it works with a Tile Entity for a custom head or whatnot + public int getModifiedParadigm() { + // TODO change so that it works with a Tile Entity for a custom head or whatnot TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); - if (tileEntity instanceof TileEntitySkull) - { + if (tileEntity instanceof TileEntitySkull) { int skullType = ((TileEntitySkull) tileEntity).func_145904_a(); - switch (skullType) - { + switch (skullType) { case 0: return 0; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEInventory.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEInventory.java index 6d28ea18..d61fe96a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEInventory.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEInventory.java @@ -10,113 +10,89 @@ import net.minecraftforge.common.util.Constants; /** * Base class for tile entities with inventory - * + * * @author ljfa-ag */ -public abstract class TEInventory extends TileEntity implements IInventory -{ +public abstract class TEInventory extends TileEntity implements IInventory { protected ItemStack[] inv; - public TEInventory(int size) - { + public TEInventory(int size) { inv = new ItemStack[size]; } @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) - setInventorySlotContents(slot, null); - else - { + if (stack != null) { + if (stack.stackSize <= amt) setInventorySlotContents(slot, null); + else { stack = stack.splitStack(amt); - if (stack.stackSize == 0) - setInventorySlotContents(slot, null); + if (stack.stackSize == 0) setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) - { + public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - setInventorySlotContents(slot, null); + if (stack != null) setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) - { + public void setInventorySlotContents(int slot, ItemStack stack) { inv[slot] = stack; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - if (stack != null && stack.stackSize > getInventoryStackLimit()) - stack.stackSize = getInventoryStackLimit(); + if (stack != null && stack.stackSize > getInventoryStackLimit()) stack.stackSize = getInventoryStackLimit(); } @Override public abstract String getInventoryName(); @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return false; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 64; } @Override - public boolean isUseableByPlayer(EntityPlayer player) - { + public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.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() {} @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) - { + public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); NBTTagList invList = 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 stackTag = new NBTTagCompound(); stackTag.setByte("Slot", (byte) i); inv[i].writeToNBT(stackTag); @@ -128,23 +104,18 @@ public abstract class TEInventory extends TileEntity implements IInventory } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); - NBTTagList invList = tag.getTagList("Inventory", - Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < invList.tagCount(); i++) - { + NBTTagList invList = tag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < invList.tagCount(); i++) { NBTTagCompound stackTag = invList.getCompoundTagAt(i); int slot = stackTag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - inv[slot] = ItemStack.loadItemStackFromNBT(stackTag); + if (slot >= 0 && slot < inv.length) inv[slot] = ItemStack.loadItemStackFromNBT(stackTag); } } - public void clear() - { + public void clear() { inv = new ItemStack[inv.length]; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java index a4f56112..d36129fe 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java @@ -1,23 +1,5 @@ package WayofTime.alchemicalWizardry.common.tileEntity; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer; @@ -32,9 +14,25 @@ import WayofTime.alchemicalWizardry.api.rituals.Rituals; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import cpw.mods.fml.common.eventhandler.Event; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; -public class TEMasterStone extends TileEntity implements IMasterRitualStone -{ +public class TEMasterStone extends TileEntity implements IMasterRitualStone { private String currentRitualString; private boolean isActive; private String owner; @@ -44,7 +42,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone private int direction; public boolean isRunning; public int runningTime; - + public LocalRitualStorage storage; private NBTTagCompound customRitualTag; @@ -52,9 +50,10 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone protected ReagentContainer[] tanks; protected Map attunedTankMap; - public TEMasterStone() - { - tanks = new ReagentContainer[]{new ReagentContainer(1000), new ReagentContainer(1000), new ReagentContainer(1000)}; + public TEMasterStone() { + tanks = new ReagentContainer[] { + new ReagentContainer(1000), new ReagentContainer(1000), new ReagentContainer(1000) + }; this.attunedTankMap = new HashMap(); isActive = false; @@ -70,8 +69,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone this.customRitualTag = new NBTTagCompound(); } - public void readClientNBT(NBTTagCompound tag) - { + public void readClientNBT(NBTTagCompound tag) { currentRitualString = tag.getString("currentRitualString"); isRunning = tag.getBoolean("isRunning"); runningTime = tag.getInteger("runningTime"); @@ -81,26 +79,22 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone 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); } } - public void writeClientNBT(NBTTagCompound tag) - { + public void writeClientNBT(NBTTagCompound tag) { tag.setString("currentRitualString", currentRitualString); 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); @@ -110,8 +104,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); isActive = tag.getBoolean("isActive"); owner = tag.getString("owner"); @@ -127,39 +120,35 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone 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")); } customRitualTag = tag.getCompoundTag("customRitualTag"); - + LocalRitualStorage newStorage = Rituals.getLocalStorage(currentRitualString); - + NBTTagCompound localStorageTag = tag.getCompoundTag("localStorage"); - if(newStorage != null) - { - newStorage.readFromNBT(localStorageTag); - storage = newStorage; - storage.xCoord = xCoord; - storage.yCoord = yCoord; - storage.zCoord = zCoord; + if (newStorage != null) { + newStorage.readFromNBT(localStorageTag); + storage = newStorage; + storage.xCoord = xCoord; + storage.yCoord = yCoord; + storage.zCoord = zCoord; } } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setBoolean("isActive", isActive); tag.setString("owner", owner); @@ -172,11 +161,9 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone 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); @@ -186,8 +173,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone NBTTagList attunedTagList = new NBTTagList(); - for (Entry entry : this.attunedTankMap.entrySet()) - { + for (Entry entry : this.attunedTankMap.entrySet()) { NBTTagCompound savedTag = new NBTTagCompound(); savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey())); savedTag.setInteger("amount", entry.getValue()); @@ -197,49 +183,44 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone tag.setTag("attunedTankMap", attunedTagList); tag.setTag("customRitualTag", customRitualTag); - - if(storage != null) - { + + if (storage != null) { NBTTagCompound localStorageTag = new NBTTagCompound(); - storage.writeToNBT(localStorageTag); + storage.writeToNBT(localStorageTag); tag.setTag("localStorage", localStorageTag); } - } - 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; } String testRitual = Rituals.checkValidRitual(world, xCoord, yCoord, zCoord); - if (testRitual.equals("")) - { + if (testRitual.equals("")) { player.addChatMessage(new ChatComponentTranslation("message.masterstone.nothinghappened")); return; } - //TODO - RitualActivatedEvent event = new RitualActivatedEvent(this, crystalOwner, testRitual, player, activationCrystal, crystalLevel); - if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) - { - player.addChatMessage(new ChatComponentTranslation("message.masterstone.somethingstoppedyou")); + // TODO + RitualActivatedEvent event = + new RitualActivatedEvent(this, crystalOwner, testRitual, player, activationCrystal, crystalLevel); + if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) { + player.addChatMessage(new ChatComponentTranslation("message.masterstone.somethingstoppedyou")); - return; + return; } - + int eventCrystalTier = event.crystalTier; String eventRitualKey = event.ritualKey; String eventOwnerKey = event.ownerKey; - + boolean testLevel = Rituals.canCrystalActivate(eventRitualKey, eventCrystalTier); - if (!testLevel) - { + if (!testLevel) { player.addChatMessage(new ChatComponentTranslation("message.masterstone.crystalvibrates")); return; @@ -247,102 +228,97 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone int currentEssence = SoulNetworkHandler.getCurrentEssence(eventOwnerKey); - if (currentEssence < Rituals.getCostForActivation(testRitual)) - { + if (currentEssence < Rituals.getCostForActivation(testRitual)) { player.addChatMessage(new ChatComponentTranslation("message.masterstone.youfeelapull")); return; } - if (!world.isRemote) - { - if (!Rituals.startRitual(this, testRitual, player)) - { + if (!world.isRemote) { + if (!Rituals.startRitual(this, testRitual, player)) { player.addChatMessage(new ChatComponentTranslation("message.masterstone.ritualresistyou")); return; - } else - { - int drain = SoulNetworkHandler.syphonFromNetwork(eventOwnerKey, Rituals.getCostForActivation(testRitual)); - - if(drain > 0) - { - player.addChatMessage(new ChatComponentTranslation("message.masterstone.energyflows")); - - for (int i = 0; i < 12; i++) - { - SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + } else { + int drain = + SoulNetworkHandler.syphonFromNetwork(eventOwnerKey, Rituals.getCostForActivation(testRitual)); + + if (drain > 0) { + player.addChatMessage(new ChatComponentTranslation("message.masterstone.energyflows")); + + 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 ChatComponentTranslation("message.masterstone.somethingstoppedyou")); - - return; + } else { + player.addChatMessage(new ChatComponentTranslation("message.masterstone.somethingstoppedyou")); + + return; } } } - if(!this.currentRitualString.equals("")) - { + if (!this.currentRitualString.equals("")) { Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.ACTIVATE); } this.setOwner(eventOwnerKey); cooldown = Rituals.getInitialCooldown(testRitual); var1 = 0; currentRitualString = testRitual; - storage = Rituals.getLocalStorage(currentRitualString); - storage.setLocation(new Int3(xCoord, yCoord, zCoord)); + storage = Rituals.getLocalStorage(currentRitualString); + storage.setLocation(new Int3(xCoord, yCoord, zCoord)); isActive = true; isRunning = true; direction = Rituals.getDirectionOfRitual(world, xCoord, yCoord, zCoord, testRitual); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - public void setOwner(String owner) - { + public void setOwner(String owner) { this.owner = owner; } - public void useOnRitualBroken() - { + public void useOnRitualBroken() { Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.BREAK_MRS); } - - public void useOnRitualBrokenExplosion() - { + + public void useOnRitualBrokenExplosion() { Rituals.onRitualBroken(this, this.currentRitualString, 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) - { - boolean testRunes = Rituals.checkDirectionOfRitualValid(worldObj, xCoord, yCoord, zCoord, currentRitualString, direction); - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + if (worldTime % 100 == 0) { + boolean testRunes = Rituals.checkDirectionOfRitualValid( + worldObj, xCoord, yCoord, zCoord, currentRitualString, direction); + SpellHelper.sendIndexedParticleToAllAround( + worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); - if (!testRunes) - { + if (!testRunes) { Rituals.onRitualBroken(this, currentRitualString, RitualBreakMethod.BREAK_STONE); isActive = false; currentRitualString = ""; @@ -351,20 +327,16 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone } } - if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0) - { - if (isRunning) - { - Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.REDSTONE); + if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0) { + if (isRunning) { + Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.REDSTONE); isRunning = false; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - + return; - } else - { - if (!isRunning) - { + } else { + if (!isRunning) { isRunning = true; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -373,111 +345,98 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone performRitual(worldObj, xCoord, yCoord, zCoord, currentRitualString); } - 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, currentRitualString); } - public String getOwner() - { + public String getOwner() { return owner; } - public void setCooldown(int newCooldown) - { + public void setCooldown(int newCooldown) { this.cooldown = newCooldown; } - public int getCooldown() - { + public int getCooldown() { return this.cooldown; } - public void setVar1(int newVar1) - { + public void setVar1(int newVar1) { this.var1 = newVar1; } - public int getVar1() - { + public int getVar1() { return this.var1; } - public void setActive(boolean active) - { - Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.DEACTIVATE); + public void setActive(boolean active) { + Rituals.onRitualBroken(this, this.currentRitualString, RitualBreakMethod.DEACTIVATE); this.isActive = active; this.isRunning = active; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - 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; } - public String getCurrentRitual() - { + public String getCurrentRitual() { return this.currentRitualString; } - public void setCurrentRitual(String str) - { + public void setCurrentRitual(String str) { this.currentRitualString = str; } @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()); } - 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); } @@ -485,58 +444,49 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone 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 && tanks[i].getReagent().isReagentEqual(remainingStack); + boolean doesReagentMatch = + tanks[i].getReagent() != null && 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; } } @@ -545,15 +495,12 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone } @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); } @@ -561,18 +508,14 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone 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; } } @@ -583,15 +526,11 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone /* 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); } @@ -603,49 +542,40 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone } @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; } @@ -654,17 +584,13 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone } @Override - public Map getAttunedTankMap() - { + public Map getAttunedTankMap() { return this.attunedTankMap; } - 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; } } @@ -673,32 +599,27 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone } @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() - { - return this.runningTime; + public int getRunningTime() { + return this.runningTime; } - @Override - public LocalRitualStorage getLocalStorage() - { - return storage; - } + @Override + public LocalRitualStorage getLocalStorage() { + return storage; + } - @Override - public void setLocalStorage(LocalRitualStorage storage) - { - this.storage = storage; - } -} \ No newline at end of file + @Override + public void setLocalStorage(LocalRitualStorage storage) { + this.storage = storage; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMimicBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMimicBlock.java index 465cec69..58ec13ed 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMimicBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMimicBlock.java @@ -1,5 +1,10 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; +import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.item.ItemBlock; @@ -12,54 +17,42 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; -import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; -public class TEMimicBlock extends TileEntity -{ +public class TEMimicBlock extends TileEntity { private ItemStack[] inv; public Reagent reagent; private int ticksRemaining; - public TEMimicBlock() - { + public TEMimicBlock() { this.inv = new ItemStack[1]; ticksRemaining = 0; } - + @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeToNBT(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); readFromNBT(packet.func_148857_g()); } @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); } } @@ -69,15 +62,12 @@ public class TEMimicBlock extends TileEntity } @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); @@ -91,135 +81,116 @@ public class TEMimicBlock extends TileEntity } @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); this.ticksRemaining--; - if (this.ticksRemaining <= 0) - { + if (this.ticksRemaining <= 0) { this.returnContainedBlock(); } } - public static boolean createMimicBlockAtLocation(World world, int x, int y, int z, int duration, Block block, int meta, Reagent reagent) - { - if (block == null) - { + public static boolean createMimicBlockAtLocation( + World world, int x, int y, int z, int duration, Block block, int meta, Reagent reagent) { + if (block == null) { return false; } TileEntity tileEntity = world.getTileEntity(x, y, z); - - if (tileEntity == null && world.isAirBlock(x, y, z)) - { + + if (tileEntity == null && world.isAirBlock(x, y, z)) { ItemStack item = new ItemStack(block, 1, meta); world.setBlock(x, y, z, ModBlocks.blockMimic); TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TEMimicBlock) - { + if (tile instanceof TEMimicBlock) { ((TEMimicBlock) tile).setContainedItem(item); ((TEMimicBlock) tile).setDuration(duration); ((TEMimicBlock) tile).reagent = reagent; world.markBlockForUpdate(x, y, z); return true; } - }else - { - if(tileEntity instanceof TEMimicBlock) - { - if(((TEMimicBlock) tileEntity).getBlock() == block && ((TEMimicBlock) tileEntity).getMetaOfMimic() == meta) - { - ((TEMimicBlock) tileEntity).ticksRemaining = Math.max(duration, ((TEMimicBlock) tileEntity).ticksRemaining); - } - } + } else { + if (tileEntity instanceof TEMimicBlock) { + if (((TEMimicBlock) tileEntity).getBlock() == block + && ((TEMimicBlock) tileEntity).getMetaOfMimic() == meta) { + ((TEMimicBlock) tileEntity).ticksRemaining = + Math.max(duration, ((TEMimicBlock) tileEntity).ticksRemaining); + } + } } return false; } - - public static boolean createMimicBlockAtLocation(World world, int x, int y, int z, int duration, Block block, int meta) - { - return createMimicBlockAtLocation(world, x, y, z, duration, block, meta); + + public static boolean createMimicBlockAtLocation( + World world, int x, int y, int z, int duration, Block block, int meta) { + return createMimicBlockAtLocation(world, x, y, z, duration, block, meta); } - public void setDuration(int dur) - { + public void setDuration(int dur) { this.ticksRemaining = dur; } - public void resetDuration(int dur) - { - if (this.ticksRemaining < dur) - { + public void resetDuration(int dur) { + if (this.ticksRemaining < dur) { this.ticksRemaining = dur; } } - public void setContainedItem(ItemStack item) - { + public void setContainedItem(ItemStack item) { this.inv[0] = item; } - public void returnContainedBlock() - { -// ItemStack item = this.inv[0]; -// if (item != null) -// { -// if (item.getItem() instanceof ItemBlock) -// { -// Block block = ((ItemBlock) item.getItem()).field_150939_a; -// int meta = item.getItemDamage(); -// -// if (block != null) -// { -// this.worldObj.setBlock(xCoord, yCoord, zCoord, block, meta, 6); -// } -// } -// -// } else + public void returnContainedBlock() { + // ItemStack item = this.inv[0]; + // if (item != null) + // { + // if (item.getItem() instanceof ItemBlock) + // { + // Block block = ((ItemBlock) item.getItem()).field_150939_a; + // int meta = item.getItemDamage(); + // + // if (block != null) + // { + // this.worldObj.setBlock(xCoord, yCoord, zCoord, block, meta, 6); + // } + // } + // + // } else { this.worldObj.setBlockToAir(xCoord, yCoord, zCoord); } } - - public Block getBlock() - { - ItemStack item = this.inv[0]; - if(item != null) - { - if (item.getItem() instanceof ItemBlock) - { - return ((ItemBlock) item.getItem()).field_150939_a; - } - } - return null; + + public Block getBlock() { + ItemStack item = this.inv[0]; + if (item != null) { + if (item.getItem() instanceof ItemBlock) { + return ((ItemBlock) item.getItem()).field_150939_a; + } + } + return null; } - - public int getMetaOfMimic() - { - ItemStack item = this.inv[0]; - if(item != null) - { - return item.getItemDamage(); - } - - return 0; + + public int getMetaOfMimic() { + ItemStack item = this.inv[0]; + if (item != null) { + return item.getItemDamage(); + } + + return 0; + } + + public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) { + if (reagent != null) { + OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent); + if (paradigm != null) { + return paradigm.getBlockEffectWhileInside(entity, x, y, z); + } + } + + return false; } - - public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z) - { - if(reagent != null) - { - OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent); - if(paradigm != null) - { - return paradigm.getBlockEffectWhileInside(entity, x, y, z); - } - } - - return false; - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java index 4029c2fa..c32dd432 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java @@ -7,61 +7,51 @@ import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TEOrientable extends TileEntity implements IOrientable -{ +public class TEOrientable extends TileEntity implements IOrientable { protected ForgeDirection inputFace; protected ForgeDirection outputFace; - public TEOrientable() - { + public TEOrientable() { this.inputFace = ForgeDirection.DOWN; this.outputFace = ForgeDirection.UP; } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); this.setInputDirection(ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("inputFace"))); this.setOutputDirection(ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("outputFace"))); } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("inputFace", TEOrientable.getIntForForgeDirection(this.getInputDirection())); par1NBTTagCompound.setInteger("outputFace", TEOrientable.getIntForForgeDirection(this.getOutputDirection())); } @Override - public ForgeDirection getInputDirection() - { + public ForgeDirection getInputDirection() { return this.inputFace; } @Override - public ForgeDirection getOutputDirection() - { + public ForgeDirection getOutputDirection() { return this.outputFace; } @Override - public void setInputDirection(ForgeDirection direction) - { + public void setInputDirection(ForgeDirection direction) { this.inputFace = direction; } @Override - public void setOutputDirection(ForgeDirection direction) - { + public void setOutputDirection(ForgeDirection direction) { this.outputFace = direction; } - public static int getIntForForgeDirection(ForgeDirection direction) - { - switch (direction) - { + public static int getIntForForgeDirection(ForgeDirection direction) { + switch (direction) { case DOWN: return 0; @@ -86,23 +76,18 @@ public class TEOrientable extends TileEntity implements IOrientable } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return NewPacketHandler.getPacket(this); } - - public boolean isSideRendered(ForgeDirection side) - { - if (side.equals(this.getInputDirection()) || side.equals(this.getOutputDirection())) - { + public boolean isSideRendered(ForgeDirection side) { + if (side.equals(this.getInputDirection()) || side.equals(this.getOutputDirection())) { return true; } return false; } - public String getResourceLocationForMeta(int meta) - { + public String getResourceLocationForMeta(int meta) { return ""; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPedestal.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPedestal.java index ff2d1875..779c3a20 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPedestal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPedestal.java @@ -1,24 +1,22 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; -import WayofTime.alchemicalWizardry.common.NewPacketHandler; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class TEPedestal extends TEInventory -{ - public static final int sizeInv = 1; - +public class TEPedestal extends TEInventory { + public static final int sizeInv = 1; + private int resultID; private int resultDamage; private boolean isActive; - public TEPedestal() - { + public TEPedestal() { super(sizeInv); resultID = 0; resultDamage = 0; @@ -26,8 +24,7 @@ public class TEPedestal extends TEInventory } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); resultID = par1NBTTagCompound.getInteger("resultID"); @@ -36,8 +33,7 @@ public class TEPedestal extends TEInventory } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("resultID", resultID); @@ -46,77 +42,62 @@ public class TEPedestal extends TEInventory } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TEPedestal"; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } - //Logic for the actual block is under here + // Logic for the actual block is under here @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); } - public void setActive() - { + public void setActive() { isActive = false; } - public boolean isActive() - { + public boolean isActive() { return isActive; } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return NewPacketHandler.getPacket(this); } - public void handlePacketData(int[] intData) - { - if (intData == null) - { + public void handlePacketData(int[] intData) { + 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; } } } } - 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; @@ -127,20 +108,17 @@ public class TEPedestal extends TEInventory } @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 0; } - public void onItemDeletion() - { + public void onItemDeletion() { worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, xCoord, yCoord, zCoord)); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - for (int i = 0; i < 16; i++) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord); + for (int i = 0; i < 16; i++) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord); } } - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPlinth.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPlinth.java index 8ad6d782..b6332140 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPlinth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEPlinth.java @@ -1,8 +1,13 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry; +import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistryComponent; +import WayofTime.alchemicalWizardry.common.IDemon; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; +import WayofTime.alchemicalWizardry.common.PlinthComponent; +import WayofTime.alchemicalWizardry.common.items.EnergyBattery; import java.util.ArrayList; import java.util.List; - import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -13,16 +18,9 @@ import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.Constants; import net.minecraftforge.oredict.OreDictionary; -import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry; -import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistryComponent; -import WayofTime.alchemicalWizardry.common.IDemon; -import WayofTime.alchemicalWizardry.common.NewPacketHandler; -import WayofTime.alchemicalWizardry.common.PlinthComponent; -import WayofTime.alchemicalWizardry.common.items.EnergyBattery; -public class TEPlinth extends TEInventory -{ - public static final int sizeInv = 1; +public class TEPlinth extends TEInventory { + public static final int sizeInv = 1; private boolean isActive; private boolean paradigm; @@ -36,9 +34,8 @@ public class TEPlinth extends TEInventory public static List pedestalPositions = new ArrayList(); - public TEPlinth() - { - super(sizeInv); + public TEPlinth() { + super(sizeInv); this.ring1Inv = new ItemStack[6]; this.ring2Inv = new ItemStack[6]; this.ring3Inv = new ItemStack[6]; @@ -48,45 +45,38 @@ public class TEPlinth extends TEInventory } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList ring1TagList = par1NBTTagCompound.getTagList("ring1Inv", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < ring1TagList.tagCount(); i++) - { + for (int i = 0; i < ring1TagList.tagCount(); i++) { NBTTagCompound tag = ring1TagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - { + if (slot >= 0 && slot < inv.length) { ring1Inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } NBTTagList ring2TagList = par1NBTTagCompound.getTagList("ring2Inv", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < ring2TagList.tagCount(); i++) - { + for (int i = 0; i < ring2TagList.tagCount(); i++) { NBTTagCompound tag = ring2TagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - { + if (slot >= 0 && slot < inv.length) { ring2Inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } NBTTagList ring3TagList = par1NBTTagCompound.getTagList("ring3Inv", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < ring3TagList.tagCount(); i++) - { + for (int i = 0; i < ring3TagList.tagCount(); i++) { NBTTagCompound tag = ring3TagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) - { + if (slot >= 0 && slot < inv.length) { ring3Inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } @@ -97,16 +87,13 @@ public class TEPlinth extends TEInventory } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); NBTTagList ring1ItemList = new NBTTagList(); - for (int i = 0; i < ring1Inv.length; i++) - { - if (ring1Inv[i] != null) - { + for (int i = 0; i < ring1Inv.length; i++) { + if (ring1Inv[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); ring1Inv[i].writeToNBT(tag); @@ -117,10 +104,8 @@ public class TEPlinth extends TEInventory par1NBTTagCompound.setTag("ring1Inv", ring1ItemList); NBTTagList ring2ItemList = new NBTTagList(); - for (int i = 0; i < ring2Inv.length; i++) - { - if (ring2Inv[i] != null) - { + for (int i = 0; i < ring2Inv.length; i++) { + if (ring2Inv[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); ring2Inv[i].writeToNBT(tag); @@ -131,10 +116,8 @@ public class TEPlinth extends TEInventory par1NBTTagCompound.setTag("ring2Inv", ring1ItemList); NBTTagList ring3ItemList = new NBTTagList(); - for (int i = 0; i < ring3Inv.length; i++) - { - if (ring3Inv[i] != null) - { + for (int i = 0; i < ring3Inv.length; i++) { + if (ring3Inv[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); ring3Inv[i].writeToNBT(tag); @@ -149,70 +132,73 @@ public class TEPlinth extends TEInventory } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TEPlinth"; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } - //Logic for the actual block is under here + // Logic for the actual block is under here @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); - if (worldObj.isRemote) - { + if (worldObj.isRemote) { return; } - if (!isActive()) - { - if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof EnergyBattery) - { + if (!isActive()) { + if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof EnergyBattery) { int bloodOrbLevel = ((EnergyBattery) getStackInSlot(0).getItem()).getOrbLevel(); - if (SummoningRegistry.isRecipeValid(bloodOrbLevel, composeItemsForRingAndParadigm(1, true), composeItemsForRingAndParadigm(2, true), composeItemsForRingAndParadigm(3, true))) - { - SummoningRegistryComponent src = SummoningRegistry.getRegistryComponent(bloodOrbLevel, composeItemsForRingAndParadigm(1, true), composeItemsForRingAndParadigm(2, true), composeItemsForRingAndParadigm(3, true)); + if (SummoningRegistry.isRecipeValid( + bloodOrbLevel, + composeItemsForRingAndParadigm(1, true), + composeItemsForRingAndParadigm(2, true), + composeItemsForRingAndParadigm(3, true))) { + SummoningRegistryComponent src = SummoningRegistry.getRegistryComponent( + bloodOrbLevel, + composeItemsForRingAndParadigm(1, true), + composeItemsForRingAndParadigm(2, true), + composeItemsForRingAndParadigm(3, true)); isActive = true; paradigm = true; progress = 0; ring1Inv = src.getRingRecipeForRing(1); ring2Inv = src.getRingRecipeForRing(2); ring3Inv = src.getRingRecipeForRing(3); - } else if (SummoningRegistry.isRecipeValid(bloodOrbLevel, composeItemsForRingAndParadigm(1, false), composeItemsForRingAndParadigm(2, false), composeItemsForRingAndParadigm(3, false))) - { - SummoningRegistryComponent src = SummoningRegistry.getRegistryComponent(bloodOrbLevel, composeItemsForRingAndParadigm(1, false), composeItemsForRingAndParadigm(2, false), composeItemsForRingAndParadigm(3, false)); + } else if (SummoningRegistry.isRecipeValid( + bloodOrbLevel, + composeItemsForRingAndParadigm(1, false), + composeItemsForRingAndParadigm(2, false), + composeItemsForRingAndParadigm(3, false))) { + SummoningRegistryComponent src = SummoningRegistry.getRegistryComponent( + bloodOrbLevel, + composeItemsForRingAndParadigm(1, false), + composeItemsForRingAndParadigm(2, false), + composeItemsForRingAndParadigm(3, false)); isActive = true; paradigm = false; progress = 0; ring1Inv = src.getRingRecipeForRing(1); ring2Inv = src.getRingRecipeForRing(2); ring3Inv = src.getRingRecipeForRing(3); - } else - { + } else { isActive = false; progress = 0; } } - } else - { - if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof EnergyBattery) - { - if (progress % progressInterval == 0) - { + } else { + if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof EnergyBattery) { + if (progress % progressInterval == 0) { int ring = (progress / progressInterval) / 6 + 1; int slot = (progress / progressInterval) % 6; ItemStack itemStack; - switch (ring) - { + switch (ring) { case 1: itemStack = this.ring1Inv[slot]; break; @@ -229,43 +215,36 @@ public class TEPlinth extends TEInventory itemStack = null; } - if (itemStack == null) - { + if (itemStack == null) { progress += progressInterval; - } else - { - if (this.deleteItemStackInRing(ring, itemStack)) - { + } else { + if (this.deleteItemStackInRing(ring, itemStack)) { progress++; } } - } else - { + } else { progress++; } - if (progress >= progressInterval * 18) - { + if (progress >= progressInterval * 18) { int bloodOrbLevel = ((EnergyBattery) getStackInSlot(0).getItem()).getOrbLevel(); - EntityLivingBase entity = SummoningRegistry.getEntity(worldObj, bloodOrbLevel, ring1Inv, ring2Inv, ring3Inv); + EntityLivingBase entity = + SummoningRegistry.getEntity(worldObj, bloodOrbLevel, ring1Inv, ring2Inv, ring3Inv); - if (entity != null) - { + if (entity != null) { entity.setPosition(xCoord + 0.5, yCoord + 1, zCoord + 0.5); worldObj.spawnEntityInWorld(entity); - if (entity instanceof IDemon) - { + if (entity instanceof IDemon) { ((IDemon) entity).setSummonedConditions(); } worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, 3, false); - //deleteItemsInRing(1); + // deleteItemsInRing(1); isActive = false; progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } @@ -274,38 +253,31 @@ public class TEPlinth extends TEInventory } } - public void deleteItemsInRing(int ring) - { - if (paradigm) - { + public void deleteItemsInRing(int ring) { + if (paradigm) { int i = 0; - for (PlinthComponent pc : pedestalPositions) - { - if (i < 6 && pc.getRing() == ring) - { - TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); + for (PlinthComponent pc : pedestalPositions) { + if (i < 6 && pc.getRing() == ring) { + TileEntity tileEntity = + worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { ((TEPedestal) tileEntity).setInventorySlotContents(0, null); worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); i++; } } } - } else - { + } else { int i = 0; - for (PlinthComponent pc : pedestalPositions) - { - if (i < 6 && pc.getRing() == ring) - { - TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset); + for (PlinthComponent pc : pedestalPositions) { + if (i < 6 && pc.getRing() == ring) { + TileEntity tileEntity = + worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { ((TEPedestal) tileEntity).setInventorySlotContents(0, null); worldObj.markBlockForUpdate(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset); i++; @@ -315,57 +287,49 @@ public class TEPlinth extends TEInventory } } - public boolean deleteItemStackInRing(int ring, ItemStack itemStack) - { - if (itemStack == null) - { + public boolean deleteItemStackInRing(int ring, ItemStack itemStack) { + if (itemStack == null) { return true; } - if (paradigm) - { + if (paradigm) { int i = 0; - for (PlinthComponent pc : pedestalPositions) - { - if (i < 6 && pc.getRing() == ring) - { - TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); + for (PlinthComponent pc : pedestalPositions) { + if (i < 6 && pc.getRing() == ring) { + TileEntity tileEntity = + worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { ItemStack possibleItem = ((TEPedestal) tileEntity).getStackInSlot(0); - if (possibleItem == null) - { + if (possibleItem == null) { i++; continue; } boolean test = false; - if (possibleItem.getItem() instanceof ItemBlock) - { - if (itemStack.getItem() instanceof ItemBlock) - { + if (possibleItem.getItem() instanceof ItemBlock) { + if (itemStack.getItem() instanceof ItemBlock) { test = true; } - } else if (!(itemStack.getItem() instanceof ItemBlock)) - { + } else if (!(itemStack.getItem() instanceof ItemBlock)) { test = true; } - if (test) - { - if (itemStack.getItem() == possibleItem.getItem() && (itemStack.getItemDamage() == possibleItem.getItemDamage() || itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) - { + if (test) { + if (itemStack.getItem() == possibleItem.getItem() + && (itemStack.getItemDamage() == possibleItem.getItemDamage() + || itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { ((TEPedestal) tileEntity).decrStackSize(0, 1); - if (((TEPedestal) tileEntity).getStackInSlot(0) != null && ((TEPedestal) tileEntity).getStackInSlot(0).stackSize == 0) - { + if (((TEPedestal) tileEntity).getStackInSlot(0) != null + && ((TEPedestal) tileEntity).getStackInSlot(0).stackSize == 0) { ((TEPedestal) tileEntity).setInventorySlotContents(0, null); } ((TEPedestal) tileEntity).onItemDeletion(); - worldObj.markBlockForUpdate(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); + worldObj.markBlockForUpdate( + xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); return true; } } @@ -374,46 +338,40 @@ public class TEPlinth extends TEInventory } } } - } else - { + } else { int i = 0; - for (PlinthComponent pc : pedestalPositions) - { - if (i < 6 && pc.getRing() == ring) - { - TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset); + for (PlinthComponent pc : pedestalPositions) { + if (i < 6 && pc.getRing() == ring) { + TileEntity tileEntity = + worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { ItemStack possibleItem = ((TEPedestal) tileEntity).getStackInSlot(0); - if (possibleItem == null) - { + if (possibleItem == null) { i++; continue; } boolean test = false; - if (possibleItem.getItem() instanceof ItemBlock) - { - if (itemStack.getItem() instanceof ItemBlock) - { + if (possibleItem.getItem() instanceof ItemBlock) { + if (itemStack.getItem() instanceof ItemBlock) { test = true; } - } else if (!(itemStack.getItem() instanceof ItemBlock)) - { + } else if (!(itemStack.getItem() instanceof ItemBlock)) { test = true; } - if (test) - { - if (itemStack.getItem() == possibleItem.getItem() && (itemStack.getItemDamage() == possibleItem.getItemDamage() || itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) - { + if (test) { + if (itemStack.getItem() == possibleItem.getItem() + && (itemStack.getItemDamage() == possibleItem.getItemDamage() + || itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { ((TEPedestal) tileEntity).decrStackSize(0, 1); ((TEPedestal) tileEntity).onItemDeletion(); - worldObj.markBlockForUpdate(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); + worldObj.markBlockForUpdate( + xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); return true; } } @@ -427,39 +385,32 @@ public class TEPlinth extends TEInventory return false; } - public ItemStack[] composeItemsForRingAndParadigm(int ring, boolean paradigm) - { + public ItemStack[] composeItemsForRingAndParadigm(int ring, boolean paradigm) { ItemStack[] composed = new ItemStack[6]; - if (paradigm) - { + if (paradigm) { int i = 0; - for (PlinthComponent pc : pedestalPositions) - { - if (i < 6 && pc.getRing() == ring) - { - TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); + for (PlinthComponent pc : pedestalPositions) { + if (i < 6 && pc.getRing() == ring) { + TileEntity tileEntity = + worldObj.getTileEntity(xCoord + pc.xOffset, yCoord + pc.yOffset, zCoord + pc.zOffset); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { composed[i] = ((TEPedestal) tileEntity).getStackInSlot(0); i++; } } } - } else - { + } else { int i = 0; - for (PlinthComponent pc : pedestalPositions) - { - if (i < 6 && pc.getRing() == ring) - { - TileEntity tileEntity = worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset); + for (PlinthComponent pc : pedestalPositions) { + if (i < 6 && pc.getRing() == ring) { + TileEntity tileEntity = + worldObj.getTileEntity(xCoord + pc.zOffset, yCoord + pc.yOffset, zCoord + pc.xOffset); - if (tileEntity instanceof TEPedestal) - { + if (tileEntity instanceof TEPedestal) { composed[i] = ((TEPedestal) tileEntity).getStackInSlot(0); i++; } @@ -470,59 +421,47 @@ public class TEPlinth extends TEInventory return composed; } - public void setActive() - { + public void setActive() { isActive = false; } - public boolean isActive() - { + public boolean isActive() { return isActive; } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return NewPacketHandler.getPacket(this); } - public void handlePacketData(int[] intData) - { - if (intData == null) - { + public void handlePacketData(int[] intData) { + 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; } } } } - 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; @@ -533,13 +472,11 @@ public class TEPlinth extends TEInventory } @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 0; } - public static void initialize() - { + public static void initialize() { pedestalPositions.add(new PlinthComponent(1, 0, -2, 1)); pedestalPositions.add(new PlinthComponent(2, 0, 0, 1)); pedestalPositions.add(new PlinthComponent(1, 0, +2, 1)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java index 6efd07e2..af89a600 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java @@ -7,6 +7,11 @@ import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -19,18 +24,11 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public class TEReagentConduit extends TileSegmentedReagentHandler -{ - public List destinationList; //These are offsets +public class TEReagentConduit extends TileSegmentedReagentHandler { + public List destinationList; // These are offsets public Map> reagentTargetList; public Map reagentTankDesignationList; - public int tickRate = 20; //Rate that the reagents are sent + public int tickRate = 20; // Rate that the reagents are sent int hasChanged = 0; public boolean affectedByRedstone = true; @@ -39,13 +37,11 @@ public class TEReagentConduit extends TileSegmentedReagentHandler public int renderCount = 0; - public TEReagentConduit() - { + public TEReagentConduit() { this(2, 2000); } - public TEReagentConduit(int numberOfTanks, int size) - { + public TEReagentConduit(int numberOfTanks, int size) { super(numberOfTanks, size); destinationList = new LinkedList(); @@ -53,17 +49,14 @@ public class TEReagentConduit extends TileSegmentedReagentHandler reagentTankDesignationList = new HashMap(); } - public Int3 getColour() - { + public Int3 getColour() { int[] redMap = new int[this.tanks.length]; int[] greenMap = new int[this.tanks.length]; int[] blueMap = new int[this.tanks.length]; - for (int i = 0; i < this.tanks.length; i++) - { + for (int i = 0; i < this.tanks.length; i++) { ReagentContainer container = this.tanks[i]; - if (container != null && container.getReagent() != null) - { + if (container != null && container.getReagent() != null) { Reagent reagent = container.getReagent().reagent; redMap[i] = reagent.getColourRed(); @@ -76,8 +69,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler int green = 0; int blue = 0; - for (int i = 0; i < this.tanks.length; i++) - { + for (int i = 0; i < this.tanks.length; i++) { red += redMap[i]; green += greenMap[i]; blue += blueMap[i]; @@ -91,33 +83,29 @@ public class TEReagentConduit extends TileSegmentedReagentHandler } @Override - public void writeToNBT(NBTTagCompound tag) - { + public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setInteger("hasChanged", hasChanged); NBTTagList tagList = new NBTTagList(); - for (int i = 0; i < destinationList.size(); i++) - { + for (int i = 0; i < destinationList.size(); i++) { NBTTagCompound savedTag = new NBTTagCompound(); tagList.appendTag(destinationList.get(i).writeToNBT(savedTag)); } tag.setTag("destinationList", tagList); - NBTTagList reagentTagList = new NBTTagList(); //TODO + NBTTagList reagentTagList = new NBTTagList(); // TODO - for (Entry> entry : reagentTargetList.entrySet()) - { + for (Entry> entry : reagentTargetList.entrySet()) { NBTTagCompound savedTag = new NBTTagCompound(); savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey())); NBTTagList coordinateTagList = new NBTTagList(); - for (Int3 coord : entry.getValue()) - { + for (Int3 coord : entry.getValue()) { NBTTagCompound coordinateTag = new NBTTagCompound(); coord.writeToNBT(coordinateTag); @@ -134,8 +122,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler NBTTagList tankDesignationList = new NBTTagList(); - for (Entry entry : this.reagentTankDesignationList.entrySet()) - { + for (Entry entry : this.reagentTankDesignationList.entrySet()) { NBTTagCompound savedTag = new NBTTagCompound(); savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey())); @@ -145,12 +132,10 @@ public class TEReagentConduit extends TileSegmentedReagentHandler } tag.setTag("tankDesignationList", tankDesignationList); - } @Override - public void readFromNBT(NBTTagCompound tag) - { + public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); hasChanged = tag.getInteger("hasChanged"); @@ -159,8 +144,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler destinationList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound savedTag = tagList.getCompoundTagAt(i); destinationList.add(ColourAndCoords.readFromNBT(savedTag)); @@ -170,8 +154,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler NBTTagList reagentTagList = tag.getTagList("reagentTargetList", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < reagentTagList.tagCount(); i++) - { + for (int i = 0; i < reagentTagList.tagCount(); i++) { NBTTagCompound savedTag = reagentTagList.getCompoundTagAt(i); Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent")); @@ -180,8 +163,7 @@ public class TEReagentConduit extends TileSegmentedReagentHandler NBTTagList coordinateList = savedTag.getTagList("coordinateList", Constants.NBT.TAG_COMPOUND); - for (int j = 0; j < coordinateList.tagCount(); j++) - { + for (int j = 0; j < coordinateList.tagCount(); j++) { coordList.add(Int3.readFromNBT(coordinateList.getCompoundTagAt(j))); } @@ -192,22 +174,21 @@ public class TEReagentConduit extends TileSegmentedReagentHandler NBTTagList tankDesignationList = tag.getTagList("tankDesignationList", Constants.NBT.TAG_COMPOUND); - for (int i = 0; i < tankDesignationList.tagCount(); i++) - { + for (int i = 0; i < tankDesignationList.tagCount(); i++) { NBTTagCompound savedTag = tankDesignationList.getCompoundTagAt(i); - this.reagentTankDesignationList.put(ReagentRegistry.getReagentForKey(savedTag.getString("reagent")), new Integer(savedTag.getInteger("integer"))); + this.reagentTankDesignationList.put( + ReagentRegistry.getReagentForKey(savedTag.getString("reagent")), + new Integer(savedTag.getInteger("integer"))); } } - public void readClientNBT(NBTTagCompound tag) - { + public void readClientNBT(NBTTagCompound tag) { NBTTagList tagList = tag.getTagList("destinationList", Constants.NBT.TAG_COMPOUND); destinationList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound savedTag = tagList.getCompoundTagAt(i); destinationList.add(ColourAndCoords.readFromNBT(savedTag)); @@ -218,19 +199,16 @@ public class TEReagentConduit extends TileSegmentedReagentHandler int size = reagentTagList.tagCount(); this.tanks = new ReagentContainer[size]; - for (int i = 0; i < size; i++) - { + for (int i = 0; i < size; i++) { NBTTagCompound savedTag = reagentTagList.getCompoundTagAt(i); this.tanks[i] = ReagentContainer.readFromNBT(savedTag); } } - public void writeClientNBT(NBTTagCompound tag) - { + public void writeClientNBT(NBTTagCompound tag) { NBTTagList tagList = new NBTTagList(); - for (int i = 0; i < destinationList.size(); i++) - { + for (int i = 0; i < destinationList.size(); i++) { NBTTagCompound savedTag = new NBTTagCompound(); tagList.appendTag(destinationList.get(i).writeToNBT(savedTag)); } @@ -239,11 +217,9 @@ public class TEReagentConduit extends TileSegmentedReagentHandler NBTTagList reagentTagList = 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); } reagentTagList.appendTag(savedTag); @@ -253,50 +229,42 @@ public class TEReagentConduit extends TileSegmentedReagentHandler } @Override - public void updateEntity() - { - if (!worldObj.isRemote) - { - if (hasChanged > 1) - { + public void updateEntity() { + if (!worldObj.isRemote) { + if (hasChanged > 1) { hasChanged = 1; - } else if (hasChanged == 1) - { + } else if (hasChanged == 1) { hasChanged = 0; } - if (worldObj.getWorldTime() % 100 == 99) - { + if (worldObj.getWorldTime() % 100 == 99) { this.updateColourList(); } - if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) - { + if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { return; } int totalTransfered = 0; - for (Entry> entry : this.reagentTargetList.entrySet()) - { - for (Int3 coord : entry.getValue()) - { - if (totalTransfered >= this.tickRate) - { + for (Entry> entry : this.reagentTargetList.entrySet()) { + for (Int3 coord : entry.getValue()) { + if (totalTransfered >= this.tickRate) { break; } - ReagentStack maxDrainAmount = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), this.tickRate - totalTransfered), false); + ReagentStack maxDrainAmount = this.drain( + ForgeDirection.UNKNOWN, + new ReagentStack(entry.getKey(), this.tickRate - totalTransfered), + false); - if (maxDrainAmount == null) - { + if (maxDrainAmount == null) { continue; } int amountLeft = maxDrainAmount.amount; - if (amountLeft <= 0) - { + if (amountLeft <= 0) { continue; } @@ -305,31 +273,29 @@ public class TEReagentConduit extends TileSegmentedReagentHandler int z = zCoord + coord.zCoord; TileEntity tile = worldObj.getTileEntity(x, y, z); - if (tile instanceof IReagentHandler) - { - int amount = Math.min(((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, maxDrainAmount, false), amountLeft); - if (amount > 0) - { + if (tile instanceof IReagentHandler) { + int amount = Math.min( + ((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, maxDrainAmount, false), + amountLeft); + if (amount > 0) { amountLeft -= amount; totalTransfered += amount; - ReagentStack stack = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), amount), true); + ReagentStack stack = + this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), amount), true); ((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, stack, true); } } } } - } else - { - if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) - { + } else { + if (affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { return; } renderCount++; - if (worldObj.getWorldTime() % 100 != 0) - { + if (worldObj.getWorldTime() % 100 != 0) { return; } @@ -337,25 +303,26 @@ public class TEReagentConduit extends TileSegmentedReagentHandler } } - @SideOnly(Side.CLIENT) - public void sendPlayerStuffs() - { + public void sendPlayerStuffs() { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; World world = mc.theWorld; - if (SpellHelper.canPlayerSeeAlchemy(player)) - { - for (ColourAndCoords colourSet : this.destinationList) - { - if (!(worldObj.getTileEntity(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord) instanceof IReagentHandler)) - { + if (SpellHelper.canPlayerSeeAlchemy(player)) { + for (ColourAndCoords colourSet : this.destinationList) { + if (!(worldObj.getTileEntity( + xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord) + instanceof IReagentHandler)) { continue; } EntityParticleBeam beam = new EntityParticleBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); - double velocity = Math.sqrt(Math.pow(colourSet.xCoord, 2) + Math.pow(colourSet.yCoord, 2) + Math.pow(colourSet.zCoord, 2)); + double velocity = Math.sqrt( + Math.pow(colourSet.xCoord, 2) + Math.pow(colourSet.yCoord, 2) + Math.pow(colourSet.zCoord, 2)); double wantedVel = 0.3d; - beam.setVelocity(wantedVel * colourSet.xCoord / velocity, wantedVel * colourSet.yCoord / velocity, wantedVel * colourSet.zCoord / velocity); + beam.setVelocity( + wantedVel * colourSet.xCoord / velocity, + wantedVel * colourSet.yCoord / velocity, + wantedVel * colourSet.zCoord / velocity); beam.setColour(colourSet.colourRed / 255f, colourSet.colourGreen / 255f, colourSet.colourBlue / 255f); beam.setDestination(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord); worldObj.spawnEntityInWorld(beam); @@ -363,43 +330,41 @@ public class TEReagentConduit extends TileSegmentedReagentHandler } } - public void updateColourList() - { - if (worldObj.isRemote) - { + public void updateColourList() { + if (worldObj.isRemote) { return; } List newList = this.compileListForReagentTargets(this.reagentTargetList); - if (newList != null && !newList.equals(destinationList)) - { + if (newList != null && !newList.equals(destinationList)) { this.destinationList = newList; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } - public List compileListForReagentTargets(Map> map) - { + public List compileListForReagentTargets(Map> map) { List list = new LinkedList(); - for (Entry> entry : map.entrySet()) - { - if (entry.getValue() != null) - { + for (Entry> entry : map.entrySet()) { + if (entry.getValue() != null) { Reagent reagent = entry.getKey(); - if (reagent == null) - { + if (reagent == null) { continue; } List coords = entry.getValue(); - for (Int3 coord : coords) - { - if (coord == null) - { + for (Int3 coord : coords) { + if (coord == null) { continue; } - list.add(new ColourAndCoords(reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), reagent.getColourIntensity(), coord.xCoord, coord.yCoord, coord.zCoord)); + list.add(new ColourAndCoords( + reagent.getColourRed(), + reagent.getColourGreen(), + reagent.getColourBlue(), + reagent.getColourIntensity(), + coord.xCoord, + coord.yCoord, + coord.zCoord)); } } } @@ -407,10 +372,9 @@ public class TEReagentConduit extends TileSegmentedReagentHandler return list; } - public boolean addDestinationViaOffset(int red, int green, int blue, int intensity, int xOffset, int yOffset, int zOffset) - { - if (xOffset == 0 && yOffset == 0 && zOffset == 0) - { + public boolean addDestinationViaOffset( + int red, int green, int blue, int intensity, int xOffset, int yOffset, int zOffset) { + if (xOffset == 0 && yOffset == 0 && zOffset == 0) { return false; } @@ -419,67 +383,56 @@ public class TEReagentConduit extends TileSegmentedReagentHandler return true; } - public boolean addDestinationViaActual(int red, int green, int blue, int intensity, int x, int y, int z) - { - return this.addDestinationViaOffset(red, green, blue, intensity, x - this.xCoord, y - this.yCoord, z - this.zCoord); + public boolean addDestinationViaActual(int red, int green, int blue, int intensity, int x, int y, int z) { + return this.addDestinationViaOffset( + red, green, blue, intensity, x - this.xCoord, y - this.yCoord, z - this.zCoord); } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeClientNBT(nbttagcompound); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, 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()); } - public boolean addReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset) - { + public boolean addReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset) { int totalConnections = 0; - for (Entry> entry : this.reagentTargetList.entrySet()) - { - if (entry.getValue() != null) - { + for (Entry> entry : this.reagentTargetList.entrySet()) { + if (entry.getValue() != null) { totalConnections += entry.getValue().size(); } } - if (totalConnections >= this.maxConnextions) - { - //Send message that it cannot be done? Maybe add a Player instance + if (totalConnections >= this.maxConnextions) { + // Send message that it cannot be done? Maybe add a Player instance return false; } - if (xOffset == 0 && yOffset == 0 && zOffset == 0) - { + if (xOffset == 0 && yOffset == 0 && zOffset == 0) { return false; } Int3 newCoord = new Int3(xOffset, yOffset, zOffset); - if (this.reagentTargetList.containsKey(reagent)) - { + if (this.reagentTargetList.containsKey(reagent)) { List coordList = this.reagentTargetList.get(reagent); - if (coordList == null) - { + if (coordList == null) { List newCoordList = new LinkedList(); newCoordList.add(newCoord); this.reagentTargetList.put(reagent, newCoordList); - } else - { + } else { coordList.add(newCoord); } return true; - } else - { + } else { List newCoordList = new LinkedList(); newCoordList.add(newCoord); this.reagentTargetList.put(reagent, newCoordList); @@ -488,18 +441,14 @@ public class TEReagentConduit extends TileSegmentedReagentHandler } } - public boolean addReagentDestinationViaActual(Reagent reagent, int x, int y, int z) - { + public boolean addReagentDestinationViaActual(Reagent reagent, int x, int y, int z) { return (this.addReagentDestinationViaOffset(reagent, x - xCoord, y - yCoord, z - zCoord)); } - public boolean removeReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset) - { - if (this.reagentTargetList.containsKey(reagent)) - { + public boolean removeReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset) { + if (this.reagentTargetList.containsKey(reagent)) { List coords = this.reagentTargetList.get(reagent); - if (coords != null) - { + if (coords != null) { Int3 reference = new Int3(xOffset, yOffset, zOffset); return coords.remove(reference); @@ -508,16 +457,13 @@ public class TEReagentConduit extends TileSegmentedReagentHandler return false; } - public boolean removeReagentDestinationViaActual(Reagent reagent, int x, int y, int z) - { + public boolean removeReagentDestinationViaActual(Reagent reagent, int x, int y, int z) { return this.removeReagentDestinationViaOffset(reagent, x - xCoord, y - yCoord, z - zCoord); } @Override - public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) - { - if (doFill && !worldObj.isRemote) - { + public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) { + if (doFill && !worldObj.isRemote) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); hasChanged = 2; } @@ -526,14 +472,12 @@ public class TEReagentConduit extends TileSegmentedReagentHandler } @Override - public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) - { - if (doDrain && !worldObj.isRemote) - { + public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) { + if (doDrain && !worldObj.isRemote) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); hasChanged = 2; } return super.drain(from, resource, doDrain); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESchematicSaver.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESchematicSaver.java index b1aa3e94..81798cc4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESchematicSaver.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESchematicSaver.java @@ -5,21 +5,18 @@ import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.common.demonVillage.BuildingSchematic; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; - import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; -public class TESchematicSaver extends TileEntity -{ +public class TESchematicSaver extends TileEntity { public Block targetBlock = ModBlocks.largeBloodStoneBrick; - public void rightClickBlock(EntityPlayer player, int side) - { + public void rightClickBlock(EntityPlayer player, int side) { BuildingSchematic schematic = new BuildingSchematic(); int negX = this.getNegXLimit(); @@ -29,20 +26,15 @@ public class TESchematicSaver extends TileEntity int posY = this.getPosYLimit(); int posZ = this.getPosZLimit(); - for (int i = -negX + 1; i <= posX - 1; i++) - { - for (int j = -negY + 1; j <= posY - 1; j++) - { - for (int k = -negZ + 1; k <= posZ - 1; k++) - { + for (int i = -negX + 1; i <= posX - 1; i++) { + for (int j = -negY + 1; j <= posY - 1; j++) { + for (int k = -negZ + 1; k <= posZ - 1; k++) { int meta = worldObj.getBlockMetadata(xCoord + i, yCoord + j, zCoord + k); Block block = worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k); - if (!block.isAir(worldObj, xCoord + i, yCoord + j, zCoord + k)) - { + if (!block.isAir(worldObj, xCoord + i, yCoord + j, zCoord + k)) { schematic.addBlockWithMeta(block, meta, i, j, k); } - } } @@ -54,24 +46,19 @@ public class TESchematicSaver extends TileEntity String json = gson.toJson(schematic); AlchemicalWizardry.logger.info("Here, too!"); Writer writer; - try - { + try { writer = new FileWriter("config/BloodMagic/schematics/" + new Random().nextInt() + ".json"); writer.write(json); writer.close(); - } catch (IOException e) - { + } catch (IOException e) { e.printStackTrace(); } } - public int getPosYLimit() - { + public int getPosYLimit() { int i = 1; - while (i < 100) - { - if (targetBlock == (worldObj.getBlock(xCoord, yCoord + i, zCoord))) - { + while (i < 100) { + if (targetBlock == (worldObj.getBlock(xCoord, yCoord + i, zCoord))) { return i; } @@ -80,13 +67,10 @@ public class TESchematicSaver extends TileEntity return 1; } - public int getNegYLimit() - { + public int getNegYLimit() { int i = 1; - while (i < 100) - { - if (targetBlock == (worldObj.getBlock(xCoord, yCoord - i, zCoord))) - { + while (i < 100) { + if (targetBlock == (worldObj.getBlock(xCoord, yCoord - i, zCoord))) { return i; } @@ -95,13 +79,10 @@ public class TESchematicSaver extends TileEntity return 1; } - public int getPosXLimit() - { + public int getPosXLimit() { int i = 1; - while (i < 100) - { - if (targetBlock == (worldObj.getBlock(xCoord + i, yCoord, zCoord))) - { + while (i < 100) { + if (targetBlock == (worldObj.getBlock(xCoord + i, yCoord, zCoord))) { return i; } @@ -110,13 +91,10 @@ public class TESchematicSaver extends TileEntity return 1; } - public int getNegXLimit() - { + public int getNegXLimit() { int i = 1; - while (i < 100) - { - if (targetBlock == (worldObj.getBlock(xCoord - i, yCoord, zCoord))) - { + while (i < 100) { + if (targetBlock == (worldObj.getBlock(xCoord - i, yCoord, zCoord))) { return i; } @@ -125,13 +103,10 @@ public class TESchematicSaver extends TileEntity return 1; } - public int getPosZLimit() - { + public int getPosZLimit() { int i = 1; - while (i < 100) - { - if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord + i))) - { + while (i < 100) { + if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord + i))) { return i; } @@ -140,13 +115,10 @@ public class TESchematicSaver extends TileEntity return 1; } - public int getNegZLimit() - { + public int getNegZLimit() { int i = 1; - while (i < 100) - { - if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord - i))) - { + while (i < 100) { + if (targetBlock == (worldObj.getBlock(xCoord, yCoord, zCoord - i))) { return i; } @@ -154,4 +126,4 @@ public class TESchematicSaver extends TileEntity } return 1; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESocket.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESocket.java index faa72994..3fd149c4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESocket.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESocket.java @@ -1,23 +1,21 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; -import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; -import WayofTime.alchemicalWizardry.common.NewPacketHandler; -public class TESocket extends TEInventory -{ - public static final int sizeInv = 1; - +public class TESocket extends TEInventory { + public static final int sizeInv = 1; + private int resultID; private int resultDamage; private boolean isActive; - public TESocket() - { + public TESocket() { super(sizeInv); resultID = 0; resultDamage = 0; @@ -25,8 +23,7 @@ public class TESocket extends TEInventory } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); resultID = par1NBTTagCompound.getInteger("resultID"); @@ -35,8 +32,7 @@ public class TESocket extends TEInventory } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("resultID", resultID); @@ -45,77 +41,62 @@ public class TESocket extends TEInventory } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TESocket"; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } - //Logic for the actual block is under here + // Logic for the actual block is under here @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); } - public void setActive() - { + public void setActive() { isActive = false; } - public boolean isActive() - { + public boolean isActive() { return isActive; } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return NewPacketHandler.getPacket(this); } - public void handlePacketData(int[] intData) - { - if (intData == null) - { + public void handlePacketData(int[] intData) { + 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; } } } } - 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; @@ -126,8 +107,7 @@ public class TESocket extends TEInventory } @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return itemstack.getItem() instanceof ArmourUpgrade; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralBlock.java index 22e637c3..b4d656b1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralBlock.java @@ -5,59 +5,50 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class TESpectralBlock extends TileEntity -{ +public class TESpectralBlock extends TileEntity { private int ticksRemaining; - public TESpectralBlock() - { + public TESpectralBlock() { ticksRemaining = 0; } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); ticksRemaining = par1NBTTagCompound.getInteger("ticksRemaining"); } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("ticksRemaining", ticksRemaining); } @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); -// if (worldObj.isRemote) + // if (worldObj.isRemote) { -// return; + // return; } this.ticksRemaining--; - if (this.ticksRemaining <= 0) - { + if (this.ticksRemaining <= 0) { worldObj.setBlockToAir(xCoord, yCoord, zCoord); } } - public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration) - { - if (!world.isAirBlock(x, y, z)) - { + public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration) { + if (!world.isAirBlock(x, y, z)) { return false; } world.setBlock(x, y, z, ModBlocks.spectralBlock); TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TESpectralBlock) - { + if (tile instanceof TESpectralBlock) { ((TESpectralBlock) tile).setDuration(duration); return true; } @@ -65,15 +56,12 @@ public class TESpectralBlock extends TileEntity return false; } - public void setDuration(int dur) - { + public void setDuration(int dur) { this.ticksRemaining = dur; } - public void resetDuration(int dur) - { - if (this.ticksRemaining < dur) - { + public void resetDuration(int dur) { + if (this.ticksRemaining < dur) { this.ticksRemaining = dur; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralContainer.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralContainer.java index 1ee0076c..2943948e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralContainer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpectralContainer.java @@ -11,32 +11,27 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.IFluidBlock; -public class TESpectralContainer extends TileEntity -{ +public class TESpectralContainer extends TileEntity { private ItemStack[] inv; private int ticksRemaining; - public TESpectralContainer() - { + public TESpectralContainer() { this.inv = new ItemStack[1]; ticksRemaining = 0; } @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); } } @@ -45,15 +40,12 @@ public class TESpectralContainer extends TileEntity } @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); @@ -66,36 +58,30 @@ public class TESpectralContainer extends TileEntity } @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); this.ticksRemaining--; - if (this.ticksRemaining <= 0) - { + if (this.ticksRemaining <= 0) { this.returnContainedBlock(); } } - public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration) - { + public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration) { Block block = world.getBlock(x, y, z); - if (block == null) - { + if (block == null) { return false; } - if (world.getTileEntity(x, y, z) == null || block instanceof IFluidBlock) - { + if (world.getTileEntity(x, y, z) == null || block instanceof IFluidBlock) { int meta = world.getBlockMetadata(x, y, z); ItemStack item = new ItemStack(block, 1, meta); world.setBlock(x, y, z, ModBlocks.blockSpectralContainer); TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TESpectralContainer) - { + if (tile instanceof TESpectralContainer) { ((TESpectralContainer) tile).setContainedItem(item); ((TESpectralContainer) tile).setDuration(duration); return true; @@ -105,42 +91,33 @@ public class TESpectralContainer extends TileEntity return false; } - public void setDuration(int dur) - { + public void setDuration(int dur) { this.ticksRemaining = dur; } - public void resetDuration(int dur) - { - if (this.ticksRemaining < dur) - { + public void resetDuration(int dur) { + if (this.ticksRemaining < dur) { this.ticksRemaining = dur; } } - public void setContainedItem(ItemStack item) - { + public void setContainedItem(ItemStack item) { this.inv[0] = item; } - public void returnContainedBlock() - { + public void returnContainedBlock() { ItemStack item = this.inv[0]; - if (item != null) - { - if (item.getItem() instanceof ItemBlock) - { + if (item != null) { + if (item.getItem() instanceof ItemBlock) { Block block = ((ItemBlock) item.getItem()).field_150939_a; int meta = item.getItemDamage(); - if (block != null) - { + if (block != null) { this.worldObj.setBlock(xCoord, yCoord, zCoord, block, meta, 6); } } - } else - { + } else { this.worldObj.setBlockToAir(xCoord, yCoord, zCoord); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellBlock.java index 5e38781c..5bdf4157 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellBlock.java @@ -5,15 +5,12 @@ import WayofTime.alchemicalWizardry.api.tile.ISpellTile; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public abstract class TESpellBlock extends TEOrientable implements ISpellTile -{ - @Override - public void modifySpellParadigm(SpellParadigm parad) - { +public abstract class TESpellBlock extends TEOrientable implements ISpellTile { + @Override + public void modifySpellParadigm(SpellParadigm parad) { this.applySpellChange(parad); TileEntity tile = this.getTileAtOutput(); - if (tile instanceof TESpellBlock) - { + if (tile instanceof TESpellBlock) { TESpellBlock outputBlock = (TESpellBlock) tile; outputBlock.modifySpellParadigm(parad); } @@ -21,8 +18,7 @@ public abstract class TESpellBlock extends TEOrientable implements ISpellTile protected abstract void applySpellChange(SpellParadigm parad); - public TESpellBlock getTileAtOutput() - { + public TESpellBlock getTileAtOutput() { ForgeDirection output = this.getOutputDirection(); int xOffset = output.offsetX; int yOffset = output.offsetY; @@ -30,22 +26,19 @@ public abstract class TESpellBlock extends TEOrientable implements ISpellTile TileEntity tile = worldObj.getTileEntity(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset); - if (tile instanceof TESpellBlock && ((TESpellBlock) tile).canInputRecieveOutput(output)) - { + if (tile instanceof TESpellBlock && ((TESpellBlock) tile).canInputRecieveOutput(output)) { return (TESpellBlock) tile; } return null; } - public boolean canInputRecieve() - { + public boolean canInputRecieve() { return true; } @Override - public boolean canInputRecieveOutput(ForgeDirection output) - { + public boolean canInputRecieveOutput(ForgeDirection output) { return this.canInputRecieve() && this.getInputDirection().getOpposite() == output; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEffectBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEffectBlock.java index 28f3f504..79064432 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEffectBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEffectBlock.java @@ -4,19 +4,15 @@ import WayofTime.alchemicalWizardry.api.spell.ComplexSpellType; import WayofTime.alchemicalWizardry.api.spell.SpellEffect; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; -public class TESpellEffectBlock extends TESpellBlock -{ +public class TESpellEffectBlock extends TESpellBlock { @Override - protected void applySpellChange(SpellParadigm parad) - { + protected void applySpellChange(SpellParadigm parad) { parad.addBufferedEffect(this.getSpellEffect()); } - public SpellEffect getSpellEffect() - { + public SpellEffect getSpellEffect() { int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - switch (meta) - { + switch (meta) { case 0: return new SpellEffect(ComplexSpellType.FIRE); case 1: @@ -30,10 +26,8 @@ public class TESpellEffectBlock extends TESpellBlock } @Override - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { + public String getResourceLocationForMeta(int meta) { + switch (meta) { case 0: return "alchemicalwizardry:textures/models/SpellEffectFire.png"; case 1: diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEnhancementBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEnhancementBlock.java index 2682d67b..2e7ec04e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEnhancementBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellEnhancementBlock.java @@ -6,15 +6,12 @@ import WayofTime.alchemicalWizardry.api.spell.SpellEnhancementPotency; import WayofTime.alchemicalWizardry.api.spell.SpellEnhancementPower; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; -public class TESpellEnhancementBlock extends TESpellBlock -{ +public class TESpellEnhancementBlock extends TESpellBlock { @Override - protected void applySpellChange(SpellParadigm parad) - { + protected void applySpellChange(SpellParadigm parad) { int i = -1; - switch (this.enhancementType()) - { + switch (this.enhancementType()) { case 0: i = parad.getBufferedEffectPower(); break; @@ -26,20 +23,16 @@ public class TESpellEnhancementBlock extends TESpellBlock break; } - if (i != -1 && i < this.getLimit()) - { + if (i != -1 && i < this.getLimit()) { parad.applyEnhancement(getSpellEnhancement()); - } else if (i < this.getLimit()) - { + } else if (i < this.getLimit()) { this.doBadStuff(); } } - public SpellEnhancement getSpellEnhancement() - { + public SpellEnhancement getSpellEnhancement() { int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - switch (meta) - { + switch (meta) { case 0: case 1: case 2: @@ -62,11 +55,9 @@ public class TESpellEnhancementBlock extends TESpellBlock return new SpellEnhancementCost(); } - public int getLimit() - { + public int getLimit() { int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - switch (meta) - { + switch (meta) { case 0: return 1; case 1: @@ -101,11 +92,10 @@ public class TESpellEnhancementBlock extends TESpellBlock return 0; } - public int enhancementType() //0 is power, 1 is cost, 2 is potency - { + public int enhancementType() // 0 is power, 1 is cost, 2 is potency + { int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - switch (meta) - { + switch (meta) { case 0: case 1: case 2: @@ -128,16 +118,11 @@ public class TESpellEnhancementBlock extends TESpellBlock return 1; } - public void doBadStuff() - { - - } + public void doBadStuff() {} @Override - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { + public String getResourceLocationForMeta(int meta) { + switch (meta) { case 0: return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png"; case 1: @@ -145,13 +130,13 @@ public class TESpellEnhancementBlock extends TESpellBlock case 2: return "alchemicalwizardry:textures/models/SpellEnhancementPower3.png"; case 3: - return "alchemicalwizardry:textures/models/SpellEnhancementPower4.png"; + return "alchemicalwizardry:textures/models/SpellEnhancementPower4.png"; case 5: return "alchemicalwizardry:textures/models/SpellEnhancementCost1.png"; case 6: return "alchemicalwizardry:textures/models/SpellEnhancementCost2.png"; case 7: - return "alchemicalwizardry:textures/models/SpellEnhancementCost3.png"; + return "alchemicalwizardry:textures/models/SpellEnhancementCost3.png"; case 8: return "alchemicalwizardry:textures/models/SpellEnhancementCost4.png"; case 10: @@ -162,7 +147,6 @@ public class TESpellEnhancementBlock extends TESpellBlock return "alchemicalwizardry:textures/models/SpellEnhancementPotency3.png"; case 13: return "alchemicalwizardry:textures/models/SpellEnhancementPotency4.png"; - } return "alchemicalwizardry:textures/models/SpellEnhancementPower1.png"; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellModifierBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellModifierBlock.java index 06787e48..94951752 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellModifierBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellModifierBlock.java @@ -3,19 +3,15 @@ package WayofTime.alchemicalWizardry.common.tileEntity; import WayofTime.alchemicalWizardry.api.spell.ComplexSpellModifier; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; -public class TESpellModifierBlock extends TESpellBlock -{ +public class TESpellModifierBlock extends TESpellBlock { @Override - protected void applySpellChange(SpellParadigm parad) - { + protected void applySpellChange(SpellParadigm parad) { parad.modifyBufferedEffect(this.getSpellModifier()); } - public ComplexSpellModifier getSpellModifier() - { + public ComplexSpellModifier getSpellModifier() { int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - switch (meta) - { + switch (meta) { case 0: return ComplexSpellModifier.DEFAULT; case 1: @@ -29,10 +25,8 @@ public class TESpellModifierBlock extends TESpellBlock } @Override - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { + public String getResourceLocationForMeta(int meta) { + switch (meta) { case 0: return "alchemicalwizardry:textures/models/SpellModifierDefault.png"; case 1: diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java index 21f12faa..961bbbe3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java @@ -1,23 +1,20 @@ package WayofTime.alchemicalWizardry.common.tileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.api.tile.ISpellParadigmTile; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigmTile -{ - public SpellParadigm getSpellParadigm() - { +public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigmTile { + public SpellParadigm getSpellParadigm() { int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - switch (meta) - { + switch (meta) { case 0: return new SpellParadigmProjectile(); case 1: @@ -31,19 +28,14 @@ public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigm } @Override - protected void applySpellChange(SpellParadigm parad) - { + protected void applySpellChange(SpellParadigm parad) {} - } - - public boolean canInputRecieve() - { + public boolean canInputRecieve() { return false; } @Override - public void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack) - { + public void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack) { SpellParadigm parad = this.getSpellParadigm(); this.modifySpellParadigm(parad); parad.applyAllSpellEffects(); @@ -51,10 +43,8 @@ public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigm } @Override - public String getResourceLocationForMeta(int meta) - { - switch (meta) - { + public String getResourceLocationForMeta(int meta) { + switch (meta) { case 0: return "alchemicalwizardry:textures/models/SpellParadigmProjectile.png"; case 1: @@ -68,14 +58,10 @@ public class TESpellParadigmBlock extends TESpellBlock implements ISpellParadigm } @Override - public void setInputDirection(ForgeDirection direction) - { - - } + public void setInputDirection(ForgeDirection direction) {} @Override - public ForgeDirection getInputDirection() - { + public ForgeDirection getInputDirection() { return ForgeDirection.UNKNOWN; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java index 60c2de4a..c2254f03 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java @@ -1,9 +1,13 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; +import WayofTime.alchemicalWizardry.common.block.BlockTeleposer; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.items.TelepositionFocus; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import java.util.Iterator; import java.util.List; - -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,24 +15,17 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.NewPacketHandler; -import WayofTime.alchemicalWizardry.common.block.BlockTeleposer; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.items.TelepositionFocus; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -public class TETeleposer extends TEInventory -{ - public static final int sizeInv = 1; - +public class TETeleposer extends TEInventory { + public static final int sizeInv = 1; + private int resultID; private int resultDamage; private int previousInput; private boolean isActive; - public TETeleposer() - { + public TETeleposer() { super(sizeInv); resultID = 0; resultDamage = 0; @@ -37,8 +34,7 @@ public class TETeleposer extends TEInventory } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); resultID = par1NBTTagCompound.getInteger("resultID"); @@ -48,8 +44,7 @@ public class TETeleposer extends TEInventory } @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("resultID", resultID); @@ -59,135 +54,163 @@ public class TETeleposer extends TEInventory } @Override - public String getInventoryName() - { + public String getInventoryName() { return "TETeleposer"; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } - //Logic for the actual block is under here + // Logic for the actual block is under here @Override - public void updateEntity() - { + public void updateEntity() { super.updateEntity(); - if (worldObj.isRemote) - { + if (worldObj.isRemote) { return; } int currentInput = worldObj.getBlockPowerInput(xCoord, yCoord, zCoord); - if (previousInput == 0 && currentInput != 0) - { + if (previousInput == 0 && currentInput != 0) { ItemStack focus = this.getStackInSlot(0); - if (focus != null && focus.getItem() instanceof TelepositionFocus) - { + if (focus != null && focus.getItem() instanceof TelepositionFocus) { TelepositionFocus focusItem = (TelepositionFocus) (focus.getItem()); int xf = focusItem.xCoord(focus); int yf = focusItem.yCoord(focus); int zf = focusItem.zCoord(focus); World worldF = focusItem.getWorld(focus); - int damage = (int) (0.5f * Math.sqrt((xCoord - xf) * (xCoord - xf) + (yCoord - yf + 1) * (yCoord - yf + 1) + (zCoord - zf) * (zCoord - zf))); + int damage = (int) (0.5f + * Math.sqrt((xCoord - xf) * (xCoord - xf) + + (yCoord - yf + 1) * (yCoord - yf + 1) + + (zCoord - zf) * (zCoord - zf))); int focusLevel = focusItem.getFocusLevel(); int transportCount = 0; int entityCount = 0; - if (worldF != null && worldF.getTileEntity(xf, yf, zf) instanceof TETeleposer && !worldF.getTileEntity(xf, yf, zf).equals(this)) - { - //Prime the teleportation + if (worldF != null + && worldF.getTileEntity(xf, yf, zf) instanceof TETeleposer + && !worldF.getTileEntity(xf, yf, zf).equals(this)) { + // Prime the teleportation int d0 = focusLevel - 1; - AxisAlignedBB axisalignedbb1 = AxisAlignedBB.getBoundingBox((double) this.xCoord-0.5, (double) this.yCoord + d0 + 0.5, (double) this.zCoord-0.5, (double) (this.xCoord + 0.5), (double) (this.yCoord + 1.5 + d0), (double) (this.zCoord + 0.5)).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb1 = AxisAlignedBB.getBoundingBox( + (double) this.xCoord - 0.5, + (double) this.yCoord + d0 + 0.5, + (double) this.zCoord - 0.5, + (double) (this.xCoord + 0.5), + (double) (this.yCoord + 1.5 + d0), + (double) (this.zCoord + 0.5)) + .expand(d0, d0, d0); axisalignedbb1.maxY = Math.min((double) this.worldObj.getHeight(), this.yCoord + 2 + d0 + d0); List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb1); Iterator iterator1 = list1.iterator(); EntityLivingBase entityplayer1; - while (iterator1.hasNext()) - { + while (iterator1.hasNext()) { entityplayer1 = (EntityLivingBase) iterator1.next(); entityCount++; } - AxisAlignedBB axisalignedbb2 = AxisAlignedBB.getBoundingBox(xf-0.5, yf + d0 + 0.5, zf-0.5, xf + 0.5, yf + 1.5 + d0, zf+0.5).expand(d0, d0, d0); + AxisAlignedBB axisalignedbb2 = AxisAlignedBB.getBoundingBox( + xf - 0.5, yf + d0 + 0.5, zf - 0.5, xf + 0.5, yf + 1.5 + d0, zf + 0.5) + .expand(d0, d0, d0); List list2 = worldF.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb2); Iterator iterator2 = list2.iterator(); EntityLivingBase entityplayer2; - while (iterator2.hasNext()) - { + while (iterator2.hasNext()) { entityplayer2 = (EntityLivingBase) iterator2.next(); entityCount++; } - if (EnergyItems.canSyphonInContainer(focus, damage * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) + damage * entityCount)) - { + if (EnergyItems.canSyphonInContainer( + focus, + damage * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) + + damage * entityCount)) { for (int k = 0; k <= (focusLevel * 2 - 2); k++) - for (int i = -(focusLevel - 1); i <= (focusLevel - 1); i++) - { - for (int j = -(focusLevel - 1); j <= (focusLevel - 1); j++) - { + for (int i = -(focusLevel - 1); i <= (focusLevel - 1); i++) { + for (int j = -(focusLevel - 1); j <= (focusLevel - 1); j++) { { - if (BlockTeleposer.swapBlocks(this, worldObj, worldF, xCoord + i, yCoord + 1 + k, zCoord + j, xf + i, yf + 1 + k, zf + j)) - { + if (BlockTeleposer.swapBlocks( + this, + worldObj, + worldF, + xCoord + i, + yCoord + 1 + k, + zCoord + j, + xf + i, + yf + 1 + k, + zf + j)) { transportCount++; } } } } - if (!worldF.equals(worldObj)) - { + if (!worldF.equals(worldObj)) { entityCount = 0; } - - //Teleport with minimum cost of 2000 LP. - int cost = Math.max(damage * transportCount + damage * entityCount, 2000); - SoulNetworkHandler.syphonFromNetwork(focus, cost); - - if (worldF.equals(worldObj)) - { + + // Teleport with minimum cost of 2000 LP. + int cost = Math.max(damage * transportCount + damage * entityCount, 2000); + SoulNetworkHandler.syphonFromNetwork(focus, cost); + + if (worldF.equals(worldObj)) { iterator1 = list1.iterator(); iterator2 = list2.iterator(); - while (iterator1.hasNext()) - { + while (iterator1.hasNext()) { entityplayer1 = (EntityLivingBase) iterator1.next(); entityplayer1.worldObj = worldF; - entityplayer1.setPositionAndUpdate(entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf); + entityplayer1.setPositionAndUpdate( + entityplayer1.posX - this.xCoord + xf, + entityplayer1.posY - this.yCoord + yf, + entityplayer1.posZ - this.zCoord + zf); } - while (iterator2.hasNext()) - { + while (iterator2.hasNext()) { entityplayer2 = (EntityLivingBase) iterator2.next(); entityplayer2.worldObj = worldF; - entityplayer2.setPositionAndUpdate(entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf); + entityplayer2.setPositionAndUpdate( + entityplayer2.posX + this.xCoord - xf, + entityplayer2.posY + this.yCoord - yf, + entityplayer2.posZ + this.zCoord - zf); } - }else - { - iterator1 = list1.iterator(); + } else { + iterator1 = list1.iterator(); iterator2 = list2.iterator(); - while (iterator1.hasNext()) - { + while (iterator1.hasNext()) { entityplayer1 = (EntityLivingBase) iterator1.next(); - SpellHelper.teleportEntityToDim(worldObj, worldF.provider.dimensionId, entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf, entityplayer1); -// entityplayer1.worldObj = worldF; -// entityplayer1.setPositionAndUpdate(entityplayer1.posX - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - this.zCoord + zf); + SpellHelper.teleportEntityToDim( + worldObj, + worldF.provider.dimensionId, + entityplayer1.posX - this.xCoord + xf, + entityplayer1.posY - this.yCoord + yf, + entityplayer1.posZ - this.zCoord + zf, + entityplayer1); + // entityplayer1.worldObj = worldF; + // entityplayer1.setPositionAndUpdate(entityplayer1.posX + // - this.xCoord + xf, entityplayer1.posY - this.yCoord + yf, entityplayer1.posZ - + // this.zCoord + zf); } - while (iterator2.hasNext()) - { + while (iterator2.hasNext()) { entityplayer2 = (EntityLivingBase) iterator2.next(); - SpellHelper.teleportEntityToDim(worldF, worldObj.provider.dimensionId, entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf, entityplayer2); -// entityplayer2.worldObj = worldF; -// entityplayer2.setPositionAndUpdate(entityplayer2.posX + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + this.zCoord - zf); + SpellHelper.teleportEntityToDim( + worldF, + worldObj.provider.dimensionId, + entityplayer2.posX + this.xCoord - xf, + entityplayer2.posY + this.yCoord - yf, + entityplayer2.posZ + this.zCoord - zf, + entityplayer2); + // entityplayer2.worldObj = worldF; + // entityplayer2.setPositionAndUpdate(entityplayer2.posX + // + this.xCoord - xf, entityplayer2.posY + this.yCoord - yf, entityplayer2.posZ + + // this.zCoord - zf); } } } @@ -198,59 +221,47 @@ public class TETeleposer extends TEInventory previousInput = currentInput; } - public void setActive() - { + public void setActive() { isActive = false; } - public boolean isActive() - { + public boolean isActive() { return isActive; } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { return NewPacketHandler.getPacket(this); } - public void handlePacketData(int[] intData) - { - if (intData == null) - { + public void handlePacketData(int[] intData) { + 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; } } } } - 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; @@ -261,8 +272,7 @@ public class TETeleposer extends TEInventory } @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return itemstack.getItem() instanceof TelepositionFocus; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java index 101950d1..3a95d79f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java @@ -1,12 +1,5 @@ package WayofTime.alchemicalWizardry.common.tileEntity; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.oredict.OreDictionary; import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe; @@ -21,24 +14,28 @@ import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry; import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst; import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.oredict.OreDictionary; + +public class TEWritingTable extends TEInventory implements ISidedInventory { + public static final int sizeInv = 7; -public class TEWritingTable extends TEInventory implements ISidedInventory -{ - public static final int sizeInv = 7; - private int progress; private int amountUsed; private int accelerationTime; - public TEWritingTable() - { + public TEWritingTable() { super(sizeInv); } @Override - public void readFromNBT(NBTTagCompound tagCompound) - { + public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); progress = tagCompound.getInteger("progress"); @@ -48,10 +45,9 @@ public class TEWritingTable extends TEInventory implements ISidedInventory } @Override - public void writeToNBT(NBTTagCompound tagCompound) - { + public void writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); - + tagCompound.setInteger("progress", progress); tagCompound.setInteger("amountUsed", amountUsed); @@ -59,68 +55,54 @@ public class TEWritingTable extends TEInventory implements ISidedInventory } @Override - public String getInventoryName() - { + public String getInventoryName() { return "aw.TEWritingTable"; } @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) - { - switch(i) - { - case 0: - if(itemstack != null) - { - return itemstack.getItem() instanceof IBloodOrb; - } - } + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + switch (i) { + case 0: + if (itemstack != null) { + return itemstack.getItem() instanceof IBloodOrb; + } + } return i != 6; } @Override - public net.minecraft.network.Packet getDescriptionPacket() - { + public net.minecraft.network.Packet getDescriptionPacket() { return NewPacketHandler.getPacket(this); } - public void handlePacketData(int[] intData) - { - if (intData == null) - { + public void handlePacketData(int[] intData) { + if (intData == null) { return; } - if (intData.length == 3 * 7) - { - for (int i = 0; i < 7; 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 * 7) { + for (int i = 0; i < 7; 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; } } } } - public int[] buildIntDataList() - { + public int[] buildIntDataList() { int[] sortList = new int[7 * 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; @@ -130,46 +112,39 @@ public class TEWritingTable extends TEInventory implements ISidedInventory return sortList; } - public ItemStack getResultingItemStack() - { + public ItemStack getResultingItemStack() { ItemStack[] composedRecipe = new ItemStack[5]; - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { composedRecipe[i] = inv[i + 1]; } return AlchemyRecipeRegistry.getResult(composedRecipe, inv[0]); } - public boolean isRecipeValid() - { + public boolean isRecipeValid() { return (getResultingItemStack() != null); } - public int getAmountNeeded(ItemStack bloodOrb) - { + public int getAmountNeeded(ItemStack bloodOrb) { ItemStack[] composedRecipe = new ItemStack[5]; - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { composedRecipe[i] = inv[i + 1]; } return AlchemyRecipeRegistry.getAmountNeeded(composedRecipe, bloodOrb); } - public boolean containsPotionFlask() - { + public boolean containsPotionFlask() { return getPotionFlaskPosition() != -1; } - public int getPotionFlaskPosition() - { - for (int i = 1; i <= 5; i++) - { - if (inv[i] != null && !(inv[i].getItem() instanceof ItemBlock) && inv[i].getItem() == ModItems.alchemyFlask) - { + public int getPotionFlaskPosition() { + for (int i = 1; i <= 5; i++) { + if (inv[i] != null + && !(inv[i].getItem() instanceof ItemBlock) + && inv[i].getItem() == ModItems.alchemyFlask) { return i; } } @@ -177,23 +152,17 @@ public class TEWritingTable extends TEInventory implements ISidedInventory return -1; } - public boolean containsCombinationCatalyst() - { - if (getCombinationCatalystPosition() != -1) - { + public boolean containsCombinationCatalyst() { + if (getCombinationCatalystPosition() != -1) { return true; - } else - { + } else { return false; } } - public int getCombinationCatalystPosition() - { - for (int i = 1; i <= 5; i++) - { - if (inv[i] != null && inv[i].getItem() instanceof ICombinationalCatalyst) - { + public int getCombinationCatalystPosition() { + for (int i = 1; i <= 5; i++) { + if (inv[i] != null && inv[i].getItem() instanceof ICombinationalCatalyst) { return i; } } @@ -201,41 +170,33 @@ public class TEWritingTable extends TEInventory implements ISidedInventory return -1; } - public boolean containsRegisteredPotionIngredient() - { + public boolean containsRegisteredPotionIngredient() { return getRegisteredPotionIngredientPosition() != -1; } - public int getRegisteredPotionIngredientPosition() - { + public int getRegisteredPotionIngredientPosition() { ItemStack[] composedRecipe = new ItemStack[5]; - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { composedRecipe[i] = inv[i + 1]; } int location = AlchemicalPotionCreationHandler.getRegisteredPotionIngredientPosition(composedRecipe); - if (location != -1) - { + if (location != -1) { return location + 1; } return -1; } - public boolean containsCatalyst() - { + public boolean containsCatalyst() { return getCatalystPosition() != -1; } - public int getCatalystPosition() - { - for (int i = 0; i < 5; i++) - { - if (inv[i + 1] != null && inv[i + 1].getItem() instanceof ICatalyst) - { + public int getCatalystPosition() { + for (int i = 0; i < 5; i++) { + if (inv[i + 1] != null && inv[i + 1].getItem() instanceof ICatalyst) { return i + 1; } } @@ -243,17 +204,13 @@ public class TEWritingTable extends TEInventory implements ISidedInventory return -1; } - public boolean containsBindingAgent() - { + public boolean containsBindingAgent() { return getBindingAgentPosition() != -1; } - public int getBindingAgentPosition() - { - for (int i = 0; i < 5; i++) - { - if (inv[i + 1] != null && inv[i + 1].getItem() instanceof IBindingAgent) - { + public int getBindingAgentPosition() { + for (int i = 0; i < 5; i++) { + if (inv[i + 1] != null && inv[i + 1].getItem() instanceof IBindingAgent) { return i + 1; } } @@ -261,17 +218,13 @@ public class TEWritingTable extends TEInventory implements ISidedInventory return -1; } - public boolean containsFillingAgent() - { + public boolean containsFillingAgent() { return getFillingAgentPosition() != -1; } - public int getFillingAgentPosition() - { - for (int i = 0; i < 5; i++) - { - if (inv[i + 1] != null && inv[i + 1].getItem() instanceof IFillingAgent) - { + public int getFillingAgentPosition() { + for (int i = 0; i < 5; i++) { + if (inv[i + 1] != null && inv[i + 1].getItem() instanceof IFillingAgent) { return i + 1; } } @@ -279,17 +232,13 @@ public class TEWritingTable extends TEInventory implements ISidedInventory return -1; } - public boolean containsBlankSlate() - { + public boolean containsBlankSlate() { return getBlankSlatePosition() != -1; } - public int getBlankSlatePosition() - { - for (int i = 0; i < 5; i++) - { - if (inv[i + 1] != null && inv[i + 1].getItem() == ModItems.blankSlate) - { + public int getBlankSlatePosition() { + for (int i = 0; i < 5; i++) { + if (inv[i + 1] != null && inv[i + 1].getItem() == ModItems.blankSlate) { return i + 1; } } @@ -298,45 +247,45 @@ public class TEWritingTable extends TEInventory implements ISidedInventory } @Override - public void updateEntity() - { + public void updateEntity() { int progressNeeded = 100; long worldTime = worldObj.getWorldTime(); - if (worldObj.isRemote) - { + if (worldObj.isRemote) { return; } - if (accelerationTime > 0) - { + if (accelerationTime > 0) { accelerationTime--; } - if (containsPotionFlask() && containsRegisteredPotionIngredient()) - { - if (containsCatalyst()) - { - if (getStackInSlot(6) == null) - { + if (containsPotionFlask() && containsRegisteredPotionIngredient()) { + if (containsCatalyst()) { + if (getStackInSlot(6) == null) { progress++; - 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 >= progressNeeded) - { + if (progress >= progressNeeded) { ItemStack flaskStack = inv[this.getPotionFlaskPosition()]; ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()]; ItemStack catalystStack = inv[this.getCatalystPosition()]; - if (flaskStack == null || ingredientStack == null || catalystStack == null) - { + if (flaskStack == null || ingredientStack == null || catalystStack == null) { progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -347,24 +296,22 @@ public class TEWritingTable extends TEInventory implements ISidedInventory int catalystLevel = ((ICatalyst) catalystStack.getItem()).getCatalystLevel(); boolean isConcentration = ((ICatalyst) catalystStack.getItem()).isConcentration(); - if (potionID == -1 || catalystLevel < 0) - { + if (potionID == -1 || catalystLevel < 0) { progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } return; } - if (isConcentration) - { - ((AlchemyFlask) flaskStack.getItem()).setConcentrationOfPotion(flaskStack, potionID, catalystLevel); - } else - { - ((AlchemyFlask) flaskStack.getItem()).setDurationFactorOfPotion(flaskStack, potionID, catalystLevel); + if (isConcentration) { + ((AlchemyFlask) flaskStack.getItem()) + .setConcentrationOfPotion(flaskStack, potionID, catalystLevel); + } else { + ((AlchemyFlask) flaskStack.getItem()) + .setDurationFactorOfPotion(flaskStack, potionID, catalystLevel); } this.setInventorySlotContents(6, flaskStack); this.decrStackSize(this.getPotionFlaskPosition(), 1); @@ -372,51 +319,55 @@ public class TEWritingTable extends TEInventory implements ISidedInventory this.decrStackSize(this.getRegisteredPotionIngredientPosition(), 1); progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } } - } else if (containsBindingAgent()) - { - if (getStackInSlot(6) == null) - { + } else if (containsBindingAgent()) { + if (getStackInSlot(6) == null) { progress++; - 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 >= progressNeeded) - { + if (progress >= progressNeeded) { ItemStack flaskStack = inv[this.getPotionFlaskPosition()]; ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()]; ItemStack agentStack = inv[this.getBindingAgentPosition()]; - if (flaskStack == null || ingredientStack == null || agentStack == null) - { + if (flaskStack == null || ingredientStack == null || agentStack == null) { progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } return; } - int potionEffectNumber = ((AlchemyFlask) flaskStack.getItem()).getNumberOfPotionEffects(flaskStack); + int potionEffectNumber = + ((AlchemyFlask) flaskStack.getItem()).getNumberOfPotionEffects(flaskStack); int potionID = AlchemicalPotionCreationHandler.getPotionIDForStack(ingredientStack); - int tickDuration = AlchemicalPotionCreationHandler.getPotionTickDurationForStack(ingredientStack); - float successChance = ((IBindingAgent) agentStack.getItem()).getSuccessRateForPotionNumber(potionEffectNumber); - if (potionID == -1) - { + int tickDuration = + AlchemicalPotionCreationHandler.getPotionTickDurationForStack(ingredientStack); + float successChance = ((IBindingAgent) agentStack.getItem()) + .getSuccessRateForPotionNumber(potionEffectNumber); + if (potionID == -1) { progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -424,11 +375,9 @@ public class TEWritingTable extends TEInventory implements ISidedInventory } ((AlchemyFlask) flaskStack.getItem()).addPotionEffect(flaskStack, potionID, tickDuration); - if (successChance > worldObj.rand.nextFloat()) - { + if (successChance > worldObj.rand.nextFloat()) { this.setInventorySlotContents(6, flaskStack); - } else - { + } else { worldObj.createExplosion(null, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 2, false); } @@ -437,35 +386,38 @@ public class TEWritingTable extends TEInventory implements ISidedInventory this.decrStackSize(this.getRegisteredPotionIngredientPosition(), 1); progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } } } - } else if (this.containsBlankSlate() && this.containsPotionFlask()) - { - if (getStackInSlot(6) == null) - { + } else if (this.containsBlankSlate() && this.containsPotionFlask()) { + if (getStackInSlot(6) == null) { progress++; - 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 >= progressNeeded) - { + if (progress >= progressNeeded) { ItemStack flaskStack = inv[this.getPotionFlaskPosition()]; ItemStack blankSlate = inv[this.getBlankSlatePosition()]; - if (flaskStack == null || blankSlate == null) - { + if (flaskStack == null || blankSlate == null) { progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -477,76 +429,84 @@ public class TEWritingTable extends TEInventory implements ISidedInventory this.decrStackSize(this.getBlankSlatePosition(), 1); progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } } - } else if (this.containsFillingAgent() && this.containsPotionFlask()) - { - if (getStackInSlot(6) == null) - { + } else if (this.containsFillingAgent() && this.containsPotionFlask()) { + if (getStackInSlot(6) == null) { progress++; - 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 >= progressNeeded) - { + if (progress >= progressNeeded) { ItemStack flaskStack = inv[this.getPotionFlaskPosition()]; ItemStack fillingAgent = inv[this.getFillingAgentPosition()]; - if (flaskStack == null || fillingAgent == null) - { + if (flaskStack == null || fillingAgent == null) { progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } return; } int potionEffects = ((AlchemyFlask) flaskStack.getItem()).getNumberOfPotionEffects(flaskStack); - int potionFillAmount = ((IFillingAgent) fillingAgent.getItem()).getFilledAmountForPotionNumber(potionEffects); + int potionFillAmount = + ((IFillingAgent) fillingAgent.getItem()).getFilledAmountForPotionNumber(potionEffects); flaskStack.setItemDamage(Math.max(0, flaskStack.getItemDamage() - potionFillAmount)); this.setInventorySlotContents(6, flaskStack); this.decrStackSize(this.getPotionFlaskPosition(), 1); this.decrStackSize(this.getFillingAgentPosition(), 1); progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } } - } else if (this.containsPotionFlask() && this.containsCombinationCatalyst()) - { - //TODO - if (getStackInSlot(6) == null && CombinedPotionRegistry.hasCombinablePotionEffect(inv[this.getPotionFlaskPosition()])) - { + } else if (this.containsPotionFlask() && this.containsCombinationCatalyst()) { + // TODO + if (getStackInSlot(6) == null + && CombinedPotionRegistry.hasCombinablePotionEffect(inv[this.getPotionFlaskPosition()])) { progress++; - 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 >= progressNeeded) - { + if (progress >= progressNeeded) { ItemStack flaskStack = inv[this.getPotionFlaskPosition()]; ItemStack combinationCatalyst = inv[this.getCombinationCatalystPosition()]; - if (flaskStack == null || combinationCatalyst == null) - { + if (flaskStack == null || combinationCatalyst == null) { progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -554,91 +514,99 @@ public class TEWritingTable extends TEInventory implements ISidedInventory } ItemStack newFlask = CombinedPotionRegistry.applyPotionEffect(flaskStack); - if (newFlask != null) - { + if (newFlask != null) { this.setInventorySlotContents(6, newFlask); this.decrStackSize(this.getPotionFlaskPosition(), 1); this.decrStackSize(this.getCombinationCatalystPosition(), 1); progress = 0; - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } } } - } else - { - if (!isRecipeValid()) - { + } else { + if (!isRecipeValid()) { progress = 0; return; } - if (progress <= 0) - { + if (progress <= 0) { progress = 0; amountUsed = this.getAmountNeeded(getStackInSlot(0)); - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } int acceleration = this.getSpeedIncrease(); - if (getStackInSlot(6) == null) - { - if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(getStackInSlot(0), amountUsed * acceleration)) - { + if (getStackInSlot(6) == null) { + if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer( + getStackInSlot(0), amountUsed * acceleration)) { return; } - 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); } progress += acceleration; - if (progress >= progressNeeded) - { + if (progress >= progressNeeded) { progress = 0; this.setInventorySlotContents(6, getResultingItemStack()); ItemStack[] composedRecipe = new ItemStack[5]; - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { composedRecipe[i] = inv[i + 1]; } this.decrementSlots(this.getRecipeForItems(composedRecipe, inv[0])); - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } - } else if (getStackInSlot(6).getItem() == getResultingItemStack().getItem() && getResultingItemStack().stackSize <= (getStackInSlot(6).getMaxStackSize() - getStackInSlot(6).stackSize)) - { - if (worldTime % 4 == 0) - { - SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + } else if (getStackInSlot(6).getItem() == getResultingItemStack().getItem() + && getResultingItemStack().stackSize + <= (getStackInSlot(6).getMaxStackSize() - getStackInSlot(6).stackSize)) { + if (worldTime % 4 == 0) { + SpellHelper.sendIndexedParticleToAllAround( + worldObj, + xCoord, + yCoord, + zCoord, + 20, + worldObj.provider.dimensionId, + 1, + xCoord, + yCoord, + zCoord); } - if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(getStackInSlot(0), amountUsed * acceleration)) - { + if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer( + getStackInSlot(0), amountUsed * acceleration)) { return; } progress += acceleration; - if (progress >= progressNeeded) - { + if (progress >= progressNeeded) { progress = 0; ItemStack result = getResultingItemStack().copy(); result.stackSize += getStackInSlot(6).stackSize; @@ -646,15 +614,13 @@ public class TEWritingTable extends TEInventory implements ISidedInventory ItemStack[] composedRecipe = new ItemStack[5]; - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { composedRecipe[i] = inv[i + 1]; } this.decrementSlots(this.getRecipeForItems(composedRecipe, inv[0])); - if (worldObj != null) - { + if (worldObj != null) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } @@ -662,30 +628,28 @@ public class TEWritingTable extends TEInventory implements ISidedInventory } } - public void decrementSlots(ItemStack[] recipe) //TODO Fix this. This doesn't work. - { - boolean[] decrementedList = new boolean[]{false, false, false, false, false}; + public void decrementSlots(ItemStack[] recipe) // TODO Fix this. This doesn't work. + { + boolean[] decrementedList = new boolean[] {false, false, false, false, false}; - for (int i = 0; i < (Math.min(recipe.length, 5)); i++) - { + for (int i = 0; i < (Math.min(recipe.length, 5)); i++) { ItemStack decStack = recipe[i]; - if (decStack == null) - { + if (decStack == null) { continue; } - for (int j = 0; j < 5; j++) - { + for (int j = 0; j < 5; j++) { ItemStack testStack = this.getStackInSlot(j + 1); - if (testStack != null && (testStack.isItemEqual(decStack) || (testStack.getItem() == decStack.getItem() && decStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) && !(decrementedList[j])) - { - if (testStack.getItem().hasContainerItem(testStack)) - { + if (testStack != null + && (testStack.isItemEqual(decStack) + || (testStack.getItem() == decStack.getItem() + && decStack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) + && !(decrementedList[j])) { + if (testStack.getItem().hasContainerItem(testStack)) { this.inv[j + 1] = testStack.getItem().getContainerItem(testStack); - } else - { + } else { this.decrStackSize(j + 1, 1); } @@ -696,24 +660,19 @@ public class TEWritingTable extends TEInventory implements ISidedInventory } } - public ItemStack[] getRecipeForItems(ItemStack[] recipe, ItemStack bloodOrb) - { - if (bloodOrb == null) - { + public ItemStack[] getRecipeForItems(ItemStack[] recipe, ItemStack bloodOrb) { + if (bloodOrb == null) { return null; } - if (!(bloodOrb.getItem() instanceof IBloodOrb)) - { + if (!(bloodOrb.getItem() instanceof IBloodOrb)) { return null; } int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel(); - for (AlchemyRecipe ar : AlchemyRecipeRegistry.recipes) - { - if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) - { + for (AlchemyRecipe ar : AlchemyRecipeRegistry.recipes) { + if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) { return ar.getRecipe(); } } @@ -721,43 +680,36 @@ public class TEWritingTable extends TEInventory implements ISidedInventory return null; } - public int getSpeedIncrease() - { + public int getSpeedIncrease() { return accelerationTime > 0 ? 5 : 1; } - public boolean isWorking() - { + public boolean isWorking() { return this.progress > 0; } - public void setAccelerationTime(int accelerationTime) - { + public void setAccelerationTime(int accelerationTime) { this.accelerationTime = accelerationTime; } - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - ForgeDirection dir = ForgeDirection.getOrientation(side); - switch(dir) - { - case DOWN: - return new int[]{6}; - default: - return new int[]{0, 1, 2, 3, 4, 5}; - } - } + @Override + public int[] getAccessibleSlotsFromSide(int side) { + ForgeDirection dir = ForgeDirection.getOrientation(side); + switch (dir) { + case DOWN: + return new int[] {6}; + default: + return new int[] {0, 1, 2, 3, 4, 5}; + } + } - @Override - public boolean canInsertItem(int slot, ItemStack stack, int side) - { - return slot != 6; - } + @Override + public boolean canInsertItem(int slot, ItemStack stack, int side) { + return slot != 6; + } - @Override - public boolean canExtractItem(int slot, ItemStack stack, int side) - { - return slot == 6; - } + @Override + public boolean canExtractItem(int slot, ItemStack stack, int side) { + return slot == 6; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerAltar.java index ebb64d8e..3c4e33f9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerAltar.java @@ -7,18 +7,14 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerAltar extends Container -{ +public class ContainerAltar extends Container { protected TEAltar tileEntity; - public ContainerAltar(InventoryPlayer inventoryPlayer, TEAltar te) - { + public ContainerAltar(InventoryPlayer inventoryPlayer, TEAltar 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 ContainerAltar 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++) - { - addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, - 8 + j * 18, 84 + i * 18)); + 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/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerTeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerTeleposer.java index aa677304..92494571 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerTeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerTeleposer.java @@ -9,76 +9,59 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerTeleposer extends Container -{ +public class ContainerTeleposer extends Container { protected TETeleposer tileEntity; - public ContainerTeleposer(InventoryPlayer inventoryPlayer, TETeleposer te) - { + public ContainerTeleposer(InventoryPlayer inventoryPlayer, TETeleposer te) { tileEntity = te; addSlotToContainer(new SlotTeleposer(te, 0, 80, 15)); bindPlayerInventory(inventoryPlayer); } @Override - public boolean canInteractWith(EntityPlayer player) - { + public boolean canInteractWith(EntityPlayer player) { return tileEntity.isUseableByPlayer(player); } - 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, 39 + i * 18)); } } - for (int i = 0; i < 9; i++) - { + for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 97)); } } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) - { + public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); 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 TelepositionFocus) - { - if (slot <= slots) - { - if (!this.mergeItemStack(stackInSlot, 0, slots, false)) - { + if (stack.getItem() instanceof TelepositionFocus) { + if (slot <= slots) { + if (!this.mergeItemStack(stackInSlot, 0, slots, false)) { return null; } - } - else if (!this.mergeItemStack(stackInSlot, slots, 36 + slots, false)) - { + } else if (!this.mergeItemStack(stackInSlot, slots, 36 + slots, 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; } @@ -88,17 +71,14 @@ public class ContainerTeleposer extends Container return stack; } - private class SlotTeleposer extends Slot - { - public SlotTeleposer(IInventory inventory, int slotIndex, int x, int y) - { + private class SlotTeleposer extends Slot { + public SlotTeleposer(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 itemStack.getItem() instanceof TelepositionFocus; } } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerWritingTable.java index 647f43e7..7ca93669 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/container/ContainerWritingTable.java @@ -8,12 +8,10 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerWritingTable extends Container -{ +public class ContainerWritingTable extends Container { protected TEWritingTable tileEntity; - public ContainerWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable te) - { + public ContainerWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable te) { tileEntity = te; addSlotToContainer(new Slot(tileEntity, 0, 152, 110)); addSlotToContainer(new Slot(tileEntity, 1, 80, 18)); @@ -26,63 +24,48 @@ public class ContainerWritingTable extends Container } @Override - public boolean canInteractWith(EntityPlayer player) - { + public boolean canInteractWith(EntityPlayer player) { return tileEntity.isUseableByPlayer(player); } - 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, 140 + i * 18)); } } - for (int i = 0; i < 9; i++) - { + for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 198)); } } @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 <= 6) - { - if (!this.mergeItemStack(stackInSlot, 7, 43, true)) - { + if (slot <= 6) { + if (!this.mergeItemStack(stackInSlot, 7, 43, true)) { return null; } - } else if (stack.getItem() instanceof IBloodOrb) - { - if (!this.mergeItemStack(stackInSlot, 0, 1, false)) - { + } else if (stack.getItem() instanceof IBloodOrb) { + if (!this.mergeItemStack(stackInSlot, 0, 1, false)) { return null; } - } else if (!this.mergeItemStack(stackInSlot, 1, 6, false)) - { + } else if (!this.mergeItemStack(stackInSlot, 1, 6, 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; } @@ -91,4 +74,4 @@ public class ContainerWritingTable extends Container return stack; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiHandler.java index 135de81b..140f58d2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiHandler.java @@ -1,8 +1,5 @@ package WayofTime.alchemicalWizardry.common.tileEntity.gui; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; import WayofTime.alchemicalWizardry.common.items.sigil.holding.ContainerHolding; import WayofTime.alchemicalWizardry.common.items.sigil.holding.GuiHolding; import WayofTime.alchemicalWizardry.common.items.sigil.holding.InventoryHolding; @@ -11,30 +8,28 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerTeleposer; import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerWritingTable; import cpw.mods.fml.common.network.IGuiHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; -public class GuiHandler implements IGuiHandler -{ - //returns an instance of the Container you made earlier +public class GuiHandler implements IGuiHandler { + // returns an instance of the Container you made earlier @Override - public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) - { + public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity; - switch (id) - { + switch (id) { case 0: tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof TEWritingTable) - { + if (tileEntity instanceof TEWritingTable) { return new ContainerWritingTable(player.inventory, (TEWritingTable) tileEntity); } case 1: tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof TETeleposer) - { + if (tileEntity instanceof TETeleposer) { return new ContainerTeleposer(player.inventory, (TETeleposer) tileEntity); } @@ -45,19 +40,16 @@ public class GuiHandler implements IGuiHandler return null; } - //returns an instance of the Gui you made earlier + // returns an instance of the Gui you made earlier @Override - public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) - { + public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity; - - switch (id) - { + + switch (id) { case 0: tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof TEWritingTable) - { + if (tileEntity instanceof TEWritingTable) { return new GuiWritingTable(player.inventory, (TEWritingTable) tileEntity); } @@ -66,15 +58,13 @@ public class GuiHandler implements IGuiHandler case 1: tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof TETeleposer) - { + if (tileEntity instanceof TETeleposer) { return new GuiTeleposer(player.inventory, (TETeleposer) tileEntity); } break; - - case 2: + case 2: case 3: return new GuiHolding(player, new InventoryHolding(player.getHeldItem())); @@ -82,4 +72,4 @@ public class GuiHandler implements IGuiHandler return null; } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiTeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiTeleposer.java index 050849d6..63c0a346 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiTeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiTeleposer.java @@ -8,28 +8,24 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -public class GuiTeleposer extends GuiContainer -{ - public GuiTeleposer(InventoryPlayer inventoryPlayer, TETeleposer tileEntity) - { +public class GuiTeleposer extends GuiContainer { + public GuiTeleposer(InventoryPlayer inventoryPlayer, TETeleposer tileEntity) { super(new ContainerTeleposer(inventoryPlayer, tileEntity)); 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("Teleposer", 64, 5, 4210752); - //draws "Inventory" or your regional equivalent + // draws "Inventory" or your regional equivalent fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, 29, 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("alchemicalwizardry", "gui/Teleposer.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(test); @@ -37,4 +33,4 @@ public class GuiTeleposer extends GuiContainer int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java index a0c1baba..75922b45 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java @@ -1,38 +1,32 @@ package WayofTime.alchemicalWizardry.common.tileEntity.gui; +import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; +import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerWritingTable; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; -import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerWritingTable; - -public class GuiWritingTable extends GuiContainer -{ - public GuiWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable tileEntity) - { +public class GuiWritingTable extends GuiContainer { + public GuiWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable tileEntity) { super(new ContainerWritingTable(inventoryPlayer, tileEntity)); xSize = 176; ySize = 222; } @Override - protected void drawGuiContainerForegroundLayer(int param1, int param2) - { - //draw text and stuff here - //the parameters for drawString are: string, x, y, color + protected void drawGuiContainerForegroundLayer(int param1, int param2) { + // draw text and stuff here + // the parameters for drawString are: string, x, y, color fontRendererObj.drawString("Alchemic Chemistry Set", 8, 6, 4210752); - //draws "Inventory" or your regional equivalent + // draws "Inventory" or your regional equivalent fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, 130, 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("alchemicalwizardry", "gui/WritingTable.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(test); @@ -40,4 +34,4 @@ public class GuiWritingTable extends GuiContainer int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } -} \ No newline at end of file +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java index 68ae82e1..0b2bf88d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java @@ -2,68 +2,63 @@ package WayofTime.alchemicalWizardry.common.tweaker; import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack; import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStacks; + +import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe; +import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import minetweaker.IUndoableAction; import minetweaker.MineTweakerAPI; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe; -import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; /** * MineTweaker3 Alchemy Recipe Handler by joshie * */ @ZenClass("mods.bloodmagic.Alchemy") -public class Alchemy -{ +public class Alchemy { @ZenMethod public static void addRecipe(IItemStack output, IItemStack[] input, int tier, int lp) { - MineTweakerAPI.apply(new Add(new AlchemyRecipe(toStack(output), (int) (((double) lp) / 100), toStacks(input), tier))); + MineTweakerAPI.apply( + new Add(new AlchemyRecipe(toStack(output), (int) (((double) lp) / 100), toStacks(input), tier))); } - private static class Add implements IUndoableAction - { + private static class Add implements IUndoableAction { private final AlchemyRecipe recipe; - - public Add(AlchemyRecipe recipe) - { + + public Add(AlchemyRecipe recipe) { this.recipe = recipe; } - + @Override - public void apply() - { + public void apply() { AlchemyRecipeRegistry.recipes.add(recipe); } @Override - public boolean canUndo() - { + public boolean canUndo() { return AlchemyRecipeRegistry.recipes != null; } @Override - public void undo() - { + public void undo() { AlchemyRecipeRegistry.recipes.remove(recipe); } @Override - public String describe() - { - return "Adding Alchemy Recipe for " + ((AlchemyRecipe) recipe).getResult().getDisplayName(); + public String describe() { + return "Adding Alchemy Recipe for " + + ((AlchemyRecipe) recipe).getResult().getDisplayName(); } @Override - public String describeUndo() - { - return "Removing Alchemy Recipe for " + ((AlchemyRecipe) recipe).getResult().getDisplayName(); + public String describeUndo() { + return "Removing Alchemy Recipe for " + + ((AlchemyRecipe) recipe).getResult().getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } @@ -73,23 +68,18 @@ public class Alchemy MineTweakerAPI.apply(new Remove(toStack(output))); } - private static class Remove implements IUndoableAction - { + private static class Remove implements IUndoableAction { private final ItemStack output; private AlchemyRecipe recipe; - - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } - + @Override - public void apply() - { - for (AlchemyRecipe r : AlchemyRecipeRegistry.recipes) - { - if (r.getResult() != null && r.getResult().isItemEqual(output)) - { + public void apply() { + for (AlchemyRecipe r : AlchemyRecipeRegistry.recipes) { + if (r.getResult() != null && r.getResult().isItemEqual(output)) { recipe = r; break; } @@ -99,32 +89,27 @@ public class Alchemy } @Override - public boolean canUndo() - { + public boolean canUndo() { return AlchemyRecipeRegistry.recipes != null && recipe != null; } @Override - public void undo() - { + public void undo() { AlchemyRecipeRegistry.recipes.add(recipe); } @Override - public String describe() - { + public String describe() { return "Removing Alchemy Recipe for " + output.getDisplayName(); } @Override - public String describeUndo() - { + public String describeUndo() { return "Restoring Alchemy Recipe for " + output.getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java index 5f5eac4f..a3918b6e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java @@ -1,68 +1,62 @@ package WayofTime.alchemicalWizardry.common.tweaker; import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack; + +import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe; +import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry; import minetweaker.IUndoableAction; import minetweaker.MineTweakerAPI; import minetweaker.api.item.IItemStack; import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe; -import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry; /** * MineTweaker3 Binding Recipe Handler by joshie * */ @ZenClass("mods.bloodmagic.Binding") -public class Binding -{ +public class Binding { @ZenMethod public static void addRecipe(IItemStack input, IItemStack output) { MineTweakerAPI.apply(new Add(new BindingRecipe(toStack(output), toStack(input)))); } - private static class Add implements IUndoableAction - { + private static class Add implements IUndoableAction { private final BindingRecipe recipe; - - public Add(BindingRecipe recipe) - { + + public Add(BindingRecipe recipe) { this.recipe = recipe; } - + @Override - public void apply() - { + public void apply() { BindingRegistry.bindingRecipes.add(recipe); } @Override - public boolean canUndo() - { + public boolean canUndo() { return BindingRegistry.bindingRecipes != null; } @Override - public void undo() - { + public void undo() { BindingRegistry.bindingRecipes.remove(recipe); } @Override - public String describe() - { - return "Adding Binding Recipe for " + ((BindingRecipe) recipe).getResult().getDisplayName(); + public String describe() { + return "Adding Binding Recipe for " + + ((BindingRecipe) recipe).getResult().getDisplayName(); } @Override - public String describeUndo() - { - return "Removing Binding Recipe for " + ((BindingRecipe) recipe).getResult().getDisplayName(); + public String describeUndo() { + return "Removing Binding Recipe for " + + ((BindingRecipe) recipe).getResult().getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } @@ -72,23 +66,18 @@ public class Binding MineTweakerAPI.apply(new Remove(toStack(output))); } - private static class Remove implements IUndoableAction - { + private static class Remove implements IUndoableAction { private final ItemStack output; private BindingRecipe recipe; - - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } - + @Override - public void apply() - { - for (BindingRecipe r : BindingRegistry.bindingRecipes) - { - if (r.getResult() != null && r.getResult().isItemEqual(output)) - { + public void apply() { + for (BindingRecipe r : BindingRegistry.bindingRecipes) { + if (r.getResult() != null && r.getResult().isItemEqual(output)) { recipe = r; break; } @@ -98,32 +87,27 @@ public class Binding } @Override - public boolean canUndo() - { + public boolean canUndo() { return BindingRegistry.bindingRecipes != null && recipe != null; } @Override - public void undo() - { + public void undo() { BindingRegistry.bindingRecipes.add(recipe); } @Override - public String describe() - { + public String describe() { return "Removing Binding Recipe for " + output.getDisplayName(); } @Override - public String describeUndo() - { + public String describeUndo() { return "Restoring Binding Recipe for " + output.getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java index e1b7d3f7..5506a380 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java @@ -1,6 +1,9 @@ package WayofTime.alchemicalWizardry.common.tweaker; import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack; + +import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; +import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; import minetweaker.IUndoableAction; import minetweaker.MineTweakerAPI; import minetweaker.api.item.IItemStack; @@ -8,64 +11,57 @@ import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe; -import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; /** * MineTweaker3 Blood Altar Recipe Handler by joshie * */ @ZenClass("mods.bloodmagic.Altar") -public class BloodAltar -{ +public class BloodAltar { @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int tier, int lp, @Optional int consume, @Optional int drain) { + public static void addRecipe( + IItemStack output, IItemStack input, int tier, int lp, @Optional int consume, @Optional int drain) { consume = consume > 0 ? consume : 20; drain = drain > 0 ? drain : 20; - MineTweakerAPI.apply(new Add(new AltarRecipe(toStack(output), toStack(input), tier, lp, consume, drain, false))); + MineTweakerAPI.apply( + new Add(new AltarRecipe(toStack(output), toStack(input), tier, lp, consume, drain, false))); } - private static class Add implements IUndoableAction - { + private static class Add implements IUndoableAction { private final AltarRecipe recipe; - - public Add(AltarRecipe recipe) - { + + public Add(AltarRecipe recipe) { this.recipe = recipe; } - + @Override - public void apply() - { + public void apply() { AltarRecipeRegistry.altarRecipes.add(recipe); } @Override - public boolean canUndo() - { + public boolean canUndo() { return AltarRecipeRegistry.altarRecipes != null; } @Override - public void undo() - { + public void undo() { AltarRecipeRegistry.altarRecipes.remove(recipe); } @Override - public String describe() - { - return "Adding Blood Altar Recipe for " + ((AltarRecipe) recipe).getResult().getDisplayName(); + public String describe() { + return "Adding Blood Altar Recipe for " + + ((AltarRecipe) recipe).getResult().getDisplayName(); } @Override - public String describeUndo() - { - return "Removing Blood Altar Recipe for " + ((AltarRecipe) recipe).getResult().getDisplayName(); + public String describeUndo() { + return "Removing Blood Altar Recipe for " + + ((AltarRecipe) recipe).getResult().getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } @@ -75,23 +71,18 @@ public class BloodAltar MineTweakerAPI.apply(new Remove(toStack(output))); } - private static class Remove implements IUndoableAction - { + private static class Remove implements IUndoableAction { private final ItemStack output; private AltarRecipe recipe; - - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } - + @Override - public void apply() - { - for (AltarRecipe r : AltarRecipeRegistry.altarRecipes) - { - if (r.getResult() != null && r.getResult().isItemEqual(output)) - { + public void apply() { + for (AltarRecipe r : AltarRecipeRegistry.altarRecipes) { + if (r.getResult() != null && r.getResult().isItemEqual(output)) { recipe = r; break; } @@ -101,32 +92,27 @@ public class BloodAltar } @Override - public boolean canUndo() - { + public boolean canUndo() { return AltarRecipeRegistry.altarRecipes != null && recipe != null; } @Override - public void undo() - { + public void undo() { AltarRecipeRegistry.altarRecipes.add(recipe); } @Override - public String describe() - { + public String describe() { return "Removing Blood Altar Recipe for " + output.getDisplayName(); } @Override - public String describeUndo() - { + public String describeUndo() { return "Restoring Blood Altar Recipe for " + output.getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java index d180d95d..5addc5d3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java @@ -4,10 +4,10 @@ import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toObjects; import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toShapedObjects; import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack; +import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe; +import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe; import java.util.ArrayList; import java.util.List; - -import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe; import minetweaker.IUndoableAction; import minetweaker.MineTweakerAPI; import minetweaker.api.item.IIngredient; @@ -17,17 +17,15 @@ import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe; /** * MineTweaker3 Blood Orb Recipe Handler by joshie * */ @ZenClass("mods.bloodmagic.BloodOrb") -public class BloodOrb -{ +public class BloodOrb { public static List lateAdditions = new ArrayList<>(); public static List lateRemovals = new ArrayList<>(); - + public static void applyAdditionsAndRemovals() { for (IUndoableAction toRemove : lateRemovals) { MineTweakerAPI.apply(toRemove); @@ -35,19 +33,17 @@ public class BloodOrb for (IUndoableAction toAdd : lateAdditions) { MineTweakerAPI.apply(toAdd); } - + lateAdditions.clear(); } - + @ZenMethod - public static void addShaped(IItemStack output, IIngredient[][] ingredients) - { + public static void addShaped(IItemStack output, IIngredient[][] ingredients) { lateAdditions.add(new Add(false, toStack(output), toShapedObjects(ingredients))); } @ZenMethod - public static void addShapeless(IItemStack output, IIngredient[] ingredients) - { + public static void addShapeless(IItemStack output, IIngredient[] ingredients) { lateAdditions.add((new Add(true, toStack(output), toObjects(ingredients)))); } @@ -56,31 +52,27 @@ public class BloodOrb private final boolean isShapeless; private final ItemStack output; private final Object[] recipe; - - public Add(boolean isShapeless, ItemStack output, Object... recipe) - { + + public Add(boolean isShapeless, ItemStack output, Object... recipe) { this.isShapeless = isShapeless; this.output = output; this.recipe = recipe; } - + @Override - public void apply() - { + public void apply() { if (isShapeless) iRecipe = new ShapelessBloodOrbRecipe(output, recipe); else iRecipe = new ShapedBloodOrbRecipe(output, recipe); CraftingManager.getInstance().getRecipeList().add(iRecipe); } @Override - public boolean canUndo() - { + public boolean canUndo() { return CraftingManager.getInstance().getRecipeList() != null; } @Override - public void undo() - { + public void undo() { CraftingManager.getInstance().getRecipeList().remove(iRecipe); } @@ -90,14 +82,12 @@ public class BloodOrb } @Override - public String describeUndo() - { + public String describeUndo() { return "Removing Blood Orb Recipe for " + output.getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } @@ -110,18 +100,17 @@ public class BloodOrb private static class Remove implements IUndoableAction { private final ItemStack output; private IRecipe iRecipe; - - public Remove(ItemStack output) - { + + public Remove(ItemStack output) { this.output = output; } - + @Override - public void apply() - { - for (IRecipe r : (List) CraftingManager.getInstance().getRecipeList()) - { - if((r instanceof ShapedBloodOrbRecipe || r instanceof ShapelessBloodOrbRecipe) && r.getRecipeOutput() != null && r.getRecipeOutput().isItemEqual(output)) { + public void apply() { + for (IRecipe r : (List) CraftingManager.getInstance().getRecipeList()) { + if ((r instanceof ShapedBloodOrbRecipe || r instanceof ShapelessBloodOrbRecipe) + && r.getRecipeOutput() != null + && r.getRecipeOutput().isItemEqual(output)) { iRecipe = r; break; } @@ -130,14 +119,12 @@ public class BloodOrb } @Override - public boolean canUndo() - { + public boolean canUndo() { return CraftingManager.getInstance().getRecipeList() != null && iRecipe != null; } @Override - public void undo() - { + public void undo() { CraftingManager.getInstance().getRecipeList().add(iRecipe); } @@ -147,14 +134,12 @@ public class BloodOrb } @Override - public String describeUndo() - { + public String describeUndo() { return "Restoring Blood Orb Recipe for " + output.getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/FallingTower.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/FallingTower.java index 7acbbd79..71c6d3e6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/FallingTower.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/FallingTower.java @@ -1,7 +1,10 @@ package WayofTime.alchemicalWizardry.common.tweaker; +import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack; + import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm; import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry; +import java.util.Iterator; import minetweaker.IUndoableAction; import minetweaker.MineTweakerAPI; import minetweaker.api.item.IItemStack; @@ -10,38 +13,29 @@ import net.minecraftforge.oredict.OreDictionary; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import java.util.Iterator; - -import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack; - /** * MineTweaker3 Falling Tower Paradigm Handler by hilburn * */ @ZenClass("mods.bloodmagic.FallingTower") -public class FallingTower -{ +public class FallingTower { @ZenMethod - public static void addFocus(IItemStack stack, int radius, String[] components) - { - MineTweakerAPI.apply(new Add(toStack(stack),radius,10000, components)); + public static void addFocus(IItemStack stack, int radius, String[] components) { + MineTweakerAPI.apply(new Add(toStack(stack), radius, 10000, components)); } @ZenMethod - public static void addFocus(IItemStack stack, int radius, String components) - { + public static void addFocus(IItemStack stack, int radius, String components) { MineTweakerAPI.apply(new Add(toStack(stack), radius, 10000, components.split("\\s*,\\s*"))); } @ZenMethod - public static void addFocus(IItemStack stack, int radius, int cost, String[] components) - { + public static void addFocus(IItemStack stack, int radius, int cost, String[] components) { MineTweakerAPI.apply(new Add(toStack(stack), radius, cost, components)); } @ZenMethod - public static void addFocus(IItemStack stack, int radius, int cost, String components) - { - MineTweakerAPI.apply(new Add(toStack(stack),radius, cost, components.split("\\s*,\\s*"))); + public static void addFocus(IItemStack stack, int radius, int cost, String components) { + MineTweakerAPI.apply(new Add(toStack(stack), radius, cost, components.split("\\s*,\\s*"))); } @ZenMethod @@ -49,31 +43,26 @@ public class FallingTower MineTweakerAPI.apply(new Remove(toStack(output))); } - private static class Add implements IUndoableAction - { + private static class Add implements IUndoableAction { private MeteorParadigm paradigm; - public Add(ItemStack stack, int radius, int cost, String[] components) - { + public Add(ItemStack stack, int radius, int cost, String[] components) { paradigm = new MeteorParadigm(stack, radius, cost); paradigm.parseStringArray(components); } @Override - public void apply() - { + public void apply() { MeteorRegistry.registerMeteorParadigm(paradigm); } @Override - public boolean canUndo() - { - return MeteorRegistry.paradigmList!= null; + public boolean canUndo() { + return MeteorRegistry.paradigmList != null; } @Override - public void undo() - { + public void undo() { MeteorRegistry.paradigmList.remove(paradigm); } @@ -83,14 +72,12 @@ public class FallingTower } @Override - public String describeUndo() - { + public String describeUndo() { return "Removing Falling Tower Focus for " + paradigm.focusStack.getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } @@ -99,19 +86,15 @@ public class FallingTower private final ItemStack focus; private MeteorParadigm paradigm; - public Remove(ItemStack focus) - { + public Remove(ItemStack focus) { this.focus = focus; } @Override - public void apply() - { - for (Iterator itr = MeteorRegistry.paradigmList.iterator(); itr.hasNext();) - { + public void apply() { + for (Iterator itr = MeteorRegistry.paradigmList.iterator(); itr.hasNext(); ) { MeteorParadigm paradigm = itr.next(); - if (OreDictionary.itemMatches(paradigm.focusStack,focus,false)) - { + if (OreDictionary.itemMatches(paradigm.focusStack, focus, false)) { this.paradigm = paradigm; itr.remove(); break; @@ -120,14 +103,12 @@ public class FallingTower } @Override - public boolean canUndo() - { - return MeteorRegistry.paradigmList!= null && paradigm != null; + public boolean canUndo() { + return MeteorRegistry.paradigmList != null && paradigm != null; } @Override - public void undo() - { + public void undo() { MeteorRegistry.paradigmList.add(paradigm); } @@ -137,14 +118,12 @@ public class FallingTower } @Override - public String describeUndo() - { + public String describeUndo() { return "Restoring Falling Tower Focus for " + focus.getDisplayName(); } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/HarvestMoon.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/HarvestMoon.java index 7dc4d07b..5dfc7804 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/HarvestMoon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/HarvestMoon.java @@ -17,56 +17,48 @@ import stanhebben.zenscript.annotations.ZenMethod; * MineTweaker3 Harvest Moon Handler by hilburn * */ @ZenClass("mods.bloodmagic.HarvestMoon") -public class HarvestMoon -{ +public class HarvestMoon { @ZenMethod - public static void addHarvestable(IItemStack block, IItemStack seed) - { - addHarvestable(block,block.getDamage(),seed); + public static void addHarvestable(IItemStack block, IItemStack seed) { + addHarvestable(block, block.getDamage(), seed); } @ZenMethod - public static void addHarvestable(IItemStack block, int meta, IItemStack seed) - { + public static void addHarvestable(IItemStack block, int meta, IItemStack seed) { ItemStack seedStack = MTHelper.toStack(seed); Block plantBlock = Block.getBlockFromItem(MTHelper.toStack(block).getItem()); - if (!(plantBlock==null || plantBlock== Blocks.air || seedStack==null || !(seedStack.getItem() instanceof IPlantable))) - { + if (!(plantBlock == null + || plantBlock == Blocks.air + || seedStack == null + || !(seedStack.getItem() instanceof IPlantable))) { MineTweakerAPI.apply(new Add(plantBlock, meta, seedStack)); - } - else - { + } else { throw new IllegalArgumentException("Invalid Harvest Block or Seed"); } } - private static class Add implements IUndoableAction - { + private static class Add implements IUndoableAction { private IHarvestHandler handler; private String name; - public Add(Block block, int meta, ItemStack seed) - { - handler = new GenericItemStackHarvestHandler(block,meta,seed); + public Add(Block block, int meta, ItemStack seed) { + handler = new GenericItemStackHarvestHandler(block, meta, seed); name = seed.getDisplayName(); } @Override - public void apply() - { + public void apply() { HarvestRegistry.registerHarvestHandler(handler); } @Override - public boolean canUndo() - { - return HarvestRegistry.handlerList!=null; + public boolean canUndo() { + return HarvestRegistry.handlerList != null; } @Override - public void undo() - { + public void undo() { HarvestRegistry.handlerList.remove(handler); } @@ -76,14 +68,12 @@ public class HarvestMoon } @Override - public String describeUndo() - { + public String describeUndo() { return "Removing Harvest Moon Support for " + name; } @Override - public Object getOverrideKey() - { + public Object getOverrideKey() { return null; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java index 019bc5f3..d23c0ea2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java @@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.common.tweaker; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import java.util.ArrayList; - import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.oredict.IOreDictEntry; @@ -61,7 +60,7 @@ public class MTHelper { prep.add("abc"); prep.add("def"); prep.add("ghi"); - char[][] map = new char[][] { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } }; + char[][] map = new char[][] {{'a', 'b', 'c'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}; for (int x = 0; x < ingredients.length; x++) { if (ingredients[x] != null) { for (int y = 0; y < ingredients[x].length; y++) { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java index fad3204a..6d3fb88a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java @@ -7,10 +7,8 @@ import minetweaker.util.IEventHandler; /** * MineTweaker3 Integration by joshie * */ -public class MineTweakerIntegration -{ - public static void register() - { +public class MineTweakerIntegration { + public static void register() { MineTweakerAPI.registerClass(Alchemy.class); MineTweakerAPI.registerClass(Binding.class); MineTweakerAPI.registerClass(BloodAltar.class); @@ -21,14 +19,12 @@ public class MineTweakerIntegration MineTweakerImplementationAPI.onRollbackEvent(new HandleLateAdditionsAndRemovals()); MineTweakerImplementationAPI.onPostReload(new HandleLateAdditionsAndRemovals()); } - public static class HandleLateAdditionsAndRemovals implements IEventHandler - { + + public static class HandleLateAdditionsAndRemovals + implements IEventHandler { @Override - public void handle(MineTweakerImplementationAPI.ReloadEvent event) - { + public void handle(MineTweakerImplementationAPI.ReloadEvent event) { BloodOrb.applyAdditionsAndRemovals(); } } - - }