From 5b110be984425c20cb07429cbb66b454daf3b94f Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Mon, 8 Aug 2022 21:25:35 +0000 Subject: [PATCH] Allow the Grinder to attack Ender Dragons (#26) * Update buildscript * Allow the Grander to kill Ender Dragons * Apply spotless --- build.gradle | 557 ++++++--- settings.gradle | 10 + .../draconicevolution/DraconicEvolution.java | 41 +- .../api/GeneratorOverride.java | 9 +- .../draconicevolution/api/package-info.java | 5 +- .../draconicevolution/client/ClientProxy.java | 214 ++-- .../client/ReactorSound.java | 14 +- .../client/creativetab/DETab.java | 5 +- .../client/gui/ConfigGUI.java | 13 +- .../client/gui/CustomGuiButton.java | 24 +- .../client/gui/DEGUIFactory.java | 7 +- .../client/gui/GUIContainerTemplate.java | 19 +- .../client/gui/GUIDissEnchanter.java | 11 +- .../client/gui/GUIDraconiumChest.java | 28 +- .../client/gui/GUIEnergyInfuser.java | 77 +- .../client/gui/GUIFlowGate.java | 84 +- .../client/gui/GUIGenerator.java | 64 +- .../client/gui/GUIGrinder.java | 65 +- .../client/gui/GUIParticleGenerator.java | 237 ++-- .../client/gui/GUIPlayerDetector.java | 42 +- .../client/gui/GUISunDial.java | 29 +- .../client/gui/GUITeleporter.java | 171 ++- .../client/gui/GUIUpgradeModifier.java | 117 +- .../client/gui/GUIWeatherController.java | 27 +- .../client/gui/GuiButtonAHeight.java | 39 +- .../client/gui/GuiButtonTextOnly.java | 22 +- .../client/gui/GuiHandler.java | 45 +- .../client/gui/GuiHudConfig.java | 109 +- .../client/gui/GuiTextureButton.java | 20 +- .../client/gui/componentguis/GUIManual.java | 231 ++-- .../client/gui/componentguis/GUIReactor.java | 160 ++- .../gui/componentguis/GUIToolConfig.java | 143 ++- .../gui/componentguis/GUIToolInventory.java | 16 +- .../client/gui/componentguis/ManualPage.java | 26 +- .../ComponentConfigItemButton.java | 29 +- .../ComponentContributorsPage.java | 54 +- .../guicomponents/ComponentFieldAdjuster.java | 93 +- .../guicomponents/ComponentFieldButton.java | 27 +- .../guicomponents/ComponentIndexButton.java | 9 +- .../guicomponents/ComponentManualPage.java | 76 +- .../client/handler/ClientEventHandler.java | 77 +- .../client/handler/HudHandler.java | 118 +- .../client/handler/ItemDisplayManager.java | 5 +- .../client/handler/ParticleHandler.java | 15 +- .../client/handler/ResourceHandler.java | 59 +- .../client/keybinding/KeyInputHandler.java | 16 +- .../client/model/ModelDraconicArmor.java | 57 +- .../client/model/ModelDraconicArmorOld.java | 50 +- .../model/ModelReactorEnergyInjector.java | 5 +- .../model/ModelReactorStabilizerCore.java | 3 +- .../model/ModelReactorStabilizerRing.java | 94 +- .../client/model/ModelRenderOBJ.java | 26 +- .../client/model/ModelTeleporterStand.java | 1 - .../client/model/ModelWyvernArmor.java | 57 +- .../special/ModelStaffOfTheGreatOne.java | 676 ++++++++--- .../client/render/block/RenderCrystal.java | 16 +- .../render/block/RenderParticleGen.java | 2 - .../client/render/block/RenderPortal.java | 7 +- .../render/block/RenderTeleporterStand.java | 4 +- .../render/entity/RenderChaosCrystal.java | 9 +- .../render/entity/RenderChaosDrill.java | 4 +- .../client/render/entity/RenderDragon.java | 237 ++-- .../render/entity/RenderDragonHeart.java | 10 +- .../render/entity/RenderDragonProjectile.java | 7 +- .../entity/RenderEntityChaosVortex.java | 3 +- .../entity/RenderEntityCustomArrow.java | 32 +- .../client/render/item/RenderArmor.java | 10 +- .../client/render/item/RenderBow.java | 42 +- .../client/render/item/RenderBowModel.java | 19 +- .../render/item/RenderChaosFragment.java | 3 +- .../client/render/item/RenderChaosShard.java | 3 +- .../client/render/item/RenderMobSoul.java | 32 +- .../render/item/RenderStabilizerPart.java | 22 +- .../client/render/item/RenderTool.java | 2 +- .../render/particle/ParticleCustom.java | 68 +- .../render/particle/ParticleDistortion.java | 88 +- .../render/particle/ParticleEnergy.java | 69 +- .../render/particle/ParticleEnergyBeam.java | 53 +- .../render/particle/ParticleEnergyField.java | 83 +- .../render/particle/ParticleReactorBeam.java | 198 +++- .../client/render/particle/Particles.java | 689 +++++++---- .../render/tile/RenderTileChaosShard.java | 5 +- .../client/render/tile/RenderTileCrystal.java | 56 +- .../render/tile/RenderTileCustomSpawner.java | 16 +- .../render/tile/RenderTileDissEnchanter.java | 7 +- .../render/tile/RenderTileDraconiumChest.java | 10 +- .../render/tile/RenderTileEnergyInfiser.java | 26 +- .../render/tile/RenderTileEnergyPylon.java | 9 +- .../tile/RenderTileEnergyStorageCore.java | 38 +- .../render/tile/RenderTileParticleGen.java | 110 +- .../render/tile/RenderTilePlacedItem.java | 5 +- .../render/tile/RenderTileReactorCore.java | 39 +- .../tile/RenderTileReactorEnergyInjector.java | 1 - .../tile/RenderTileReactorStabilizer.java | 140 +-- .../tile/RenderTileTeleporterStand.java | 32 +- .../render/tile/RenderTileTestBlock.java | 17 +- .../tile/RenderTileUpgradeModifier.java | 8 +- .../draconicevolution/common/CommonProxy.java | 211 ++-- .../draconicevolution/common/ModBlocks.java | 7 +- .../draconicevolution/common/ModItems.java | 8 +- .../common/achievements/Achievements.java | 455 +++++++- .../common/blocks/BlockContainerTemplate.java | 6 +- .../common/blocks/BlockCustomDrop.java | 8 +- .../common/blocks/BlockDE.java | 8 +- .../common/blocks/CKeyStone.java | 41 +- .../common/blocks/ChaosCrystal.java | 20 +- .../common/blocks/ChaosShardAtmos.java | 6 +- .../common/blocks/CustomSpawner.java | 110 +- .../common/blocks/DraconicBlock.java | 3 +- .../common/blocks/DraconiumBlock.java | 22 +- .../common/blocks/DraconiumChest.java | 58 +- .../common/blocks/DraconiumOre.java | 8 +- .../common/blocks/InfusedObsidian.java | 16 +- .../common/blocks/ParticleGenerator.java | 59 +- .../common/blocks/PlacedItem.java | 72 +- .../common/blocks/Potentiometer.java | 40 +- .../common/blocks/RainSensor.java | 14 +- .../common/blocks/SafetyFlame.java | 11 +- .../common/blocks/TeleporterStand.java | 36 +- .../common/blocks/TestBlock.java | 53 +- .../common/blocks/XRayBlock.java | 42 +- .../blocks/itemblocks/CKeyStoneItemBlock.java | 3 +- .../itemblocks/DraconiumChestItemBlock.java | 3 +- .../blocks/itemblocks/DraconiumItemBlock.java | 4 +- .../itemblocks/EnergyCrystalItemBlock.java | 17 +- .../itemblocks/ItemBlockCustomData.java | 27 +- .../blocks/itemblocks/LRDItemBlock.java | 5 - .../blocks/itemblocks/TestItemBlock.java | 2 +- .../common/blocks/machine/DissEnchanter.java | 31 +- .../common/blocks/machine/EnergyCrystal.java | 91 +- .../common/blocks/machine/EnergyInfuser.java | 15 +- .../common/blocks/machine/FlowGate.java | 24 +- .../common/blocks/machine/Generator.java | 63 +- .../common/blocks/machine/Grinder.java | 15 +- .../blocks/machine/LongRangeDislocator.java | 41 +- .../common/blocks/machine/PlayerDetector.java | 27 +- .../machine/PlayerDetectorAdvanced.java | 51 +- .../common/blocks/machine/SunDial.java | 37 +- .../blocks/machine/UpgradeModifier.java | 17 +- .../blocks/machine/WeatherController.java | 43 +- .../multiblock/DislocatorReceptacle.java | 37 +- .../common/blocks/multiblock/EnergyPylon.java | 56 +- .../blocks/multiblock/EnergyStorageCore.java | 81 +- .../blocks/multiblock/IReactorPart.java | 1 - .../multiblock/InvisibleMultiblock.java | 112 +- .../blocks/multiblock/MultiblockHelper.java | 13 +- .../common/blocks/multiblock/Portal.java | 36 +- .../common/blocks/multiblock/ReactorCore.java | 28 +- .../multiblock/ReactorEnergyInjector.java | 32 +- .../blocks/multiblock/ReactorStabilizer.java | 39 +- .../common/container/ContainerAdvTool.java | 85 +- .../common/container/ContainerDataSync.java | 7 +- .../container/ContainerDissEnchanter.java | 8 +- .../container/ContainerDraconiumChest.java | 38 +- .../container/ContainerEnergyInfuser.java | 7 +- .../common/container/ContainerGenerator.java | 3 +- .../common/container/ContainerGrinder.java | 6 +- .../container/ContainerPlayerDetector.java | 71 +- .../common/container/ContainerReactor.java | 77 +- .../common/container/ContainerSunDial.java | 3 - .../common/container/ContainerTemplate.java | 5 +- .../container/ContainerUpgradeModifier.java | 45 +- .../container/ContainerWeatherController.java | 5 +- .../common/container/DummyContainer.java | 5 +- .../common/entity/ChaosImplosion.java | 9 +- .../common/entity/ChaosImplosionTrace.java | 16 +- .../common/entity/EntityChaosBolt.java | 57 +- .../common/entity/EntityChaosCrystal.java | 30 +- .../common/entity/EntityChaosDrill.java | 21 +- .../common/entity/EntityChaosGuardian.java | 653 +++++++---- .../common/entity/EntityChaosVortex.java | 29 +- .../common/entity/EntityCustomArrow.java | 180 ++- .../common/entity/EntityCustomDragon.java | 204 ++-- .../common/entity/EntityDraconicArrow.java | 145 ++- .../common/entity/EntityDragonHeart.java | 116 +- .../common/entity/EntityDragonProjectile.java | 190 +++- .../common/entity/EntityEnderArrow.java | 262 +++-- .../common/entity/EntityPersistentItem.java | 38 +- .../common/entity/ExtendedPlayer.java | 5 +- .../common/handler/BalanceConfigHandler.java | 834 ++++++++------ .../common/handler/ConfigHandler.java | 341 ++++-- .../common/handler/ContributorHandler.java | 51 +- .../common/handler/CraftingHandler.java | 1004 +++++++++++++++-- .../common/handler/FMLEventHandler.java | 8 +- .../handler/MinecraftForgeEventHandler.java | 104 +- .../common/inventory/GenericInventory.java | 10 +- .../inventory/InventoryCraftingChest.java | 10 +- .../InventoryCraftingChestResult.java | 11 +- .../common/inventory/InventoryTool.java | 74 +- .../common/inventory/SlotChargable.java | 3 - .../common/inventory/SlotItemValid.java | 29 +- .../common/inventory/SlotOpaqueBlock.java | 4 - .../common/items/AwakenedCore.java | 2 +- .../common/items/ChaosFragment.java | 3 +- .../common/items/ChaosShard.java | 3 +- .../common/items/DraconicCore.java | 23 +- .../common/items/DraconiumBlend.java | 3 +- .../common/items/DraconiumDust.java | 1 - .../common/items/DraconiumEnergyCore.java | 4 +- .../common/items/DragonHeart.java | 2 +- .../common/items/InfoTablet.java | 11 +- .../common/items/ItemDE.java | 7 +- .../draconicevolution/common/items/Key.java | 12 +- .../common/items/MobSoul.java | 23 +- .../common/items/Nugget.java | 3 +- .../common/items/ReactorStabiliserPart.java | 26 +- .../common/items/SunFocus.java | 3 +- .../common/items/Tclogo.java | 705 ++++++------ .../common/items/WyvernCore.java | 2 +- .../items/armor/CustomArmorHandler.java | 193 ++-- .../common/items/armor/DraconicArmor.java | 203 ++-- .../common/items/armor/ICustomArmor.java | 50 +- .../common/items/armor/WyvernArmor.java | 93 +- .../common/items/tools/AdminSpawnEgg.java | 27 +- .../items/tools/CreativeStructureSpawner.java | 24 +- .../common/items/tools/DraconicAxe.java | 112 +- .../items/tools/DraconicDistructionStaff.java | 49 +- .../common/items/tools/DraconicHoe.java | 109 +- .../common/items/tools/DraconicPickaxe.java | 373 +++--- .../common/items/tools/DraconicShovel.java | 387 ++++--- .../items/tools/DraconiumFluxCapacitor.java | 86 +- .../common/items/tools/EnderArrow.java | 13 +- .../common/items/tools/Magnet.java | 53 +- .../items/tools/ObliterationCatalyst.java | 27 +- .../common/items/tools/SafetyMatch.java | 23 +- .../common/items/tools/TeleporterMKI.java | 39 +- .../common/items/tools/TeleporterMKII.java | 62 +- .../common/items/tools/Wrench.java | 49 +- .../common/items/tools/WyvernPickaxe.java | 347 +++--- .../common/items/tools/WyvernShovel.java | 304 ++--- .../items/tools/baseclasses/MiningTool.java | 175 +-- .../items/tools/baseclasses/RFItemBase.java | 19 +- .../items/tools/baseclasses/ToolBase.java | 125 +- .../items/tools/baseclasses/ToolHandler.java | 283 ++--- .../common/items/weapons/BowHandler.java | 56 +- .../common/items/weapons/DraconicBow.java | 116 +- .../common/items/weapons/DraconicSword.java | 61 +- .../common/items/weapons/WyvernBow.java | 115 +- .../common/items/weapons/WyvernSword.java | 67 +- .../common/lib/OreDoublingRegistry.java | 28 +- .../common/lib/References.java | 7 +- .../draconicevolution/common/lib/Strings.java | 2 +- .../common/lib/VersionHandler.java | 3 - .../common/magic/PotionHandler.java | 37 +- .../common/network/BlockUpdatePacket.java | 11 +- .../common/network/ButtonPacket.java | 19 +- .../common/network/ContributorPacket.java | 8 +- .../common/network/GenericParticlePacket.java | 72 +- .../common/network/ItemConfigPacket.java | 23 +- .../common/network/MagnetToggleAckPacket.java | 3 +- .../common/network/MagnetTogglePacket.java | 4 +- .../common/network/MountUpdatePacket.java | 6 +- .../common/network/ParticleGenPacket.java | 189 ++-- .../common/network/PlacedItemPacket.java | 18 +- .../network/PlayerDetectorButtonPacket.java | 14 +- .../network/PlayerDetectorStringPacket.java | 11 +- .../common/network/ShieldHitPacket.java | 7 +- .../common/network/SpeedRequestPacket.java | 9 +- .../common/network/TeleporterPacket.java | 50 +- .../common/network/TileObjectPacket.java | 33 +- .../common/network/ToolModePacket.java | 11 +- .../tileentities/CustomSpawnerBaseLogic.java | 78 +- .../common/tileentities/TileCKeyStone.java | 81 +- .../common/tileentities/TileChaosShard.java | 22 +- .../tileentities/TileContainerTemplate.java | 21 +- .../tileentities/TileCustomSpawner.java | 66 +- .../tileentities/TileDissEnchanter.java | 51 +- .../tileentities/TileDraconiumChest.java | 116 +- .../tileentities/TileEnergyInfuser.java | 111 +- .../common/tileentities/TileGenerator.java | 37 +- .../common/tileentities/TileGrinder.java | 60 +- .../common/tileentities/TileLRD.java | 3 +- .../common/tileentities/TileObjectSync.java | 9 +- .../tileentities/TileParticleGenerator.java | 62 +- .../tileentities/TilePlayerDetector.java | 3 - .../TilePlayerDetectorAdvanced.java | 37 +- .../tileentities/TilePotentiometer.java | 21 +- .../common/tileentities/TileSunDial.java | 84 +- .../tileentities/TileTeleporterStand.java | 20 +- .../common/tileentities/TileTestBlock.java | 122 +- .../tileentities/TileUpgradeModifier.java | 19 +- .../tileentities/TileWeatherController.java | 83 +- .../energynet/IRemoteEnergyHandler.java | 2 +- .../energynet/LinkedEnergyDevice.java | 22 +- .../energynet/LinkedReceiver.java | 9 +- .../energynet/TileEnergyRelay.java | 37 +- .../energynet/TileEnergyTransceiver.java | 62 +- .../energynet/TileRemoteEnergyBase.java | 81 +- .../TileWirelessEnergyTransceiver.java | 75 +- .../tileentities/gates/TileFluidGate.java | 4 +- .../tileentities/gates/TileFluxGate.java | 58 +- .../common/tileentities/gates/TileGate.java | 31 +- .../TileDislocatorReceptacle.java | 13 +- .../TileEnderResurrection.java | 232 +++- .../multiblocktiles/TileEnergyPylon.java | 93 +- .../TileEnergyStorageCore.java | 336 ++++-- .../TileInvisibleMultiblock.java | 39 +- .../multiblocktiles/TilePortalBlock.java | 79 +- .../reactor/ReactorExplosion.java | 9 +- .../reactor/ReactorExplosionTrace.java | 14 +- .../reactor/TileReactorCore.java | 199 ++-- .../reactor/TileReactorEnergyInjector.java | 35 +- .../reactor/TileReactorStabilizer.java | 58 +- .../common/utills/DamageSourceChaos.java | 9 - .../common/utills/DragonChunkLoader.java | 18 +- .../common/utills/EnergyStorage.java | 3 +- .../common/utills/IConfigurableItem.java | 27 +- .../common/utills/IHudDisplayBlock.java | 3 +- .../common/utills/IHudDisplayItem.java | 3 +- .../common/utills/IUpgradableItem.java | 59 +- .../common/utills/InventoryUtils.java | 6 +- .../common/utills/ItemConfigField.java | 22 +- .../common/utills/PortalHelper.java | 43 +- .../common/utills/UpdateChecker.java | 79 +- .../common/world/ChaosWorldGenHandler.java | 78 +- .../common/world/DraconicWorldGenerator.java | 44 +- .../common/world/WorldGenChaosIsland.java | 754 +++++++------ .../common/world/WorldGenEnderComet.java | 9 +- .../common/world/WorldGenEnderIsland.java | 24 +- .../integration/ModHelper.java | 59 +- .../computers/CCOCIntegration.java | 1 - .../integration/computers/cc/CCAdapter.java | 12 +- .../nei/CraftingChestOverlayHandler.java | 40 +- .../nei/CraftingChestStackPositioner.java | 4 +- .../integration/nei/DENEIGuiHandler.java | 5 +- .../nei/NEIDraconicevolutionConfig.java | 1 - 326 files changed, 14641 insertions(+), 7821 deletions(-) create mode 100644 settings.gradle diff --git a/build.gradle b/build.gradle index 7914dd81..ec6cfc96 100644 --- a/build.gradle +++ b/build.gradle @@ -1,51 +1,77 @@ -//version: 1643020202 +//version: 1659365110 /* -DO NOT CHANGE THIS FILE! - -Also, you may replace this file at any time if there is an update available. -Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. + DO NOT CHANGE THIS FILE! + Also, you may replace this file at any time if there is an update available. + Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. */ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.internal.logging.text.StyledTextOutput.Style +import org.gradle.internal.logging.text.StyledTextOutputFactory +import java.nio.file.Files +import java.nio.file.Paths import java.util.concurrent.TimeUnit +import java.util.zip.ZipEntry +import java.util.zip.ZipInputStream +import java.util.zip.ZipOutputStream buildscript { repositories { + mavenCentral() + maven { - name = "forge" - url = "https://maven.minecraftforge.net" + name 'forge' + url 'https://maven.minecraftforge.net' } maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" + name 'sonatype' + url 'https://oss.sonatype.org/content/repositories/snapshots/' } maven { - name = "Scala CI dependencies" - url = "https://repo1.maven.org/maven2/" + name 'Scala CI dependencies' + url 'https://repo1.maven.org/maven2/' } maven { - name = "jitpack" - url = "https://jitpack.io" + name 'jitpack' + url 'https://jitpack.io' } } dependencies { classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7' } } - plugins { + id 'java-library' id 'idea' id 'eclipse' id 'scala' - id("org.ajoberstar.grgit") version("3.1.1") - id("com.github.johnrengelman.shadow") version("4.0.4") - id("com.palantir.git-version") version("0.12.3") - id('de.undercouch.download') version('4.1.2') - id("maven-publish") + id 'maven-publish' + id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false + id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false + id 'org.ajoberstar.grgit' version '4.1.1' + id 'com.github.johnrengelman.shadow' version '4.0.4' + id 'com.palantir.git-version' version '0.13.0' apply false + id 'de.undercouch.download' version '5.0.1' + id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id "com.diffplug.spotless" version "6.7.2" } +verifySettingsGradle() + +dependencies { + implementation 'com.diffplug:blowdryer:1.6.0' +} + +apply plugin: 'com.diffplug.blowdryer' + +if (project.file('.git/HEAD').isFile()) { + apply plugin: 'com.palantir.git-version' +} + +def out = services.get(StyledTextOutputFactory).create('an-output') apply plugin: 'forge' @@ -64,6 +90,7 @@ idea { downloadSources = true } } +apply from: Blowdryer.file('spotless.gradle') if(JavaVersion.current() != JavaVersion.VERSION_1_8) { throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) @@ -90,28 +117,34 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") -boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false - +boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false +boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() +boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false +String channel = project.hasProperty('channel') ? project.channel : 'stable' +String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12' String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" +String kotlinSourceDir = "src/main/kotlin/" String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") -if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") +if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } if(apiPackage) { targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } } if(accessTransformersFile) { String targetFile = "src/main/resources/META-INF/" + accessTransformersFile - if(getFile(targetFile).exists() == false) { + if(!getFile(targetFile).exists()) { throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) } } @@ -123,15 +156,17 @@ if(usesMixins.toBoolean()) { targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" + if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } @@ -139,8 +174,9 @@ if(coreModClass) { String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { - throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" + if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } @@ -153,17 +189,35 @@ configurations.all { } // Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version -'git config core.fileMode false'.execute() +try { + 'git config core.fileMode false'.execute() +} +catch (Exception ignored) { + out.style(Style.Failure).println("git isn't installed at all") +} // Pulls version first from the VERSION env and then git tag String identifiedVersion +String versionOverride = System.getenv("VERSION") ?: null try { - String versionOverride = System.getenv("VERSION") ?: null identifiedVersion = versionOverride == null ? gitVersion() : versionOverride - version = minecraftVersion + "-" + identifiedVersion } -catch (Exception e) { - throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!"); +catch (Exception ignored) { + out.style(Style.Failure).text( + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + ) + versionOverride = 'NO-GIT-TAG-SET' + identifiedVersion = versionOverride +} +version = minecraftVersion + '-' + identifiedVersion +ext { + modVersion = identifiedVersion +} + +if(identifiedVersion == versionOverride) { + out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } group = modGroup @@ -174,22 +228,25 @@ else { archivesBaseName = modId } - def arguments = [] def jvmArguments = [] -if(usesMixins.toBoolean()) { +if (usesMixins.toBoolean() || forceEnableMixins) { arguments += [ - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - jvmArguments += [ - "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true" + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] + if (usesMixinDebug.toBoolean()) { + jvmArguments += [ + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" + ] + } } minecraft { - version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion - runDir = "run" + version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion + runDir = 'run' if (replaceGradleTokenInFile) { replaceIn replaceGradleTokenInFile @@ -200,7 +257,7 @@ minecraft { replace gradleTokenModName, modName } if(gradleTokenVersion) { - replace gradleTokenVersion, versionDetails().lastTag + replace gradleTokenVersion, modVersion } if(gradleTokenGroupName) { replace gradleTokenGroupName, modGroup @@ -222,8 +279,8 @@ minecraft { } } -if(file("addon.gradle").exists()) { - apply from: "addon.gradle" +if(file('addon.gradle').exists()) { + apply from: 'addon.gradle' } apply from: 'repositories.gradle' @@ -236,58 +293,65 @@ configurations { repositories { maven { - name = "Overmind forge repo mirror" - url = "https://gregtech.overminddl1.com/" + name 'Overmind forge repo mirror' + url 'https://gregtech.overminddl1.com/' } - if(usesMixins.toBoolean()) { + if(usesMixins.toBoolean() || forceEnableMixins) { maven { - name = "sponge" - url = "https://repo.spongepowered.org/repository/maven-public" + name 'sponge' + url 'https://repo.spongepowered.org/repository/maven-public' } maven { - url = "https://jitpack.io" + url 'https://jitpack.io' } } } dependencies { if(usesMixins.toBoolean()) { - annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") - annotationProcessor("com.google.guava:guava:24.1.1-jre") - annotationProcessor("com.google.code.gson:gson:2.8.6") - annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') + annotationProcessor('com.google.guava:guava:24.1.1-jre') + annotationProcessor('com.google.code.gson:gson:2.8.6') + annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') + } + if(usesMixins.toBoolean() || forceEnableMixins) { // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") { + compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { // Mixin includes a lot of dependencies that are too up-to-date - exclude module: "launchwrapper" - exclude module: "guava" - exclude module: "gson" - exclude module: "commons-io" - exclude module: "log4j-core" + exclude module: 'launchwrapper' + exclude module: 'guava' + exclude module: 'gson' + exclude module: 'commons-io' + exclude module: 'log4j-core' } - compile("com.github.GTNewHorizons:SpongeMixins:1.5.0") + compile('com.github.GTNewHorizons:SpongeMixins:1.5.0') } } apply from: 'dependencies.gradle' -def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" task generateAssets { - if(usesMixins.toBoolean()) { - getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + if (usesMixins.toBoolean()) { + def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); + if (!mixinConfigFile.exists()) { + mixinConfigFile.text = """{ "required": true, "minVersion": "0.7.11", "package": "${modGroup}.${mixinsPackage}", "plugin": "${modGroup}.${mixinPlugin}", "refmap": "${mixingConfigRefMap}", "target": "@env(DEFAULT)", - "compatibilityLevel": "JAVA_8" + "compatibilityLevel": "JAVA_8", + "mixins": [], + "client": [], + "server": [] } - """ + } } } @@ -308,7 +372,10 @@ shadowJar { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile + ] dependsOn(relocateShadowJar) } @@ -339,12 +406,12 @@ afterEvaluate { if(usesMixins.toBoolean()) { tasks.compileJava { options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobf.srg}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" ] } } @@ -353,8 +420,8 @@ afterEvaluate { runClient { if(developmentEnvironmentUserName) { arguments += [ - "--username", - developmentEnvironmentUserName + "--username", + developmentEnvironmentUserName ] } @@ -372,39 +439,40 @@ tasks.withType(JavaExec).configureEach { javaToolchains.launcherFor { languageVersion = projectJavaVersion } - ) + ) } -processResources -{ +processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version + exclude("spotless.gradle") // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - // replace version and mcversion + // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName + "modVersion": modVersion, + "modId": modId, + "modName": modName } if(usesMixins.toBoolean()) { from refMap } - // copy everything else, thats not the mcmod.info + // copy everything else that's not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' + exclude 'spotless.gradle' } } def getManifestAttributes() { def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } @@ -418,16 +486,16 @@ def getManifestAttributes() { if(usesMixins.toBoolean()) { manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes } task sourcesJar(type: Jar) { - from (sourceSets.main.allJava) + from (sourceSets.main.allSource) from (file("$projectDir/LICENSE")) getArchiveClassifier().set('sources') } @@ -447,7 +515,10 @@ task shadowDevJar(type: ShadowJar) { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile + ] } task relocateShadowDevJar(type: ConfigureShadowRelocation) { @@ -482,7 +553,7 @@ task devJar(type: Jar) { } task apiJar(type: Jar) { - from (sourceSets.main.allJava) { + from (sourceSets.main.allSource) { include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' } @@ -507,14 +578,15 @@ artifacts { } } -// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), +// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), // and isn't strictly needed with the POM so just disable it. tasks.withType(GenerateModuleMetadata) { enabled = false } +// workaround variable hiding in pom processing +def projectConfigs = project.configurations -// publishing publishing { publications { maven(MavenPublication) { @@ -523,7 +595,7 @@ publishing { artifact source: shadowJar, classifier: "" } if(!noPublishedSources) { - artifact source: sourcesJar, classifier: "src" + artifact source: sourcesJar, classifier: "sources" } artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" if (apiPackage) { @@ -534,14 +606,24 @@ publishing { artifactId = System.getenv("ARTIFACT_ID") ?: project.name // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion - - // Remove all non GTNH deps here. - // Original intention was to remove an invalid forgeBin being generated without a groupId (mandatory), but - // it also removes all of the MC deps + + // remove extra garbage from minecraft and minecraftDeps configuration pom.withXml { + def badArtifacts = [:].withDefault {[] as Set} + for (configuration in [ + projectConfigs.minecraft, + projectConfigs.minecraftDeps + ]) { + for (dependency in configuration.allDependencies) { + badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name + } + } + // example for specifying extra stuff to ignore + // badArtifacts["org.example.group"] += "artifactName" + Node pomNode = asNode() pomNode.dependencies.'*'.findAll() { - it.groupId.text() != 'com.github.GTNewHorizons' + badArtifacts[it.groupId.text()].contains(it.artifactId.text()) }.each() { it.parent().remove(it) } @@ -565,7 +647,7 @@ task updateBuildScript { doLast { if (performBuildScriptUpdate(projectDir.toString())) return - print("Build script already up-to-date!") + print("Build script already up-to-date!") } } @@ -573,19 +655,33 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) { if (autoUpdateBuildScript.toBoolean()) { performBuildScriptUpdate(projectDir.toString()) } else { - println("Build script update available! Run 'gradle updateBuildScript'") + out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") } } static URL availableBuildScriptUrl() { new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle") } +static URL exampleSettingsGradleUrl() { + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/settings.gradle.example") +} + + +def verifySettingsGradle() { + def settingsFile = getFile("settings.gradle") + if (!settingsFile.exists()) { + println("Downloading default settings.gradle") + exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } } + throw new GradleException("Settings.gradle has been updated, please re-run task.") + } +} boolean performBuildScriptUpdate(String projectDir) { if (isNewBuildScriptVersionAvailable(projectDir)) { def buildscriptFile = getFile("build.gradle") availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } - print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + verifySettingsGradle() return true } return false @@ -616,80 +712,225 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } -// Deobfuscation +// Parameter Deobfuscation -def deobf(String sourceURL) { - try { - URL url = new URL(sourceURL) - String fileName = url.getFile() +task deobfParams { + doLast { - //get rid of directories: - int lastSlash = fileName.lastIndexOf("/") - if(lastSlash > 0) { - fileName = fileName.substring(lastSlash + 1) - } - //get rid of extension: - if(fileName.endsWith(".jar")) { - fileName = fileName.substring(0, fileName.lastIndexOf(".")) + String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" + String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + String paramsCSV = "$mcpDir/params.csv" + + download.run { + src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + dest mcpZIP + overwrite false } - String hostName = url.getHost() - if(hostName.startsWith("www.")) { - hostName = hostName.substring(4) + if(!file(paramsCSV).exists()) { + println("Extracting MCP archive ...") + unzip(mcpZIP, mcpDir) } - List parts = Arrays.asList(hostName.split("\\.")) - Collections.reverse(parts) - hostName = String.join(".", parts) - return deobf(sourceURL, hostName + "/" + fileName) - } catch(Exception e) { - return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) - } + println("Parsing params.csv ...") + Map params = new HashMap<>() + Files.lines(Paths.get(paramsCSV)).forEach{line -> + String[] cells = line.split(",") + if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { + params.put(cells[0], cells[1]) + } + } + + out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") + out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") +} } -// The method above is to be prefered. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String fileName) { - String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" - String bon2Dir = cacheDir + "forge_gradle/deobf" - String bon2File = bon2Dir + "/BON2-2.5.0.jar" - String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar" - String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar" - - if(file(deobfFile).exists()) { - return files(deobfFile) +static int replaceParams(File file, Map params) { +int fileCount = 0 + +if(file.isDirectory()) { + for(File f : file.listFiles()) { + fileCount += replaceParams(f, params) + } + return fileCount +} +println("Visiting ${file.getName()} ...") +try { + String content = new String(Files.readAllBytes(file.toPath())) + int hash = content.hashCode() + params.forEach{key, value -> + content = content.replaceAll(key, value) + } + if(hash != content.hashCode()) { + Files.write(file.toPath(), content.getBytes("UTF-8")) + return 1 + } +} catch(Exception e) { + e.printStackTrace() +} +return 0 +} + +// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) +static unzip(String zipFileName, String outputDir) { +byte[] buffer = new byte[16384] +ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) +ZipEntry zipEntry = zis.getNextEntry() +while (zipEntry != null) { + File newFile = new File(outputDir + File.separator, zipEntry.name) + if (zipEntry.isDirectory()) { + if (!newFile.isDirectory() && !newFile.mkdirs()) { + throw new IOException("Failed to create directory $newFile") + } + } else { + // fix for Windows-created archives + File parent = newFile.parentFile + if (!parent.isDirectory() && !parent.mkdirs()) { + throw new IOException("Failed to create directory $parent") + } + // write file content + FileOutputStream fos = new FileOutputStream(newFile) + int len = 0 + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len) + } + fos.close() + } + zipEntry = zis.getNextEntry() +} +zis.closeEntry() +zis.close() +} + +configure(deobfParams) { +group = 'forgegradle' +description = 'Rename all obfuscated parameter names inherited from Minecraft classes' +} + +// Dependency Deobfuscation + +def deobf(String sourceURL) { +try { + URL url = new URL(sourceURL) + String fileName = url.getFile() + + //get rid of directories: + int lastSlash = fileName.lastIndexOf("/") + if(lastSlash > 0) { + fileName = fileName.substring(lastSlash + 1) + } + //get rid of extension: + if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { + fileName = fileName.substring(0, fileName.lastIndexOf(".")) } - download { - src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' - dest bon2File - quiet true - overwrite false + String hostName = url.getHost() + if(hostName.startsWith("www.")) { + hostName = hostName.substring(4) } + List parts = Arrays.asList(hostName.split("\\.")) + Collections.reverse(parts) + hostName = String.join(".", parts) - download { - src sourceURL - dest obfFile - quiet true - overwrite false - } + return deobf(sourceURL, "$hostName/$fileName") +} catch(Exception e) { + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") +} +} - exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' - workingDir bon2Dir - standardOutput = new ByteArrayOutputStream() - } +// The method above is to be preferred. Use this method if the filename is not at the end of the URL. +def deobf(String sourceURL, String rawFileName) { +String bon2Version = "2.5.1" +String fileName = URLDecoder.decode(rawFileName, "UTF-8") +String cacheDir = "$project.gradle.gradleUserHomeDir/caches" +String bon2Dir = "$cacheDir/forge_gradle/deobf" +String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" +String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" +String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" +if(file(deobfFile).exists()) { return files(deobfFile) } +String mappingsVer +String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' +if(remoteMappings) { + String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" + String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" + + zipMappings(mappingsZIP, remoteMappings, bon2Dir) + + mappingsVer = "snapshot_$id" +} else { + mappingsVer = "${channel}_$mappingsVersion" +} + +download.run { + src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" + dest bon2File + quiet true + overwrite false +} + +download.run { + src sourceURL + dest obfFile + quiet true + overwrite false +} + +exec { + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' + workingDir bon2Dir + standardOutput = new FileOutputStream("${deobfFile}.log") +} + +return files(deobfFile) +} + +def zipMappings(String zipPath, String url, String bon2Dir) { +File zipFile = new File(zipPath) +if(zipFile.exists()) { + return +} + +String fieldsCache = "$bon2Dir/data/fields.csv" +String methodsCache = "$bon2Dir/data/methods.csv" + +download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true +} +download.run { + src "${url}methods.csv" + dest methodsCache + quiet true +} + +zipFile.getParentFile().mkdirs() +ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) + +zos.putNextEntry(new ZipEntry("fields.csv")) +Files.copy(Paths.get(fieldsCache), zos) +zos.closeEntry() + +zos.putNextEntry(new ZipEntry("methods.csv")) +Files.copy(Paths.get(methodsCache), zos) +zos.closeEntry() + +zos.close() +} + // Helper methods def checkPropertyExists(String propertyName) { - if (project.hasProperty(propertyName) == false) { - throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") - } +if (!project.hasProperty(propertyName)) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") +} } def getFile(String relativePath) { - return new File(projectDir, relativePath) +return new File(projectDir, relativePath) } diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..97d8f71c --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +plugins { + id 'com.diffplug.blowdryerSetup' version '1.6.0' +} + +apply plugin: 'com.diffplug.blowdryerSetup' + +blowdryerSetup { + github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.4') + //devLocal '.' // Use this when testing config updates locally +} diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index e828116c..d79e393d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java +++ b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java @@ -15,11 +15,15 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; -@Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION, canBeDeactivated = false, guiFactory = References.GUIFACTORY, - dependencies = "after:NotEnoughItems;" + - "after:ThermalExpansion;" + - "after:ThermalFoundation;" + - "required-after:BrandonsCore@[1.0.0.11,);") +@Mod( + modid = References.MODID, + name = References.MODNAME, + version = References.VERSION, + canBeDeactivated = false, + guiFactory = References.GUIFACTORY, + dependencies = "after:NotEnoughItems;" + "after:ThermalExpansion;" + + "after:ThermalFoundation;" + + "required-after:BrandonsCore@[1.0.0.11,);") public class DraconicEvolution { @Mod.Instance(References.MODID) @@ -28,13 +32,15 @@ public class DraconicEvolution { @SidedProxy(clientSide = References.CLIENTPROXYLOCATION, serverSide = References.SERVERPROXYLOCATION) public static CommonProxy proxy; - public static CreativeTabs tabToolsWeapons = new DETab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons", 0); - public static CreativeTabs tabBlocksItems = new DETab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems", 1); + public static CreativeTabs tabToolsWeapons = + new DETab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons", 0); + public static CreativeTabs tabBlocksItems = + new DETab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems", 1); public static final String networkChannelName = "DEvolutionNC"; public static SimpleNetworkWrapper network; - public static boolean debug = false;//todo + public static boolean debug = false; // todo public static Enchantment reaperEnchant; @@ -46,16 +52,15 @@ public class DraconicEvolution { public static void preInit(final FMLPreInitializationEvent event) { if (debug) LogHelper.info("Initialization"); -// event.getModMetadata().autogenerated = false; -// event.getModMetadata().credits = ""; -// event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack"; -// event.getModMetadata().authorList = Arrays.asList("brandon3055"); -// event.getModMetadata().logoFile = "banner.png"; -// event.getModMetadata().url = "http://www.brandon3055.com/"; -// event.getModMetadata().version = References.VERSION + "-MC1.7.10"; + // event.getModMetadata().autogenerated = false; + // event.getModMetadata().credits = ""; + // event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack"; + // event.getModMetadata().authorList = Arrays.asList("brandon3055"); + // event.getModMetadata().logoFile = "banner.png"; + // event.getModMetadata().url = "http://www.brandon3055.com/"; + // event.getModMetadata().version = References.VERSION + "-MC1.7.10"; proxy.preInit(event); - } @Mod.EventHandler @@ -75,7 +80,7 @@ public class DraconicEvolution { proxy.postInit(event); } - //FMLInterModComms.sendMessage("DraconicEvolution", "addChestRecipe:item.coal", new ItemStack(Items.diamond, 2)); + // FMLInterModComms.sendMessage("DraconicEvolution", "addChestRecipe:item.coal", new ItemStack(Items.diamond, 2)); @Mod.EventHandler public void processMessage(FMLInterModComms.IMCEvent event) { for (FMLInterModComms.IMCMessage m : event.getMessages()) { @@ -87,4 +92,4 @@ public class DraconicEvolution { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java index 70db6b76..82bafa87 100644 --- a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java +++ b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java @@ -5,9 +5,8 @@ import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet; import com.brandon3055.draconicevolution.common.world.WorldGenEnderIsland; -import net.minecraft.world.World; - import java.util.Random; +import net.minecraft.world.World; /** * Created by Brandon on 11/7/2015. @@ -40,8 +39,10 @@ public class GeneratorOverride { * @param centerZ this should be the center of the area you are spawning the island it (this is the actual zCoord) * @param random a random */ - public static void generateChaosChunk(World world, int chunkX, int chunkZ, int centerX, int centerZ, Random random) { - ChaosWorldGenHandler.generateChunk(world, chunkX, chunkZ, new DataUtills.XZPair(centerX, centerZ), random); + public static void generateChaosChunk( + World world, int chunkX, int chunkZ, int centerX, int centerZ, Random random) { + ChaosWorldGenHandler.generateChunk( + world, chunkX, chunkZ, new DataUtills.XZPair(centerX, centerZ), random); } /** diff --git a/src/main/java/com/brandon3055/draconicevolution/api/package-info.java b/src/main/java/com/brandon3055/draconicevolution/api/package-info.java index bc967e25..0104dfc2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/api/package-info.java +++ b/src/main/java/com/brandon3055/draconicevolution/api/package-info.java @@ -1,6 +1,7 @@ /** * Created by Brandon on 19/03/2015. */ -@API(apiVersion = "1.2", owner = "DraconicEvolution", provides = "DraconicEvolution|API") package com.brandon3055.draconicevolution.api; +@API(apiVersion = "1.2", owner = "DraconicEvolution", provides = "DraconicEvolution|API") +package com.brandon3055.draconicevolution.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/com/brandon3055/draconicevolution/client/ClientProxy.java b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java index 5130f6b7..df666cef 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java @@ -49,7 +49,7 @@ import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; public class ClientProxy extends CommonProxy { - private final static boolean debug = DraconicEvolution.debug; + private static final boolean debug = DraconicEvolution.debug; public static String downloadLocation; @Override @@ -59,52 +59,52 @@ public class ClientProxy extends CommonProxy { ResourceHandler.init(event); -// downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/mods/derspack"; -// downloadLocation = downloadLocation.replaceAll("\\\\", "/"); -// -// File rescourcePack = new File(event.getModConfigurationDirectory().getParentFile(), "/mods/derspack"); -// -// -// //File file = new File(downloadLocation); -// if (!rescourcePack.exists()) rescourcePack.mkdir(); -// -// LogHelper.info("Downloading Images"); -// -// try { -// URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); -// String fileName = url.getFile(); -// //String destName = downloadLocation + fileName.substring(fileName.lastIndexOf("/")); -// File dll = new File(rescourcePack, fileName.substring(fileName.lastIndexOf("/"))); -// -// InputStream is = url.openStream(); -// OutputStream os = new FileOutputStream(dll); -// -// ByteStreams.copy(is, os); -// -// is.close(); -// os.close(); -// }catch (IOException e){ -// LogHelper.info(e); -// } -// -// -// List defaultResourcePacks = Lists.newArrayList(); -// Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao"); -// f.setAccessible(true); -// try { -// defaultResourcePacks = (List)f.get(Minecraft.getMinecraft()); -// defaultResourcePacks.add(new FolderResourcePack(rescourcePack)); -// for (Object o : defaultResourcePacks){ -// if (o instanceof FolderResourcePack) LogHelper.info(((FolderResourcePack) o).getPackName()); -// if (o instanceof FileResourcePack) LogHelper.info(((FileResourcePack)o).getPackName()); -// } -// -// f.set(Minecraft.getMinecraft(), defaultResourcePacks); -// } -// catch (IllegalAccessException e) { -// e.printStackTrace(); -// } - + // downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + + // "/mods/derspack"; + // downloadLocation = downloadLocation.replaceAll("\\\\", "/"); + // + // File rescourcePack = new File(event.getModConfigurationDirectory().getParentFile(), "/mods/derspack"); + // + // + // //File file = new File(downloadLocation); + // if (!rescourcePack.exists()) rescourcePack.mkdir(); + // + // LogHelper.info("Downloading Images"); + // + // try { + // URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); + // String fileName = url.getFile(); + // //String destName = downloadLocation + fileName.substring(fileName.lastIndexOf("/")); + // File dll = new File(rescourcePack, fileName.substring(fileName.lastIndexOf("/"))); + // + // InputStream is = url.openStream(); + // OutputStream os = new FileOutputStream(dll); + // + // ByteStreams.copy(is, os); + // + // is.close(); + // os.close(); + // }catch (IOException e){ + // LogHelper.info(e); + // } + // + // + // List defaultResourcePacks = Lists.newArrayList(); + // Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao"); + // f.setAccessible(true); + // try { + // defaultResourcePacks = (List)f.get(Minecraft.getMinecraft()); + // defaultResourcePacks.add(new FolderResourcePack(rescourcePack)); + // for (Object o : defaultResourcePacks){ + // if (o instanceof FolderResourcePack) LogHelper.info(((FolderResourcePack) o).getPackName()); + // if (o instanceof FileResourcePack) LogHelper.info(((FileResourcePack)o).getPackName()); + // } + // + // f.set(Minecraft.getMinecraft(), defaultResourcePacks); + // } + // catch (IllegalAccessException e) { + // e.printStackTrace(); + // } } @@ -113,7 +113,8 @@ public class ClientProxy extends CommonProxy { super.init(event); FMLCommonHandler.instance().bus().register(new KeyInputHandler()); FMLCommonHandler.instance().bus().register(new ClientEventHandler()); - if (ConfigHandler.enableVersionChecker) FMLCommonHandler.instance().bus().register(new UpdateChecker()); + if (ConfigHandler.enableVersionChecker) + FMLCommonHandler.instance().bus().register(new UpdateChecker()); MinecraftForge.EVENT_BUS.register(new HudHandler()); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); KeyBindings.init(); @@ -129,7 +130,7 @@ public class ClientProxy extends CommonProxy { } public void registerRendering() { - //Item Renderers + // Item Renderers MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBow()); MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBow()); MinecraftForgeClient.registerItemRenderer(ModItems.mobSoul, new RenderMobSoul()); @@ -149,38 +150,83 @@ public class ClientProxy extends CommonProxy { } if (!ConfigHandler.useOldD2DToolTextures) { - MinecraftForgeClient.registerItemRenderer(ModItems.draconicSword, new RenderTool("models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak) ModItems.draconicSword)); - MinecraftForgeClient.registerItemRenderer(ModItems.wyvernPickaxe, new RenderTool("models/tools/Pickaxe.obj", "textures/models/tools/Pickaxe.png", (IRenderTweak) ModItems.wyvernPickaxe)); - MinecraftForgeClient.registerItemRenderer(ModItems.draconicPickaxe, new RenderTool("models/tools/DraconicPickaxe.obj", "textures/models/tools/DraconicPickaxe.png", (IRenderTweak) ModItems.draconicPickaxe)); - MinecraftForgeClient.registerItemRenderer(ModItems.draconicAxe, new RenderTool("models/tools/DraconicLumberAxe.obj", "textures/models/tools/DraconicLumberAxe.png", (IRenderTweak) ModItems.draconicAxe)); - MinecraftForgeClient.registerItemRenderer(ModItems.wyvernShovel, new RenderTool("models/tools/Shovel.obj", "textures/models/tools/Shovel.png", (IRenderTweak) ModItems.wyvernShovel)); - MinecraftForgeClient.registerItemRenderer(ModItems.draconicShovel, new RenderTool("models/tools/DraconicShovel.obj", "textures/models/tools/DraconicShovel.png", (IRenderTweak) ModItems.draconicShovel)); - MinecraftForgeClient.registerItemRenderer(ModItems.wyvernSword, new RenderTool("models/tools/Sword.obj", "textures/models/tools/Sword.png", (IRenderTweak) ModItems.wyvernSword)); - MinecraftForgeClient.registerItemRenderer(ModItems.draconicDestructionStaff, new RenderTool("models/tools/DraconicStaffOfPower.obj", "textures/models/tools/DraconicStaffOfPower.png", (IRenderTweak) ModItems.draconicDestructionStaff)); - MinecraftForgeClient.registerItemRenderer(ModItems.draconicHoe, new RenderTool("models/tools/DraconicHoe.obj", "textures/models/tools/DraconicHoe.png", (IRenderTweak) ModItems.draconicHoe)); + MinecraftForgeClient.registerItemRenderer( + ModItems.draconicSword, + new RenderTool( + "models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak) + ModItems.draconicSword)); + MinecraftForgeClient.registerItemRenderer( + ModItems.wyvernPickaxe, + new RenderTool("models/tools/Pickaxe.obj", "textures/models/tools/Pickaxe.png", (IRenderTweak) + ModItems.wyvernPickaxe)); + MinecraftForgeClient.registerItemRenderer( + ModItems.draconicPickaxe, + new RenderTool( + "models/tools/DraconicPickaxe.obj", + "textures/models/tools/DraconicPickaxe.png", + (IRenderTweak) ModItems.draconicPickaxe)); + MinecraftForgeClient.registerItemRenderer( + ModItems.draconicAxe, + new RenderTool( + "models/tools/DraconicLumberAxe.obj", + "textures/models/tools/DraconicLumberAxe.png", + (IRenderTweak) ModItems.draconicAxe)); + MinecraftForgeClient.registerItemRenderer( + ModItems.wyvernShovel, + new RenderTool("models/tools/Shovel.obj", "textures/models/tools/Shovel.png", (IRenderTweak) + ModItems.wyvernShovel)); + MinecraftForgeClient.registerItemRenderer( + ModItems.draconicShovel, + new RenderTool( + "models/tools/DraconicShovel.obj", + "textures/models/tools/DraconicShovel.png", + (IRenderTweak) ModItems.draconicShovel)); + MinecraftForgeClient.registerItemRenderer( + ModItems.wyvernSword, + new RenderTool("models/tools/Sword.obj", "textures/models/tools/Sword.png", (IRenderTweak) + ModItems.wyvernSword)); + MinecraftForgeClient.registerItemRenderer( + ModItems.draconicDestructionStaff, + new RenderTool( + "models/tools/DraconicStaffOfPower.obj", + "textures/models/tools/DraconicStaffOfPower.png", + (IRenderTweak) ModItems.draconicDestructionStaff)); + MinecraftForgeClient.registerItemRenderer( + ModItems.draconicHoe, + new RenderTool( + "models/tools/DraconicHoe.obj", "textures/models/tools/DraconicHoe.png", (IRenderTweak) + ModItems.draconicHoe)); MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBowModel(true)); MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBowModel(false)); } - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyCrystal), new RenderCrystal()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorStabilizer), new RenderReactorStabilizer()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), new RenderReactorEnergyInjector()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.upgradeModifier), new RenderUpgradeModifier()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.reactorStabilizer), new RenderReactorStabilizer()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), new RenderReactorEnergyInjector()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard()); + MinecraftForgeClient.registerItemRenderer( + Item.getItemFromBlock(ModBlocks.upgradeModifier), new RenderUpgradeModifier()); - //ISimpleBlockRendering + // ISimpleBlockRendering RenderingRegistry.registerBlockHandler(new RenderTeleporterStand()); RenderingRegistry.registerBlockHandler(new RenderPortal()); - //TileEntitySpecialRenderers + // TileEntitySpecialRenderers ClientRegistry.bindTileEntitySpecialRenderer(TileParticleGenerator.class, new RenderTileParticleGen()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyInfuser.class, new RenderTileEnergyInfiser()); ClientRegistry.bindTileEntitySpecialRenderer(TileCustomSpawner.class, new RenderTileCustomSpawner()); - //ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileCrystal()); + // ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileCrystal()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyStorageCore.class, new RenderTileEnergyStorageCore()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyPylon.class, new RenderTileEnergyPylon()); ClientRegistry.bindTileEntitySpecialRenderer(TilePlacedItem.class, new RenderTilePlacedItem()); @@ -192,11 +238,12 @@ public class ClientProxy extends CommonProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileWirelessEnergyTransceiver.class, new RenderTileCrystal()); ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore()); ClientRegistry.bindTileEntitySpecialRenderer(TileReactorStabilizer.class, new RenderTileReactorStabilizer()); - ClientRegistry.bindTileEntitySpecialRenderer(TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector()); + ClientRegistry.bindTileEntitySpecialRenderer( + TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector()); ClientRegistry.bindTileEntitySpecialRenderer(TileChaosShard.class, new RenderTileChaosShard()); ClientRegistry.bindTileEntitySpecialRenderer(TileUpgradeModifier.class, new RenderTileUpgradeModifier()); - //Entitys + // Entitys RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new RenderDragon()); RenderingRegistry.registerEntityRenderingHandler(EntityChaosGuardian.class, new RenderDragon()); RenderingRegistry.registerEntityRenderingHandler(EntityDragonHeart.class, new RenderDragonHeart()); @@ -212,7 +259,19 @@ public class ClientProxy extends CommonProxy { } @Override - public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType) { + public ParticleEnergyBeam energyBeam( + World worldObj, + double x, + double y, + double z, + double tx, + double ty, + double tz, + int powerFlow, + boolean advanced, + ParticleEnergyBeam oldBeam, + boolean render, + int beamType) { if (!worldObj.isRemote) return null; ParticleEnergyBeam beam = oldBeam; boolean inRange = ParticleHandler.isInRange(x, y, z, 50) || ParticleHandler.isInRange(tx, ty, tz, 50); @@ -233,7 +292,15 @@ public class ClientProxy extends CommonProxy { } @Override - public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, ParticleEnergyField oldBeam, boolean render) { + public ParticleEnergyField energyField( + World worldObj, + double x, + double y, + double z, + int type, + boolean advanced, + ParticleEnergyField oldBeam, + boolean render) { if (!worldObj.isRemote) return null; ParticleEnergyField beam = oldBeam; boolean inRange = ParticleHandler.isInRange(x, y, z, 50); @@ -274,7 +341,6 @@ public class ClientProxy extends CommonProxy { return beam; } - public boolean isOp(String paramString) { return Minecraft.getMinecraft().theWorld.getWorldInfo().getGameType().isCreative(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java b/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java index 721ceb3d..df9fa498 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java @@ -36,16 +36,24 @@ public class ReactorSound extends PositionedSound implements ITickableSound { if (tile.reactionTemperature > 8000) { volume += (float) ((tile.reactionTemperature - 8000D) / 1000D); } - if (tile.reactionTemperature > 2000 && tile.maxFieldCharge > 0 && tile.fieldCharge < (tile.maxFieldCharge * 0.2D)) { + if (tile.reactionTemperature > 2000 + && tile.maxFieldCharge > 0 + && tile.fieldCharge < (tile.maxFieldCharge * 0.2D)) { volume += 2D - ((tile.fieldCharge / tile.maxFieldCharge) * 10D); } - if (tile.reactionTemperature > 2000 && tile.reactorFuel + tile.convertedFuel > 0 && tile.reactorFuel < (double) (tile.reactorFuel + tile.convertedFuel) * 0.2D) { + if (tile.reactionTemperature > 2000 + && tile.reactorFuel + tile.convertedFuel > 0 + && tile.reactorFuel < (double) (tile.reactorFuel + tile.convertedFuel) * 0.2D) { volume += 2D - ((tile.reactorFuel / (tile.reactorFuel + tile.convertedFuel)) * 10D); } field_147663_c = 0.5F + volume / 2F; - if (tile.isInvalid() || !tile.getWorldObj().getChunkFromBlockCoords(tile.xCoord, tile.zCoord).isChunkLoaded) {// || player == null || tile.getDistanceFrom(player.posX, player.posY, player.posZ) > 512){ + if (tile.isInvalid() + || !tile.getWorldObj() + .getChunkFromBlockCoords(tile.xCoord, tile.zCoord) + .isChunkLoaded) { // || player == null || tile.getDistanceFrom(player.posX, player.posY, + // player.posZ) > 512){ donePlaying = true; repeat = false; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java b/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java index 936205c9..5670ff03 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java @@ -1,7 +1,7 @@ package com.brandon3055.draconicevolution.client.creativetab; -import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -18,7 +18,8 @@ public class DETab extends CreativeTabs { public static void initialize() { if (ModItems.isEnabled(ModItems.draconicDestructionStaff)) - iconStackStaff = ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 30000000); + iconStackStaff = + ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 30000000); else iconStackStaff = new ItemStack(Items.stick); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java index 4569af49..abc1a961 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java @@ -12,10 +12,15 @@ import net.minecraftforge.common.config.Configuration; */ public class ConfigGUI extends GuiConfig { public ConfigGUI(GuiScreen parent) { - super(parent, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), References.MODID, false, false, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString())); + super( + parent, + new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), + References.MODID, + false, + false, + GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString())); configElements.addAll(new ConfigElement(ConfigHandler.config.getCategory("spawner")).getChildElements()); - configElements.addAll(new ConfigElement(ConfigHandler.config.getCategory("long range dislocator")).getChildElements()); + configElements.addAll( + new ConfigElement(ConfigHandler.config.getCategory("long range dislocator")).getChildElements()); } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java index ded293b2..86d7cc21 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java @@ -1,11 +1,10 @@ package com.brandon3055.draconicevolution.client.gui; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; +import org.lwjgl.opengl.GL11; public class CustomGuiButton extends GuiButton { @@ -18,13 +17,22 @@ public class CustomGuiButton extends GuiButton { FontRenderer fontrenderer = minecraft.fontRenderer; minecraft.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height; + this.field_146123_n = p_146112_2_ >= this.xPosition + && p_146112_3_ >= this.yPosition + && p_146112_2_ < this.xPosition + this.width + && p_146112_3_ < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height); - this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height); + this.drawTexturedModalRect( + this.xPosition + this.width / 2, + this.yPosition, + 200 - this.width / 2, + 46 + k * 20, + this.width / 2, + this.height); this.mouseDragged(minecraft, p_146112_2_, p_146112_3_); int l = 14737632; @@ -36,8 +44,12 @@ public class CustomGuiButton extends GuiButton { l = 16777120; } - this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); + this.drawCenteredString( + fontrenderer, + this.displayString, + this.xPosition + this.width / 2, + this.yPosition + (this.height - 8) / 2, + l); } } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java index 8c0eb50c..f6909481 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java @@ -1,19 +1,16 @@ package com.brandon3055.draconicevolution.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; - /** * Created by Brandon on 6/08/2014. */ public class DEGUIFactory implements IModGuiFactory { @Override - public void initialize(Minecraft minecraftInstance) { - - } + public void initialize(Minecraft minecraftInstance) {} @Override public Class mainConfigGuiClass() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java index 540dbb92..ada161d3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java @@ -29,42 +29,37 @@ public class GUIContainerTemplate extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - } @Override protected void drawGuiContainerForegroundLayer(int x, int y) { fontRendererObj.drawStringWithShadow("Energy Infuser", 49, -9, 0x00FFFF); - //bindTexture(texture); + // bindTexture(texture); - //fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); + // fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); } @Override public void initGui() { super.initGui(); - } @Override - protected void actionPerformed(GuiButton button) { - - - } + protected void actionPerformed(GuiButton button) {} @Override public void updateScreen() { super.updateScreen(); - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java index f374597a..587ba633 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java @@ -34,19 +34,24 @@ public class GUIDissEnchanter extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DissEnchanter.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DissEnchanter.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - } @Override protected void drawGuiContainerForegroundLayer(int x, int y) { - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("tile.draconicevolution:dissEnchanter.name"), 88, 4, 0x00FFFF); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("tile.draconicevolution:dissEnchanter.name"), + 88, + 4, + 0x00FFFF); fontRendererObj.drawString("Item", 5, 40, 0x0000ff); fontRendererObj.drawString("Damage: " + (40 - tile.bookPower) + "%", 5, 49, 0x0000ff); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java index 11fd70ce..6992d937 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java @@ -13,6 +13,9 @@ import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -25,17 +28,15 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - @SideOnly(Side.CLIENT) @Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems") public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler { public EntityPlayer player; private TileDraconiumChest tile; - private static final ResourceLocation textureLeft = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DraconicChestLeft.png"); - private static final ResourceLocation textureRight = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DraconicChestRight.png"); + private static final ResourceLocation textureLeft = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DraconicChestLeft.png"); + private static final ResourceLocation textureRight = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DraconicChestRight.png"); private int lastAutoFeed = -1; public GUIDraconiumChest(InventoryPlayer invPlayer, TileDraconiumChest tile) { @@ -67,24 +68,29 @@ public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler { } int arrowHight = (int) (((float) tile.smeltingProgressTime / (float) tile.smeltingCompleateTime) * 22f); - drawTexturedModalRect(guiLeft + 140, guiTop + 192 + 22 - arrowHight, 140, 216 + 22 - arrowHight, 16, arrowHight); + drawTexturedModalRect( + guiLeft + 140, guiTop + 192 + 22 - arrowHight, 140, 216 + 22 - arrowHight, 16, arrowHight); Minecraft.getMinecraft().getTextureManager().bindTexture(textureRight); - int energyWidth = (int) (((float) tile.getEnergyStored(ForgeDirection.DOWN) / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN)) * 90f); + int energyWidth = (int) (((float) tile.getEnergyStored(ForgeDirection.DOWN) + / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN)) + * 90f); drawTexturedModalRect(guiLeft + 44, guiTop + 235, 131, 236, energyWidth, 16); int flameHight = (int) (((float) tile.smeltingBurnSpeed / (float) tile.smeltingMaxBurnSpeed) * 13f); - //flameHight = tile.smeltingProgressTime <= 0 ? 0 : Math.min(flameHight, 13); + // flameHight = tile.smeltingProgressTime <= 0 ? 0 : Math.min(flameHight, 13); drawTexturedModalRect(guiLeft + 45, guiTop + 217 + 13 - flameHight, 132, 180 + 13 - flameHight, 88, flameHight); } @Override protected void drawGuiContainerForegroundLayer(int x, int y) { fontRendererObj.drawString(tile.getInventoryName(), 4, 4, 0x222222); - //fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("button.de.chestAutoFeed.txt"), 4, 180, 0x00FFFF); + // fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("button.de.chestAutoFeed.txt"), 4, 180, + // 0x00FFFF); ArrayList list = new ArrayList(); - list.add(String.valueOf(tile.getEnergyStored(ForgeDirection.DOWN)) + "/" + String.valueOf(tile.getMaxEnergyStored(ForgeDirection.DOWN)) + "RF"); + list.add(String.valueOf(tile.getEnergyStored(ForgeDirection.DOWN)) + "/" + + String.valueOf(tile.getMaxEnergyStored(ForgeDirection.DOWN)) + "RF"); if (GuiHelper.isInRect(44, 235, 90, 16, x - guiLeft, y - guiTop)) drawHoveringText(list, x - guiLeft, y - guiTop, fontRendererObj); list.clear(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java index 2b85acbd..d33bb0d2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java @@ -7,6 +7,8 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -17,9 +19,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; -import java.util.Random; - @SideOnly(Side.CLIENT) public class GUIEnergyInfuser extends GuiContainer { @@ -37,7 +36,8 @@ public class GUIEnergyInfuser extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/EnergyInfuser.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/EnergyInfuser.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { @@ -45,16 +45,33 @@ public class GUIEnergyInfuser extends GuiContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); if (tile.getStackInSlot(0) == null) - drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18);//fuel box - + drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18); // fuel box float power = (float) tile.energy.getEnergyStored() / (float) tile.energy.getMaxEnergyStored() * -1F + 1F; - drawTexturedModalRect(guiLeft + 49, guiTop + 7 + (int) (power * 45), xSize, (int) (power * 45), 8, 45 - (int) (power * 45));//Power bar + drawTexturedModalRect( + guiLeft + 49, + guiTop + 7 + (int) (power * 45), + xSize, + (int) (power * 45), + 8, + 45 - (int) (power * 45)); // Power bar - if (tile.running && tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IEnergyContainerItem) { - IEnergyContainerItem item = (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); - float charge = (float) item.getEnergyStored(tile.getStackInSlot(0)) / (float) item.getMaxEnergyStored(tile.getStackInSlot(0)) * -1F + 1F; - drawTexturedModalRect(guiLeft + 119, guiTop + 7 + (int) (charge * 45), xSize, (int) (charge * 45), 8, 45 - (int) (charge * 45));//Item Power bar + if (tile.running + && tile.getStackInSlot(0) != null + && tile.getStackInSlot(0).getItem() instanceof IEnergyContainerItem) { + IEnergyContainerItem item = + (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); + float charge = (float) item.getEnergyStored(tile.getStackInSlot(0)) + / (float) item.getMaxEnergyStored(tile.getStackInSlot(0)) + * -1F + + 1F; + drawTexturedModalRect( + guiLeft + 119, + guiTop + 7 + (int) (charge * 45), + xSize, + (int) (charge * 45), + 8, + 45 - (int) (charge * 45)); // Item Power bar } drawAnimatedParts(); @@ -64,12 +81,11 @@ public class GUIEnergyInfuser extends GuiContainer { protected void drawGuiContainerForegroundLayer(int x, int y) { fontRendererObj.drawStringWithShadow("Energy Infuser", 49, -9, 0x00FFFF); + // bindTexture(texture); - //bindTexture(texture); - - //fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); + // fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); } @@ -83,37 +99,39 @@ public class GUIEnergyInfuser extends GuiContainer { public void initGui() { super.initGui(); - //ID - //buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); + // ID + // buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); } @Override - protected void actionPerformed(GuiButton button) { - - - } + protected void actionPerformed(GuiButton button) {} @Override public void updateScreen() { super.updateScreen(); - } private void drawEnergyBarHoverText(int x, int y) { if (GuiHelper.isInRect(48, 6, 9, 46, x, y)) { ArrayList internal = new ArrayList(); internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt")); - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.energy.getEnergyStored() + "/" + tile.energy.getMaxEnergyStored()); + internal.add("" + EnumChatFormatting.DARK_BLUE + tile.energy.getEnergyStored() + "/" + + tile.energy.getMaxEnergyStored()); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); GL11.glPopAttrib(); } - if (GuiHelper.isInRect(118, 6, 10, 46, x, y) && tile.running && tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IEnergyContainerItem) { - IEnergyContainerItem item = (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); + if (GuiHelper.isInRect(118, 6, 10, 46, x, y) + && tile.running + && tile.getStackInSlot(0) != null + && tile.getStackInSlot(0).getItem() instanceof IEnergyContainerItem) { + IEnergyContainerItem item = + (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); ArrayList internal = new ArrayList(); internal.add(StatCollector.translateToLocal("gui.de.itemStorage.txt")); - internal.add("" + EnumChatFormatting.DARK_BLUE + item.getEnergyStored(tile.getStackInSlot(0)) + "/" + item.getMaxEnergyStored(tile.getStackInSlot(0))); + internal.add("" + EnumChatFormatting.DARK_BLUE + item.getEnergyStored(tile.getStackInSlot(0)) + "/" + + item.getMaxEnergyStored(tile.getStackInSlot(0))); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); GL11.glPopAttrib(); @@ -126,7 +144,7 @@ public class GUIEnergyInfuser extends GuiContainer { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glTranslatef(guiLeft + 62, guiTop + 4, 0); - {//Draw Ring + { // Draw Ring GL11.glTranslatef(26, 26, 0); GL11.glRotatef(rotation, 0, 0, 1); GL11.glTranslatef(-26, -26, 0); @@ -169,12 +187,9 @@ public class GUIEnergyInfuser extends GuiContainer { drawTexturedModalRect(0, 0, 0, 173, 26, 8); } } - } - GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java index a76d3c13..fdd4d39d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java @@ -4,15 +4,14 @@ import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 30/6/2015. */ @@ -46,24 +45,60 @@ public class GUIFlowGate extends GuiScreen { drawDefaultBackground(); ResourceHandler.bindResource("textures/gui/ToolConfig.png"); drawTexturedModalRect(guiLeft, guiTop, 0, 0, 197, 88); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGate.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGate.name")) / 2), guiTop + 5, 0x2c2c2c); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.flowGate.name"), + guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGate.name")) / 2), + guiTop + 5, + 0x2c2c2c); if (!tile.flowOverridden) { String flowRSLow = tile.getFlowSetting(0); String flowRSHeigh = tile.getFlowSetting(1); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name")) / 2), guiTop + 20, 0xff0000); - fontRendererObj.drawString(flowRSHeigh, guiCrt - (fontRendererObj.getStringWidth(flowRSHeigh) / 2), guiTop + 31, 0x2c2c2c); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSLow.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSLow.name")) / 2), guiTop + 50, 0x660000); - fontRendererObj.drawString(flowRSLow, guiCrt - (fontRendererObj.getStringWidth(flowRSLow) / 2), guiTop + 61, 0x2c2c2c); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.flowGateRSHigh.name"), + guiCrt + - (fontRendererObj.getStringWidth( + StatCollector.translateToLocal("gui.de.flowGateRSHigh.name")) + / 2), + guiTop + 20, + 0xff0000); + fontRendererObj.drawString( + flowRSHeigh, guiCrt - (fontRendererObj.getStringWidth(flowRSHeigh) / 2), guiTop + 31, 0x2c2c2c); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.flowGateRSLow.name"), + guiCrt + - (fontRendererObj.getStringWidth( + StatCollector.translateToLocal("gui.de.flowGateRSLow.name")) + / 2), + guiTop + 50, + 0x660000); + fontRendererObj.drawString( + flowRSLow, guiCrt - (fontRendererObj.getStringWidth(flowRSLow) / 2), guiTop + 61, 0x2c2c2c); } else - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.flowGateOverridden.txt"), width / 2, height / 2 - 30, 0x00FF00); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.flowGateOverridden.txt"), + width / 2, + height / 2 - 30, + 0x00FF00); - String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": " + Utills.addCommas(tile.getActualFlow()); + String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": " + + Utills.addCommas(tile.getActualFlow()); fontRendererObj.drawString(flow, guiCrt - (fontRendererObj.getStringWidth(flow) / 2), guiTop + 76, 0x2c2c2c); if (!tile.flowOverridden) { - fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.flowGatePartialSignal.name"), guiLeft + 5, guiTop + 90, 197, 0xFFFFFF); - fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.ctrlAndShift.name"), guiLeft + 200, guiTop + 5, 100, 0xFFFFFF); + fontRendererObj.drawSplitString( + StatCollector.translateToLocal("gui.de.flowGatePartialSignal.name"), + guiLeft + 5, + guiTop + 90, + 197, + 0xFFFFFF); + fontRendererObj.drawSplitString( + StatCollector.translateToLocal("gui.de.ctrlAndShift.name"), + guiLeft + 200, + guiTop + 5, + 100, + 0xFFFFFF); ResourceHandler.bindResource("textures/gui/Widgets.png"); super.drawScreen(x, y, pt); @@ -73,22 +108,36 @@ public class GUIFlowGate extends GuiScreen { boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)); + hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + + tile.getToolTip(1, shift, ctrl)); } if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(1, shift, ctrl)); + hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + + tile.getToolTip(1, shift, ctrl)); } if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(0, shift, ctrl)); + hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + + tile.getToolTip(0, shift, ctrl)); } if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(0, shift, ctrl)); + hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + + tile.getToolTip(0, shift, ctrl)); } if (!hoverText.isEmpty()) { hoverText.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gui.de.pressOrScroll.name")); - drawHoveringText(hoverText, x - (x < width / 2 ? fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)) + 25 : 0), y, fontRendererObj); + drawHoveringText( + hoverText, + x + - (x < width / 2 + ? fontRendererObj.getStringWidth( + StatCollector.translateToLocal("gui.de.decrement.name") + " " + + tile.getToolTip(1, shift, ctrl)) + + 25 + : 0), + y, + fontRendererObj); } } } @@ -155,5 +204,4 @@ public class GUIFlowGate extends GuiScreen { this.mc.setIngameFocus(); } } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java index 646c94ee..915af500 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java @@ -1,11 +1,12 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.draconicevolution.common.container.ContainerGenerator; import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.common.container.ContainerGenerator; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -16,8 +17,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; - @SideOnly(Side.CLIENT) public class GUIGenerator extends GuiContainer { @@ -35,7 +34,8 @@ public class GUIGenerator extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/GGrinder.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/GGrinder.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int X, int Y) { @@ -43,16 +43,31 @@ public class GUIGenerator extends GuiContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - drawTexturedModalRect(guiLeft + 63, guiTop + 34, 0, ySize, 18, 18);//fuel box - drawTexturedModalRect(guiLeft + 97, guiTop + 34, 18, ySize, 18, 18);//flame box + drawTexturedModalRect(guiLeft + 63, guiTop + 34, 0, ySize, 18, 18); // fuel box + drawTexturedModalRect(guiLeft + 97, guiTop + 34, 18, ySize, 18, 18); // flame box if (tile.getStackInSlot(0) == null) - drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18);//fuel box + drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18); // fuel box - float power = (float) tile.getEnergyStored(ForgeDirection.DOWN) / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) * -1 + 1; + float power = (float) tile.getEnergyStored(ForgeDirection.DOWN) + / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) + * -1 + + 1; float fuel = tile.burnTimeRemaining / ((float) tile.burnTime) * -1 + 1; - drawTexturedModalRect(guiLeft + 83, guiTop + 11 + (int) (power * 40), xSize, 0 + (int) (power * 40), 12, 40 - (int) (power * 40));//Power bar - drawTexturedModalRect(guiLeft + 100, guiTop + 37 + (int) (fuel * 13), xSize, 40 + (int) (fuel * 13), 18, 18 - (int) (fuel * 13));//Power bar + drawTexturedModalRect( + guiLeft + 83, + guiTop + 11 + (int) (power * 40), + xSize, + 0 + (int) (power * 40), + 12, + 40 - (int) (power * 40)); // Power bar + drawTexturedModalRect( + guiLeft + 100, + guiTop + 37 + (int) (fuel * 13), + xSize, + 40 + (int) (fuel * 13), + 18, + 18 - (int) (fuel * 13)); // Power bar fontRendererObj.drawStringWithShadow("Generator", guiLeft + 64, guiTop + 0, 0x00FFFF); @@ -61,7 +76,8 @@ public class GUIGenerator extends GuiContainer { if (GuiHelper.isInRect(83, 10, 12, 40, x, y)) { ArrayList internal = new ArrayList(); internal.add("Internal Storage"); - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" + tile.getMaxEnergyStored(ForgeDirection.UP)); + internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" + + tile.getMaxEnergyStored(ForgeDirection.UP)); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); } } @@ -71,28 +87,25 @@ public class GUIGenerator extends GuiContainer { int x = X - guiLeft; int y = Y - guiTop; - /* if (GuiHelper.isInRect(83, 10, 95, 50, x, y)) { - ArrayList internal = new ArrayList(); - internal.add("Internal Storage"); - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" + tile.getMaxEnergyStored(ForgeDirection.UP)); - drawHoveringText(internal, x, y, fontRendererObj); - } -*/ + /* if (GuiHelper.isInRect(83, 10, 95, 50, x, y)) { + ArrayList internal = new ArrayList(); + internal.add("Internal Storage"); + internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" + tile.getMaxEnergyStored(ForgeDirection.UP)); + drawHoveringText(internal, x, y, fontRendererObj); + } + */ } @Override public void initGui() { super.initGui(); - //ID - //buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); + // ID + // buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); } @Override - protected void actionPerformed(GuiButton button) { - - - } + protected void actionPerformed(GuiButton button) {} @Override public void updateScreen() { @@ -102,9 +115,8 @@ public class GUIGenerator extends GuiContainer { guiUpdateTick = 0; } super.updateScreen(); - } // ####Draw at############ read from size - //drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38); + // drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java index fa9484b4..20431a04 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java @@ -1,11 +1,12 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.draconicevolution.common.container.ContainerGrinder; import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.common.container.ContainerGrinder; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -16,8 +17,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; - @SideOnly(Side.CLIENT) public class GUIGrinder extends GuiContainer { @@ -35,7 +34,8 @@ public class GUIGrinder extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/GGrinder.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/GGrinder.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int X, int Y) { @@ -43,21 +43,39 @@ public class GUIGrinder extends GuiContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - if (!tile.isExternallyPowered()) drawTexturedModalRect(guiLeft + 63, guiTop + 34, 0, ySize, 18, 18);//fuel box - drawTexturedModalRect(guiLeft + 97, guiTop + 34, 18, ySize, 18, 18);//flame box + if (!tile.isExternallyPowered()) drawTexturedModalRect(guiLeft + 63, guiTop + 34, 0, ySize, 18, 18); // fuel box + drawTexturedModalRect(guiLeft + 97, guiTop + 34, 18, ySize, 18, 18); // flame box if (tile.getStackInSlot(0) == null && !tile.isExternallyPowered()) - drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18);//fuel box + drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18); // fuel box float power; if (tile.isExternallyPowered()) { - power = (float) tile.getEnergyStored(ForgeDirection.DOWN) / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) * -1 + 1; + power = (float) tile.getEnergyStored(ForgeDirection.DOWN) + / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) + * -1 + + 1; } else { - power = (float) tile.getInternalBuffer().getEnergyStored() / (float) tile.getInternalBuffer().getMaxEnergyStored() * -1 + 1; + power = (float) tile.getInternalBuffer().getEnergyStored() + / (float) tile.getInternalBuffer().getMaxEnergyStored() + * -1 + + 1; } float fuel = tile.burnTimeRemaining / ((float) tile.burnTime) * -1 + 1; - drawTexturedModalRect(guiLeft + 83, guiTop + 11 + (int) (power * 40), xSize, 0 + (int) (power * 40), 12, 40 - (int) (power * 40));//Power bar - drawTexturedModalRect(guiLeft + 100, guiTop + 37 + (int) (fuel * 13), xSize, 40 + (int) (fuel * 13), 18, 18 - (int) (fuel * 13));//Power bar + drawTexturedModalRect( + guiLeft + 83, + guiTop + 11 + (int) (power * 40), + xSize, + 0 + (int) (power * 40), + 12, + 40 - (int) (power * 40)); // Power bar + drawTexturedModalRect( + guiLeft + 100, + guiTop + 37 + (int) (fuel * 13), + xSize, + 40 + (int) (fuel * 13), + 18, + 18 - (int) (fuel * 13)); // Power bar if (tile.isExternallyPowered()) drawTexturedModalRect(guiLeft + 100, guiTop + 37, xSize, 66, 13, 13); fontRendererObj.drawStringWithShadow("Grinder", guiLeft + 71, guiTop + 0, 0x00FFFF); @@ -68,9 +86,12 @@ public class GUIGrinder extends GuiContainer { ArrayList internal = new ArrayList(); internal.add("Energy Buffer"); if (tile.isExternallyPowered()) { - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" + tile.getMaxEnergyStored(ForgeDirection.UP)); + internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" + + tile.getMaxEnergyStored(ForgeDirection.UP)); } else { - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getInternalBuffer().getEnergyStored() + "/" + tile.getInternalBuffer().getMaxEnergyStored()); + internal.add("" + EnumChatFormatting.DARK_BLUE + + tile.getInternalBuffer().getEnergyStored() + "/" + + tile.getInternalBuffer().getMaxEnergyStored()); } drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); } @@ -78,9 +99,9 @@ public class GUIGrinder extends GuiContainer { @Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - //fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); + // fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); } @@ -88,15 +109,12 @@ public class GUIGrinder extends GuiContainer { public void initGui() { super.initGui(); - //ID - //buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); + // ID + // buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); } @Override - protected void actionPerformed(GuiButton button) { - - - } + protected void actionPerformed(GuiButton button) {} @Override public void updateScreen() { @@ -106,9 +124,8 @@ public class GUIGrinder extends GuiContainer { guiUpdateTick = 0; } super.updateScreen(); - } // ####Draw at############ read from size - //drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38); + // drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java index 32b7c2bf..f8e9240c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java @@ -16,12 +16,13 @@ import org.lwjgl.opengl.GL11; public class GUIParticleGenerator extends GuiScreen { private final int xSize = 212; private final int ySize = 198; - private ResourceLocation guiTexture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/ParticleGenerator.png"); + private ResourceLocation guiTexture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/ParticleGenerator.png"); private int page = 1; private int infoPage = 0; private boolean hasInitialized = false; - //Particle variables + // Particle variables private boolean particles_enabled = true; private int red = 0; @@ -53,7 +54,7 @@ public class GUIParticleGenerator extends GuiScreen { private int selected_max = 3; private float gravity = 0F; - //Beam variables + // Beam variables private boolean beam_enabled = false; private boolean render_core = false; @@ -66,11 +67,10 @@ public class GUIParticleGenerator extends GuiScreen { private float beam_length = 0F; private float beam_rotation = 0F; + // Buttons - //Buttons - - //Info Page - //particle selection + // Info Page + // particle selection private TileParticleGenerator tile; @@ -80,9 +80,34 @@ public class GUIParticleGenerator extends GuiScreen { syncWithServer(); } - String[] InfoText = {"" + "The Particle Generator is a decorative device that allows you to create your own custom particle effects. " + "It is fairly easy you use this device you simply adjust the fields (variables) in the interface to change how the generated particles look and behave. " + "This block is a work in progress and new features and particles are likely to be added in future versions. " + "The following is a list of all of the fields in the interface and what they do.", "The first thing to note is that most fields have a random modifier which will add a random number between 0 and whatever max (or min) value you give it to the field. " + "-The first 3 fields (Red, Green & Blue) control the colour of the particle. Most people should be familiar with this colour system if not google RGB colours. Note: the max value for each colour can not go higher then 255 so the colour field limits the random modifier e.g. if the colour field is set to 255 and the random modifier is set to 20 the result will always be 255", "-The next 3 fields (Motion X, Y & Z) control the direction and speed of the particle " + "-The \"Life\" field sets how long (in ticks) before the particle despawns. " + "-The \"Size\" field sets the size of the particle. " + "-The next 3 fields (Spawn X, Y & Z) Sets the spawn location of the particle (relative to the location of the particle generator)", "-The \"Delay\" field sets the delay (in ticks) between each particle spawn e.g. 1=20/s, 20=1/s, 100=1/5s " + "-The \"Fade\" field sets how long (in ticks) it takes the partile to fade out of existance. Note: This adds to the life of the particle " + "-The \"Gravity\" field sets how the particle is affected by gravity. " + "-\"Block Collision\" Toggles weather or not the particle will collide with blocks " + "-\"Particle Selected\" Switches between the different particles available.", EnumChatFormatting.DARK_RED + " Redstone Control" + EnumChatFormatting.BLACK + "\nBy default a redstone signal is required for the generator to run." + "\n\nHowever if you shift right click the generator with an empty hand it will switch to inverted mode." + "\nThe redstone mode is indicated by the 8 cubes at the corners of the block.", EnumChatFormatting.DARK_RED + " Computer Control" + EnumChatFormatting.BLACK + "\nThe Generator can be controlled via a computer" + "\nIt exposes a relatively straight forward API:" + "\n\n setGeneratorProperty(property, value)\n getGeneratorState()\n resetGeneratorState()" + "\n\nGenerator state is obtained as a whole from getGeneratorState, whereas properties are modified one at a time using setGeneratorProperty. Property names are strings and mostly correspond to button labels in the GUI."}; + String[] InfoText = { + "" + + "The Particle Generator is a decorative device that allows you to create your own custom particle effects. " + + "It is fairly easy you use this device you simply adjust the fields (variables) in the interface to change how the generated particles look and behave. " + + "This block is a work in progress and new features and particles are likely to be added in future versions. " + + "The following is a list of all of the fields in the interface and what they do.", + "The first thing to note is that most fields have a random modifier which will add a random number between 0 and whatever max (or min) value you give it to the field. " + + "-The first 3 fields (Red, Green & Blue) control the colour of the particle. Most people should be familiar with this colour system if not google RGB colours. Note: the max value for each colour can not go higher then 255 so the colour field limits the random modifier e.g. if the colour field is set to 255 and the random modifier is set to 20 the result will always be 255", + "-The next 3 fields (Motion X, Y & Z) control the direction and speed of the particle " + + "-The \"Life\" field sets how long (in ticks) before the particle despawns. " + + "-The \"Size\" field sets the size of the particle. " + + "-The next 3 fields (Spawn X, Y & Z) Sets the spawn location of the particle (relative to the location of the particle generator)", + "-The \"Delay\" field sets the delay (in ticks) between each particle spawn e.g. 1=20/s, 20=1/s, 100=1/5s " + + "-The \"Fade\" field sets how long (in ticks) it takes the partile to fade out of existance. Note: This adds to the life of the particle " + + "-The \"Gravity\" field sets how the particle is affected by gravity. " + + "-\"Block Collision\" Toggles weather or not the particle will collide with blocks " + + "-\"Particle Selected\" Switches between the different particles available.", + EnumChatFormatting.DARK_RED + " Redstone Control" + EnumChatFormatting.BLACK + + "\nBy default a redstone signal is required for the generator to run." + + "\n\nHowever if you shift right click the generator with an empty hand it will switch to inverted mode." + + "\nThe redstone mode is indicated by the 8 cubes at the corners of the block.", + EnumChatFormatting.DARK_RED + " Computer Control" + EnumChatFormatting.BLACK + + "\nThe Generator can be controlled via a computer" + "\nIt exposes a relatively straight forward API:" + + "\n\n setGeneratorProperty(property, value)\n getGeneratorState()\n resetGeneratorState()" + + "\n\nGenerator state is obtained as a whole from getGeneratorState, whereas properties are modified one at a time using setGeneratorProperty. Property names are strings and mostly correspond to button labels in the GUI." + }; - //@formatter:off + // @formatter:off @Override public void drawScreen(int x, int y, float f) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -109,7 +134,7 @@ public class GUIParticleGenerator extends GuiScreen { super.drawScreen(x, y, f); } - //@formatter:on + // @formatter:on @Override protected void mouseClicked(int x, int y, int button) { @@ -137,8 +162,6 @@ public class GUIParticleGenerator extends GuiScreen { if (page < 10) buttonList.add(new GuiButton(54, posX - 21, posY + 3, 20, 20, "i")); else buttonList.add(new GuiButton(55, posX - 31, posY + 23, 30, 20, "Back")); - - } @Override @@ -159,251 +182,252 @@ public class GUIParticleGenerator extends GuiScreen { value_F = (value) / 1000F; switch (button.id) { - case 0://Red + + case 0: // Red + red = (red + value) > 255 ? 255 : red + value; packetValue = (short) red; break; - case 1://Green + + case 1: // Green + green = (green + value) > 255 ? 255 : green + value; packetValue = (short) green; break; - case 2://Blue + + case 2: // Blue + blue = (blue + value) > 255 ? 255 : blue + value; packetValue = (short) blue; break; - case 3://MX + + case 3: // MX + motion_x = (motion_x + value_F) > 5F ? 5F : motion_x + value_F; packetValue = (short) (motion_x * 1000F); break; - case 4://MY + + case 4: // MY + motion_y = (motion_y + value_F) > 5F ? 5F : motion_y + value_F; packetValue = (short) (motion_y * 1000F); break; - case 5://MZ + + case 5: // MZ + motion_z = (motion_z + value_F) > 5F ? 5F : motion_z + value_F; packetValue = (short) (motion_z * 1000F); break; - case 6://Red - + case 6: // Red - red = (red - value) < 0 ? 0 : red - value; packetValue = (short) red; break; - case 7://Green - + case 7: // Green - green = (green - value) < 0 ? 0 : green - value; packetValue = (short) green; break; - case 8://Blue - + case 8: // Blue - blue = (blue - value) < 0 ? 0 : blue - value; packetValue = (short) blue; break; - case 9://MX - + case 9: // MX - motion_x = (motion_x - value_F) < -5F ? -5F : motion_x - value_F; packetValue = (short) (motion_x * 1000F); break; - case 10://MY - + case 10: // MY - motion_y = (motion_y - value_F) < -5F ? -5F : motion_y - value_F; packetValue = (short) (motion_y * 1000F); break; - case 11://MZ - + case 11: // MZ - motion_z = (motion_z - value_F) < -5F ? -5F : motion_z - value_F; packetValue = (short) (motion_z * 1000F); break; - case 12://RRed + + case 12: // RRed + random_red = (random_red + value) > 255 ? 255 : random_red + value; packetValue = (short) random_red; break; - case 13://RGreen + + case 13: // RGreen + random_green = (random_green + value) > 255 ? 255 : random_green + value; packetValue = (short) random_green; break; - case 14://RBlue + + case 14: // RBlue + random_blue = (random_blue + value) > 255 ? 255 : random_blue + value; packetValue = (short) random_blue; break; - case 15://RMX + + case 15: // RMX + random_motion_x = (random_motion_x + value_F) > 5F ? 5F : random_motion_x + value_F; packetValue = (short) (random_motion_x * 1000F); break; - case 16://RMY + + case 16: // RMY + random_motion_y = (random_motion_y + value_F) > 5F ? 5F : random_motion_y + value_F; packetValue = (short) (random_motion_y * 1000F); break; - case 17://RMZ + + case 17: // RMZ + random_motion_z = (random_motion_z + value_F) > 5F ? 5F : random_motion_z + value_F; packetValue = (short) (random_motion_z * 1000F); break; - case 18://RRed - + case 18: // RRed - random_red = (random_red - value) < 0 ? 0 : random_red - value; packetValue = (short) random_red; break; - case 19://RGreen - + case 19: // RGreen - random_green = (random_green - value) < 0 ? 0 : random_green - value; packetValue = (short) random_green; break; - case 20://RBlue - + case 20: // RBlue - random_blue = (random_blue - value) < 0 ? 0 : random_blue - value; packetValue = (short) random_blue; break; - case 21://RMX - + case 21: // RMX - random_motion_x = (random_motion_x - value_F) < -5F ? -5F : random_motion_x - value_F; packetValue = (short) (random_motion_x * 1000F); break; - case 22://RMY - + case 22: // RMY - random_motion_y = (random_motion_y - value_F) < -5F ? -5F : random_motion_y - value_F; packetValue = (short) (random_motion_y * 1000F); break; - case 23://RMZ - + case 23: // RMZ - random_motion_z = (random_motion_z - value_F) < -5F ? -5F : random_motion_z - value_F; packetValue = (short) (random_motion_z * 1000F); break; - case 24://Life + + case 24: // Life + life = (life + value) > 1000 ? 1000 : life + value; packetValue = (short) life; break; - case 25://Life - + case 25: // Life - life = (life - value) < 0 ? 0 : life - value; packetValue = (short) life; break; - case 26://RLife + + case 26: // RLife + random_life = (random_life + value) > 1000 ? 1000 : random_life + value; packetValue = (short) random_life; break; - case 27://RLife - + case 27: // RLife - random_life = (random_life - value) < 0 ? 0 : random_life - value; packetValue = (short) random_life; break; - case 28://Size + + case 28: // Size + scale = (scale + value_F * 10F) > 50F ? 50F : scale + value_F * 10F; packetValue = (short) (scale * 100F); break; - case 29://Size - + case 29: // Size - scale = (scale - value_F * 10F) < 0.01F ? 0.01F : scale - value_F * 10F; packetValue = (short) (scale * 100F); break; - case 30://RSize + + case 30: // RSize + random_scale = (random_scale + value_F * 10F) > 50F ? 50F : random_scale + value_F * 10F; packetValue = (short) (random_scale * 100F); break; - case 31://RSize - + case 31: // RSize - random_scale = (random_scale - value_F * 10F) < 0.0F ? 0.0F : random_scale - value_F * 10F; packetValue = (short) (random_scale * 100F); break; - case 32://Page 2 + case 32: // Page 2 if (page > 1) page--; packetValue = (short) page; initGui(); break; - case 33://Page 1 + case 33: // Page 1 if (page < 3) page++; initGui(); packetValue = (short) page; break; - case 34://SX + + case 34: // SX + spawn_x = (spawn_x + value_F * 100F) > 50F ? 50F : spawn_x + value_F * 100F; packetValue = (short) (spawn_x * 100F); break; - case 35://SX - + case 35: // SX - spawn_x = (spawn_x - value_F * 100F) < -50F ? -50F : spawn_x - value_F * 100F; packetValue = (short) (spawn_x * 100F); break; - case 36://RSX + + case 36: // RSX + random_spawn_x = (random_spawn_x + value_F * 100F) > 50F ? 50F : random_spawn_x + value_F * 100F; packetValue = (short) (random_spawn_x * 100F); break; - case 37://RSX - + case 37: // RSX - random_spawn_x = (random_spawn_x - value_F * 100F) < -50F ? -50F : random_spawn_x - value_F * 100F; packetValue = (short) (random_spawn_x * 100F); break; - case 38://SY + + case 38: // SY + spawn_y = (spawn_y + value_F * 100F) > 50F ? 50F : spawn_y + value_F * 100F; packetValue = (short) (spawn_y * 100F); break; - case 39://SY - + case 39: // SY - spawn_y = (spawn_y - value_F * 100F) < -50F ? -50F : spawn_y - value_F * 100F; packetValue = (short) (spawn_y * 100F); break; - case 40://RSY + + case 40: // RSY + random_spawn_y = (random_spawn_y + value_F * 100F) > 50F ? 50F : random_spawn_y + value_F * 100F; packetValue = (short) (random_spawn_y * 100F); break; - case 41://RSY - + case 41: // RSY - random_spawn_y = (random_spawn_y - value_F * 100F) < -50F ? -50F : random_spawn_y - value_F * 100F; packetValue = (short) (random_spawn_y * 100F); break; - case 42://SZ + + case 42: // SZ + spawn_z = (spawn_z + value_F * 100F) > 50F ? 50F : spawn_z + value_F * 100F; packetValue = (short) (spawn_z * 100F); break; - case 43://SZ - + case 43: // SZ - spawn_z = (spawn_z - value_F * 100F) < -50F ? -50F : spawn_z - value_F * 100F; packetValue = (short) (spawn_z * 100F); break; - case 44://RSZ + + case 44: // RSZ + random_spawn_z = (random_spawn_z + value_F * 100F) > 50F ? 50F : random_spawn_z + value_F * 100F; packetValue = (short) (random_spawn_z * 100F); break; - case 45://RSZ - + case 45: // RSZ - random_spawn_z = (random_spawn_z - value_F * 100F) < -50F ? -50F : random_spawn_z - value_F * 100F; packetValue = (short) (random_spawn_z * 100F); break; - case 46://Delay + + case 46: // Delay + spawn_rate = (spawn_rate + value) > 200 ? 200 : spawn_rate + value; packetValue = (short) spawn_rate; break; - case 47://Delay - + case 47: // Delay - spawn_rate = (spawn_rate - value) < 1 ? 1 : spawn_rate - value; packetValue = (short) spawn_rate; break; - case 48://Fade + + case 48: // Fade + fade = (fade + value) > 100 ? 100 : fade + value; packetValue = (short) fade; break; - case 49://Fade - + case 49: // Fade - fade = (fade - value) < 0 ? 0 : fade - value; packetValue = (short) fade; break; - case 50://Toggle Collision + case 50: // Toggle Collision collide = !collide; packetValue = (short) (collide ? 1 : 0); initGui(); break; - case 51://cycle particle selection + case 51: // cycle particle selection selected_particle = selected_particle < selected_max ? selected_particle + 1 : 1; packetValue = (short) selected_particle; initGui(); break; - case 52://RSZ + + case 52: // RSZ + gravity = (gravity + value_F) > 5F ? 5F : gravity + value_F; packetValue = (short) (gravity * 1000F); break; - case 53://RSZ - + case 53: // RSZ - gravity = (gravity - value_F) < -5F ? -5F : gravity - value_F; packetValue = (short) (gravity * 1000F); break; - case 54://Info Page + case 54: // Info Page page = 10; initGui(); packetValue = (short) page; break; - case 55://Back Page + case 55: // Back Page page = 1; initGui(); packetValue = (short) page; break; - case 56://Info Next Page + case 56: // Info Next Page if (infoPage < 5) infoPage++; else initGui(); break; - case 57://Info Previous Page + case 57: // Info Previous Page if (infoPage > 0) infoPage--; else initGui(); break; - case 58://particles Enabled + case 58: // particles Enabled particles_enabled = !particles_enabled; packetValue = particles_enabled ? (byte) 1 : (byte) 0; initGui(); break; } - DraconicEvolution.network.sendToServer(new ParticleGenPacket((byte) button.id, packetValue, tile.xCoord, tile.yCoord, tile.zCoord)); + DraconicEvolution.network.sendToServer( + new ParticleGenPacket((byte) button.id, packetValue, tile.xCoord, tile.yCoord, tile.zCoord)); } @Override @@ -415,8 +439,7 @@ public class GUIParticleGenerator extends GuiScreen { } @Override - public void updateScreen() { - } + public void updateScreen() {} @Override public boolean doesGuiPauseGame() { @@ -466,7 +489,7 @@ public class GUIParticleGenerator extends GuiScreen { beam_rotation = tile.beam_rotation; } - //@formatter:off + // @formatter:off private void page1Txt() { int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; @@ -567,8 +590,6 @@ public class GUIParticleGenerator extends GuiScreen { buttonList.add(new GuiButton(23, posX + DX4, posY + y1 + 5 * 22, 20, 20, "-")); buttonList.add(new GuiButton(27, posX + DX4, posY + y1 + 6 * 22, 20, 20, "-")); buttonList.add(new GuiButton(31, posX + DX4, posY + y1 + 7 * 22, 20, 20, "-")); - - } private void page2Txt() { @@ -611,7 +632,6 @@ public class GUIParticleGenerator extends GuiScreen { fontRendererObj.drawString("" + fade, col1, posY + ln2 + 4 * 22, 0x000000, false); fontRendererObj.drawString("Gravity:", col1, posY + ln1 + 5 * 22, 0x000000, false); fontRendererObj.drawString(Gravity, col1, posY + ln2 + 5 * 22, 0x000000, false); - } private void page2Buttons() { @@ -645,10 +665,13 @@ public class GUIParticleGenerator extends GuiScreen { buttonList.add(new GuiButton(41, posX + DX4, posY + y1 + 1 * 22, 20, 20, "-")); buttonList.add(new GuiButton(45, posX + DX4, posY + y1 + 2 * 22, 20, 20, "-")); - buttonList.add(new GuiButton(50, posX + DX3 - 11, posY + y1 + 3 * 22, 102, 20, "Block Collision: " + (collide ? "on" : "off"))); - buttonList.add(new GuiButton(51, posX + DX3 - 11, posY + y1 + 4 * 22, 102, 20, "Particle Selected: " + selected_particle)); + buttonList.add(new GuiButton( + 50, posX + DX3 - 11, posY + y1 + 3 * 22, 102, 20, "Block Collision: " + (collide ? "on" : "off"))); + buttonList.add(new GuiButton( + 51, posX + DX3 - 11, posY + y1 + 4 * 22, 102, 20, "Particle Selected: " + selected_particle)); - buttonList.add(new GuiButton(58, posX + DX3 - 11, posY + y1 + 5 * 22, 102, 20, "Enabled: " + (particles_enabled ? "on" : "off"))); + buttonList.add(new GuiButton( + 58, posX + DX3 - 11, posY + y1 + 5 * 22, 102, 20, "Enabled: " + (particles_enabled ? "on" : "off"))); } private void page3Txt() { @@ -683,13 +706,12 @@ public class GUIParticleGenerator extends GuiScreen { fontRendererObj.drawString(rotation, col1, posY + ln2 + 6 * 22, 0x000000, false); fontRendererObj.drawString("Scale:", col1, posY + ln1 + 7 * 22, 0x000000, false); fontRendererObj.drawString(scale, col1, posY + ln2 + 7 * 22, 0x000000, false); - } private void page3Buttons() { int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; - int DX1 = 5;//x pos for row 1,2,3,4 + int DX1 = 5; // x pos for row 1,2,3,4 int DX2 = DX1 + 71; int DX3 = DX2 + 40; int DX4 = DX3 + 71; @@ -713,9 +735,10 @@ public class GUIParticleGenerator extends GuiScreen { buttonList.add(new GuiButton(114, posX + DX2, posY + y1 + 6 * 22, 20, 20, "-")); buttonList.add(new GuiButton(115, posX + DX2, posY + y1 + 7 * 22, 20, 20, "-")); - buttonList.add(new GuiButton(116, posX + DX3 - 11, posY + y1 + 0 * 22, 102, 20, "Enabled: " + (beam_enabled ? "on" : "off"))); - buttonList.add(new GuiButton(117, posX + DX3 - 11, posY + y1 + 1 * 22, 102, 20, "Render Core: " + (render_core ? "on" : "off"))); - + buttonList.add(new GuiButton( + 116, posX + DX3 - 11, posY + y1 + 0 * 22, 102, 20, "Enabled: " + (beam_enabled ? "on" : "off"))); + buttonList.add(new GuiButton( + 117, posX + DX3 - 11, posY + y1 + 1 * 22, 102, 20, "Render Core: " + (render_core ? "on" : "off"))); buttonList.add(new GuiButton(127, posX + DX3 - 11, posY + y1 + 7 * 22, 102, 20, "Take note of values")); } @@ -732,84 +755,84 @@ public class GUIParticleGenerator extends GuiScreen { value_F = (value) / 100F; switch (button.id) { - case 100: //beam red + + case 100: // beam red + beam_red = (beam_red + value) > 255 ? 255 : beam_red + value; packetValue = (short) beam_red; break; - case 101: //beam green + + case 101: // beam green + beam_green = (beam_green + value) > 255 ? 255 : beam_green + value; packetValue = (short) beam_green; break; - case 102: //beam blue + + case 102: // beam blue + beam_blue = (beam_blue + value) > 255 ? 255 : beam_blue + value; packetValue = (short) beam_blue; break; - case 103: //beam pitch + + case 103: // beam pitch + beam_pitch = (beam_pitch + value_F) > 180F ? 180F : beam_pitch + value_F; packetValue = (short) (beam_pitch * 100F); break; - case 104: //beam yaw + + case 104: // beam yaw + beam_yaw = (beam_yaw + value_F) > 180F ? 180F : beam_yaw + value_F; packetValue = (short) (beam_yaw * 100F); break; - case 105: //beam length + + case 105: // beam length + beam_length = (beam_length + value_F) > 320F ? 320F : beam_length + value_F; packetValue = (short) (beam_length * 100F); break; - case 106: //beam rotation + + case 106: // beam rotation + beam_rotation = (beam_rotation + value_F) > 1F ? 1F : beam_rotation + value_F; packetValue = (short) (beam_rotation * 100F); break; - case 107: //beam scale + + case 107: // beam scale + beam_scale = (beam_scale + value_F) > 5F ? 5F : beam_scale + value_F; packetValue = (short) (beam_scale * 100F); break; - case 108: //beam red - + case 108: // beam red - beam_red = (beam_red - value) < 0 ? 0 : beam_red - value; packetValue = (short) beam_red; break; - case 109: //beam green - + case 109: // beam green - beam_green = (beam_green - value) < 0 ? 0 : beam_green - value; packetValue = (short) beam_green; break; - case 110: //beam blue - + case 110: // beam blue - beam_blue = (beam_blue - value) < 0 ? 0 : beam_blue - value; packetValue = (short) beam_blue; break; - case 111: //beam pitch - + case 111: // beam pitch - beam_pitch = (beam_pitch - value_F) < -180F ? -180F : beam_pitch - value_F; packetValue = (short) (beam_pitch * 100F); break; - case 112: //beam yaw - + case 112: // beam yaw - beam_yaw = (beam_yaw - value_F) < -180F ? -180F : beam_yaw - value_F; packetValue = (short) (beam_yaw * 100F); break; - case 113: //beam length - + case 113: // beam length - beam_length = (beam_length - value_F) < -0F ? -0F : beam_length - value_F; packetValue = (short) (beam_length * 100F); break; - case 114: //beam rotation - + case 114: // beam rotation - beam_rotation = (beam_rotation - value_F) < -1F ? -1F : beam_rotation - value_F; packetValue = (short) (beam_rotation * 100F); break; - case 115: //beam scale - + case 115: // beam scale - beam_scale = (beam_scale - value_F) < -0F ? -0F : beam_scale - value_F; packetValue = (short) (beam_scale * 100F); break; - case 116: //beam enabled + case 116: // beam enabled beam_enabled = !beam_enabled; packetValue = beam_enabled ? (byte) 1 : (byte) 0; initGui(); break; - case 117: //beam enabled + case 117: // beam enabled render_core = !render_core; packetValue = render_core ? (byte) 1 : (byte) 0; initGui(); break; - } - DraconicEvolution.network.sendToServer(new ParticleGenPacket((byte) button.id, packetValue, tile.xCoord, tile.yCoord, tile.zCoord)); + DraconicEvolution.network.sendToServer( + new ParticleGenPacket((byte) button.id, packetValue, tile.xCoord, tile.yCoord, tile.zCoord)); } - //@formatter:on + // @formatter:on } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java index 6b857db0..07ff56dd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java @@ -2,12 +2,13 @@ package com.brandon3055.draconicevolution.client.gui; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; +import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.PlayerDetectorButtonPacket; import com.brandon3055.draconicevolution.common.network.PlayerDetectorStringPacket; -import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; @@ -17,8 +18,6 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; - @SideOnly(Side.CLIENT) public class GUIPlayerDetector extends GuiContainer { @@ -40,8 +39,7 @@ public class GUIPlayerDetector extends GuiContainer { super(detector.getGuiContainer(invPlayer)); this.inventorySlots = new ContainerPlayerDetector(invPlayer, detector, this); - for (int i = 0; i < names.length; i++) - names[i] = ""; + for (int i = 0; i < names.length; i++) names[i] = ""; xSize = 176; ySize = 198; @@ -51,7 +49,8 @@ public class GUIPlayerDetector extends GuiContainer { syncWithServer(); } - private static final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/PlayerDetector.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/PlayerDetector.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { @@ -65,14 +64,11 @@ public class GUIPlayerDetector extends GuiContainer { } if (showInvSlots) drawTexturedModalRect(guiLeft + 142, guiTop + 19, xSize, 0, 23, 41); - } @Override protected void drawGuiContainerForegroundLayer(int x, int y) { drawGuiText(x, y); - - } @Override @@ -107,42 +103,42 @@ public class GUIPlayerDetector extends GuiContainer { selectedNameText.setMaxStringLength(40); selectedNameText.setVisible(editMode); - //ID - //buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, "sgASGgs")); + // ID + // buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, "sgASGgs")); - //syncWithServer(); + // syncWithServer(); } @Override protected void actionPerformed(GuiButton button) { switch (button.id) { - case 0: //Range + + case 0: // Range + range = (range < maxRange) ? range + 1 : maxRange; DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 0, (byte) range)); break; - case 1: //Range - + case 1: // Range - range = (range > 1) ? range - 1 : 1; DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 0, (byte) range)); break; - case 3: //White List - + case 3: // White List - initScedualed = true; editMode = true; showInvSlots = false; ((ContainerPlayerDetector) this.inventorySlots).updateContainerSlots(); break; - case 4: //Toggle White List - + case 4: // Toggle White List - whitelist = !whitelist; initScedualed = true; byte val = (byte) (whitelist ? 1 : 0); DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 1, val)); break; - case 5: //Back - + case 5: // Back - editMode = false; showInvSlots = true; ((ContainerPlayerDetector) this.inventorySlots).updateContainerSlots(); initScedualed = true; break; - case 6: //Back - + case 6: // Back - outputInverted = !outputInverted; initScedualed = true; byte val2 = (byte) (outputInverted ? 1 : 0); @@ -150,7 +146,7 @@ public class GUIPlayerDetector extends GuiContainer { break; } - //DraconicEvolution.channelHandler.sendToServer(new ButtonPacket((byte) 0, true)); + // DraconicEvolution.channelHandler.sendToServer(new ButtonPacket((byte) 0, true)); } @@ -162,7 +158,8 @@ public class GUIPlayerDetector extends GuiContainer { names[selected] = selectedNameText.getText(); selectedNameText.setText(""); selectedNameText.setFocused(false); - DraconicEvolution.network.sendToServer(new PlayerDetectorStringPacket((byte) selected, names[selected])); + DraconicEvolution.network.sendToServer( + new PlayerDetectorStringPacket((byte) selected, names[selected])); selected = -1; } } else super.keyTyped(par1, par2); @@ -185,7 +182,7 @@ public class GUIPlayerDetector extends GuiContainer { if (editMode) selectName(x - guiLeft, y - guiTop); - //this.selectedNameText.mouseClicked(x - guiLeft, y - guiTop, par3); + // this.selectedNameText.mouseClicked(x - guiLeft, y - guiTop, par3); } private void drawGuiText(int rawX, int rawY) { @@ -223,7 +220,8 @@ public class GUIPlayerDetector extends GuiContainer { for (int i = 0; i < 21; i++) { for (int j = 0; j < 2; j++) { - if ((x > 4 + j * 84 && x < (xSize / 2) - 1 + j * 82) && (y > 4 + i * 9 && y < 13 + i * 9) || i + j * 21 == selected) + if ((x > 4 + j * 84 && x < (xSize / 2) - 1 + j * 82) && (y > 4 + i * 9 && y < 13 + i * 9) + || i + j * 21 == selected) drawTexturedModalRect(guiLeft + 5 + j * 84, guiTop + 5 + i * 9, 0, ySize + 10, 82, 8); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java index b692466c..3e2e469b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java @@ -1,21 +1,19 @@ package com.brandon3055.draconicevolution.client.gui; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.container.ContainerSunDial; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.TeleporterPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.container.ContainerSunDial; -import com.brandon3055.draconicevolution.common.network.TeleporterPacket; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; - @SideOnly(Side.CLIENT) public class GUISunDial extends GuiContainer { @@ -26,7 +24,6 @@ public class GUISunDial extends GuiContainer { xSize = 176; ySize = 90; - } private static final ResourceLocation texture = new ResourceLocation(References.MODID, "textures/gui/SunDial.png"); @@ -37,21 +34,20 @@ public class GUISunDial extends GuiContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - } @Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - //fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); + // fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); } @Override public void initGui() { super.initGui(); - //ID + // ID buttonList.add(new GuiButton(0, guiLeft + 10, guiTop + 10, 85, 20, "")); } @@ -60,7 +56,6 @@ public class GUISunDial extends GuiContainer { if (button.id == 0) { DraconicEvolution.network.sendToServer(new TeleporterPacket()); } - } @Override @@ -72,6 +67,4 @@ public class GUISunDial extends GuiContainer { } super.updateScreen(); } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java index 098c833b..d489d20b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java @@ -10,6 +10,8 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.TeleporterPacket; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -26,14 +28,12 @@ import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; -import java.util.List; - @SideOnly(Side.CLIENT) public class GUITeleporter extends GuiScreen { private final int xSize = 182; private final int ySize = 141; - private ResourceLocation guiTexture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/TeleporterMKII.png"); + private ResourceLocation guiTexture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/TeleporterMKII.png"); private ItemStack teleporterItem; protected List locations = new ArrayList(0); @@ -52,7 +52,8 @@ public class GUITeleporter extends GuiScreen { public GUITeleporter(EntityPlayer player) { super(); this.player = player; - if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.teleporterMKII))) { + if (player.getCurrentEquippedItem() != null + && player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.teleporterMKII))) { this.teleporterItem = player.getCurrentEquippedItem(); readDataFromItem(teleporterItem); } @@ -82,7 +83,11 @@ public class GUITeleporter extends GuiScreen { String colour = EnumChatFormatting.GREEN + ""; if (fuel < 10) colour = EnumChatFormatting.YELLOW + ""; if (fuel == 0) colour = EnumChatFormatting.DARK_RED + ""; - fontRendererObj.drawString(colour + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + fuel, posX + 115, posY + 87, 0x000000); + fontRendererObj.drawString( + colour + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + fuel, + posX + 115, + posY + 87, + 0x000000); super.drawScreen(x, y, f); @@ -162,10 +167,30 @@ public class GUITeleporter extends GuiScreen { int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; if (locations.size() <= 0) return; - fontRendererObj.drawString(EnumChatFormatting.GOLD + "X: " + (int) getLocationSafely(selected + selectionOffset).getXCoord(), posX + 114, posY + 7, 0x000000); - fontRendererObj.drawString(EnumChatFormatting.GOLD + "Y: " + (int) getLocationSafely(selected + selectionOffset).getYCoord(), posX + 114, posY + 16, 0x000000); - fontRendererObj.drawString(EnumChatFormatting.GOLD + "Z: " + (int) getLocationSafely(selected + selectionOffset).getZCoord(), posX + 114, posY + 25, 0x000000); - fontRendererObj.drawString(EnumChatFormatting.GOLD + "" + getLocationSafely(selected + selectionOffset).getDimensionName(), posX + 114, posY + 34, 0x000000); + fontRendererObj.drawString( + EnumChatFormatting.GOLD + "X: " + + (int) getLocationSafely(selected + selectionOffset).getXCoord(), + posX + 114, + posY + 7, + 0x000000); + fontRendererObj.drawString( + EnumChatFormatting.GOLD + "Y: " + + (int) getLocationSafely(selected + selectionOffset).getYCoord(), + posX + 114, + posY + 16, + 0x000000); + fontRendererObj.drawString( + EnumChatFormatting.GOLD + "Z: " + + (int) getLocationSafely(selected + selectionOffset).getZCoord(), + posX + 114, + posY + 25, + 0x000000); + fontRendererObj.drawString( + EnumChatFormatting.GOLD + "" + + getLocationSafely(selected + selectionOffset).getDimensionName(), + posX + 114, + posY + 34, + 0x000000); } @Override @@ -178,7 +203,7 @@ public class GUITeleporter extends GuiScreen { if (textBeingEdited.getVisible()) textBeingEdited.mouseClicked(x, y, button); - //Check for arrow click + // Check for arrow click if (selectionOffset > 0 && GuiHelper.isInRect(3, 5, 13, 15, x - posX, y - posY)) { selectionOffset--; offsetChanged = true; @@ -196,7 +221,7 @@ public class GUITeleporter extends GuiScreen { } } - //Check for location or lock clicked + // Check for location or lock clicked for (int i = 0; i < Math.min(12, locations.size()); i++) { if (GuiHelper.isInRect(17, 6 + i * 11, 80, 10, x - posX, y - posY)) { if (!(getLocationSafely(i + selectionOffset).getWriteProtected() && editingExisting) && button == 0) { @@ -212,22 +237,29 @@ public class GUITeleporter extends GuiScreen { if (player.capabilities.isCreativeMode || fuel > 0) { if (!player.capabilities.isCreativeMode) fuel--; - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.TELEPORT, i + selectionOffset, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.TELEPORT, i + selectionOffset, false)); } } } if (GuiHelper.isInRect(99, 8 + i * 11, 8, 7, x - posX, y - posY)) { - getLocationSafely(i + selectionOffset).setWriteProtected(!getLocationSafely(i + selectionOffset).getWriteProtected()); - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.UPDATELOCK, i + selectionOffset, getLocationSafely(i + selectionOffset).getWriteProtected())); + getLocationSafely(i + selectionOffset) + .setWriteProtected( + !getLocationSafely(i + selectionOffset).getWriteProtected()); + DraconicEvolution.network.sendToServer(new TeleporterPacket( + TeleporterPacket.UPDATELOCK, + i + selectionOffset, + getLocationSafely(i + selectionOffset).getWriteProtected())); } } - if (selectionChanged) - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); if (offsetChanged) - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); updateButtons(); super.mouseClicked(x, y, button); @@ -263,9 +295,11 @@ public class GUITeleporter extends GuiScreen { } if (selectionChanged) - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); if (offsetChanged) - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); super.handleMouseInput(); } @@ -278,10 +312,13 @@ public class GUITeleporter extends GuiScreen { if ((selected + selectionOffset) + 1 > locations.size()) { selected = 0; selectionOffset = 0; - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); } - if (locations.size() == 0 || getLocationSafely(selected + selectionOffset).getWriteProtected()) { + if (locations.size() == 0 + || getLocationSafely(selected + selectionOffset).getWriteProtected()) { ((GuiButton) buttonList.get(0)).enabled = false; ((GuiButton) buttonList.get(1)).enabled = false; ((GuiButton) buttonList.get(2)).enabled = false; @@ -308,19 +345,27 @@ public class GUITeleporter extends GuiScreen { int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; - //updateTeleporter(); + // updateTeleporter(); - buttonList.add(new GuiButtonAHeight(0, posX + 112, posY + 45, 66, 12, StatCollector.translateToLocal("button.de.rename.txt"))); - buttonList.add(new GuiButtonAHeight(1, posX + 112, posY + 58, 66, 12, StatCollector.translateToLocal("button.de.setHere.txt"))); - buttonList.add(new GuiButtonAHeight(2, posX + 112, posY + 71, 66, 12, StatCollector.translateToLocal("button.de.remove.txt"))); + buttonList.add(new GuiButtonAHeight( + 0, posX + 112, posY + 45, 66, 12, StatCollector.translateToLocal("button.de.rename.txt"))); + buttonList.add(new GuiButtonAHeight( + 1, posX + 112, posY + 58, 66, 12, StatCollector.translateToLocal("button.de.setHere.txt"))); + buttonList.add(new GuiButtonAHeight( + 2, posX + 112, posY + 71, 66, 12, StatCollector.translateToLocal("button.de.remove.txt"))); - buttonList.add(new GuiButtonAHeight(3, posX + 112, posY + 99, 33, 12, StatCollector.translateToLocal("button.de.UP.txt"))); + buttonList.add(new GuiButtonAHeight( + 3, posX + 112, posY + 99, 33, 12, StatCollector.translateToLocal("button.de.UP.txt"))); - buttonList.add(new GuiButtonAHeight(4, posX + 112, posY + 112, 66, 12, StatCollector.translateToLocal("button.de.addNew.txt"))); - buttonList.add(new GuiButtonAHeight(5, posX + 112, posY + 125, 66, 12, StatCollector.translateToLocal("button.de.addFuel.txt"))); - buttonList.add(new GuiButtonAHeight(6, posX + xSize - 63, posY - 15, 60, 15, StatCollector.translateToLocal("button.de.cancel.txt"))); + buttonList.add(new GuiButtonAHeight( + 4, posX + 112, posY + 112, 66, 12, StatCollector.translateToLocal("button.de.addNew.txt"))); + buttonList.add(new GuiButtonAHeight( + 5, posX + 112, posY + 125, 66, 12, StatCollector.translateToLocal("button.de.addFuel.txt"))); + buttonList.add(new GuiButtonAHeight( + 6, posX + xSize - 63, posY - 15, 60, 15, StatCollector.translateToLocal("button.de.cancel.txt"))); - buttonList.add(new GuiButtonAHeight(7, posX + 112 + 34, posY + 99, 33, 12, StatCollector.translateToLocal("button.de.DOWN.txt"))); + buttonList.add(new GuiButtonAHeight( + 7, posX + 112 + 34, posY + 99, 33, 12, StatCollector.translateToLocal("button.de.DOWN.txt"))); ((GuiButton) buttonList.get(6)).visible = false; textBeingEdited = new GuiTextField(fontRendererObj, posX + 3, posY - 14, xSize - 67, 12); @@ -347,7 +392,8 @@ public class GUITeleporter extends GuiScreen { if (!editingExisting) { editingExisting = true; textBeingEdited.setVisible(true); - textBeingEdited.setText(getLocationSafely(selected + selectionOffset).getName()); + textBeingEdited.setText( + getLocationSafely(selected + selectionOffset).getName()); textBeingEdited.setSelectionPos(0); textBeingEdited.setFocused(true); ((GuiButton) buttonList.get(6)).visible = true; @@ -356,8 +402,10 @@ public class GUITeleporter extends GuiScreen { getLocationSafely(selected + selectionOffset).setName(textBeingEdited.getText()); TeleportLocation location = new TeleportLocation(); location.setName(textBeingEdited.getText()); - DraconicEvolution.network.sendToServer(new TeleporterPacket(location, TeleporterPacket.UPDATENAME, selected + selectionOffset)); - ((GuiButton) buttonList.get(0)).displayString = StatCollector.translateToLocal("button.de.rename.txt"); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(location, TeleporterPacket.UPDATENAME, selected + selectionOffset)); + ((GuiButton) buttonList.get(0)).displayString = + StatCollector.translateToLocal("button.de.rename.txt"); editingExisting = false; textBeingEdited.setVisible(false); ((GuiButton) buttonList.get(6)).visible = false; @@ -366,13 +414,22 @@ public class GUITeleporter extends GuiScreen { } if (button.id == 1) { - TeleportLocation location = new TeleportLocation(player.posX, player.posY - 1.62, player.posZ, player.dimension, player.rotationPitch, player.rotationYaw, getLocationSafely(selected + selectionOffset).getName()); - DraconicEvolution.network.sendToServer(new TeleporterPacket(location, TeleporterPacket.UPDATEDESTINATION, selected + selectionOffset)); + TeleportLocation location = new TeleportLocation( + player.posX, + player.posY - 1.62, + player.posZ, + player.dimension, + player.rotationPitch, + player.rotationYaw, + getLocationSafely(selected + selectionOffset).getName()); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(location, TeleporterPacket.UPDATEDESTINATION, selected + selectionOffset)); locations.set(selected + selectionOffset, location); } if (button.id == 2) { - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.REMOVEDESTINATION, selected + selectionOffset, false)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.REMOVEDESTINATION, selected + selectionOffset, false)); locations.remove(selected + selectionOffset); if (selectionOffset > 0) selectionOffset--; if (selected >= locations.size()) selected--; @@ -395,7 +452,8 @@ public class GUITeleporter extends GuiScreen { } } - DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.MOVELOCATION, selected + selectionOffset, button.id == 3)); + DraconicEvolution.network.sendToServer( + new TeleporterPacket(TeleporterPacket.MOVELOCATION, selected + selectionOffset, button.id == 3)); } if (button.id == 4 || button.id == 6 && !editingExisting) { @@ -417,7 +475,8 @@ public class GUITeleporter extends GuiScreen { } else { if (!textBeingEdited.getText().isEmpty()) { addCurrentLocationToList(textBeingEdited.getText()); - ((GuiButton) buttonList.get(4)).displayString = StatCollector.translateToLocal("button.de.addNew.txt"); + ((GuiButton) buttonList.get(4)).displayString = + StatCollector.translateToLocal("button.de.addNew.txt"); editingNew = false; textBeingEdited.setVisible(false); ((GuiButton) buttonList.get(6)).visible = false; @@ -455,11 +514,13 @@ public class GUITeleporter extends GuiScreen { public void keyTyped(char key, int keyN) { if (this.textBeingEdited.textboxKeyTyped(key, keyN)) { if (editingNew) { - ((GuiButton) buttonList.get(4)).enabled = !textBeingEdited.getText().isEmpty(); + ((GuiButton) buttonList.get(4)).enabled = + !textBeingEdited.getText().isEmpty(); ((GuiButton) buttonList.get(4)).displayString = StatCollector.translateToLocal("button.de.commit.txt"); } if (editingExisting) { - ((GuiButton) buttonList.get(0)).enabled = !textBeingEdited.getText().isEmpty(); + ((GuiButton) buttonList.get(0)).enabled = + !textBeingEdited.getText().isEmpty(); ((GuiButton) buttonList.get(0)).displayString = StatCollector.translateToLocal("button.de.commit.txt"); } return; @@ -476,13 +537,20 @@ public class GUITeleporter extends GuiScreen { @Override public void updateScreen() { - if (player.getCurrentEquippedItem() == null || !player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.teleporterMKII)) || player.isDead) { + if (player.getCurrentEquippedItem() == null + || !player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.teleporterMKII)) + || player.isDead) { this.mc.displayGuiScreen(null); this.mc.setIngameFocus(); } - if (tick % 5 == 0 && locations.size() > 0 && getLocationSafely(selected + selectionOffset).getDimensionName().equals("") && player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.teleporterMKII) - readDataFromItem(player.getHeldItem()); + if (tick % 5 == 0 + && locations.size() > 0 + && getLocationSafely(selected + selectionOffset) + .getDimensionName() + .equals("") + && player.getHeldItem() != null + && player.getHeldItem().getItem() == ModItems.teleporterMKII) readDataFromItem(player.getHeldItem()); tick++; if (tick >= 10) { @@ -510,7 +578,9 @@ public class GUITeleporter extends GuiScreen { for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound tagLocation = list.getCompoundTagAt(i); - //TeleportLocation location = new TeleportLocation(tagLocation.getDouble("X"), tagLocation.getDouble("Y"), tagLocation.getDouble("Z"), tagLocation.getInteger("Dimension"), tagLocation.getFloat("Pitch"), tagLocation.getFloat("Yaw"), tagLocation.getString("Name")); + // TeleportLocation location = new TeleportLocation(tagLocation.getDouble("X"), tagLocation.getDouble("Y"), + // tagLocation.getDouble("Z"), tagLocation.getInteger("Dimension"), tagLocation.getFloat("Pitch"), + // tagLocation.getFloat("Yaw"), tagLocation.getString("Name")); TeleportLocation location = new TeleportLocation(); location.readFromNBT(tagLocation); location.setWriteProtected(tagLocation.getBoolean("WP")); @@ -519,7 +589,14 @@ public class GUITeleporter extends GuiScreen { } private void addCurrentLocationToList(String name) { - TeleportLocation currentLocation = new TeleportLocation(player.posX, player.posY - 1.62, player.posZ, player.dimension, player.rotationPitch, player.rotationYaw, name); + TeleportLocation currentLocation = new TeleportLocation( + player.posX, + player.posY - 1.62, + player.posZ, + player.dimension, + player.rotationPitch, + player.rotationYaw, + name); DraconicEvolution.network.sendToServer(new TeleporterPacket(currentLocation, TeleporterPacket.ADDDESTINATION)); locations.add(currentLocation); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java index 210be50a..b764e6da 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.client.gui; -import java.util.ArrayList; -import java.util.List; - import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.ModItems; @@ -12,6 +9,8 @@ import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiButton; @@ -35,11 +34,11 @@ public class GUIUpgradeModifier extends GuiContainer { private List itemUpgrades = new ArrayList(); private ContainerUpgradeModifier containerEM; - public GUIUpgradeModifier(InventoryPlayer invPlayer, TileUpgradeModifier tile, ContainerUpgradeModifier containerEM) { + public GUIUpgradeModifier( + InventoryPlayer invPlayer, TileUpgradeModifier tile, ContainerUpgradeModifier containerEM) { super(containerEM); this.containerEM = containerEM; - xSize = 176; ySize = 190; @@ -47,7 +46,6 @@ public class GUIUpgradeModifier extends GuiContainer { this.player = invPlayer.player; } - @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1F, 1F, 1F, 1F); @@ -90,14 +88,10 @@ public class GUIUpgradeModifier extends GuiContainer { @Override public void initGui() { super.initGui(); - } @Override - protected void actionPerformed(GuiButton button) { - - - } + protected void actionPerformed(GuiButton button) {} private int coreSlots = 0; private int coreTier = 0; @@ -159,24 +153,32 @@ public class GUIUpgradeModifier extends GuiContainer { int[] appliedCores = upgrade.getCoresApplied(tile.getStackInSlot(0)); for (int i = 0; i <= coreTier; i++) { - //Check + buttons - if (coreInInventory[i] && coreSlots > usedSlots && GuiHelper.isInRect(xPos, yPos + 33 + i * 18, 8, 8, x, y) && upgrade.getUpgradePoints(stack) < upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) { + // Check + buttons + if (coreInInventory[i] + && coreSlots > usedSlots + && GuiHelper.isInRect(xPos, yPos + 33 + i * 18, 8, 8, x, y) + && upgrade.getUpgradePoints(stack) < upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) { containerEM.sendObjectToServer(null, upgrade.index, i * 2); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(PositionedSoundRecord.func_147674_a( + ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); } - //Check - buttons + // Check - buttons if (appliedCores[i] > 0 && GuiHelper.isInRect(xPos + 16, yPos + 33 + i * 18, 8, 8, x, y)) { containerEM.sendObjectToServer(null, upgrade.index, 1 + i * 2); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(PositionedSoundRecord.func_147674_a( + ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); } } } - } private void renderUpgrades(int x, int y) { - //First Draw + // First Draw for (EnumUpgrade upgrade : itemUpgrades) { int xIndex = itemUpgrades.indexOf(upgrade); int spacing = (xSize - 6) / itemUpgrades.size(); @@ -202,32 +204,43 @@ public class GUIUpgradeModifier extends GuiContainer { GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glDisable(GL11.GL_BLEND); - //Draw + buttons - if (coreSlots > usedSlots && upgrade.getUpgradePoints(stack) < upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) { + // Draw + buttons + if (coreSlots > usedSlots + && upgrade.getUpgradePoints(stack) < upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) { boolean hovering = GuiHelper.isInRect(xPos, yPos + 33 + i * 18, 8, 8, x, y); if (!coreInInventory[i]) drawTexturedModalRect(xPos, yPos + 33 + i * 18, 24, 208, 8, 8); else drawTexturedModalRect(xPos, yPos + 33 + i * 18, 32 + (hovering ? 8 : 0), 208, 8, 8); } - //Draw - buttons + // Draw - buttons if (appliedCores[i] > 0) { boolean hovering = GuiHelper.isInRect(xPos + 16, yPos + 33 + i * 18, 8, 8, x, y); drawTexturedModalRect(xPos + 16, yPos + 33 + i * 18, 56 + (hovering ? 8 : 0), 208, 8, 8); } - - } for (int i = 0; i <= coreTier; i++) - fontRendererObj.drawString(String.valueOf(appliedCores[i]), xPos + 12 - fontRendererObj.getStringWidth(String.valueOf(appliedCores[i])) / 2, yPos + 29 + i * 18, 0xFFFFFF); - fontRendererObj.drawString(String.valueOf(upgrade.getUpgradePoints(stack)), xPos + 12 - fontRendererObj.getStringWidth(String.valueOf(upgrade.getUpgradePoints(stack))) / 2, yPos - 8, 0xFFFFFF); + fontRendererObj.drawString( + String.valueOf(appliedCores[i]), + xPos + 12 - fontRendererObj.getStringWidth(String.valueOf(appliedCores[i])) / 2, + yPos + 29 + i * 18, + 0xFFFFFF); + fontRendererObj.drawString( + String.valueOf(upgrade.getUpgradePoints(stack)), + xPos + 12 - fontRendererObj.getStringWidth(String.valueOf(upgrade.getUpgradePoints(stack))) / 2, + yPos - 8, + 0xFFFFFF); } - fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("gui.de.cores.txt"), guiLeft + 4, guiTop + 4, 0x00ff00); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.cap.txt"), guiLeft + 4, guiTop + 16, 0x000000); + fontRendererObj.drawStringWithShadow( + StatCollector.translateToLocal("gui.de.cores.txt"), guiLeft + 4, guiTop + 4, 0x00ff00); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.cap.txt"), guiLeft + 4, guiTop + 16, 0x000000); fontRendererObj.drawString(">" + coreSlots, guiLeft + 4, guiTop + 25, 0x000000); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.installed.txt"), guiLeft + 4, guiTop + 37, 0x000000); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.installed.txt"), guiLeft + 4, guiTop + 37, 0x000000); fontRendererObj.drawString(">" + usedSlots, guiLeft + 4, guiTop + 46, 0x000000); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.free.txt"), guiLeft + 4, guiTop + 58, 0x000000); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.free.txt"), guiLeft + 4, guiTop + 58, 0x000000); fontRendererObj.drawString(">" + (coreSlots - usedSlots), guiLeft + 4, guiTop + 67, 0x000000); } @@ -236,7 +249,7 @@ public class GUIUpgradeModifier extends GuiContainer { super.drawScreen(x, y, f); if (!inUse) return; - //Second Draw + // Second Draw for (EnumUpgrade upgrade : itemUpgrades) { int xIndex = itemUpgrades.indexOf(upgrade); int spacing = (xSize - 6) / itemUpgrades.size(); @@ -252,8 +265,10 @@ public class GUIUpgradeModifier extends GuiContainer { if (GuiHelper.isInRect(xPos + 3, yPos - 9, 18, 8, x, y)) { List list = new ArrayList(); - list.add(StatCollector.translateToLocal("gui.de.basePoints.txt") + ": " + upgradableItem.getBaseUpgradePoints(upgrade.index)); - list.add(StatCollector.translateToLocal("gui.de.maxPoints.txt") + ": " + upgradableItem.getMaxUpgradePoints(upgrade.index, stack)); + list.add(StatCollector.translateToLocal("gui.de.basePoints.txt") + ": " + + upgradableItem.getBaseUpgradePoints(upgrade.index)); + list.add(StatCollector.translateToLocal("gui.de.maxPoints.txt") + ": " + + upgradableItem.getMaxUpgradePoints(upgrade.index, stack)); list.add(StatCollector.translateToLocal("gui.de.pointCost.txt") + ": " + upgrade.pointConversion); drawHoveringText(list, x, y, fontRendererObj); } @@ -262,12 +277,15 @@ public class GUIUpgradeModifier extends GuiContainer { if (GuiHelper.isInRect(xPos + 9, yPos + 25 + i * 18, 6, 15, x, y)) { List list = new ArrayList(); double value = Math.pow(2, i) / upgrade.pointConversion; - String string = StatCollector.translateToLocal("gui.de.value.txt") + ": " + value + " " + (value == 1 ? StatCollector.translateToLocal("gui.de.point.txt") : StatCollector.translateToLocal("gui.de.points.txt")); + String string = StatCollector.translateToLocal("gui.de.value.txt") + ": " + value + " " + + (value == 1 + ? StatCollector.translateToLocal("gui.de.point.txt") + : StatCollector.translateToLocal("gui.de.points.txt")); list.add(string.replace(".0", "")); drawHoveringText(list, x, y, fontRendererObj); } - //Draw Button Text (add) + // Draw Button Text (add) if (coreSlots > usedSlots && GuiHelper.isInRect(xPos, yPos + 33 + i * 18, 8, 8, x, y)) { List list = new ArrayList(); if (coreInInventory[i]) list.add(StatCollector.translateToLocal("gui.de.addCore.txt")); @@ -275,7 +293,7 @@ public class GUIUpgradeModifier extends GuiContainer { drawHoveringText(list, x, y, fontRendererObj); } - //Draw Button Text (remove) + // Draw Button Text (remove) if (appliedCores[i] > 0 && GuiHelper.isInRect(xPos + 16, yPos + 33 + i * 18, 8, 8, x, y)) { List list = new ArrayList(); if (coreInInventory[i]) list.add(StatCollector.translateToLocal("gui.de.removeCore.txt")); @@ -283,7 +301,6 @@ public class GUIUpgradeModifier extends GuiContainer { } } } - } public void drawFlippedTexturedModalRect(int xPos, int yPos, int texXPos, int texYPos, int xSize, int ySize) { @@ -291,10 +308,30 @@ public class GUIUpgradeModifier extends GuiContainer { float f1 = 0.00390625F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); - tessellator.addVertexWithUV((double) (xPos), (double) (yPos + ySize), (double) this.zLevel, (double) ((float) (texXPos + xSize) * f), (double) ((float) (texYPos + ySize) * f1)); - tessellator.addVertexWithUV((double) (xPos + xSize), (double) (yPos + ySize), (double) this.zLevel, (double) ((float) (texXPos) * f), (double) ((float) (texYPos + ySize) * f1)); - tessellator.addVertexWithUV((double) (xPos + xSize), (double) (yPos), (double) this.zLevel, (double) ((float) (texXPos) * f), (double) ((float) (texYPos) * f1)); - tessellator.addVertexWithUV((double) (xPos), (double) (yPos), (double) this.zLevel, (double) ((float) (texXPos + xSize) * f), (double) ((float) (texYPos) * f1)); + tessellator.addVertexWithUV( + (double) (xPos), + (double) (yPos + ySize), + (double) this.zLevel, + (double) ((float) (texXPos + xSize) * f), + (double) ((float) (texYPos + ySize) * f1)); + tessellator.addVertexWithUV( + (double) (xPos + xSize), + (double) (yPos + ySize), + (double) this.zLevel, + (double) ((float) (texXPos) * f), + (double) ((float) (texYPos + ySize) * f1)); + tessellator.addVertexWithUV( + (double) (xPos + xSize), + (double) (yPos), + (double) this.zLevel, + (double) ((float) (texXPos) * f), + (double) ((float) (texYPos) * f1)); + tessellator.addVertexWithUV( + (double) (xPos), + (double) (yPos), + (double) this.zLevel, + (double) ((float) (texXPos + xSize) * f), + (double) ((float) (texYPos) * f1)); tessellator.draw(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java index 7bddd4e1..448db1b8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java @@ -1,22 +1,20 @@ package com.brandon3055.draconicevolution.client.gui; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.container.ContainerWeatherController; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.ButtonPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.container.ContainerWeatherController; -import com.brandon3055.draconicevolution.common.network.ButtonPacket; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; - @SideOnly(Side.CLIENT) public class GUIWeatherController extends GuiContainer { @@ -36,7 +34,8 @@ public class GUIWeatherController extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/WeatherController.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/WeatherController.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { @@ -51,9 +50,8 @@ public class GUIWeatherController extends GuiContainer { @Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); - //drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); + // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); drawCenteredString(fontRendererObj, "Weather Controller", xSize / 2, -15, 0x2a4ed0); - } public static final String RAIN_ON_TEXT = "Turn rain on"; @@ -68,7 +66,7 @@ public class GUIWeatherController extends GuiContainer { if (tileWC.mode == 0) text = RAIN_OFF_TEXT; else if (tileWC.mode == 1) text = RAIN_ON_TEXT; else text = STORM_TEXT; - //ID + // ID buttonList.add(new GuiButton(0, guiLeft + 85, guiTop, 85, 20, text)); } @@ -80,7 +78,6 @@ public class GUIWeatherController extends GuiContainer { else if (button.displayString.equals(RAIN_OFF_TEXT)) button.displayString = RAIN_ON_TEXT; else button.displayString = STORM_TEXT; } - } @Override @@ -93,6 +90,4 @@ public class GUIWeatherController extends GuiContainer { super.updateScreen(); this.charges = tileWC.charges; } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java index 8b30754e..f9cee6e5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java @@ -21,17 +21,39 @@ public class GuiButtonAHeight extends GuiButton { FontRenderer fontrenderer = minecraft.fontRenderer; minecraft.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + this.field_146123_n = mouseX >= this.xPosition + && mouseY >= this.yPosition + && mouseX < this.xPosition + this.width + && mouseY < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, width % 2 + this.width / 2, this.height); - this.drawTexturedModalRect(width % 2 + this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height); + this.drawTexturedModalRect( + this.xPosition, this.yPosition, 0, 46 + k * 20, width % 2 + this.width / 2, this.height); + this.drawTexturedModalRect( + width % 2 + this.xPosition + this.width / 2, + this.yPosition, + 200 - this.width / 2, + 46 + k * 20, + this.width / 2, + this.height); if (this.height < 20) { - this.drawTexturedModalRect(xPosition, yPosition + 3, 0, (46 + k * 20) + 20 - height + 3, width % 2 + width / 2, height - 3); - this.drawTexturedModalRect(width % 2 + xPosition + width / 2, yPosition + 3, 200 - width / 2, (46 + k * 20) + 20 - height + 3, width / 2, height - 3); + this.drawTexturedModalRect( + xPosition, + yPosition + 3, + 0, + (46 + k * 20) + 20 - height + 3, + width % 2 + width / 2, + height - 3); + this.drawTexturedModalRect( + width % 2 + xPosition + width / 2, + yPosition + 3, + 200 - width / 2, + (46 + k * 20) + 20 - height + 3, + width / 2, + height - 3); } this.mouseDragged(minecraft, mouseX, mouseY); int l = 14737632; @@ -43,7 +65,12 @@ public class GuiButtonAHeight extends GuiButton { } else if (this.field_146123_n) { l = 16777120; } - this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); + this.drawCenteredString( + fontrenderer, + this.displayString, + this.xPosition + this.width / 2, + this.yPosition + (this.height - 8) / 2, + l); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java index 961f2cc0..364d06b3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java @@ -14,7 +14,8 @@ public class GuiButtonTextOnly extends GuiButton { public String LINKED_PAGE; public int textColour; - public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, int colour) { + public GuiButtonTextOnly( + int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, int colour) { super(id, xPos, yPos, width, hight, displayString); this.LINKED_PAGE = linkedPage; this.textColour = colour; @@ -26,7 +27,10 @@ public class GuiButtonTextOnly extends GuiButton { FontRenderer fontrenderer = minecraft.fontRenderer; minecraft.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + this.field_146123_n = mouseX >= this.xPosition + && mouseY >= this.yPosition + && mouseX < this.xPosition + this.width + && mouseY < this.yPosition + this.height; GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -48,12 +52,22 @@ public class GuiButtonTextOnly extends GuiButton { trimmedDisplayString = EnumChatFormatting.BOLD + "" + EnumChatFormatting.ITALIC + trimmedDisplayString; GL11.glPushMatrix(); GL11.glColor4f(0f, 0f, 0f, 1f); - drawTexturedModalRect(xPosition + (int) (xPosition * 0.01), yPosition + (int) (yPosition * 0.01), 0, 46, (int) (fontrenderer.getStringWidth(trimmedDisplayString) * 0.72) + 2, 8); + drawTexturedModalRect( + xPosition + (int) (xPosition * 0.01), + yPosition + (int) (yPosition * 0.01), + 0, + 46, + (int) (fontrenderer.getStringWidth(trimmedDisplayString) * 0.72) + 2, + 8); GL11.glPopMatrix(); } GL11.glPushMatrix(); GL11.glScalef(0.7F, 0.7F, 1); - fontrenderer.drawString(trimmedDisplayString, (int) (xPosition * 1.45), (int) ((yPosition + (height - 8) / 2) * 1.45), textColour); + fontrenderer.drawString( + trimmedDisplayString, + (int) (xPosition * 1.45), + (int) ((yPosition + (height - 8) / 2) * 1.45), + textColour); GL11.glPopMatrix(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java index 154f9b59..a534c5f8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java @@ -104,13 +104,12 @@ public class GuiHandler implements IGuiHandler { } break; - -// case GUIID_CONTAINER_TEMPLATE: -// TileEntity containerTemp = world.getTileEntity(x, y, z); -// if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { -// return new ContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); -// } -// break; + // case GUIID_CONTAINER_TEMPLATE: + // TileEntity containerTemp = world.getTileEntity(x, y, z); + // if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { + // return new ContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); + // } + // break; } return null; @@ -141,7 +140,9 @@ public class GuiHandler implements IGuiHandler { break; case GUIID_PARTICLEGEN: TileEntity gen = world.getTileEntity(x, y, z); - return (gen != null && gen instanceof TileParticleGenerator) ? new GUIParticleGenerator((TileParticleGenerator) gen, player) : null; + return (gen != null && gen instanceof TileParticleGenerator) + ? new GUIParticleGenerator((TileParticleGenerator) gen, player) + : null; case GUIID_PLAYERDETECTOR: TileEntity detector = world.getTileEntity(x, y, z); if (detector != null && detector instanceof TilePlayerDetectorAdvanced) { @@ -177,29 +178,35 @@ public class GuiHandler implements IGuiHandler { case GUIID_REACTOR: TileEntity reactor = world.getTileEntity(x, y, z); if (reactor != null && reactor instanceof TileReactorCore) { - return new GUIReactor(player, (TileReactorCore) reactor, new ContainerReactor(player, (TileReactorCore) reactor)); + return new GUIReactor( + player, (TileReactorCore) reactor, new ContainerReactor(player, (TileReactorCore) reactor)); } break; case GUIID_TOOL_CONFIG: - return new GUIToolConfig(player, new ContainerAdvTool(player.inventory, new InventoryTool(player, null))); + return new GUIToolConfig( + player, new ContainerAdvTool(player.inventory, new InventoryTool(player, null))); case GUIID_FLOW_GATE: - return world.getTileEntity(x, y, z) instanceof TileGate ? new GUIFlowGate((TileGate) world.getTileEntity(x, y, z)) : null; + return world.getTileEntity(x, y, z) instanceof TileGate + ? new GUIFlowGate((TileGate) world.getTileEntity(x, y, z)) + : null; case GUIID_UPGRADE_MODIFIER: TileEntity containerTemp = world.getTileEntity(x, y, z); if (containerTemp != null && containerTemp instanceof TileUpgradeModifier) { - return new GUIUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp, new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp)); + return new GUIUpgradeModifier( + player.inventory, + (TileUpgradeModifier) containerTemp, + new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp)); } break; -// case GUIID_CONTAINER_TEMPLATE: -// TileEntity containerTemp = world.getTileEntity(x, y, z); -// if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { -// return new GUIContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); -// } -// break; + // case GUIID_CONTAINER_TEMPLATE: + // TileEntity containerTemp = world.getTileEntity(x, y, z); + // if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { + // return new GUIContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); + // } + // break; } return null; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java index cd15b7e4..9b994210 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.client.gui; import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import java.util.ArrayList; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -11,8 +12,6 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import java.util.ArrayList; - /** * Created by brandon3055 on 11/2/2016. */ @@ -40,24 +39,36 @@ public class GuiHudConfig extends GuiScreen { buttonList.add(new GuiButtonAHeight(0, x - 35, y + 95, 70, 15, StatCollector.translateToLocal("gui.back"))); - buttonList.add(new GuiButtonAHeight(1, x + 2, y - 37, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt"))); - buttonList.add(new GuiButtonAHeight(2, x - 81, y - 37, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt"))); + buttonList.add(new GuiButtonAHeight( + 1, x + 2, y - 37, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt"))); + buttonList.add(new GuiButtonAHeight( + 2, x - 81, y - 37, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt"))); buttonList.add(buttonHudFade = new GuiButtonAHeight(3, x - 81, y - 20, 163, 15, "")); - buttonList.add(new GuiButtonAHeight(9, x - 81, y - 3, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt"))); + buttonList.add(new GuiButtonAHeight( + 9, x - 81, y - 3, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt"))); - buttonList.add(new GuiButtonAHeight(4, x + 2, y + 25, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt"))); - buttonList.add(new GuiButtonAHeight(5, x - 81, y + 25, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt"))); + buttonList.add(new GuiButtonAHeight( + 4, x + 2, y + 25, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt"))); + buttonList.add(new GuiButtonAHeight( + 5, x - 81, y + 25, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt"))); buttonList.add(buttonArmorFade = new GuiButtonAHeight(6, x - 81, y + 42, 163, 15, "")); buttonList.add(buttonArmorNumeric = new GuiButtonAHeight(7, x + 2, y + 59, 80, 15, "")); - buttonList.add(new GuiButtonAHeight(8, x - 81, y + 59, 80, 15, StatCollector.translateToLocal("button.de.rotate.txt"))); - buttonList.add(new GuiButtonAHeight(10, x - 81, y + 76, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt"))); + buttonList.add(new GuiButtonAHeight( + 8, x - 81, y + 59, 80, 15, StatCollector.translateToLocal("button.de.rotate.txt"))); + buttonList.add(new GuiButtonAHeight( + 10, x - 81, y + 76, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt"))); } @Override public void updateScreen() { - buttonHudFade.displayString = StatCollector.translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[6] + ".txt"); - buttonArmorFade.displayString = StatCollector.translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[7] + ".txt"); - buttonArmorNumeric.displayString = StatCollector.translateToLocal("button.de.numeric.txt") + " " + (ConfigHandler.hudSettings[9] == 0 ? StatCollector.translateToLocal("gui.de.off.txt") : StatCollector.translateToLocal("gui.de.on.txt")); + buttonHudFade.displayString = + StatCollector.translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[6] + ".txt"); + buttonArmorFade.displayString = + StatCollector.translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[7] + ".txt"); + buttonArmorNumeric.displayString = StatCollector.translateToLocal("button.de.numeric.txt") + " " + + (ConfigHandler.hudSettings[9] == 0 + ? StatCollector.translateToLocal("gui.de.off.txt") + : StatCollector.translateToLocal("gui.de.on.txt")); } @Override @@ -93,7 +104,17 @@ public class GuiHudConfig extends GuiScreen { else ConfigHandler.hudSettings[11] = 0; } - ConfigHandler.config.get("Gui Stuff", "HUD Settings", new int[]{7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).set(ConfigHandler.hudSettings); + ConfigHandler.config + .get( + "Gui Stuff", + "HUD Settings", + new int[] {7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, + "Used to store the position of the armor ant tool HUD's. This should not be modified", + Integer.MIN_VALUE, + Integer.MAX_VALUE, + true, + 12) + .set(ConfigHandler.hudSettings); ConfigHandler.config.save(); } @@ -105,13 +126,35 @@ public class GuiHudConfig extends GuiScreen { int armorX = (int) ((pos[2] / 1000D) * width); int armorY = (int) ((pos[3] / 1000D) * height); - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.configureGuiElements.txt"), width / 2, height / 2 - 90, 0x00FFFF); - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.hudDisplaySettings.txt"), width / 2, height / 2 - 77, 0xFFFFFF); - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.shieldDisplaySettings.txt"), width / 2, height / 2 - 15, 0xFFFFFF); - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.clickAndDragPurpleBoxes.txt"), width / 2, height / 2 + 85, 0xFFFFFF); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.configureGuiElements.txt"), + width / 2, + height / 2 - 90, + 0x00FFFF); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.hudDisplaySettings.txt"), + width / 2, + height / 2 - 77, + 0xFFFFFF); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.shieldDisplaySettings.txt"), + width / 2, + height / 2 - 15, + 0xFFFFFF); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.clickAndDragPurpleBoxes.txt"), + width / 2, + height / 2 + 85, + 0xFFFFFF); - drawCenteredString(fontRendererObj, ConfigHandler.hudSettings[4] + "%", width / 2 + 97, height / 2 - 63, 0xFFFFFF); - drawCenteredString(fontRendererObj, ConfigHandler.hudSettings[5] + "%", width / 2 + 97, height / 2 - 1, 0xFFFFFF); + drawCenteredString( + fontRendererObj, ConfigHandler.hudSettings[4] + "%", width / 2 + 97, height / 2 - 63, 0xFFFFFF); + drawCenteredString( + fontRendererObj, ConfigHandler.hudSettings[5] + "%", width / 2 + 97, height / 2 - 1, 0xFFFFFF); super.drawScreen(x, y, partial); GL11.glDisable(GL12.GL_RESCALE_NORMAL); @@ -140,12 +183,18 @@ public class GuiHudConfig extends GuiScreen { RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - if (GuiHelper.isInRect(armorX - 19, armorY - 19, 39, 39, x, y) || GuiHelper.isInRect(hudX - 19, hudY - 19, 39, 39, x, y)) { - drawHoveringText(new ArrayList() {{ - add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt2.txt")); - }}, x, y, fontRendererObj); + if (GuiHelper.isInRect(armorX - 19, armorY - 19, 39, 39, x, y) + || GuiHelper.isInRect(hudX - 19, hudY - 19, 39, 39, x, y)) { + drawHoveringText( + new ArrayList() { + { + add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt2.txt")); + } + }, + x, + y, + fontRendererObj); } - } @Override @@ -175,7 +224,17 @@ public class GuiHudConfig extends GuiScreen { protected void mouseMovedOrUp(int x, int y, int action) { super.mouseMovedOrUp(x, y, action); draggingHud = draggingArmor = false; - ConfigHandler.config.get("Gui Stuff", "HUD Settings", new int[]{7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).set(ConfigHandler.hudSettings); + ConfigHandler.config + .get( + "Gui Stuff", + "HUD Settings", + new int[] {7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, + "Used to store the position of the armor ant tool HUD's. This should not be modified", + Integer.MIN_VALUE, + Integer.MAX_VALUE, + true, + 12) + .set(ConfigHandler.hudSettings); ConfigHandler.config.save(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java index d08aefee..37e2b984 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java @@ -13,7 +13,8 @@ public class GuiTextureButton extends GuiButton { public int textureXPos; public int textureYPos; - public GuiTextureButton(int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, String text) { + public GuiTextureButton( + int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, String text) { super(id, xPos, yPos, xSise, ySise, text); this.textureXPos = textureXPos; this.textureYPos = textureYPos; @@ -24,12 +25,16 @@ public class GuiTextureButton extends GuiButton { if (this.visible) { FontRenderer fontrenderer = mc.fontRenderer; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; + this.field_146123_n = x >= this.xPosition + && y >= this.yPosition + && x < this.xPosition + this.width + && y < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - this.drawTexturedModalRect(this.xPosition, this.yPosition, textureXPos, textureYPos + k * height, this.width, this.height); + this.drawTexturedModalRect( + this.xPosition, this.yPosition, textureXPos, textureYPos + k * height, this.width, this.height); this.mouseDragged(mc, x, y); int l = 14737632; @@ -42,9 +47,12 @@ public class GuiTextureButton extends GuiButton { l = 16777120; } - this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); + this.drawCenteredString( + fontrenderer, + this.displayString, + this.xPosition + this.width / 2, + this.yPosition + (this.height - 8) / 2, + l); } } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java index df7d13c8..a076410a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java @@ -13,6 +13,9 @@ import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.google.gson.stream.JsonReader; +import java.io.*; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiConfirmOpenLink; @@ -26,10 +29,6 @@ import org.apache.commons.io.IOUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; -import java.io.*; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 6/03/2015. */ @@ -42,17 +41,21 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { private int worldUpdateIn = -1; private static String lang; - public GUIManual() { super(new DummyContainer(), 255, 325); if (currentPage != null) { - collection.addComponent(new ComponentManualPage(0, 0, this, currentPage)).setGroup(GR_PAGE); - collection.addComponent(new ComponentButton(102, 314, 50, 12, 1, this, StatCollector.translateToLocal("button.de.back.txt"))).setGroup(GR_PAGE); + collection + .addComponent(new ComponentManualPage(0, 0, this, currentPage)) + .setGroup(GR_PAGE); + collection + .addComponent(new ComponentButton( + 102, 314, 50, 12, 1, this, StatCollector.translateToLocal("button.de.back.txt"))) + .setGroup(GR_PAGE); collection.setOnlyGroupEnabled(GR_BACKGROUND); collection.setGroupEnabled(GR_PAGE, true); } - //mc.gameSettings.guiScale + // mc.gameSettings.guiScale } @Override @@ -61,8 +64,11 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { loadPages(); if (previousScale == -1) adjustGuiScale(); - if (!Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode().equals(lang)) - loadPages(); + if (!Minecraft.getMinecraft() + .getLanguageManager() + .getCurrentLanguage() + .getLanguageCode() + .equals(lang)) loadPages(); LogHelper.info(ContributorHandler.contributors); } @@ -119,19 +125,69 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { protected ComponentCollection assembleComponents() { collection = new ComponentCollection(0, 0, xSize, ySize, this); - collection.addComponent(new ComponentTexturedRect(0, 0, 255, 255, ResourceHandler.getResource("textures/gui/manualTop.png"))).setGroup(GR_BACKGROUND); - collection.addComponent(new ComponentTexturedRect(0, 255, 255, 69, ResourceHandler.getResource("textures/gui/manualBottom.png"))).setGroup(GR_BACKGROUND); + collection + .addComponent(new ComponentTexturedRect( + 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/manualTop.png"))) + .setGroup(GR_BACKGROUND); + collection + .addComponent(new ComponentTexturedRect( + 0, 255, 255, 69, ResourceHandler.getResource("textures/gui/manualBottom.png"))) + .setGroup(GR_BACKGROUND); - collection.addComponent(new ComponentTexturedRect(7, 100, 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/images/debanner.png"), true)).setGroup(GR_INTRO).setName("BANNER"); + collection + .addComponent(new ComponentTexturedRect( + 7, 100, 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/images/debanner.png"), true)) + .setGroup(GR_INTRO) + .setName("BANNER"); - collection.addComponent(new ComponentButton(75, 260, 100, 20, 0, this, StatCollector.translateToLocal("info.de.manual.indexButton.txt"), StatCollector.translateToLocal("info.de.manual.indexButtonTip.txt"))).setGroup(GR_INTRO); - collection.addComponent(new ComponentButton(75, 285, 100, 20, 2, this, StatCollector.translateToLocal("info.de.manual.contributorsButton.txt"), StatCollector.translateToLocal("info.de.manual.contributorsButtonInfo.txt"))).setGroup(GR_INTRO); - collection.addComponent(new ComponentContributorsPage(0, 0, this)).setGroup(GR_CONTRIBUTORS).setName("CONTRIBUTORS"); + collection + .addComponent(new ComponentButton( + 75, + 260, + 100, + 20, + 0, + this, + StatCollector.translateToLocal("info.de.manual.indexButton.txt"), + StatCollector.translateToLocal("info.de.manual.indexButtonTip.txt"))) + .setGroup(GR_INTRO); + collection + .addComponent(new ComponentButton( + 75, + 285, + 100, + 20, + 2, + this, + StatCollector.translateToLocal("info.de.manual.contributorsButton.txt"), + StatCollector.translateToLocal("info.de.manual.contributorsButtonInfo.txt"))) + .setGroup(GR_INTRO); + collection + .addComponent(new ComponentContributorsPage(0, 0, this)) + .setGroup(GR_CONTRIBUTORS) + .setName("CONTRIBUTORS"); - collection.addComponent(new ComponentTextureButton(140, 290, 0, 0, 100, 30, 10, this, "", "", ResourceHandler.getResource("textures/gui/patreon.png")).forceFullRender()).setGroup(GR_CONTRIBUTORS); + collection + .addComponent(new ComponentTextureButton( + 140, + 290, + 0, + 0, + 100, + 30, + 10, + this, + "", + "", + ResourceHandler.getResource("textures/gui/patreon.png")) + .forceFullRender()) + .setGroup(GR_CONTRIBUTORS); for (int i = 0; i < pageList.size(); i++) { - collection.addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))).setGroup(GR_INDEX).setName("INDEX_BUTTON_" + i); + collection + .addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))) + .setGroup(GR_INDEX) + .setName("INDEX_BUTTON_" + i); pageLength += 20; } @@ -144,7 +200,8 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { @Override public void handleScrollInput(int direction) { - if (collection.getComponent("INDEX_BUTTON_0") != null && collection.getComponent("INDEX_BUTTON_0").isEnabled()) { + if (collection.getComponent("INDEX_BUTTON_0") != null + && collection.getComponent("INDEX_BUTTON_0").isEnabled()) { if (currentPage != null) return; scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10); @@ -153,15 +210,15 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { if (pageLength + 40 <= ySize) scrollOffset = 0; barPosition = (int) (((double) scrollOffset / scrollLimit) * 247D); - } else if (collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) { + } else if (collection.getComponent("CONTRIBUTORS") != null + && collection.getComponent("CONTRIBUTORS").isEnabled()) { ComponentContributorsPage page = (ComponentContributorsPage) collection.getComponent("CONTRIBUTORS"); barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); - } else if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) { + } else if (collection.getComponent("OPEN_PAGE") != null + && collection.getComponent("OPEN_PAGE").isEnabled()) { ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); } - - } @Override @@ -169,10 +226,17 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { super.drawScreen(mouseX, mouseY, par3); int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; - if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) - fontRendererObj.drawSplitString(StatCollector.translateToLocal("info.de.manual.introTxt.txt"), posX + 20, posY + 190, 150, 0x000000); + if (collection.getComponent("BANNER") != null + && collection.getComponent("BANNER").isEnabled()) + fontRendererObj.drawSplitString( + StatCollector.translateToLocal("info.de.manual.introTxt.txt"), + posX + 20, + posY + 190, + 150, + 0x000000); - if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) return; + if (collection.getComponent("BANNER") != null + && collection.getComponent("BANNER").isEnabled()) return; ResourceHandler.bindResource("textures/gui/Widgets.png"); GL11.glColor4f(1F, 1F, 1F, 1F); drawTexturedModalRect(guiLeft, guiTop, 118, 20, 17, 17); @@ -191,14 +255,21 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { public void updateScreen() { super.updateScreen(); - disableScrollBar = collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled(); + disableScrollBar = collection.getComponent("BANNER") != null + && collection.getComponent("BANNER").isEnabled(); - if (!scrollPressed && collection.getComponent("INDEX_BUTTON_0") != null && collection.getComponent("INDEX_BUTTON_0").isEnabled()) { + if (!scrollPressed + && collection.getComponent("INDEX_BUTTON_0") != null + && collection.getComponent("INDEX_BUTTON_0").isEnabled()) { barPosition = (int) (((double) scrollOffset / scrollLimit) * 247D); - } else if (!scrollPressed && collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) { + } else if (!scrollPressed + && collection.getComponent("CONTRIBUTORS") != null + && collection.getComponent("CONTRIBUTORS").isEnabled()) { ComponentContributorsPage page = (ComponentContributorsPage) collection.getComponent("CONTRIBUTORS"); barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); - } else if (!scrollPressed && collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) { + } else if (!scrollPressed + && collection.getComponent("OPEN_PAGE") != null + && collection.getComponent("OPEN_PAGE").isEnabled()) { ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); } @@ -229,7 +300,6 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); if (disableScrollBar) return; - ResourceHandler.bindResource("textures/gui/manualBottom.png"); GL11.glColor4f(1F, 1F, 1F, 1F); drawTexturedModalRect(guiLeft - 16, guiTop + 10, 0, 146, 15, 100); @@ -278,15 +348,18 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { } public static void loadPages() { - lang = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode(); + lang = Minecraft.getMinecraft() + .getLanguageManager() + .getCurrentLanguage() + .getLanguageCode(); - ResourceLocation rsLocation = new ResourceLocation(References.RESOURCESPREFIX + "manual/manual-" + lang + ".json"); + ResourceLocation rsLocation = + new ResourceLocation(References.RESOURCESPREFIX + "manual/manual-" + lang + ".json"); IResource resource = null; try { resource = Minecraft.getMinecraft().getResourceManager().getResource(rsLocation); - } - catch (IOException e) { + } catch (IOException e) { LogHelper.warn("##################################################################################"); LogHelper.warn(""); LogHelper.warn("Info Tablet language localisation is not available for the selected language: " + lang); @@ -297,8 +370,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { rsLocation = new ResourceLocation(References.RESOURCESPREFIX + "manual/manual-en_US.json"); try { resource = Minecraft.getMinecraft().getResourceManager().getResource(rsLocation); - } - catch (IOException e1) { + } catch (IOException e1) { LogHelper.error("Well that didn't work... "); e1.printStackTrace(); } @@ -309,7 +381,6 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { return; } - try { File manualJSON = new File(ResourceHandler.getConfigFolder(), "manual.json"); @@ -319,14 +390,14 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { is.close(); os.close(); - JsonReader reader = new JsonReader(new InputStreamReader(new FileInputStream(manualJSON),"utf-8")); + JsonReader reader = new JsonReader(new InputStreamReader(new FileInputStream(manualJSON), "utf-8")); List images; List content; reader.beginArray(); - - //Read next page + + // Read next page while (reader.hasNext()) { String name; String nameL = null; @@ -335,18 +406,18 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { content = new ArrayList(); reader.beginObject(); - - //Read page name + + // Read page name String s = reader.nextName(); if (s.equals("name")) { name = reader.nextString(); } else { - reader.close(); - throw new IOException("Error reading manual.json (invalid name in place of \"name\" [Found:\"" + s + "\"])"); + reader.close(); + throw new IOException( + "Error reading manual.json (invalid name in place of \"name\" [Found:\"" + s + "\"])"); } - - //Read page images + // Read page images s = reader.nextName(); if (s.equals("nameL")) { nameL = reader.nextString(); @@ -365,11 +436,12 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { if (!imageURLs.contains(url)) imageURLs.add(url); } reader.endArray(); - } else{ - reader.close(); - throw new IOException("Error reading manual.json (invalid name in place of \"name\" [Found:\"" + s + "\"])"); - } - //Read page content + } else { + reader.close(); + throw new IOException( + "Error reading manual.json (invalid name in place of \"name\" [Found:\"" + s + "\"])"); + } + // Read page content s = reader.nextName(); if (s.equals("content")) { reader.beginArray(); @@ -377,25 +449,28 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { content.add(reader.nextString()); } reader.endArray(); - } else{ - reader.close(); - throw new IOException("Error reading manual.json (invalid name in place of \"name\" [Found:\"" + s + "\"])"); - } + } else { + reader.close(); + throw new IOException( + "Error reading manual.json (invalid name in place of \"name\" [Found:\"" + s + "\"])"); + } reader.endObject(); if (isValidPage(name)) - pageList.add(new ManualPage(name, images.toArray(new String[images.size()]), content.toArray(new String[content.size()]), nameL, meta)); + pageList.add(new ManualPage( + name, + images.toArray(new String[images.size()]), + content.toArray(new String[content.size()]), + nameL, + meta)); } reader.endArray(); reader.close(); - } - catch (FileNotFoundException e) { + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { e.printStackTrace(); } - catch (IOException e) { - e.printStackTrace(); - } - } @Override @@ -404,11 +479,22 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { if (buttonPressed) return; for (ComponentBase c : collection.getComponents()) { - if (c instanceof ComponentIndexButton && c.isEnabled() && ((ComponentIndexButton) c).isOnScreen() && c.isMouseOver(x - guiLeft, y - guiTop)) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + if (c instanceof ComponentIndexButton + && c.isEnabled() + && ((ComponentIndexButton) c).isOnScreen() + && c.isMouseOver(x - guiLeft, y - guiTop)) { + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); currentPage = ((ComponentIndexButton) c).getPage(); - collection.addComponent(new ComponentManualPage(0, 0, this, currentPage)).setGroup(GR_PAGE).setName("OPEN_PAGE"); - collection.addComponent(new ComponentButton(102, 314, 50, 12, 1, this, StatCollector.translateToLocal("button.de.back.txt"))).setGroup(GR_PAGE); + collection + .addComponent(new ComponentManualPage(0, 0, this, currentPage)) + .setGroup(GR_PAGE) + .setName("OPEN_PAGE"); + collection + .addComponent(new ComponentButton( + 102, 314, 50, 12, 1, this, StatCollector.translateToLocal("button.de.back.txt"))) + .setGroup(GR_PAGE); collection.setOnlyGroupEnabled(GR_BACKGROUND); collection.setGroupEnabled(GR_PAGE, true); break; @@ -418,13 +504,15 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { @Override public void barMoved(double position) { - if (collection.getComponent("INDEX_BUTTON_0") != null && collection.getComponent("INDEX_BUTTON_0").isEnabled()) - scrollOffset = (int) (position * scrollLimit); - else if (collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) { + if (collection.getComponent("INDEX_BUTTON_0") != null + && collection.getComponent("INDEX_BUTTON_0").isEnabled()) scrollOffset = (int) (position * scrollLimit); + else if (collection.getComponent("CONTRIBUTORS") != null + && collection.getComponent("CONTRIBUTORS").isEnabled()) { ComponentContributorsPage page = (ComponentContributorsPage) collection.getComponent("CONTRIBUTORS"); if (page.scrollLimit < 0) return; page.scrollOffset = (int) (position * page.scrollLimit); - } else if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) { + } else if (collection.getComponent("OPEN_PAGE") != null + && collection.getComponent("OPEN_PAGE").isEnabled()) { ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); if (page.scrollLimit < 0) return; page.scrollOffset = (int) (position * page.scrollLimit); @@ -443,4 +531,3 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { mc.displayGuiScreen(this); } } - diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java index 9bfc31f8..968a72d7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java @@ -6,6 +6,8 @@ import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.container.ContainerReactor; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.player.EntityPlayer; @@ -13,9 +15,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; -import java.util.List; - /** * Created by brandon3055 on 30/7/2015. */ @@ -33,28 +32,82 @@ public class GUIReactor extends GUIBase { @Override protected ComponentCollection assembleComponents() { collection = new ComponentCollection(0, 0, 248, 222, this); - collection.addComponent(new ComponentTexturedRect(0, 0, xSize, ySize, ResourceHandler.getResource("textures/gui/Reactor.png"))); - collection.addComponent(new ComponentTextureButton(14, 190, 18, 162, 18, 18, 0, this, "", StatCollector.translateToLocal("button.de.reactorCharge.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))).setName("CHARGE"); - collection.addComponent(new ComponentTextureButton(14, 190, 18, 54, 18, 18, 1, this, "", StatCollector.translateToLocal("button.de.reactorStart.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))).setName("ACTIVATE"); - collection.addComponent(new ComponentTextureButton(216, 190, 18, 108, 18, 18, 2, this, "", StatCollector.translateToLocal("button.de.reactorStop.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))).setName("DEACTIVATE"); - collection.addComponent(new ComponentButton(9, 120, 43, 15, 3, this, StatCollector.translateToLocal("button.de.stats.txt"), StatCollector.translateToLocal("button.de.statsShow.txt"))).setName("STATS"); + collection.addComponent( + new ComponentTexturedRect(0, 0, xSize, ySize, ResourceHandler.getResource("textures/gui/Reactor.png"))); + collection + .addComponent(new ComponentTextureButton( + 14, + 190, + 18, + 162, + 18, + 18, + 0, + this, + "", + StatCollector.translateToLocal("button.de.reactorCharge.txt"), + ResourceHandler.getResource("textures/gui/Widgets.png"))) + .setName("CHARGE"); + collection + .addComponent(new ComponentTextureButton( + 14, + 190, + 18, + 54, + 18, + 18, + 1, + this, + "", + StatCollector.translateToLocal("button.de.reactorStart.txt"), + ResourceHandler.getResource("textures/gui/Widgets.png"))) + .setName("ACTIVATE"); + collection + .addComponent(new ComponentTextureButton( + 216, + 190, + 18, + 108, + 18, + 18, + 2, + this, + "", + StatCollector.translateToLocal("button.de.reactorStop.txt"), + ResourceHandler.getResource("textures/gui/Widgets.png"))) + .setName("DEACTIVATE"); + collection + .addComponent(new ComponentButton( + 9, + 120, + 43, + 15, + 3, + this, + StatCollector.translateToLocal("button.de.stats.txt"), + StatCollector.translateToLocal("button.de.statsShow.txt"))) + .setName("STATS"); return collection; } @Override protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); - //Draw I/O Slots + // Draw I/O Slots if (reactor.reactorState == TileReactorCore.STATE_OFFLINE) { RenderHelper.enableGUIStandardItemLighting(); drawTexturedModalRect(guiLeft + 14, guiTop + 139, 14, ySize, 18, 18); drawTexturedModalRect(guiLeft + 216, guiTop + 139, 32, ySize, 18, 18); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.insert.txt"), guiLeft + 8, guiTop + 159, 0); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 13, guiTop + 168, 0); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.insert.txt"), guiLeft + 8, guiTop + 159, 0); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 13, guiTop + 168, 0); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.extract.txt"), guiLeft + 206, guiTop + 159, 0); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 215, guiTop + 168, 0); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.extract.txt"), guiLeft + 206, guiTop + 159, 0); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 215, guiTop + 168, 0); } drawCenteredString(fontRendererObj, "Draconic Reactor", guiLeft + xSize / 2, guiTop + 4, 0x00FFFF); } @@ -65,7 +118,7 @@ public class GUIReactor extends GUIBase { ResourceHandler.bindResource("textures/gui/Reactor.png"); GL11.glColor4f(1f, 1f, 1f, 1f); - //Draw Indicators + // Draw Indicators double value = Math.min(reactor.reactionTemperature, reactor.maxReactTemperature) / reactor.maxReactTemperature; int pixOffset = (int) (value * 108); drawTexturedModalRect(11, 112 - pixOffset, 0, 222, 14, 5); @@ -103,9 +156,16 @@ public class GUIReactor extends GUIBase { drawStats(); } - String status = StatCollector.translateToLocal("gui.de.status.txt") + ": " + (reactor.reactorState == 0 ? EnumChatFormatting.DARK_GRAY : reactor.reactorState == 1 ? EnumChatFormatting.RED : reactor.reactorState == 2 ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.RED) + StatCollector.translateToLocal("gui.de.status" + reactor.reactorState + ".txt"); + String status = StatCollector.translateToLocal("gui.de.status.txt") + ": " + + (reactor.reactorState == 0 + ? EnumChatFormatting.DARK_GRAY + : reactor.reactorState == 1 + ? EnumChatFormatting.RED + : reactor.reactorState == 2 ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.RED) + + StatCollector.translateToLocal("gui.de.status" + reactor.reactorState + ".txt"); if (reactor.reactorState == 1 && reactor.canStart()) - status = StatCollector.translateToLocal("gui.de.status.txt") + ": " + EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocal("gui.de.status1_5.txt"); + status = StatCollector.translateToLocal("gui.de.status.txt") + ": " + EnumChatFormatting.DARK_GREEN + + StatCollector.translateToLocal("gui.de.status1_5.txt"); if (!showStats) fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 125, 0); } @@ -121,37 +181,52 @@ public class GUIReactor extends GUIBase { text.add(StatCollector.translateToLocal("gui.de.fieldStrength.txt")); if (reactor.maxFieldCharge > 0) text.add(Utills.round(reactor.fieldCharge / reactor.maxFieldCharge * 100D, 100D) + "%"); - text.add(Utills.addCommas((int) reactor.fieldCharge) + " / " + Utills.addCommas((int) reactor.maxFieldCharge)); //todo refine or remove + text.add(Utills.addCommas((int) reactor.fieldCharge) + " / " + + Utills.addCommas((int) reactor.maxFieldCharge)); // todo refine or remove drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(197, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { text.add(StatCollector.translateToLocal("gui.de.energySaturation.txt")); if (reactor.maxEnergySaturation > 0) - text.add(Utills.round((double) reactor.energySaturation / (double) reactor.maxEnergySaturation * 100D, 100D) + "%"); - text.add(Utills.addCommas(reactor.energySaturation) + " / " + Utills.addCommas(reactor.maxEnergySaturation)); //todo refine or remove + text.add(Utills.round( + (double) reactor.energySaturation / (double) reactor.maxEnergySaturation * 100D, 100D) + + "%"); + text.add(Utills.addCommas(reactor.energySaturation) + " / " + + Utills.addCommas(reactor.maxEnergySaturation)); // todo refine or remove drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(221, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { text.add(StatCollector.translateToLocal("gui.de.fuelConversion.txt")); if (reactor.reactorFuel + reactor.convertedFuel > 0) - text.add(Utills.round(((double) reactor.convertedFuel + reactor.conversionUnit) / ((double) reactor.convertedFuel + (double) reactor.reactorFuel) * 100D, 100D) + "%"); - text.add(reactor.convertedFuel + " / " + (reactor.convertedFuel + reactor.reactorFuel)); //todo refine or remove + text.add(Utills.round( + ((double) reactor.convertedFuel + reactor.conversionUnit) + / ((double) reactor.convertedFuel + (double) reactor.reactorFuel) + * 100D, + 100D) + + "%"); + text.add(reactor.convertedFuel + " / " + + (reactor.convertedFuel + reactor.reactorFuel)); // todo refine or remove drawHoveringText(text, mouseX, mouseY, fontRendererObj); } if (showStats) { if (GuiHelper.isInRect(53, 15, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacTempLoadFactor.txt"), 200)); + text.addAll(fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacTempLoadFactor.txt"), 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 40, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacCoreMass.txt"), 200)); + text.addAll(fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacCoreMass.txt"), 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 65, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacGenRate.txt"), 200)); + text.addAll(fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacGenRate.txt"), 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 88, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacInputRate.txt"), 200)); + text.addAll(fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacInputRate.txt"), 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 113, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth(StatCollector.translateToLocal("gui.de.reacConversionRate.txt"), 200)); + text.addAll(fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacConversionRate.txt"), 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } } @@ -163,26 +238,34 @@ public class GUIReactor extends GUIBase { fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.tempLoad.name"), 55, 16, 0x0000FF); fontRendererObj.drawString(Utills.round(reactor.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.mass.name"), 55, 16 + 24, 0x0000FF); - fontRendererObj.drawString(Utills.round((reactor.reactorFuel + reactor.convertedFuel) / 1296D, 100) + "m^3", 60, 2 + 2 * 24, 0); + fontRendererObj.drawString( + Utills.round((reactor.reactorFuel + reactor.convertedFuel) / 1296D, 100) + "m^3", 60, 2 + 2 * 24, 0); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.genRate.name"), 55, 16 + 2 * 24, 0x0000FF); fontRendererObj.drawString(Utills.addCommas((int) reactor.generationRate) + "RF/t", 60, 2 + 3 * 24, 0); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF); - fontRendererObj.drawString(Utills.addCommas((int) Math.min(inputRate, Integer.MAX_VALUE)) + "RF/t", 60, 2 + 4 * 24, 0); - fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF); - fontRendererObj.drawString(Utills.addCommas((int) Math.round(reactor.fuelUseRate * 1000000D)) + "nb/t", 60, 2 + 5 * 24, 0); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF); + fontRendererObj.drawString( + Utills.addCommas((int) Math.min(inputRate, Integer.MAX_VALUE)) + "RF/t", 60, 2 + 4 * 24, 0); + fontRendererObj.drawString( + StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF); + fontRendererObj.drawString( + Utills.addCommas((int) Math.round(reactor.fuelUseRate * 1000000D)) + "nb/t", 60, 2 + 5 * 24, 0); } @Override public void updateScreen() { - if (reactor.reactorState == TileReactorCore.STATE_INVALID || reactor.reactorState == TileReactorCore.STATE_OFFLINE || reactor.reactorState == TileReactorCore.STATE_STOP) + if (reactor.reactorState == TileReactorCore.STATE_INVALID + || reactor.reactorState == TileReactorCore.STATE_OFFLINE + || reactor.reactorState == TileReactorCore.STATE_STOP) collection.getComponent("DEACTIVATE").setEnabled(false); else collection.getComponent("DEACTIVATE").setEnabled(true); - if ((reactor.reactorState == TileReactorCore.STATE_OFFLINE || (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) && reactor.canCharge()) - collection.getComponent("CHARGE").setEnabled(true); + if ((reactor.reactorState == TileReactorCore.STATE_OFFLINE + || (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) + && reactor.canCharge()) collection.getComponent("CHARGE").setEnabled(true); else collection.getComponent("CHARGE").setEnabled(false); - if ((reactor.reactorState == TileReactorCore.STATE_START || reactor.reactorState == TileReactorCore.STATE_STOP) && reactor.canStart()) - collection.getComponent("ACTIVATE").setEnabled(true); + if ((reactor.reactorState == TileReactorCore.STATE_START || reactor.reactorState == TileReactorCore.STATE_STOP) + && reactor.canStart()) collection.getComponent("ACTIVATE").setEnabled(true); else collection.getComponent("ACTIVATE").setEnabled(false); super.updateScreen(); } @@ -193,8 +276,9 @@ public class GUIReactor extends GUIBase { if (id < 3) container.sendObjectToServer(null, 20, id); else if (id == 3) { showStats = !showStats; - ((ComponentButton) collection.getComponent("STATS")).hoverText = showStats ? StatCollector.translateToLocal("button.de.statsHide.txt") : StatCollector.translateToLocal("button.de.statsShow.txt"); + ((ComponentButton) collection.getComponent("STATS")).hoverText = showStats + ? StatCollector.translateToLocal("button.de.statsHide.txt") + : StatCollector.translateToLocal("button.de.statsShow.txt"); } - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java index 79d8eef3..2e6752f8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java @@ -17,6 +17,8 @@ import com.brandon3055.draconicevolution.common.network.ItemConfigPacket; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; @@ -25,16 +27,14 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.util.StringUtils; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 26/12/2014. */ public class GUIToolConfig extends GUIBase { public EntityPlayer player; - private static final ResourceLocation inventoryTexture = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); + private static final ResourceLocation inventoryTexture = + new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); private int screenLevel = 0; private ItemStack editingItem; private ContainerAdvTool container; @@ -52,15 +52,28 @@ public class GUIToolConfig extends GUIBase { public void initGui() { super.initGui(); if (ContributorHandler.contributors.containsKey(player.getCommandSenderName())) { - ContributorHandler.Contributor contributor = ContributorHandler.contributors.get(player.getCommandSenderName()); + ContributorHandler.Contributor contributor = + ContributorHandler.contributors.get(player.getCommandSenderName()); if (!contributor.isUserValid(player)) return; buttonList.clear(); if (contributor.contributionLevel >= 1) - buttonList.add(new GuiButton(0, guiLeft - 150, guiTop, 150, 20, "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"))); + buttonList.add(new GuiButton( + 0, + guiLeft - 150, + guiTop, + 150, + 20, + "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"))); if (contributor.contribution.toLowerCase().contains("patreon")) - buttonList.add(new GuiButton(1, guiLeft - 150, guiTop + 22, 150, 20, "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled"))); + buttonList.add(new GuiButton( + 1, + guiLeft - 150, + guiTop + 22, + 150, + 20, + "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled"))); } } @@ -68,51 +81,76 @@ public class GUIToolConfig extends GUIBase { protected void actionPerformed(GuiButton button) { super.actionPerformed(button); if (ContributorHandler.contributors.containsKey(player.getCommandSenderName())) { - ContributorHandler.Contributor contributor = ContributorHandler.contributors.get(player.getCommandSenderName()); + ContributorHandler.Contributor contributor = + ContributorHandler.contributors.get(player.getCommandSenderName()); if (!contributor.isUserValid(player)) return; if (button.id == 0) { contributor.contributorWingsEnabled = !contributor.contributorWingsEnabled; - button.displayString = "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"); + button.displayString = + "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"); } else if (button.id == 1) { contributor.patreonBadgeEnabled = !contributor.patreonBadgeEnabled; button.displayString = "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled"); } - DraconicEvolution.network.sendToServer(new ContributorPacket(player.getCommandSenderName(), contributor.contributorWingsEnabled, contributor.patreonBadgeEnabled)); + DraconicEvolution.network.sendToServer(new ContributorPacket( + player.getCommandSenderName(), + contributor.contributorWingsEnabled, + contributor.patreonBadgeEnabled)); } - } @Override protected ComponentCollection assembleComponents() { ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize, this).setOpenBoarders(); - c.addComponent(new ComponentTexturedRect(0, -15, 198, 20, inventoryTexture)).setGroup("TEXT_TAB"); - c.addComponent(new ComponentTexturedRect(0, 0, 198, 89, inventoryTexture)).setGroup("BACKGROUND"); - c.addComponent(new ComponentTexturedRect(0, 13, 0, 9, 198, 80, inventoryTexture, false)).setGroup("BACKGROUND_EXTENSION"); - c.addComponent(new ComponentButton(3, 26, 20, 12, 0, this, "<=", StatCollector.translateToLocal("gui.back"))).setGroup("BUTTONS").setName("BACK_BUTTON"); - c.addComponent(new ComponentButton(3, 39, 20, 12, 1, this, "Inv", StatCollector.translateToLocal("gui.de.itemInventory.txt"))).setGroup("BUTTONS").setName("INVENTORY_BUTTON"); - c.addComponent(new ComponentFieldAdjuster(4, 34, null, this)).setGroup("FIELD_BUTTONS").setName("FIELD_CONFIG_BUTTON_ARRAY"); - c.addComponent(new ComponentButton(0, ySize, xSize, 14, 2, this, StatCollector.translateToLocal("gui.de.configureGuiElements.txt")).setGroup("INV_SCREEN")); + c.addComponent(new ComponentTexturedRect(0, -15, 198, 20, inventoryTexture)) + .setGroup("TEXT_TAB"); + c.addComponent(new ComponentTexturedRect(0, 0, 198, 89, inventoryTexture)) + .setGroup("BACKGROUND"); + c.addComponent(new ComponentTexturedRect(0, 13, 0, 9, 198, 80, inventoryTexture, false)) + .setGroup("BACKGROUND_EXTENSION"); + c.addComponent(new ComponentButton(3, 26, 20, 12, 0, this, "<=", StatCollector.translateToLocal("gui.back"))) + .setGroup("BUTTONS") + .setName("BACK_BUTTON"); + c.addComponent(new ComponentButton( + 3, 39, 20, 12, 1, this, "Inv", StatCollector.translateToLocal("gui.de.itemInventory.txt"))) + .setGroup("BUTTONS") + .setName("INVENTORY_BUTTON"); + c.addComponent(new ComponentFieldAdjuster(4, 34, null, this)) + .setGroup("FIELD_BUTTONS") + .setName("FIELD_CONFIG_BUTTON_ARRAY"); + c.addComponent(new ComponentButton( + 0, ySize, xSize, 14, 2, this, StatCollector.translateToLocal("gui.de.configureGuiElements.txt")) + .setGroup("INV_SCREEN")); - ComponentTextField textField = (ComponentTextField) new ComponentTextField(this, 3, -12, 191, 12).setLabel(StatCollector.translateToLocal("gui.de.profile.txt") + ":", 0xE0E0E0).setGroup("TEXT_TAB").setName("PROFILE_TEXT_FIELD"); + ComponentTextField textField = (ComponentTextField) new ComponentTextField(this, 3, -12, 191, 12) + .setLabel(StatCollector.translateToLocal("gui.de.profile.txt") + ":", 0xE0E0E0) + .setGroup("TEXT_TAB") + .setName("PROFILE_TEXT_FIELD"); c.addComponent(textField); return c; } protected void addDependentComponents() { for (int x = 0; x < 9; x++) { - collection.addComponent(new ComponentConfigItemButton(29 + 18 * x, 64, x, player)).setGroup("INV_SCREEN"); + collection + .addComponent(new ComponentConfigItemButton(29 + 18 * x, 64, x, player)) + .setGroup("INV_SCREEN"); } for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - collection.addComponent(new ComponentConfigItemButton(29 + 18 * x, 7 + y * 18, x + y * 9 + 9, player)).setGroup("INV_SCREEN"); + collection + .addComponent(new ComponentConfigItemButton(29 + 18 * x, 7 + y * 18, x + y * 9 + 9, player)) + .setGroup("INV_SCREEN"); } } for (int y = 0; y < 4; y++) { - collection.addComponent(new ComponentConfigItemButton(6, 7 + y * 19, 39 - y, player)).setGroup("INV_SCREEN"); + collection + .addComponent(new ComponentConfigItemButton(6, 7 + y * 19, 39 - y, player)) + .setGroup("INV_SCREEN"); } setLevel(0); @@ -136,7 +174,10 @@ public class GUIToolConfig extends GUIBase { int fieldOffsetY = 5; for (ComponentBase component : collection.getComponents()) { - if (component.isEnabled() && component instanceof ComponentConfigItemButton && component.isMouseOver(x - this.guiLeft, y - this.guiTop) && ((ComponentConfigItemButton) component).hasValidItem) { + if (component.isEnabled() + && component instanceof ComponentConfigItemButton + && component.isMouseOver(x - this.guiLeft, y - this.guiTop) + && ((ComponentConfigItemButton) component).hasValidItem) { ItemStack stack = player.inventory.getStackInSlot(((ComponentConfigItemButton) component).slot); if (stack == null || !(stack.getItem() instanceof IConfigurableItem)) return; buttonPressed = true; @@ -145,7 +186,9 @@ public class GUIToolConfig extends GUIBase { setEditingItem(stack, ((ComponentConfigItemButton) component).slot); setLevel(1); for (ItemConfigField field : item.getFields(stack, ((ComponentConfigItemButton) component).slot)) { - collection.addComponent(new ComponentFieldButton(fieldOffsetX, fieldOffsetY, player, field, this)).setGroup("LIST_SCREEN"); + collection + .addComponent(new ComponentFieldButton(fieldOffsetX, fieldOffsetY, player, field, this)) + .setGroup("LIST_SCREEN"); fieldOffsetY += 12; } @@ -160,7 +203,8 @@ public class GUIToolConfig extends GUIBase { } } - if (collection.getComponent("PROFILE_TEXT_FIELD") instanceof ComponentTextField && !collection.getComponent("PROFILE_TEXT_FIELD").isMouseOver(x - guiLeft, y - guiTop)) { + if (collection.getComponent("PROFILE_TEXT_FIELD") instanceof ComponentTextField + && !collection.getComponent("PROFILE_TEXT_FIELD").isMouseOver(x - guiLeft, y - guiTop)) { ((ComponentTextField) collection.getComponent("PROFILE_TEXT_FIELD")).textField.setFocused(false); } } @@ -169,13 +213,13 @@ public class GUIToolConfig extends GUIBase { public void buttonClicked(int id, int button) { super.buttonClicked(id, button); - if (id == 0 && screenLevel > 0) {//button back + if (id == 0 && screenLevel > 0) { // button back setLevel(screenLevel - 1); - } else if (id == 1 && editingItem != null) {//inventory button + } else if (id == 1 && editingItem != null) { // inventory button setLevel(3); Minecraft.getMinecraft().displayGuiScreen(new GUIToolInventory(player, container, this)); -// LogHelper.info("Pre send container " + Minecraft.getMinecraft().thePlayer.openContainer); -// DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLINVENTORY, false)); + // LogHelper.info("Pre send container " + Minecraft.getMinecraft().thePlayer.openContainer); + // DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLINVENTORY, false)); } else if (id == 2) { Minecraft.getMinecraft().displayGuiScreen(new GuiHudConfig(this)); } @@ -184,29 +228,33 @@ public class GUIToolConfig extends GUIBase { public void setLevel(int level) { this.screenLevel = level; - if (level == 0) {//inv screen + if (level == 0) { // inv screen collection.schedulRemoval("LIST_SCREEN"); collection.setOnlyGroupEnabled("INV_SCREEN"); collection.setGroupEnabled("BACKGROUND", true); collection.setComponentEnabled("BACK_BUTTON", false); slot = -1; - } else if (level == 1) {//list screen + } else if (level == 1) { // list screen collection.setOnlyGroupEnabled("LIST_SCREEN"); collection.setGroupEnabled("BACKGROUND", true); collection.setGroupEnabled("BACKGROUND_EXTENSION", true); - if (editingItem != null && editingItem.getItem() instanceof IConfigurableItem && ((IConfigurableItem) editingItem.getItem()).hasProfiles()) + if (editingItem != null + && editingItem.getItem() instanceof IConfigurableItem + && ((IConfigurableItem) editingItem.getItem()).hasProfiles()) collection.setGroupEnabled("TEXT_TAB", true); collection.setComponentEnabled("BACK_BUTTON", true); if (editingItem != null && editingItem.getItem() instanceof IInventoryTool) collection.setComponentEnabled("INVENTORY_BUTTON", true); - if (collection.getComponent("BACK_BUTTON") != null) collection.getComponent("BACK_BUTTON").setY(26); - } else if (level == 2) {//field screen + if (collection.getComponent("BACK_BUTTON") != null) + collection.getComponent("BACK_BUTTON").setY(26); + } else if (level == 2) { // field screen collection.setOnlyGroupEnabled("FIELD_BUTTONS"); collection.setGroupEnabled("BACKGROUND", true); collection.setComponentEnabled("BACK_BUTTON", true); - if (collection.getComponent("BACK_BUTTON") != null) collection.getComponent("BACK_BUTTON").setY(3); -// slot = -1; - } else if (level == 3) {//inventory screen + if (collection.getComponent("BACK_BUTTON") != null) + collection.getComponent("BACK_BUTTON").setY(3); + // slot = -1; + } else if (level == 3) { // inventory screen } } @@ -229,7 +277,9 @@ public class GUIToolConfig extends GUIBase { @Override protected void keyTyped(char par1, int par2) { - if (collection.getComponent("PROFILE_TEXT_FIELD") instanceof ComponentTextField && ((ComponentTextField) collection.getComponent("PROFILE_TEXT_FIELD")).isFocused() && par2 != 1) { + if (collection.getComponent("PROFILE_TEXT_FIELD") instanceof ComponentTextField + && ((ComponentTextField) collection.getComponent("PROFILE_TEXT_FIELD")).isFocused() + && par2 != 1) { collection.keyTyped(par1, par2); return; } @@ -251,16 +301,23 @@ public class GUIToolConfig extends GUIBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); if (slot > -1) editingItem = player.inventory.getStackInSlot(slot); - if (slot > -1 && editingItem != null && editingItem.getUnlocalizedName().toLowerCase().contains("bow")) { + if (slot > -1 + && editingItem != null + && editingItem.getUnlocalizedName().toLowerCase().contains("bow")) { BowHandler.BowProperties properties = new BowHandler.BowProperties(editingItem, player); - if (!properties.canFire() && properties.cantFireMessage != null && !properties.cantFireMessage.equals("msg.de.outOfArrows.name")) { - fontRendererObj.drawSplitString(StatCollector.translateToLocal(properties.cantFireMessage), 0, ySize + 5, xSize, 0xFF0000); + if (!properties.canFire() + && properties.cantFireMessage != null + && !properties.cantFireMessage.equals("msg.de.outOfArrows.name")) { + fontRendererObj.drawSplitString( + StatCollector.translateToLocal(properties.cantFireMessage), 0, ySize + 5, xSize, 0xFF0000); } List list = new ArrayList(); - list.add(StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + Utills.addCommas(properties.calculateEnergyCost())); - list.add(StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": " + properties.arrowDamage * (properties.arrowSpeed * 3)); + list.add(StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + + Utills.addCommas(properties.calculateEnergyCost())); + list.add(StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": " + + properties.arrowDamage * (properties.arrowSpeed * 3)); drawHoveringText(list, xSize - 8, 0, fontRendererObj); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java index af7f6002..cfaa80d0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java @@ -13,7 +13,8 @@ import org.lwjgl.opengl.GL11; */ public class GUIToolInventory extends GUIBase { - private static final ResourceLocation inventoryTexture = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); + private static final ResourceLocation inventoryTexture = + new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); private ContainerAdvTool container; private String inventoryName; @@ -37,13 +38,16 @@ public class GUIToolInventory extends GUIBase { @Override protected ComponentCollection assembleComponents() { ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize, this); - c.addComponent(new ComponentTexturedRect(0, 130 - 89, 198, 89, inventoryTexture)).setGroup("BACKGROUND"); - c.addComponent(new ComponentTexturedRect(0, 0, 198, 80, inventoryTexture)).setGroup("BACKGROUND"); + c.addComponent(new ComponentTexturedRect(0, 130 - 89, 198, 89, inventoryTexture)) + .setGroup("BACKGROUND"); + c.addComponent(new ComponentTexturedRect(0, 0, 198, 80, inventoryTexture)) + .setGroup("BACKGROUND"); c.addComponent(new ComponentButton(172, 3, 18, 12, 0, this, "<=", "Back")); for (int i = 0; i < 5; i++) { c.addComponent(new ComponentSlotBackground(172, 18 + i * 21)).setGroup("INVENTORY"); - c.addComponent(new ComponentTexturedRect(173, 20 + i * 21, 0, 89, 16, 14, inventoryTexture, true)).setGroup("INVENTORY"); + c.addComponent(new ComponentTexturedRect(173, 20 + i * 21, 0, 89, 16, 14, inventoryTexture, true)) + .setGroup("INVENTORY"); } return c; } @@ -64,7 +68,9 @@ public class GUIToolInventory extends GUIBase { collection.addComponent(new ComponentSlotBackground(7 + x * 18, 18)).setGroup("INVENTORY"); ComponentSlotBackground.addInventorySlots(collection, 7, 44, container.inventoryItemSlot); if (container.inventoryItemSlot > 35) - collection.addComponent(new ComponentItemRenderer(6, 18, container.inventoryTool.inventoryItem)).setGroup("INVENTORY"); + collection + .addComponent(new ComponentItemRenderer(6, 18, container.inventoryTool.inventoryItem)) + .setGroup("INVENTORY"); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java index 92a01a47..cf653f06 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java @@ -29,24 +29,24 @@ public class ManualPage { } public String getImageResourceName(String url) { -// try -// { + // try + // { LogHelper.info(url); return FilenameUtils.getName(url); - //String fileName = new URL(url).getFile(); - //return fileName.substring(fileName.indexOf("/") + 1); -// } -// catch (MalformedURLException e) -// { -// e.printStackTrace(); -// return ""; -// } + // String fileName = new URL(url).getFile(); + // return fileName.substring(fileName.indexOf("/") + 1); + // } + // catch (MalformedURLException e) + // { + // e.printStackTrace(); + // return ""; + // } } public String getLocalizedName() { if (nameL != null) return nameL; - return (name.contains("item.") || name.contains("tile.")) ? StatCollector.translateToLocal(name + ".name") : name.contains("info.") ? name.substring(name.indexOf("info.") + 5) : "Invalid Name Data"; + return (name.contains("item.") || name.contains("tile.")) + ? StatCollector.translateToLocal(name + ".name") + : name.contains("info.") ? name.substring(name.indexOf("info.") + 5) : "Invalid Name Data"; } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java index bdf46f39..ff747bd4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java @@ -5,21 +5,21 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 29/12/2014. */ public class ComponentConfigItemButton extends ComponentBase { - private static final ResourceLocation texture = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); + private static final ResourceLocation texture = + new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); public int slot; private InventoryPlayer inventory; public boolean hasValidItem = false; @@ -32,7 +32,13 @@ public class ComponentConfigItemButton extends ComponentBase { } public void refreshState() { - hasValidItem = (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)); + hasValidItem = (inventory.getStackInSlot(slot) != null + && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem + && !((IConfigurableItem) + inventory.getStackInSlot(slot).getItem()) + .getFields(inventory.getStackInSlot(slot), slot) + .isEmpty()) + || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)); } @Override @@ -58,18 +64,17 @@ public class ComponentConfigItemButton extends ComponentBase { } @Override - public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - - } + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} @Override public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { if (isMouseOver(mouseX, mouseY) && hasValidItem) { List list = new ArrayList(); - List fields = ((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot); + List fields = ((IConfigurableItem) + inventory.getStackInSlot(slot).getItem()) + .getFields(inventory.getStackInSlot(slot), slot); for (ItemConfigField field : fields) { list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); - } drawHoveringText(list, mouseX + offsetX, mouseY + offsetY + 10, fontRendererObj); } @@ -78,7 +83,9 @@ public class ComponentConfigItemButton extends ComponentBase { @Override public void mouseClicked(int x, int y, int button) { if (hasValidItem) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java index 1043235f..f5e54cbb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java @@ -4,9 +4,13 @@ import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingB import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase; import com.brandon3055.brandonscore.client.utills.ClientUtills; import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler.Contributor; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.gui.GuiConfirmOpenLink; @@ -18,11 +22,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.StringUtils; import org.lwjgl.opengl.GL11; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * Created by brandon3055 on 5/11/2015. */ @@ -46,7 +45,6 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (scrollOffset < 0) scrollOffset = 0; if (scrollOffset > pageLength - getHeight()) scrollOffset = pageLength - getHeight(); if (pageLength <= getHeight()) scrollOffset = 0; - } @Override @@ -66,7 +64,12 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements yOffset += 20; if (yOffset > 0) { - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("info.de.manual.contributors.txt"), getWidth() / 2, yOffset, 0x00FFFF); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("info.de.manual.contributors.txt"), + getWidth() / 2, + yOffset, + 0x00FFFF); } yOffset += 10; @@ -79,7 +82,11 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!(yOffset > 25 && yOffset < 324)) continue; - if (mouseX > 15 && mouseX < 245 && mouseY < yOffset + 5 && mouseY > yOffset - 25 && !patreonButtonHighlighted) { + if (mouseX > 15 + && mouseX < 245 + && mouseY < yOffset + 5 + && mouseY > yOffset - 25 + && !patreonButtonHighlighted) { ResourceHandler.bindResource("textures/gui/manualTop.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0F, 0F, 0F, 0.4F); @@ -94,8 +101,10 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements renderPlayer(contributor.ign); GL11.glPopMatrix(); - fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD + contributor.name, 50, yOffset - 20, 0x000000); - fontRendererObj.drawString(EnumChatFormatting.DARK_BLUE + contributor.contribution, 50, yOffset - 10, 0x000000); + fontRendererObj.drawStringWithShadow( + EnumChatFormatting.GOLD + contributor.name, 50, yOffset - 20, 0x000000); + fontRendererObj.drawString( + EnumChatFormatting.DARK_BLUE + contributor.contribution, 50, yOffset - 10, 0x000000); } } @@ -111,7 +120,11 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!(yOffset > 20 && yOffset < 330)) continue; - if (mouseX > 15 && mouseX < 245 && mouseY < yOffset + 5 && mouseY > yOffset - 25 && !patreonButtonHighlighted) { + if (mouseX > 15 + && mouseX < 245 + && mouseY < yOffset + 5 + && mouseY > yOffset - 25 + && !patreonButtonHighlighted) { List list = new ArrayList(); list.add(EnumChatFormatting.GOLD + contributor.contribution); @@ -129,7 +142,8 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!StringUtils.isNullOrEmpty(contributor.website)) { list.add(""); list.add("Website: " + EnumChatFormatting.BLUE + contributor.website); - list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("info.de.manual.clickToGoToSite.txt")); + list.add(EnumChatFormatting.GRAY + + StatCollector.translateToLocal("info.de.manual.clickToGoToSite.txt")); } drawHoveringText(list, offsetX - 7, offsetY + yOffset + 20, fontRendererObj); @@ -137,13 +151,12 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements } if (!ContributorHandler.successfulLoad) - fontRendererObj.drawString("[Error] Failed to download contributors list", offsetX + 20, offsetY + 40, 0xFF0000); + fontRendererObj.drawString( + "[Error] Failed to download contributors list", offsetX + 20, offsetY + 40, 0xFF0000); } @Override - public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - - } + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} private String lastClickURL = ""; @@ -161,7 +174,11 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!(yOffset > 20 && yOffset < 330) || patreonButtonHighlighted) continue; - if (x > 15 && x < 245 && y < yOffset + 5 && y > yOffset - 25 && !StringUtils.isNullOrEmpty(contributor.website)) { + if (x > 15 + && x < 245 + && y < yOffset + 5 + && y > yOffset - 25 + && !StringUtils.isNullOrEmpty(contributor.website)) { lastClickURL = contributor.website; mc.displayGuiScreen(new GuiConfirmOpenLink(this, contributor.website, 0, true)); } @@ -200,5 +217,4 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!skinCache.containsKey(username)) return AbstractClientPlayer.locationStevePng; return skinCache.get(username); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java index d4d49220..3bf38299 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java @@ -17,7 +17,8 @@ import net.minecraft.util.StatCollector; * Created by Brandon on 1/01/2015. */ public class ComponentFieldAdjuster extends ComponentBase { - private static final ResourceLocation widgets = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); + private static final ResourceLocation widgets = + new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png"); public ItemConfigField field; @@ -45,15 +46,50 @@ public class ComponentFieldAdjuster extends ComponentBase { minecraft.getTextureManager().bindTexture(buttonTextures); if (isBoolean()) { - renderButton((getWidth() / 2) - 30, 0, 60, 20, GuiHelper.isInRect(x + (getWidth() / 2) - 30, y, 60, 20, mouseX - offsetX, mouseY - offsetY)); + renderButton( + (getWidth() / 2) - 30, + 0, + 60, + 20, + GuiHelper.isInRect(x + (getWidth() / 2) - 30, y, 60, 20, mouseX - offsetX, mouseY - offsetY)); } else if (isDecimal() || isNonDecimal()) { - renderButton((getWidth() / 2) - 43, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 43, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); - renderButton((getWidth() / 2) - 69, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 69, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); - renderButton((getWidth() / 2) - 95, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 95, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); + renderButton( + (getWidth() / 2) - 43, + 3, + 24, + 14, + GuiHelper.isInRect(x + (getWidth() / 2) - 43, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); + renderButton( + (getWidth() / 2) - 69, + 3, + 24, + 14, + GuiHelper.isInRect(x + (getWidth() / 2) - 69, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); + renderButton( + (getWidth() / 2) - 95, + 3, + 24, + 14, + GuiHelper.isInRect(x + (getWidth() / 2) - 95, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); - renderButton((getWidth() / 2) + 19, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 19, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); - renderButton((getWidth() / 2) + 45, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 45, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); - renderButton((getWidth() / 2) + 71, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 71, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); + renderButton( + (getWidth() / 2) + 19, + 3, + 24, + 14, + GuiHelper.isInRect(x + (getWidth() / 2) + 19, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); + renderButton( + (getWidth() / 2) + 45, + 3, + 24, + 14, + GuiHelper.isInRect(x + (getWidth() / 2) + 45, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); + renderButton( + (getWidth() / 2) + 71, + 3, + 24, + 14, + GuiHelper.isInRect(x + (getWidth() / 2) + 71, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY)); } } @@ -66,16 +102,21 @@ public class ComponentFieldAdjuster extends ComponentBase { double d = (Double) field.value; fieldValue = String.valueOf((double) Math.round(d * 100f) / 100D); } - //if (field.datatype == References.FLOAT_ID) { + // if (field.datatype == References.FLOAT_ID) { // float d = (Float)field.value; // fieldValue = String.valueOf((double)Math.round((double)(d*100f)) / 100D); - //} + // } int centre = fontRendererObj.getStringWidth(fieldName) / 2; fontRendererObj.drawString(fieldName, x + getWidth() / 2 - centre, y - 12, 0x00000); drawCenteredString(fontRendererObj, fieldValue, x + getWidth() / 2, y + 6, 0xffffff); if (field.modifier == null || field.modifier.equals("AOE")) - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.max.txt") + " " + field.getMaxFormattedValue(), x + getWidth() / 2, y + 20, 0xFFFFFF); + drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.max.txt") + " " + field.getMaxFormattedValue(), + x + getWidth() / 2, + y + 20, + 0xFFFFFF); if (isDecimal() || isNonDecimal()) { fontRendererObj.drawString("---", 7, y + 6, 0x000000); @@ -84,7 +125,6 @@ public class ComponentFieldAdjuster extends ComponentBase { fontRendererObj.drawString("+", 127, y + 6, 0x000000); fontRendererObj.drawString("++", 151, y + 6, 0x000000); fontRendererObj.drawString("+++", 174, y + 6, 0x000000); - } } @@ -98,17 +138,17 @@ public class ComponentFieldAdjuster extends ComponentBase { if (field == null) return; if (!isBoolean()) { - if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 43, this.y + 3, 26, 14, x, y)) {//- + if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 43, this.y + 3, 26, 14, x, y)) { // - incroment(-1); - } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 69, this.y + 3, 26, 14, x, y)) {//-- + } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 69, this.y + 3, 26, 14, x, y)) { // -- incroment(-10); - } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 95, this.y + 3, 26, 14, x, y)) {//--- + } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 95, this.y + 3, 26, 14, x, y)) { // --- incroment(-100); - } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 19, this.y + 3, 26, 14, x, y)) {//+ + } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 19, this.y + 3, 26, 14, x, y)) { // + incroment(1); - } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 45, this.y + 3, 26, 14, x, y)) {//++ + } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 45, this.y + 3, 26, 14, x, y)) { // ++ incroment(10); - } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 71, this.y + 3, 26, 14, x, y)) {//+++ + } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 71, this.y + 3, 26, 14, x, y)) { // +++ incroment(100); } } else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 30, this.y, 60, 20, x, y)) { @@ -167,10 +207,13 @@ public class ComponentFieldAdjuster extends ComponentBase { field.value = !(Boolean) field.value; break; } - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); ItemStack stack = gui.player.inventory.getStackInSlot(field.slot); if (stack != null && stack.getItem() instanceof IConfigurableItem) { - DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name); + DataUtills.writeObjectToCompound( + IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name); } field.sendChanges(); } @@ -181,11 +224,13 @@ public class ComponentFieldAdjuster extends ComponentBase { int y = this.y + offsetY; this.drawTexturedModalRect(x, y, 0, 46 + k * 20, xSize / 2, 20 - Math.max(0, 20 - ySize)); - this.drawTexturedModalRect(x + xSize / 2, y, 200 - xSize / 2, 46 + k * 20, xSize / 2, 20 - Math.max(0, 20 - ySize)); + this.drawTexturedModalRect( + x + xSize / 2, y, 200 - xSize / 2, 46 + k * 20, xSize / 2, 20 - Math.max(0, 20 - ySize)); if (ySize < 20) { this.drawTexturedModalRect(x, y + 3, 0, (46 + k * 20) + 20 - ySize + 3, xSize - 1, ySize - 3); - this.drawTexturedModalRect(x + xSize / 2, y + 3, 200 - xSize / 2, (46 + k * 20) + 20 - ySize + 3, xSize / 2, ySize - 3); + this.drawTexturedModalRect( + x + xSize / 2, y + 3, 200 - xSize / 2, (46 + k * 20) + 20 - ySize + 3, xSize / 2, ySize - 3); } } @@ -194,7 +239,9 @@ public class ComponentFieldAdjuster extends ComponentBase { } private boolean isNonDecimal() { - return field.datatype == References.INT_ID || field.datatype == References.SHORT_ID || field.datatype == References.BYTE_ID; + return field.datatype == References.INT_ID + || field.datatype == References.SHORT_ID + || field.datatype == References.BYTE_ID; } private boolean isDecimal() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java index ea34f873..21ab4c0f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java @@ -1,26 +1,26 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; +import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 31/12/2014. */ public class ComponentFieldButton extends ComponentBase { - private static final ResourceLocation widgets = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); + private static final ResourceLocation widgets = + new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); public EntityPlayer player; public int slot; @@ -68,7 +68,12 @@ public class ComponentFieldButton extends ComponentBase { @Override public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - drawString(fontRendererObj, field.getLocalizedName(), x + offsetX + 2, y + offsetY + (getHeight() / 2) - (fontRendererObj.FONT_HEIGHT / 2), 0xffffff); + drawString( + fontRendererObj, + field.getLocalizedName(), + x + offsetX + 2, + y + offsetY + (getHeight() / 2) - (fontRendererObj.FONT_HEIGHT / 2), + 0xffffff); } @Override @@ -82,13 +87,19 @@ public class ComponentFieldButton extends ComponentBase { @Override public void mouseClicked(int x, int y, int button) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); if (field.datatype == References.BOOLEAN_ID) { field.value = !(Boolean) field.value; field.sendChanges(); ItemStack stack = gui.player.inventory.getStackInSlot(field.slot); if (stack != null && stack.getItem() instanceof IConfigurableItem) { - DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name); + DataUtills.writeObjectToCompound( + IConfigurableItem.ProfileHelper.getProfileCompound(stack), + field.value, + field.datatype, + field.name); } return; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java index a37598c3..8afeacbd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java @@ -2,9 +2,9 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase; import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.brandonscore.common.utills.Utills; import net.minecraft.client.Minecraft; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -26,7 +26,7 @@ public class ComponentIndexButton extends ComponentScrollingBase { @Override public void handleScrollInput(int direction) { - //this.y += direction * 10; + // this.y += direction * 10; } @Override @@ -48,7 +48,6 @@ public class ComponentIndexButton extends ComponentScrollingBase { fontRendererObj.drawString(page.getLocalizedName(), x + 19, sy, mouseOver ? 0xdd00ff : 0x000000); ResourceHandler.bindResource("textures/gui/Widgets.png"); - GL11.glColor4f(1f, 1f, 1f, 1f); if (mouseOver) { GL11.glColor4f(0f, 1f, 1f, 1f); @@ -57,7 +56,6 @@ public class ComponentIndexButton extends ComponentScrollingBase { if (stack != null && stack.getItem() != null) drawItemStack(stack, x, sy, ""); else drawItemStack(new ItemStack(Items.writable_book), x, sy, ""); - } } @@ -67,8 +65,7 @@ public class ComponentIndexButton extends ComponentScrollingBase { } @Override - public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - } + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} public ManualPage getPage() { return page; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java index 665d31f4..9d4c49e8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java @@ -8,6 +8,11 @@ import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; @@ -18,12 +23,6 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import org.apache.commons.io.FilenameUtils; import org.lwjgl.opengl.GL11; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - /** * Created by Brandon on 19/03/2015. */ @@ -83,13 +82,10 @@ public class ComponentManualPage extends ComponentScrollingBase { } @Override - public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - } + public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} @Override - public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { - - } + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} @Override public void updateScreen() { @@ -104,6 +100,7 @@ public class ComponentManualPage extends ComponentScrollingBase { * 0 = text, 1 = image, 2 = crafting */ private int type; + public int yPos; private ComponentManualPage page; private String[] textLines; @@ -157,7 +154,8 @@ public class ComponentManualPage extends ComponentScrollingBase { if (stack != null) { - for (IRecipe recipe : (List) CraftingManager.getInstance().getRecipeList()) { + for (IRecipe recipe : + (List) CraftingManager.getInstance().getRecipeList()) { if (recipe == null) continue; ItemStack result = recipe.getRecipeOutput(); @@ -169,7 +167,10 @@ public class ComponentManualPage extends ComponentScrollingBase { recipes.add(recipe); } - Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator(); + Iterator iterator = FurnaceRecipes.smelting() + .getSmeltingList() + .entrySet() + .iterator(); Map.Entry entry; while (iterator.hasNext()) { @@ -183,14 +184,20 @@ public class ComponentManualPage extends ComponentScrollingBase { } public int getHeight() { - if (type == 1 && (ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content)) || (slide && ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content))))) { - CustomResourceLocation texture = slide ? ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)) : ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)); + if (type == 1 + && (ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content)) + || (slide + && ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content))))) { + CustomResourceLocation texture = slide + ? ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)) + : ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)); return (int) ((double) texture.getHeight() / (double) texture.getWidth() * 220D) + 5; } else if (type == 2) { return (recipes.size() + smeltingRecipes.size()) * 57; } - return ((textLines != null ? textLines.length * 10 : 10) + 5) + ((isTitle && (page.page.name.contains("tile.") || page.page.name.contains("item."))) ? 18 : 0); + return ((textLines != null ? textLines.length * 10 : 10) + 5) + + ((isTitle && (page.page.name.contains("tile.") || page.page.name.contains("item."))) ? 18 : 0); } public void render(int mouseX, int mouseY) { @@ -203,7 +210,8 @@ public class ComponentManualPage extends ComponentScrollingBase { } else if (isTitle) { int y = yPos - page.scrollOffset; if (y > 310 || y < 5) return; - page.drawCenteredString(page.fontRendererObj, content.substring(content.indexOf("title.") + 6), 128, y, 0x00ffff); + page.drawCenteredString( + page.fontRendererObj, content.substring(content.indexOf("title.") + 6), 128, y, 0x00ffff); if ((page.page.name.contains("tile.") || page.page.name.contains("item.")) && page.stack != null) { ResourceHandler.bindResource("textures/gui/Widgets.png"); @@ -221,17 +229,20 @@ public class ComponentManualPage extends ComponentScrollingBase { } private void renderImage() { - CustomResourceLocation image = null;//slide ? ResourceHandler.downloadedImages.get(slides.get(page.slideTick % slides.size() - 1)) : ResourceHandler.downloadedImages.get(content); + CustomResourceLocation image = + null; // slide ? ResourceHandler.downloadedImages.get(slides.get(page.slideTick % slides.size() - + // 1)) : ResourceHandler.downloadedImages.get(content); if (slide) { int index = (page.slideTick / 20) % (slides.size()); - image = (slides.size() > index) ? ResourceHandler.downloadedImages.get(FilenameUtils.getName(slides.get(index))) : null; + image = (slides.size() > index) + ? ResourceHandler.downloadedImages.get(FilenameUtils.getName(slides.get(index))) + : null; } else if (ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content))) { image = ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)); } - if (image != null) { - //CustomResourceLocation image = ResourceHandler.downloadedImages.get(content); + // CustomResourceLocation image = ResourceHandler.downloadedImages.get(content); image.bind(); Tessellator tess = Tessellator.instance; @@ -286,7 +297,13 @@ public class ComponentManualPage extends ComponentScrollingBase { if (y + yDown + posY < 0 || y + yDown + posY > 305) continue; page.drawTexturedModalRect(x + posX, y + yDown + posY, 138, 0, 18, 18); - ItemStack stack = (ItemStack) (getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ItemStack ? getRecipeInput(recipe)[i] : getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ArrayList ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) : null); + ItemStack stack = (ItemStack) + (getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ItemStack + ? getRecipeInput(recipe)[i] + : getRecipeInput(recipe).length > i + && getRecipeInput(recipe)[i] instanceof ArrayList + ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) + : null); if (stack != null) { if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) stack.setItemDamage(0); @@ -301,7 +318,6 @@ public class ComponentManualPage extends ComponentScrollingBase { if (recipe.getRecipeOutput() != null) page.drawItemStack(recipe.getRecipeOutput(), 5 + 90 + posX, 5 + 14 + yDown + posY, ""); } - } for (IRecipe recipe : recipes) { @@ -325,7 +341,13 @@ public class ComponentManualPage extends ComponentScrollingBase { int y = i / 3 * 18; if (y + yDown + posY < 0 || y + yDown + posY > 305) continue; - ItemStack stack = (ItemStack) (getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ItemStack ? getRecipeInput(recipe)[i] : getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ArrayList ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) : null); + ItemStack stack = (ItemStack) + (getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ItemStack + ? getRecipeInput(recipe)[i] + : getRecipeInput(recipe).length > i + && getRecipeInput(recipe)[i] instanceof ArrayList + ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) + : null); if (stack != null) { if (GuiHelper.isInRect(1 + x + posX, 1 + y + yDown + posY, 18, 18, mouseX, mouseY)) { @@ -381,7 +403,8 @@ public class ComponentManualPage extends ComponentScrollingBase { } private Object[] getRecipeInput(IRecipe recipe) { - if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe) recipe).getInput().toArray(); + if (recipe instanceof ShapelessOreRecipe) + return ((ShapelessOreRecipe) recipe).getInput().toArray(); else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe) recipe); else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes) recipe).recipeItems; else if (recipe instanceof ShapelessRecipes) @@ -409,8 +432,7 @@ public class ComponentManualPage extends ComponentScrollingBase { } return grid; } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } return null; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java index e557dc35..837f2080 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java @@ -18,34 +18,30 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; -import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Random; /** * Created by Brandon on 28/10/2014. */ public class ClientEventHandler { - public static Map> playerShieldStatus = new HashMap>(); + public static Map> playerShieldStatus = + new HashMap>(); public static int elapsedTicks; private static float previousFOB = 0f; @@ -72,12 +68,13 @@ public class ClientEventHandler { if (event.phase != TickEvent.Phase.START || event.type != TickEvent.Type.CLIENT || event.side != Side.CLIENT) return; - for (Iterator>> i = playerShieldStatus.entrySet().iterator(); i.hasNext(); ) { + for (Iterator>> i = + playerShieldStatus.entrySet().iterator(); + i.hasNext(); ) { Map.Entry> entry = i.next(); if (elapsedTicks - entry.getValue().getValue() > 5) i.remove(); } - if (mc == null) mc = Minecraft.getMinecraft(); else if (mc.theWorld != null) { elapsedTicks++; @@ -99,7 +96,8 @@ public class ClientEventHandler { if (Math.abs(energyCrystalAlphaTarget - energyCrystalAlphaValue) <= 0.02f) energyCrystalAlphaTarget = rand.nextFloat(); - playerHoldingWrench = mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() == ModItems.wrench; + playerHoldingWrench = mc.thePlayer.getHeldItem() != null + && mc.thePlayer.getHeldItem().getItem() == ModItems.wrench; searchForPlayerMount(); } @@ -109,7 +107,7 @@ public class ClientEventHandler { @SubscribeEvent @SideOnly(Side.CLIENT) - public void renderGameOverlayEvent (final RenderGameOverlayEvent.Post event) { + public void renderGameOverlayEvent(final RenderGameOverlayEvent.Post event) { if (event.type == RenderGameOverlayEvent.ElementType.ALL) { statusDisplayManager.drawItemStack(); } @@ -118,36 +116,42 @@ public class ClientEventHandler { @SubscribeEvent(priority = EventPriority.LOW) public void fovUpdate(FOVUpdateEvent event) { - //region Bow FOV Update - if (event.entity.getHeldItem() != null && (event.entity.getHeldItem().getItem() instanceof WyvernBow || event.entity.getHeldItem().getItem() instanceof DraconicBow) && Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed()) { + // region Bow FOV Update + if (event.entity.getHeldItem() != null + && (event.entity.getHeldItem().getItem() instanceof WyvernBow + || event.entity.getHeldItem().getItem() instanceof DraconicBow) + && Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed()) { - BowHandler.BowProperties properties = new BowHandler.BowProperties(event.entity.getHeldItem(), event.entity); + BowHandler.BowProperties properties = + new BowHandler.BowProperties(event.entity.getHeldItem(), event.entity); event.newfov = ((6 - properties.zoomModifier) / 6) * event.fov; -// if (ItemNBTHelper.getString(event.entity.getItemInUse(), "mode", "").equals("sharpshooter")){ -// if (event.entity.getItemInUse().getItem() instanceof WyvernBow) zMax = 1.35f; -// else if (event.entity.getItemInUse().getItem() instanceof DraconicBow) zMax = 2.5f; -// bowZoom = true; -// tickSet = elapsedTicks; -// } + // if (ItemNBTHelper.getString(event.entity.getItemInUse(), "mode", "").equals("sharpshooter")){ + // if (event.entity.getItemInUse().getItem() instanceof WyvernBow) zMax = 1.35f; + // else if (event.entity.getItemInUse().getItem() instanceof DraconicBow) zMax = 2.5f; + // bowZoom = true; + // tickSet = elapsedTicks; + // } } - //endregion + // endregion - //region Armor move speed FOV effect cancellation + // region Armor move speed FOV effect cancellation CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(event.entity); if (summery != null && summery.speedModifier > 0) { - IAttributeInstance iattributeinstance = event.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed); - float f = (float) ((iattributeinstance.getAttributeValue() / (double) event.entity.capabilities.getWalkSpeed() + 1.0D) / 2.0D); + IAttributeInstance iattributeinstance = + event.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + float f = (float) + ((iattributeinstance.getAttributeValue() / (double) event.entity.capabilities.getWalkSpeed() + 1.0D) + / 2.0D); event.newfov /= f; } - //endregion + // endregion } - private void searchForPlayerMount() { if (remountTicksRemaining > 0) { Entity e = Minecraft.getMinecraft().theWorld.getEntityByID(remountEntityID); @@ -180,7 +184,8 @@ public class ClientEventHandler { @SubscribeEvent public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) { if (ConfigHandler.useOriginal3DArmorModel || ConfigHandler.useOldArmorModel || event.isCanceled()) return; - if (event.stack != null && (event.stack.getItem() instanceof DraconicArmor || event.stack.getItem() instanceof WyvernArmor)) { + if (event.stack != null + && (event.stack.getItem() instanceof DraconicArmor || event.stack.getItem() instanceof WyvernArmor)) { ItemArmor itemarmor = (ItemArmor) event.stack.getItem(); ModelBiped modelbiped = itemarmor.getArmorModel(event.entityPlayer, event.stack, event.slot); event.renderer.setRenderPassModel(modelbiped); @@ -206,7 +211,8 @@ public class ClientEventHandler { EntityPlayer viewingPlayer = Minecraft.getMinecraft().thePlayer; - int i = 5 - (elapsedTicks - playerShieldStatus.get(event.entityPlayer).getValue()); + int i = 5 + - (elapsedTicks - playerShieldStatus.get(event.entityPlayer).getValue()); GL11.glColor4f(1F - p, 0F, p, i / 5F); @@ -215,9 +221,12 @@ public class ClientEventHandler { double translationYLT = event.entityPlayer.prevPosY - viewingPlayer.prevPosY; double translationZLT = event.entityPlayer.prevPosZ - viewingPlayer.prevPosZ; - double translationX = translationXLT + (((event.entityPlayer.posX - viewingPlayer.posX) - translationXLT) * event.partialRenderTick); - double translationY = translationYLT + (((event.entityPlayer.posY - viewingPlayer.posY) - translationYLT) * event.partialRenderTick); - double translationZ = translationZLT + (((event.entityPlayer.posZ - viewingPlayer.posZ) - translationZLT) * event.partialRenderTick); + double translationX = translationXLT + + (((event.entityPlayer.posX - viewingPlayer.posX) - translationXLT) * event.partialRenderTick); + double translationY = translationYLT + + (((event.entityPlayer.posY - viewingPlayer.posY) - translationYLT) * event.partialRenderTick); + double translationZ = translationZLT + + (((event.entityPlayer.posZ - viewingPlayer.posZ) - translationZLT) * event.partialRenderTick); GL11.glTranslated(translationX, translationY + 1.1, translationZ); } else { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java index cb1c73c6..312bc7e8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.client.handler; -import java.util.ArrayList; -import java.util.List; - import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.gui.GuiHudConfig; @@ -13,6 +10,8 @@ import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiChat; @@ -47,8 +46,9 @@ public class HudHandler { @SideOnly(Side.CLIENT) public void drawHUD(RenderGameOverlayEvent.Post event) { Minecraft mc = Minecraft.getMinecraft(); - if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo || mc.currentScreen instanceof GuiChat) - return; + if (event.type != RenderGameOverlayEvent.ElementType.ALL + || mc.gameSettings.showDebugInfo + || mc.currentScreen instanceof GuiChat) return; ScaledResolution resolution = event.resolution; width = resolution.getScaledWidth(); @@ -60,7 +60,15 @@ public class HudHandler { int y = (int) (((float) ConfigHandler.hudSettings[1] / 1000F) * (float) height); GL11.glPushMatrix(); - GuiHelper.drawHoveringText(hudList, x, y, fontRenderer, toolTipFadeOut > 1 ? 1 : toolTipFadeOut, ConfigHandler.hudSettings[4] / 100D, width, height); + GuiHelper.drawHoveringText( + hudList, + x, + y, + fontRenderer, + toolTipFadeOut > 1 ? 1 : toolTipFadeOut, + ConfigHandler.hudSettings[4] / 100D, + width, + height); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } @@ -73,14 +81,15 @@ public class HudHandler { } } - //x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText + // x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText @SideOnly(Side.CLIENT) public static void clientTick() { if (ConfigHandler.hudSettings[6] > 0 && toolTipFadeOut > 1F - ((float) ConfigHandler.hudSettings[6] * 0.25F)) { toolTipFadeOut -= 0.1F; } if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) toolTipFadeOut = 5F; - if (ConfigHandler.hudSettings[7] > 0 && armorStatsFadeOut > 1F - ((float) ConfigHandler.hudSettings[7] * 0.25F)) { + if (ConfigHandler.hudSettings[7] > 0 + && armorStatsFadeOut > 1F - ((float) ConfigHandler.hudSettings[7] * 0.25F)) { armorStatsFadeOut -= 0.1F; if (armorStatsFadeOut < 0) armorStatsFadeOut = 0; } @@ -103,13 +112,18 @@ public class HudHandler { toolTipFadeOut = 1F; armorStatsFadeOut = 1F; } - } else if (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof IHudDisplayItem) { - hudList = ((IHudDisplayItem) mc.thePlayer.getHeldItem().getItem()).getDisplayData(mc.thePlayer.getHeldItem()); + } else if (mc.thePlayer.getHeldItem() != null + && mc.thePlayer.getHeldItem().getItem() instanceof IHudDisplayItem) { + hudList = + ((IHudDisplayItem) mc.thePlayer.getHeldItem().getItem()).getDisplayData(mc.thePlayer.getHeldItem()); } MovingObjectPosition mop = mc.thePlayer.rayTrace(5, 0); - if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ) instanceof IHudDisplayBlock) { - hudList = ((IHudDisplayBlock) mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ)).getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ); + if (mop != null + && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + && mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ) instanceof IHudDisplayBlock) { + hudList = ((IHudDisplayBlock) mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ)) + .getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ); } CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(mc.thePlayer); @@ -120,18 +134,20 @@ public class HudHandler { } showShieldHud = armorStatsFadeOut > 0F; - if (maxShieldPoints != summery.maxProtectionPoints || shieldPoints != summery.protectionPoints || shieldEntropy != summery.entropy || rfTotal != summery.totalEnergyStored) - armorStatsFadeOut = 5F; + if (maxShieldPoints != summery.maxProtectionPoints + || shieldPoints != summery.protectionPoints + || shieldEntropy != summery.entropy + || rfTotal != summery.totalEnergyStored) armorStatsFadeOut = 5F; maxShieldPoints = summery.maxProtectionPoints; shieldPoints = summery.protectionPoints; shieldPercentCharge = (int) (summery.protectionPoints / summery.maxProtectionPoints * 100D); shieldEntropy = summery.entropy; - rfCharge = (int) ((double) summery.totalEnergyStored / Math.max((double) summery.maxTotalEnergyStorage, 1D) * 100D); + rfCharge = (int) + ((double) summery.totalEnergyStored / Math.max((double) summery.maxTotalEnergyStorage, 1D) * 100D); rfTotal = summery.totalEnergyStored; } - private void drawArmorHUD(int x, int y, boolean rotated, double scale) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); @@ -153,10 +169,30 @@ public class HudHandler { } else GuiHelper.drawTexturedRect(x + 1, y + 105, 15, 17, 2, 0, 13, 15, 0, GuiHelper.PXL128); GuiHelper.drawTexturedRect(x, y, 17, 104, 0, 15, 17, 104, 0, GuiHelper.PXL128); - GuiHelper.drawTexturedRect(x + 2, y + 2 + (100 - shieldPercentCharge), 7, shieldPercentCharge, 17, 100 - shieldPercentCharge, 7, shieldPercentCharge, 0, GuiHelper.PXL128); - GuiHelper.drawTexturedRect(x + 10, y + 2 + 100 - (int) shieldEntropy, 2, (int) shieldEntropy, 25, 100 - (int) shieldEntropy, 2, (int) shieldEntropy, 0, GuiHelper.PXL128); - GuiHelper.drawTexturedRect(x + 13, y + 2 + 100 - rfCharge, 2, rfCharge, 28, 100 - rfCharge, 2, rfCharge, 0, GuiHelper.PXL128); - + GuiHelper.drawTexturedRect( + x + 2, + y + 2 + (100 - shieldPercentCharge), + 7, + shieldPercentCharge, + 17, + 100 - shieldPercentCharge, + 7, + shieldPercentCharge, + 0, + GuiHelper.PXL128); + GuiHelper.drawTexturedRect( + x + 10, + y + 2 + 100 - (int) shieldEntropy, + 2, + (int) shieldEntropy, + 25, + 100 - (int) shieldEntropy, + 2, + (int) shieldEntropy, + 0, + GuiHelper.PXL128); + GuiHelper.drawTexturedRect( + x + 13, y + 2 + 100 - rfCharge, 2, rfCharge, 28, 100 - rfCharge, 2, rfCharge, 0, GuiHelper.PXL128); if (ConfigHandler.hudSettings[9] == 1) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; @@ -168,13 +204,25 @@ public class HudHandler { String energy = "RF: " + Utills.formatNumber(rfTotal); float fade = Math.min(armorStatsFadeOut, 1F); if (!rotated) { - fontRenderer.drawStringWithShadow(shield, x + 18, y + 74, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); - fontRenderer.drawStringWithShadow(energy, x + 18, y + 84, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); - fontRenderer.drawStringWithShadow(entropy, x + 18, y + 94, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer.drawStringWithShadow( + shield, x + 18, y + 74, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer.drawStringWithShadow( + energy, x + 18, y + 84, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer.drawStringWithShadow( + entropy, x + 18, y + 94, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); } else { - fontRenderer.drawString(shield, x - 52 - fontRenderer.getStringWidth(shield) / 2, y + 2, ((int) (fade * 240F) + 0x10 << 24) | 0x000000FF); - fontRenderer.drawStringWithShadow(entropy, x - fontRenderer.getStringWidth(entropy), y + 18, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); - fontRenderer.drawStringWithShadow(energy, x - 102, y + 18, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer.drawString( + shield, + x - 52 - fontRenderer.getStringWidth(shield) / 2, + y + 2, + ((int) (fade * 240F) + 0x10 << 24) | 0x000000FF); + fontRenderer.drawStringWithShadow( + entropy, + x - fontRenderer.getStringWidth(entropy), + y + 18, + ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer.drawStringWithShadow( + energy, x - 102, y + 18, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); } } @@ -186,23 +234,26 @@ public class HudHandler { } } - -//GL11.glPushMatrix(); +// GL11.glPushMatrix(); // GL11.glEnable(GL11.GL_ALPHA_TEST); // ResourceHandler.bindResource("textures/gui/HUD.png"); // // if (rotated){ -// GuiHelper.drawTexturedRect(x-(12*scale), y+scale, (int)(11*scale), (int)(13*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128); +// GuiHelper.drawTexturedRect(x-(12*scale), y+scale, (int)(11*scale), (int)(13*scale), 2, 0, 11, 13, 0, +// GuiHelper.PXL128); // x+=(104*scale); // GL11.glTranslated(x, y, 0); // GL11.glRotated(-90, 0, 0, -1); // GL11.glTranslated(-x, -y, 0); // } -// else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128); +// else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, +// GuiHelper.PXL128); // // GuiHelper.drawTexturedRect(x, y, (int)(17*scale), (int)(104*scale), 0, 15, 17, 104, 0, GuiHelper.PXL128); -// GuiHelper.drawTexturedRect(x+(2*scale), y+(2*scale)+(100-shieldPercentCharge), (int)(7*scale), shieldPercentCharge *scale, 17, 100-shieldPercentCharge, 7, shieldPercentCharge, 0, GuiHelper.PXL128); -// GuiHelper.drawTexturedRect(x+(10*scale), y+(2+(100-(int)shieldEntropy) * scale), (int)(2*scale), (int)shieldEntropy * scale, 25, 100-(int)shieldEntropy, 2, (int)shieldEntropy, 0, GuiHelper.PXL128); +// GuiHelper.drawTexturedRect(x+(2*scale), y+(2*scale)+(100-shieldPercentCharge), (int)(7*scale), shieldPercentCharge +// *scale, 17, 100-shieldPercentCharge, 7, shieldPercentCharge, 0, GuiHelper.PXL128); +// GuiHelper.drawTexturedRect(x+(10*scale), y+(2+(100-(int)shieldEntropy) * scale), (int)(2*scale), (int)shieldEntropy +// * scale, 25, 100-(int)shieldEntropy, 2, (int)shieldEntropy, 0, GuiHelper.PXL128); // // if (ConfigHandler.hudSettings[9] == 1) { // FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; @@ -215,7 +266,8 @@ public class HudHandler { // fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x + 16, y + 94, 0xFFFFFF); // }else { // fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x - 102, y + 16, 0xFFFFFF); -// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x - fontRenderer.getStringWidth((int)shieldEntropy + "%"), y + 16, 0xFFFFFF); +// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x - fontRenderer.getStringWidth((int)shieldEntropy + +// "%"), y + 16, 0xFFFFFF); // } // } // diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java index b0e45560..973e4b09 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java @@ -17,7 +17,8 @@ public final class ItemDisplayManager { private int ticksCounter; private static final RenderItem renderItem = new RenderItem(); private static final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - private static final TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); + private static final TextureManager textureManager = + Minecraft.getMinecraft().getTextureManager(); public ItemDisplayManager(int ticks) { this.ticks = ticks; @@ -57,4 +58,4 @@ public final class ItemDisplayManager { GL11.glDisable(GL11.GL_BLEND); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java index a3dcaf53..72956077 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java @@ -12,7 +12,15 @@ public class ParticleHandler { private static Minecraft mc = Minecraft.getMinecraft(); private static World theWorld = mc.theWorld; - public static EntityFX spawnParticle(String particleName, double x, double y, double z, double motionX, double motionY, double motionZ, float scale) { + public static EntityFX spawnParticle( + String particleName, + double x, + double y, + double z, + double motionX, + double motionY, + double motionZ, + float scale) { if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) { int var14 = mc.gameSettings.particleSetting; if (var14 == 1 && theWorld.rand.nextInt(3) == 0) { @@ -29,7 +37,8 @@ public class ParticleHandler { return null; } else { if (particleName.equals("distortionParticle")) { - var21 = new ParticleDistortion(theWorld, x, y, z, (float) motionX, (float) motionY, (float) motionZ, scale); + var21 = new ParticleDistortion( + theWorld, x, y, z, (float) motionX, (float) motionY, (float) motionZ, scale); } mc.effectRenderer.addEffect(var21); @@ -72,4 +81,4 @@ public class ParticleHandler { } return true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java index 5a5c82f8..4f96d9a8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java @@ -11,19 +11,18 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.ReflectionHelper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EffectRenderer; -import net.minecraft.client.resources.FolderResourcePack; -import net.minecraft.util.ResourceLocation; -import org.apache.commons.io.FilenameUtils; - -import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.*; import java.lang.reflect.Field; import java.net.MalformedURLException; import java.net.URL; import java.util.*; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.resources.FolderResourcePack; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.FilenameUtils; /** * Created by Brandon on 8/02/2015. @@ -31,19 +30,18 @@ import java.util.*; public class ResourceHandler { public static ResourceHandler instance = new ResourceHandler(); private static ResourceLocation defaultParticles; - private static ResourceLocation particles = new ResourceLocation(References.RESOURCESPREFIX + "textures/particle/particles.png"); + private static ResourceLocation particles = + new ResourceLocation(References.RESOURCESPREFIX + "textures/particle/particles.png"); private static Map cachedResources = new HashMap(); public static Map downloadedImages = new HashMap(); - private static String savePath; private static File saveFolder; private static File imagesFolder; private static DownloadThread downloadThread; public static int downloadStatus = 0; - - //-------------------- File Handling -----------------------// + // -------------------- File Handling -----------------------// @SubscribeEvent public void tick(TickEvent.ClientTickEvent event) { @@ -60,14 +58,14 @@ public class ResourceHandler { FMLCommonHandler.instance().bus().register(instance); if (event != null) - savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/config/draconicevolution"; + savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + + "/config/draconicevolution"; GUIManual.loadPages(); downloadThread = new DownloadThread(GUIManual.imageURLs); downloadThread.start(); } - public static class DownloadThread extends Thread { private List imageURLs; private boolean isFinished = false; @@ -89,13 +87,14 @@ public class ResourceHandler { String fileName = url.getFile(); BufferedImage bi = ImageIO.read(new File(getImagesFolder(), FilenameUtils.getName(fileName))); - downloadedImages.put(FilenameUtils.getName(fileName), new CustomResourceLocation(FilenameUtils.getName(fileName), bi.getWidth(), bi.getHeight())); - } - catch (MalformedURLException e) { + downloadedImages.put( + FilenameUtils.getName(fileName), + new CustomResourceLocation( + FilenameUtils.getName(fileName), bi.getWidth(), bi.getHeight())); + } catch (MalformedURLException e) { LogHelper.error("Image Read Failed"); e.printStackTrace(); - } - catch (IOException e) { + } catch (IOException e) { LogHelper.error("Image Read Failed"); e.printStackTrace(); } @@ -122,8 +121,7 @@ public class ResourceHandler { is.close(); os.close(); - } - catch (IOException e) { + } catch (IOException e) { LogHelper.error("Download Failed"); e.printStackTrace(); return false; @@ -136,8 +134,7 @@ public class ResourceHandler { URL url = new URL(urlS); String fileName = url.getFile(); return Arrays.asList(getImagesFolder().list()).contains(FilenameUtils.getName(fileName)); - } - catch (MalformedURLException e) { + } catch (MalformedURLException e) { LogHelper.error("Unable to check files existence. Invalid URL: " + urlS); e.printStackTrace(); return false; @@ -157,7 +154,6 @@ public class ResourceHandler { } } - private static void addRSPack(boolean refreash) { File rspack = new File(getConfigFolder(), "/resources"); if (!rspack.exists()) return; @@ -173,8 +169,7 @@ public class ResourceHandler { writer.endObject(); writer.endObject(); writer.close(); - } - catch (IOException e) { + } catch (IOException e) { LogHelper.error("Error creating pack.mcmeta"); e.printStackTrace(); } @@ -189,8 +184,7 @@ public class ResourceHandler { f.set(Minecraft.getMinecraft(), defaultResourcePacks); LogHelper.info("RS Added"); if (refreash) Minecraft.getMinecraft().refreshResources(); - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { e.printStackTrace(); } } @@ -213,8 +207,7 @@ public class ResourceHandler { return imagesFolder; } - //----------------------------------------------------------// - + // ----------------------------------------------------------// public static void bindTexture(ResourceLocation texture) { Minecraft.getMinecraft().renderEngine.bindTexture(texture); @@ -226,9 +219,9 @@ public class ResourceHandler { public static void bindDefaultParticles() { if (defaultParticles == null) { try { - defaultParticles = (ResourceLocation) ReflectionHelper.getPrivateValue(EffectRenderer.class, null, "particleTextures", "field_110737_b"); - } - catch (Exception e) { + defaultParticles = (ResourceLocation) ReflectionHelper.getPrivateValue( + EffectRenderer.class, null, "particleTextures", "field_110737_b"); + } catch (Exception e) { } } if (defaultParticles != null) bindTexture(defaultParticles); @@ -252,6 +245,4 @@ public class ResourceHandler { public static void bindResource(String rs) { bindTexture(ResourceHandler.getResource(rs)); } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java index 9304fb4b..0a8c0a19 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java @@ -32,11 +32,15 @@ public class KeyInputHandler { if (KeyBindings.placeItem.isPressed()) handlePlaceItemKey(); else if (KeyBindings.toolConfig.isPressed()) { DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false)); - } else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.getItemInUse() == null) { + } else if (KeyBindings.toolProfileChange.isPressed() + && Minecraft.getMinecraft().thePlayer != null + && Minecraft.getMinecraft().thePlayer.getItemInUse() == null) { DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false)); ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem(); - if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem) stack.getItem()).hasProfiles()) { + if (stack != null + && stack.getItem() instanceof IConfigurableItem + && ((IConfigurableItem) stack.getItem()).hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); if (++preset >= 5) preset = 0; ItemNBTHelper.setInteger(stack, "ConfigProfile", preset); @@ -65,13 +69,13 @@ public class KeyInputHandler { } } - private void handlePlaceItemKey() { EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; WorldClient world = Minecraft.getMinecraft().theWorld; MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 4.5D); if (mop != null) - DraconicEvolution.network.sendToServer(new PlacedItemPacket((byte) mop.sideHit, mop.blockX, mop.blockY, mop.blockZ)); + DraconicEvolution.network.sendToServer( + new PlacedItemPacket((byte) mop.sideHit, mop.blockX, mop.blockY, mop.blockZ)); } @SideOnly(Side.CLIENT) @@ -84,7 +88,9 @@ public class KeyInputHandler { DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false)); ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem(); - if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem) stack.getItem()).hasProfiles()) { + if (stack != null + && stack.getItem() instanceof IConfigurableItem + && ((IConfigurableItem) stack.getItem()).hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); if (++preset >= 5) preset = 0; ItemNBTHelper.setInteger(stack, "ConfigProfile", preset); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java index ac9bf520..08035f9f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java @@ -5,7 +5,6 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; - public class ModelDraconicArmor extends ModelBiped { public ModelRenderOBJ head; @@ -45,16 +44,42 @@ public class ModelDraconicArmor extends ModelBiped { this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F); this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - - this.head = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicHelmet.obj"), ResourceHandler.getResource("textures/models/armor/DraconicHelmet.png")); - this.body = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicBody.obj"), ResourceHandler.getResource("textures/models/armor/DraconicBody.png")); - this.rightArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicRightArm.obj"), ResourceHandler.getResource("textures/models/armor/DraconicRightArm.png")); - this.leftArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicLeftArm.obj"), ResourceHandler.getResource("textures/models/armor/DraconicLeftArm.png")); - this.belt = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicBelt.obj"), ResourceHandler.getResource("textures/models/armor/DraconicBelt.png")); - this.rightLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicRightLeg.obj"), ResourceHandler.getResource("textures/models/armor/DraconicRightLeg.png")); - this.leftLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicLeftLeg.obj"), ResourceHandler.getResource("textures/models/armor/DraconicLeftLeg.png")); - this.rightBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicRightBoot.obj"), ResourceHandler.getResource("textures/models/armor/DraconicRightBoot.png")); - this.leftBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicLeftBoot.obj"), ResourceHandler.getResource("textures/models/armor/DraconicLeftBoot.png")); + this.head = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicHelmet.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicHelmet.png")); + this.body = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicBody.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicBody.png")); + this.rightArm = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicRightArm.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicRightArm.png")); + this.leftArm = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicLeftArm.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicLeftArm.png")); + this.belt = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicBelt.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicBelt.png")); + this.rightLeg = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicRightLeg.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicRightLeg.png")); + this.leftLeg = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicLeftLeg.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicLeftLeg.png")); + this.rightBoot = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicRightBoot.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicRightBoot.png")); + this.leftBoot = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/DraconicLeftBoot.obj"), + ResourceHandler.getResource("textures/models/armor/DraconicLeftBoot.png")); this.bipedHead.cubeList.clear(); this.bipedHeadwear.cubeList.clear(); @@ -113,7 +138,6 @@ public class ModelDraconicArmor extends ModelBiped { this.bipedLeftLeg.addChild(leftBoot); this.bipedRightLeg.addChild(rightBoot); } - } @Override @@ -158,7 +182,14 @@ public class ModelDraconicArmor extends ModelBiped { this.bipedLeftLeg.render(1F / 16F); } - public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { + public void setRotationAngles( + float p_78087_1_, + float p_78087_2_, + float p_78087_3_, + float p_78087_4_, + float p_78087_5_, + float p_78087_6_, + Entity p_78087_7_) { this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotationPointZ = 0.0F; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java index 21de2bf3..b3f4218e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java @@ -8,13 +8,13 @@ import net.minecraft.entity.Entity; * Draconic Armor.tcn - TechneToTabulaImporter * Created using Tabula 5.0.0 */ -public class ModelDraconicArmorOld extends ModelBiped {// +public class ModelDraconicArmorOld extends ModelBiped { // // public ModelRenderer bipedHead; -// public ModelRenderer bipedBody; -// public ModelRenderer bipedRightArm; -// public ModelRenderer bipedLeftArm; -// public ModelRenderer bipedRightLeg;/ -// public ModelRenderer bipedLeftLeg; + // public ModelRenderer bipedBody; + // public ModelRenderer bipedRightArm; + // public ModelRenderer bipedLeftArm; + // public ModelRenderer bipedRightLeg;/ + // public ModelRenderer bipedLeftLeg; public ModelRenderer MainHelmPieceRight1; public ModelRenderer MainHelmPieceRight2; public ModelRenderer MainHelmPieceLeft1; @@ -84,7 +84,7 @@ public class ModelDraconicArmorOld extends ModelBiped {// public ModelRenderer BootPieceRight4; public ModelRenderer LeggsTop; - //Draconic Specific + // Draconic Specific public ModelRenderer DrMainChestPieceTop; public ModelRenderer DrMainChestPieceMid; public ModelRenderer DrChestDecorationPiece1; @@ -94,7 +94,7 @@ public class ModelDraconicArmorOld extends ModelBiped {// public ModelRenderer BeltLeft; public ModelRenderer BeltRight; public ModelRenderer BeltBuckle; - //Wyvern Specific + // Wyvern Specific public ModelRenderer WyHelmPieceTop1; public ModelRenderer WyHelmPieceTop2; public ModelRenderer WyHelmPieceTop3; @@ -108,13 +108,14 @@ public class ModelDraconicArmorOld extends ModelBiped {// private boolean isDraconic; - public ModelDraconicArmorOld(float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots, boolean isDraconic) { + public ModelDraconicArmorOld( + float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots, boolean isDraconic) { super(f, 0.0f, 128, 128); this.textureWidth = 256; this.textureHeight = 128; this.isDraconic = isDraconic; - /* Helm */ + /* Helm */ { this.bipedHead = new ModelRenderer(this, 0, 0); this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F); @@ -178,7 +179,6 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.MainHelmPieceFrontTop.setRotationPoint(-4.0F, -8.0F, -5.0F); this.MainHelmPieceFrontTop.addBox(0.0F, 0.0F, 0.0F, 8, 2, 1, 0.0F); - this.HornPieceLeft1 = new ModelRenderer(this, 182, 40); this.HornPieceLeft1.setRotationPoint(4.0F, -7.5F, -1.0F); this.HornPieceLeft1.addBox(0.0F, 0.0F, 0.0F, 1, 4, 4, 0.0F); @@ -238,7 +238,7 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.setRotateAngle(WyHelmPieceTop4, -0.20943951023931953F, -0.0F, 0.0F); } - /* Chest */ + /* Chest */ { this.bipedBody = new ModelRenderer(this, 16, 16); this.bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F); @@ -270,7 +270,8 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.DrChestDecorationPiece1 = new ModelRenderer(this, 244, 38); this.DrChestDecorationPiece1.setRotationPoint(0.0F, -0.5F, -4.0F); this.DrChestDecorationPiece1.addBox(0.0F, 0.0F, -0.5F, 5, 5, 1, 0.0F); - this.setRotateAngle(DrChestDecorationPiece1, 0.1426609064282019F, -0.13533507716461618F, 0.7946695004338321F); + this.setRotateAngle( + DrChestDecorationPiece1, 0.1426609064282019F, -0.13533507716461618F, 0.7946695004338321F); this.ChestDecorationPiece2 = new ModelRenderer(this, 229, 38); this.ChestDecorationPiece2.setRotationPoint(-3.0F, 7.0F, -3.0F); @@ -325,7 +326,7 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.BeltLeft.setRotationPoint(3.7F, 10.01F, -2.2F); this.BeltLeft.addBox(0.0F, 0.0F, -0.3F, 1, 2, 5, 0.0F); - //Left + // Left this.bipedLeftArm = new ModelRenderer(this, 40, 16); this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); @@ -382,8 +383,7 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.ArmStrapLeftBottom.setRotationPoint(-1.5F, 7.0F, -2.5F); this.ArmStrapLeftBottom.addBox(0.0F, 0.0F, 0.0F, 2, 1, 5, 0.0F); - - //Right + // Right this.MainArmGuardRight = new ModelRenderer(this, 240, 72); this.MainArmGuardRight.setRotationPoint(-3.5F, 3.0F, -2.5F); this.MainArmGuardRight.addBox(0.0F, 0.0F, 0.0F, 3, 5, 5, 0.0F); @@ -440,12 +440,12 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.ArmStrapRightBottom.addBox(0.0F, 0.0F, 0.0F, 2, 1, 5, 0.0F); } - /* Leggs */ + /* Leggs */ { this.LeggsTop = new ModelRenderer(this, 121, 15); this.LeggsTop.setRotationPoint(0.5F, 8.0F, -2.4F); this.LeggsTop.addBox(-5.0F, 0.0F, 0.0F, 9, 4, 5, 0.0F); - //Left + // Left this.bipedLeftLeg = new ModelRenderer(this, 0, 16); this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F); this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); @@ -471,7 +471,7 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.KneePieceLeft1.setRotationPoint(-0.5F, 2.0F, -2.7F); this.KneePieceLeft1.addBox(0.0F, 0.0F, 0.0F, 1, 4, 1, 0.0F); - //Right + // Right this.bipedRightLeg = new ModelRenderer(this, 0, 16); this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F); this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); @@ -496,12 +496,11 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.KneePieceRight1 = new ModelRenderer(this, 156, 15); this.KneePieceRight1.setRotationPoint(-0.5F, 2.0F, -2.7F); this.KneePieceRight1.addBox(0.0F, 0.0F, 0.0F, 1, 4, 1, 0.0F); - } - /* Boots */ + /* Boots */ { - //Left + // Left this.MainBootPieceLeft = new ModelRenderer(this, 119, 0); this.MainBootPieceLeft.setRotationPoint(-2.0F, 9.1F, -2.5F); this.MainBootPieceLeft.addBox(0.0F, 0.0F, 0.0F, 4, 3, 5, 0.0F); @@ -523,7 +522,7 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.BootPieceLeft4.setRotationPoint(-2.5F, 9.05F, -2.0F); this.BootPieceLeft4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 4, 0.0F); - //Right + // Right this.MainBootPieceRight = new ModelRenderer(this, 119, 0); this.MainBootPieceRight.setRotationPoint(-2.0F, 9.1F, -2.5F); this.MainBootPieceRight.addBox(0.0F, 0.0F, 0.0F, 4, 3, 5, 0.0F); @@ -546,7 +545,6 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.BootPieceRight4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 4, 0.0F); } - this.bipedHead.cubeList.clear(); this.bipedHeadwear.cubeList.clear(); if (isHelmet) { @@ -659,7 +657,6 @@ public class ModelDraconicArmorOld extends ModelBiped {// } } - if (isdBoots) { this.bipedLeftLeg.addChild(this.MainBootPieceLeft); this.bipedLeftLeg.addChild(this.BootPieceLeft2); @@ -673,14 +670,13 @@ public class ModelDraconicArmorOld extends ModelBiped {// this.bipedRightLeg.addChild(this.BootPieceRight3); this.bipedRightLeg.addChild(this.BootPieceRight4); } - } @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); this.bipedRightLeg.render(f5); - this.bipedBody.render(f5 * 1.05F);// * 1.1F); + this.bipedBody.render(f5 * 1.05F); // * 1.1F); this.bipedLeftArm.render(f5); this.bipedRightArm.render(f5); this.bipedLeftLeg.render(f5); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java index eadfb416..0ae709f0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java @@ -158,7 +158,7 @@ public class ModelReactorEnergyInjector extends ModelBase { public void render(Entity entity, float brightness, float f1, float f2, float f3, float f4, float f5) { this.support1.render(f5); this.BasePlate.render(f5); - //this.coreSupports.render(f5); + // this.coreSupports.render(f5); float lastBrightnessX = OpenGlHelper.lastBrightnessX; float lastBrightnessY = OpenGlHelper.lastBrightnessY; @@ -166,7 +166,8 @@ public class ModelReactorEnergyInjector extends ModelBase { float b = brightness * 200F; float colour = Math.min(2F, (brightness * 2F) + 0.5F); if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); + OpenGlHelper.setLightmapTextureCoords( + OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); GL11.glColor4f(colour, colour, colour, 1F); this.element1.render(f5); GL11.glColor4f(1F, 1F, 1F, 1F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java index 004b7326..7b682dec 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java @@ -269,7 +269,8 @@ public class ModelReactorStabilizerCore extends ModelBase { float colour = Math.min(2F, (brightness * 2F) + 0.1F); if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); + OpenGlHelper.setLightmapTextureCoords( + OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); GL11.glColor4f(colour, colour, colour, 1F); this.rotor2R.render(f5); GL11.glRotatef(rotation * 2F, 0F, 0F, 1F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java index 064e979e..fd2c110f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java @@ -114,7 +114,8 @@ public class ModelReactorStabilizerRing extends ModelBase { } @Override - public void render(Entity entity, float embitterRotation, float brightness, float f2, float f3, float f4, float scale) { + public void render( + Entity entity, float embitterRotation, float brightness, float f2, float f3, float f4, float scale) { this.ringElement1.render(scale); this.ringElement2.render(scale); @@ -131,84 +132,133 @@ public class ModelReactorStabilizerRing extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.hing1.offsetX, this.hing1.offsetY, this.hing1.offsetZ); - GL11.glTranslated(this.hing1.rotationPointX * scale, this.hing1.rotationPointY * scale, this.hing1.rotationPointZ * scale); + GL11.glTranslated( + this.hing1.rotationPointX * scale, + this.hing1.rotationPointY * scale, + this.hing1.rotationPointZ * scale); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.hing1.offsetX, -this.hing1.offsetY, -this.hing1.offsetZ); - GL11.glTranslated(-this.hing1.rotationPointX * scale, -this.hing1.rotationPointY * scale, -this.hing1.rotationPointZ * scale); + GL11.glTranslated( + -this.hing1.rotationPointX * scale, + -this.hing1.rotationPointY * scale, + -this.hing1.rotationPointZ * scale); this.hing1.render(scale); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.hing2.offsetX, this.hing2.offsetY, this.hing2.offsetZ); - GL11.glTranslated(this.hing2.rotationPointX * scale, this.hing2.rotationPointY * scale, this.hing2.rotationPointZ * scale); + GL11.glTranslated( + this.hing2.rotationPointX * scale, + this.hing2.rotationPointY * scale, + this.hing2.rotationPointZ * scale); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.hing2.offsetX, -this.hing2.offsetY, -this.hing2.offsetZ); - GL11.glTranslated(-this.hing2.rotationPointX * scale, -this.hing2.rotationPointY * scale, -this.hing2.rotationPointZ * scale); + GL11.glTranslated( + -this.hing2.rotationPointX * scale, + -this.hing2.rotationPointY * scale, + -this.hing2.rotationPointZ * scale); this.hing2.render(scale); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.hing3.offsetX, this.hing3.offsetY, this.hing3.offsetZ); - GL11.glTranslated(this.hing3.rotationPointX * scale, this.hing3.rotationPointY * scale, this.hing3.rotationPointZ * scale); + GL11.glTranslated( + this.hing3.rotationPointX * scale, + this.hing3.rotationPointY * scale, + this.hing3.rotationPointZ * scale); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.hing3.offsetX, -this.hing3.offsetY, -this.hing3.offsetZ); - GL11.glTranslated(-this.hing3.rotationPointX * scale, -this.hing3.rotationPointY * scale, -this.hing3.rotationPointZ * scale); + GL11.glTranslated( + -this.hing3.rotationPointX * scale, + -this.hing3.rotationPointY * scale, + -this.hing3.rotationPointZ * scale); this.hing3.render(scale); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.hing4.offsetX, this.hing4.offsetY, this.hing4.offsetZ); - GL11.glTranslated(this.hing4.rotationPointX * scale, this.hing4.rotationPointY * scale, this.hing4.rotationPointZ * scale); + GL11.glTranslated( + this.hing4.rotationPointX * scale, + this.hing4.rotationPointY * scale, + this.hing4.rotationPointZ * scale); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.hing4.offsetX, -this.hing4.offsetY, -this.hing4.offsetZ); - GL11.glTranslated(-this.hing4.rotationPointX * scale, -this.hing4.rotationPointY * scale, -this.hing4.rotationPointZ * scale); + GL11.glTranslated( + -this.hing4.rotationPointX * scale, + -this.hing4.rotationPointY * scale, + -this.hing4.rotationPointZ * scale); this.hing4.render(scale); GL11.glPopMatrix(); -// float lastBrightnessX = OpenGlHelper.lastBrightnessX; -// float lastBrightnessY = OpenGlHelper.lastBrightnessY; -// OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); + // float lastBrightnessX = OpenGlHelper.lastBrightnessX; + // float lastBrightnessY = OpenGlHelper.lastBrightnessY; + // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); float lastBrightnessX = OpenGlHelper.lastBrightnessX; float lastBrightnessY = OpenGlHelper.lastBrightnessY; float b = brightness * 200F; float colour = Math.min(2F, (brightness * 2F) + 0.1F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); + OpenGlHelper.setLightmapTextureCoords( + OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); GL11.glColor4f(colour, colour, colour, 1F); if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslated(this.emitter1.offsetX, this.emitter1.offsetY, this.emitter1.offsetZ); - GL11.glTranslated(this.emitter1.rotationPointX * scale, this.emitter1.rotationPointY * scale, this.emitter1.rotationPointZ * scale); + GL11.glTranslated( + this.emitter1.rotationPointX * scale, + this.emitter1.rotationPointY * scale, + this.emitter1.rotationPointZ * scale); GL11.glRotatef(embitterRotation, 0, 0, 1); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.emitter1.offsetX, -this.emitter1.offsetY, -this.emitter1.offsetZ); - GL11.glTranslated(-this.emitter1.rotationPointX * scale, -this.emitter1.rotationPointY * scale, -this.emitter1.rotationPointZ * scale); + GL11.glTranslated( + -this.emitter1.rotationPointX * scale, + -this.emitter1.rotationPointY * scale, + -this.emitter1.rotationPointZ * scale); this.emitter1.render(scale); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.emitter2.offsetX, this.emitter2.offsetY, this.emitter2.offsetZ); - GL11.glTranslated(this.emitter2.rotationPointX * scale, this.emitter2.rotationPointY * scale, this.emitter2.rotationPointZ * scale); + GL11.glTranslated( + this.emitter2.rotationPointX * scale, + this.emitter2.rotationPointY * scale, + this.emitter2.rotationPointZ * scale); GL11.glRotatef(embitterRotation, 0, 0, -1); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.emitter2.offsetX, -this.emitter2.offsetY, -this.emitter2.offsetZ); - GL11.glTranslated(-this.emitter2.rotationPointX * scale, -this.emitter2.rotationPointY * scale, -this.emitter2.rotationPointZ * scale); + GL11.glTranslated( + -this.emitter2.rotationPointX * scale, + -this.emitter2.rotationPointY * scale, + -this.emitter2.rotationPointZ * scale); this.emitter2.render(scale); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.emitter3.offsetX, this.emitter3.offsetY, this.emitter3.offsetZ); - GL11.glTranslated(this.emitter3.rotationPointX * scale, this.emitter3.rotationPointY * scale, this.emitter3.rotationPointZ * scale); + GL11.glTranslated( + this.emitter3.rotationPointX * scale, + this.emitter3.rotationPointY * scale, + this.emitter3.rotationPointZ * scale); GL11.glRotatef(embitterRotation, 1, 0, 0); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.emitter3.offsetX, -this.emitter3.offsetY, -this.emitter3.offsetZ); - GL11.glTranslated(-this.emitter3.rotationPointX * scale, -this.emitter3.rotationPointY * scale, -this.emitter3.rotationPointZ * scale); + GL11.glTranslated( + -this.emitter3.rotationPointX * scale, + -this.emitter3.rotationPointY * scale, + -this.emitter3.rotationPointZ * scale); this.emitter3.render(scale); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.emitter4.offsetX, this.emitter4.offsetY, this.emitter4.offsetZ); - GL11.glTranslated(this.emitter4.rotationPointX * scale, this.emitter4.rotationPointY * scale, this.emitter4.rotationPointZ * scale); + GL11.glTranslated( + this.emitter4.rotationPointX * scale, + this.emitter4.rotationPointY * scale, + this.emitter4.rotationPointZ * scale); GL11.glRotatef(embitterRotation, -1, 0, 0); GL11.glScaled(0.5D, 0.5D, 0.5D); GL11.glTranslated(-this.emitter4.offsetX, -this.emitter4.offsetY, -this.emitter4.offsetZ); - GL11.glTranslated(-this.emitter4.rotationPointX * scale, -this.emitter4.rotationPointY * scale, -this.emitter4.rotationPointZ * scale); + GL11.glTranslated( + -this.emitter4.rotationPointX * scale, + -this.emitter4.rotationPointY * scale, + -this.emitter4.rotationPointZ * scale); this.emitter4.render(scale); GL11.glPopMatrix(); @@ -226,6 +276,4 @@ public class ModelReactorStabilizerRing extends ModelBase { modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java index c0989149..1abd6feb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java @@ -38,13 +38,16 @@ public class ModelRenderOBJ extends ModelRenderer { if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { GL11.glCallList(this.displayList); } else { - GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + GL11.glTranslatef( + this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); GL11.glCallList(this.displayList); - GL11.glTranslatef(-this.rotationPointX * scale, -this.rotationPointY * scale, -this.rotationPointZ * scale); + GL11.glTranslatef( + -this.rotationPointX * scale, -this.rotationPointY * scale, -this.rotationPointZ * scale); } } else { GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + GL11.glTranslatef( + this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); if (this.rotateAngleZ != 0.0F) { GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); } @@ -63,7 +66,6 @@ public class ModelRenderOBJ extends ModelRenderer { GL11.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ); } - } private void compileDisplayList(float scale) { @@ -74,7 +76,7 @@ public class ModelRenderOBJ extends ModelRenderer { GL11.glPushMatrix(); ResourceHandler.bindTexture(texture); - //scale = 1F/15F; + // scale = 1F/15F; GL11.glScalef(scale, scale, scale); GL11.glRotatef(180, -1, 0, 1); model.renderAll(); @@ -108,22 +110,23 @@ public class ModelRenderOBJ extends ModelRenderer { GL11.glCallList(this.displayList); GL11.glPopMatrix(); } - } @Override public void postRender(float scale) { if (!this.isHidden && this.showModel) { -// if(!this.compiled) { -// this.compileDisplayList(scale); -// } + // if(!this.compiled) { + // this.compileDisplayList(scale); + // } if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { - GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + GL11.glTranslatef( + this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); } } else { - GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + GL11.glTranslatef( + this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); if (this.rotateAngleZ != 0.0F) { GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); } @@ -137,6 +140,5 @@ public class ModelRenderOBJ extends ModelRenderer { } } } - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java index 6d51c6ea..9e463eea 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java @@ -55,7 +55,6 @@ public class ModelTeleporterStand extends ModelBase { baseBottom.setRotationPoint(-5F, 7F, -5F); baseBottom.setTextureSize(64, 64); setRotationDegree(baseBottom, 0, 0, 0); - } public void render() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java index 19cacd8c..4a63ceec 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java @@ -5,7 +5,6 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; - public class ModelWyvernArmor extends ModelBiped { public ModelRenderOBJ head; @@ -45,16 +44,42 @@ public class ModelWyvernArmor extends ModelBiped { this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F); this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - - this.head = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernHelmet.obj"), ResourceHandler.getResource("textures/models/armor/WyvernHelmet.png")); - this.body = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernBody.obj"), ResourceHandler.getResource("textures/models/armor/WyvernBody.png")); - this.rightArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernRightArm.obj"), ResourceHandler.getResource("textures/models/armor/WyvernRightArm.png")); - this.leftArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernLeftArm.obj"), ResourceHandler.getResource("textures/models/armor/WyvernLeftArm.png")); - this.belt = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernBelt.obj"), ResourceHandler.getResource("textures/models/armor/WyvernBelt.png")); - this.rightLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernRightLeg.obj"), ResourceHandler.getResource("textures/models/armor/WyvernRightLeg.png")); - this.leftLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernLeftLeg.obj"), ResourceHandler.getResource("textures/models/armor/WyvernLeftLeg.png")); - this.rightBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernRightBoot.obj"), ResourceHandler.getResource("textures/models/armor/WyvernRightBoot.png")); - this.leftBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernLeftBoot.obj"), ResourceHandler.getResource("textures/models/armor/WyvernLeftBoot.png")); + this.head = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernHelmet.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernHelmet.png")); + this.body = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernBody.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernBody.png")); + this.rightArm = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernRightArm.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernRightArm.png")); + this.leftArm = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernLeftArm.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernLeftArm.png")); + this.belt = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernBelt.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernBelt.png")); + this.rightLeg = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernRightLeg.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernRightLeg.png")); + this.leftLeg = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernLeftLeg.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernLeftLeg.png")); + this.rightBoot = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernRightBoot.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernRightBoot.png")); + this.leftBoot = new ModelRenderOBJ( + this, + ResourceHandler.getResource("models/armor/WyvernLeftBoot.obj"), + ResourceHandler.getResource("textures/models/armor/WyvernLeftBoot.png")); this.bipedHead.cubeList.clear(); this.bipedHeadwear.cubeList.clear(); @@ -110,7 +135,6 @@ public class ModelWyvernArmor extends ModelBiped { this.bipedLeftLeg.addChild(leftBoot); this.bipedRightLeg.addChild(rightBoot); } - } @Override @@ -155,7 +179,14 @@ public class ModelWyvernArmor extends ModelBiped { this.bipedLeftLeg.render(1F / 16F); } - public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float scale, Entity p_78087_7_) { + public void setRotationAngles( + float p_78087_1_, + float p_78087_2_, + float p_78087_3_, + float p_78087_4_, + float p_78087_5_, + float scale, + Entity p_78087_7_) { this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotationPointZ = 0.0F; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java b/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java index 28c05446..ec3f5111 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java @@ -10,7 +10,7 @@ import org.lwjgl.opengl.GL11; * Created using Tabula 5.0.0 */ public class ModelStaffOfTheGreatOne extends ModelBase { - public double[] modelScale = new double[]{2.0D, 2.0D, 2.0D}; + public double[] modelScale = new double[] {2.0D, 2.0D, 2.0D}; public ModelRenderer staff; public ModelRenderer edge1; public ModelRenderer edge1_1; @@ -336,611 +336,981 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glScaled(1D / modelScale[0], 1D / modelScale[1], 1D / modelScale[2]); GL11.glPushMatrix(); GL11.glTranslated(this.edge1.offsetX, this.edge1.offsetY, this.edge1.offsetZ); - GL11.glTranslated(this.edge1.rotationPointX * f5, this.edge1.rotationPointY * f5, this.edge1.rotationPointZ * f5); + GL11.glTranslated( + this.edge1.rotationPointX * f5, this.edge1.rotationPointY * f5, this.edge1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1.offsetX, -this.edge1.offsetY, -this.edge1.offsetZ); - GL11.glTranslated(-this.edge1.rotationPointX * f5, -this.edge1.rotationPointY * f5, -this.edge1.rotationPointZ * f5); + GL11.glTranslated( + -this.edge1.rotationPointX * f5, -this.edge1.rotationPointY * f5, -this.edge1.rotationPointZ * f5); this.edge1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopM_3.offsetX, this.staffTopM_3.offsetY, this.staffTopM_3.offsetZ); - GL11.glTranslated(this.staffTopM_3.rotationPointX * f5, this.staffTopM_3.rotationPointY * f5, this.staffTopM_3.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopM_3.rotationPointX * f5, + this.staffTopM_3.rotationPointY * f5, + this.staffTopM_3.rotationPointZ * f5); GL11.glScaled(0.6D, 1.06D, 0.6D); GL11.glTranslated(-this.staffTopM_3.offsetX, -this.staffTopM_3.offsetY, -this.staffTopM_3.offsetZ); - GL11.glTranslated(-this.staffTopM_3.rotationPointX * f5, -this.staffTopM_3.rotationPointY * f5, -this.staffTopM_3.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopM_3.rotationPointX * f5, + -this.staffTopM_3.rotationPointY * f5, + -this.staffTopM_3.rotationPointZ * f5); this.staffTopM_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge2_1.offsetX, this.edge2_1.offsetY, this.edge2_1.offsetZ); - GL11.glTranslated(this.edge2_1.rotationPointX * f5, this.edge2_1.rotationPointY * f5, this.edge2_1.rotationPointZ * f5); + GL11.glTranslated( + this.edge2_1.rotationPointX * f5, this.edge2_1.rotationPointY * f5, this.edge2_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2_1.offsetX, -this.edge2_1.offsetY, -this.edge2_1.offsetZ); - GL11.glTranslated(-this.edge2_1.rotationPointX * f5, -this.edge2_1.rotationPointY * f5, -this.edge2_1.rotationPointZ * f5); + GL11.glTranslated( + -this.edge2_1.rotationPointX * f5, + -this.edge2_1.rotationPointY * f5, + -this.edge2_1.rotationPointZ * f5); this.edge2_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape5_1.offsetX, this.shape5_1.offsetY, this.shape5_1.offsetZ); - GL11.glTranslated(this.shape5_1.rotationPointX * f5, this.shape5_1.rotationPointY * f5, this.shape5_1.rotationPointZ * f5); + GL11.glTranslated( + this.shape5_1.rotationPointX * f5, + this.shape5_1.rotationPointY * f5, + this.shape5_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape5_1.offsetX, -this.shape5_1.offsetY, -this.shape5_1.offsetZ); - GL11.glTranslated(-this.shape5_1.rotationPointX * f5, -this.shape5_1.rotationPointY * f5, -this.shape5_1.rotationPointZ * f5); + GL11.glTranslated( + -this.shape5_1.rotationPointX * f5, + -this.shape5_1.rotationPointY * f5, + -this.shape5_1.rotationPointZ * f5); this.shape5_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape4_2.offsetX, this.shape4_2.offsetY, this.shape4_2.offsetZ); - GL11.glTranslated(this.shape4_2.rotationPointX * f5, this.shape4_2.rotationPointY * f5, this.shape4_2.rotationPointZ * f5); + GL11.glTranslated( + this.shape4_2.rotationPointX * f5, + this.shape4_2.rotationPointY * f5, + this.shape4_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape4_2.offsetX, -this.shape4_2.offsetY, -this.shape4_2.offsetZ); - GL11.glTranslated(-this.shape4_2.rotationPointX * f5, -this.shape4_2.rotationPointY * f5, -this.shape4_2.rotationPointZ * f5); + GL11.glTranslated( + -this.shape4_2.rotationPointX * f5, + -this.shape4_2.rotationPointY * f5, + -this.shape4_2.rotationPointZ * f5); this.shape4_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.tope2.offsetX, this.tope2.offsetY, this.tope2.offsetZ); - GL11.glTranslated(this.tope2.rotationPointX * f5, this.tope2.rotationPointY * f5, this.tope2.rotationPointZ * f5); + GL11.glTranslated( + this.tope2.rotationPointX * f5, this.tope2.rotationPointY * f5, this.tope2.rotationPointZ * f5); GL11.glScaled(0.9D, 0.5D, 0.9D); GL11.glTranslated(-this.tope2.offsetX, -this.tope2.offsetY, -this.tope2.offsetZ); - GL11.glTranslated(-this.tope2.rotationPointX * f5, -this.tope2.rotationPointY * f5, -this.tope2.rotationPointZ * f5); + GL11.glTranslated( + -this.tope2.rotationPointX * f5, -this.tope2.rotationPointY * f5, -this.tope2.rotationPointZ * f5); this.tope2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.tope1.offsetX, this.tope1.offsetY, this.tope1.offsetZ); - GL11.glTranslated(this.tope1.rotationPointX * f5, this.tope1.rotationPointY * f5, this.tope1.rotationPointZ * f5); + GL11.glTranslated( + this.tope1.rotationPointX * f5, this.tope1.rotationPointY * f5, this.tope1.rotationPointZ * f5); GL11.glScaled(1.2D, 0.5D, 1.2D); GL11.glTranslated(-this.tope1.offsetX, -this.tope1.offsetY, -this.tope1.offsetZ); - GL11.glTranslated(-this.tope1.rotationPointX * f5, -this.tope1.rotationPointY * f5, -this.tope1.rotationPointZ * f5); + GL11.glTranslated( + -this.tope1.rotationPointX * f5, -this.tope1.rotationPointY * f5, -this.tope1.rotationPointZ * f5); this.tope1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape7_2.offsetX, this.shape7_2.offsetY, this.shape7_2.offsetZ); - GL11.glTranslated(this.shape7_2.rotationPointX * f5, this.shape7_2.rotationPointY * f5, this.shape7_2.rotationPointZ * f5); + GL11.glTranslated( + this.shape7_2.rotationPointX * f5, + this.shape7_2.rotationPointY * f5, + this.shape7_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape7_2.offsetX, -this.shape7_2.offsetY, -this.shape7_2.offsetZ); - GL11.glTranslated(-this.shape7_2.rotationPointX * f5, -this.shape7_2.rotationPointY * f5, -this.shape7_2.rotationPointZ * f5); + GL11.glTranslated( + -this.shape7_2.rotationPointX * f5, + -this.shape7_2.rotationPointY * f5, + -this.shape7_2.rotationPointZ * f5); this.shape7_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape4.offsetX, this.shape4.offsetY, this.shape4.offsetZ); - GL11.glTranslated(this.shape4.rotationPointX * f5, this.shape4.rotationPointY * f5, this.shape4.rotationPointZ * f5); + GL11.glTranslated( + this.shape4.rotationPointX * f5, this.shape4.rotationPointY * f5, this.shape4.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape4.offsetX, -this.shape4.offsetY, -this.shape4.offsetZ); - GL11.glTranslated(-this.shape4.rotationPointX * f5, -this.shape4.rotationPointY * f5, -this.shape4.rotationPointZ * f5); + GL11.glTranslated( + -this.shape4.rotationPointX * f5, -this.shape4.rotationPointY * f5, -this.shape4.rotationPointZ * f5); this.shape4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape2_2.offsetX, this.shape2_2.offsetY, this.shape2_2.offsetZ); - GL11.glTranslated(this.shape2_2.rotationPointX * f5, this.shape2_2.rotationPointY * f5, this.shape2_2.rotationPointZ * f5); + GL11.glTranslated( + this.shape2_2.rotationPointX * f5, + this.shape2_2.rotationPointY * f5, + this.shape2_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape2_2.offsetX, -this.shape2_2.offsetY, -this.shape2_2.offsetZ); - GL11.glTranslated(-this.shape2_2.rotationPointX * f5, -this.shape2_2.rotationPointY * f5, -this.shape2_2.rotationPointZ * f5); + GL11.glTranslated( + -this.shape2_2.rotationPointX * f5, + -this.shape2_2.rotationPointY * f5, + -this.shape2_2.rotationPointZ * f5); this.shape2_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge2_2.offsetX, this.topedge2_2.offsetY, this.topedge2_2.offsetZ); - GL11.glTranslated(this.topedge2_2.rotationPointX * f5, this.topedge2_2.rotationPointY * f5, this.topedge2_2.rotationPointZ * f5); + GL11.glTranslated( + this.topedge2_2.rotationPointX * f5, + this.topedge2_2.rotationPointY * f5, + this.topedge2_2.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge2_2.offsetX, -this.topedge2_2.offsetY, -this.topedge2_2.offsetZ); - GL11.glTranslated(-this.topedge2_2.rotationPointX * f5, -this.topedge2_2.rotationPointY * f5, -this.topedge2_2.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge2_2.rotationPointX * f5, + -this.topedge2_2.rotationPointY * f5, + -this.topedge2_2.rotationPointZ * f5); this.topedge2_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge4_1.offsetX, this.topedge4_1.offsetY, this.topedge4_1.offsetZ); - GL11.glTranslated(this.topedge4_1.rotationPointX * f5, this.topedge4_1.rotationPointY * f5, this.topedge4_1.rotationPointZ * f5); + GL11.glTranslated( + this.topedge4_1.rotationPointX * f5, + this.topedge4_1.rotationPointY * f5, + this.topedge4_1.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge4_1.offsetX, -this.topedge4_1.offsetY, -this.topedge4_1.offsetZ); - GL11.glTranslated(-this.topedge4_1.rotationPointX * f5, -this.topedge4_1.rotationPointY * f5, -this.topedge4_1.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge4_1.rotationPointX * f5, + -this.topedge4_1.rotationPointY * f5, + -this.topedge4_1.rotationPointZ * f5); this.topedge4_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge5.offsetX, this.topedge5.offsetY, this.topedge5.offsetZ); - GL11.glTranslated(this.topedge5.rotationPointX * f5, this.topedge5.rotationPointY * f5, this.topedge5.rotationPointZ * f5); + GL11.glTranslated( + this.topedge5.rotationPointX * f5, + this.topedge5.rotationPointY * f5, + this.topedge5.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge5.offsetX, -this.topedge5.offsetY, -this.topedge5.offsetZ); - GL11.glTranslated(-this.topedge5.rotationPointX * f5, -this.topedge5.rotationPointY * f5, -this.topedge5.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge5.rotationPointX * f5, + -this.topedge5.rotationPointY * f5, + -this.topedge5.rotationPointZ * f5); this.topedge5.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge4_2.offsetX, this.topedge4_2.offsetY, this.topedge4_2.offsetZ); - GL11.glTranslated(this.topedge4_2.rotationPointX * f5, this.topedge4_2.rotationPointY * f5, this.topedge4_2.rotationPointZ * f5); + GL11.glTranslated( + this.topedge4_2.rotationPointX * f5, + this.topedge4_2.rotationPointY * f5, + this.topedge4_2.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge4_2.offsetX, -this.topedge4_2.offsetY, -this.topedge4_2.offsetZ); - GL11.glTranslated(-this.topedge4_2.rotationPointX * f5, -this.topedge4_2.rotationPointY * f5, -this.topedge4_2.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge4_2.rotationPointX * f5, + -this.topedge4_2.rotationPointY * f5, + -this.topedge4_2.rotationPointZ * f5); this.topedge4_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape6_2.offsetX, this.shape6_2.offsetY, this.shape6_2.offsetZ); - GL11.glTranslated(this.shape6_2.rotationPointX * f5, this.shape6_2.rotationPointY * f5, this.shape6_2.rotationPointZ * f5); + GL11.glTranslated( + this.shape6_2.rotationPointX * f5, + this.shape6_2.rotationPointY * f5, + this.shape6_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape6_2.offsetX, -this.shape6_2.offsetY, -this.shape6_2.offsetZ); - GL11.glTranslated(-this.shape6_2.rotationPointX * f5, -this.shape6_2.rotationPointY * f5, -this.shape6_2.rotationPointZ * f5); + GL11.glTranslated( + -this.shape6_2.rotationPointX * f5, + -this.shape6_2.rotationPointY * f5, + -this.shape6_2.rotationPointZ * f5); this.shape6_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge3.offsetX, this.edge3.offsetY, this.edge3.offsetZ); - GL11.glTranslated(this.edge3.rotationPointX * f5, this.edge3.rotationPointY * f5, this.edge3.rotationPointZ * f5); + GL11.glTranslated( + this.edge3.rotationPointX * f5, this.edge3.rotationPointY * f5, this.edge3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3.offsetX, -this.edge3.offsetY, -this.edge3.offsetZ); - GL11.glTranslated(-this.edge3.rotationPointX * f5, -this.edge3.rotationPointY * f5, -this.edge3.rotationPointZ * f5); + GL11.glTranslated( + -this.edge3.rotationPointX * f5, -this.edge3.rotationPointY * f5, -this.edge3.rotationPointZ * f5); this.edge3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge4_3.offsetX, this.topedge4_3.offsetY, this.topedge4_3.offsetZ); - GL11.glTranslated(this.topedge4_3.rotationPointX * f5, this.topedge4_3.rotationPointY * f5, this.topedge4_3.rotationPointZ * f5); + GL11.glTranslated( + this.topedge4_3.rotationPointX * f5, + this.topedge4_3.rotationPointY * f5, + this.topedge4_3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge4_3.offsetX, -this.topedge4_3.offsetY, -this.topedge4_3.offsetZ); - GL11.glTranslated(-this.topedge4_3.rotationPointX * f5, -this.topedge4_3.rotationPointY * f5, -this.topedge4_3.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge4_3.rotationPointX * f5, + -this.topedge4_3.rotationPointY * f5, + -this.topedge4_3.rotationPointZ * f5); this.topedge4_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape5_3.offsetX, this.shape5_3.offsetY, this.shape5_3.offsetZ); - GL11.glTranslated(this.shape5_3.rotationPointX * f5, this.shape5_3.rotationPointY * f5, this.shape5_3.rotationPointZ * f5); + GL11.glTranslated( + this.shape5_3.rotationPointX * f5, + this.shape5_3.rotationPointY * f5, + this.shape5_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape5_3.offsetX, -this.shape5_3.offsetY, -this.shape5_3.offsetZ); - GL11.glTranslated(-this.shape5_3.rotationPointX * f5, -this.shape5_3.rotationPointY * f5, -this.shape5_3.rotationPointZ * f5); + GL11.glTranslated( + -this.shape5_3.rotationPointX * f5, + -this.shape5_3.rotationPointY * f5, + -this.shape5_3.rotationPointZ * f5); this.shape5_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape4_3.offsetX, this.shape4_3.offsetY, this.shape4_3.offsetZ); - GL11.glTranslated(this.shape4_3.rotationPointX * f5, this.shape4_3.rotationPointY * f5, this.shape4_3.rotationPointZ * f5); + GL11.glTranslated( + this.shape4_3.rotationPointX * f5, + this.shape4_3.rotationPointY * f5, + this.shape4_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape4_3.offsetX, -this.shape4_3.offsetY, -this.shape4_3.offsetZ); - GL11.glTranslated(-this.shape4_3.rotationPointX * f5, -this.shape4_3.rotationPointY * f5, -this.shape4_3.rotationPointZ * f5); + GL11.glTranslated( + -this.shape4_3.rotationPointX * f5, + -this.shape4_3.rotationPointY * f5, + -this.shape4_3.rotationPointZ * f5); this.shape4_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge3.offsetX, this.topedge3.offsetY, this.topedge3.offsetZ); - GL11.glTranslated(this.topedge3.rotationPointX * f5, this.topedge3.rotationPointY * f5, this.topedge3.rotationPointZ * f5); + GL11.glTranslated( + this.topedge3.rotationPointX * f5, + this.topedge3.rotationPointY * f5, + this.topedge3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge3.offsetX, -this.topedge3.offsetY, -this.topedge3.offsetZ); - GL11.glTranslated(-this.topedge3.rotationPointX * f5, -this.topedge3.rotationPointY * f5, -this.topedge3.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge3.rotationPointX * f5, + -this.topedge3.rotationPointY * f5, + -this.topedge3.rotationPointZ * f5); this.topedge3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge4.offsetX, this.topedge4.offsetY, this.topedge4.offsetZ); - GL11.glTranslated(this.topedge4.rotationPointX * f5, this.topedge4.rotationPointY * f5, this.topedge4.rotationPointZ * f5); + GL11.glTranslated( + this.topedge4.rotationPointX * f5, + this.topedge4.rotationPointY * f5, + this.topedge4.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge4.offsetX, -this.topedge4.offsetY, -this.topedge4.offsetZ); - GL11.glTranslated(-this.topedge4.rotationPointX * f5, -this.topedge4.rotationPointY * f5, -this.topedge4.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge4.rotationPointX * f5, + -this.topedge4.rotationPointY * f5, + -this.topedge4.rotationPointZ * f5); this.topedge4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge5_2.offsetX, this.edge5_2.offsetY, this.edge5_2.offsetZ); - GL11.glTranslated(this.edge5_2.rotationPointX * f5, this.edge5_2.rotationPointY * f5, this.edge5_2.rotationPointZ * f5); + GL11.glTranslated( + this.edge5_2.rotationPointX * f5, this.edge5_2.rotationPointY * f5, this.edge5_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_2.offsetX, -this.edge5_2.offsetY, -this.edge5_2.offsetZ); - GL11.glTranslated(-this.edge5_2.rotationPointX * f5, -this.edge5_2.rotationPointY * f5, -this.edge5_2.rotationPointZ * f5); + GL11.glTranslated( + -this.edge5_2.rotationPointX * f5, + -this.edge5_2.rotationPointY * f5, + -this.edge5_2.rotationPointZ * f5); this.edge5_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge5.offsetX, this.edge5.offsetY, this.edge5.offsetZ); - GL11.glTranslated(this.edge5.rotationPointX * f5, this.edge5.rotationPointY * f5, this.edge5.rotationPointZ * f5); + GL11.glTranslated( + this.edge5.rotationPointX * f5, this.edge5.rotationPointY * f5, this.edge5.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5.offsetX, -this.edge5.offsetY, -this.edge5.offsetZ); - GL11.glTranslated(-this.edge5.rotationPointX * f5, -this.edge5.rotationPointY * f5, -this.edge5.rotationPointZ * f5); + GL11.glTranslated( + -this.edge5.rotationPointX * f5, -this.edge5.rotationPointY * f5, -this.edge5.rotationPointZ * f5); this.edge5.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge2_3.offsetX, this.topedge2_3.offsetY, this.topedge2_3.offsetZ); - GL11.glTranslated(this.topedge2_3.rotationPointX * f5, this.topedge2_3.rotationPointY * f5, this.topedge2_3.rotationPointZ * f5); + GL11.glTranslated( + this.topedge2_3.rotationPointX * f5, + this.topedge2_3.rotationPointY * f5, + this.topedge2_3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge2_3.offsetX, -this.topedge2_3.offsetY, -this.topedge2_3.offsetZ); - GL11.glTranslated(-this.topedge2_3.rotationPointX * f5, -this.topedge2_3.rotationPointY * f5, -this.topedge2_3.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge2_3.rotationPointX * f5, + -this.topedge2_3.rotationPointY * f5, + -this.topedge2_3.rotationPointZ * f5); this.topedge2_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape6_3.offsetX, this.shape6_3.offsetY, this.shape6_3.offsetZ); - GL11.glTranslated(this.shape6_3.rotationPointX * f5, this.shape6_3.rotationPointY * f5, this.shape6_3.rotationPointZ * f5); + GL11.glTranslated( + this.shape6_3.rotationPointX * f5, + this.shape6_3.rotationPointY * f5, + this.shape6_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape6_3.offsetX, -this.shape6_3.offsetY, -this.shape6_3.offsetZ); - GL11.glTranslated(-this.shape6_3.rotationPointX * f5, -this.shape6_3.rotationPointY * f5, -this.shape6_3.rotationPointZ * f5); + GL11.glTranslated( + -this.shape6_3.rotationPointX * f5, + -this.shape6_3.rotationPointY * f5, + -this.shape6_3.rotationPointZ * f5); this.shape6_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge1_1.offsetX, this.edge1_1.offsetY, this.edge1_1.offsetZ); - GL11.glTranslated(this.edge1_1.rotationPointX * f5, this.edge1_1.rotationPointY * f5, this.edge1_1.rotationPointZ * f5); + GL11.glTranslated( + this.edge1_1.rotationPointX * f5, this.edge1_1.rotationPointY * f5, this.edge1_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1_1.offsetX, -this.edge1_1.offsetY, -this.edge1_1.offsetZ); - GL11.glTranslated(-this.edge1_1.rotationPointX * f5, -this.edge1_1.rotationPointY * f5, -this.edge1_1.rotationPointZ * f5); + GL11.glTranslated( + -this.edge1_1.rotationPointX * f5, + -this.edge1_1.rotationPointY * f5, + -this.edge1_1.rotationPointZ * f5); this.edge1_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape5_2.offsetX, this.shape5_2.offsetY, this.shape5_2.offsetZ); - GL11.glTranslated(this.shape5_2.rotationPointX * f5, this.shape5_2.rotationPointY * f5, this.shape5_2.rotationPointZ * f5); + GL11.glTranslated( + this.shape5_2.rotationPointX * f5, + this.shape5_2.rotationPointY * f5, + this.shape5_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape5_2.offsetX, -this.shape5_2.offsetY, -this.shape5_2.offsetZ); - GL11.glTranslated(-this.shape5_2.rotationPointX * f5, -this.shape5_2.rotationPointY * f5, -this.shape5_2.rotationPointZ * f5); + GL11.glTranslated( + -this.shape5_2.rotationPointX * f5, + -this.shape5_2.rotationPointY * f5, + -this.shape5_2.rotationPointZ * f5); this.shape5_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge5_2.offsetX, this.topedge5_2.offsetY, this.topedge5_2.offsetZ); - GL11.glTranslated(this.topedge5_2.rotationPointX * f5, this.topedge5_2.rotationPointY * f5, this.topedge5_2.rotationPointZ * f5); + GL11.glTranslated( + this.topedge5_2.rotationPointX * f5, + this.topedge5_2.rotationPointY * f5, + this.topedge5_2.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge5_2.offsetX, -this.topedge5_2.offsetY, -this.topedge5_2.offsetZ); - GL11.glTranslated(-this.topedge5_2.rotationPointX * f5, -this.topedge5_2.rotationPointY * f5, -this.topedge5_2.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge5_2.rotationPointX * f5, + -this.topedge5_2.rotationPointY * f5, + -this.topedge5_2.rotationPointZ * f5); this.topedge5_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge2.offsetX, this.topedge2.offsetY, this.topedge2.offsetZ); - GL11.glTranslated(this.topedge2.rotationPointX * f5, this.topedge2.rotationPointY * f5, this.topedge2.rotationPointZ * f5); + GL11.glTranslated( + this.topedge2.rotationPointX * f5, + this.topedge2.rotationPointY * f5, + this.topedge2.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge2.offsetX, -this.topedge2.offsetY, -this.topedge2.offsetZ); - GL11.glTranslated(-this.topedge2.rotationPointX * f5, -this.topedge2.rotationPointY * f5, -this.topedge2.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge2.rotationPointX * f5, + -this.topedge2.rotationPointY * f5, + -this.topedge2.rotationPointZ * f5); this.topedge2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopQ_3.offsetX, this.staffTopQ_3.offsetY, this.staffTopQ_3.offsetZ); - GL11.glTranslated(this.staffTopQ_3.rotationPointX * f5, this.staffTopQ_3.rotationPointY * f5, this.staffTopQ_3.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopQ_3.rotationPointX * f5, + this.staffTopQ_3.rotationPointY * f5, + this.staffTopQ_3.rotationPointZ * f5); GL11.glScaled(0.7D, 1.0D, 0.7D); GL11.glTranslated(-this.staffTopQ_3.offsetX, -this.staffTopQ_3.offsetY, -this.staffTopQ_3.offsetZ); - GL11.glTranslated(-this.staffTopQ_3.rotationPointX * f5, -this.staffTopQ_3.rotationPointY * f5, -this.staffTopQ_3.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopQ_3.rotationPointX * f5, + -this.staffTopQ_3.rotationPointY * f5, + -this.staffTopQ_3.rotationPointZ * f5); this.staffTopQ_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge4_2.offsetX, this.edge4_2.offsetY, this.edge4_2.offsetZ); - GL11.glTranslated(this.edge4_2.rotationPointX * f5, this.edge4_2.rotationPointY * f5, this.edge4_2.rotationPointZ * f5); + GL11.glTranslated( + this.edge4_2.rotationPointX * f5, this.edge4_2.rotationPointY * f5, this.edge4_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge4_2.offsetX, -this.edge4_2.offsetY, -this.edge4_2.offsetZ); - GL11.glTranslated(-this.edge4_2.rotationPointX * f5, -this.edge4_2.rotationPointY * f5, -this.edge4_2.rotationPointZ * f5); + GL11.glTranslated( + -this.edge4_2.rotationPointX * f5, + -this.edge4_2.rotationPointY * f5, + -this.edge4_2.rotationPointZ * f5); this.edge4_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopQ_1.offsetX, this.staffTopQ_1.offsetY, this.staffTopQ_1.offsetZ); - GL11.glTranslated(this.staffTopQ_1.rotationPointX * f5, this.staffTopQ_1.rotationPointY * f5, this.staffTopQ_1.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopQ_1.rotationPointX * f5, + this.staffTopQ_1.rotationPointY * f5, + this.staffTopQ_1.rotationPointZ * f5); GL11.glScaled(0.7D, 1.0D, 0.7D); GL11.glTranslated(-this.staffTopQ_1.offsetX, -this.staffTopQ_1.offsetY, -this.staffTopQ_1.offsetZ); - GL11.glTranslated(-this.staffTopQ_1.rotationPointX * f5, -this.staffTopQ_1.rotationPointY * f5, -this.staffTopQ_1.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopQ_1.rotationPointX * f5, + -this.staffTopQ_1.rotationPointY * f5, + -this.staffTopQ_1.rotationPointZ * f5); this.staffTopQ_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge3_3.offsetX, this.edge3_3.offsetY, this.edge3_3.offsetZ); - GL11.glTranslated(this.edge3_3.rotationPointX * f5, this.edge3_3.rotationPointY * f5, this.edge3_3.rotationPointZ * f5); + GL11.glTranslated( + this.edge3_3.rotationPointX * f5, this.edge3_3.rotationPointY * f5, this.edge3_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3_3.offsetX, -this.edge3_3.offsetY, -this.edge3_3.offsetZ); - GL11.glTranslated(-this.edge3_3.rotationPointX * f5, -this.edge3_3.rotationPointY * f5, -this.edge3_3.rotationPointZ * f5); + GL11.glTranslated( + -this.edge3_3.rotationPointX * f5, + -this.edge3_3.rotationPointY * f5, + -this.edge3_3.rotationPointZ * f5); this.edge3_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape3.offsetX, this.shape3.offsetY, this.shape3.offsetZ); - GL11.glTranslated(this.shape3.rotationPointX * f5, this.shape3.rotationPointY * f5, this.shape3.rotationPointZ * f5); + GL11.glTranslated( + this.shape3.rotationPointX * f5, this.shape3.rotationPointY * f5, this.shape3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape3.offsetX, -this.shape3.offsetY, -this.shape3.offsetZ); - GL11.glTranslated(-this.shape3.rotationPointX * f5, -this.shape3.rotationPointY * f5, -this.shape3.rotationPointZ * f5); + GL11.glTranslated( + -this.shape3.rotationPointX * f5, -this.shape3.rotationPointY * f5, -this.shape3.rotationPointZ * f5); this.shape3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape2_3.offsetX, this.shape2_3.offsetY, this.shape2_3.offsetZ); - GL11.glTranslated(this.shape2_3.rotationPointX * f5, this.shape2_3.rotationPointY * f5, this.shape2_3.rotationPointZ * f5); + GL11.glTranslated( + this.shape2_3.rotationPointX * f5, + this.shape2_3.rotationPointY * f5, + this.shape2_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape2_3.offsetX, -this.shape2_3.offsetY, -this.shape2_3.offsetZ); - GL11.glTranslated(-this.shape2_3.rotationPointX * f5, -this.shape2_3.rotationPointY * f5, -this.shape2_3.rotationPointZ * f5); + GL11.glTranslated( + -this.shape2_3.rotationPointX * f5, + -this.shape2_3.rotationPointY * f5, + -this.shape2_3.rotationPointZ * f5); this.shape2_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge1.offsetX, this.topedge1.offsetY, this.topedge1.offsetZ); - GL11.glTranslated(this.topedge1.rotationPointX * f5, this.topedge1.rotationPointY * f5, this.topedge1.rotationPointZ * f5); + GL11.glTranslated( + this.topedge1.rotationPointX * f5, + this.topedge1.rotationPointY * f5, + this.topedge1.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge1.offsetX, -this.topedge1.offsetY, -this.topedge1.offsetZ); - GL11.glTranslated(-this.topedge1.rotationPointX * f5, -this.topedge1.rotationPointY * f5, -this.topedge1.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge1.rotationPointX * f5, + -this.topedge1.rotationPointY * f5, + -this.topedge1.rotationPointZ * f5); this.topedge1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge5_1.offsetX, this.topedge5_1.offsetY, this.topedge5_1.offsetZ); - GL11.glTranslated(this.topedge5_1.rotationPointX * f5, this.topedge5_1.rotationPointY * f5, this.topedge5_1.rotationPointZ * f5); + GL11.glTranslated( + this.topedge5_1.rotationPointX * f5, + this.topedge5_1.rotationPointY * f5, + this.topedge5_1.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge5_1.offsetX, -this.topedge5_1.offsetY, -this.topedge5_1.offsetZ); - GL11.glTranslated(-this.topedge5_1.rotationPointX * f5, -this.topedge5_1.rotationPointY * f5, -this.topedge5_1.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge5_1.rotationPointX * f5, + -this.topedge5_1.rotationPointY * f5, + -this.topedge5_1.rotationPointZ * f5); this.topedge5_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape7_3.offsetX, this.shape7_3.offsetY, this.shape7_3.offsetZ); - GL11.glTranslated(this.shape7_3.rotationPointX * f5, this.shape7_3.rotationPointY * f5, this.shape7_3.rotationPointZ * f5); + GL11.glTranslated( + this.shape7_3.rotationPointX * f5, + this.shape7_3.rotationPointY * f5, + this.shape7_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape7_3.offsetX, -this.shape7_3.offsetY, -this.shape7_3.offsetZ); - GL11.glTranslated(-this.shape7_3.rotationPointX * f5, -this.shape7_3.rotationPointY * f5, -this.shape7_3.rotationPointZ * f5); + GL11.glTranslated( + -this.shape7_3.rotationPointX * f5, + -this.shape7_3.rotationPointY * f5, + -this.shape7_3.rotationPointZ * f5); this.shape7_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopM_2.offsetX, this.staffTopM_2.offsetY, this.staffTopM_2.offsetZ); - GL11.glTranslated(this.staffTopM_2.rotationPointX * f5, this.staffTopM_2.rotationPointY * f5, this.staffTopM_2.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopM_2.rotationPointX * f5, + this.staffTopM_2.rotationPointY * f5, + this.staffTopM_2.rotationPointZ * f5); GL11.glScaled(0.6D, 1.06D, 0.6D); GL11.glTranslated(-this.staffTopM_2.offsetX, -this.staffTopM_2.offsetY, -this.staffTopM_2.offsetZ); - GL11.glTranslated(-this.staffTopM_2.rotationPointX * f5, -this.staffTopM_2.rotationPointY * f5, -this.staffTopM_2.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopM_2.rotationPointX * f5, + -this.staffTopM_2.rotationPointY * f5, + -this.staffTopM_2.rotationPointZ * f5); this.staffTopM_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape3_3.offsetX, this.shape3_3.offsetY, this.shape3_3.offsetZ); - GL11.glTranslated(this.shape3_3.rotationPointX * f5, this.shape3_3.rotationPointY * f5, this.shape3_3.rotationPointZ * f5); + GL11.glTranslated( + this.shape3_3.rotationPointX * f5, + this.shape3_3.rotationPointY * f5, + this.shape3_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape3_3.offsetX, -this.shape3_3.offsetY, -this.shape3_3.offsetZ); - GL11.glTranslated(-this.shape3_3.rotationPointX * f5, -this.shape3_3.rotationPointY * f5, -this.shape3_3.rotationPointZ * f5); + GL11.glTranslated( + -this.shape3_3.rotationPointX * f5, + -this.shape3_3.rotationPointY * f5, + -this.shape3_3.rotationPointZ * f5); this.shape3_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape3_1.offsetX, this.shape3_1.offsetY, this.shape3_1.offsetZ); - GL11.glTranslated(this.shape3_1.rotationPointX * f5, this.shape3_1.rotationPointY * f5, this.shape3_1.rotationPointZ * f5); + GL11.glTranslated( + this.shape3_1.rotationPointX * f5, + this.shape3_1.rotationPointY * f5, + this.shape3_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape3_1.offsetX, -this.shape3_1.offsetY, -this.shape3_1.offsetZ); - GL11.glTranslated(-this.shape3_1.rotationPointX * f5, -this.shape3_1.rotationPointY * f5, -this.shape3_1.rotationPointZ * f5); + GL11.glTranslated( + -this.shape3_1.rotationPointX * f5, + -this.shape3_1.rotationPointY * f5, + -this.shape3_1.rotationPointZ * f5); this.shape3_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape6_1.offsetX, this.shape6_1.offsetY, this.shape6_1.offsetZ); - GL11.glTranslated(this.shape6_1.rotationPointX * f5, this.shape6_1.rotationPointY * f5, this.shape6_1.rotationPointZ * f5); + GL11.glTranslated( + this.shape6_1.rotationPointX * f5, + this.shape6_1.rotationPointY * f5, + this.shape6_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape6_1.offsetX, -this.shape6_1.offsetY, -this.shape6_1.offsetZ); - GL11.glTranslated(-this.shape6_1.rotationPointX * f5, -this.shape6_1.rotationPointY * f5, -this.shape6_1.rotationPointZ * f5); + GL11.glTranslated( + -this.shape6_1.rotationPointX * f5, + -this.shape6_1.rotationPointY * f5, + -this.shape6_1.rotationPointZ * f5); this.shape6_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape7_1.offsetX, this.shape7_1.offsetY, this.shape7_1.offsetZ); - GL11.glTranslated(this.shape7_1.rotationPointX * f5, this.shape7_1.rotationPointY * f5, this.shape7_1.rotationPointZ * f5); + GL11.glTranslated( + this.shape7_1.rotationPointX * f5, + this.shape7_1.rotationPointY * f5, + this.shape7_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape7_1.offsetX, -this.shape7_1.offsetY, -this.shape7_1.offsetZ); - GL11.glTranslated(-this.shape7_1.rotationPointX * f5, -this.shape7_1.rotationPointY * f5, -this.shape7_1.rotationPointZ * f5); + GL11.glTranslated( + -this.shape7_1.rotationPointX * f5, + -this.shape7_1.rotationPointY * f5, + -this.shape7_1.rotationPointZ * f5); this.shape7_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge1_3.offsetX, this.topedge1_3.offsetY, this.topedge1_3.offsetZ); - GL11.glTranslated(this.topedge1_3.rotationPointX * f5, this.topedge1_3.rotationPointY * f5, this.topedge1_3.rotationPointZ * f5); + GL11.glTranslated( + this.topedge1_3.rotationPointX * f5, + this.topedge1_3.rotationPointY * f5, + this.topedge1_3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge1_3.offsetX, -this.topedge1_3.offsetY, -this.topedge1_3.offsetZ); - GL11.glTranslated(-this.topedge1_3.rotationPointX * f5, -this.topedge1_3.rotationPointY * f5, -this.topedge1_3.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge1_3.rotationPointX * f5, + -this.topedge1_3.rotationPointY * f5, + -this.topedge1_3.rotationPointZ * f5); this.topedge1_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.tope3.offsetX, this.tope3.offsetY, this.tope3.offsetZ); - GL11.glTranslated(this.tope3.rotationPointX * f5, this.tope3.rotationPointY * f5, this.tope3.rotationPointZ * f5); + GL11.glTranslated( + this.tope3.rotationPointX * f5, this.tope3.rotationPointY * f5, this.tope3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.6D, 0.6D); GL11.glTranslated(-this.tope3.offsetX, -this.tope3.offsetY, -this.tope3.offsetZ); - GL11.glTranslated(-this.tope3.rotationPointX * f5, -this.tope3.rotationPointY * f5, -this.tope3.rotationPointZ * f5); + GL11.glTranslated( + -this.tope3.rotationPointX * f5, -this.tope3.rotationPointY * f5, -this.tope3.rotationPointZ * f5); this.tope3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape5.offsetX, this.shape5.offsetY, this.shape5.offsetZ); - GL11.glTranslated(this.shape5.rotationPointX * f5, this.shape5.rotationPointY * f5, this.shape5.rotationPointZ * f5); + GL11.glTranslated( + this.shape5.rotationPointX * f5, this.shape5.rotationPointY * f5, this.shape5.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape5.offsetX, -this.shape5.offsetY, -this.shape5.offsetZ); - GL11.glTranslated(-this.shape5.rotationPointX * f5, -this.shape5.rotationPointY * f5, -this.shape5.rotationPointZ * f5); + GL11.glTranslated( + -this.shape5.rotationPointX * f5, -this.shape5.rotationPointY * f5, -this.shape5.rotationPointZ * f5); this.shape5.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge3_1.offsetX, this.topedge3_1.offsetY, this.topedge3_1.offsetZ); - GL11.glTranslated(this.topedge3_1.rotationPointX * f5, this.topedge3_1.rotationPointY * f5, this.topedge3_1.rotationPointZ * f5); + GL11.glTranslated( + this.topedge3_1.rotationPointX * f5, + this.topedge3_1.rotationPointY * f5, + this.topedge3_1.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge3_1.offsetX, -this.topedge3_1.offsetY, -this.topedge3_1.offsetZ); - GL11.glTranslated(-this.topedge3_1.rotationPointX * f5, -this.topedge3_1.rotationPointY * f5, -this.topedge3_1.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge3_1.rotationPointX * f5, + -this.topedge3_1.rotationPointY * f5, + -this.topedge3_1.rotationPointZ * f5); this.topedge3_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge5_3.offsetX, this.topedge5_3.offsetY, this.topedge5_3.offsetZ); - GL11.glTranslated(this.topedge5_3.rotationPointX * f5, this.topedge5_3.rotationPointY * f5, this.topedge5_3.rotationPointZ * f5); + GL11.glTranslated( + this.topedge5_3.rotationPointX * f5, + this.topedge5_3.rotationPointY * f5, + this.topedge5_3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge5_3.offsetX, -this.topedge5_3.offsetY, -this.topedge5_3.offsetZ); - GL11.glTranslated(-this.topedge5_3.rotationPointX * f5, -this.topedge5_3.rotationPointY * f5, -this.topedge5_3.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge5_3.rotationPointX * f5, + -this.topedge5_3.rotationPointY * f5, + -this.topedge5_3.rotationPointZ * f5); this.topedge5_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge5_3.offsetX, this.edge5_3.offsetY, this.edge5_3.offsetZ); - GL11.glTranslated(this.edge5_3.rotationPointX * f5, this.edge5_3.rotationPointY * f5, this.edge5_3.rotationPointZ * f5); + GL11.glTranslated( + this.edge5_3.rotationPointX * f5, this.edge5_3.rotationPointY * f5, this.edge5_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_3.offsetX, -this.edge5_3.offsetY, -this.edge5_3.offsetZ); - GL11.glTranslated(-this.edge5_3.rotationPointX * f5, -this.edge5_3.rotationPointY * f5, -this.edge5_3.rotationPointZ * f5); + GL11.glTranslated( + -this.edge5_3.rotationPointX * f5, + -this.edge5_3.rotationPointY * f5, + -this.edge5_3.rotationPointZ * f5); this.edge5_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge3_1.offsetX, this.edge3_1.offsetY, this.edge3_1.offsetZ); - GL11.glTranslated(this.edge3_1.rotationPointX * f5, this.edge3_1.rotationPointY * f5, this.edge3_1.rotationPointZ * f5); + GL11.glTranslated( + this.edge3_1.rotationPointX * f5, this.edge3_1.rotationPointY * f5, this.edge3_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3_1.offsetX, -this.edge3_1.offsetY, -this.edge3_1.offsetZ); - GL11.glTranslated(-this.edge3_1.rotationPointX * f5, -this.edge3_1.rotationPointY * f5, -this.edge3_1.rotationPointZ * f5); + GL11.glTranslated( + -this.edge3_1.rotationPointX * f5, + -this.edge3_1.rotationPointY * f5, + -this.edge3_1.rotationPointZ * f5); this.edge3_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape7.offsetX, this.shape7.offsetY, this.shape7.offsetZ); - GL11.glTranslated(this.shape7.rotationPointX * f5, this.shape7.rotationPointY * f5, this.shape7.rotationPointZ * f5); + GL11.glTranslated( + this.shape7.rotationPointX * f5, this.shape7.rotationPointY * f5, this.shape7.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape7.offsetX, -this.shape7.offsetY, -this.shape7.offsetZ); - GL11.glTranslated(-this.shape7.rotationPointX * f5, -this.shape7.rotationPointY * f5, -this.shape7.rotationPointZ * f5); + GL11.glTranslated( + -this.shape7.rotationPointX * f5, -this.shape7.rotationPointY * f5, -this.shape7.rotationPointZ * f5); this.shape7.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge1_1.offsetX, this.topedge1_1.offsetY, this.topedge1_1.offsetZ); - GL11.glTranslated(this.topedge1_1.rotationPointX * f5, this.topedge1_1.rotationPointY * f5, this.topedge1_1.rotationPointZ * f5); + GL11.glTranslated( + this.topedge1_1.rotationPointX * f5, + this.topedge1_1.rotationPointY * f5, + this.topedge1_1.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge1_1.offsetX, -this.topedge1_1.offsetY, -this.topedge1_1.offsetZ); - GL11.glTranslated(-this.topedge1_1.rotationPointX * f5, -this.topedge1_1.rotationPointY * f5, -this.topedge1_1.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge1_1.rotationPointX * f5, + -this.topedge1_1.rotationPointY * f5, + -this.topedge1_1.rotationPointZ * f5); this.topedge1_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape2_1.offsetX, this.shape2_1.offsetY, this.shape2_1.offsetZ); - GL11.glTranslated(this.shape2_1.rotationPointX * f5, this.shape2_1.rotationPointY * f5, this.shape2_1.rotationPointZ * f5); + GL11.glTranslated( + this.shape2_1.rotationPointX * f5, + this.shape2_1.rotationPointY * f5, + this.shape2_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape2_1.offsetX, -this.shape2_1.offsetY, -this.shape2_1.offsetZ); - GL11.glTranslated(-this.shape2_1.rotationPointX * f5, -this.shape2_1.rotationPointY * f5, -this.shape2_1.rotationPointZ * f5); + GL11.glTranslated( + -this.shape2_1.rotationPointX * f5, + -this.shape2_1.rotationPointY * f5, + -this.shape2_1.rotationPointZ * f5); this.shape2_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge2_3.offsetX, this.edge2_3.offsetY, this.edge2_3.offsetZ); - GL11.glTranslated(this.edge2_3.rotationPointX * f5, this.edge2_3.rotationPointY * f5, this.edge2_3.rotationPointZ * f5); + GL11.glTranslated( + this.edge2_3.rotationPointX * f5, this.edge2_3.rotationPointY * f5, this.edge2_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2_3.offsetX, -this.edge2_3.offsetY, -this.edge2_3.offsetZ); - GL11.glTranslated(-this.edge2_3.rotationPointX * f5, -this.edge2_3.rotationPointY * f5, -this.edge2_3.rotationPointZ * f5); + GL11.glTranslated( + -this.edge2_3.rotationPointX * f5, + -this.edge2_3.rotationPointY * f5, + -this.edge2_3.rotationPointZ * f5); this.edge2_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge3_2.offsetX, this.topedge3_2.offsetY, this.topedge3_2.offsetZ); - GL11.glTranslated(this.topedge3_2.rotationPointX * f5, this.topedge3_2.rotationPointY * f5, this.topedge3_2.rotationPointZ * f5); + GL11.glTranslated( + this.topedge3_2.rotationPointX * f5, + this.topedge3_2.rotationPointY * f5, + this.topedge3_2.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge3_2.offsetX, -this.topedge3_2.offsetY, -this.topedge3_2.offsetZ); - GL11.glTranslated(-this.topedge3_2.rotationPointX * f5, -this.topedge3_2.rotationPointY * f5, -this.topedge3_2.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge3_2.rotationPointX * f5, + -this.topedge3_2.rotationPointY * f5, + -this.topedge3_2.rotationPointZ * f5); this.topedge3_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge1_2.offsetX, this.edge1_2.offsetY, this.edge1_2.offsetZ); - GL11.glTranslated(this.edge1_2.rotationPointX * f5, this.edge1_2.rotationPointY * f5, this.edge1_2.rotationPointZ * f5); + GL11.glTranslated( + this.edge1_2.rotationPointX * f5, this.edge1_2.rotationPointY * f5, this.edge1_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1_2.offsetX, -this.edge1_2.offsetY, -this.edge1_2.offsetZ); - GL11.glTranslated(-this.edge1_2.rotationPointX * f5, -this.edge1_2.rotationPointY * f5, -this.edge1_2.rotationPointZ * f5); + GL11.glTranslated( + -this.edge1_2.rotationPointX * f5, + -this.edge1_2.rotationPointY * f5, + -this.edge1_2.rotationPointZ * f5); this.edge1_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge2_2.offsetX, this.edge2_2.offsetY, this.edge2_2.offsetZ); - GL11.glTranslated(this.edge2_2.rotationPointX * f5, this.edge2_2.rotationPointY * f5, this.edge2_2.rotationPointZ * f5); + GL11.glTranslated( + this.edge2_2.rotationPointX * f5, this.edge2_2.rotationPointY * f5, this.edge2_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2_2.offsetX, -this.edge2_2.offsetY, -this.edge2_2.offsetZ); - GL11.glTranslated(-this.edge2_2.rotationPointX * f5, -this.edge2_2.rotationPointY * f5, -this.edge2_2.rotationPointZ * f5); + GL11.glTranslated( + -this.edge2_2.rotationPointX * f5, + -this.edge2_2.rotationPointY * f5, + -this.edge2_2.rotationPointZ * f5); this.edge2_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge2.offsetX, this.edge2.offsetY, this.edge2.offsetZ); - GL11.glTranslated(this.edge2.rotationPointX * f5, this.edge2.rotationPointY * f5, this.edge2.rotationPointZ * f5); + GL11.glTranslated( + this.edge2.rotationPointX * f5, this.edge2.rotationPointY * f5, this.edge2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2.offsetX, -this.edge2.offsetY, -this.edge2.offsetZ); - GL11.glTranslated(-this.edge2.rotationPointX * f5, -this.edge2.rotationPointY * f5, -this.edge2.rotationPointZ * f5); + GL11.glTranslated( + -this.edge2.rotationPointX * f5, -this.edge2.rotationPointY * f5, -this.edge2.rotationPointZ * f5); this.edge2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopM.offsetX, this.staffTopM.offsetY, this.staffTopM.offsetZ); - GL11.glTranslated(this.staffTopM.rotationPointX * f5, this.staffTopM.rotationPointY * f5, this.staffTopM.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopM.rotationPointX * f5, + this.staffTopM.rotationPointY * f5, + this.staffTopM.rotationPointZ * f5); GL11.glScaled(0.6D, 1.06D, 0.6D); GL11.glTranslated(-this.staffTopM.offsetX, -this.staffTopM.offsetY, -this.staffTopM.offsetZ); - GL11.glTranslated(-this.staffTopM.rotationPointX * f5, -this.staffTopM.rotationPointY * f5, -this.staffTopM.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopM.rotationPointX * f5, + -this.staffTopM.rotationPointY * f5, + -this.staffTopM.rotationPointZ * f5); this.staffTopM.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge5_1.offsetX, this.edge5_1.offsetY, this.edge5_1.offsetZ); - GL11.glTranslated(this.edge5_1.rotationPointX * f5, this.edge5_1.rotationPointY * f5, this.edge5_1.rotationPointZ * f5); + GL11.glTranslated( + this.edge5_1.rotationPointX * f5, this.edge5_1.rotationPointY * f5, this.edge5_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_1.offsetX, -this.edge5_1.offsetY, -this.edge5_1.offsetZ); - GL11.glTranslated(-this.edge5_1.rotationPointX * f5, -this.edge5_1.rotationPointY * f5, -this.edge5_1.rotationPointZ * f5); + GL11.glTranslated( + -this.edge5_1.rotationPointX * f5, + -this.edge5_1.rotationPointY * f5, + -this.edge5_1.rotationPointZ * f5); this.edge5_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopQ.offsetX, this.staffTopQ.offsetY, this.staffTopQ.offsetZ); - GL11.glTranslated(this.staffTopQ.rotationPointX * f5, this.staffTopQ.rotationPointY * f5, this.staffTopQ.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopQ.rotationPointX * f5, + this.staffTopQ.rotationPointY * f5, + this.staffTopQ.rotationPointZ * f5); GL11.glScaled(0.7D, 1.0D, 0.7D); GL11.glTranslated(-this.staffTopQ.offsetX, -this.staffTopQ.offsetY, -this.staffTopQ.offsetZ); - GL11.glTranslated(-this.staffTopQ.rotationPointX * f5, -this.staffTopQ.rotationPointY * f5, -this.staffTopQ.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopQ.rotationPointX * f5, + -this.staffTopQ.rotationPointY * f5, + -this.staffTopQ.rotationPointZ * f5); this.staffTopQ.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge4_1.offsetX, this.edge4_1.offsetY, this.edge4_1.offsetZ); - GL11.glTranslated(this.edge4_1.rotationPointX * f5, this.edge4_1.rotationPointY * f5, this.edge4_1.rotationPointZ * f5); + GL11.glTranslated( + this.edge4_1.rotationPointX * f5, this.edge4_1.rotationPointY * f5, this.edge4_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge4_1.offsetX, -this.edge4_1.offsetY, -this.edge4_1.offsetZ); - GL11.glTranslated(-this.edge4_1.rotationPointX * f5, -this.edge4_1.rotationPointY * f5, -this.edge4_1.rotationPointZ * f5); + GL11.glTranslated( + -this.edge4_1.rotationPointX * f5, + -this.edge4_1.rotationPointY * f5, + -this.edge4_1.rotationPointZ * f5); this.edge4_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopM_1.offsetX, this.staffTopM_1.offsetY, this.staffTopM_1.offsetZ); - GL11.glTranslated(this.staffTopM_1.rotationPointX * f5, this.staffTopM_1.rotationPointY * f5, this.staffTopM_1.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopM_1.rotationPointX * f5, + this.staffTopM_1.rotationPointY * f5, + this.staffTopM_1.rotationPointZ * f5); GL11.glScaled(0.6D, 1.0D, 0.6D); GL11.glTranslated(-this.staffTopM_1.offsetX, -this.staffTopM_1.offsetY, -this.staffTopM_1.offsetZ); - GL11.glTranslated(-this.staffTopM_1.rotationPointX * f5, -this.staffTopM_1.rotationPointY * f5, -this.staffTopM_1.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopM_1.rotationPointX * f5, + -this.staffTopM_1.rotationPointY * f5, + -this.staffTopM_1.rotationPointZ * f5); this.staffTopM_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge3_2.offsetX, this.edge3_2.offsetY, this.edge3_2.offsetZ); - GL11.glTranslated(this.edge3_2.rotationPointX * f5, this.edge3_2.rotationPointY * f5, this.edge3_2.rotationPointZ * f5); + GL11.glTranslated( + this.edge3_2.rotationPointX * f5, this.edge3_2.rotationPointY * f5, this.edge3_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3_2.offsetX, -this.edge3_2.offsetY, -this.edge3_2.offsetZ); - GL11.glTranslated(-this.edge3_2.rotationPointX * f5, -this.edge3_2.rotationPointY * f5, -this.edge3_2.rotationPointZ * f5); + GL11.glTranslated( + -this.edge3_2.rotationPointX * f5, + -this.edge3_2.rotationPointY * f5, + -this.edge3_2.rotationPointZ * f5); this.edge3_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopQ_2.offsetX, this.staffTopQ_2.offsetY, this.staffTopQ_2.offsetZ); - GL11.glTranslated(this.staffTopQ_2.rotationPointX * f5, this.staffTopQ_2.rotationPointY * f5, this.staffTopQ_2.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopQ_2.rotationPointX * f5, + this.staffTopQ_2.rotationPointY * f5, + this.staffTopQ_2.rotationPointZ * f5); GL11.glScaled(0.7D, 1.0D, 0.7D); GL11.glTranslated(-this.staffTopQ_2.offsetX, -this.staffTopQ_2.offsetY, -this.staffTopQ_2.offsetZ); - GL11.glTranslated(-this.staffTopQ_2.rotationPointX * f5, -this.staffTopQ_2.rotationPointY * f5, -this.staffTopQ_2.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopQ_2.rotationPointX * f5, + -this.staffTopQ_2.rotationPointY * f5, + -this.staffTopQ_2.rotationPointZ * f5); this.staffTopQ_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.staffTopM_4.offsetX, this.staffTopM_4.offsetY, this.staffTopM_4.offsetZ); - GL11.glTranslated(this.staffTopM_4.rotationPointX * f5, this.staffTopM_4.rotationPointY * f5, this.staffTopM_4.rotationPointZ * f5); + GL11.glTranslated( + this.staffTopM_4.rotationPointX * f5, + this.staffTopM_4.rotationPointY * f5, + this.staffTopM_4.rotationPointZ * f5); GL11.glScaled(0.6D, 1.06D, 0.6D); GL11.glTranslated(-this.staffTopM_4.offsetX, -this.staffTopM_4.offsetY, -this.staffTopM_4.offsetZ); - GL11.glTranslated(-this.staffTopM_4.rotationPointX * f5, -this.staffTopM_4.rotationPointY * f5, -this.staffTopM_4.rotationPointZ * f5); + GL11.glTranslated( + -this.staffTopM_4.rotationPointX * f5, + -this.staffTopM_4.rotationPointY * f5, + -this.staffTopM_4.rotationPointZ * f5); this.staffTopM_4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge3_3.offsetX, this.topedge3_3.offsetY, this.topedge3_3.offsetZ); - GL11.glTranslated(this.topedge3_3.rotationPointX * f5, this.topedge3_3.rotationPointY * f5, this.topedge3_3.rotationPointZ * f5); + GL11.glTranslated( + this.topedge3_3.rotationPointX * f5, + this.topedge3_3.rotationPointY * f5, + this.topedge3_3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge3_3.offsetX, -this.topedge3_3.offsetY, -this.topedge3_3.offsetZ); - GL11.glTranslated(-this.topedge3_3.rotationPointX * f5, -this.topedge3_3.rotationPointY * f5, -this.topedge3_3.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge3_3.rotationPointX * f5, + -this.topedge3_3.rotationPointY * f5, + -this.topedge3_3.rotationPointZ * f5); this.topedge3_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape3_2.offsetX, this.shape3_2.offsetY, this.shape3_2.offsetZ); - GL11.glTranslated(this.shape3_2.rotationPointX * f5, this.shape3_2.rotationPointY * f5, this.shape3_2.rotationPointZ * f5); + GL11.glTranslated( + this.shape3_2.rotationPointX * f5, + this.shape3_2.rotationPointY * f5, + this.shape3_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape3_2.offsetX, -this.shape3_2.offsetY, -this.shape3_2.offsetZ); - GL11.glTranslated(-this.shape3_2.rotationPointX * f5, -this.shape3_2.rotationPointY * f5, -this.shape3_2.rotationPointZ * f5); + GL11.glTranslated( + -this.shape3_2.rotationPointX * f5, + -this.shape3_2.rotationPointY * f5, + -this.shape3_2.rotationPointZ * f5); this.shape3_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge1_3.offsetX, this.edge1_3.offsetY, this.edge1_3.offsetZ); - GL11.glTranslated(this.edge1_3.rotationPointX * f5, this.edge1_3.rotationPointY * f5, this.edge1_3.rotationPointZ * f5); + GL11.glTranslated( + this.edge1_3.rotationPointX * f5, this.edge1_3.rotationPointY * f5, this.edge1_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1_3.offsetX, -this.edge1_3.offsetY, -this.edge1_3.offsetZ); - GL11.glTranslated(-this.edge1_3.rotationPointX * f5, -this.edge1_3.rotationPointY * f5, -this.edge1_3.rotationPointZ * f5); + GL11.glTranslated( + -this.edge1_3.rotationPointX * f5, + -this.edge1_3.rotationPointY * f5, + -this.edge1_3.rotationPointZ * f5); this.edge1_3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge2_1.offsetX, this.topedge2_1.offsetY, this.topedge2_1.offsetZ); - GL11.glTranslated(this.topedge2_1.rotationPointX * f5, this.topedge2_1.rotationPointY * f5, this.topedge2_1.rotationPointZ * f5); + GL11.glTranslated( + this.topedge2_1.rotationPointX * f5, + this.topedge2_1.rotationPointY * f5, + this.topedge2_1.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge2_1.offsetX, -this.topedge2_1.offsetY, -this.topedge2_1.offsetZ); - GL11.glTranslated(-this.topedge2_1.rotationPointX * f5, -this.topedge2_1.rotationPointY * f5, -this.topedge2_1.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge2_1.rotationPointX * f5, + -this.topedge2_1.rotationPointY * f5, + -this.topedge2_1.rotationPointZ * f5); this.topedge2_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape2.offsetX, this.shape2.offsetY, this.shape2.offsetZ); - GL11.glTranslated(this.shape2.rotationPointX * f5, this.shape2.rotationPointY * f5, this.shape2.rotationPointZ * f5); + GL11.glTranslated( + this.shape2.rotationPointX * f5, this.shape2.rotationPointY * f5, this.shape2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape2.offsetX, -this.shape2.offsetY, -this.shape2.offsetZ); - GL11.glTranslated(-this.shape2.rotationPointX * f5, -this.shape2.rotationPointY * f5, -this.shape2.rotationPointZ * f5); + GL11.glTranslated( + -this.shape2.rotationPointX * f5, -this.shape2.rotationPointY * f5, -this.shape2.rotationPointZ * f5); this.shape2.render(f5); GL11.glPopMatrix(); this.staff.render(f5); GL11.glPushMatrix(); GL11.glTranslated(this.shape6.offsetX, this.shape6.offsetY, this.shape6.offsetZ); - GL11.glTranslated(this.shape6.rotationPointX * f5, this.shape6.rotationPointY * f5, this.shape6.rotationPointZ * f5); + GL11.glTranslated( + this.shape6.rotationPointX * f5, this.shape6.rotationPointY * f5, this.shape6.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape6.offsetX, -this.shape6.offsetY, -this.shape6.offsetZ); - GL11.glTranslated(-this.shape6.rotationPointX * f5, -this.shape6.rotationPointY * f5, -this.shape6.rotationPointZ * f5); + GL11.glTranslated( + -this.shape6.rotationPointX * f5, -this.shape6.rotationPointY * f5, -this.shape6.rotationPointZ * f5); this.shape6.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge4.offsetX, this.edge4.offsetY, this.edge4.offsetZ); - GL11.glTranslated(this.edge4.rotationPointX * f5, this.edge4.rotationPointY * f5, this.edge4.rotationPointZ * f5); + GL11.glTranslated( + this.edge4.rotationPointX * f5, this.edge4.rotationPointY * f5, this.edge4.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge4.offsetX, -this.edge4.offsetY, -this.edge4.offsetZ); - GL11.glTranslated(-this.edge4.rotationPointX * f5, -this.edge4.rotationPointY * f5, -this.edge4.rotationPointZ * f5); + GL11.glTranslated( + -this.edge4.rotationPointX * f5, -this.edge4.rotationPointY * f5, -this.edge4.rotationPointZ * f5); this.edge4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.topedge1_2.offsetX, this.topedge1_2.offsetY, this.topedge1_2.offsetZ); - GL11.glTranslated(this.topedge1_2.rotationPointX * f5, this.topedge1_2.rotationPointY * f5, this.topedge1_2.rotationPointZ * f5); + GL11.glTranslated( + this.topedge1_2.rotationPointX * f5, + this.topedge1_2.rotationPointY * f5, + this.topedge1_2.rotationPointZ * f5); GL11.glScaled(0.6D, 0.5D, 0.6D); GL11.glTranslated(-this.topedge1_2.offsetX, -this.topedge1_2.offsetY, -this.topedge1_2.offsetZ); - GL11.glTranslated(-this.topedge1_2.rotationPointX * f5, -this.topedge1_2.rotationPointY * f5, -this.topedge1_2.rotationPointZ * f5); + GL11.glTranslated( + -this.topedge1_2.rotationPointX * f5, + -this.topedge1_2.rotationPointY * f5, + -this.topedge1_2.rotationPointZ * f5); this.topedge1_2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape4_1.offsetX, this.shape4_1.offsetY, this.shape4_1.offsetZ); - GL11.glTranslated(this.shape4_1.rotationPointX * f5, this.shape4_1.rotationPointY * f5, this.shape4_1.rotationPointZ * f5); + GL11.glTranslated( + this.shape4_1.rotationPointX * f5, + this.shape4_1.rotationPointY * f5, + this.shape4_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape4_1.offsetX, -this.shape4_1.offsetY, -this.shape4_1.offsetZ); - GL11.glTranslated(-this.shape4_1.rotationPointX * f5, -this.shape4_1.rotationPointY * f5, -this.shape4_1.rotationPointZ * f5); + GL11.glTranslated( + -this.shape4_1.rotationPointX * f5, + -this.shape4_1.rotationPointY * f5, + -this.shape4_1.rotationPointZ * f5); this.shape4_1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge5_4.offsetX, this.edge5_4.offsetY, this.edge5_4.offsetZ); - GL11.glTranslated(this.edge5_4.rotationPointX * f5, this.edge5_4.rotationPointY * f5, this.edge5_4.rotationPointZ * f5); + GL11.glTranslated( + this.edge5_4.rotationPointX * f5, this.edge5_4.rotationPointY * f5, this.edge5_4.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_4.offsetX, -this.edge5_4.offsetY, -this.edge5_4.offsetZ); - GL11.glTranslated(-this.edge5_4.rotationPointX * f5, -this.edge5_4.rotationPointY * f5, -this.edge5_4.rotationPointZ * f5); + GL11.glTranslated( + -this.edge5_4.rotationPointX * f5, + -this.edge5_4.rotationPointY * f5, + -this.edge5_4.rotationPointZ * f5); this.edge5_4.render(f5); GL11.glPopMatrix(); GL11.glPopMatrix(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java index 153f2f04..0e6311fe 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java @@ -32,7 +32,6 @@ public class RenderCrystal implements IItemRenderer { transceiver2.facing = 1; } - @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; @@ -55,7 +54,20 @@ public class RenderCrystal implements IItemRenderer { else GL11.glTranslatef(0.0F, -0.6F, 0.0F); } int meta = item.getItemDamage(); - TileEntityRendererDispatcher.instance.renderTileEntityAt(meta == 0 ? relay1 : meta == 1 ? relay2 : meta == 2 ? transceiver1 : meta == 3 ? transceiver2 : meta == 4 ? wirelessTransceiver1 : wirelessTransceiver2, 0.0D, 0.0D, 0.0D, 0.0F); + TileEntityRendererDispatcher.instance.renderTileEntityAt( + meta == 0 + ? relay1 + : meta == 1 + ? relay2 + : meta == 2 + ? transceiver1 + : meta == 3 + ? transceiver2 + : meta == 4 ? wirelessTransceiver1 : wirelessTransceiver2, + 0.0D, + 0.0D, + 0.0D, + 0.0F); GL11.glPopMatrix(); RenderHelper.enableStandardItemLighting(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java index 60a52022..7b8bbe7e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java @@ -35,6 +35,4 @@ public class RenderParticleGen implements IItemRenderer { GL11.glPopAttrib(); GL11.glPopMatrix(); } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java index 03192d15..3e1e0859 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java @@ -15,12 +15,11 @@ import net.minecraft.world.IBlockAccess; */ public class RenderPortal implements ISimpleBlockRenderingHandler { @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { - - } + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {} @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { Tessellator tess = Tessellator.instance; int meta = world.getBlockMetadata(x, y, z); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java index 31859777..a776659a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java @@ -23,7 +23,8 @@ public class RenderTeleporterStand implements ISimpleBlockRenderingHandler { } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return false; } @@ -36,5 +37,4 @@ public class RenderTeleporterStand implements ISimpleBlockRenderingHandler { public int getRenderId() { return References.idTeleporterStand; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java index 89846cbd..3206d92e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java @@ -96,12 +96,17 @@ public class RenderChaosCrystal extends Render { return ResourceHandler.getResource("textures/entity/chaosCrystal.png"); } - protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityChaosCrystal) p_110775_1_); } - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { + public void doRender( + Entity p_76986_1_, + double p_76986_2_, + double p_76986_4_, + double p_76986_6_, + float p_76986_8_, + float p_76986_9_) { this.doRender((EntityChaosCrystal) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java index 0cb0e532..91389e29 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java @@ -13,9 +13,7 @@ import net.minecraft.util.ResourceLocation; public class RenderChaosDrill extends Render { @Override - public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) { - - } + public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {} @Override protected ResourceLocation getEntityTexture(Entity p_110775_1_) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java index 544f9423..7ce0c9e5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java @@ -4,6 +4,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; import com.brandon3055.draconicevolution.common.lib.References; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.client.model.ModelDragon; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; @@ -18,18 +19,21 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import java.util.Random; - /** * Created by Brandon on 11/08/2014. */ @SideOnly(Side.CLIENT) public class RenderDragon extends RenderLiving { - private static final ResourceLocation enderDragonExplodingTextures = new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png"); - private static final ResourceLocation enderDragonCrystalBeamTextures = new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"); - private static final ResourceLocation enderDragonEyesTextures = new ResourceLocation("textures/entity/enderdragon/dragon_eyes.png"); - private static final ResourceLocation enderDragonTextures = new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_dragon.png"); - private static final ResourceLocation enderDragonTextures2 = new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_chaos_dragon.png"); + private static final ResourceLocation enderDragonExplodingTextures = + new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png"); + private static final ResourceLocation enderDragonCrystalBeamTextures = + new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"); + private static final ResourceLocation enderDragonEyesTextures = + new ResourceLocation("textures/entity/enderdragon/dragon_eyes.png"); + private static final ResourceLocation enderDragonTextures = + new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_dragon.png"); + private static final ResourceLocation enderDragonTextures2 = + new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_chaos_dragon.png"); /** * An instance of the dragon model in RenderDragon */ @@ -43,7 +47,8 @@ public class RenderDragon extends RenderLiving { protected void rotateCorpse(EntityDragon p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { float f3 = (float) p_77043_1_.getMovementOffsets(7, p_77043_4_)[0]; - float f4 = (float) (p_77043_1_.getMovementOffsets(5, p_77043_4_)[1] - p_77043_1_.getMovementOffsets(10, p_77043_4_)[1]); + float f4 = (float) + (p_77043_1_.getMovementOffsets(5, p_77043_4_)[1] - p_77043_1_.getMovementOffsets(10, p_77043_4_)[1]); GL11.glRotatef(-f3, 0.0F, 1.0F, 0.0F); GL11.glRotatef(f4 * 10.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, 1.0F); @@ -63,7 +68,14 @@ public class RenderDragon extends RenderLiving { /** * Renders the model in RenderLiving */ - protected void renderModel(EntityDragon p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) { + protected void renderModel( + EntityDragon p_77036_1_, + float p_77036_2_, + float p_77036_3_, + float p_77036_4_, + float p_77036_5_, + float p_77036_6_, + float p_77036_7_) { if (p_77036_1_.deathTicks > 0) { float f6 = (float) p_77036_1_.deathTicks / 200.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); @@ -97,7 +109,13 @@ public class RenderDragon extends RenderLiving { * (Render 0) { - float f2 = ((EntityChaosGuardian) dragon).healingChaosCrystal != null ? (float) ((EntityChaosGuardian) dragon).healingChaosCrystal.innerRotation + p_76986_9_ : 0; + float f2 = ((EntityChaosGuardian) dragon).healingChaosCrystal != null + ? (float) ((EntityChaosGuardian) dragon).healingChaosCrystal.innerRotation + p_76986_9_ + : 0; float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F; f3 = (f3 * f3 + f3) * 0.2F; - float f4 = (float) (((EntityChaosGuardian) dragon).crystalX + 0.5 - dragon.posX - (dragon.prevPosX - dragon.posX) * (double) (1.0F - p_76986_9_)); - float f5 = (float) ((double) f3 + ((EntityChaosGuardian) dragon).crystalY + 0.5 - 1.0D - dragon.posY - (dragon.prevPosY - dragon.posY) * (double) (1.0F - p_76986_9_)); - float f6 = (float) (((EntityChaosGuardian) dragon).crystalZ + 0.5 - dragon.posZ - (dragon.prevPosZ - dragon.posZ) * (double) (1.0F - p_76986_9_)); + float f4 = (float) (((EntityChaosGuardian) dragon).crystalX + + 0.5 + - dragon.posX + - (dragon.prevPosX - dragon.posX) * (double) (1.0F - p_76986_9_)); + float f5 = (float) ((double) f3 + + ((EntityChaosGuardian) dragon).crystalY + + 0.5 + - 1.0D + - dragon.posY + - (dragon.prevPosY - dragon.posY) * (double) (1.0F - p_76986_9_)); + float f6 = (float) (((EntityChaosGuardian) dragon).crystalZ + + 0.5 + - dragon.posZ + - (dragon.prevPosZ - dragon.posZ) * (double) (1.0F - p_76986_9_)); float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6); float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6); GL11.glPushMatrix(); GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_ + 2.0F, (float) p_76986_6_); - GL11.glRotatef((float) (-Math.atan2((double) f6, (double) f4)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef((float) (-Math.atan2((double) f7, (double) f5)) * 180.0F / (float) Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef( + (float) (-Math.atan2((double) f6, (double) f4)) * 180.0F / (float) Math.PI - 90.0F, + 0.0F, + 1.0F, + 0.0F); + GL11.glRotatef( + (float) (-Math.atan2((double) f7, (double) f5)) * 180.0F / (float) Math.PI - 90.0F, + 1.0F, + 0.0F, + 0.0F); Tessellator tessellator = Tessellator.instance; RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_CULL_FACE); this.bindTexture(enderDragonCrystalBeamTextures); GL11.glShadeModel(GL11.GL_SMOOTH); float f9 = 0.0F - ((float) dragon.ticksExisted + p_76986_9_) * 0.01F; - float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F - ((float) dragon.ticksExisted + p_76986_9_) * 0.01F; + float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F + - ((float) dragon.ticksExisted + p_76986_9_) * 0.01F; tessellator.startDrawing(5); byte b0 = 8; @@ -168,7 +226,8 @@ public class RenderDragon extends RenderLiving { float f12 = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.0F / (float) b0) * 0.75F; float f13 = (float) (i % b0) * 1.0F / (float) b0; tessellator.setColorOpaque_I(0); - tessellator.addVertexWithUV((double) (f11 * 0.2F), (double) (f12 * 0.2F), 0.0D, (double) f13, (double) f10); + tessellator.addVertexWithUV( + (double) (f11 * 0.2F), (double) (f12 * 0.2F), 0.0D, (double) f13, (double) f10); tessellator.setColorOpaque_I(0xFF0000); tessellator.addVertexWithUV((double) f11, (double) f12, (double) f8, (double) f13, (double) f9); } @@ -179,48 +238,55 @@ public class RenderDragon extends RenderLiving { RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); } -// } else if (dragon instanceof EntityChaosGuardian && ((EntityChaosGuardian) dragon).healingChaosCrystal != null){ -// -// -// float f2 = (float)((EntityChaosGuardian) dragon).healingChaosCrystal.innerRotation + p_76986_9_; -// float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F; -// f3 = (f3 * f3 + f3) * 0.2F; -// float f4 = (float)(((EntityChaosGuardian) dragon).healingChaosCrystal.posX - dragon.posX - (dragon.prevPosX - dragon.posX) * (double)(1.0F - p_76986_9_)); -// float f5 = (float)((double)f3 + ((EntityChaosGuardian) dragon).healingChaosCrystal.posY - 1.0D - dragon.posY - (dragon.prevPosY - dragon.posY) * (double)(1.0F - p_76986_9_)); -// float f6 = (float)(((EntityChaosGuardian) dragon).healingChaosCrystal.posZ - dragon.posZ - (dragon.prevPosZ - dragon.posZ) * (double)(1.0F - p_76986_9_)); -// float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6); -// float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6); -// GL11.glPushMatrix(); -// GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_ + 2.0F, (float)p_76986_6_); -// GL11.glRotatef((float)(-Math.atan2((double)f6, (double)f4)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); -// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)f5)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); -// Tessellator tessellator = Tessellator.instance; -// RenderHelper.disableStandardItemLighting(); -// GL11.glDisable(GL11.GL_CULL_FACE); -// this.bindTexture(enderDragonCrystalBeamTextures); -// GL11.glShadeModel(GL11.GL_SMOOTH); -// float f9 = 0.0F - ((float)dragon.ticksExisted + p_76986_9_) * 0.01F; -// float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F - ((float)dragon.ticksExisted + p_76986_9_) * 0.01F; -// tessellator.startDrawing(5); -// byte b0 = 8; -// -// for (int i = 0; i <= b0; ++i) -// { -// float f11 = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F; -// float f12 = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F; -// float f13 = (float)(i % b0) * 1.0F / (float)b0; -// tessellator.setColorOpaque_I(0); -// tessellator.addVertexWithUV((double)(f11 * 0.2F), (double)(f12 * 0.2F), 0.0D, (double)f13, (double)f10); -// tessellator.setColorOpaque_I(0xFF0000); -// tessellator.addVertexWithUV((double)f11, (double)f12, (double)f8, (double)f13, (double)f9); -// } -// -// tessellator.draw(); -// GL11.glEnable(GL11.GL_CULL_FACE); -// GL11.glShadeModel(GL11.GL_FLAT); -// RenderHelper.enableStandardItemLighting(); -// GL11.glPopMatrix(); -// } + // } else if (dragon instanceof EntityChaosGuardian && ((EntityChaosGuardian) dragon).healingChaosCrystal != + // null){ + // + // + // float f2 = (float)((EntityChaosGuardian) dragon).healingChaosCrystal.innerRotation + p_76986_9_; + // float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F; + // f3 = (f3 * f3 + f3) * 0.2F; + // float f4 = (float)(((EntityChaosGuardian) dragon).healingChaosCrystal.posX - dragon.posX - (dragon.prevPosX + // - dragon.posX) * (double)(1.0F - p_76986_9_)); + // float f5 = (float)((double)f3 + ((EntityChaosGuardian) dragon).healingChaosCrystal.posY - 1.0D - + // dragon.posY - (dragon.prevPosY - dragon.posY) * (double)(1.0F - p_76986_9_)); + // float f6 = (float)(((EntityChaosGuardian) dragon).healingChaosCrystal.posZ - dragon.posZ - (dragon.prevPosZ + // - dragon.posZ) * (double)(1.0F - p_76986_9_)); + // float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6); + // float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6); + // GL11.glPushMatrix(); + // GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_ + 2.0F, (float)p_76986_6_); + // GL11.glRotatef((float)(-Math.atan2((double)f6, (double)f4)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, + // 0.0F); + // GL11.glRotatef((float)(-Math.atan2((double)f7, (double)f5)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, + // 0.0F); + // Tessellator tessellator = Tessellator.instance; + // RenderHelper.disableStandardItemLighting(); + // GL11.glDisable(GL11.GL_CULL_FACE); + // this.bindTexture(enderDragonCrystalBeamTextures); + // GL11.glShadeModel(GL11.GL_SMOOTH); + // float f9 = 0.0F - ((float)dragon.ticksExisted + p_76986_9_) * 0.01F; + // float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F - ((float)dragon.ticksExisted + + // p_76986_9_) * 0.01F; + // tessellator.startDrawing(5); + // byte b0 = 8; + // + // for (int i = 0; i <= b0; ++i) + // { + // float f11 = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F; + // float f12 = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F; + // float f13 = (float)(i % b0) * 1.0F / (float)b0; + // tessellator.setColorOpaque_I(0); + // tessellator.addVertexWithUV((double)(f11 * 0.2F), (double)(f12 * 0.2F), 0.0D, (double)f13, (double)f10); + // tessellator.setColorOpaque_I(0xFF0000); + // tessellator.addVertexWithUV((double)f11, (double)f12, (double)f8, (double)f13, (double)f9); + // } + // + // tessellator.draw(); + // GL11.glEnable(GL11.GL_CULL_FACE); + // GL11.glShadeModel(GL11.GL_FLAT); + // RenderHelper.enableStandardItemLighting(); + // GL11.glPopMatrix(); + // } } /** @@ -321,7 +387,13 @@ public class RenderDragon extends RenderLiving { * (Render 0 ? selection : -1, properties); GL11.glPopMatrix(); } - private void doRender(IModelCustom modelCustom, ItemRenderType type, int drawState, BowHandler.BowProperties properties) { + private void doRender( + IModelCustom modelCustom, ItemRenderType type, int drawState, BowHandler.BowProperties properties) { if (type == ItemRenderType.EQUIPPED) { GL11.glScaled(0.8, 0.8, 0.8); @@ -104,11 +105,11 @@ public class RenderBowModel implements IItemRenderer { GL11.glRotatef(-90, 1, 0, 0); } - modelCustom.renderAll(); if (drawState != -1) { - GL11.glTranslated(0.3, 0.151, -0.2 + (drawState == 1 ? 0 : drawState == 2 ? 0.55 : drawState == 3 ? 1 : -0.7)); + GL11.glTranslated( + 0.3, 0.151, -0.2 + (drawState == 1 ? 0 : drawState == 2 ? 0.55 : drawState == 3 ? 1 : -0.7)); GL11.glRotatef(90, 0, 0, 1); if (properties != null && properties.energyBolt) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosFragment.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosFragment.java index 99c42709..008d8d32 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosFragment.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosFragment.java @@ -12,7 +12,8 @@ import org.lwjgl.opengl.GL11; * Created by brandon3055 on 1/10/2015. */ public class RenderChaosFragment implements IItemRenderer { - private static IModelCustom model = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystalShard.obj")); + private static IModelCustom model = + AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystalShard.obj")); private static ModelStaffOfTheGreatOne staff = new ModelStaffOfTheGreatOne(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosShard.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosShard.java index 0a69bdbb..03fd7248 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosShard.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderChaosShard.java @@ -11,7 +11,8 @@ import org.lwjgl.opengl.GL11; * Created by brandon3055 on 1/10/2015. */ public class RenderChaosShard implements IItemRenderer { - private static IModelCustom model = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystalShard.obj")); + private static IModelCustom model = + AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystalShard.obj")); @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java index a31d5eab..935e821d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java @@ -14,7 +14,27 @@ import org.lwjgl.opengl.GL11; public class RenderMobSoul implements IItemRenderer { private Minecraft mc; private Entity randomEntity = null; - private String[] randomEntitys = new String[]{"Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow", "Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze", "Bat", "Villager", "Silverfish"}; + private String[] randomEntitys = new String[] { + "Pig", + "Sheep", + "Enderman", + "Zombie", + "Creeper", + "Cow", + "Chicken", + "Ozelot", + "Witch", + "Wolf", + "MushroomCow", + "Squid", + "EntityHorse", + "Spider", + "Skeleton", + "Blaze", + "Bat", + "Villager", + "Silverfish" + }; public RenderMobSoul() { this.mc = Minecraft.getMinecraft(); @@ -22,11 +42,13 @@ public class RenderMobSoul implements IItemRenderer { @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY; + return type == ItemRenderType.EQUIPPED + || type == ItemRenderType.EQUIPPED_FIRST_PERSON + || type == ItemRenderType.INVENTORY + || type == ItemRenderType.ENTITY; } @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } @@ -34,7 +56,8 @@ public class RenderMobSoul implements IItemRenderer { @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { Entity mob = EntityList.createEntityByName(ItemNBTHelper.getString(item, "Name", "Pig"), mc.theWorld); - randomEntity = EntityList.createEntityByName(randomEntitys[(int) ((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld); + randomEntity = EntityList.createEntityByName( + randomEntitys[(int) ((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld); if (ItemNBTHelper.getString(item, "Name", "Pig").equals("Any")) mob = randomEntity; if (mob instanceof EntitySkeleton) ((EntitySkeleton) mob).setSkeletonType(ItemNBTHelper.getInteger(item, "SkeletonType", 0)); @@ -88,6 +111,5 @@ public class RenderMobSoul implements IItemRenderer { GL11.glPopAttrib(); GL11.glPopMatrix(); - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderStabilizerPart.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderStabilizerPart.java index b971abd9..be55d694 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderStabilizerPart.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderStabilizerPart.java @@ -33,14 +33,14 @@ public class RenderStabilizerPart implements IItemRenderer { GL11.glTranslated(0.5, 0.5, 0.5); switch (item.getItemDamage()) { - case 0://frame + case 0: // frame ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png"); modelBase.basePlate.render(0.0625F); break; - case 1://rotor inner + case 1: // rotor inner ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png"); -// GL11.glScaled(2, 2, 2); -// GL11.glTranslated(-0.2, 0, 0); + // GL11.glScaled(2, 2, 2); + // GL11.glTranslated(-0.2, 0, 0); modelBaseRotors.rotor1R.childModels.clear(); modelBaseRotors.rotor1R.render(0.0625F); modelBaseRotors.rotor1R_1.render(0.0625F); @@ -48,10 +48,10 @@ public class RenderStabilizerPart implements IItemRenderer { modelBaseRotors.rotor1R_3.render(0.0625F); modelBaseRotors.rotor1R_4.render(0.0625F); break; - case 2://rotor outer + case 2: // rotor outer ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png"); -// GL11.glScaled(2, 2, 2); -// GL11.glTranslated(-0.3, 0, 0); + // GL11.glScaled(2, 2, 2); + // GL11.glTranslated(-0.3, 0, 0); modelBaseRotors.rotor2R.childModels.clear(); modelBaseRotors.rotor2R.render(0.0625F); modelBaseRotors.rotor2R_1.render(0.0625F); @@ -59,10 +59,10 @@ public class RenderStabilizerPart implements IItemRenderer { modelBaseRotors.rotor2R_3.render(0.0625F); modelBaseRotors.rotor2R_4.render(0.0625F); break; - case 3://rotor assembly + case 3: // rotor assembly ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png"); -// GL11.glScaled(1.5, 1.5, 1.5); -// GL11.glTranslated(-0.05, 0, 0); + // GL11.glScaled(1.5, 1.5, 1.5); + // GL11.glTranslated(-0.05, 0, 0); GL11.glRotatef(30F, 0F, 0F, 1F); modelBase.rotor1R.render(0.0625F); modelBase.hub1.render(0.0625F); @@ -70,7 +70,7 @@ public class RenderStabilizerPart implements IItemRenderer { modelBase.hub2.render(0.0625F); modelBase.rotor2R.render(0.0625F); break; - case 4://stabilizer ring + case 4: // stabilizer ring ResourceHandler.bindResource("textures/models/reactorStabilizerRing.png"); GL11.glRotatef(90F, 0F, 0F, 1F); modelRing.render(null, -30, 1, 0, 0, 0, 1F / 16F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderTool.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderTool.java index 95553a9e..43201730 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderTool.java @@ -16,7 +16,7 @@ public class RenderTool implements IItemRenderer { private String toolTexture; private IRenderTweak tool; - //Draconic Sword + // Draconic Sword public RenderTool(String model, String texture, IRenderTweak tool) { this.tool = tool; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleCustom.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleCustom.java index 6a1ebe9c..35787837 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleCustom.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleCustom.java @@ -16,12 +16,21 @@ public class ParticleCustom extends EntityFX { public int fadeLength = 0; public float gravity = 0F; - - public ParticleCustom(World world, double spawnX, double spawnY, double spawnZ, float spawnMotionX, float spawnMotionY, float spawnMotionZ, float scale, boolean canCollide, int index) { + public ParticleCustom( + World world, + double spawnX, + double spawnY, + double spawnZ, + float spawnMotionX, + float spawnMotionY, + float spawnMotionZ, + float scale, + boolean canCollide, + int index) { super(world, spawnX, spawnY, spawnZ, 0.0D, 0.0D, 0.0D); - this.motionX = spawnMotionX;//initial motion value X - this.motionY = spawnMotionY;//initial motion value Y - this.motionZ = spawnMotionZ;//initial motion value Z + this.motionX = spawnMotionX; // initial motion value X + this.motionY = spawnMotionY; // initial motion value Y + this.motionZ = spawnMotionZ; // initial motion value Z this.particleTextureIndexX = index - 1; // this.particleTextureIndexY = 0; @@ -30,7 +39,6 @@ public class ParticleCustom extends EntityFX { this.noClip = !canCollide; } - @Override public void onUpdate() { this.prevPosX = this.posX; @@ -43,23 +51,28 @@ public class ParticleCustom extends EntityFX { fadeTime--; } - this.moveEntity(this.motionX, this.motionY, this.motionZ);// also important if you want your particle to move - //this.motionX = motionX * (1 - (worldObj.rand.nextFloat() / 10F)); + this.moveEntity(this.motionX, this.motionY, this.motionZ); // also important if you want your particle to move + // this.motionX = motionX * (1 - (worldObj.rand.nextFloat() / 10F)); this.motionY = motionY - (gravity / 100F); - //this.motionZ = motionZ * (1 - (worldObj.rand.nextFloat() / 10F)); - + // this.motionZ = motionZ * (1 - (worldObj.rand.nextFloat() / 10F)); } @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); tesselator.startDrawingQuads(); - tesselator.setBrightness(200);//make sure you have this!! - + tesselator.setBrightness(200); // make sure you have this!! float minU = (float) this.particleTextureIndexX / 8.0F; float maxU = minU + 0.124F; @@ -80,14 +93,33 @@ public class ParticleCustom extends EntityFX { tesselator.setColorRGBA(red, green, blue, (int) (this.particleAlpha * 255F)); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleDistortion.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleDistortion.java index eda89584..f9fe61dc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleDistortion.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleDistortion.java @@ -11,36 +11,46 @@ public class ParticleDistortion extends EntityFX { double originalX; double originalZ; - public ParticleDistortion(World par1World, double par2, double par4, double par6, float par8, float par9, float par10, float scale) { + public ParticleDistortion( + World par1World, double par2, double par4, double par6, float par8, float par9, float par10, float scale) { this(par1World, par2, par4, par6, 1.0F, par8, par9, par10, scale); } - public ParticleDistortion(World world, double par2, double par4, double par6, float par8, float par9, float par10, float par11, float scale) { + public ParticleDistortion( + World world, + double par2, + double par4, + double par6, + float par8, + float par9, + float par10, + float par11, + float scale) { super(world, par2, par4, par6, 0.0D, 0.0D, 0.0D); - this.motionX = par9;//initial motion value X - this.motionY = par10;//initial motion value Y - this.motionZ = par11;//initial motion value Z + this.motionX = par9; // initial motion value X + this.motionY = par10; // initial motion value Y + this.motionZ = par11; // initial motion value Z this.originalX = par9; this.originalZ = par11; if (par9 == 0.0F) { par9 = 1.0F; } - //float var12 = (float) Math.random() * 0.4F + 0.6F; + // float var12 = (float) Math.random() * 0.4F + 0.6F; this.particleTextureIndexX = 0; // this.particleTextureIndexY = 0; - this.particleRed = 0.7F;//RGB of your particle + this.particleRed = 0.7F; // RGB of your particle this.particleGreen = 0.8F; this.particleBlue = 1.0F; - //this.particleScale *= 0.05f + world.rand.nextFloat()*0.005; - //this.particleScale *= par8; + // this.particleScale *= 0.05f + world.rand.nextFloat()*0.005; + // this.particleScale *= par8; this.particleScale = scale; - this.particleMaxAge = 40 + world.rand.nextInt(40);//how soon the particle dies. You can use randomizer for this - this.noClip = true;//does your particle collide with blocks? + this.particleMaxAge = + 40 + world.rand.nextInt(40); // how soon the particle dies. You can use randomizer for this + this.noClip = true; // does your particle collide with blocks? } - @Override public void onUpdate() { this.prevPosX = this.posX; @@ -48,30 +58,35 @@ public class ParticleDistortion extends EntityFX { this.prevPosZ = this.posZ; if (this.particleAge++ >= this.particleMaxAge) { - this.setDead();//make sure to have this + this.setDead(); // make sure to have this } - this.moveEntity(this.motionX, this.motionY, this.motionZ);// also important if you want your particle to move + this.moveEntity(this.motionX, this.motionY, this.motionZ); // also important if you want your particle to move this.motionX = motionX * (1 - (worldObj.rand.nextFloat() / 10F)); this.motionY = motionY * (1 - (worldObj.rand.nextFloat() / 10F)); this.motionZ = motionZ * (1 - (worldObj.rand.nextFloat() / 10F)); this.particleAlpha = (1F - ((float) this.particleAge / (float) this.particleMaxAge)) * 0.5F; - } @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tessellator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tessellator.draw(); ResourceHandler.bindParticles(); tessellator.startDrawingQuads(); - tessellator.setBrightness(200);//make sure you have this!! + tessellator.setBrightness(200); // make sure you have this!! - - float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; - float maxU = 0.0F + 0.1245F;//minU + 0.124F; - float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; - float maxV = 0.1245F;//minV + 0.124F; + float minU = 0.0F + 0F; // (float)this.particleTextureIndexX / 32.0F; + float maxU = 0.0F + 0.1245F; // minU + 0.124F; + float minV = 0F; // (float)this.particleTextureIndexY / 32.0F; + float maxV = 0.1245F; // minV + 0.124F; float drawScale = 0.1F * this.particleScale; if (this.particleIcon != null) { @@ -88,14 +103,33 @@ public class ParticleDistortion extends EntityFX { tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); tessellator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); - tessellator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tessellator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tessellator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tessellator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tessellator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tessellator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tessellator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tessellator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tessellator.draw(); ResourceHandler.bindDefaultParticles(); tessellator.startDrawingQuads(); - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergy.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergy.java index d171d13f..2f73d5ba 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergy.java @@ -15,7 +15,8 @@ public class ParticleEnergy extends EntityFX { public int particle; public boolean expand = true; - public ParticleEnergy(World world, double x, double y, double z, double tX, double tY, double tZ, int particle, boolean expand) { + public ParticleEnergy( + World world, double x, double y, double z, double tX, double tY, double tZ, int particle, boolean expand) { this(world, x, y, z, tX, tY, tZ, particle); this.expand = expand; this.particleRed = 185F / 255F; @@ -43,14 +44,13 @@ public class ParticleEnergy extends EntityFX { this.particleRed = particle == 1 ? 0F : 1.0F; this.particleGreen = particle == 1 ? 1F : 0.2F; this.particleBlue = particle == 1 ? 1F : 0.0F; - //this.particleScale *= 0.05f + world.rand.nextFloat()*0.005; - //this.particleScale *= par8; + // this.particleScale *= 0.05f + world.rand.nextFloat()*0.005; + // this.particleScale *= par8; this.particleScale = 0.5F; this.particleMaxAge = 80; this.noClip = true; } - @Override public void onUpdate() { prevPosX = posX; @@ -66,7 +66,7 @@ public class ParticleEnergy extends EntityFX { if (particleAge++ >= particleMaxAge) { setDead(); } - moveEntity(motionX, motionY, motionZ);// also important if you want your particle to move + moveEntity(motionX, motionY, motionZ); // also important if you want your particle to move float speedMultiplyer = 0.000501F; float ySpeedMultiplyer = 0.1006F; if (expand) { @@ -78,7 +78,10 @@ public class ParticleEnergy extends EntityFX { motionY = (targetY - posY) * ySpeedMultiplyer; motionZ = (targetZ - posZ) * speedMultiplyer; } - if (expand && Math.abs(targetX - posX) < 0.01 && Math.abs(targetY - posY) < 0.01 && Math.abs(targetZ - posZ) < 0.01) { + if (expand + && Math.abs(targetX - posX) < 0.01 + && Math.abs(targetY - posY) < 0.01 + && Math.abs(targetZ - posZ) < 0.01) { motionX = 0; motionY = 0; motionZ = 0; @@ -88,23 +91,28 @@ public class ParticleEnergy extends EntityFX { particleScale = 2; particleAlpha = (1F - ((float) particleAge / (float) particleMaxAge)) * 1F; } - } @Override - //@SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + // @SideOnly(Side.CLIENT) + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); tesselator.startDrawingQuads(); - tesselator.setBrightness(200);//make sure you have this!! + tesselator.setBrightness(200); // make sure you have this!! - - float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; - float maxU = 0.0F + 0.1245F;//minU + 0.124F; - float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; - float maxV = 0.1245F;//minV + 0.124F; + float minU = 0.0F + 0F; // (float)this.particleTextureIndexX / 32.0F; + float maxU = 0.0F + 0.1245F; // minU + 0.124F; + float minV = 0F; // (float)this.particleTextureIndexY / 32.0F; + float maxV = 0.1245F; // minV + 0.124F; float drawScale = 0.1F * this.particleScale; if (this.particleIcon != null) { @@ -119,16 +127,35 @@ public class ParticleEnergy extends EntityFX { float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - //tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); + // tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java index e1279566..ee5978b6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java @@ -1,9 +1,9 @@ package com.brandon3055.draconicevolution.client.render.particle; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.brandonscore.common.utills.Utills; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; @@ -38,6 +38,7 @@ public class ParticleEnergyBeam extends EntityFX { * Modified Target X */ private boolean advanced; + private boolean renderParticle = true; private float length = 0.0F; private float rotYaw = 0.0F; @@ -46,16 +47,28 @@ public class ParticleEnergyBeam extends EntityFX { private float prevPitch = 0.0F; private EntityPlayer player; - //todo make sure not dyrectly up or down on y axis, Set dead when player goes out of range, PaRTICLE eNGINE - - private static ResourceLocation beamTextureBasic = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyBeamBlue.png"); - private static ResourceLocation beamTextureAdvanced = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyBeamRed.png"); + // todo make sure not dyrectly up or down on y axis, Set dead when player goes out of range, PaRTICLE eNGINE + private static ResourceLocation beamTextureBasic = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyBeamBlue.png"); + private static ResourceLocation beamTextureAdvanced = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyBeamRed.png"); /** * @param offsetMode 0 = no offset, 1 = offset target end, 2 = offset start end, 3 offset both ends */ - public ParticleEnergyBeam(World world, double x, double y, double z, double tX, double tY, double tZ, int maxAge, int flow, boolean advanced, int offsetMode) { + public ParticleEnergyBeam( + World world, + double x, + double y, + double z, + double tX, + double tY, + double tZ, + int maxAge, + int flow, + boolean advanced, + int offsetMode) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.particleRed = 1F; this.particleGreen = 1F; @@ -82,7 +95,7 @@ public class ParticleEnergyBeam extends EntityFX { double xOff = xDist / dist; double zOff = zDist / dist; if (xOff == 0 && zOff == 0) xOff = 1; - //LogHelper.info(xOff + " " + zOff); + // LogHelper.info(xOff + " " + zOff); double offM = 0.4D; if (offsetMode == 2 || offsetMode == 3) setPosition(posX - xOff * offM, posY, posZ - zOff * offM); @@ -93,20 +106,18 @@ public class ParticleEnergyBeam extends EntityFX { this.tZ = tZ + zOff * offM; } } - } public void update(int flow, boolean render) { this.renderParticle = render; - for (this.flow = flow; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) { - } + for (this.flow = flow; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) {} } @Override public void onUpdate() { - //1.570797f -// double sin = Math.sin(-1f + (float)(particleAge % 360) / 180f * 1.570797f); -// LogHelper.info(sin + " " + particleAge % 360); + // 1.570797f + // double sin = Math.sin(-1f + (float)(particleAge % 360) / 180f * 1.570797f); + // LogHelper.info(sin + " " + particleAge % 360); this.prevPosX = this.posX; this.prevPosY = this.posY; @@ -125,7 +136,6 @@ public class ParticleEnergyBeam extends EntityFX { this.prevYaw = this.rotYaw; this.prevPitch = this.rotPitch; - if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } @@ -139,14 +149,15 @@ public class ParticleEnergyBeam extends EntityFX { } @Override - public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { + public void renderParticle( + Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { if (!renderParticle) return; tessellator.draw(); GL11.glPushMatrix(); - //GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); + // GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); float var9 = 1.0F; float slide = (float) getPlayer().ticksExisted; - float size = (float) flow / 100f * 2f; //0.7F; + float size = (float) flow / 100f * 2f; // 0.7F; if (advanced) Minecraft.getMinecraft().renderEngine.bindTexture(beamTextureAdvanced); else Minecraft.getMinecraft().renderEngine.bindTexture(beamTextureBasic); GL11.glTexParameterf(3553, 10242, 10497.0F); @@ -191,8 +202,8 @@ public class ParticleEnergyBeam extends EntityFX { var44 = -0.15D * (double) 1; var17 = 0.15D * (double) 1; - //GL11.glColor4f(1f, 1f, 1f, 1f); - //GL11.glTranslated(0.1, 0, 0); + // GL11.glColor4f(1f, 1f, 1f, 1f); + // GL11.glTranslated(0.1, 0, 0); for (int t = 0; t < 2; ++t) { double var29 = (double) (this.length * var9); double var31 = 0D; @@ -212,14 +223,12 @@ public class ParticleEnergyBeam extends EntityFX { } } - - //GL11.glDepthMask(true); + // GL11.glDepthMask(true); GL11.glBlendFunc(770, 771); GL11.glEnable(GL11.GL_CULL_FACE); // GL11.glPopAttrib(); GL11.glPopMatrix(); - ResourceHandler.bindDefaultParticles(); tessellator.startDrawingQuads(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyField.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyField.java index e979e6c5..fda1a496 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyField.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyField.java @@ -15,6 +15,7 @@ public class ParticleEnergyField extends EntityFX { * Particle Type 0 = Energy Ring, 1 = single particle */ private int type; + private boolean advanced; private boolean renderParticle = true; @@ -34,8 +35,7 @@ public class ParticleEnergyField extends EntityFX { } public void update(boolean render) { - for (this.renderParticle = render; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) { - } + for (this.renderParticle = render; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) {} } @Override @@ -45,30 +45,29 @@ public class ParticleEnergyField extends EntityFX { this.prevPosY = this.posY; this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } } - @Override - public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { + public void renderParticle( + Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { if (!renderParticle) return; tessellator.draw(); GL11.glPushMatrix(); - //GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); + // GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); GL11.glDepthMask(false); ResourceHandler.bindParticles(); float minU = 0.0F + 0.125F * (advanced ? 4 : 3); - float maxU = 0.0F + 0.125F * (advanced ? 5 : 4);//minU + 0.124F; + float maxU = 0.0F + 0.125F * (advanced ? 5 : 4); // minU + 0.124F; if (type == 2) { minU = 0.0F + 0.125F * 5; maxU = 0.0F + 0.125F * 6; } - float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; - float maxV = 0.123F;//minV + 0.124F; + float minV = 0F; // (float)this.particleTextureIndexY / 32.0F; + float maxV = 0.123F; // minV + 0.124F; float drawScale = 0.2f; if (this.particleIcon != null) { @@ -82,7 +81,6 @@ public class ParticleEnergyField extends EntityFX { float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTick - interpPosY); float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTick - interpPosZ); - if (type == 0 || type == 2) { tessellator.startDrawingQuads(); tessellator.setBrightness(200); @@ -90,7 +88,7 @@ public class ParticleEnergyField extends EntityFX { double pCount = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 35 : 15; for (int i = 0; i < pCount; i++) { - double rot = i / pCount * (3.141 * 2D) + particleAge / 3D;//1D;//i / 10D; + double rot = i / pCount * (3.141 * 2D) + particleAge / 3D; // 1D;//i / 10D; double offset = 0.4; double ox = Math.sin(rot) * offset; double oz = Math.cos(rot) * offset; @@ -98,10 +96,30 @@ public class ParticleEnergyField extends EntityFX { float drawXX = drawX + (float) ox; float drawZZ = drawZ + (float) oz; - tessellator.addVertexWithUV((double) (drawXX - rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZZ - rotZ * drawScale - rotXY * drawScale), (double) maxU, (double) maxV); - tessellator.addVertexWithUV((double) (drawXX - rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZZ - rotZ * drawScale + rotXY * drawScale), (double) maxU, (double) minV); - tessellator.addVertexWithUV((double) (drawXX + rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZZ + rotZ * drawScale + rotXY * drawScale), (double) minU, (double) minV); - tessellator.addVertexWithUV((double) (drawXX + rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZZ + rotZ * drawScale - rotXY * drawScale), (double) minU, (double) maxV); + tessellator.addVertexWithUV( + (double) (drawXX - rotX * drawScale - rotYZ * drawScale), + (double) (drawY - rotXZ * drawScale), + (double) (drawZZ - rotZ * drawScale - rotXY * drawScale), + (double) maxU, + (double) maxV); + tessellator.addVertexWithUV( + (double) (drawXX - rotX * drawScale + rotYZ * drawScale), + (double) (drawY + rotXZ * drawScale), + (double) (drawZZ - rotZ * drawScale + rotXY * drawScale), + (double) maxU, + (double) minV); + tessellator.addVertexWithUV( + (double) (drawXX + rotX * drawScale + rotYZ * drawScale), + (double) (drawY + rotXZ * drawScale), + (double) (drawZZ + rotZ * drawScale + rotXY * drawScale), + (double) minU, + (double) minV); + tessellator.addVertexWithUV( + (double) (drawXX + rotX * drawScale - rotYZ * drawScale), + (double) (drawY - rotXZ * drawScale), + (double) (drawZZ + rotZ * drawScale - rotXY * drawScale), + (double) minU, + (double) maxV); } tessellator.draw(); @@ -111,20 +129,39 @@ public class ParticleEnergyField extends EntityFX { tessellator.setBrightness(200); tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1f); - tessellator.addVertexWithUV((double) (drawX - rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZ - rotZ * drawScale - rotXY * drawScale), (double) maxU, (double) maxV); - tessellator.addVertexWithUV((double) (drawX - rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZ - rotZ * drawScale + rotXY * drawScale), (double) maxU, (double) minV); - tessellator.addVertexWithUV((double) (drawX + rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZ + rotZ * drawScale + rotXY * drawScale), (double) minU, (double) minV); - tessellator.addVertexWithUV((double) (drawX + rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZ + rotZ * drawScale - rotXY * drawScale), (double) minU, (double) maxV); + tessellator.addVertexWithUV( + (double) (drawX - rotX * drawScale - rotYZ * drawScale), + (double) (drawY - rotXZ * drawScale), + (double) (drawZ - rotZ * drawScale - rotXY * drawScale), + (double) maxU, + (double) maxV); + tessellator.addVertexWithUV( + (double) (drawX - rotX * drawScale + rotYZ * drawScale), + (double) (drawY + rotXZ * drawScale), + (double) (drawZ - rotZ * drawScale + rotXY * drawScale), + (double) maxU, + (double) minV); + tessellator.addVertexWithUV( + (double) (drawX + rotX * drawScale + rotYZ * drawScale), + (double) (drawY + rotXZ * drawScale), + (double) (drawZ + rotZ * drawScale + rotXY * drawScale), + (double) minU, + (double) minV); + tessellator.addVertexWithUV( + (double) (drawX + rotX * drawScale - rotYZ * drawScale), + (double) (drawY - rotXZ * drawScale), + (double) (drawZ + rotZ * drawScale - rotXY * drawScale), + (double) minU, + (double) maxV); tessellator.draw(); } - -// GL11.glDepthMask(true); - //GL11.glPopAttrib(); + // GL11.glDepthMask(true); + // GL11.glPopAttrib(); GL11.glPopMatrix(); ResourceHandler.bindDefaultParticles(); tessellator.startDrawingQuads(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java index 7eea2dc6..b0eb4d6c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java @@ -23,6 +23,7 @@ public class ParticleReactorBeam extends EntityFX { * Particle Type 0 = Energy Ring, 1 = single particle */ private boolean renderParticle = true; + private TileEntity tile; private boolean isInjectorBeam = false; @@ -42,8 +43,7 @@ public class ParticleReactorBeam extends EntityFX { } public void update(boolean render) { - for (this.renderParticle = render; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) { - } + for (this.renderParticle = render; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) {} } @Override @@ -53,15 +53,14 @@ public class ParticleReactorBeam extends EntityFX { this.prevPosY = this.posY; this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } } - @Override - public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { + public void renderParticle( + Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { if (!((IReactorPart) tile).isActive()) return; tessellator.draw(); GL11.glPushMatrix(); @@ -73,20 +72,29 @@ public class ParticleReactorBeam extends EntityFX { float zz = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTick - interpPosZ); GL11.glTranslated((double) xx, (double) yy, (double) zz); - //Common Fields + // Common Fields MultiblockHelper.TileLocation master = ((IReactorPart) tile).getMaster(); float offsetX = (float) (master.posX - tile.xCoord); float offsetY = (float) ((double) master.posY - tile.yCoord); float offsetZ = (float) (master.posZ - tile.zCoord); float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); - - //Rotate beam to face target + // Rotate beam to face target float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); - GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef((float) (-Math.atan2((double) f7, (double) offsetY)) * 180.0F / (float) Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef( + (float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, + 0.0F, + 1.0F, + 0.0F); + GL11.glRotatef( + (float) (-Math.atan2((double) f7, (double) offsetY)) * 180.0F / (float) Math.PI - 90.0F, + 1.0F, + 0.0F, + 0.0F); - TileReactorCore reactor = ((IReactorPart) tile).getMaster().getTileEntity(worldObj) instanceof TileReactorCore ? (TileReactorCore) ((IReactorPart) tile).getMaster().getTileEntity(worldObj) : null; + TileReactorCore reactor = ((IReactorPart) tile).getMaster().getTileEntity(worldObj) instanceof TileReactorCore + ? (TileReactorCore) ((IReactorPart) tile).getMaster().getTileEntity(worldObj) + : null; if (tile instanceof TileReactorStabilizer && reactor != null) renderStabilizerEffect(tessellator, reactor, offsetX, offsetY, offsetZ, length, partialTick); @@ -94,20 +102,20 @@ public class ParticleReactorBeam extends EntityFX { GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glTranslated(0, 0, 0.3); - //GL11.glPushMatrix(); + // GL11.glPushMatrix(); GL11.glRotatef(((float) particleAge + partialTick) * 20F, 0, 0, 1); ResourceHandler.bindResource("textures/particle/reactorEnergyBeam.png"); -// float sizeOrigin = 0.5F; -// float sizeTarget = 0.2F; + // float sizeOrigin = 0.5F; + // float sizeTarget = 0.2F; float sizeOrigin = 0.5F; int color = 0xFF2200; int alpha = (int) (200D * reactor.renderSpeed); - float speed = 20F; float texV2 = 0.0F + ((float) particleAge + partialTick) * 0.01F * speed; - float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) + ((float) particleAge + partialTick) * 0.01F * speed; + float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) + + ((float) particleAge + partialTick) * 0.01F * speed; tessellator.startDrawing(5); tessellator.setBrightness(200); @@ -122,12 +130,17 @@ public class ParticleReactorBeam extends EntityFX { float texU = (float) (i % b0) * 1.0F / (float) b0; tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); - tessellator.addVertexWithUV((double) (verX * sizeOrigin), (double) (verY * sizeOrigin), -0.55D, (double) texU, (double) texV1); + tessellator.addVertexWithUV( + (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), -0.55D, (double) texU, (double) + texV1); tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); - tessellator.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2); + tessellator.addVertexWithUV( + (double) verX, (double) verY, (double) length, (double) texU, (double) texV2); } - length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) - (float) (reactor.getCoreDiameter() / 2D) - 0.3F; + length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) + - (float) (reactor.getCoreDiameter() / 2D) + - 0.3F; sizeTarget = (float) (reactor.getCoreDiameter() / 2 * 0.2D); sizeOrigin = 0.1F / sizeTarget; @@ -137,14 +150,16 @@ public class ParticleReactorBeam extends EntityFX { float texU = (float) (i % b0) * 1.0F / (float) b0; tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); - tessellator.addVertexWithUV((double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) texV1); + tessellator.addVertexWithUV( + (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) + texV1); tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); - tessellator.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2); + tessellator.addVertexWithUV( + (double) verX, (double) verY, (double) length, (double) texU, (double) texV2); } - tessellator.draw(); - //GL11.glPopMatrix(); + // GL11.glPopMatrix(); GL11.glRotatef(((float) particleAge + partialTick) * -30F, 0, 0, 1); tessellator.startDrawing(5); @@ -162,9 +177,12 @@ public class ParticleReactorBeam extends EntityFX { float texU = (float) (i % b0) * 1.0F / (float) b0; tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha / 2); - tessellator.addVertexWithUV((double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) texV1); + tessellator.addVertexWithUV( + (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) + texV1); tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); - tessellator.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2); + tessellator.addVertexWithUV( + (double) verX, (double) verY, (double) length, (double) texU, (double) texV2); } tessellator.draw(); @@ -177,33 +195,92 @@ public class ParticleReactorBeam extends EntityFX { tessellator.startDrawingQuads(); } - private void renderStabilizerEffect(Tessellator tessellator, TileReactorCore reactor, float offsetX, float offsetY, float offsetZ, float length, float partialTick) { + private void renderStabilizerEffect( + Tessellator tessellator, + TileReactorCore reactor, + float offsetX, + float offsetY, + float offsetZ, + float length, + float partialTick) { GL11.glShadeModel(GL11.GL_SMOOTH); - //Draw Beams + // Draw Beams GL11.glPushMatrix(); GL11.glTranslated(0, 0, -0.35); ResourceHandler.bindResource("textures/particle/reactorBeam.png"); - drawBeam(tessellator, reactor, 1F, 0.355F, 0.8F, offsetX, offsetY, offsetZ, particleAge, partialTick, true, false, 0x00ffff); + drawBeam( + tessellator, + reactor, + 1F, + 0.355F, + 0.8F, + offsetX, + offsetY, + offsetZ, + particleAge, + partialTick, + true, + false, + 0x00ffff); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(0, 0, 0.45); float coreSize = (float) (reactor.getCoreDiameter() / 2) * 0.9F; float s = 0.355F; - drawBeam(tessellator, reactor, s / coreSize, coreSize, length - (float) (reactor.getCoreDiameter() / 2.5D), offsetX, offsetY, offsetZ, particleAge, partialTick, false, false, 0x00ffff); + drawBeam( + tessellator, + reactor, + s / coreSize, + coreSize, + length - (float) (reactor.getCoreDiameter() / 2.5D), + offsetX, + offsetY, + offsetZ, + particleAge, + partialTick, + false, + false, + 0x00ffff); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(0, 0, -0.35); - drawBeam(tessellator, reactor, 1F, 0.263F, 0.8F, offsetX, offsetY, offsetZ, particleAge, partialTick, true, true, 0xff6600); + drawBeam( + tessellator, + reactor, + 1F, + 0.263F, + 0.8F, + offsetX, + offsetY, + offsetZ, + particleAge, + partialTick, + true, + true, + 0xff6600); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(0, 0, 0.45); coreSize = (float) (reactor.getCoreDiameter() / 2) * 0.4F; s = 0.263F; - drawBeam(tessellator, reactor, s / coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, particleAge, partialTick, false, true, 0xff6600); + drawBeam( + tessellator, + reactor, + s / coreSize, + coreSize, + length - 0.5F, + offsetX, + offsetY, + offsetZ, + particleAge, + partialTick, + false, + true, + 0xff6600); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); @@ -213,10 +290,24 @@ public class ParticleReactorBeam extends EntityFX { * Size Origin is the fraction of size start Target * So if size target is 10 and size origin is 0.5 origin will actually be 5 */ - private void drawBeam(Tessellator tessellator, TileReactorCore reactor, float sizeOrigin, float sizeTarget, float length, float offsetX, float offsetY, float offsetZ, int tick, float partialTick, boolean reverseTransparency, boolean reverseDirection, int color) { + private void drawBeam( + Tessellator tessellator, + TileReactorCore reactor, + float sizeOrigin, + float sizeTarget, + float length, + float offsetX, + float offsetY, + float offsetZ, + int tick, + float partialTick, + boolean reverseTransparency, + boolean reverseDirection, + int color) { float speed = 3F; float texV2 = -0.1F + ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed; - float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) / 32.0F + ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed; + float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) / 32.0F + + ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed; tessellator.startDrawing(5); tessellator.setBrightness(200); @@ -226,9 +317,18 @@ public class ParticleReactorBeam extends EntityFX { float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.13325F / (float) b0) * sizeTarget; float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.13325F / (float) b0) * sizeTarget; float texU = (float) (i % b0) * 1.0F / (float) b0; - tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), reverseTransparency ? 0 : (int) (255D * reactor.renderSpeed)); - tessellator.addVertexWithUV((double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) texV1); - tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), reverseTransparency ? (int) (255D * reactor.renderSpeed) : 0); + tessellator.setColorRGBA( + (color & 0xFF0000) >> 16, + (color & 0xFF00) >> 8, + (color & 0xFF), + reverseTransparency ? 0 : (int) (255D * reactor.renderSpeed)); + tessellator.addVertexWithUV( + (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) texV1); + tessellator.setColorRGBA( + (color & 0xFF0000) >> 16, + (color & 0xFF00) >> 8, + (color & 0xFF), + reverseTransparency ? (int) (255D * reactor.renderSpeed) : 0); tessellator.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2); } @@ -237,7 +337,8 @@ public class ParticleReactorBeam extends EntityFX { } // @Override -// public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { +// public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float +// rotYZ, float rotXY) { // if (!((IIsSlave)tile).isActive()) return; // tessellator.draw(); // GL11.glPushMatrix(); @@ -259,10 +360,13 @@ public class ParticleReactorBeam extends EntityFX { // // //Rotate beam to face target // float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); -// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); -// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); +// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, +// 1.0F, 0.0F); +// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, +// 0.0F); // -// if (tile instanceof TileReactorStabilizer) renderStabilizerEffect(tessellator, offsetX, offsetY, offsetZ, length, partialTick); +// if (tile instanceof TileReactorStabilizer) renderStabilizerEffect(tessellator, offsetX, offsetY, offsetZ, length, +// partialTick); // else { // GL11.glShadeModel(GL11.GL_SMOOTH); // GL11.glTranslated(0, 0, 0.3); @@ -280,7 +384,8 @@ public class ParticleReactorBeam extends EntityFX { // // float speed = 20F; // float texV2 = 0.0F + ((float)particleAge + partialTick) * 0.01F * speed; -// float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) + ((float)particleAge + partialTick) * 0.01F * speed; +// float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) + +// ((float)particleAge + partialTick) * 0.01F * speed; // // tessellator.startDrawing(5); // tessellator.setBrightness(200); @@ -293,7 +398,8 @@ public class ParticleReactorBeam extends EntityFX { // float texU = (float)(i % b0) * 1.0F / (float)b0; // tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); // -// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, (double)texV1); +// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, +// (double)texV1); // tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); // tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); // } @@ -308,7 +414,8 @@ public class ParticleReactorBeam extends EntityFX { // float texU = (float)(i % b0) * 1.0F / (float)b0; // tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); // -// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), -0.55D, (double)texU, (double)texV1); +// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), -0.55D, (double)texU, +// (double)texV1); // tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); // tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); // } @@ -332,7 +439,8 @@ public class ParticleReactorBeam extends EntityFX { // float texU = (float)(i % b0) * 1.0F / (float)b0; // tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha/2); // -// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, (double)texV1); +// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, +// (double)texV1); // tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); // tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); // } @@ -345,4 +453,4 @@ public class ParticleReactorBeam extends EntityFX { // GL11.glEnable(GL11.GL_CULL_FACE); // ResourceHandler.bindDefaultParticles(); // tessellator.startDrawingQuads(); -// } \ No newline at end of file +// } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java index 955f1f58..63ca9587 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java @@ -32,7 +32,8 @@ public class Particles { private double[] trailY = new double[15]; private double[] trailZ = new double[15]; - public EnergyBeamParticle(World world, double x, double y, double z, double x1, double z1, int direction, boolean mirror) { + public EnergyBeamParticle( + World world, double x, double y, double z, double x1, double z1, int direction, boolean mirror) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); float speed = 0.04F; this.motionX = 0; @@ -122,18 +123,24 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); tesselator.startDrawingQuads(); - tesselator.setBrightness(200);//make sure you have this!! + tesselator.setBrightness(200); // make sure you have this!! - - float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; - float maxU = 0.0F + 0.1245F;//minU + 0.124F; - float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; - float maxV = 0.1245F;//minV + 0.124F; + float minU = 0.0F + 0F; // (float)this.particleTextureIndexX / 32.0F; + float maxU = 0.0F + 0.1245F; // minU + 0.124F; + float minV = 0F; // (float)this.particleTextureIndexY / 32.0F; + float maxV = 0.1245F; // minV + 0.124F; float drawScale = 0.1F * particleScale; if (this.particleIcon != null) { @@ -149,10 +156,30 @@ public class Particles { tesselator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); for (int i = 0; i <= 14; i++) { GL11.glPushMatrix(); @@ -168,17 +195,36 @@ public class Particles { tesselator.setColorRGBA_F(scale2, 1F, scale2, scale2); } - tesselator.addVertexWithUV((double) (drawX - par3 * scale - par6 * scale), (double) (drawY - par4 * scale), (double) (drawZ - par5 * scale - par7 * scale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * scale + par6 * scale), (double) (drawY + par4 * scale), (double) (drawZ - par5 * scale + par7 * scale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * scale + par6 * scale), (double) (drawY + par4 * scale), (double) (drawZ + par5 * scale + par7 * scale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * scale - par6 * scale), (double) (drawY - par4 * scale), (double) (drawZ + par5 * scale - par7 * scale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * scale - par6 * scale), + (double) (drawY - par4 * scale), + (double) (drawZ - par5 * scale - par7 * scale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * scale + par6 * scale), + (double) (drawY + par4 * scale), + (double) (drawZ - par5 * scale + par7 * scale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * scale + par6 * scale), + (double) (drawY + par4 * scale), + (double) (drawZ + par5 * scale + par7 * scale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * scale - par6 * scale), + (double) (drawY - par4 * scale), + (double) (drawZ + par5 * scale - par7 * scale), + (double) minU, + (double) maxV); GL11.glPopMatrix(); } tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } @@ -189,7 +235,8 @@ public class Particles { private double targetZ; private boolean passive; - public EnergyTransferParticle(World world, double x, double y, double z, double tX, double tY, double tZ, boolean passive) { + public EnergyTransferParticle( + World world, double x, double y, double z, double tX, double tY, double tZ, boolean passive) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.passive = passive; this.targetX = tX; @@ -226,18 +273,24 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); tesselator.startDrawingQuads(); - tesselator.setBrightness(200);//make sure you have this!! + tesselator.setBrightness(200); // make sure you have this!! - - float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; - float maxU = 0.0F + 0.1245F;//minU + 0.124F; - float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; - float maxV = 0.1245F;//minV + 0.124F; + float minU = 0.0F + 0F; // (float)this.particleTextureIndexX / 32.0F; + float maxU = 0.0F + 0.1245F; // minU + 0.124F; + float minV = 0F; // (float)this.particleTextureIndexY / 32.0F; + float maxV = 0.1245F; // minV + 0.124F; float drawScale = 0.1F * this.particleScale; if (this.particleIcon != null) { @@ -252,21 +305,48 @@ public class Particles { float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); if (passive) - tesselator.setColorRGBA_F((float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleRed, (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleGreen, this.particleBlue, this.particleAlpha); + tesselator.setColorRGBA_F( + (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleRed, + (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleGreen, + this.particleBlue, + this.particleAlpha); else - tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F); + tesselator.setColorRGBA_F( + this.particleRed, + this.particleGreen, + this.particleBlue, + (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F); - //tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); + // tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } @@ -279,7 +359,8 @@ public class Particles { public int behaviour; public int timer = 0; - public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, int type, int maxAge) { + public AdvancedSeekerParticle( + World world, double x, double y, double z, double tX, double tY, double tZ, int type, int maxAge) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.targetX = tX; this.targetY = tY; @@ -297,14 +378,39 @@ public class Particles { this.particleMaxAge = maxAge; } - public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, int type, float red, float green, float blue, int maxAge) { + public AdvancedSeekerParticle( + World world, + double x, + double y, + double z, + double tX, + double tY, + double tZ, + int type, + float red, + float green, + float blue, + int maxAge) { this(world, x, y, z, tX, tY, tZ, type, maxAge); this.particleRed = red; this.particleGreen = green; this.particleBlue = blue; } - public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, int type, float red, float green, float blue, int maxAge, int timer) { + public AdvancedSeekerParticle( + World world, + double x, + double y, + double z, + double tX, + double tY, + double tZ, + int type, + float red, + float green, + float blue, + int maxAge, + int timer) { this(world, x, y, z, tX, tY, tZ, type, maxAge); this.particleRed = red; this.particleGreen = green; @@ -328,7 +434,6 @@ public class Particles { behaviour4(); break; } - } /** @@ -390,7 +495,8 @@ public class Particles { if (particleScale > 0) particleScale -= 0.02F; - if ((particleRed == 1F || (particleGreen == 1F && particleBlue == 0F)) && particleAge > particleMaxAge - 10) { + if ((particleRed == 1F || (particleGreen == 1F && particleBlue == 0F)) + && particleAge > particleMaxAge - 10) { int t = timer - 300; if (timer > 0) particleScale = (float) t / (1F - (particleAge / (particleMaxAge - 10F)) * 100F); } else if (particleBlue == 1F && particleAge > particleMaxAge - 15) { @@ -410,9 +516,11 @@ public class Particles { motionY = (motionY * directMotT) + (targetY - posY) * directMotMod; motionZ = (motionZ * directMotT) + (targetZ - posZ) * directMotMod; - if (particleMaxAge - particleAge < 40 && timer > 2300 && (particleRed == 1F || (particleGreen == 1f && particleBlue == 1f))) { + if (particleMaxAge - particleAge < 40 + && timer > 2300 + && (particleRed == 1F || (particleGreen == 1f && particleBlue == 1f))) { double yChange = (double) (timer - 2300); - //setPosition(posX, targetY + yChange, posZ); + // setPosition(posX, targetY + yChange, posZ); if (posY < targetY + 60) motionY = yChange * 0.05F; } @@ -426,20 +534,24 @@ public class Particles { /** * Go to target and shrink out of existence */ - private void behaviour4() { - - } + private void behaviour4() {} @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); tesselator.startDrawingQuads(); tesselator.setBrightness(200); - int uIndex = 0; int vIndex = 0; @@ -448,10 +560,10 @@ public class Particles { float minV = vIndex * 0.125F; float maxV = (vIndex + 1) * 0.125F; -// float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; -// float maxU = 0.0F + 0.1245F;//minU + 0.124F; -// float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; -// float maxV = 0.1245F;//minV + 0.124F; + // float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; + // float maxU = 0.0F + 0.1245F;//minU + 0.124F; + // float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; + // float maxV = 0.1245F;//minV + 0.124F; float drawScale = 0.1F * this.particleScale; if (this.particleIcon != null) { @@ -467,19 +579,37 @@ public class Particles { tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - //tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); + // tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } - } public static class TransceiverParticle extends EntityFX { @@ -503,7 +633,7 @@ public class Particles { @Override public void onUpdate() { - //super.onUpdate(); + // super.onUpdate(); if (particleAge > particleMaxAge) setDead(); if (particleAge > particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead(); particleAge++; @@ -521,7 +651,14 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); @@ -551,17 +688,36 @@ public class Particles { tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - //tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); + // tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } @@ -596,7 +752,7 @@ public class Particles { @Override public void onUpdate() { - //super.onUpdate(); + // super.onUpdate(); if (particleAge >= particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead(); double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); @@ -608,12 +764,18 @@ public class Particles { prevPosY = posY; prevPosZ = posZ; moveEntity(motionX, motionY, motionZ); - } @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); @@ -643,15 +805,34 @@ public class Particles { tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } @@ -663,7 +844,8 @@ public class Particles { public ReactorExplosionParticle(World world, double x, double y, double z, double maxSize) { super(world, x, y, z, 0D, 0D, 0D); if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + uvSphere = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); this.maxSize = maxSize; } @@ -682,7 +864,14 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tessellator, + float partialTick, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -700,8 +889,7 @@ public class Particles { double s = size + partialTick * 1F; GL11.glScaled(s, s / 4, s); - - //Leading edge + // Leading edge GL11.glPushMatrix(); float a = (float) Math.max(0D, 0.3D - (size / (maxSize))); GL11.glColor4f(1F, 0.4F, 0F, a); @@ -709,7 +897,7 @@ public class Particles { if (a > 0) uvSphere.renderAll(); GL11.glPopMatrix(); - //Disk + // Disk GL11.glPushMatrix(); a = (float) Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); GL11.glColor4f(1F, 0.4F, 0F, a); @@ -717,7 +905,7 @@ public class Particles { if (a > 0) uvSphere.renderAll(); GL11.glPopMatrix(); - //Synced edge + // Synced edge GL11.glPushMatrix(); a = (float) Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); GL11.glColor4f(1F, 0.4F, 0F, a); @@ -726,7 +914,7 @@ public class Particles { GL11.glScalef(1.5F, 1.5F, 1.5F); - //Inner edges + // Inner edges GL11.glPushMatrix(); a = (float) Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); GL11.glColor4f(1F, 0.4F, 0F, a); @@ -777,7 +965,6 @@ public class Particles { GL11.glPopMatrix(); } - GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); ResourceHandler.bindDefaultParticles(); @@ -793,13 +980,15 @@ public class Particles { public ChaosImplosionParticle(World world, double x, double y, double z, double maxSize) { super(world, x, y, z, 0D, 0D, 0D); if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + uvSphere = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); this.maxSize = maxSize; } @Override public void onUpdate() { - //if (particleAge == 3) worldObj.playSound(posX, posY, posZ, "DraconicEvolution:fusionExplosion", 100F, 1F, false); + // if (particleAge == 3) worldObj.playSound(posX, posY, posZ, "DraconicEvolution:fusionExplosion", 100F, 1F, + // false); particleAge++; size++; if (size > maxSize * 1.2) setDead(); @@ -811,7 +1000,14 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tessellator, + float partialTick, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -829,8 +1025,7 @@ public class Particles { double s = size + partialTick * 1F; GL11.glScaled(s, s / 4, s); - - //Leading edge + // Leading edge GL11.glPushMatrix(); float a = (float) Math.max(0D, 0.3D - (size / (maxSize))); GL11.glColor4f(1F, 1F, 1F, a); @@ -838,15 +1033,15 @@ public class Particles { if (a > 0) uvSphere.renderAll(); GL11.glPopMatrix(); -// //Disk -// GL11.glPushMatrix(); -// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); -// GL11.glColor4f(1F, 1F, 1F, a); -// GL11.glScaled(2, 0.2, 2); -// if (a > 0)uvSphere.renderAll(); -// GL11.glPopMatrix(); + // //Disk + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(2, 0.2, 2); + // if (a > 0)uvSphere.renderAll(); + // GL11.glPopMatrix(); - //Synced edge + // Synced edge GL11.glPushMatrix(); a = (float) Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); GL11.glColor4f(1F, 1F, 1F, a); @@ -855,7 +1050,7 @@ public class Particles { GL11.glScalef(1.5F, 1.5F, 1.5F); - //Inner edges + // Inner edges GL11.glPushMatrix(); a = (float) Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); GL11.glColor4f(1F, 1F, 1F, a); @@ -906,7 +1101,6 @@ public class Particles { GL11.glPopMatrix(); } - GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); ResourceHandler.bindDefaultParticles(); @@ -937,12 +1131,12 @@ public class Particles { @Override public void onUpdate() { - //super.onUpdate(); + // super.onUpdate(); if (particleAge >= particleMaxAge) setDead(); -// -// double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); -// double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); - //particleScale = ((float) (d2 / d1)) * baseScale; + // + // double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); + // double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); + // particleScale = ((float) (d2 / d1)) * baseScale; particleAlpha = (1F - (float) ((double) particleAge / particleMaxAge)); particleScale = 1F * (1F - (float) ((double) particleAge / particleMaxAge)); @@ -956,12 +1150,19 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); tesselator.startDrawingQuads(); tesselator.setBrightness(200); - //GL11.glDepthMask(true); + // GL11.glDepthMask(true); int uIndex = 7; int vIndex = 0; @@ -984,18 +1185,37 @@ public class Particles { float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); - //tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); + // tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); tesselator.setColorRGBA_I(particleColour, 0xFF); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } @@ -1011,7 +1231,8 @@ public class Particles { private int mode; - public ChaosBoltParticle(World world, double x, double y, double z, double shardX, double shardY, double shardZ, int mode) { + public ChaosBoltParticle( + World world, double x, double y, double z, double shardX, double shardY, double shardZ, int mode) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.focalX = x; this.focalY = y; @@ -1037,7 +1258,6 @@ public class Particles { this.particleBlue = 0; } - @Override public void onUpdate() { if (particleAge++ > particleMaxAge) setDead(); @@ -1076,7 +1296,14 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); @@ -1106,18 +1333,36 @@ public class Particles { tesselator.setBrightness(200); tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } - } public static class ChaosExpansionParticle extends EntityFX { @@ -1130,7 +1375,8 @@ public class Particles { super(world, x, y, z, 0D, 0D, 0D); this.shrink = shrink; if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + uvSphere = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); if (shrink) { size = 20; } @@ -1150,7 +1396,14 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tessellator, + float partialTick, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -1170,7 +1423,7 @@ public class Particles { if (shrink) GL11.glColor4f(1F, 1F, 1F, 1F - ((float) size - partialTick) / (float) maxSize); else GL11.glColor4f(0F, 0F, 0F, 1F - ((float) size - partialTick) / (float) maxSize); - //GL11.glScaled(5, 10, 5); + // GL11.glScaled(5, 10, 5); uvSphere.renderAll(); GL11.glEnable(GL11.GL_CULL_FACE); @@ -1210,12 +1463,19 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tesselator, + float par2, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); tesselator.startDrawingQuads(); tesselator.setBrightness(200); - //GL11.glDepthMask(true); + // GL11.glDepthMask(true); int uIndex = 3; int vIndex = 1; @@ -1238,18 +1498,37 @@ public class Particles { float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); - //tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); + // tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); tesselator.setColorRGBA_I(particleColour, 0xFF); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); - tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); - tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ - par5 * drawScale - par7 * drawScale), + (double) maxU, + (double) maxV); + tesselator.addVertexWithUV( + (double) (drawX - par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ - par5 * drawScale + par7 * drawScale), + (double) maxU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale + par6 * drawScale), + (double) (drawY + par4 * drawScale), + (double) (drawZ + par5 * drawScale + par7 * drawScale), + (double) minU, + (double) minV); + tesselator.addVertexWithUV( + (double) (drawX + par3 * drawScale - par6 * drawScale), + (double) (drawY - par4 * drawScale), + (double) (drawZ + par5 * drawScale - par7 * drawScale), + (double) minU, + (double) maxV); tesselator.draw(); ResourceHandler.bindDefaultParticles(); tesselator.startDrawingQuads(); - } } @@ -1261,13 +1540,15 @@ public class Particles { public ArrowShockParticle(World world, double x, double y, double z, int maxSize) { super(world, x, y, z, 0D, 0D, 0D); if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + uvSphere = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); this.maxSize = maxSize / 100D; } @Override public void onUpdate() { - //if (particleAge == 3) worldObj.playSound(posX, posY, posZ, "DraconicEvolution:fusionExplosion", 100F, 1F, false); + // if (particleAge == 3) worldObj.playSound(posX, posY, posZ, "DraconicEvolution:fusionExplosion", 100F, 1F, + // false); particleAge++; size += 1.2; if (size > maxSize * 1.2) setDead(); @@ -1279,7 +1560,14 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + public void renderParticle( + Tessellator tessellator, + float partialTick, + float par3, + float par4, + float par5, + float par6, + float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -1297,83 +1585,81 @@ public class Particles { double s = size + partialTick * 1F; GL11.glScaled(s, s / 3, s); - - //Leading edge + // Leading edge GL11.glPushMatrix(); float a = (float) Math.max(0D, 0.3D - (size / (maxSize))); GL11.glScaled(5, 5, 5); - //if (a > 0)uvSphere.renderAll(); + // if (a > 0)uvSphere.renderAll(); GL11.glPopMatrix(); -// //Disk -// GL11.glPushMatrix(); -// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); -// GL11.glColor4f(1F, 1F, 1F, a); -// GL11.glScaled(2, 0.2, 2); -// if (a > 0)uvSphere.renderAll(); -// GL11.glPopMatrix(); + // //Disk + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(2, 0.2, 2); + // if (a > 0)uvSphere.renderAll(); + // GL11.glPopMatrix(); - //Synced edge + // Synced edge GL11.glPushMatrix(); a = (float) Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); GL11.glColor4f(1F, 0.1F, 0F, a); if (a > 0) uvSphere.renderAll(); GL11.glPopMatrix(); -// GL11.glScalef(1.5F, 1.5F, 1.5F); -// -// //Inner edges -// GL11.glPushMatrix(); -// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); -//// GL11.glColor4f(1F, 0.3F, 0F, a); -// GL11.glScaled(0.8, 0.8, 0.8); -//// if (a > 0)uvSphere.renderAll(); -// -//// GL11.glColor4f(1F, 0.3F, 0F, a); -// GL11.glScaled(0.8, 0.8, 0.8); -//// if (a > 0)uvSphere.renderAll(); -// -//// GL11.glColor4f(1F, 0.3F, 0F, a); -// GL11.glScaled(0.7, 0.7, 0.7); -//// if (a > 0)uvSphere.renderAll(); -// -//// GL11.glColor4f(1F, 0.3F, 0F, a); -// GL11.glScaled(0.6, 0.6, 0.6); -//// if (a > 0)uvSphere.renderAll(); -// -//// GL11.glColor4f(1F, 0.3F, 0F, a); -// GL11.glScaled(0.5, 0.5, 0.5); -//// if (a > 0)uvSphere.renderAll(); -// -// GL11.glPopMatrix(); - -// for (int i = 0; i < 10; i++) -// { -// GL11.glScalef(0.95F, 0.95F, 0.95F); -// GL11.glPushMatrix(); -// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); -// GL11.glColor4f(1F, 1F, 1F, a); -// GL11.glScaled(0.8, 0.6, 0.8); -// if (a > 0)uvSphere.renderAll(); -// -// GL11.glColor4f(1F, 1F, 1F, a); -// GL11.glScaled(0.8, 0.7, 0.8); -// if (a > 0)uvSphere.renderAll(); -// -// GL11.glColor4f(1F, 1F, 1F, a); -// GL11.glScaled(0.7, 0.9, 0.7); -// if (a > 0)uvSphere.renderAll(); -// -// GL11.glColor4f(1F, 1F, 1F, a); -// GL11.glScaled(0.6, 0.9, 0.6); -// if (a > 0)uvSphere.renderAll(); -// -// GL11.glColor4f(1F, 1F, 1F, a); -// GL11.glScaled(0.5, 0.9, 0.5); -// if (a > 0)uvSphere.renderAll(); -// GL11.glPopMatrix(); -// } + // GL11.glScalef(1.5F, 1.5F, 1.5F); + // + // //Inner edges + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.8, 0.8, 0.8); + //// if (a > 0)uvSphere.renderAll(); + // + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.8, 0.8, 0.8); + //// if (a > 0)uvSphere.renderAll(); + // + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.7, 0.7, 0.7); + //// if (a > 0)uvSphere.renderAll(); + // + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.6, 0.6, 0.6); + //// if (a > 0)uvSphere.renderAll(); + // + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.5, 0.5, 0.5); + //// if (a > 0)uvSphere.renderAll(); + // + // GL11.glPopMatrix(); + // for (int i = 0; i < 10; i++) + // { + // GL11.glScalef(0.95F, 0.95F, 0.95F); + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.8, 0.6, 0.8); + // if (a > 0)uvSphere.renderAll(); + // + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.8, 0.7, 0.8); + // if (a > 0)uvSphere.renderAll(); + // + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.7, 0.9, 0.7); + // if (a > 0)uvSphere.renderAll(); + // + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.6, 0.9, 0.6); + // if (a > 0)uvSphere.renderAll(); + // + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.5, 0.9, 0.5); + // if (a > 0)uvSphere.renderAll(); + // GL11.glPopMatrix(); + // } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); @@ -1381,12 +1667,11 @@ public class Particles { tessellator.startDrawingQuads(); } } - } -//int uIndex = 0; -//int vIndex = 0; +// int uIndex = 0; +// int vIndex = 0; // -//float minU = uIndex * 0.125F; -//float maxU = (uIndex+1) * 0.125F; -//float minV = vIndex * 0.125F; -//float maxV = (vIndex+1) * 0.125F; \ No newline at end of file +// float minU = uIndex * 0.125F; +// float maxU = (uIndex+1) * 0.125F; +// float minV = vIndex * 0.125F; +// float maxV = (vIndex+1) * 0.125F; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java index 40236c2d..dc446e8c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java @@ -15,7 +15,8 @@ import org.lwjgl.opengl.GL11; * Created by brandon3055 on 24/9/2015. */ public class RenderTileChaosShard extends TileEntitySpecialRenderer { - public static IModelCustom model = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystal.obj")); + public static IModelCustom model = + AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystal.obj")); @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float tick) { @@ -60,7 +61,7 @@ public class RenderTileChaosShard extends TileEntitySpecialRenderer { double d12 = 0.8D + size; double d14 = 0.8D + size; double d16 = 0.8D + size; - double d18 = 10.0D; //Height + double d18 = 10.0D; // Height double d20 = 0.0D; double d22 = 1.0D; double d24 = (double) (-1.0F + f3); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java index a938aac6..5557be22 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java @@ -20,19 +20,25 @@ import org.lwjgl.opengl.GL11; */ public class RenderTileCrystal extends TileEntitySpecialRenderer { - private static ResourceLocation texrure = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalPurpleTransparent.png"); - private static ResourceLocation crystalBlue = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalBlue.png"); - private static ResourceLocation crystalBlueAlpha = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalBlueAlpha.png"); - private static ResourceLocation crystalRed = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalRed.png"); - private static ResourceLocation crystalRedAlpha = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalRedAlpha.png"); - + private static ResourceLocation texrure = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalPurpleTransparent.png"); + private static ResourceLocation crystalBlue = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalBlue.png"); + private static ResourceLocation crystalBlueAlpha = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalBlueAlpha.png"); + private static ResourceLocation crystalRed = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalRed.png"); + private static ResourceLocation crystalRedAlpha = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalRedAlpha.png"); private IModelCustom modelCrystal; private IModelCustom modelCrystalTransceiver; public RenderTileCrystal() { - modelCrystal = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/CCrystal.obj")); - modelCrystalTransceiver = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/CrystalTransceiver.obj")); + modelCrystal = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/CCrystal.obj")); + modelCrystalTransceiver = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/CrystalTransceiver.obj")); } @Override @@ -43,9 +49,8 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { renderTransceiver((TileEnergyTransceiver) tileEntity, x, y, z, partialTick); } - public void renderEnergyRelay(TileRemoteEnergyBase tileEntity, double x, double y, double z, float partialTick) { - //--- Pre Render ---// + // --- Pre Render ---// tileEntity.inView = 10; GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); @@ -57,14 +62,13 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, innerLight, innerLight); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - //--- Render Bottom Layer ---// + // --- Render Bottom Layer ---// if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlue); else bindTexture(crystalRed); modelCrystal.renderAll(); - - //--- Render Alpha Overlay ---// + // --- Render Alpha Overlay ---// if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlueAlpha); else bindTexture(crystalRedAlpha); GL11.glEnable(GL11.GL_ALPHA_TEST); @@ -73,26 +77,23 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { modelCrystal.renderAll(); GL11.glAlphaFunc(GL11.GL_GREATER, 0f); -// GL11.glDisable(GL11.GL_ALPHA_TEST); + // GL11.glDisable(GL11.GL_ALPHA_TEST); - - //--- Render Overlay ---// + // --- Render Overlay ---// bindTexture(texrure); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, outerLight, outerLight); modelCrystal.renderAll(); - - //--- Post Render ---// + // --- Post Render ---// GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); GL11.glDisable(GL11.GL_BLEND); RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); } - public void renderTransceiver(TileEnergyTransceiver tileEntity, double x, double y, double z, float partialTick) { - //--- Pre Render ---// + // --- Pre Render ---// tileEntity.inView = 10; GL11.glPushMatrix(); @@ -120,21 +121,20 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { GL11.glTranslated(0, -1, 0); GL11.glDisable(GL11.GL_LIGHTING); -// RenderHelper.disableStandardItemLighting(); + // RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_BLEND); float innerLight = 100f; float outerLight = 140f + ClientEventHandler.energyCrystalAlphaValue * 40F; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, innerLight, innerLight); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - //--- Render Bottom Layer ---// + // --- Render Bottom Layer ---// if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlue); else bindTexture(crystalRed); modelCrystalTransceiver.renderAll(); - - //--- Render Alpha Overlay ---// + // --- Render Alpha Overlay ---// if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlueAlpha); else bindTexture(crystalRedAlpha); GL11.glEnable(GL11.GL_ALPHA_TEST); @@ -144,17 +144,15 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_ALPHA_TEST); - - //--- Render Overlay ---// + // --- Render Overlay ---// bindTexture(texrure); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, outerLight, outerLight); modelCrystalTransceiver.renderAll(); - - //--- Post Render ---// + // --- Post Render ---// GL11.glDisable(GL11.GL_BLEND); -// RenderHelper.enableStandardItemLighting(); + // RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java index 54caf89e..0afdb102 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java @@ -3,7 +3,6 @@ package com.brandon3055.draconicevolution.client.render.tile; /** * Created by Brandon on 5/07/2014. */ - import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.tileentities.CustomSpawnerBaseLogic; import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; @@ -25,7 +24,8 @@ public class RenderTileCustomSpawner extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - public void renderTile(CustomSpawnerBaseLogic customSpawnerBaseLogic, double x, double y, double z, float partialTick) { + public void renderTile( + CustomSpawnerBaseLogic customSpawnerBaseLogic, double x, double y, double z, float partialTick) { Tessellator tessellator = Tessellator.instance; Entity entity = customSpawnerBaseLogic.getEntityForRenderer(); @@ -36,7 +36,14 @@ public class RenderTileCustomSpawner extends TileEntitySpecialRenderer { entity.setWorld(customSpawnerBaseLogic.getSpawnerWorld()); float f1 = 0.4375F; GL11.glTranslatef(0.0F, 0.4F, 0.0F); - GL11.glRotatef((float) (customSpawnerBaseLogic.renderRotation1 + (customSpawnerBaseLogic.renderRotation0 - customSpawnerBaseLogic.renderRotation1) * (double) partialTick) * 10.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef( + (float) (customSpawnerBaseLogic.renderRotation1 + + (customSpawnerBaseLogic.renderRotation0 - customSpawnerBaseLogic.renderRotation1) + * (double) partialTick) + * 10.0F, + 0.0F, + 1.0F, + 0.0F); GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -0.4F, 0.0F); GL11.glScalef(f1, f1, f1); @@ -86,7 +93,8 @@ public class RenderTileCustomSpawner extends TileEntitySpecialRenderer { } @Override - public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { + public void renderTileEntityAt( + TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { this.renderTileEntityAt((TileCustomSpawner) p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java index b2eea370..ff111cab 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java @@ -16,9 +16,10 @@ import org.lwjgl.opengl.GL11; public class RenderTileDissEnchanter extends TileEntitySpecialRenderer { - //private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyInfuserTextureSheet.png"); + // private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), + // "textures/models/EnergyInfuserTextureSheet.png"); - //private static float pxl = 1F / 256F; + // private static float pxl = 1F / 256F; @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { @@ -33,7 +34,7 @@ public class RenderTileDissEnchanter extends TileEntitySpecialRenderer { public void renderBlock(TileDissEnchanter tile, World world, int x, int y, int z, float f) { Tessellator tessellator = Tessellator.instance; - //bindTexture(texture); + // bindTexture(texture); tessellator.setColorRGBA(255, 255, 255, 255); tessellator.setBrightness(200); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java index a48907fb..fd10744c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java @@ -1,24 +1,24 @@ package com.brandon3055.draconicevolution.client.render.tile; +import static org.lwjgl.opengl.GL11.*; + import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; +import java.util.Random; import net.minecraft.client.model.ModelChest; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import java.util.Random; - -import static org.lwjgl.opengl.GL11.*; - /** * Created by Brandon on 25/10/2014. */ public class RenderTileDraconiumChest extends TileEntitySpecialRenderer { ModelChest model; - private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/DraconiumChest.png"); + private final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/DraconiumChest.png"); private Random random; public RenderTileDraconiumChest() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java index eeb80de8..510dd7b7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java @@ -15,7 +15,8 @@ import org.lwjgl.opengl.GL11; public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { - private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyInfuserTextureSheet.png"); + private final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyInfuserTextureSheet.png"); private static float pxl = 1F / 256F; @@ -41,7 +42,6 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { drawBase(tessellator); drawWings(tessellator, tile); renderChargingItem(tile); - } private void drawBase(Tessellator tess) { @@ -59,7 +59,6 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { tess.addVertexWithUV(1, 0.0005D, 1, srcXMax, srcYMax); tess.addVertexWithUV(0, 0.0005D, 1, srcXMin, srcYMax); - srcXMin = 128D * pxl; srcYMin = 0D; srcXMax = 192D * pxl; @@ -97,21 +96,19 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { tess.draw(); GL11.glPopMatrix(); - } private void drawWings(Tessellator tess, TileEnergyInfuser tile) { GL11.glPushMatrix(); - float srcXMin = 0F; //iicon.getMinU(); - float srcYMin = 64F * pxl; //iicon.getMaxU(); - float srcXMax = 92F * pxl; //iicon.getMinV(); - float srcYMax = 115F * pxl; //iicon.getMaxV(); + float srcXMin = 0F; // iicon.getMinU(); + float srcYMin = 64F * pxl; // iicon.getMaxU(); + float srcXMax = 92F * pxl; // iicon.getMinV(); + float srcYMax = 115F * pxl; // iicon.getMaxV(); GL11.glTranslatef(-0.64F, 0.365F, 0.51F); GL11.glScalef(0.7F, 0.7F, 0.7F); float xTrans = 0.025F; - { GL11.glTranslatef(1.62F, 0F, -xTrans); GL11.glRotatef(tile.rotation, 0F, 1F, 0F); @@ -137,10 +134,10 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { render2DWithThicness(tess, srcXMax, srcYMin, srcXMin, srcYMax, 92, 51, 0.0625F); } { - srcXMin = 64F * pxl; //iicon.getMinU(); - srcYMin = 24F * pxl; //iicon.getMaxU(); - srcXMax = 96F * pxl; //iicon.getMinV(); - srcYMax = 56F * pxl; //iicon.getMaxV(); + srcXMin = 64F * pxl; // iicon.getMinU(); + srcYMin = 24F * pxl; // iicon.getMaxU(); + srcXMax = 96F * pxl; // iicon.getMinV(); + srcYMax = 56F * pxl; // iicon.getMaxV(); GL11.glTranslatef(1.26F, 0F, 0.31F); GL11.glTranslatef(0F, 0F, 0F); GL11.glRotatef(90, 0F, 1F, 0F); @@ -152,7 +149,8 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - public static void render2DWithThicness(Tessellator tess, float maxU, float minV, float minU, float maxV, int width, int height, float thickness) { + public static void render2DWithThicness( + Tessellator tess, float maxU, float minV, float minU, float maxV, int width, int height, float thickness) { double pix = 1D / 64D; tess.startDrawingQuads(); tess.setNormal(0.0F, 0.0F, 1.0F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java index 277f691d..8cb7528c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java @@ -15,11 +15,13 @@ import org.lwjgl.opengl.GL11; */ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer { - private static final ResourceLocation model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/pylon_sphere_texture.png"); + private static final ResourceLocation model_texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/pylon_sphere_texture.png"); private IModelCustom model; public RenderTileEnergyPylon() { - model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/pylon_sphere.obj")); + model = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/pylon_sphere.obj")); } @Override @@ -95,6 +97,5 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - -// private void renderSphere() + // private void renderSphere() } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java index a30ed6a1..f18c31f8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java @@ -17,12 +17,15 @@ import org.lwjgl.opengl.GL11; */ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { - private static final ResourceLocation iner_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png"); - private static final ResourceLocation outer_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png"); + private static final ResourceLocation iner_model_texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png"); + private static final ResourceLocation outer_model_texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png"); private IModelCustom iner_model; public RenderTileEnergyStorageCore() { - iner_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); + iner_model = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); } @Override @@ -65,7 +68,8 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture); - double colour = (double) ((TileEnergyStorageCore) tile).getEnergyStored() / (double) ((TileEnergyStorageCore) tile).getMaxEnergyStored(); + double colour = (double) ((TileEnergyStorageCore) tile).getEnergyStored() + / (double) ((TileEnergyStorageCore) tile).getMaxEnergyStored(); float brightness = (float) Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f); colour = 1f - colour; @@ -77,19 +81,19 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { iner_model.renderAll(); GL11.glPopMatrix(); -// GL11.glPushMatrix(); -// GL11.glScalef(0.8F, 0.8F, 0.8F); -// GL11.glColor4d(1F, 1f, 0.2f, 1F); -// GL11.glRotatef(rotation, 0F, 1F, 0.5F); -// //iner_model.renderAll(); -// GL11.glPopMatrix(); -// -// GL11.glPushMatrix(); -// GL11.glScalef(0.9F, 0.9F, 0.9F); -// GL11.glColor4d(1F, 0f, 0.2f, 1F); -// GL11.glRotatef(rotation, 0F, 1F, 0.5F); -// //iner_model.renderAll(); -// GL11.glPopMatrix(); + // GL11.glPushMatrix(); + // GL11.glScalef(0.8F, 0.8F, 0.8F); + // GL11.glColor4d(1F, 1f, 0.2f, 1F); + // GL11.glRotatef(rotation, 0F, 1F, 0.5F); + // //iner_model.renderAll(); + // GL11.glPopMatrix(); + // + // GL11.glPushMatrix(); + // GL11.glScalef(0.9F, 0.9F, 0.9F); + // GL11.glColor4d(1F, 0f, 0.2f, 1F); + // GL11.glRotatef(rotation, 0F, 1F, 0.5F); + // //iner_model.renderAll(); + // GL11.glPopMatrix(); GL11.glScalef(1.1F, 1.1F, 1.1F); GL11.glDepthMask(false); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java index 3a211ae4..d5f776b8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java @@ -16,19 +16,22 @@ import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; import org.lwjgl.opengl.GL11; - @SideOnly(Side.CLIENT) public class RenderTileParticleGen extends TileEntitySpecialRenderer { - private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/ParticleGenTextureSheet.png"); - private final ResourceLocation beamTexture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/stabilizer_beam.png"); - private static final ResourceLocation modelTexture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/stabilizer_sphere.png"); + private final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/ParticleGenTextureSheet.png"); + private final ResourceLocation beamTexture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/stabilizer_beam.png"); + private static final ResourceLocation modelTexture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/stabilizer_sphere.png"); private IModelCustom stabilizerSphereModel; private float pxl = 1F / 64; public RenderTileParticleGen() { - stabilizerSphereModel = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/stabilizer_sphere.obj")); + stabilizerSphereModel = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/stabilizer_sphere.obj")); } @Override @@ -39,7 +42,6 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { TileParticleGenerator tileEntityGen = (TileParticleGenerator) tileEntity; renderBlock(tileEntityGen, f); - GL11.glPopMatrix(); } @@ -51,14 +53,14 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { GL11.glPushMatrix(); - //GL11.glDisable(GL11.GL_LIGHTING); + // GL11.glDisable(GL11.GL_LIGHTING); bindTexture(texture); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); tessellator.setColorRGBA(255, 255, 255, 255); - {//Draw Corners + { // Draw Corners float f = 0.4F; drawCornerCube(tessellator, f, f, f, 1F - f, inverted, stabilizerMode); drawCornerCube(tessellator, f, -f, f, 1F - f, inverted, stabilizerMode); @@ -69,7 +71,7 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { drawCornerCube(tessellator, f, -f, -f, 1F - f, inverted, stabilizerMode); drawCornerCube(tessellator, -f, -f, f, 1F - f, inverted, stabilizerMode); } - {//Draw Beams + { // Draw Beams float f = 0.45F; float f2 = 0.4F; drawBeamX(tessellator, 0, f2, f2, 1F - f); @@ -89,7 +91,7 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { } tessellator.draw(); - //GL11.glEnable(GL11.GL_LIGHTING); + // GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); if (stabilizerMode) { @@ -97,7 +99,6 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { } if (tl.beam_enabled) preRenderBeam(tessellator, tl, f3); - } private void drawEnergyBeam(Tessellator tess, TileParticleGenerator gen, float f) { @@ -133,7 +134,7 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { public void renderStabilizerSphere(TileParticleGenerator tile) { GL11.glPushMatrix(); - //GL11.glColor4f(0.5F, 0.0F, 0.0F, 1F); + // GL11.glColor4f(0.5F, 0.0F, 0.0F, 1F); GL11.glColor4f(0.0F, 2.0F, 0.0F, 1F); GL11.glTranslated(0.5, 0, 0.5); GL11.glScalef(0.4F, 0.4F, 0.4F); @@ -192,22 +193,21 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); - //float time = (float)tile.getWorldObj().getTotalWorldTime() + f; + // float time = (float)tile.getWorldObj().getTotalWorldTime() + f; float time = tile.rotation + f; float upMot = -time * 0.2F - (float) MathHelper.floor_float(-time * 0.1F); byte scaleMult = 1; double rotation = (double) time * 0.025D * (1.0D - (double) (scaleMult & 1) * 2.5D); - tess.startDrawingQuads(); tess.setColorRGBA(255, 255, 255, 32); double scale = (double) scaleMult * 0.2D; - double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; //x point 1 - double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; //z point 1 - double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; //x point 2 - double d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale; //z point 2 - double d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale;//Dist from x-3 + double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; // x point 1 + double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; // z point 1 + double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; // x point 2 + double d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale; // z point 2 + double d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale; // Dist from x-3 double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale; double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale; double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale; @@ -323,15 +323,15 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); - } - private void drawCornerCube(Tessellator tess, float x, float y, float z, float FP, boolean inverted, boolean stabalizerMode) { + private void drawCornerCube( + Tessellator tess, float x, float y, float z, float FP, boolean inverted, boolean stabalizerMode) { float srcXMin = inverted ? 38F * pxl : 32F * pxl; float srcYMin = 0F; float srcXMax = inverted ? 44F * pxl : 38F * pxl; float srcYMax = 6 * pxl; - //float FP = 0.6F; //Scale + // float FP = 0.6F; //Scale float FN = 1F - FP; if (stabalizerMode) { @@ -339,37 +339,37 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { srcXMax = 50F * pxl; } - //X+ + // X+ tess.addVertexWithUV(FP + x, FN + y, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(FP + x, FP + y, FN + z, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, FP + y, FP + z, srcXMax, srcYMax); tess.addVertexWithUV(FP + x, FN + y, FP + z, srcXMin, srcYMax); - //X- + // X- tess.addVertexWithUV(FN + x, FN + y, FP + z, srcXMin, srcYMin); tess.addVertexWithUV(FN + x, FP + y, FP + z, srcXMax, srcYMin); tess.addVertexWithUV(FN + x, FP + y, FN + z, srcXMax, srcYMax); tess.addVertexWithUV(FN + x, FN + y, FN + z, srcXMin, srcYMax); - //Y+ + // Y+ tess.addVertexWithUV(FN + x, FP + y, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(FN + x, FP + y, FP + z, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, FP + y, FP + z, srcXMax, srcYMax); tess.addVertexWithUV(FP + x, FP + y, FN + z, srcXMin, srcYMax); - //Y- + // Y- tess.addVertexWithUV(FN + x, FN + y, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(FP + x, FN + y, FN + z, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, FN + y, FP + z, srcXMax, srcYMax); tess.addVertexWithUV(FN + x, FN + y, FP + z, srcXMin, srcYMax); - //Z+ + // Z+ tess.addVertexWithUV(FP + x, FN + y, FP + z, srcXMin, srcYMin); tess.addVertexWithUV(FP + x, FP + y, FP + z, srcXMax, srcYMin); tess.addVertexWithUV(FN + x, FP + y, FP + z, srcXMax, srcYMax); tess.addVertexWithUV(FN + x, FN + y, FP + z, srcXMin, srcYMax); - //Z- + // Z- tess.addVertexWithUV(FN + x, FN + y, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(FN + x, FP + y, FN + z, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, FP + y, FN + z, srcXMax, srcYMax); @@ -386,25 +386,25 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { float XX = 0.9F; float XM = 0.1F; - //Y+ + // Y+ tess.addVertexWithUV(XM, FP + y, FN + z, srcXMin, srcYMax); tess.addVertexWithUV(XM, FP + y, FP + z, srcXMin, srcYMin); tess.addVertexWithUV(XX, FP + y, FP + z, srcXMax, srcYMin); tess.addVertexWithUV(XX, FP + y, FN + z, srcXMax, srcYMax); - //Y- + // Y- tess.addVertexWithUV(XM, FN + y, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(XX, FN + y, FN + z, srcXMax, srcYMin); tess.addVertexWithUV(XX, FN + y, FP + z, srcXMax, srcYMax); tess.addVertexWithUV(XM, FN + y, FP + z, srcXMin, srcYMax); - //Z+ + // Z+ tess.addVertexWithUV(XX, FN + y, FP + z, srcXMin, srcYMax); tess.addVertexWithUV(XX, FP + y, FP + z, srcXMin, srcYMin); tess.addVertexWithUV(XM, FP + y, FP + z, srcXMax, srcYMin); tess.addVertexWithUV(XM, FN + y, FP + z, srcXMax, srcYMax); - //Z- + // Z- tess.addVertexWithUV(XM, FN + y, FN + z, srcXMin, srcYMax); tess.addVertexWithUV(XM, FP + y, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(XX, FP + y, FN + z, srcXMax, srcYMin); @@ -421,30 +421,29 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { float XX = 0.9F; float XM = 0.1F; - //X+ + // X+ tess.addVertexWithUV(FP + x, XM, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(FP + x, XX, FN + z, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, XX, FP + z, srcXMax, srcYMax); tess.addVertexWithUV(FP + x, XM, FP + z, srcXMin, srcYMax); - //X- + // X- tess.addVertexWithUV(FN + x, XM, FP + z, srcXMin, srcYMin); tess.addVertexWithUV(FN + x, XX, FP + z, srcXMax, srcYMin); tess.addVertexWithUV(FN + x, XX, FN + z, srcXMax, srcYMax); tess.addVertexWithUV(FN + x, XM, FN + z, srcXMin, srcYMax); - //Z+ + // Z+ tess.addVertexWithUV(FP + x, XM, FP + z, srcXMin, srcYMin); tess.addVertexWithUV(FP + x, XX, FP + z, srcXMax, srcYMin); tess.addVertexWithUV(FN + x, XX, FP + z, srcXMax, srcYMax); tess.addVertexWithUV(FN + x, XM, FP + z, srcXMin, srcYMax); - //Z- + // Z- tess.addVertexWithUV(FN + x, XM, FN + z, srcXMin, srcYMin); tess.addVertexWithUV(FN + x, XX, FN + z, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, XX, FN + z, srcXMax, srcYMax); tess.addVertexWithUV(FP + x, XM, FN + z, srcXMin, srcYMax); - } private void drawBeamZ(Tessellator tess, float x, float y, float z, float FP) { @@ -457,30 +456,29 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { float XX = 0.9F; float XM = 0.1F; - //X+ + // X+ tess.addVertexWithUV(FP + x, FN + y, XM, srcXMin, srcYMax); tess.addVertexWithUV(FP + x, FP + y, XM, srcXMin, srcYMin); tess.addVertexWithUV(FP + x, FP + y, XX, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, FN + y, XX, srcXMax, srcYMax); - //X- + // X- tess.addVertexWithUV(FN + x, FN + y, XX, srcXMin, srcYMax); tess.addVertexWithUV(FN + x, FP + y, XX, srcXMin, srcYMin); tess.addVertexWithUV(FN + x, FP + y, XM, srcXMax, srcYMin); tess.addVertexWithUV(FN + x, FN + y, XM, srcXMax, srcYMax); - //Y+ + // Y+ tess.addVertexWithUV(FN + x, FP + y, XM, srcXMin, srcYMin); tess.addVertexWithUV(FN + x, FP + y, XX, srcXMax, srcYMin); tess.addVertexWithUV(FP + x, FP + y, XX, srcXMax, srcYMax); tess.addVertexWithUV(FP + x, FP + y, XM, srcXMin, srcYMax); - //Y- + // Y- tess.addVertexWithUV(FN + x, FN + y, XM, srcXMin, srcYMax); tess.addVertexWithUV(FP + x, FN + y, XM, srcXMin, srcYMin); tess.addVertexWithUV(FP + x, FN + y, XX, srcXMax, srcYMin); tess.addVertexWithUV(FN + x, FN + y, XX, srcXMax, srcYMax); - } private void preRenderBeam(Tessellator tess, TileParticleGenerator gen, float f) { @@ -526,23 +524,22 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); - //float time = (float)tile.getWorldObj().getTotalWorldTime() + f; + // float time = (float)tile.getWorldObj().getTotalWorldTime() + f; float time = tile.rotation + f; float upMot = -time * 0.2F - (float) MathHelper.floor_float(-time * 0.1F); float rotValue = tile.beam_rotation * (tile.rotation + f * 0.5F); double rotation = rotValue; - tess.startDrawingQuads(); tess.setBrightness(200); tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32); double scale = (double) tile.beam_scale * 0.2D; - double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; //x point 1 - double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; //z point 1 - double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; //x point 2 - double d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale; //z point 2 - double d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale;//Dist from x-3 + double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; // x point 1 + double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; // z point 1 + double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; // x point 2 + double d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale; // z point 2 + double d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale; // Dist from x-3 double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale; double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale; double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale; @@ -610,8 +607,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { tess.draw(); GL11.glPushMatrix(); - //GL11.glTranslated(0, 0.4, 0); - //length -= 0.5F; + // GL11.glTranslated(0, 0.4, 0); + // length -= 0.5F; GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); @@ -656,13 +653,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); -// -// GL11.glEnable(GL11.GL_LIGHTING); -// GL11.glEnable(GL11.GL_TEXTURE_2D); + // + // GL11.glEnable(GL11.GL_LIGHTING); + // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); - } - - -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java index 845af836..d31f5be7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java @@ -20,8 +20,7 @@ import org.lwjgl.opengl.GL11; */ public class RenderTilePlacedItem extends TileEntitySpecialRenderer { - public RenderTilePlacedItem() { - } + public RenderTilePlacedItem() {} @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float timeSinceLastTick) { @@ -41,7 +40,7 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer { World world = Minecraft.getMinecraft().theWorld; EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, stack); int meta = world.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); - //itemEntity.getEntityItem().stackSize = 1; + // itemEntity.getEntityItem().stackSize = 1; itemEntity.hoverStart = 0.0F; boolean is3D = stack.getItem().isFull3D(); boolean isBlock = stack.getItem() instanceof ItemBlock; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java index 06f256ec..f173ba12 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java @@ -18,34 +18,34 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer { public static IModelCustom reactorModel; public RenderTileReactorCore() { - reactorModel = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + reactorModel = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) { TileReactorCore tile = (TileReactorCore) tileEntity; -// tile.renderList.clear(); + // tile.renderList.clear(); GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); renderReactorCore(tile, partialTick); -// for (MultiblockHelper.TileOffset offset : tile.stabilizerLocations){ -// if (!(offset.getTileEntity(tileEntity) instanceof TileReactorStabilizer)) continue; -// GL11.glPushMatrix(); -// -// TileReactorStabilizer stabilizer = (TileReactorStabilizer)offset.getTileEntity(tileEntity); -// GL11.glTranslated(-offset.offsetX, -offset.offsetY, -offset.offsetZ); -// //RenderTileReactorStabilizer.renderCore(stabilizer, partialTick); -// //RenderTileReactorStabilizer.renderEffects(stabilizer, partialTick); -// -// GL11.glPopMatrix(); -// } + // for (MultiblockHelper.TileOffset offset : tile.stabilizerLocations){ + // if (!(offset.getTileEntity(tileEntity) instanceof TileReactorStabilizer)) continue; + // GL11.glPushMatrix(); + // + // TileReactorStabilizer stabilizer = (TileReactorStabilizer)offset.getTileEntity(tileEntity); + // GL11.glTranslated(-offset.offsetX, -offset.offsetY, -offset.offsetZ); + // //RenderTileReactorStabilizer.renderCore(stabilizer, partialTick); + // //RenderTileReactorStabilizer.renderEffects(stabilizer, partialTick); + // + // GL11.glPopMatrix(); + // } GL11.glPopMatrix(); } - public void renderReactorCore(TileReactorCore tile, float partialTick) { float rotation = (tile.renderRotation * 0.2F) + (partialTick * (tile.renderSpeed * 0.2F)); double ff = tile.maxFieldCharge > 0 ? tile.fieldCharge / tile.maxFieldCharge : 0; @@ -54,14 +54,14 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer { double b = ff * 2; double a = ff < 0.1 ? (ff * 10) : 1; - //Pre Render + // Pre Render GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); float lastBrightnessX = OpenGlHelper.lastBrightnessX; float lastBrightnessY = OpenGlHelper.lastBrightnessY; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); - //Render inner + // Render inner if (tile.reactorFuel + tile.convertedFuel < 144) { ResourceHandler.bindResource("textures/blocks/draconic_block_blank.png"); GL11.glPushMatrix(); @@ -78,7 +78,7 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer { GL11.glScaled(r3, r3, r3); reactorModel.renderAll(); - //Mid Render + // Mid Render GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_ALPHA_TEST); @@ -91,7 +91,7 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer { reactorModel.renderAll(); } - //Render Outer + // Render Outer ResourceHandler.bindResource("textures/models/reactorShieldPlate.png"); GL11.glColor4d(r, g, b, a); GL11.glScaled(1.03F, 1.03F, 1.03F); @@ -99,12 +99,11 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer { GL11.glRotatef(-rotation * 2, 0.5F, 1F, 0.5F); reactorModel.renderAll(); - //Post Render + // Post Render GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1f, 1f, 1f, 1f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY); GL11.glPopMatrix(); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java index d6aed6b7..83bed45d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java @@ -50,5 +50,4 @@ public class RenderTileReactorEnergyInjector extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java index a060af52..ea957648 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java @@ -22,7 +22,7 @@ public class RenderTileReactorStabilizer extends TileEntitySpecialRenderer { GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); renderCore((TileReactorStabilizer) tileEntity, partialTick); - //renderEffects((TileReactorStabilizer) tileEntity, partialTick); + // renderEffects((TileReactorStabilizer) tileEntity, partialTick); GL11.glPopMatrix(); } @@ -62,71 +62,75 @@ public class RenderTileReactorStabilizer extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } -// public static void renderEffects(TileReactorStabilizer tile, float partialTick) { -// if (tile.isValid) -// { -// //Common Fields -// MultiblockHelper.TileLocation master = tile.masterLocation; -// float offsetX = (float)(master.posX - tile.xCoord); -// float offsetY = (float)((double)master.posY - tile.yCoord); -// float offsetZ = (float)(master.posZ - tile.zCoord); -// float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); -// -// Tessellator tessellator = Tessellator.instance; -// -// //Pre Render -// GL11.glPushMatrix(); -//// RenderHelper.disableStandardItemLighting(); -// GL11.glDisable(GL11.GL_CULL_FACE); -// GL11.glShadeModel(GL11.GL_SMOOTH); -// GL11.glEnable(GL11.GL_BLEND); -// OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); -// GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); -// GL11.glDisable(GL11.GL_LIGHTING); -// GL11.glDepthMask(false); -// -// //Rotate beam to face target -// float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); -// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); -// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); -// -// -// //Draw Beams -// GL11.glPushMatrix(); -// GL11.glTranslated(0, 0, -0.35); -// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); -//// drawBeam(tessellator, 1F, 0.355F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, false); -// GL11.glPopMatrix(); -// -// GL11.glPushMatrix(); -// GL11.glTranslated(0, 0, 0.4526); -// float coreSize = 1.1F; -// float s = 0.355F; -//// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, false, false); -// GL11.glPopMatrix(); -// -//// GL11.glPushMatrix(); -//// GL11.glTranslated(0, 0, -0.35); -//// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); -//// drawBeam(tessellator, 1F, 0.26F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, true); -//// GL11.glPopMatrix(); -//// -//// GL11.glPushMatrix(); -//// GL11.glTranslated(0, 0, 0.4526); -//// coreSize = 1.1F; -//// s = 0.263F; -//// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, false, true); -//// GL11.glPopMatrix(); -// -// //Post Render -// GL11.glDepthMask(true); -// GL11.glEnable(GL11.GL_LIGHTING); -// GL11.glEnable(GL11.GL_CULL_FACE); -// GL11.glShadeModel(GL11.GL_FLAT); -//// RenderHelper.enableStandardItemLighting(); -// GL11.glDisable(GL11.GL_BLEND); -// GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); -// GL11.glPopMatrix(); -// } -// } + // public static void renderEffects(TileReactorStabilizer tile, float partialTick) { + // if (tile.isValid) + // { + // //Common Fields + // MultiblockHelper.TileLocation master = tile.masterLocation; + // float offsetX = (float)(master.posX - tile.xCoord); + // float offsetY = (float)((double)master.posY - tile.yCoord); + // float offsetZ = (float)(master.posZ - tile.zCoord); + // float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); + // + // Tessellator tessellator = Tessellator.instance; + // + // //Pre Render + // GL11.glPushMatrix(); + //// RenderHelper.disableStandardItemLighting(); + // GL11.glDisable(GL11.GL_CULL_FACE); + // GL11.glShadeModel(GL11.GL_SMOOTH); + // GL11.glEnable(GL11.GL_BLEND); + // OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + // GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); + // GL11.glDisable(GL11.GL_LIGHTING); + // GL11.glDepthMask(false); + // + // //Rotate beam to face target + // float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); + // GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, + // 0.0F, 1.0F, 0.0F); + // GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, + // 0.0F); + // + // + // //Draw Beams + // GL11.glPushMatrix(); + // GL11.glTranslated(0, 0, -0.35); + // ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); + //// drawBeam(tessellator, 1F, 0.355F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, false); + // GL11.glPopMatrix(); + // + // GL11.glPushMatrix(); + // GL11.glTranslated(0, 0, 0.4526); + // float coreSize = 1.1F; + // float s = 0.355F; + //// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, + // false, false); + // GL11.glPopMatrix(); + // + //// GL11.glPushMatrix(); + //// GL11.glTranslated(0, 0, -0.35); + //// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); + //// drawBeam(tessellator, 1F, 0.26F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, true); + //// GL11.glPopMatrix(); + //// + //// GL11.glPushMatrix(); + //// GL11.glTranslated(0, 0, 0.4526); + //// coreSize = 1.1F; + //// s = 0.263F; + //// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, + // false, true); + //// GL11.glPopMatrix(); + // + // //Post Render + // GL11.glDepthMask(true); + // GL11.glEnable(GL11.GL_LIGHTING); + // GL11.glEnable(GL11.GL_CULL_FACE); + // GL11.glShadeModel(GL11.GL_FLAT); + //// RenderHelper.enableStandardItemLighting(); + // GL11.glDisable(GL11.GL_BLEND); + // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + // GL11.glPopMatrix(); + // } + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java index e0384ecc..b8afb123 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.client.render.tile; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.model.ModelTeleporterStand; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; +import java.awt.*; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -24,17 +25,15 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import java.awt.*; - /** * Created by Brandon on 25/10/2014. */ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { - ModelTeleporterStand model = new ModelTeleporterStand(); - private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/TeleporterStand.png"); + private final ResourceLocation texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/TeleporterStand.png"); @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { @@ -64,7 +63,6 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { GL11.glEnable(GL12.GL_RESCALE_NORMAL); if (item != null) renderItem(tileentity, item, f); GL11.glPopMatrix(); - } public void renderItem(TileEntity tile, ItemStack item, float f) { @@ -96,12 +94,15 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { private void drawNameString(ItemStack item, float rotation, TileEntity tileentity, float f) { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; MovingObjectPosition mop = player.rayTrace(10, f); - boolean isCursorOver = mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.blockX == tileentity.xCoord && mop.blockY == tileentity.yCoord && mop.blockZ == tileentity.zCoord; + boolean isCursorOver = mop != null + && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + && mop.blockX == tileentity.xCoord + && mop.blockY == tileentity.yCoord + && mop.blockZ == tileentity.zCoord; boolean isSneaking = player.isSneaking(); if (!isCursorOver && (isSneaking != ConfigHandler.invertDPDSB)) return; - String s = item.hasDisplayName() ? item.getDisplayName() : ""; if (item.getItem() instanceof TeleporterMKII) { short selected = ItemNBTHelper.getShort(item, "Selection", (short) 0); @@ -114,7 +115,6 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { } if (s.isEmpty()) return; - FontRenderer fontRenderer = RenderManager.instance.getFontRenderer(); Tessellator tess = Tessellator.instance; @@ -123,7 +123,6 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { GL11.glRotated(180, 0, 1, 0); GL11.glTranslated(0, -40, 0); - Point.Double p1 = new Point.Double(tileentity.xCoord + 0.5, tileentity.zCoord + 0.5); Point.Double p2 = new Point.Double(player.posX, player.posZ); @@ -131,7 +130,15 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { double yDiff = player.posY - (tileentity.yCoord + 0.5); double zDiff = player.posZ - (tileentity.zCoord + 0.5); double yawAngle = Math.toDegrees(Math.atan2(zDiff, xDiff)); - double pitchAngle = Math.toDegrees(Math.atan2(yDiff, Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, tileentity.xCoord + 0.5, tileentity.yCoord + 0.5, tileentity.zCoord + 0.5))); + double pitchAngle = Math.toDegrees(Math.atan2( + yDiff, + Utills.getDistanceAtoB( + player.posX, + player.posY, + player.posZ, + tileentity.xCoord + 0.5, + tileentity.yCoord + 0.5, + tileentity.zCoord + 0.5))); GL11.glRotated(yawAngle + 90 - rotation, 0, 1, 0); GL11.glRotated(-pitchAngle, 1, 0, 0); @@ -161,6 +168,5 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java index cc68146d..807c72fa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java @@ -16,14 +16,18 @@ import org.lwjgl.opengl.GL11; */ public class RenderTileTestBlock extends TileEntitySpecialRenderer { - private static final ResourceLocation iner_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png"); - private static final ResourceLocation outer_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png"); + private static final ResourceLocation iner_model_texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png"); + private static final ResourceLocation outer_model_texture = + new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png"); private IModelCustom iner_model; private IModelCustom outer_model; public RenderTileTestBlock() { - iner_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); - //outer_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_2.obj")); + iner_model = AdvancedModelLoader.loadModel( + new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); + // outer_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), + // "models/power_sphere_layer_2.obj")); } @Override @@ -34,7 +38,7 @@ public class RenderTileTestBlock extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); - //GL11.glDepthMask(false); + // GL11.glDepthMask(false); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); @@ -42,7 +46,7 @@ public class RenderTileTestBlock extends TileEntitySpecialRenderer { GL11.glPushMatrix(); GL11.glRotatef(((TileTestBlock) var1).modelRotation, 0F, 1F, 0.5F); - //GL11.glColor4f(2F, 2F, 2F, 1F); + // GL11.glColor4f(2F, 2F, 2F, 1F); iner_model.renderAll(); GL11.glPopMatrix(); @@ -58,7 +62,6 @@ public class RenderTileTestBlock extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); - GL11.glPopMatrix(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java index b3db407f..386286b8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java @@ -14,7 +14,6 @@ import org.lwjgl.opengl.GL11; public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer { - private static float pxl = 1F / 256F; @Override @@ -61,10 +60,8 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer { GL11.glPopMatrix(); - drawBase(tess); renderChargingItem(tile, pt); - } private void drawBase(Tessellator tess) { @@ -83,7 +80,6 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer { tess.addVertexWithUV(1, 0.0005D, 1, srcXMax, srcYMax); tess.addVertexWithUV(0, 0.0005D, 1, srcXMin, srcYMax); - srcXMin = 128D * pxl; srcYMin = 0D; srcXMax = 192D * pxl; @@ -121,10 +117,10 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer { tess.draw(); GL11.glPopMatrix(); - } - public static void render2DWithThicness(Tessellator tess, float maxU, float minV, float minU, float maxV, int width, int height, float thickness) { + public static void render2DWithThicness( + Tessellator tess, float maxU, float minV, float minU, float maxV, int width, int height, float thickness) { double pix = 1D / 64D; tess.startDrawingQuads(); tess.setNormal(0.0F, 0.0F, 1.0F); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java index 303c06d9..37b4247c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java @@ -27,7 +27,6 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.rea import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; -import com.brandon3055.draconicevolution.integration.ModHelper; import com.brandon3055.draconicevolution.integration.computers.CCOCIntegration; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -58,29 +57,29 @@ public class CommonProxy { registerOres(); DraconicEvolution.reaperEnchant = new EnchantmentReaper(ConfigHandler.reaperEnchantID); -// -// Potion[] potionTypes = null; -// LogHelper.info("Expanding Potion array size to 256"); -// -// for (Field f : Potion.class.getDeclaredFields()) { -// f.setAccessible(true); -// -// 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); -// potionTypes = (Potion[]) f.get(null); -// final Potion[] newPotionTypes = new Potion[256]; -// System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length); -// f.set(null, newPotionTypes); -// } -// } -// catch (Exception e) { -// LogHelper.error("Severe error, please report this to the mod author:"); -// e.printStackTrace(); -// } -// } + // + // Potion[] potionTypes = null; + // LogHelper.info("Expanding Potion array size to 256"); + // + // for (Field f : Potion.class.getDeclaredFields()) { + // f.setAccessible(true); + // + // 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); + // potionTypes = (Potion[]) f.get(null); + // final Potion[] newPotionTypes = new Potion[256]; + // System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length); + // f.set(null, newPotionTypes); + // } + // } + // catch (Exception e) { + // LogHelper.error("Severe error, please report this to the mod author:"); + // e.printStackTrace(); + // } + // } Achievements.addModAchievements(); LogHelper.info("Finished PreInitialization"); @@ -109,63 +108,95 @@ public class CommonProxy { public void initializeNetwork() { DraconicEvolution.network = NetworkRegistry.INSTANCE.newSimpleChannel(DraconicEvolution.networkChannelName); DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER); - DraconicEvolution.network.registerMessage(ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER); - DraconicEvolution.network.registerMessage(PlacedItemPacket.Handler.class, PlacedItemPacket.class, 2, Side.SERVER); - DraconicEvolution.network.registerMessage(PlayerDetectorButtonPacket.Handler.class, PlayerDetectorButtonPacket.class, 3, Side.SERVER); - DraconicEvolution.network.registerMessage(PlayerDetectorStringPacket.Handler.class, PlayerDetectorStringPacket.class, 4, Side.SERVER); - DraconicEvolution.network.registerMessage(TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER); - DraconicEvolution.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 6, Side.CLIENT); - DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT); - DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER); - DraconicEvolution.network.registerMessage(ItemConfigPacket.Handler.class, ItemConfigPacket.class, 9, Side.SERVER); - DraconicEvolution.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 10, Side.SERVER); - DraconicEvolution.network.registerMessage(BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER); - DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER); - DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT); + DraconicEvolution.network.registerMessage( + ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER); + DraconicEvolution.network.registerMessage( + PlacedItemPacket.Handler.class, PlacedItemPacket.class, 2, Side.SERVER); + DraconicEvolution.network.registerMessage( + PlayerDetectorButtonPacket.Handler.class, PlayerDetectorButtonPacket.class, 3, Side.SERVER); + DraconicEvolution.network.registerMessage( + PlayerDetectorStringPacket.Handler.class, PlayerDetectorStringPacket.class, 4, Side.SERVER); + DraconicEvolution.network.registerMessage( + TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER); + DraconicEvolution.network.registerMessage( + TileObjectPacket.Handler.class, TileObjectPacket.class, 6, Side.CLIENT); + DraconicEvolution.network.registerMessage( + MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT); + DraconicEvolution.network.registerMessage( + MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER); + DraconicEvolution.network.registerMessage( + ItemConfigPacket.Handler.class, ItemConfigPacket.class, 9, Side.SERVER); + DraconicEvolution.network.registerMessage( + TileObjectPacket.Handler.class, TileObjectPacket.class, 10, Side.SERVER); + DraconicEvolution.network.registerMessage( + BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER); + DraconicEvolution.network.registerMessage( + SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER); + DraconicEvolution.network.registerMessage( + SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT); DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER); - DraconicEvolution.network.registerMessage(GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT); - DraconicEvolution.network.registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT); - DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT); - DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER); - DraconicEvolution.network.registerMessage(MagnetTogglePacket.Handler.class, MagnetTogglePacket.class, 19, Side.SERVER); - DraconicEvolution.network.registerMessage(MagnetToggleAckPacket.Handler.class, MagnetToggleAckPacket.class, 20, Side.CLIENT); + DraconicEvolution.network.registerMessage( + GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT); + DraconicEvolution.network.registerMessage( + ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT); + DraconicEvolution.network.registerMessage( + ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT); + DraconicEvolution.network.registerMessage( + ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER); + DraconicEvolution.network.registerMessage( + MagnetTogglePacket.Handler.class, MagnetTogglePacket.class, 19, Side.SERVER); + DraconicEvolution.network.registerMessage( + MagnetToggleAckPacket.Handler.class, MagnetToggleAckPacket.class, 20, Side.CLIENT); } public void registerTileEntities() { - GameRegistry.registerTileEntity(TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController"); + GameRegistry.registerTileEntity( + TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController"); GameRegistry.registerTileEntity(TileSunDial.class, References.RESOURCESPREFIX + "TileSunDial"); GameRegistry.registerTileEntity(TileGrinder.class, References.RESOURCESPREFIX + "TileGrinder"); GameRegistry.registerTileEntity(TilePotentiometer.class, References.RESOURCESPREFIX + "TilePotentiometer"); - GameRegistry.registerTileEntity(TileParticleGenerator.class, References.RESOURCESPREFIX + "TileParticleGenerator"); + GameRegistry.registerTileEntity( + TileParticleGenerator.class, References.RESOURCESPREFIX + "TileParticleGenerator"); GameRegistry.registerTileEntity(TilePlayerDetector.class, References.RESOURCESPREFIX + "TilePlayerDetector"); - GameRegistry.registerTileEntity(TilePlayerDetectorAdvanced.class, References.RESOURCESPREFIX + "TilePlayerDetectorAdvanced"); + GameRegistry.registerTileEntity( + TilePlayerDetectorAdvanced.class, References.RESOURCESPREFIX + "TilePlayerDetectorAdvanced"); GameRegistry.registerTileEntity(TileEnergyInfuser.class, References.RESOURCESPREFIX + "TileEnergyInfuser"); GameRegistry.registerTileEntity(TileCustomSpawner.class, References.RESOURCESPREFIX + "TileCustomSpawner"); GameRegistry.registerTileEntity(TileGenerator.class, References.RESOURCESPREFIX + "TileGenerator"); - GameRegistry.registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore"); - GameRegistry.registerTileEntity(TileInvisibleMultiblock.class, References.RESOURCESPREFIX + "TileInvisibleMultiblock"); + GameRegistry.registerTileEntity( + TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore"); + GameRegistry.registerTileEntity( + TileInvisibleMultiblock.class, References.RESOURCESPREFIX + "TileInvisibleMultiblock"); GameRegistry.registerTileEntity(TileEnergyPylon.class, References.RESOURCESPREFIX + "TileEnergyPylon"); - GameRegistry.registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection"); + GameRegistry.registerTileEntity( + TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection"); GameRegistry.registerTileEntity(TilePlacedItem.class, References.RESOURCESPREFIX + "TilePlacedItem"); GameRegistry.registerTileEntity(TileCKeyStone.class, References.RESOURCESPREFIX + "TileCKeyStone"); GameRegistry.registerTileEntity(TileDissEnchanter.class, References.RESOURCESPREFIX + "TileDissEnchanter"); GameRegistry.registerTileEntity(TileTeleporterStand.class, References.RESOURCESPREFIX + "TileTeleporterStand"); GameRegistry.registerTileEntity(TileDraconiumChest.class, References.RESOURCESPREFIX + "TileDraconiumChest"); GameRegistry.registerTileEntity(TileEnergyRelay.class, References.RESOURCESPREFIX + "TileEnergyRelay"); - GameRegistry.registerTileEntity(TileEnergyTransceiver.class, References.RESOURCESPREFIX + "TileEnergyTransceiver"); - GameRegistry.registerTileEntity(TileWirelessEnergyTransceiver.class, References.RESOURCESPREFIX + "TileWirelessEnergyTransceiver"); - GameRegistry.registerTileEntity(TileDislocatorReceptacle.class, References.RESOURCESPREFIX + "TileDislocatorReceptacle"); + GameRegistry.registerTileEntity( + TileEnergyTransceiver.class, References.RESOURCESPREFIX + "TileEnergyTransceiver"); + GameRegistry.registerTileEntity( + TileWirelessEnergyTransceiver.class, References.RESOURCESPREFIX + "TileWirelessEnergyTransceiver"); + GameRegistry.registerTileEntity( + TileDislocatorReceptacle.class, References.RESOURCESPREFIX + "TileDislocatorReceptacle"); GameRegistry.registerTileEntity(TilePortalBlock.class, References.RESOURCESPREFIX + "TilePortalBlock"); GameRegistry.registerTileEntity(TileReactorCore.class, References.RESOURCESPREFIX + "TileReactorCore"); GameRegistry.registerTileEntity(TileFluxGate.class, References.RESOURCESPREFIX + "TileFluxGate"); GameRegistry.registerTileEntity(TileFluidGate.class, References.RESOURCESPREFIX + "TileFluidGate"); - GameRegistry.registerTileEntity(TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer"); - GameRegistry.registerTileEntity(TileReactorEnergyInjector.class, References.RESOURCESPREFIX + "TileReactorEnergyInjector"); + GameRegistry.registerTileEntity( + TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer"); + GameRegistry.registerTileEntity( + TileReactorEnergyInjector.class, References.RESOURCESPREFIX + "TileReactorEnergyInjector"); GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard"); - GameRegistry.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier"); + GameRegistry.registerTileEntity( + TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier"); if (DraconicEvolution.debug) { GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock"); - GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate"); + GameRegistry.registerTileEntity( + TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate"); } } @@ -204,28 +235,59 @@ public class CommonProxy { } } - //@Callback + // @Callback public void registerEntities() { - EntityRegistry.registerModEntity(EntityCustomDragon.class, "EnderDragon", 0, DraconicEvolution.instance, 256, 3, true); - EntityRegistry.registerModEntity(EntityPersistentItem.class, "Persistent Item", 1, DraconicEvolution.instance, 32, 5, true); - EntityRegistry.registerModEntity(EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true); - EntityRegistry.registerModEntity(EntityEnderArrow.class, "Ender Arrow", 3, DraconicEvolution.instance, 32, 1, true); - //EntityRegistry.registerModEntity(EntityChaosDrill.class, "Chaos Drill", 4, DraconicEvolution.instance, 10, 5, false); - EntityRegistry.registerModEntity(EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true); - EntityRegistry.registerModEntity(EntityChaosGuardian.class, "ChaosGuardian", 6, DraconicEvolution.instance, 256, 1, true); - EntityRegistry.registerModEntity(EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true); - EntityRegistry.registerModEntity(EntityChaosCrystal.class, "ChaosCrystal", 8, DraconicEvolution.instance, 256, 5, false); - EntityRegistry.registerModEntity(EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true); - EntityRegistry.registerModEntity(EntityChaosVortex.class, "EntityChaosEnergyVortex", 10, DraconicEvolution.instance, 512, 5, true); - EntityRegistry.registerModEntity(EntityCustomArrow.class, "CustomArrow", 11, DraconicEvolution.instance, 128, 1, true); - + EntityRegistry.registerModEntity( + EntityCustomDragon.class, "EnderDragon", 0, DraconicEvolution.instance, 256, 3, true); + EntityRegistry.registerModEntity( + EntityPersistentItem.class, "Persistent Item", 1, DraconicEvolution.instance, 32, 5, true); + EntityRegistry.registerModEntity( + EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true); + EntityRegistry.registerModEntity( + EntityEnderArrow.class, "Ender Arrow", 3, DraconicEvolution.instance, 32, 1, true); + // EntityRegistry.registerModEntity(EntityChaosDrill.class, "Chaos Drill", 4, DraconicEvolution.instance, 10, 5, + // false); + EntityRegistry.registerModEntity( + EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true); + EntityRegistry.registerModEntity( + EntityChaosGuardian.class, "ChaosGuardian", 6, DraconicEvolution.instance, 256, 1, true); + EntityRegistry.registerModEntity( + EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true); + EntityRegistry.registerModEntity( + EntityChaosCrystal.class, "ChaosCrystal", 8, DraconicEvolution.instance, 256, 5, false); + EntityRegistry.registerModEntity( + EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true); + EntityRegistry.registerModEntity( + EntityChaosVortex.class, "EntityChaosEnergyVortex", 10, DraconicEvolution.instance, 512, 5, true); + EntityRegistry.registerModEntity( + EntityCustomArrow.class, "CustomArrow", 11, DraconicEvolution.instance, 128, 1, true); } - public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType) { + public ParticleEnergyBeam energyBeam( + World worldObj, + double x, + double y, + double z, + double tx, + double ty, + double tz, + int powerFlow, + boolean advanced, + ParticleEnergyBeam oldBeam, + boolean render, + int beamType) { return null; } - public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, ParticleEnergyField oldBeam, boolean render) { + public ParticleEnergyField energyField( + World worldObj, + double x, + double y, + double z, + int type, + boolean advanced, + ParticleEnergyField oldBeam, + boolean render) { return null; } @@ -233,12 +295,9 @@ public class CommonProxy { return null; } - public void spawnParticle(Object particle, int range) { - - } + public void spawnParticle(Object particle, int range) {} public ISound playISound(ISound sound) { return null; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java b/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java index 5a1af918..dd624912 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java @@ -50,7 +50,9 @@ public class ModBlocks { public static BlockDE chaosCrystal; public static BlockDE upgradeModifier; public static Block safetyFlame; - public static Block chaosShardAtmos = new ChaosShardAtmos().setBlockName(References.RESOURCESPREFIX + "chaosShardAtmos").setBlockTextureName(References.RESOURCESPREFIX + "transparency"); + public static Block chaosShardAtmos = new ChaosShardAtmos() + .setBlockName(References.RESOURCESPREFIX + "chaosShardAtmos") + .setBlockTextureName(References.RESOURCESPREFIX + "transparency"); public static ItemStack resurrectionStone; @@ -113,7 +115,8 @@ public class ModBlocks { } public static void registerOther(Block block) { - String name = block.getUnlocalizedName().substring(block.getUnlocalizedName().indexOf(".") + 1); + String name = + block.getUnlocalizedName().substring(block.getUnlocalizedName().indexOf(".") + 1); if (isEnabled(block)) GameRegistry.registerBlock(block, name.substring(name.indexOf(":") + 1)); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java b/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java index 7a20f363..45794163 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java @@ -21,8 +21,10 @@ import net.minecraftforge.common.util.EnumHelper; @GameRegistry.ObjectHolder(References.MODID) public class ModItems { - public static ArmorMaterial WYVERN_ARMOR = EnumHelper.addArmorMaterial("WYVERN_ARMOR", -1, new int[]{3, 8, 6, 3}, 30); - public static ArmorMaterial DRACONIC_ARMOR = EnumHelper.addArmorMaterial("DRACONIC_ARMOR", -1, new int[]{3, 8, 6, 3}, 30); + public static ArmorMaterial WYVERN_ARMOR = + EnumHelper.addArmorMaterial("WYVERN_ARMOR", -1, new int[] {3, 8, 6, 3}, 30); + public static ArmorMaterial DRACONIC_ARMOR = + EnumHelper.addArmorMaterial("DRACONIC_ARMOR", -1, new int[] {3, 8, 6, 3}, 30); public static ToolMaterial WYVERN = EnumHelper.addToolMaterial("WYVERN", 10, -1, 12.0F, 20.0F, 35); public static ToolMaterial AWAKENED = EnumHelper.addToolMaterial("AWAKENED", 10, -1, 16.0F, 40.0F, 40); public static ToolMaterial CHAOTIC = EnumHelper.addToolMaterial("CHAOTIC", 10, -1, 400.0F, 60.0F, 45); @@ -147,7 +149,7 @@ public class ModItems { dezilsMarshmallow = new DezilsMarshmallow(); - //Custom ItemStacks + // Custom ItemStacks wyvernEnergyCore = new ItemStack(ModItems.draconiumEnergyCore, 1, 0); draconicEnergyCore = new ItemStack(ModItems.draconiumEnergyCore, 1, 1); wyvernFluxCapacitor = new ItemStack(ModItems.draconiumFluxCapacitor, 1, 0); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java b/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java index 4f3b704f..6ca9405a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java @@ -1,10 +1,11 @@ package com.brandon3055.draconicevolution.common.achievements; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; +import java.util.HashMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; @@ -12,8 +13,6 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.AchievementPage; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; -import java.util.HashMap; - /** * Created by Brandon on 18/11/2014. */ @@ -52,62 +51,406 @@ public class Achievements { public static void addModAchievements() { int x = 5; - addAchievement("draconicevolution.dust", new Achievement("draconicevolution.dust", "draconicevolution.dust", -10 + x, 0, ModItems.draconiumDust, null).initIndependentStat().setSpecial(), "pickup"); - addAchievement("draconicevolution.ingot", new Achievement("draconicevolution.ingot", "draconicevolution.ingot", -8 + x, 0, ModItems.draconiumIngot, getAchievement("draconicevolution.dust")), "smelt"); - addAchievement("draconicevolution.core", new Achievement("draconicevolution.core", "draconicevolution.core", -6 + x, 0, ModItems.draconicCore, getAchievement("draconicevolution.ingot")), "craft"); - addAchievement("draconicevolution.core2", new Achievement("draconicevolution.core2", "draconicevolution.core2", -4 + x, 0, ModItems.wyvernCore, getAchievement("draconicevolution.core")).setSpecial(), "craft"); + addAchievement( + "draconicevolution.dust", + new Achievement( + "draconicevolution.dust", + "draconicevolution.dust", + -10 + x, + 0, + ModItems.draconiumDust, + null) + .initIndependentStat() + .setSpecial(), + "pickup"); + addAchievement( + "draconicevolution.ingot", + new Achievement( + "draconicevolution.ingot", + "draconicevolution.ingot", + -8 + x, + 0, + ModItems.draconiumIngot, + getAchievement("draconicevolution.dust")), + "smelt"); + addAchievement( + "draconicevolution.core", + new Achievement( + "draconicevolution.core", + "draconicevolution.core", + -6 + x, + 0, + ModItems.draconicCore, + getAchievement("draconicevolution.ingot")), + "craft"); + addAchievement( + "draconicevolution.core2", + new Achievement( + "draconicevolution.core2", + "draconicevolution.core2", + -4 + x, + 0, + ModItems.wyvernCore, + getAchievement("draconicevolution.core")) + .setSpecial(), + "craft"); - addAchievement("draconicevolution.dislocator", new Achievement("draconicevolution.dislocator", "draconicevolution.dislocator", -8 + x, 1, ModItems.teleporterMKI, getAchievement("draconicevolution.dust")), "craft"); - addAchievement("draconicevolution.chest", new Achievement("draconicevolution.chest", "draconicevolution.chest", -5 + x, 2, ModBlocks.draconiumChest, getAchievement("draconicevolution.core")), "craft"); - addAchievement("draconicevolution.particles", new Achievement("draconicevolution.particles", "draconicevolution.particles", -7 + x, 2, ModBlocks.particleGenerator, getAchievement("draconicevolution.core")), "craft"); - addAchievement("draconicevolution.weather", new Achievement("draconicevolution.weather", "draconicevolution.weather", -5 + x, -2, ModBlocks.weatherController, getAchievement("draconicevolution.core")), "craft"); - addAchievement("draconicevolution.dissenchanter", new Achievement("draconicevolution.dissenchanter", "draconicevolution.dissenchanter", -7 + x, -2, ModBlocks.dissEnchanter, getAchievement("draconicevolution.core")), "craft"); - addAchievement("draconicevolution.ecore", new Achievement("draconicevolution.ecore", "draconicevolution.ecore", -4 + x, -6, ModBlocks.energyStorageCore, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.wpick", new Achievement("draconicevolution.wpick", "draconicevolution.wpick", -2 + x, 1, ModItems.wyvernPickaxe, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.wshovel", new Achievement("draconicevolution.wshovel", "draconicevolution.wshovel", -2 + x, -1, ModItems.wyvernShovel, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.wsword", new Achievement("draconicevolution.wsword", "draconicevolution.wsword", -2 + x, 2, ModItems.wyvernSword, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.wbow", new Achievement("draconicevolution.wbow", "draconicevolution.wbow", -2 + x, -2, ModItems.wyvernBow, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.whelm", new Achievement("draconicevolution.whelm", "draconicevolution.whelm", -2 + x, -4, ModItems.wyvernHelm, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.wchest", new Achievement("draconicevolution.wchest", "draconicevolution.wchest", -2 + x, -3, ModItems.wyvernChest, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.wleggs", new Achievement("draconicevolution.wleggs", "draconicevolution.wleggs", -2 + x, 3, ModItems.wyvernLeggs, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.wboots", new Achievement("draconicevolution.wboots", "draconicevolution.wboots", -2 + x, 4, ModItems.wyvernBoots, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.resurrection", new Achievement("draconicevolution.resurrection", "draconicevolution.resurrection", -4 + x, 6, ModBlocks.resurrectionStone, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.dislocator2", new Achievement("draconicevolution.dislocator2", "draconicevolution.dislocator2", -2 + x, -5, ModItems.teleporterMKII, getAchievement("draconicevolution.core2")), "craft"); - addAchievement("draconicevolution.flux", new Achievement("draconicevolution.flux", "draconicevolution.flux", -2 + x, 5, ModItems.wyvernFluxCapacitor, getAchievement("draconicevolution.core2")), "craft"); + addAchievement( + "draconicevolution.dislocator", + new Achievement( + "draconicevolution.dislocator", + "draconicevolution.dislocator", + -8 + x, + 1, + ModItems.teleporterMKI, + getAchievement("draconicevolution.dust")), + "craft"); + addAchievement( + "draconicevolution.chest", + new Achievement( + "draconicevolution.chest", + "draconicevolution.chest", + -5 + x, + 2, + ModBlocks.draconiumChest, + getAchievement("draconicevolution.core")), + "craft"); + addAchievement( + "draconicevolution.particles", + new Achievement( + "draconicevolution.particles", + "draconicevolution.particles", + -7 + x, + 2, + ModBlocks.particleGenerator, + getAchievement("draconicevolution.core")), + "craft"); + addAchievement( + "draconicevolution.weather", + new Achievement( + "draconicevolution.weather", + "draconicevolution.weather", + -5 + x, + -2, + ModBlocks.weatherController, + getAchievement("draconicevolution.core")), + "craft"); + addAchievement( + "draconicevolution.dissenchanter", + new Achievement( + "draconicevolution.dissenchanter", + "draconicevolution.dissenchanter", + -7 + x, + -2, + ModBlocks.dissEnchanter, + getAchievement("draconicevolution.core")), + "craft"); + addAchievement( + "draconicevolution.ecore", + new Achievement( + "draconicevolution.ecore", + "draconicevolution.ecore", + -4 + x, + -6, + ModBlocks.energyStorageCore, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.wpick", + new Achievement( + "draconicevolution.wpick", + "draconicevolution.wpick", + -2 + x, + 1, + ModItems.wyvernPickaxe, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.wshovel", + new Achievement( + "draconicevolution.wshovel", + "draconicevolution.wshovel", + -2 + x, + -1, + ModItems.wyvernShovel, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.wsword", + new Achievement( + "draconicevolution.wsword", + "draconicevolution.wsword", + -2 + x, + 2, + ModItems.wyvernSword, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.wbow", + new Achievement( + "draconicevolution.wbow", + "draconicevolution.wbow", + -2 + x, + -2, + ModItems.wyvernBow, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.whelm", + new Achievement( + "draconicevolution.whelm", + "draconicevolution.whelm", + -2 + x, + -4, + ModItems.wyvernHelm, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.wchest", + new Achievement( + "draconicevolution.wchest", + "draconicevolution.wchest", + -2 + x, + -3, + ModItems.wyvernChest, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.wleggs", + new Achievement( + "draconicevolution.wleggs", + "draconicevolution.wleggs", + -2 + x, + 3, + ModItems.wyvernLeggs, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.wboots", + new Achievement( + "draconicevolution.wboots", + "draconicevolution.wboots", + -2 + x, + 4, + ModItems.wyvernBoots, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.resurrection", + new Achievement( + "draconicevolution.resurrection", + "draconicevolution.resurrection", + -4 + x, + 6, + ModBlocks.resurrectionStone, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.dislocator2", + new Achievement( + "draconicevolution.dislocator2", + "draconicevolution.dislocator2", + -2 + x, + -5, + ModItems.teleporterMKII, + getAchievement("draconicevolution.core2")), + "craft"); + addAchievement( + "draconicevolution.flux", + new Achievement( + "draconicevolution.flux", + "draconicevolution.flux", + -2 + x, + 5, + ModItems.wyvernFluxCapacitor, + getAchievement("draconicevolution.core2")), + "craft"); - addAchievement("draconicevolution.heart", new Achievement("draconicevolution.heart", "draconicevolution.heart", 0 + x, 0, ModItems.dragonHeart, getAchievement("draconicevolution.core2")).setSpecial(), "pickup"); - addAchievement("draconicevolution.awakenedblock", new Achievement("draconicevolution.awakenedblock", "draconicevolution.awakenedblock", 2 + x, 0, ModBlocks.draconicBlock, getAchievement("draconicevolution.heart")), "pickup"); - addAchievement("draconicevolution.core3", new Achievement("draconicevolution.core3", "draconicevolution.core3", 4 + x, 0, ModItems.awakenedCore, getAchievement("draconicevolution.awakenedblock")).setSpecial(), "craft"); + addAchievement( + "draconicevolution.heart", + new Achievement( + "draconicevolution.heart", + "draconicevolution.heart", + 0 + x, + 0, + ModItems.dragonHeart, + getAchievement("draconicevolution.core2")) + .setSpecial(), + "pickup"); + addAchievement( + "draconicevolution.awakenedblock", + new Achievement( + "draconicevolution.awakenedblock", + "draconicevolution.awakenedblock", + 2 + x, + 0, + ModBlocks.draconicBlock, + getAchievement("draconicevolution.heart")), + "pickup"); + addAchievement( + "draconicevolution.core3", + new Achievement( + "draconicevolution.core3", + "draconicevolution.core3", + 4 + x, + 0, + ModItems.awakenedCore, + getAchievement("draconicevolution.awakenedblock")) + .setSpecial(), + "craft"); - addAchievement("draconicevolution.dhelm", new Achievement("draconicevolution.dhelm", "draconicevolution.dhelm", 2 + x, -3, ModItems.draconicHelm, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.dChest", new Achievement("draconicevolution.dChest", "draconicevolution.dChest", 2 + x, -2, ModItems.draconicChest, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.dleggs", new Achievement("draconicevolution.dleggs", "draconicevolution.dleggs", 2 + x, 2, ModItems.draconicLeggs, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.dboots", new Achievement("draconicevolution.dboots", "draconicevolution.dboots", 2 + x, 3, ModItems.draconicBoots, getAchievement("draconicevolution.core3")), "craft"); + addAchievement( + "draconicevolution.dhelm", + new Achievement( + "draconicevolution.dhelm", + "draconicevolution.dhelm", + 2 + x, + -3, + ModItems.draconicHelm, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.dChest", + new Achievement( + "draconicevolution.dChest", + "draconicevolution.dChest", + 2 + x, + -2, + ModItems.draconicChest, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.dleggs", + new Achievement( + "draconicevolution.dleggs", + "draconicevolution.dleggs", + 2 + x, + 2, + ModItems.draconicLeggs, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.dboots", + new Achievement( + "draconicevolution.dboots", + "draconicevolution.dboots", + 2 + x, + 3, + ModItems.draconicBoots, + getAchievement("draconicevolution.core3")), + "craft"); - addAchievement("draconicevolution.dpick", new Achievement("draconicevolution.dpick", "draconicevolution.dpick", 6 + x, 0, ModItems.draconicPickaxe, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.dshovel", new Achievement("draconicevolution.dshovel", "draconicevolution.dshovel", 6 + x, -1, ModItems.draconicShovel, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.daxe", new Achievement("draconicevolution.daxe", "draconicevolution.daxe", 6 + x, 1, ModItems.draconicAxe, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.dsword", new Achievement("draconicevolution.dsword", "draconicevolution.dsword", 6 + x, -2, ModItems.draconicSword, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.dbow", new Achievement("draconicevolution.dbow", "draconicevolution.dbow", 6 + x, 2, ModItems.draconicBow, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.flux2", new Achievement("draconicevolution.flux2", "draconicevolution.flux2", 6 + x, -3, ModItems.draconicFluxCapacitor, getAchievement("draconicevolution.core3")), "craft"); - addAchievement("draconicevolution.dhoe", new Achievement("draconicevolution.dhoe", "draconicevolution.dhoe", 6 + x, 3, ModItems.draconicHoe, getAchievement("draconicevolution.core3")), "craft"); + addAchievement( + "draconicevolution.dpick", + new Achievement( + "draconicevolution.dpick", + "draconicevolution.dpick", + 6 + x, + 0, + ModItems.draconicPickaxe, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.dshovel", + new Achievement( + "draconicevolution.dshovel", + "draconicevolution.dshovel", + 6 + x, + -1, + ModItems.draconicShovel, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.daxe", + new Achievement( + "draconicevolution.daxe", + "draconicevolution.daxe", + 6 + x, + 1, + ModItems.draconicAxe, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.dsword", + new Achievement( + "draconicevolution.dsword", + "draconicevolution.dsword", + 6 + x, + -2, + ModItems.draconicSword, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.dbow", + new Achievement( + "draconicevolution.dbow", + "draconicevolution.dbow", + 6 + x, + 2, + ModItems.draconicBow, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.flux2", + new Achievement( + "draconicevolution.flux2", + "draconicevolution.flux2", + 6 + x, + -3, + ModItems.draconicFluxCapacitor, + getAchievement("draconicevolution.core3")), + "craft"); + addAchievement( + "draconicevolution.dhoe", + new Achievement( + "draconicevolution.dhoe", + "draconicevolution.dhoe", + 6 + x, + 3, + ModItems.draconicHoe, + getAchievement("draconicevolution.core3")), + "craft"); - addAchievement("draconicevolution.dstaff", new Achievement("draconicevolution.dstaff", "draconicevolution.dstaff", 8 + x, 0, ModItems.draconicDestructionStaff, getAchievement("draconicevolution.dpick")).setSpecial(), "craft"); + addAchievement( + "draconicevolution.dstaff", + new Achievement( + "draconicevolution.dstaff", + "draconicevolution.dstaff", + 8 + x, + 0, + ModItems.draconicDestructionStaff, + getAchievement("draconicevolution.dpick")) + .setSpecial(), + "craft"); ItemStack mobSoul = new ItemStack(ModItems.mobSoul); ItemNBTHelper.setString(mobSoul, "Name", "Any"); - addAchievement("draconicevolution.soul", new Achievement("draconicevolution.soul", "draconicevolution.soul", 0 + x, -2, mobSoul, null).initIndependentStat(), "null"); - //if (ConfigHandler.disableSunDial == 0)addAchievement("draconicevolution.sundial", new Achievement("draconicevolution.sundial", "draconicevolution.sundial", 4+x, -4, ModBlocks.sunDial, getAchievement("draconicevolution.core3")).setSpecial(), "craft"); - addAchievement("draconicevolution.manual", new Achievement("draconicevolution.manual", "draconicevolution.manual", -8 + x, -1, ModItems.infoTablet, getAchievement("draconicevolution.dust")), "craft"); - + addAchievement( + "draconicevolution.soul", + new Achievement("draconicevolution.soul", "draconicevolution.soul", 0 + x, -2, mobSoul, null) + .initIndependentStat(), + "null"); + // if (ConfigHandler.disableSunDial == 0)addAchievement("draconicevolution.sundial", new + // Achievement("draconicevolution.sundial", "draconicevolution.sundial", 4+x, -4, ModBlocks.sunDial, + // getAchievement("draconicevolution.core3")).setSpecial(), "craft"); + addAchievement( + "draconicevolution.manual", + new Achievement( + "draconicevolution.manual", + "draconicevolution.manual", + -8 + x, + -1, + ModItems.infoTablet, + getAchievement("draconicevolution.dust")), + "craft"); } - public static void registerAchievementPane() { Achievement[] achievements = new Achievement[achievementsList.size()]; achievements = achievementsList.values().toArray(achievements); - achievementsPage = new AchievementPage(StatCollector.translateToLocal("draconicevolution.achievementPage.name"), achievements); + achievementsPage = new AchievementPage( + StatCollector.translateToLocal("draconicevolution.achievementPage.name"), achievements); AchievementPage.registerAchievementPage(achievementsPage); } @@ -115,8 +458,11 @@ public class Achievements { public void entityPickupEvent(EntityItemPickupEvent event) { ItemStack stack = event.item.getEntityItem().copy(); stack.stackSize = 1; - if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("pickup")) { - triggerAchievement(event.entityPlayer, achievementItems.get(stack.getUnlocalizedName()).getName()); + if (achievementItems.containsKey(stack.getUnlocalizedName()) + && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("pickup")) { + triggerAchievement( + event.entityPlayer, + achievementItems.get(stack.getUnlocalizedName()).getName()); } } @@ -124,8 +470,11 @@ public class Achievements { public void craftEvent(PlayerEvent.ItemCraftedEvent event) { ItemStack stack = event.crafting.copy(); stack.stackSize = 1; - if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("craft")) { - triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); + if (achievementItems.containsKey(stack.getUnlocalizedName()) + && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("craft")) { + triggerAchievement( + event.player, + achievementItems.get(stack.getUnlocalizedName()).getName()); } } @@ -133,8 +482,11 @@ public class Achievements { public void smeltEvent(PlayerEvent.ItemSmeltedEvent event) { ItemStack stack = event.smelting.copy(); stack.stackSize = 1; - if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("smelt")) { - triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); + if (achievementItems.containsKey(stack.getUnlocalizedName()) + && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("smelt")) { + triggerAchievement( + event.player, + achievementItems.get(stack.getUnlocalizedName()).getName()); } } @@ -155,5 +507,4 @@ public class Achievements { return name; } } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java index 97dce033..2377d57f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java @@ -45,9 +45,11 @@ public class BlockContainerTemplate extends BlockContainerDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_CONTAINER_TEMPLATE, world, x, y, z); + FMLNetworkHandler.openGui( + player, DraconicEvolution.instance, GuiHandler.GUIID_CONTAINER_TEMPLATE, world, x, y, z); } return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java index 66591ce8..41dbae8c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java @@ -2,6 +2,8 @@ package com.brandon3055.draconicevolution.common.blocks; import com.brandon3055.brandonscore.common.utills.InventoryUtils; import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -9,9 +11,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 13/11/2014. */ @@ -57,8 +56,7 @@ public abstract class BlockCustomDrop extends BlockContainerDE { if (result) { List teDrops = Lists.newArrayList(); getCustomDrops(te, teDrops); - for (ItemStack drop : teDrops) - dropBlockAsItem(world, x, y, z, drop); + for (ItemStack drop : teDrops) dropBlockAsItem(world, x, y, z, drop); } return result; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java index 7c8947ea..c7469d05 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java @@ -23,7 +23,9 @@ public class BlockDE extends Block { @Override public String getUnlocalizedName() { - return String.format("tile.%s%s", References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + return String.format( + "tile.%s%s", + References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } public String getUnwrappedUnlocalizedName(String unlocalizedName) { @@ -33,7 +35,7 @@ public class BlockDE extends Block { @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { - this.blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + this.blockIcon = iconRegister.registerIcon( + References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java index 69245f40..46442398 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java @@ -1,10 +1,10 @@ package com.brandon3055.draconicevolution.common.blocks; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.CKeyStoneItemBlock; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.CKeyStoneItemBlock; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone; @@ -34,7 +34,6 @@ public class CKeyStone extends BlockDE { ModBlocks.register(this, CKeyStoneItemBlock.class); } - @Override public boolean hasTileEntity(int metadata) { return true; @@ -62,14 +61,29 @@ public class CKeyStone extends BlockDE { @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { if (side == 0 || side == 1) return Blocks.furnace.getIcon(side, 0); - TileCKeyStone tile = world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; + TileCKeyStone tile = + world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone + ? (TileCKeyStone) world.getTileEntity(x, y, z) + : null; if (tile != null) return tile.isActivated ? blockIcon1 : blockIcon; else return blockIcon; } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - TileCKeyStone tile = world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + TileCKeyStone tile = + world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone + ? (TileCKeyStone) world.getTileEntity(x, y, z) + : null; if (tile != null) return tile.onActivated(player.getHeldItem(), player); return false; @@ -87,7 +101,10 @@ public class CKeyStone extends BlockDE { @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) { - TileCKeyStone tile = world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; + TileCKeyStone tile = + world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone + ? (TileCKeyStone) world.getTileEntity(x, y, z) + : null; if (tile != null) return tile.isActivated ? 15 : 0; return 0; } @@ -99,7 +116,10 @@ public class CKeyStone extends BlockDE { @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { - TileCKeyStone tile = world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; + TileCKeyStone tile = + world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone + ? (TileCKeyStone) world.getTileEntity(x, y, z) + : null; if (tile != null) { ItemStack key = new ItemStack(ModItems.key); ItemNBTHelper.setInteger(key, "KeyCode", tile.getKeyCode()); @@ -112,7 +132,8 @@ public class CKeyStone extends BlockDE { } @Override - public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { + public boolean isBlockSolid( + IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { return true; } @@ -120,6 +141,4 @@ public class CKeyStone extends BlockDE { public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { return true; } - } - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java index a313640c..49ff84f6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java @@ -5,6 +5,8 @@ import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; +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; @@ -19,9 +21,6 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - /** * Created by brandon3055 on 24/9/2015. */ @@ -40,7 +39,9 @@ public class ChaosCrystal extends BlockDE { @Override public float getBlockHardness(World world, int x, int y, int z) { - TileChaosShard tile = world.getTileEntity(x, y, z) instanceof TileChaosShard ? (TileChaosShard) world.getTileEntity(x, y, z) : null; + TileChaosShard tile = world.getTileEntity(x, y, z) instanceof TileChaosShard + ? (TileChaosShard) world.getTileEntity(x, y, z) + : null; if (tile != null) return tile.guardianDefeated ? 100F : -1F; return super.getBlockHardness(world, x, y, z); } @@ -93,12 +94,17 @@ public class ChaosCrystal extends BlockDE { entity.attackEntityFrom(punishment, Float.MAX_VALUE); } - private static String[] naughtyList = new String[]{"item.blockMover", "tile.CardboardBox", "item.WandCasting"}; - private static DamageSource punishment = new DamageSource("chrystalMoved").setDamageAllowedInCreativeMode().setDamageBypassesArmor().setDamageIsAbsolute(); + private static String[] naughtyList = new String[] {"item.blockMover", "tile.CardboardBox", "item.WandCasting"}; + private static DamageSource punishment = new DamageSource("chrystalMoved") + .setDamageAllowedInCreativeMode() + .setDamageBypassesArmor() + .setDamageIsAbsolute(); @Override public void onBlockAdded(World world, int x, int y, int z) { - List players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(15, 15, 15)); + List players = world.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(15, 15, 15)); for (EntityPlayer player : players) { if (player.getHeldItem() != null) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java index 58282023..0d7e75bd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java @@ -2,13 +2,12 @@ package com.brandon3055.draconicevolution.common.blocks; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt; +import java.util.Random; import net.minecraft.block.BlockAir; import net.minecraft.entity.Entity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - /** * Created by brandon3055 on 30/9/2015. */ @@ -28,7 +27,8 @@ public class ChaosShardAtmos extends BlockAir { for (int searchX = x - 15; searchX < x + 15; searchX++) { for (int searchZ = z - 15; searchZ < z + 15; searchZ++) { if (world.getBlock(searchX, 80, searchZ) == ModBlocks.chaosCrystal) { - EntityChaosBolt bolt = new EntityChaosBolt(world, x + 0.5, y + 0.5, z + 0.5, searchX + 0.5, 80.5, searchZ + 0.5); + EntityChaosBolt bolt = new EntityChaosBolt( + world, x + 0.5, y + 0.5, z + 0.5, searchX + 0.5, 80.5, searchZ + 0.5); world.spawnEntityInWorld(bolt); return; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java index 10aa1dbf..c5f654b8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java @@ -12,6 +12,10 @@ import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; @@ -26,11 +30,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Random; - /** * Created by Brandon on 5/07/2014. */ @@ -45,15 +44,31 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + TileCustomSpawner spawner = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + ? (TileCustomSpawner) world.getTileEntity(x, y, z) + : null; if (spawner != null) { ItemStack item = player.getHeldItem(); if (item != null && item.getItem().equals(ModItems.mobSoul)) { String name = ItemNBTHelper.getString(item, "Name", "Pig"); - if ((!ConfigHandler.spawnerListType && Arrays.asList(ConfigHandler.spawnerList).contains(name)) || (ConfigHandler.spawnerListType && !Arrays.asList(ConfigHandler.spawnerList).contains(name))) { + if ((!ConfigHandler.spawnerListType + && Arrays.asList(ConfigHandler.spawnerList).contains(name)) + || (ConfigHandler.spawnerListType + && !Arrays.asList(ConfigHandler.spawnerList).contains(name))) { if (!world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "[Error] soul disabled in config!")); + player.addChatComponentMessage( + new ChatComponentText(EnumChatFormatting.RED + "[Error] soul disabled in config!")); return false; } @@ -66,42 +81,60 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; - } else if (item != null && item.getItem().equals(Items.nether_star) && spawner.getBaseLogic().requiresPlayer) { + } else if (item != null + && item.getItem().equals(Items.nether_star) + && spawner.getBaseLogic().requiresPlayer) { spawner.getBaseLogic().requiresPlayer = false; world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; - } else if (item != null && item.getItem().equals(ModItems.wyvernCore) && spawner.getBaseLogic().spawnSpeed == 1) { + } else if (item != null + && item.getItem().equals(ModItems.wyvernCore) + && spawner.getBaseLogic().spawnSpeed == 1) { spawner.getBaseLogic().setSpawnRate(2); world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; - } else if (item != null && item.getItem().equals(ModItems.awakenedCore) && spawner.getBaseLogic().spawnSpeed == 2) { + } else if (item != null + && item.getItem().equals(ModItems.awakenedCore) + && spawner.getBaseLogic().spawnSpeed == 2) { spawner.getBaseLogic().setSpawnRate(3); world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; - } else if (item != null && item.getItem().equals(Items.golden_apple) && item.getItemDamage() == 1 && !spawner.getBaseLogic().ignoreSpawnRequirements) { + } else if (item != null + && item.getItem().equals(Items.golden_apple) + && item.getItemDamage() == 1 + && !spawner.getBaseLogic().ignoreSpawnRequirements) { spawner.getBaseLogic().ignoreSpawnRequirements = true; world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; } else { if (world.isRemote && !player.isSneaking()) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo1.txt").appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().entityName)); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo2.txt").appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().requiresPlayer)); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo3.txt").appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().ignoreSpawnRequirements)); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo4.txt").appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().spawnSpeed)); + player.addChatMessage( + new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo1.txt") + .appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().entityName)); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo2.txt") + .appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().requiresPlayer)); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo3.txt") + .appendText(": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().ignoreSpawnRequirements)); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo4.txt") + .appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().spawnSpeed)); player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo5.txt")); - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); + player.addChatMessage( + new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); } else if (world.isRemote && player.isSneaking()) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); + player.addChatMessage( + new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo6.txt")); player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo7.txt")); player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo8.txt")); player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo9.txt")); - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); + player.addChatMessage( + new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); } return true; } @@ -158,7 +191,10 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { - TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; + TileCustomSpawner spawner = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + ? (TileCustomSpawner) world.getTileEntity(x, y, z) + : null; if (spawner != null) { spawner.getBaseLogic().powered = world.isBlockIndirectlyGettingPowered(x, y, z); if (spawner.getBaseLogic().powered != spawner.getBaseLogic().ltPowered) { @@ -174,15 +210,18 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { return new ItemStack(ModBlocks.customSpawner); } - @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) { - TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; + TileCustomSpawner spawner = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + ? (TileCustomSpawner) world.getTileEntity(x, y, z) + : null; if (spawner != null && !world.isRemote) { float multiplyer = 0.05F; if (spawner.getBaseLogic().ignoreSpawnRequirements) { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(Items.golden_apple, 1, 1)); + EntityItem item = + new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(Items.golden_apple, 1, 1)); item.motionX = (-0.5F + world.rand.nextFloat()) * multiplyer; item.motionY = (4 + world.rand.nextFloat()) * multiplyer; item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; @@ -196,7 +235,8 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { world.spawnEntityInWorld(item); } if (spawner.getBaseLogic().spawnSpeed > 2) { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.awakenedCore)); + EntityItem item = + new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.awakenedCore)); item.motionX = (-0.5F + world.rand.nextFloat()) * multiplyer; item.motionY = (4 + world.rand.nextFloat()) * multiplyer; item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; @@ -215,15 +255,22 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { @Override public List getDisplayData(World world, int x, int y, int z) { - TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; + TileCustomSpawner spawner = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + ? (TileCustomSpawner) world.getTileEntity(x, y, z) + : null; List list = new ArrayList(); if (spawner != null) { list.add(InfoHelper.HITC() + getLocalizedName()); if (world.isRemote && !Minecraft.getMinecraft().thePlayer.isSneaking()) { - list.add(StatCollector.translateToLocal("msg.spawnerInfo1.txt") + ": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().entityName); - list.add(StatCollector.translateToLocal("msg.spawnerInfo2.txt") + ": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().requiresPlayer); - list.add(StatCollector.translateToLocal("msg.spawnerInfo3.txt") + ": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().ignoreSpawnRequirements); - list.add(StatCollector.translateToLocal("msg.spawnerInfo4.txt") + ": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().spawnSpeed); + list.add(StatCollector.translateToLocal("msg.spawnerInfo1.txt") + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().entityName); + list.add(StatCollector.translateToLocal("msg.spawnerInfo2.txt") + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().requiresPlayer); + list.add(StatCollector.translateToLocal("msg.spawnerInfo3.txt") + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().ignoreSpawnRequirements); + list.add(StatCollector.translateToLocal("msg.spawnerInfo4.txt") + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().spawnSpeed); list.add(StatCollector.translateToLocal("msg.spawnerInfo5.txt")); } else if (world.isRemote && Minecraft.getMinecraft().thePlayer.isSneaking()) { list.add(StatCollector.translateToLocal("msg.spawnerInfo6.txt")); @@ -231,7 +278,6 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { list.add(StatCollector.translateToLocal("msg.spawnerInfo8.txt")); list.add(StatCollector.translateToLocal("msg.spawnerInfo9.txt")); } - } return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java index d7967d3c..07000407 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java @@ -33,8 +33,7 @@ public class DraconicBlock extends BlockDE { } @Override - public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { - } + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {} @Override public boolean canDropFromExplosion(Explosion p_149659_1_) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java index 0c93ceea..fb532d99 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java @@ -8,6 +8,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection; 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.Entity; @@ -20,8 +21,6 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - /** * Created by Brandon on 25/07/2014. */ @@ -46,8 +45,7 @@ public class DraconiumBlock extends BlockDE { } @Override - public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { - } + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {} @Override public boolean canDropFromExplosion(Explosion p_149659_1_) { @@ -83,11 +81,23 @@ public class DraconiumBlock extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0) return false; if (meta == 1) { - TileEnderResurrection tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnderResurrection) ? (TileEnderResurrection) world.getTileEntity(x, y, z) : null; + TileEnderResurrection tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnderResurrection) + ? (TileEnderResurrection) world.getTileEntity(x, y, z) + : null; if (tile != null) return tile.onActivated(player); } return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java index 51535c0d..9aa56019 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java @@ -1,5 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks; +import static net.minecraftforge.common.util.ForgeDirection.DOWN; +import static net.minecraftforge.common.util.ForgeDirection.UP; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; import com.brandon3055.draconicevolution.common.ModBlocks; @@ -11,6 +14,8 @@ import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; 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; @@ -29,18 +34,14 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; -import java.util.List; - -import static net.minecraftforge.common.util.ForgeDirection.DOWN; -import static net.minecraftforge.common.util.ForgeDirection.UP; - /** * Created by Brandon on 28/10/2014. */ public class DraconiumChest extends BlockCustomDrop { - private static final String[] STORAGE_BLACKLIST = new String[]{"tile.thermalexpansion.strongbox", "item.thermalexpansion.satchel", "tile.draconicevolution:draconiumChest"}; + private static final String[] STORAGE_BLACKLIST = new String[] { + "tile.thermalexpansion.strongbox", "item.thermalexpansion.satchel", "tile.draconicevolution:draconiumChest" + }; public DraconiumChest() { super(Material.iron); @@ -59,9 +60,9 @@ public class DraconiumChest extends BlockCustomDrop { return true; } - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float cx, float cy, float cz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float cx, float cy, float cz) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (!(tileEntity instanceof TileDraconiumChest)) return false; TileDraconiumChest te = (TileDraconiumChest) tileEntity; @@ -69,21 +70,30 @@ public class DraconiumChest extends BlockCustomDrop { if (player.isSneaking()) { te.editMode = !te.editMode; if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_GREEN + "" + StatCollector.translateToLocal("msg.draconiumChestEditmode.txt") + EnumChatFormatting.DARK_AQUA + " " + String.valueOf(te.editMode))); + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_GREEN + "" + + StatCollector.translateToLocal("msg.draconiumChestEditmode.txt") + + EnumChatFormatting.DARK_AQUA + " " + String.valueOf(te.editMode))); if (te.editMode) { if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + StatCollector.translateToLocal("msg.draconiumChestEditL1.txt"))); + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL1.txt"))); if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + StatCollector.translateToLocal("msg.draconiumChestEditL2.txt"))); + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL2.txt"))); if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + StatCollector.translateToLocal("msg.draconiumChestEditL3.txt"))); + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL3.txt"))); if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + StatCollector.translateToLocal("msg.draconiumChestEditL4.txt"))); + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL4.txt"))); } return false; } - if (te.editMode && (isDye(player.getHeldItem(), "dyeRed") || isDye(player.getHeldItem(), "dyeGreen") || isDye(player.getHeldItem(), "dyeBlue"))) { + if (te.editMode + && (isDye(player.getHeldItem(), "dyeRed") + || isDye(player.getHeldItem(), "dyeGreen") + || isDye(player.getHeldItem(), "dyeBlue"))) { int increment = cy > 0.5F ? 5 : -5; if (isDye(player.getHeldItem(), "dyeRed")) { @@ -102,15 +112,20 @@ public class DraconiumChest extends BlockCustomDrop { if (te.blue < 0) te.blue = 0; } if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.draconiumChestRed.txt") + " " + te.red)); + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("msg.draconiumChestRed.txt") + " " + te.red)); if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.draconiumChestGreen.txt") + " " + te.green)); + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("msg.draconiumChestGreen.txt") + " " + te.green)); if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.draconiumChestBlue.txt") + " " + te.blue)); + player.addChatComponentMessage(new ChatComponentText( + StatCollector.translateToLocal("msg.draconiumChestBlue.txt") + " " + te.blue)); return true; } - if (te.editMode && player.getHeldItem() != null && player.getHeldItem().getItem().equals(Items.paper)) { + if (te.editMode + && player.getHeldItem() != null + && player.getHeldItem().getItem().equals(Items.paper)) { if (player.getHeldItem().stackSize != 1) { if (world.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.draconiumChestEdit2.txt")); @@ -144,7 +159,8 @@ public class DraconiumChest extends BlockCustomDrop { } if (!world.isRemote) - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_DRACONIC_CHEST, world, x, y, z); + FMLNetworkHandler.openGui( + player, DraconicEvolution.instance, GuiHandler.GUIID_DRACONIC_CHEST, world, x, y, z); return true; } @@ -265,6 +281,4 @@ public class DraconiumChest extends BlockCustomDrop { } droppes.add(stack); } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java index e5c62e7a..b4cf18e5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java @@ -7,6 +7,7 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,8 +18,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - public class DraconiumOre extends BlockDE { public IIcon icon; public IIcon iconEnd; @@ -66,7 +65,9 @@ public class DraconiumOre extends BlockDE { @Override public int quantityDroppedWithBonus(int fortune, Random random) { - return fortune == 0 ? this.quantityDropped(random) : this.quantityDropped(random) + fortune + random.nextInt(fortune * 2); + return fortune == 0 + ? this.quantityDropped(random) + : this.quantityDropped(random) + fortune + random.nextInt(fortune * 2); } @Override @@ -78,5 +79,4 @@ public class DraconiumOre extends BlockDE { public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return ModItems.draconiumDust; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java index 42e34191..7861d6c7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java @@ -5,6 +5,7 @@ import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.lib.References; 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; @@ -18,8 +19,6 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - /** * Created by Brandon on 19/5/2015. */ @@ -48,11 +47,18 @@ public class InfusedObsidian extends BlockDE { } @Override - public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { - } + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {} @Override - public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) { + public float getExplosionResistance( + Entity par1Entity, + World world, + int x, + int y, + int z, + double explosionX, + double explosionY, + double explosionZ) { return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java index 3c8f76d4..5e88b0cf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java @@ -2,9 +2,9 @@ package com.brandon3055.draconicevolution.common.blocks; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom; import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; @@ -12,6 +12,7 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -22,8 +23,6 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - public class ParticleGenerator extends BlockDE { public static Block instance; @@ -42,12 +41,22 @@ public class ParticleGenerator extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int side, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { if (world.getBlockMetadata(x, y, z) == 1) return false; if (player.getHeldItem() != null && player.getHeldItem().getItem() == Items.paper) { TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = + (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; ItemStack stack = player.getHeldItem(); if (gen != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("particles_enabled")) { gen.setBlockNBT(stack.getTagCompound()); @@ -58,7 +67,8 @@ public class ParticleGenerator extends BlockDE { if (player.isSneaking()) { if (activateEnergyStorageCore(world, x, y, z, player)) return true; TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = + (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; if (gen != null) { gen.toggleInverted(); } @@ -76,7 +86,8 @@ public class ParticleGenerator extends BlockDE { @Override public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) { TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = + (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; if (gen != null) { gen.signal = world.isBlockIndirectlyGettingPowered(x, y, z); world.markBlockForUpdate(x, y, z); @@ -104,9 +115,9 @@ public class ParticleGenerator extends BlockDE { float MY = modifier - ((2f * modifier) * rand.nextFloat()); float MZ = modifier - ((2f * modifier) * rand.nextFloat()); - { - ParticleCustom particle = new ParticleCustom(world, spawnX, spawnY, spawnZ, MX, MY, MZ, SCALE, false, 1); + ParticleCustom particle = + new ParticleCustom(world, spawnX, spawnY, spawnZ, MX, MY, MZ, SCALE, false, 1); particle.red = rand.nextInt(255); particle.green = rand.nextInt(255); particle.blue = rand.nextInt(255); @@ -127,7 +138,8 @@ public class ParticleGenerator extends BlockDE { } @Override - 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_) { return false; } @@ -149,18 +161,23 @@ public class ParticleGenerator extends BlockDE { private boolean activateEnergyStorageCore(World world, int x, int y, int z, EntityPlayer player) { for (int x1 = x - 11; x1 <= x + 11; x1++) { if (world.getBlock(x1, y, z) == ModBlocks.energyStorageCore) { - TileEnergyStorageCore tile = (world.getTileEntity(x1, y, z) != null && world.getTileEntity(x1, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x1, y, z) : null; + TileEnergyStorageCore tile = (world.getTileEntity(x1, y, z) != null + && world.getTileEntity(x1, y, z) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x1, y, z) + : null; if (tile != null && !tile.isOnline()) { if (player.capabilities.isCreativeMode) { if (!tile.creativeActivate()) { if (world.isRemote) - player.addChatComponentMessage(new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } else { if (!tile.tryActivate()) { if (world.isRemote) - player.addChatComponentMessage(new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } @@ -171,18 +188,23 @@ public class ParticleGenerator extends BlockDE { for (int z1 = z - 11; z1 <= z + 11; z1++) { if (world.getBlock(x, y, z1) == ModBlocks.energyStorageCore) { - TileEnergyStorageCore tile = (world.getTileEntity(x, y, z1) != null && world.getTileEntity(x, y, z1) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z1) : null; + TileEnergyStorageCore tile = (world.getTileEntity(x, y, z1) != null + && world.getTileEntity(x, y, z1) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x, y, z1) + : null; if (tile != null && !tile.isOnline()) { if (player.capabilities.isCreativeMode) { if (!tile.creativeActivate()) { if (world.isRemote) - player.addChatComponentMessage(new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } else { if (!tile.tryActivate()) { if (world.isRemote) - player.addChatComponentMessage(new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } @@ -197,10 +219,11 @@ public class ParticleGenerator extends BlockDE { public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) { if (meta == 1) { TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = + (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; if (gen != null && gen.getMaster() != null) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); - //LogHelper.info("deActivate"); + // LogHelper.info("deActivate"); gen.getMaster().isStructureStillValid(true); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java index e1e8becb..4e44b88c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.blocks; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,8 +18,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - /** * Created by Brandon on 13/08/2014. */ @@ -74,38 +73,53 @@ public class PlacedItem extends BlockDE { @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; + TilePlacedItem tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + ? (TilePlacedItem) world.getTileEntity(x, y, z) + : null; int meta = world.getBlockMetadata(x, y, z); if (tile != null && tile.getStack() != null) { if (tile.getStack().getItem() instanceof ItemBlock) { switch (meta) { case 0: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0.5D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0.5D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); case 1: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.5D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.5D, z + 0.75D); case 2: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0.25D, z + 0.5D, x + 0.75D, y + 0.75D, z + 1D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0.25D, z + 0.5D, x + 0.75D, y + 0.75D, z + 1D); case 3: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.5D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.5D); case 4: - return AxisAlignedBB.getBoundingBox(x + 0.5D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0.5D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); case 5: - return AxisAlignedBB.getBoundingBox(x + 0D, y + 0.25D, z + 0.25D, x + 0.5D, y + 0.75D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0D, y + 0.25D, z + 0.25D, x + 0.5D, y + 0.75D, z + 0.75D); } } else { switch (meta) { case 0: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0.9D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0.9D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); case 1: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.1D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.1D, z + 0.75D); case 2: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0.25D, z + 0.9D, x + 0.75D, y + 0.75D, z + 1D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0.25D, z + 0.9D, x + 0.75D, y + 0.75D, z + 1D); case 3: - return AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.1D); + return AxisAlignedBB.getBoundingBox( + x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.1D); case 4: - return AxisAlignedBB.getBoundingBox(x + 0.9D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0.9D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); case 5: - return AxisAlignedBB.getBoundingBox(x + 0D, y + 0.25D, z + 0.25D, x + 0.1D, y + 0.75D, z + 0.75D); + return AxisAlignedBB.getBoundingBox( + x + 0D, y + 0.25D, z + 0.25D, x + 0.1D, y + 0.75D, z + 0.75D); } } } @@ -157,9 +171,21 @@ public class PlacedItem extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { if (player.isSneaking()) { - TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; + TilePlacedItem tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + ? (TilePlacedItem) world.getTileEntity(x, y, z) + : null; if (tile == null) { world.setBlockToAir(x, y, z); } @@ -175,13 +201,19 @@ public class PlacedItem extends BlockDE { @Override public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { if (player.isSneaking()) { - TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; + TilePlacedItem tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + ? (TilePlacedItem) world.getTileEntity(x, y, z) + : null; if (tile == null) { world.setBlockToAir(x, y, z); } tile.rotation += 22.5F; } else { - TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; + TilePlacedItem tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + ? (TilePlacedItem) world.getTileEntity(x, y, z) + : null; if (tile == null) { world.setBlockToAir(x, y, z); } @@ -210,6 +242,4 @@ public class PlacedItem extends BlockDE { } return null; } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java index d5dd6c6c..0536cbcb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java @@ -1,5 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; +import static net.minecraftforge.common.util.ForgeDirection.*; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.lib.References; @@ -19,8 +21,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import static net.minecraftforge.common.util.ForgeDirection.*; - public class Potentiometer extends BlockDE { IIcon icons[] = new IIcon[16]; @@ -34,14 +34,14 @@ public class Potentiometer extends BlockDE { ModBlocks.register(this); } - @Override public boolean renderAsNormalBlock() { return false; } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { + public AxisAlignedBB getCollisionBoundingBoxFromPool( + World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } @@ -77,7 +77,12 @@ public class Potentiometer extends BlockDE { @Override public boolean canPlaceBlockAt(World world, int x, int y, int z) { - return (world.isSideSolid(x, y + 1, z, UP)) || (world.isSideSolid(x, y - 1, z, DOWN)) || (world.isSideSolid(x - 1, y, z, EAST)) || (world.isSideSolid(x + 1, y, z, WEST)) || (world.isSideSolid(x, y, z - 1, SOUTH)) || (world.isSideSolid(x, y, z + 1, NORTH)); + return (world.isSideSolid(x, y + 1, z, UP)) + || (world.isSideSolid(x, y - 1, z, DOWN)) + || (world.isSideSolid(x - 1, y, z, EAST)) + || (world.isSideSolid(x + 1, y, z, WEST)) + || (world.isSideSolid(x, y, z - 1, SOUTH)) + || (world.isSideSolid(x, y, z + 1, NORTH)); } @Override @@ -120,7 +125,16 @@ public class Potentiometer extends BlockDE { } @Override - public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { + public int onBlockPlaced( + World world, + int x, + int y, + int z, + int side, + float p_149660_6_, + float p_149660_7_, + float p_149660_8_, + int p_149660_9_) { int j1 = world.getBlockMetadata(x, y, z); int k1 = j1 & 8; j1 &= 7; @@ -242,9 +256,18 @@ public class Potentiometer extends BlockDE { } } - //#################################LOGIC##################################// + // #################################LOGIC##################################// @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int side, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { TilePotentiometer tile = (TilePotentiometer) world.getTileEntity(x, y, z); if (tile != null && tile instanceof TilePotentiometer) { @@ -271,5 +294,4 @@ public class Potentiometer extends BlockDE { if (tile != null && tile instanceof TilePotentiometer) return ((TilePotentiometer) tile).power; else return 0; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java index 79692513..eb16d5f2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java @@ -6,6 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -13,8 +14,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - public class RainSensor extends BlockDE { IIcon icon_inactive; IIcon icon_active; @@ -86,7 +85,16 @@ public class RainSensor extends BlockDE { } @Override - public int onBlockPlaced(World world, int x, int y, int z, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { + public int onBlockPlaced( + World world, + int x, + int y, + int z, + int p_149660_5_, + float p_149660_6_, + float p_149660_7_, + float p_149660_8_, + int p_149660_9_) { world.scheduleBlockUpdate(x, y, z, this, 10); return super.onBlockPlaced(world, x, y, z, p_149660_5_, p_149660_6_, p_149660_7_, p_149660_8_, p_149660_9_); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java index b703e1fe..32e5fef1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java @@ -3,12 +3,11 @@ package com.brandon3055.draconicevolution.common.blocks; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; +import java.util.Random; import net.minecraft.block.BlockFire; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - /** * Created by Brandon on 23/08/2014. */ @@ -23,7 +22,9 @@ public class SafetyFlame extends BlockFire { @Override public String getUnlocalizedName() { - return String.format("tile.%s%s", References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + return String.format( + "tile.%s%s", + References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } public String getUnwrappedUnlocalizedName(String unlocalizedName) { @@ -31,9 +32,7 @@ public class SafetyFlame extends BlockFire { } @Override - public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { - - } + public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {} @Override public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java index fd8c9d0c..ac2eadb6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java @@ -1,14 +1,15 @@ package com.brandon3055.draconicevolution.common.blocks; +import com.brandon3055.brandonscore.common.utills.Teleporter; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; -import com.brandon3055.brandonscore.common.utills.Teleporter; 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; @@ -21,8 +22,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import java.util.List; - /** * Created by Brandon on 27/06/2014. */ @@ -41,7 +40,7 @@ public class TeleporterStand extends BlockCustomDrop { @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { - //blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); + // blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); } @Override @@ -50,10 +49,15 @@ public class TeleporterStand extends BlockCustomDrop { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { - TileTeleporterStand tile = world.getTileEntity(x, y, z) instanceof TileTeleporterStand ? (TileTeleporterStand) world.getTileEntity(x, y, z) : null; + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + TileTeleporterStand tile = world.getTileEntity(x, y, z) instanceof TileTeleporterStand + ? (TileTeleporterStand) world.getTileEntity(x, y, z) + : null; if (tile == null) return false; - if (tile.getStackInSlot(0) == null && player.getHeldItem() != null && (player.getHeldItem().getItem() instanceof TeleporterMKI)) { + if (tile.getStackInSlot(0) == null + && player.getHeldItem() != null + && (player.getHeldItem().getItem() instanceof TeleporterMKI)) { ItemStack stack = player.getHeldItem(); tile.setInventorySlotContents(0, stack.copy()); player.inventory.setInventorySlotContents(player.inventory.currentItem, null); @@ -62,7 +66,8 @@ public class TeleporterStand extends BlockCustomDrop { } if (tile.getStackInSlot(0) != null && player.isSneaking()) { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.9, z + 0.5, tile.getStackInSlot(0).copy()); + EntityItem item = new EntityItem( + world, x + 0.5, y + 0.9, z + 0.5, tile.getStackInSlot(0).copy()); item.motionX = 0; item.motionY = 0; item.motionZ = 0; @@ -72,8 +77,11 @@ public class TeleporterStand extends BlockCustomDrop { return true; } - if (tile.getStackInSlot(0) != null && !player.isSneaking() && tile.getStackInSlot(0).getItem() instanceof TeleporterMKI) { - Teleporter.TeleportLocation l = ((TeleporterMKI) tile.getStackInSlot(0).getItem()).getLocation(tile.getStackInSlot(0)); + if (tile.getStackInSlot(0) != null + && !player.isSneaking() + && tile.getStackInSlot(0).getItem() instanceof TeleporterMKI) { + Teleporter.TeleportLocation l = + ((TeleporterMKI) tile.getStackInSlot(0).getItem()).getLocation(tile.getStackInSlot(0)); if (l != null) l.sendEntityToCoords(player); return true; } @@ -114,14 +122,14 @@ public class TeleporterStand extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack p_149689_6_) { super.onBlockPlacedBy(world, x, y, z, entity, p_149689_6_); - TileTeleporterStand tile = world.getTileEntity(x, y, z) instanceof TileTeleporterStand ? (TileTeleporterStand) world.getTileEntity(x, y, z) : null; + TileTeleporterStand tile = world.getTileEntity(x, y, z) instanceof TileTeleporterStand + ? (TileTeleporterStand) world.getTileEntity(x, y, z) + : null; if (tile == null) return; tile.rotation = (int) entity.rotationYawHead; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java index 30866355..1f4374d0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java @@ -6,6 +6,8 @@ import com.brandon3055.draconicevolution.common.blocks.itemblocks.TestItemBlock; import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.effect.EntityLightningBolt; @@ -18,9 +20,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - public class TestBlock extends BlockDE { public TestBlock() { @@ -29,7 +28,7 @@ public class TestBlock extends BlockDE { this.setCreativeTab(DraconicEvolution.tabBlocksItems); this.setHardness(5f); this.setResistance(200.0f); - //this.setBlockBounds(0.4f, 0f, 0.4f, 0.6f, 1f, 0.6f); + // this.setBlockBounds(0.4f, 0f, 0.4f, 0.6f, 1f, 0.6f); ModBlocks.register(this, TestItemBlock.class); } @@ -37,14 +36,14 @@ public class TestBlock extends BlockDE { @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess p_149673_1_, int p_149673_2_, int p_149673_3_, int p_149673_4_, int p_149673_5_) { return null; - //return super.getIcon(p_149673_1_, p_149673_2_, p_149673_3_, p_149673_4_, p_149673_5_); + // return super.getIcon(p_149673_1_, p_149673_2_, p_149673_3_, p_149673_4_, p_149673_5_); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return null; - //return super.getIcon(p_149691_1_, p_149691_2_); + // return super.getIcon(p_149691_1_, p_149691_2_); } @Override @@ -60,7 +59,7 @@ public class TestBlock extends BlockDE { @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { return new ItemStack(Item.getItemFromBlock(world.getBlock(x, y, z)), 1, world.getBlockMetadata(x, y, z)); - //return super.getPickBlock(target, world, x, y, z); + // return super.getPickBlock(target, world, x, y, z); } @Override @@ -74,33 +73,34 @@ public class TestBlock extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float px, float py, float pz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float px, float py, float pz) { EntityLightningBolt bolt = new EntityLightningBolt(world, x, y, z + 5); - //System.out.println(world.getBlockMetadata(x,y,z)); + // System.out.println(world.getBlockMetadata(x,y,z)); world.spawnEntityInWorld(bolt); /* - if (!world.isRemote && !player.isSneaking()) - { - System.out.println("Sending from server"); - DraconicEvolution.channelHandler.sendToAll(new ExamplePacket()); - } + if (!world.isRemote && !player.isSneaking()) + { + System.out.println("Sending from server"); + DraconicEvolution.channelHandler.sendToAll(new ExamplePacket()); + } - if (world.isRemote && player.isSneaking()) - { - System.out.println("Sending from client"); - DraconicEvolution.channelHandler.sendToServer(new ExamplePacket()); - } - */ + if (world.isRemote && player.isSneaking()) + { + System.out.println("Sending from client"); + DraconicEvolution.channelHandler.sendToServer(new ExamplePacket()); + } + */ return true; } @SideOnly(Side.CLIENT) @Override public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) { - //for (int i = 0; i < 16; i++) { + // for (int i = 0; i < 16; i++) { list.add(new ItemStack(item, 1, 0)); - //} + // } } @Override @@ -109,17 +109,16 @@ public class TestBlock extends BlockDE { } @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) {} @Override public int getRenderType() { - return -1;//super.getRenderType(); + return -1; // super.getRenderType(); } @Override - public boolean shouldSideBeRendered(IBlockAccess world, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { + public boolean shouldSideBeRendered( + IBlockAccess world, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java index 4aedceec..71d94f80 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.common.blocks; import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -16,8 +17,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - public class XRayBlock extends BlockDE { public XRayBlock() { @@ -45,7 +44,8 @@ public class XRayBlock extends BlockDE { } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) { + public AxisAlignedBB getCollisionBoundingBoxFromPool( + final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) { return null; } @@ -77,8 +77,15 @@ public class XRayBlock extends BlockDE { @Override public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { ItemStack tool = player.getCurrentEquippedItem(); - if (tool != null && (player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.draconicDestructionStaff)) || player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.draconicPickaxe)))) { - EntityItem item = new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(Item.getItemFromBlock(ModBlocks.xRayBlock))); + if (tool != null + && (player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.draconicDestructionStaff)) + || player.getCurrentEquippedItem().isItemEqual(new ItemStack(ModItems.draconicPickaxe)))) { + EntityItem item = new EntityItem( + world, + player.posX, + player.posY, + player.posZ, + new ItemStack(Item.getItemFromBlock(ModBlocks.xRayBlock))); world.setBlockToAir(x, y, z); if (!world.isRemote) world.spawnEntityInWorld(item); } @@ -91,16 +98,25 @@ public class XRayBlock extends BlockDE { } @Override - public void onEntityCollidedWithBlock(final World world, final int x, final int y, final int z, final Entity entity) { - //if(entity != EntityItem) - //System.out.println(); - //entity.attackEntityFrom(DamageSource.magic, 10F); + public void onEntityCollidedWithBlock( + final World world, final int x, final int y, final int z, final Entity entity) { + // if(entity != EntityItem) + // System.out.println(); + // entity.attackEntityFrom(DamageSource.magic, 10F); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - //world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + // world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); return false; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java index 4e1644d8..2353c9f1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java @@ -1,5 +1,6 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -7,8 +8,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import java.util.List; - /** * Created by Brandon on 27/08/2014. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java index b6bb80c9..aa260f5e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -8,8 +9,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - /** * Created by Brandon on 31/10/2014. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java index e6088360..8bbc3be3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java @@ -1,11 +1,10 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; -import java.util.List; - import cofh.api.energy.IEnergyContainerItem; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -46,7 +45,6 @@ public class DraconiumItemBlock extends ItemBlock implements IEnergyContainerIte return super.getUnlocalizedName(stack) + stack.getItemDamage(); } - @Override public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { if (container.getItemDamage() != 0 || container.stackSize <= 0) return 0; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java index 04cece71..8bd7182f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java @@ -28,9 +28,22 @@ public class EnergyCrystalItemBlock extends ItemBlock { } @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) { + 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) { boolean b = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata); - TileEnergyTransceiver transceiver = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) : null; + TileEnergyTransceiver transceiver = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver + ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) + : null; if (transceiver != null) transceiver.facing = side; return b; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java index 34751756..817d43c5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java @@ -1,7 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; +import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -22,7 +22,17 @@ public class ItemBlockCustomData extends ItemBlock { } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { if (stack.stackSize <= 0) return false; Block block = world.getBlock(x, y, z); @@ -37,7 +47,6 @@ public class ItemBlockCustomData extends ItemBlock { z += sideDir.offsetZ; } - if (!player.canPlayerEdit(x, y, z, side, stack)) return false; Block ownBlock = this.field_150939_a; @@ -50,7 +59,9 @@ public class ItemBlockCustomData extends ItemBlock { if (!placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, newMeta)) return false; - TileEntity te = world.getTileEntity(x, y, z) instanceof TileDraconiumChest ? (TileDraconiumChest) world.getTileEntity(x, y, z) : null; + TileEntity te = world.getTileEntity(x, y, z) instanceof TileDraconiumChest + ? (TileDraconiumChest) world.getTileEntity(x, y, z) + : null; if (te instanceof ICustomItemData) { NBTTagCompound itemTag = stack.getTagCompound(); @@ -59,7 +70,13 @@ public class ItemBlockCustomData extends ItemBlock { } } - world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, ownBlock.stepSound.getBreakSound(), (ownBlock.stepSound.getVolume() + 1.0F) / 2.0F, ownBlock.stepSound.getPitch() * 0.8F); + world.playSoundEffect( + x + 0.5, + y + 0.5, + z + 0.5, + ownBlock.stepSound.getBreakSound(), + (ownBlock.stepSound.getVolume() + 1.0F) / 2.0F, + ownBlock.stepSound.getPitch() * 0.8F); stack.stackSize--; return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java index 9689981f..33168ea0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java @@ -1,13 +1,9 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import java.util.List; - /** * Created by Brandon on 23/06/2014. */ @@ -26,5 +22,4 @@ public class LRDItemBlock extends ItemBlock { public String getUnlocalizedName(ItemStack stack) { return super.getUnlocalizedName(stack) + stack.getItemDamage(); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java index 5b84d408..5ecb188f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java @@ -11,7 +11,7 @@ public class TestItemBlock extends ItemBlock { public TestItemBlock(Block block) { super(block); setHasSubtypes(true); - //this.hasSubtypes = true; + // this.hasSubtypes = true; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java index 57127699..00984efa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java @@ -2,14 +2,16 @@ package com.brandon3055.draconicevolution.common.blocks.machine; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -19,9 +21,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - /** * Created by Brandon on 27/06/2014. */ @@ -57,9 +56,11 @@ public class DissEnchanter extends BlockCustomDrop { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_DISSENCHANTER, world, x, y, z); + FMLNetworkHandler.openGui( + player, DraconicEvolution.instance, GuiHandler.GUIID_DISSENCHANTER, world, x, y, z); } return true; } @@ -91,9 +92,7 @@ public class DissEnchanter extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} @Override @SideOnly(Side.CLIENT) @@ -113,9 +112,17 @@ public class DissEnchanter extends BlockCustomDrop { break; } - //world.spawnParticle("enchantmenttable", x + 0.5D, y + 2.0D, z + 0.5D, l - x + rand.nextFloat() - 0.5D, j1 - y - rand.nextFloat() - 1.0F, i1 - z + rand.nextFloat() - 0.5D); - world.spawnParticle("enchantmenttable", x1 + 0.4 + (rand.nextFloat() * 0.2), y1 + 0.8, z1 + 0.4 + (rand.nextFloat() * 0.2), x - x1 + rand.nextFloat() - 0.5, y - y1 + rand.nextFloat(), z - z1 + rand.nextFloat() - 0.5); - + // world.spawnParticle("enchantmenttable", x + 0.5D, y + 2.0D, z + 0.5D, l - x + + // rand.nextFloat() - 0.5D, j1 - y - rand.nextFloat() - 1.0F, i1 - z + rand.nextFloat() - + // 0.5D); + world.spawnParticle( + "enchantmenttable", + x1 + 0.4 + (rand.nextFloat() * 0.2), + y1 + 0.8, + z1 + 0.4 + (rand.nextFloat() * 0.2), + x - x1 + rand.nextFloat() - 0.5, + y - y1 + rand.nextFloat(), + z - z1 + rand.nextFloat() - 0.5); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java index e39f2315..39a4c03e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java @@ -1,5 +1,6 @@ package com.brandon3055.draconicevolution.common.blocks.machine; +import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.BlockDE; @@ -8,9 +9,10 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.energynet.*; import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; -import com.brandon3055.brandonscore.common.utills.InfoHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -25,9 +27,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 10/02/2015. */ @@ -64,7 +63,9 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { if (meta == 1 || meta == 0 || meta == 4 || meta == 5) setBlockBounds(0.37F, 0.135F, 0.37F, 0.63F, 0.865F, 0.63F); else if (meta == 2 || meta == 3) { - TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) : null; + TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver + ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) + : null; if (tile != null) { switch (tile.facing) { case 0: @@ -96,21 +97,29 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { if (meta == 1 || meta == 0 || meta == 4 || meta == 5) return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.135F, z + 0.37F, x + 0.63F, y + 0.865F, z + 0.63F); else if (meta == 2 || meta == 3) { - TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) : null; + TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver + ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) + : null; if (tile != null) { switch (tile.facing) { case 0: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); case 1: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); case 2: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); case 3: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); case 4: - return AxisAlignedBB.getBoundingBox(x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); case 5: - return AxisAlignedBB.getBoundingBox(x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); } } } @@ -124,21 +133,29 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { if (meta == 1 || meta == 0) return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.135F, z + 0.37F, x + 0.63F, y + 0.865F, z + 0.63F); else if (meta == 2 || meta == 3) { - TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) : null; + TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver + ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) + : null; if (tile != null) { switch (tile.facing) { case 0: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); case 1: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); case 2: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); case 3: - return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); + return AxisAlignedBB.getBoundingBox( + x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); case 4: - return AxisAlignedBB.getBoundingBox(x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); case 5: - return AxisAlignedBB.getBoundingBox(x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); + return AxisAlignedBB.getBoundingBox( + x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); } } } @@ -153,7 +170,11 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { @Override public TileEntity createTileEntity(World world, int metadata) { - return metadata == 0 || metadata == 1 ? new TileEnergyRelay(metadata) : metadata == 2 || metadata == 3 ? new TileEnergyTransceiver(metadata - 2) : metadata == 4 || metadata == 5 ? new TileWirelessEnergyTransceiver(metadata - 4) : null; + return metadata == 0 || metadata == 1 + ? new TileEnergyRelay(metadata) + : metadata == 2 || metadata == 3 + ? new TileEnergyTransceiver(metadata - 2) + : metadata == 4 || metadata == 5 ? new TileWirelessEnergyTransceiver(metadata - 4) : null; } @Override @@ -162,7 +183,8 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xx, float yy, float zz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float xx, float yy, float zz) { if (world.getTileEntity(x, y, z) instanceof TileRemoteEnergyBase) ((TileRemoteEnergyBase) world.getTileEntity(x, y, z)).onBlockActivated(player); return true; @@ -185,7 +207,7 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { - return 4;//super.getLightValue(world, x, y, z); + return 4; // super.getLightValue(world, x, y, z); } @Override @@ -196,20 +218,33 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { @Override public List getDisplayData(World world, int x, int y, int z) { List list = new ArrayList(); - IRemoteEnergyHandler tile = world.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler ? (IRemoteEnergyHandler) world.getTileEntity(x, y, z) : null; + IRemoteEnergyHandler tile = world.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler + ? (IRemoteEnergyHandler) world.getTileEntity(x, y, z) + : null; if (tile != null) { - list.add(InfoHelper.HITC() + StatCollector.translateToLocal(this.getUnlocalizedName() + world.getBlockMetadata(x, y, z) + ".name")); + list.add(InfoHelper.HITC() + + StatCollector.translateToLocal( + this.getUnlocalizedName() + world.getBlockMetadata(x, y, z) + ".name")); list.add("RF: " + tile.getEnergyStored(ForgeDirection.DOWN)); list.add("Cap: " + tile.getCapacity() + "%"); if (tile instanceof TileEnergyTransceiver) { - String x5 = ((TileEnergyTransceiver) tile).getPowerTier() > 0 && ((TileEnergyTransceiver) tile).transferBoost ? StatCollector.translateToLocal("info.de.5xTransfer.txt") : ""; - list.add(((TileEnergyTransceiver) tile).getInput() ? StatCollector.translateToLocal("info.de.modeIn.txt") + x5 : StatCollector.translateToLocal("info.de.modeOut.txt") + x5); + String x5 = ((TileEnergyTransceiver) tile).getPowerTier() > 0 + && ((TileEnergyTransceiver) tile).transferBoost + ? StatCollector.translateToLocal("info.de.5xTransfer.txt") + : ""; + list.add( + ((TileEnergyTransceiver) tile).getInput() + ? StatCollector.translateToLocal("info.de.modeIn.txt") + x5 + : StatCollector.translateToLocal("info.de.modeOut.txt") + x5); } if (tile instanceof TileRemoteEnergyBase) { - list.add(StatCollector.translateToLocal("info.de.connections.txt") + ": " + ((TileRemoteEnergyBase) tile).linkedDevices.size() + "/" + tile.getMaxConnections()); + list.add(StatCollector.translateToLocal("info.de.connections.txt") + ": " + + ((TileRemoteEnergyBase) tile).linkedDevices.size() + "/" + tile.getMaxConnections()); } if (tile instanceof TileWirelessEnergyTransceiver) { - list.add(StatCollector.translateToLocal("info.de.wirelessConnections.txt") + ": " + ((TileWirelessEnergyTransceiver) tile).receiverList.size() + "/" + ((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections()); + list.add(StatCollector.translateToLocal("info.de.wirelessConnections.txt") + ": " + + ((TileWirelessEnergyTransceiver) tile).receiverList.size() + "/" + + ((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections()); } if (tile instanceof TileRemoteEnergyBase) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java index 0b84755a..07cfa5bf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java @@ -2,14 +2,15 @@ package com.brandon3055.draconicevolution.common.blocks.machine; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -19,8 +20,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - /** * Created by Brandon on 27/06/2014. */ @@ -46,9 +45,11 @@ public class EnergyInfuser extends BlockCustomDrop { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_ENERGY_INFUSER, world, x, y, z); + FMLNetworkHandler.openGui( + player, DraconicEvolution.instance, GuiHandler.GUIID_ENERGY_INFUSER, world, x, y, z); } world.markBlockForUpdate(x, y, z); return true; @@ -81,9 +82,7 @@ public class EnergyInfuser extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} @Override public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java index 419b31f5..679ec6be 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java @@ -13,6 +13,7 @@ import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate; import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; 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; @@ -28,8 +29,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - /** * Created by Brandon on 25/6/2015. */ @@ -109,7 +108,8 @@ public class FlowGate extends BlockDE { } public static int determineOrientation(World world, int x, int y, int z, EntityLivingBase entity) { - if (MathHelper.abs((float) entity.posX - (float) x) < 2.0F && MathHelper.abs((float) entity.posZ - (float) z) < 2.0F) { + if (MathHelper.abs((float) entity.posX - (float) x) < 2.0F + && MathHelper.abs((float) entity.posZ - (float) z) < 2.0F) { double d0 = entity.posY + 1.82D - (double) entity.yOffset; if (d0 - (double) y > 2.0D) { @@ -181,8 +181,19 @@ public class FlowGate extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - if (world.isRemote && !(player.getHeldItem() != null && player.getHeldItem().getItem().equals(ModItems.wrench))) + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + if (world.isRemote + && !(player.getHeldItem() != null + && player.getHeldItem().getItem().equals(ModItems.wrench))) player.openGui(DraconicEvolution.instance, GuiHandler.GUIID_FLOW_GATE, world, x, y, z); return true; } @@ -198,7 +209,8 @@ public class FlowGate extends BlockDE { } private void updateSignal(IBlockAccess world, int x, int y, int z) { - TileGate gate = world.getTileEntity(x, y, z) instanceof TileGate ? (TileGate) world.getTileEntity(x, y, z) : null; + TileGate gate = + world.getTileEntity(x, y, z) instanceof TileGate ? (TileGate) world.getTileEntity(x, y, z) : null; if (gate != null && world instanceof World) { gate.signal = ((World) world).getStrongestIndirectPower(x, y, z); ((World) world).markBlockForUpdate(x, y, z); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java index b5b67823..841279be 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java @@ -2,16 +2,18 @@ package com.brandon3055.draconicevolution.common.blocks.machine; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; 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; @@ -27,9 +29,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; -import java.util.Random; - /** * Created by Brandon on 23/07/2014. */ @@ -48,7 +47,6 @@ public class Generator extends BlockCustomDrop { this.setCreativeTab(DraconicEvolution.tabBlocksItems); this.setStepSound(soundTypeStone); ModBlocks.register(this); - } @Override @@ -62,7 +60,6 @@ public class Generator extends BlockCustomDrop { for (int i = 0; i < 4; i++) { icon_top[i] = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_top_" + i); } - } @SideOnly(Side.CLIENT) @@ -73,7 +70,10 @@ public class Generator extends BlockCustomDrop { @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { - TileGenerator tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) ? (TileGenerator) world.getTileEntity(x, y, z) : null; + TileGenerator tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) + ? (TileGenerator) world.getTileEntity(x, y, z) + : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Generator)"); return 0; @@ -89,7 +89,10 @@ public class Generator extends BlockCustomDrop { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - TileGenerator tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) ? (TileGenerator) world.getTileEntity(x, y, z) : null; + TileGenerator tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) + ? (TileGenerator) world.getTileEntity(x, y, z) + : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Generator)"); return null; @@ -166,7 +169,8 @@ public class Generator extends BlockCustomDrop { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { if (!world.isRemote) { FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_GENERATOR, world, x, y, z); } @@ -213,18 +217,20 @@ public class Generator extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} @Override public void randomDisplayTick(World world, int x, int y, int z, Random random) { - TileGenerator tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) ? (TileGenerator) world.getTileEntity(x, y, z) : null; + TileGenerator tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) + ? (TileGenerator) world.getTileEntity(x, y, z) + : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Generator)"); return; } - if (tile.burnTimeRemaining > 0 && tile.getEnergyStored(ForgeDirection.UP) < tile.getMaxEnergyStored(ForgeDirection.UP)) { + if (tile.burnTimeRemaining > 0 + && tile.getEnergyStored(ForgeDirection.UP) < tile.getMaxEnergyStored(ForgeDirection.UP)) { double ox = 0; double oz = 0; if (world.getBlockMetadata(x, y, z) == 0) oz = -0.5; @@ -232,10 +238,31 @@ public class Generator extends BlockCustomDrop { if (world.getBlockMetadata(x, y, z) == 2) oz = 0.5; if (world.getBlockMetadata(x, y, z) == 3) ox = -0.5; - world.spawnParticle("flame", ox + x + 0.5 + (Math.abs(ox) - 0.5) * ((random.nextDouble() - 0.5) * 1), y + 0.3 + (random.nextDouble() * 0.5), oz + z + 0.5 + (Math.abs(oz) - 0.5) * ((random.nextDouble() - 0.5) * 1), (ox * 0.05) * random.nextDouble(), (random.nextDouble() - 0.2) * 0.03, (oz * 0.05) * random.nextDouble()); - world.spawnParticle("smoke", ox + x + 0.5 + (Math.abs(ox) - 0.5) * ((random.nextDouble() - 0.5) * 1), y + 0.3 + (random.nextDouble() * 0.5), oz + z + 0.5 + (Math.abs(oz) - 0.5) * ((random.nextDouble() - 0.5) * 1), (ox * 0.05) * random.nextDouble(), (random.nextDouble() - 0.2) * 0.03, (oz * 0.05) * random.nextDouble()); + world.spawnParticle( + "flame", + ox + x + 0.5 + (Math.abs(ox) - 0.5) * ((random.nextDouble() - 0.5) * 1), + y + 0.3 + (random.nextDouble() * 0.5), + oz + z + 0.5 + (Math.abs(oz) - 0.5) * ((random.nextDouble() - 0.5) * 1), + (ox * 0.05) * random.nextDouble(), + (random.nextDouble() - 0.2) * 0.03, + (oz * 0.05) * random.nextDouble()); + world.spawnParticle( + "smoke", + ox + x + 0.5 + (Math.abs(ox) - 0.5) * ((random.nextDouble() - 0.5) * 1), + y + 0.3 + (random.nextDouble() * 0.5), + oz + z + 0.5 + (Math.abs(oz) - 0.5) * ((random.nextDouble() - 0.5) * 1), + (ox * 0.05) * random.nextDouble(), + (random.nextDouble() - 0.2) * 0.03, + (oz * 0.05) * random.nextDouble()); - world.playSound((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), "fire.fire", 0.2F + (random.nextFloat() * 0.1F), random.nextFloat() * 0.7F + 0.5F, false); + world.playSound( + (double) ((float) x + 0.5F), + (double) ((float) y + 0.5F), + (double) ((float) z + 0.5F), + "fire.fire", + 0.2F + (random.nextFloat() * 0.1F), + random.nextFloat() * 0.7F + 0.5F, + false); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java index 3cb24fc4..2f895876 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java @@ -10,6 +10,7 @@ import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; 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,8 +26,6 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class Grinder extends BlockCustomDrop { public IIcon icon_front; public IIcon icon_side; @@ -42,7 +41,6 @@ public class Grinder extends BlockCustomDrop { this.setStepSound(soundTypeStone); this.setResistance(2000.0f); ModBlocks.register(this); - } @Override @@ -56,12 +54,10 @@ public class Grinder extends BlockCustomDrop { for (int i = 0; i < 4; i++) { icon_top[i] = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_top_" + i); } - } @Override - public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { - } + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {} @SideOnly(Side.CLIENT) @Override @@ -150,7 +146,8 @@ public class Grinder extends BlockCustomDrop { } @Override - public boolean onBlockActivated(World world, int X, int Y, int Z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated( + World world, int X, int Y, int Z, EntityPlayer player, int side, float prx, float pry, float prz) { TileEntity tile = world.getTileEntity(X, Y, Z); if (!(tile instanceof TileGrinder)) { return false; @@ -209,7 +206,5 @@ public class Grinder extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java index cd2037f8..9b68623e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java @@ -1,15 +1,17 @@ package com.brandon3055.draconicevolution.common.blocks.machine; import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.blocks.itemblocks.LRDItemBlock; -import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; 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.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -23,9 +25,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - /** * Created by Brandon on 20/07/2014. */ @@ -56,14 +55,23 @@ public class LongRangeDislocator extends BlockDE { @SideOnly(Side.CLIENT) @Override public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) { - //list.add(new ItemStack(item, 1, 0)); + // list.add(new ItemStack(item, 1, 0)); list.add(new ItemStack(item, 1, 1)); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); - if (meta == 0) return false;//return teleportPlayer(world, player, false); + if (meta == 0) return false; // return teleportPlayer(world, player, false); else if (meta == 1) return false; else { LogHelper.error("Invalid LRT Metadata"); @@ -87,8 +95,10 @@ public class LongRangeDislocator extends BlockDE { Random rand = new Random(); if (admin) { - int randX = ConfigHandler.admin_dislocator_Min_Range + rand.nextInt(ConfigHandler.admin_dislocator_Max_Range - ConfigHandler.admin_dislocator_Min_Range); - int randZ = ConfigHandler.admin_dislocator_Min_Range + rand.nextInt(ConfigHandler.admin_dislocator_Max_Range - ConfigHandler.admin_dislocator_Min_Range); + int randX = ConfigHandler.admin_dislocator_Min_Range + + rand.nextInt(ConfigHandler.admin_dislocator_Max_Range - ConfigHandler.admin_dislocator_Min_Range); + int randZ = ConfigHandler.admin_dislocator_Min_Range + + rand.nextInt(ConfigHandler.admin_dislocator_Max_Range - ConfigHandler.admin_dislocator_Min_Range); randX = rand.nextBoolean() ? randX * -1 : randX * 1; randZ = rand.nextBoolean() ? randZ * -1 : randZ * 1; randX += (int) player.posX; @@ -100,7 +110,8 @@ public class LongRangeDislocator extends BlockDE { break; } } - player.addChatComponentMessage(new ChatComponentText("" + EnumChatFormatting.RED + "[WARNING]" + EnumChatFormatting.WHITE + " Do not move until the world loads!")); + player.addChatComponentMessage(new ChatComponentText("" + EnumChatFormatting.RED + "[WARNING]" + + EnumChatFormatting.WHITE + " Do not move until the world loads!")); if (world.getBlock(randX, y, randZ).isBlockSolid(world, randX, y, randZ, 0)) { world.setBlock(randX, y, randZ, world.getBlock(randX, y, randZ)); player.setLocationAndAngles(randX + 0.5, y + 1.5, randZ + 0.5, 0F, 0F); @@ -113,14 +124,16 @@ public class LongRangeDislocator extends BlockDE { return true; } else { - int randX = ConfigHandler.dislocator_Min_Range + rand.nextInt(ConfigHandler.dislocator_Max_Range - ConfigHandler.dislocator_Min_Range); - int randZ = ConfigHandler.dislocator_Min_Range + rand.nextInt(ConfigHandler.dislocator_Max_Range - ConfigHandler.dislocator_Min_Range); + int randX = ConfigHandler.dislocator_Min_Range + + rand.nextInt(ConfigHandler.dislocator_Max_Range - ConfigHandler.dislocator_Min_Range); + int randZ = ConfigHandler.dislocator_Min_Range + + rand.nextInt(ConfigHandler.dislocator_Max_Range - ConfigHandler.dislocator_Min_Range); randX = rand.nextBoolean() ? randX * -1 : randX * 1; randZ = rand.nextBoolean() ? randZ * -1 : randZ * 1; int y = 255; for (int i = 255; i > 1; i--) { if (world.getBlock(randX, i, randZ) != Blocks.air) { - //LogHelper.info(world.getBlock(randX, i, randZ)); + // LogHelper.info(world.getBlock(randX, i, randZ)); y = i; break; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java index 7252c91b..5c4a34fe 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java @@ -1,7 +1,11 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetector; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -11,10 +15,6 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetector; import net.minecraftforge.common.util.ForgeDirection; public class PlayerDetector extends BlockDE { @@ -58,7 +58,8 @@ public class PlayerDetector extends BlockDE { } @Override - public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { + public boolean isBlockSolid( + IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { return true; } @@ -105,7 +106,16 @@ public class PlayerDetector extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int side, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { TileEntity te = world.getTileEntity(x, y, z); TilePlayerDetector detector = (te != null && te instanceof TilePlayerDetector) ? (TilePlayerDetector) te : null; if (detector != null) { @@ -122,7 +132,8 @@ public class PlayerDetector extends BlockDE { detector.setRange(range); if (world.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.range.txt").appendSibling(new ChatComponentText(" " + range))); + player.addChatMessage(new ChatComponentTranslation("msg.range.txt") + .appendSibling(new ChatComponentText(" " + range))); } return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java index e85927a0..613ef3a9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java @@ -2,14 +2,15 @@ package com.brandon3055.draconicevolution.common.blocks.machine; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; 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; @@ -22,8 +23,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - public class PlayerDetectorAdvanced extends BlockCustomDrop { IIcon side_inactive; IIcon side_active; @@ -41,14 +40,16 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { - side_inactive = iconRegister.registerIcon(References.RESOURCESPREFIX + "advanced_player_detector_side_inactive"); + side_inactive = + iconRegister.registerIcon(References.RESOURCESPREFIX + "advanced_player_detector_side_inactive"); side_active = iconRegister.registerIcon(References.RESOURCESPREFIX + "advanced_player_detector_side_active"); top = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_top_0"); bottom = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); } @Override - public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { + public boolean isBlockSolid( + IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { return true; } @@ -63,7 +64,8 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { IIcon side_icon; TileEntity tile = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = (tile != null && tile instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) tile : null; + TilePlayerDetectorAdvanced detector = + (tile != null && tile instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) tile : null; if (detector != null && detector.getStackInSlot(0) != null) { ItemStack stack = detector.getStackInSlot(0); Block block = Block.getBlockFromItem(stack.getItem()); @@ -94,9 +96,19 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { if (!world.isRemote) { - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_PLAYERDETECTOR, world, x, y, z); + FMLNetworkHandler.openGui( + player, DraconicEvolution.instance, GuiHandler.GUIID_PLAYERDETECTOR, world, x, y, z); } return true; } @@ -115,18 +127,22 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) { TileEntity te = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; - if (detector != null) if (!detector.outputInverted) return detector.output ? 15 : 0; - else return detector.output ? 0 : 15; + TilePlayerDetectorAdvanced detector = + (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; + if (detector != null) + if (!detector.outputInverted) return detector.output ? 15 : 0; + else return detector.output ? 0 : 15; else return 0; } @Override public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int meta) { TileEntity te = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; - if (detector != null) if (!detector.outputInverted) return detector.output ? 15 : 0; - else return detector.output ? 0 : 15; + TilePlayerDetectorAdvanced detector = + (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; + if (detector != null) + if (!detector.outputInverted) return detector.output ? 15 : 0; + else return detector.output ? 0 : 15; else return 0; } @@ -141,14 +157,13 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; + TilePlayerDetectorAdvanced detector = + (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; if (detector != null && detector.getStackInSlot(0) != null) { return detector.getStackInSlot(0); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java index c132db52..cc9863ba 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java @@ -1,7 +1,13 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -9,19 +15,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; public class SunDial extends BlockDE { - //@SideOnly(Side.CLIENT) + // @SideOnly(Side.CLIENT) public IIcon icon_front; public IIcon icon_front_active; public IIcon icon_side; - //public boolean blockState = true; + // public boolean blockState = true; public SunDial() { this.setBlockName(Strings.blockSunDialName); @@ -69,15 +69,24 @@ public class SunDial extends BlockDE { @Override public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) { - //if (!world.isRemote) { - //world.setBlock(x, y, z, ModBlocks.sunDial, 0, 2); - //} + // if (!world.isRemote) { + // world.setBlock(x, y, z, ModBlocks.sunDial, 0, 2); + // } } @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer entityPlayer, final int par1, final float par2, final float par3, final float par4) { + public boolean onBlockActivated( + final World world, + final int x, + final int y, + final int z, + final EntityPlayer entityPlayer, + final int par1, + final float par2, + final float par3, + final float par4) { if (!world.isRemote) { - //FMLNetworkHandler.openGui(entityPlayer, DraconicEvolution.instance, 1, world, x, y, z); + // FMLNetworkHandler.openGui(entityPlayer, DraconicEvolution.instance, 1, world, x, y, z); } return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java index aba2e4da..fc5e1897 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java @@ -8,6 +8,7 @@ import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -17,8 +18,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - /** * Created by brandon3055 on 23/12/2015. */ @@ -35,7 +34,7 @@ public class UpgradeModifier extends BlockCustomDrop { @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { - //blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); + // blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); } @Override @@ -44,9 +43,11 @@ public class UpgradeModifier extends BlockCustomDrop { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_UPGRADE_MODIFIER, world, x, y, z); + FMLNetworkHandler.openGui( + player, DraconicEvolution.instance, GuiHandler.GUIID_UPGRADE_MODIFIER, world, x, y, z); } world.markBlockForUpdate(x, y, z); return true; @@ -79,9 +80,7 @@ public class UpgradeModifier extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} @Override public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side) { @@ -92,4 +91,4 @@ public class UpgradeModifier extends BlockCustomDrop { public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { return side == ForgeDirection.DOWN; } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java index c36a5cb7..0f1d9e60 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java @@ -2,14 +2,15 @@ package com.brandon3055.draconicevolution.common.blocks.machine; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; 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; @@ -22,8 +23,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class WeatherController extends BlockCustomDrop { public boolean blockState = true; @@ -54,12 +53,18 @@ public class WeatherController extends BlockCustomDrop { public void registerBlockIcons(final IIconRegister iconRegister) { icon_top = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weather_controller_top"); icon_bottom = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); - icon_side_rain_off = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weather_controller_rain"); - icon_side_rain_on = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_rain_active"); - icon_side_thunder_off = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm"); - icon_side_thunder_on = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm_active"); - icon_side_sun_off = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_sun"); - icon_side_sun_on = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_sun_active"); + icon_side_rain_off = + iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weather_controller_rain"); + icon_side_rain_on = iconRegister.registerIcon( + References.RESOURCESPREFIX + "weather_controller/weatherController_rain_active"); + icon_side_thunder_off = iconRegister.registerIcon( + References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm"); + icon_side_thunder_on = iconRegister.registerIcon( + References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm_active"); + icon_side_sun_off = + iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_sun"); + icon_side_sun_on = iconRegister.registerIcon( + References.RESOURCESPREFIX + "weather_controller/weatherController_sun_active"); } @Override @@ -79,11 +84,9 @@ public class WeatherController extends BlockCustomDrop { } } - if (side > 1) return icon_side; else if (side == 0) return icon_bottom; else return icon_top; - } @Override @@ -102,9 +105,19 @@ public class WeatherController extends BlockCustomDrop { } @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer entityPlayer, final int par1, final float par2, final float par3, final float par4) { + public boolean onBlockActivated( + final World world, + final int x, + final int y, + final int z, + final EntityPlayer entityPlayer, + final int par1, + final float par2, + final float par3, + final float par4) { if (!world.isRemote) { - FMLNetworkHandler.openGui(entityPlayer, DraconicEvolution.instance, GuiHandler.GUIID_WEATHER_CONTROLLER, world, x, y, z); + FMLNetworkHandler.openGui( + entityPlayer, DraconicEvolution.instance, GuiHandler.GUIID_WEATHER_CONTROLLER, world, x, y, z); } return true; } @@ -125,9 +138,7 @@ public class WeatherController extends BlockCustomDrop { } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java index 41295543..c3232e27 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java @@ -6,6 +6,8 @@ import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle; +import java.util.List; +import java.util.Random; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,9 +20,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - /** * Created by Brandon on 19/5/2015. */ @@ -40,13 +39,16 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity @Override public void registerBlockIcons(IIconRegister iconRegister) { - textureInactive = iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_inactive"); + textureInactive = + iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_inactive"); blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_active"); } @Override public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) { - TileDislocatorReceptacle tile = access.getTileEntity(x, y, z) instanceof TileDislocatorReceptacle ? (TileDislocatorReceptacle) access.getTileEntity(x, y, z) : null; + TileDislocatorReceptacle tile = access.getTileEntity(x, y, z) instanceof TileDislocatorReceptacle + ? (TileDislocatorReceptacle) access.getTileEntity(x, y, z) + : null; if (tile != null) return tile.isActive ? blockIcon : textureInactive; return blockIcon; } @@ -55,7 +57,6 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity public void updateTick(World world, int x, int y, int z, Random random) { TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z); if (tile != null) tile.updateState(); - } @Override @@ -79,7 +80,16 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int side, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { if (world.isRemote) return true; TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z); if (tile == null) return false; @@ -89,7 +99,8 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.getStackInSlot(0)); tile.setInventorySlotContents(0, null); } else { - world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, tile.getStackInSlot(0))); + world.spawnEntityInWorld( + new EntityItem(world, player.posX, player.posY, player.posZ, tile.getStackInSlot(0))); tile.setInventorySlotContents(0, null); } world.markBlockForUpdate(x, y, z); @@ -97,14 +108,14 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity } else { ItemStack stack = player.getHeldItem(); - if (stack != null && stack.getItem() instanceof TeleporterMKI && ((TeleporterMKI) stack.getItem()).getLocation(stack) != null) { + if (stack != null + && stack.getItem() instanceof TeleporterMKI + && ((TeleporterMKI) stack.getItem()).getLocation(stack) != null) { tile.setInventorySlotContents(0, player.getHeldItem()); player.destroyCurrentEquippedItem(); } - } - return true; } @@ -130,7 +141,5 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity } @Override - protected void getCustomTileEntityDrops(TileEntity te, List droppes) { - - } + protected void getCustomTileEntityDrops(TileEntity te, List droppes) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java index 6b4a7271..0031c6e9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java @@ -21,9 +21,10 @@ import net.minecraft.world.World; /** * Created by Brandon on 28/07/2014. */ -public class EnergyPylon extends BlockDE {//todo fix sphere renderer +public class EnergyPylon extends BlockDE { // todo fix sphere renderer @SideOnly(Side.CLIENT) public IIcon icon_active_face; + public IIcon icon_input; public IIcon icon_output; @@ -69,7 +70,10 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer int meta = world.getBlockMetadata(x, y, z); if (meta == 1 && side == 1) return icon_active_face; if (meta == 2 && side == 0) return icon_active_face; - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; + TileEnergyPylon thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y, z) + : null; if (thisTile == null) return icon_input; return !thisTile.reciveEnergy ? icon_output : icon_input; } @@ -86,12 +90,20 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2); } } else { - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; - if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z)) || (meta == 2 && !isGlass(world, x, y - 1, z))) { + TileEnergyPylon thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y, z) + : null; + if (thisTile == null + || (meta == 1 && !isGlass(world, x, y + 1, z)) + || (meta == 2 && !isGlass(world, x, y - 1, z))) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); } } - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; + TileEnergyPylon thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y, z) + : null; if (thisTile != null) { thisTile.onActivated(); } @@ -104,10 +116,22 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0) return false; - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; + TileEnergyPylon thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y, z) + : null; if (thisTile != null) { if (!player.isSneaking()) thisTile.onActivated(); else thisTile.nextCore(); @@ -128,12 +152,20 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2); } } else { - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; - if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z)) || (meta == 2 && !isGlass(world, x, y - 1, z))) { + TileEnergyPylon thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y, z) + : null; + if (thisTile == null + || (meta == 1 && !isGlass(world, x, y + 1, z)) + || (meta == 2 && !isGlass(world, x, y - 1, z))) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); } } - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; + TileEnergyPylon thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y, z) + : null; if (thisTile != null) { thisTile.onActivated(); } @@ -148,7 +180,9 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer @Override public int getComparatorInputOverride(World world, int x, int y, int z, int meta) { - TileEnergyPylon tile = world.getTileEntity(x, y, z) instanceof TileEnergyPylon ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; + TileEnergyPylon tile = world.getTileEntity(x, y, z) instanceof TileEnergyPylon + ? (TileEnergyPylon) world.getTileEntity(x, y, z) + : null; if (tile != null) return (int) (tile.getEnergyStored() / tile.getMaxEnergyStored() * 15D); return 0; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java index 2f93314d..1084bf45 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java @@ -1,5 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.BlockDE; @@ -7,11 +9,11 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; -import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.brandonscore.common.utills.Utills; 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; @@ -24,9 +26,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 25/07/2014. */ @@ -41,7 +40,6 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { ModBlocks.register(this); } - @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -69,8 +67,20 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - TileEnergyStorageCore tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + TileEnergyStorageCore tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) + : null; if (tile == null) { LogHelper.error("Missing Tile Entity (EnergyStorageCore)"); return false; @@ -79,7 +89,9 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { if (!world.isRemote) { player.addChatComponentMessage(new ChatComponentText("Tier:" + (tile.getTier() + 1))); String BN = String.valueOf(tile.getEnergyStored()); - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + ": " + Utills.formatNumber(tile.getEnergyStored()) + " / " + Utills.formatNumber(tile.getMaxEnergyStored()) + " [" + BN + " RF]")); + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + + ": " + Utills.formatNumber(tile.getEnergyStored()) + " / " + + Utills.formatNumber(tile.getMaxEnergyStored()) + " [" + BN + " RF]")); } return true; } @@ -87,8 +99,23 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { - TileEnergyStorageCore tile = (world.getTileEntity(x - ForgeDirection.getOrientation(side).offsetX, y - ForgeDirection.getOrientation(side).offsetY, z - ForgeDirection.getOrientation(side).offsetZ) != null && world.getTileEntity(x - ForgeDirection.getOrientation(side).offsetX, y - ForgeDirection.getOrientation(side).offsetY, z - ForgeDirection.getOrientation(side).offsetZ) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x - ForgeDirection.getOrientation(side).offsetX, y - ForgeDirection.getOrientation(side).offsetY, z - ForgeDirection.getOrientation(side).offsetZ) : null; - //LogHelper.error(world.getTileEntity(x - ForgeDirection.getOrientation(side).offsetX, y - ForgeDirection.getOrientation(side).offsetY, z - ForgeDirection.getOrientation(side).offsetZ)); + TileEnergyStorageCore tile = (world.getTileEntity( + x - ForgeDirection.getOrientation(side).offsetX, + y - ForgeDirection.getOrientation(side).offsetY, + z - ForgeDirection.getOrientation(side).offsetZ) + != null + && world.getTileEntity( + x - ForgeDirection.getOrientation(side).offsetX, + y - ForgeDirection.getOrientation(side).offsetY, + z - ForgeDirection.getOrientation(side).offsetZ) + instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity( + x - ForgeDirection.getOrientation(side).offsetX, + y - ForgeDirection.getOrientation(side).offsetY, + z - ForgeDirection.getOrientation(side).offsetZ) + : null; + // LogHelper.error(world.getTileEntity(x - ForgeDirection.getOrientation(side).offsetX, y - + // ForgeDirection.getOrientation(side).offsetY, z - ForgeDirection.getOrientation(side).offsetZ)); if (tile == null) { LogHelper.error("Missing Tile Entity (EnergyStorageCore)(shouldSideBeRendered)"); return true; @@ -99,7 +126,10 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { - TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; + TileEnergyStorageCore thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) + : null; if (thisTile != null && thisTile.isOnline() && thisTile.getTier() == 0) { thisTile.isStructureStillValid(false); } @@ -107,7 +137,10 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) { - TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; + TileEnergyStorageCore thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) + : null; if (thisTile != null && thisTile.isOnline() && thisTile.getTier() == 0) { thisTile.deactivateStabilizers(); } @@ -116,9 +149,18 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { - TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; + TileEnergyStorageCore thisTile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) + : null; if (thisTile != null && thisTile.isOnline()) { - return AxisAlignedBB.getBoundingBox(thisTile.xCoord + 0.5, thisTile.yCoord + 0.5, thisTile.zCoord + 0.5, thisTile.xCoord + 0.5, thisTile.yCoord + 0.5, thisTile.zCoord + 0.5); + return AxisAlignedBB.getBoundingBox( + thisTile.xCoord + 0.5, + thisTile.yCoord + 0.5, + thisTile.zCoord + 0.5, + thisTile.xCoord + 0.5, + thisTile.yCoord + 0.5, + thisTile.zCoord + 0.5); } return super.getSelectedBoundingBoxFromPool(world, x, y, z); } @@ -127,7 +169,10 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { public List getDisplayData(World world, int x, int y, int z) { List list = new ArrayList(); - TileEnergyStorageCore tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; + TileEnergyStorageCore tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) + : null; if (tile == null) { LogHelper.error("Missing Tile Entity (EnergyStorageCore getDisplayData)"); return list; @@ -136,7 +181,9 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { list.add(InfoHelper.HITC() + getLocalizedName()); list.add("Tier: " + InfoHelper.ITC() + (tile.getTier() + 1)); String BN = String.valueOf(tile.getEnergyStored()); - list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() + Utills.formatNumber(tile.getEnergyStored()) + " / " + Utills.formatNumber(tile.getMaxEnergyStored()) + " [" + BN + " RF]"); + list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() + + Utills.formatNumber(tile.getEnergyStored()) + " / " + Utills.formatNumber(tile.getMaxEnergyStored()) + + " [" + BN + " RF]"); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java index 974d24e1..970f5927 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java @@ -13,7 +13,6 @@ public interface IReactorPart { public static int RMODE_FUEL = 6; public static int RMODE_FUEL_INV = 7; - public MultiblockHelper.TileLocation getMaster(); public void shutDown(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java index de8cdbb3..02ed0492 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java @@ -1,9 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.common.ModBlocks; @@ -18,6 +14,9 @@ import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -41,7 +40,7 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { super(Material.iron); this.setHardness(10F); this.setResistance(2000F); - //this.setCreativeTab(DraconicEvolution.getCreativeTab(2)); + // this.setCreativeTab(DraconicEvolution.getCreativeTab(2)); this.setBlockName(Strings.invisibleMultiblockName); ModBlocks.register(this); } @@ -92,8 +91,7 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { @Override public int damageDropped(int metadata) { - if (metadata == 0) - { + if (metadata == 0) { return BalanceConfigHandler.energyStorageStructureOuterBlockMetadata; } if (metadata == 1) { @@ -103,10 +101,22 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { - TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) : null; + TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile == null) { LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock)"); return false; @@ -120,11 +130,20 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { world.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord); player.addChatComponentMessage(new ChatComponentText("Tier:" + (master.getTier() + 1))); String BN = String.valueOf(master.getEnergyStored()); - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + ": " + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + BN + " RF]")); + player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + ": " + + Utills.formatNumber(master.getEnergyStored()) + " / " + + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + BN + " RF]")); } return true; } else if (meta == 2) { - TileEnergyPylon pylon = (world.getTileEntity(x, y + 1, z) != null && world.getTileEntity(x, y + 1, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y + 1, z) : (world.getTileEntity(x, y - 1, z) != null && world.getTileEntity(x, y - 1, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y - 1, z) : null; + TileEnergyPylon pylon = (world.getTileEntity(x, y + 1, z) != null + && world.getTileEntity(x, y + 1, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y + 1, z) + : (world.getTileEntity(x, y - 1, z) != null + && world.getTileEntity(x, y - 1, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y - 1, z) + : null; if (pylon == null) return false; pylon.reciveEnergy = !pylon.reciveEnergy; world.markBlockForUpdate(pylon.xCoord, pylon.yCoord, pylon.zCoord); @@ -138,7 +157,10 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { - TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) : null; + TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile == null) { LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock)"); revert(world, x, y, z); @@ -150,29 +172,44 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { revert(world, x, y, z); return; } - if (master.isOnline()) master.isStructureStillValid(thisTile.getMaster().getTier() == 1); + if (master.isOnline()) + master.isStructureStillValid(thisTile.getMaster().getTier() == 1); if (!master.isOnline()) revert(world, x, y, z); } else if (meta == 2) { - if (world.getBlock(x, y + 1, z) != ModBlocks.energyPylon && world.getBlock(x, y - 1, z) != ModBlocks.energyPylon) - world.setBlock(x, y, z, Blocks.glass); + if (world.getBlock(x, y + 1, z) != ModBlocks.energyPylon + && world.getBlock(x, y - 1, z) != ModBlocks.energyPylon) world.setBlock(x, y, z, Blocks.glass); } } private void revert(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0) { - world.setBlock(x, y, z, BalanceConfigHandler.energyStorageStructureOuterBlock, BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, 3); - } - else if (meta == 1) { - world.setBlock(x, y, z, BalanceConfigHandler.energyStorageStructureBlock, BalanceConfigHandler.energyStorageStructureBlockMetadata, 3); + world.setBlock( + x, + y, + z, + BalanceConfigHandler.energyStorageStructureOuterBlock, + BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, + 3); + } else if (meta == 1) { + world.setBlock( + x, + y, + z, + BalanceConfigHandler.energyStorageStructureBlock, + BalanceConfigHandler.energyStorageStructureBlockMetadata, + 3); } } @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) { TileEntity tile = world.getTileEntity(x, y, z); - TileInvisibleMultiblock thisTile = (tile != null && tile instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) tile : null; - if (thisTile != null && thisTile.getMaster() != null && thisTile.getMaster().isOnline()) { + TileInvisibleMultiblock thisTile = + (tile != null && tile instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) tile : null; + if (thisTile != null + && thisTile.getMaster() != null + && thisTile.getMaster().isOnline()) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); thisTile.getMaster().isStructureStillValid(thisTile.getMaster().getTier() == 1); @@ -184,9 +221,18 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { - TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) : null; + TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile != null && thisTile.getMaster() != null) { - return AxisAlignedBB.getBoundingBox(thisTile.getMaster().xCoord, thisTile.getMaster().yCoord, thisTile.getMaster().zCoord, thisTile.getMaster().xCoord + 0.5, thisTile.getMaster().yCoord + 0.5, thisTile.getMaster().zCoord + 0.5); + return AxisAlignedBB.getBoundingBox( + thisTile.getMaster().xCoord, + thisTile.getMaster().yCoord, + thisTile.getMaster().zCoord, + thisTile.getMaster().xCoord + 0.5, + thisTile.getMaster().yCoord + 0.5, + thisTile.getMaster().zCoord + 0.5); } return super.getSelectedBoundingBoxFromPool(world, x, y, z); } else if (meta == 2) { @@ -209,10 +255,16 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { int metadata = world.getBlockMetadata(x, y, z); if (metadata == 0) { - return new ItemStack(BalanceConfigHandler.energyStorageStructureOuterBlock, 1, BalanceConfigHandler.energyStorageStructureOuterBlockMetadata); + return new ItemStack( + BalanceConfigHandler.energyStorageStructureOuterBlock, + 1, + BalanceConfigHandler.energyStorageStructureOuterBlockMetadata); } if (metadata == 1) { - return new ItemStack(BalanceConfigHandler.energyStorageStructureBlock, 1, BalanceConfigHandler.energyStorageStructureBlockMetadata); + return new ItemStack( + BalanceConfigHandler.energyStorageStructureBlock, + 1, + BalanceConfigHandler.energyStorageStructureBlockMetadata); } return new ItemStack(Blocks.glass); } @@ -223,7 +275,10 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { - TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) : null; + TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile == null) { LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock getDisplayData)"); return list; @@ -238,7 +293,10 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { list.add(InfoHelper.HITC() + ModBlocks.energyStorageCore.getLocalizedName()); list.add("Tier: " + InfoHelper.ITC() + (master.getTier() + 1)); String BN = String.valueOf(master.getEnergyStored()); - list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + Utills.addCommas(master.getEnergyStored()) + " RF]"); + list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() + + Utills.formatNumber(master.getEnergyStored()) + " / " + + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + + Utills.addCommas(master.getEnergyStored()) + " RF]"); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java index 06be95b1..7e82eb70 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java @@ -10,13 +10,10 @@ import net.minecraft.world.World; */ public class MultiblockHelper { - public static class TileLocation extends ChunkCoordinates { public boolean initialized = false; - public TileLocation() { - - } + public TileLocation() {} public TileLocation(int x, int y, int z) { this.posX = x; @@ -86,8 +83,7 @@ public class MultiblockHelper { public int offsetY; public int offsetZ; - public TileOffset() { - } + public TileOffset() {} public TileOffset(int x, int y, int z, int offsetX, int offsetY, int offsetZ) { this.offsetX = x - offsetX; @@ -126,7 +122,9 @@ public class MultiblockHelper { } public TileEntity getTileEntity(TileEntity tileEntity) { - return tileEntity.getWorldObj().getTileEntity(getXCoord(tileEntity), getYCoord(tileEntity), getZCoord(tileEntity)); + return tileEntity + .getWorldObj() + .getTileEntity(getXCoord(tileEntity), getYCoord(tileEntity), getZCoord(tileEntity)); } public void writeToNBT(NBTTagCompound compound, String key) { @@ -141,5 +139,4 @@ public class MultiblockHelper { offsetZ = compound.getInteger("Z_" + key); } } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java index 915faead..3be88afd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java @@ -7,6 +7,7 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock; 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.ITileEntityProvider; import net.minecraft.block.material.Material; @@ -18,8 +19,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.Random; - /** * Created by Brandon on 23/5/2015. */ @@ -45,7 +44,8 @@ public class Portal extends BlockDE implements ITileEntityProvider { } @Override - public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) { + public AxisAlignedBB getSelectedBoundingBoxFromPool( + World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) { return AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); } @@ -64,9 +64,9 @@ public class Portal extends BlockDE implements ITileEntityProvider { return new TilePortalBlock(); } - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { + public AxisAlignedBB getCollisionBoundingBoxFromPool( + World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } @@ -99,7 +99,9 @@ public class Portal extends BlockDE implements ITileEntityProvider { } private TileDislocatorReceptacle getMaster(World world, int x, int y, int z) { - return world.getTileEntity(x, y, z) instanceof TilePortalBlock ? ((TilePortalBlock) world.getTileEntity(x, y, z)).getMaster() : null; + return world.getTileEntity(x, y, z) instanceof TilePortalBlock + ? ((TilePortalBlock) world.getTileEntity(x, y, z)).getMaster() + : null; } @Override @@ -109,7 +111,9 @@ public class Portal extends BlockDE implements ITileEntityProvider { private boolean isPortalOrFrame(IBlockAccess access, int x, int y, int z) { Block block = access.getBlock(x, y, z); - return block == ModBlocks.portal || block == ModBlocks.infusedObsidian || block == ModBlocks.dislocatorReceptacle; + return block == ModBlocks.portal + || block == ModBlocks.infusedObsidian + || block == ModBlocks.dislocatorReceptacle; } @Override @@ -121,12 +125,18 @@ public class Portal extends BlockDE implements ITileEntityProvider { if (world.isRemote || world.getBlockMetadata(x, y, z) != 0) return; int meta = 0; - if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z) && isPortalOrFrame(world, x + 1, y, z) && isPortalOrFrame(world, x - 1, y, z)) - meta = 1; - else if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z) && isPortalOrFrame(world, x, y, z + 1) && isPortalOrFrame(world, x, y, z - 1)) - meta = 2; - else if (isPortalOrFrame(world, x + 1, y, z) && isPortalOrFrame(world, x - 1, y, z) && isPortalOrFrame(world, x, y, z + 1) && isPortalOrFrame(world, x, y, z - 1)) - meta = 3; + if (isPortalOrFrame(world, x, y + 1, z) + && isPortalOrFrame(world, x, y - 1, z) + && isPortalOrFrame(world, x + 1, y, z) + && isPortalOrFrame(world, x - 1, y, z)) meta = 1; + else if (isPortalOrFrame(world, x, y + 1, z) + && isPortalOrFrame(world, x, y - 1, z) + && isPortalOrFrame(world, x, y, z + 1) + && isPortalOrFrame(world, x, y, z - 1)) meta = 2; + else if (isPortalOrFrame(world, x + 1, y, z) + && isPortalOrFrame(world, x - 1, y, z) + && isPortalOrFrame(world, x, y, z + 1) + && isPortalOrFrame(world, x, y, z - 1)) meta = 3; world.setBlockMetadataWithNotify(x, y, z, meta, 2); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java index 2d6f296f..aadf2c86 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java @@ -24,7 +24,6 @@ public class ReactorCore extends BlockDE { this.setBlockName("reactorCore"); this.setHardness(100F); - ModBlocks.register(this); } @@ -61,26 +60,41 @@ public class ReactorCore extends BlockDE { @Override public void onBlockAdded(World world, int x, int y, int z) { - TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore ? (TileReactorCore) world.getTileEntity(x, y, z) : null; + TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore + ? (TileReactorCore) world.getTileEntity(x, y, z) + : null; if (tile != null) tile.onPlaced(); } @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int x, int y, int z) { - return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);//super.getSelectedBoundingBoxFromPool(p_149633_1_, x, y, z); + return AxisAlignedBB.getBoundingBox( + 0, 0, 0, 1, 1, 1); // super.getSelectedBoundingBoxFromPool(p_149633_1_, x, y, z); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - //TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore ? (TileReactorCore) world.getTileEntity(x, y, z) : null; - //if (tile != null) return tile.onStructureRightClicked(player); + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + // TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore ? (TileReactorCore) + // world.getTileEntity(x, y, z) : null; + // if (tile != null) return tile.onStructureRightClicked(player); return false; } @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) { - TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore ? (TileReactorCore) world.getTileEntity(x, y, z) : null; + TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore + ? (TileReactorCore) world.getTileEntity(x, y, z) + : null; if (tile != null) tile.onBroken(); super.breakBlock(world, x, y, z, p_149749_5_, p_149749_6_); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java index 4bb3098d..e5b74bd2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java @@ -39,7 +39,9 @@ public class ReactorEnergyInjector extends BlockDE { @Override public void setBlockBoundsBasedOnState(IBlockAccess access, int x, int y, int z) { - TileReactorEnergyInjector tile = access.getTileEntity(x, y, z) instanceof TileReactorEnergyInjector ? (TileReactorEnergyInjector) access.getTileEntity(x, y, z) : null; + TileReactorEnergyInjector tile = access.getTileEntity(x, y, z) instanceof TileReactorEnergyInjector + ? (TileReactorEnergyInjector) access.getTileEntity(x, y, z) + : null; if (tile != null) { switch (tile.facingDirection) { case 0: @@ -67,7 +69,9 @@ public class ReactorEnergyInjector extends BlockDE { @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - TileReactorEnergyInjector tile = world.getTileEntity(x, y, z) instanceof TileReactorEnergyInjector ? (TileReactorEnergyInjector) world.getTileEntity(x, y, z) : null; + TileReactorEnergyInjector tile = world.getTileEntity(x, y, z) instanceof TileReactorEnergyInjector + ? (TileReactorEnergyInjector) world.getTileEntity(x, y, z) + : null; if (tile != null) { switch (tile.facingDirection) { case 0: @@ -117,8 +121,19 @@ public class ReactorEnergyInjector extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart) world.getTileEntity(x, y, z) : null; + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart + ? (IReactorPart) world.getTileEntity(x, y, z) + : null; if (tile != null && player.isSneaking()) { tile.changeRedstoneMode(); if (!world.isRemote) player.addChatComponentMessage(new ChatComponentText(tile.getRedstoneModeString())); @@ -133,9 +148,13 @@ public class ReactorEnergyInjector extends BlockDE { @Override public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) { - IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart) world.getTileEntity(x, y, z) : null; + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart + ? (IReactorPart) world.getTileEntity(x, y, z) + : null; if (tile == null) return 0; - TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore ? (TileReactorCore) tile.getMaster().getTileEntity(world) : null; + TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore + ? (TileReactorCore) tile.getMaster().getTileEntity(world) + : null; if (core != null) return core.getComparatorOutput(tile.getRedstoneMode()); return 0; } @@ -149,5 +168,4 @@ public class ReactorEnergyInjector extends BlockDE { public TileEntity createTileEntity(World world, int metadata) { return new TileReactorEnergyInjector(); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java index 81ed47d3..67119fd9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java @@ -41,9 +41,20 @@ public class ReactorStabilizer extends BlockDE { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + public boolean onBlockActivated( + World world, + int x, + int y, + int z, + EntityPlayer player, + int p_149727_6_, + float p_149727_7_, + float p_149727_8_, + float p_149727_9_) { if (!player.isSneaking()) { - TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer ? (TileReactorStabilizer) world.getTileEntity(x, y, z) : null; + TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer + ? (TileReactorStabilizer) world.getTileEntity(x, y, z) + : null; TileEntity core = null; if (tile != null) core = tile.getMaster().getTileEntity(world); if (core instanceof TileReactorCore) { @@ -51,7 +62,9 @@ public class ReactorStabilizer extends BlockDE { return true; } } else if (!world.isRemote) { - IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart) world.getTileEntity(x, y, z) : null; + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart + ? (IReactorPart) world.getTileEntity(x, y, z) + : null; if (tile != null) { tile.changeRedstoneMode(); if (!world.isRemote) @@ -85,9 +98,13 @@ public class ReactorStabilizer extends BlockDE { @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { int d = Utills.determineOrientation(x, y, z, entity); - TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer ? (TileReactorStabilizer) world.getTileEntity(x, y, z) : null; + TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer + ? (TileReactorStabilizer) world.getTileEntity(x, y, z) + : null; if (tile != null) { - if (entity.isSneaking()) tile.facingDirection = ForgeDirection.getOrientation(d).getOpposite().ordinal(); + if (entity.isSneaking()) + tile.facingDirection = + ForgeDirection.getOrientation(d).getOpposite().ordinal(); else tile.facingDirection = ForgeDirection.getOrientation(d).ordinal(); tile.onPlaced(); } @@ -95,7 +112,9 @@ public class ReactorStabilizer extends BlockDE { @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) { - TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer ? (TileReactorStabilizer) world.getTileEntity(x, y, z) : null; + TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer + ? (TileReactorStabilizer) world.getTileEntity(x, y, z) + : null; TileEntity core = null; if (tile != null) core = tile.getMaster().getTileEntity(world); super.breakBlock(world, x, y, z, p_149749_5_, p_149749_6_); @@ -108,9 +127,13 @@ public class ReactorStabilizer extends BlockDE { @Override public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) { - IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart) world.getTileEntity(x, y, z) : null; + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart + ? (IReactorPart) world.getTileEntity(x, y, z) + : null; if (tile == null) return 0; - TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore ? (TileReactorCore) tile.getMaster().getTileEntity(world) : null; + TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore + ? (TileReactorCore) tile.getMaster().getTileEntity(world) + : null; if (core != null) return core.getComparatorOutput(tile.getRedstoneMode()); return 0; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java index 740eeef4..a7fb717c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java @@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.container; import com.brandon3055.draconicevolution.common.inventory.InventoryTool; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; +import java.util.ArrayList; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnumEnchantmentType; @@ -14,8 +15,6 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagList; -import java.util.ArrayList; - /** * Created by Brandon on 13/01/2015. */ @@ -45,7 +44,8 @@ public class ContainerAdvTool extends ContainerDataSync { for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - addSlotToContainer(new SlotPlayerInv(player.inventory, x + y * 9 + 9, 8 + 18 * x, 45 + y * 18, inventoryItemSlot)); + addSlotToContainer(new SlotPlayerInv( + player.inventory, x + y * 9 + 9, 8 + 18 * x, 45 + y * 18, inventoryItemSlot)); } } @@ -58,12 +58,18 @@ public class ContainerAdvTool extends ContainerDataSync { } } else { for (int x = 0; x < 9; x++) { - addSlotToContainer(new SlotPlayerInv(player.inventory, x, -1000 + 8 + 18 * x, -1000 + 103, inventoryItemSlot)); + addSlotToContainer( + new SlotPlayerInv(player.inventory, x, -1000 + 8 + 18 * x, -1000 + 103, inventoryItemSlot)); } for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - addSlotToContainer(new SlotPlayerInv(player.inventory, x + y * 9 + 9, -1000 + 8 + 18 * x, -1000 + 45 + y * 18, inventoryItemSlot)); + addSlotToContainer(new SlotPlayerInv( + player.inventory, + x + y * 9 + 9, + -1000 + 8 + 18 * x, + -1000 + 45 + y * 18, + inventoryItemSlot)); } } } @@ -88,31 +94,32 @@ public class ContainerAdvTool extends ContainerDataSync { @Override public ItemStack transferStackInSlot(EntityPlayer player, int i) { -// Slot slot = getSlot(i); -// -// if (slot != null && slot.getHasStack()) -// { -// ItemStack stack = slot.getStack(); -// ItemStack result = stack.copy(); -// -// if (i >= 36){ //To player -// if (!mergeItemStack(stack, 0, 36, false)){ -// return null; -// } -// }else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 37, false)){ -// return null; -// } -// -// if (stack.stackSize == 0) { -// slot.putStack(null); -// }else{ -// slot.onSlotChanged(); -// } -// -// slot.onPickupFromSlot(player, stack); -// -// return result; -// } + // Slot slot = getSlot(i); + // + // if (slot != null && slot.getHasStack()) + // { + // ItemStack stack = slot.getStack(); + // ItemStack result = stack.copy(); + // + // if (i >= 36){ //To player + // if (!mergeItemStack(stack, 0, 36, false)){ + // return null; + // } + // }else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || + // !mergeItemStack(stack, 36, 37, false)){ + // return null; + // } + // + // if (stack.stackSize == 0) { + // slot.putStack(null); + // }else{ + // slot.onSlotChanged(); + // } + // + // slot.onPickupFromSlot(player, stack); + // + // return result; + // } return null; } @@ -132,7 +139,8 @@ public class ContainerAdvTool extends ContainerDataSync { sendObjectToServer(null, 0, slot); } - if (player.inventory.getStackInSlot(slot) != null && player.inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool) { + if (player.inventory.getStackInSlot(slot) != null + && player.inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool) { this.inventoryTool.setAndReadFromStack(player.inventory.getStackInSlot(slot), slot); } } @@ -160,8 +168,6 @@ public class ContainerAdvTool extends ContainerDataSync { public boolean isItemValid(ItemStack stack) { return stack != null && stack.getItem() instanceof ItemBlock && super.isItemValid(stack); } - - } public class SlotEnchantment extends Slot { @@ -176,11 +182,14 @@ public class ContainerAdvTool extends ContainerDataSync { if (stack == null || stack.getItem() != Items.enchanted_book || !stack.hasTagCompound()) return false; NBTTagList list = stack.getTagCompound().getTagList("StoredEnchantments", 10); if (list.tagCount() != 1) return false; - Enchantment enchant = Enchantment.enchantmentsList[list.getCompoundTagAt(0).getInteger("id")]; - if (inventoryTool.inventoryItem == null || !(inventoryTool.inventoryItem.getItem() instanceof IInventoryTool) || (!((IInventoryTool) inventoryTool.inventoryItem.getItem()).isEnchantValid(enchant) && enchant.type != EnumEnchantmentType.all)) - return false; - if (EnchantmentHelper.getEnchantments(inventoryTool.inventoryItem).containsKey(list.getCompoundTagAt(0).getInteger("id"))) - return false; + Enchantment enchant = + Enchantment.enchantmentsList[list.getCompoundTagAt(0).getInteger("id")]; + if (inventoryTool.inventoryItem == null + || !(inventoryTool.inventoryItem.getItem() instanceof IInventoryTool) + || (!((IInventoryTool) inventoryTool.inventoryItem.getItem()).isEnchantValid(enchant) + && enchant.type != EnumEnchantmentType.all)) return false; + if (EnchantmentHelper.getEnchantments(inventoryTool.inventoryItem) + .containsKey(list.getCompoundTagAt(0).getInteger("id"))) return false; return super.isItemValid(stack); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java index 79eb0fe5..2c5d50b9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java @@ -18,7 +18,9 @@ import net.minecraft.inventory.Container; */ public abstract class ContainerDataSync extends Container { - //TODO WTF? Was i sleep coding when i wrote this? In 1.8 re write this as a common container class for all mod containers and use a dedicated sender/receiver method for each data type i want to send (Unless i think of something better between now and then) + // TODO WTF? Was i sleep coding when i wrote this? In 1.8 re write this as a common container class for all mod + // containers and use a dedicated sender/receiver method for each data type i want to send (Unless i think of + // something better between now and then) /** * Sends two ints to the client-side Container. Normally the first int identifies which variable to update, and the second contains the new @@ -27,7 +29,8 @@ public abstract class ContainerDataSync extends Container { */ public Object sendObjectToClient(TileObjectSync tile, int index, Object object) { for (Object p : crafters) { - DraconicEvolution.network.sendTo(new TileObjectPacket(tile, References.INT_ID, index, object), (EntityPlayerMP) p); + DraconicEvolution.network.sendTo( + new TileObjectPacket(tile, References.INT_ID, index, object), (EntityPlayerMP) p); } return object; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java index 3605057f..17a8eed2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java @@ -1,7 +1,7 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.inventory.SlotOutput; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.inventory.SlotOutput; import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; @@ -59,7 +59,8 @@ public class ContainerDissEnchanter extends Container { if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if ((!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 37, false)) && (!isStackValidForInventory(stack, 1) || !mergeItemStack(stack, 37, 38, false))) { + } else if ((!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 37, false)) + && (!isStackValidForInventory(stack, 1) || !mergeItemStack(stack, 37, 38, false))) { return null; } @@ -106,7 +107,8 @@ public class ContainerDissEnchanter extends Container { @Override public boolean isItemValid(ItemStack stack) { - return EnchantmentHelper.getEnchantments(stack).size() > 0 || ItemNBTHelper.getInteger(stack, "RepairCost", 0) > 0; + return EnchantmentHelper.getEnchantments(stack).size() > 0 + || ItemNBTHelper.getInteger(stack, "RepairCost", 0) > 0; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java index 1a6c8506..e541ed27 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java @@ -25,6 +25,7 @@ public class ContainerDraconiumChest extends Container { * The crafting matrix inventory (3x3). */ public InventoryCrafting craftMatrix; + public IInventory craftResult; private TileDraconiumChest tile; private EntityPlayer player; @@ -35,6 +36,7 @@ public class ContainerDraconiumChest extends Container { * how much energy is stored in the tile */ private int lastEnergyStored; + private int lastBurnSpeed; private int lastTickFeedMode; private boolean lastTickOutputLock; @@ -60,16 +62,20 @@ public class ContainerDraconiumChest extends Container { private void addContainerSlots() { for (int chestRow = 0; chestRow < 9; chestRow++) { for (int chestCol = 0; chestCol < 26; chestCol++) { - addSlotToContainer(new SlotDChest(tile, chestCol + (chestRow * 26), 8 + chestCol * 18, 15 + chestRow * 18)); + addSlotToContainer( + new SlotDChest(tile, chestCol + (chestRow * 26), 8 + chestCol * 18, 15 + chestRow * 18)); } } - } private void addPlayerInventory() { for (int playerInvRow = 0; playerInvRow < 3; playerInvRow++) { for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++) { - addSlotToContainer(new Slot(player.inventory, playerInvCol + (playerInvRow * 9) + 9, 161 + 18 * playerInvCol, 179 + playerInvRow * 18)); + addSlotToContainer(new Slot( + player.inventory, + playerInvCol + (playerInvRow * 9) + 9, + 161 + 18 * playerInvCol, + 179 + playerInvRow * 18)); } } @@ -92,14 +98,16 @@ public class ContainerDraconiumChest extends Container { for (int gridCol = 0; gridCol < 3; ++gridCol) { for (int gridRow = 0; gridRow < 3; ++gridRow) { - addSlotToContainer(new SlotDChest(craftMatrix, gridRow + (gridCol * 3), xOffset + (gridRow * 18), yOffset + (gridCol * 18))); + addSlotToContainer(new SlotDChest( + craftMatrix, gridRow + (gridCol * 3), xOffset + (gridRow * 18), yOffset + (gridCol * 18))); } } } @Override public void onCraftMatrixChanged(IInventory inventory) { - craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); + craftResult.setInventorySlotContents( + 0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); } @Override @@ -114,7 +122,7 @@ public class ContainerDraconiumChest extends Container { if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (i < tile.getSizeInventory() + 16 && i != 240)//Transferring from container + if (i < tile.getSizeInventory() + 16 && i != 240) // Transferring from container { if (!mergeItemStack(itemstack1, tile.getSizeInventory() + 16, inventorySlots.size(), true)) { return null; @@ -127,7 +135,8 @@ public class ContainerDraconiumChest extends Container { } } slot.onSlotChange(itemstack1, itemstack); - } else if (!DraconiumChest.isStackValid(itemstack1) || !mergeItemStack(itemstack1, 0, tile.getSizeInventory(), false))//Transferring from player + } else if (!DraconiumChest.isStackValid(itemstack1) + || !mergeItemStack(itemstack1, 0, tile.getSizeInventory(), false)) // Transferring from player { return null; } @@ -164,9 +173,9 @@ public class ContainerDraconiumChest extends Container { @Override public void addCraftingToCrafters(ICrafting iCrafting) { super.addCraftingToCrafters(iCrafting); -// iCrafting.sendProgressBarUpdate(this, 0, tile.smeltingProgressTime); -// iCrafting.sendProgressBarUpdate(this, 1, tile.getEnergyStored(ForgeDirection.DOWN)/32); -// iCrafting.sendProgressBarUpdate(this, 2, tile.smeltingBurnSpeed); + // iCrafting.sendProgressBarUpdate(this, 0, tile.smeltingProgressTime); + // iCrafting.sendProgressBarUpdate(this, 1, tile.getEnergyStored(ForgeDirection.DOWN)/32); + // iCrafting.sendProgressBarUpdate(this, 2, tile.smeltingBurnSpeed); } @Override @@ -190,7 +199,6 @@ public class ContainerDraconiumChest extends Container { if (lastTickOutputLock != tile.lockOutputSlots) { icrafting.sendProgressBarUpdate(this, 4, tile.lockOutputSlots ? 1 : 0); } - } lastTickOutputLock = tile.lockOutputSlots; @@ -222,16 +230,15 @@ public class ContainerDraconiumChest extends Container { @Override public boolean isItemValid(ItemStack stack) { - return FurnaceRecipes.smelting().getSmeltingResult(stack) != null || OreDoublingRegistry.getOreResult(stack) != null; + return FurnaceRecipes.smelting().getSmeltingResult(stack) != null + || OreDoublingRegistry.getOreResult(stack) != null; } } public class SlotChargable extends Slot { - public SlotChargable(IInventory inventory, int id, int x, int y) { super(inventory, id, x, y); - } @Override @@ -250,16 +257,13 @@ public class ContainerDraconiumChest extends Container { public class SlotDChest extends Slot { - public SlotDChest(IInventory inventory, int id, int x, int y) { super(inventory, id, x, y); - } @Override public boolean isItemValid(ItemStack stack) { return DraconiumChest.isStackValid(stack); } - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java index 2e6fd1c1..e8817e1a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java @@ -46,11 +46,13 @@ public class ContainerEnergyInfuser extends ContainerDataSync { ItemStack stack = slot.getStack(); ItemStack result = stack.copy(); - if (i >= 36) { //To player + if (i >= 36) { // To player if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 37, false)) { + } else if (stack.stackSize != 1 + || !(stack.getItem() instanceof IEnergyContainerItem) + || !mergeItemStack(stack, 36, 37, false)) { return null; } @@ -68,7 +70,6 @@ public class ContainerEnergyInfuser extends ContainerDataSync { return null; } - @Override public void detectAndSendChanges() { super.detectAndSendChanges(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java index 56b0365d..6c525585 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java @@ -50,7 +50,8 @@ public class ContainerGenerator extends ContainerDataSync { if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if (TileGenerator.getItemBurnTime(stack) == 0 || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { + } else if (TileGenerator.getItemBurnTime(stack) == 0 + || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { return null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java index b02cd895..2280c4b8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java @@ -31,7 +31,6 @@ public class ContainerGrinder extends ContainerDataSync { } if (!tile.isExternallyPowered()) addSlotToContainer(new SlotItemValid(tile, 0, 64, 35, true)); else addSlotToContainer(new SlotItemValid(tile, 0, -10000, -10000, true)); - } @Override @@ -39,7 +38,6 @@ public class ContainerGrinder extends ContainerDataSync { return tile.isUseableByPlayer(player); } - @Override public ItemStack transferStackInSlot(EntityPlayer player, int i) { Slot slot = getSlot(i); @@ -52,7 +50,8 @@ public class ContainerGrinder extends ContainerDataSync { if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if (TileGrinder.getItemBurnTime(stack) == 0 || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { + } else if (TileGrinder.getItemBurnTime(stack) == 0 + || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { return null; } @@ -89,6 +88,5 @@ public class ContainerGrinder extends ContainerDataSync { else if (index == 1) tile.internalGenBuffer.setEnergyStored(i); else if (index == 2) tile.burnTime = i; else if (index == 3) tile.burnTimeRemaining = i; - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java index 9c939530..5a40a589 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java @@ -3,14 +3,13 @@ package com.brandon3055.draconicevolution.common.container; import com.brandon3055.draconicevolution.client.gui.GUIPlayerDetector; import com.brandon3055.draconicevolution.common.inventory.SlotOpaqueBlock; import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; +import java.util.Iterator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import java.util.Iterator; - public class ContainerPlayerDetector extends Container { private TilePlayerDetectorAdvanced tileDetector; @@ -22,17 +21,16 @@ public class ContainerPlayerDetector extends Container { bindPlayerInventory(invPlayer); addContainerSlots(tileDetector); updateContainerSlots(); - } - public ContainerPlayerDetector(InventoryPlayer invPlayer, TilePlayerDetectorAdvanced tileDetector, GUIPlayerDetector gui) { + public ContainerPlayerDetector( + InventoryPlayer invPlayer, TilePlayerDetectorAdvanced tileDetector, GUIPlayerDetector gui) { this.tileDetector = tileDetector; this.gui = gui; bindPlayerInventory(invPlayer); addContainerSlots(tileDetector); updateContainerSlots(); - } private void bindPlayerInventory(InventoryPlayer invPlayer) { @@ -98,33 +96,34 @@ public class ContainerPlayerDetector extends Container { @Override public ItemStack transferStackInSlot(EntityPlayer player, int i) { -// Slot slot = getSlot(i); -// -// -// if (slot != null && slot.getHasStack()) -// { -// ItemStack stack = slot.getStack(); -// ItemStack result = stack.copy(); -// Block block = Block.getBlockFromItem(stack.getItem()); -// -// if (i >= 36){ -// if (!mergeItemStack(stack, 0, 36, false)){ -// return null; -// } -// }else if (!(block.isOpaqueCube() && block.renderAsNormalBlock()) || !mergeItemStack(stack, 36, 36 + tileDetector.getSizeInventory(), false)){ -// return null; -// } -// -// if (stack.stackSize == 0) { -// slot.putStack(null); -// }else{ -// slot.onSlotChanged(); -// } -// -// slot.onPickupFromSlot(player, stack); -// -// return result; -// } + // Slot slot = getSlot(i); + // + // + // if (slot != null && slot.getHasStack()) + // { + // ItemStack stack = slot.getStack(); + // ItemStack result = stack.copy(); + // Block block = Block.getBlockFromItem(stack.getItem()); + // + // if (i >= 36){ + // if (!mergeItemStack(stack, 0, 36, false)){ + // return null; + // } + // }else if (!(block.isOpaqueCube() && block.renderAsNormalBlock()) || !mergeItemStack(stack, 36, 36 + + // tileDetector.getSizeInventory(), false)){ + // return null; + // } + // + // if (stack.stackSize == 0) { + // slot.putStack(null); + // }else{ + // slot.onSlotChanged(); + // } + // + // slot.onPickupFromSlot(player, stack); + // + // return result; + // } return null; } @@ -136,9 +135,9 @@ public class ContainerPlayerDetector extends Container { @Override public ItemStack slotClick(int slot, int button, int par3, EntityPlayer par4EntityPlayer) { return super.slotClick(slot, button, par3, par4EntityPlayer); -// if (par3 == 4) -// return super.slotClick(slot, button, 0, par4EntityPlayer); -// else -// return super.slotClick(slot, button, par3, par4EntityPlayer); + // if (par3 == 4) + // return super.slotClick(slot, button, 0, par4EntityPlayer); + // else + // return super.slotClick(slot, button, par3, par4EntityPlayer); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java index 4657a474..a885c0ad 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java @@ -4,6 +4,7 @@ import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.inventory.GenericInventory; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; +import java.util.Iterator; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -11,8 +12,6 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import java.util.Iterator; - /** * Created by brandon3055 on 30/7/2015. */ @@ -31,17 +30,22 @@ public class ContainerReactor extends ContainerDataSync { @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; - //return itemstack != null && (itemstack.getItem() == ModItems.draconicIngot || itemstack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock)); + // return itemstack != null && (itemstack.getItem() == ModItems.draconicIngot || itemstack.getItem() == + // Item.getItemFromBlock(ModBlocks.draconicBlock)); } @Override public int getInventoryStackLimit() { - return 1;//super.getInventoryStackLimit(); + return 1; // super.getInventoryStackLimit(); } @Override public void setInventorySlotContents(int i, ItemStack stack) { - if (i == 0 && stack != null && (stack.getItem() == ModItems.draconicIngot || stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock) || (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1))) { + if (i == 0 + && stack != null + && (stack.getItem() == ModItems.draconicIngot + || stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock) + || (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1))) { if (stack.getItem() == ModItems.nugget) reactor.reactorFuel += stack.stackSize * 16; if (stack.getItem() == ModItems.draconicIngot) reactor.reactorFuel += stack.stackSize * 144; if (stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock)) @@ -51,22 +55,22 @@ public class ContainerReactor extends ContainerDataSync { } }; - //Syncing //todo sort out syncing + // Syncing //todo sort out syncing public int LTConversionUnit = -1; public int LTReactionIntensity = -1; -// public int LTMaxReactIntensity = -1; -// public int LTFieldStrength = -1; -// public int LTMaxFieldStrength = -1; -// public int LTEnergySaturation = -1; -// public int LTMaxEnergySaturation = -1; -// public int LTFuelConversion = -1; + // public int LTMaxReactIntensity = -1; + // public int LTFieldStrength = -1; + // public int LTMaxFieldStrength = -1; + // public int LTEnergySaturation = -1; + // public int LTMaxEnergySaturation = -1; + // public int LTFuelConversion = -1; public double LTTempDrainFactor = -1; public double LTGenerationRate = -1; public int LTFieldDrain = -1; public double LTFuelUseRate = -1; public boolean LTOffline; - //####### + // ####### public ContainerReactor(EntityPlayer player, TileReactorCore reactor) { this.reactor = reactor; @@ -92,19 +96,21 @@ public class ContainerReactor extends ContainerDataSync { @Override public void onContainerClosed(EntityPlayer entityPlayer) { if (ioSlots.getStackInSlot(1) != null && !player.worldObj.isRemote) { - entityPlayer.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, entityPlayer.posX, player.posY, player.posZ, ioSlots.getStackInSlot(1))); + entityPlayer.worldObj.spawnEntityInWorld(new EntityItem( + player.worldObj, entityPlayer.posX, player.posY, player.posZ, ioSlots.getStackInSlot(1))); ioSlots.setInventorySlotContents(1, null); } super.onContainerClosed(entityPlayer); } @Override - public boolean canInteractWith(EntityPlayer player) {//todo (the chest thing) + public boolean canInteractWith(EntityPlayer player) { // todo (the chest thing) return true; } @Override - public void detectAndSendChanges() { //todo check what values are being synced by the tile and remove them from here + public void + detectAndSendChanges() { // todo check what values are being synced by the tile and remove them from here if (LTOffline && reactor.reactorState != TileReactorCore.STATE_OFFLINE) { Iterator i = inventorySlots.iterator(); @@ -120,39 +126,44 @@ public class ContainerReactor extends ContainerDataSync { } LTOffline = reactor.reactorState == TileReactorCore.STATE_OFFLINE; - if (reactor.conversionUnit != LTConversionUnit) LTConversionUnit = (Integer) sendObjectToClient(null, 0, (int) (reactor.conversionUnit * 100)); -// if ((int)reactor.reactionTemperature != LTReactionIntensity)LTReactionIntensity = (Integer) sendObjectToClient(null, 1, (int) reactor.reactionTemperature); -// if ((int)reactor.maxReactTemperature != LTMaxReactIntensity)LTMaxReactIntensity = (Integer) sendObjectToClient(null, 2, (int) reactor.maxReactTemperature); -// if ((int)reactor.fieldCharge != LTFieldStrength) LTFieldStrength = (Integer) sendObjectToClient(null, 3, (int) reactor.fieldCharge); -// if ((int)reactor.maxFieldCharge != LTMaxFieldStrength) LTMaxFieldStrength = (Integer) sendObjectToClient(null, 7, (int) reactor.maxFieldCharge); -// if (reactor.energySaturation != LTEnergySaturation) LTEnergySaturation = (Integer) sendObjectToClient(null, 4, reactor.energySaturation); -// if (reactor.maxEnergySaturation != LTMaxEnergySaturation) LTMaxEnergySaturation = (Integer) sendObjectToClient(null, 5, reactor.maxEnergySaturation); -// if (reactor.convertedFuel != LTFuelConversion) LTFuelConversion = (Integer) sendObjectToClient(null, 6, reactor.convertedFuel); + // if ((int)reactor.reactionTemperature != LTReactionIntensity)LTReactionIntensity = (Integer) + // sendObjectToClient(null, 1, (int) reactor.reactionTemperature); + // if ((int)reactor.maxReactTemperature != LTMaxReactIntensity)LTMaxReactIntensity = (Integer) + // sendObjectToClient(null, 2, (int) reactor.maxReactTemperature); + // if ((int)reactor.fieldCharge != LTFieldStrength) LTFieldStrength = (Integer) sendObjectToClient(null, + // 3, (int) reactor.fieldCharge); + // if ((int)reactor.maxFieldCharge != LTMaxFieldStrength) LTMaxFieldStrength = (Integer) + // sendObjectToClient(null, 7, (int) reactor.maxFieldCharge); + // if (reactor.energySaturation != LTEnergySaturation) LTEnergySaturation = (Integer) + // sendObjectToClient(null, 4, reactor.energySaturation); + // if (reactor.maxEnergySaturation != LTMaxEnergySaturation) LTMaxEnergySaturation = (Integer) + // sendObjectToClient(null, 5, reactor.maxEnergySaturation); + // if (reactor.convertedFuel != LTFuelConversion) LTFuelConversion = (Integer) sendObjectToClient(null, + // 6, reactor.convertedFuel); /*if (reactor.tempDrainFactor != LTTempDrainFactor) LTTempDrainFactor = (Integer) */ sendObjectToClient(null, 8, (int) (reactor.tempDrainFactor * 1000D)); if (reactor.generationRate != LTGenerationRate) LTGenerationRate = (Integer) sendObjectToClient(null, 9, (int) (reactor.generationRate)); if (reactor.fieldDrain != LTFieldDrain) LTFieldDrain = (Integer) sendObjectToClient(null, 10, reactor.fieldDrain); - /*if (reactor.fuelUseRate != LTFuelUseRate) LTFuelUseRate = (Integer) */ + /*if (reactor.fuelUseRate != LTFuelUseRate) LTFuelUseRate = (Integer) */ sendObjectToClient(null, 11, (int) (reactor.fuelUseRate * 1000000D)); - super.detectAndSendChanges(); } @Override public void receiveSyncData(int index, int value) { if (index == 0) reactor.conversionUnit = (double) value / 100D; -// else if (index == 1) reactor.reactionTemperature = value; -// else if (index == 2) reactor.maxReactTemperature = value; -// else if (index == 3) reactor.fieldCharge = value; -// else if (index == 4) reactor.energySaturation = value; -// else if (index == 5) reactor.maxEnergySaturation = value; -// else if (index == 6) reactor.convertedFuel = value; -// else if (index == 7) reactor.maxFieldCharge = value; + // else if (index == 1) reactor.reactionTemperature = value; + // else if (index == 2) reactor.maxReactTemperature = value; + // else if (index == 3) reactor.fieldCharge = value; + // else if (index == 4) reactor.energySaturation = value; + // else if (index == 5) reactor.maxEnergySaturation = value; + // else if (index == 6) reactor.convertedFuel = value; + // else if (index == 7) reactor.maxFieldCharge = value; else if (index == 8) reactor.tempDrainFactor = value / 1000D; else if (index == 9) reactor.generationRate = value; else if (index == 10) reactor.fieldDrain = value; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java index 4189db52..06076b26 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java @@ -12,7 +12,6 @@ public class ContainerSunDial extends Container { public ContainerSunDial(InventoryPlayer invPlayer, TileSunDial tile) { this.tile = tile; - } @Override @@ -20,7 +19,6 @@ public class ContainerSunDial extends Container { return tile.isUseableByPlayer(player); } - @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { return null; @@ -29,5 +27,4 @@ public class ContainerSunDial extends Container { public TileSunDial getTile() { return tile; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java index 917cedf7..b972cbae 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java @@ -29,7 +29,6 @@ public class ContainerTemplate extends Container { for (int x = 0; x < 9; x++) { addSlotToContainer(new Slot(tile, x, 8 + 18 * x, 10)); } - } @Override @@ -49,7 +48,8 @@ public class ContainerTemplate extends Container { if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if (!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { + } else if (!isStackValidForInventory(stack, 0) + || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { return null; } @@ -70,5 +70,4 @@ public class ContainerTemplate extends Container { private boolean isStackValidForInventory(ItemStack stack, int slot) { return true; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java index b4e0d823..079c7a17 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java @@ -14,7 +14,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ContainerUpgradeModifier extends ContainerDataSync { - private static final Item[] CORES_INDEX = {ModItems.draconicCore, ModItems.wyvernCore, ModItems.awakenedCore, ModItems.chaoticCore}; + private static final Item[] CORES_INDEX = { + ModItems.draconicCore, ModItems.wyvernCore, ModItems.awakenedCore, ModItems.chaoticCore + }; private TileUpgradeModifier tile; private EntityPlayer player; private boolean slotsActive = true; @@ -34,7 +36,6 @@ public class ContainerUpgradeModifier extends ContainerDataSync { } addSlotToContainer(new SlotUpgradable(tile, 0, 112, 48)); - } @Override @@ -54,12 +55,15 @@ public class ContainerUpgradeModifier extends ContainerDataSync { } private void updateSlotState() { - if (tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IUpgradableItem && slotsActive) { + if (tile.getStackInSlot(0) != null + && tile.getStackInSlot(0).getItem() instanceof IUpgradableItem + && slotsActive) { for (Object o : inventorySlots) { if (o instanceof Slot && !(o instanceof SlotUpgradable)) ((Slot) o).xDisplayPosition += 1000; } slotsActive = false; - } else if ((tile.getStackInSlot(0) == null || !(tile.getStackInSlot(0).getItem() instanceof IUpgradableItem)) && !slotsActive) { + } else if ((tile.getStackInSlot(0) == null || !(tile.getStackInSlot(0).getItem() instanceof IUpgradableItem)) + && !slotsActive) { for (Object o : inventorySlots) { if (o instanceof Slot && !(o instanceof SlotUpgradable)) ((Slot) o).xDisplayPosition -= 1000; } @@ -84,7 +88,8 @@ public class ContainerUpgradeModifier extends ContainerDataSync { if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if (!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { + } else if (!isStackValidForInventory(stack, 0) + || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { return null; } @@ -106,27 +111,36 @@ public class ContainerUpgradeModifier extends ContainerDataSync { return true; } - @Override public void receiveSyncData(int index, int value) { EnumUpgrade upgrade = EnumUpgrade.getUpgradeByIndex(index); int coreTier = value / 2; boolean addCore = value % 2 == 0; ItemStack stack = tile.getStackInSlot(0); - if (upgrade == null || stack == null || !(stack.getItem() instanceof IUpgradableItem) || coreTier < 0 || coreTier > 3 || (upgrade.getCoresApplied(stack)[coreTier] <= 0 && !addCore)) - return; + if (upgrade == null + || stack == null + || !(stack.getItem() instanceof IUpgradableItem) + || coreTier < 0 + || coreTier > 3 + || (upgrade.getCoresApplied(stack)[coreTier] <= 0 && !addCore)) return; handleCoreTransaction(upgrade, coreTier, addCore, (IUpgradableItem) stack.getItem(), stack); } - - private void handleCoreTransaction(EnumUpgrade upgrade, int coreTier, boolean addCoreElseRemove, IUpgradableItem upgradableItem, ItemStack stack) { + private void handleCoreTransaction( + EnumUpgrade upgrade, + int coreTier, + boolean addCoreElseRemove, + IUpgradableItem upgradableItem, + ItemStack stack) { int coreSlots = upgradableItem.getUpgradeCap(stack); int totalCores = 0; int[] coresApplied = upgrade.getCoresApplied(stack); for (EnumUpgrade u : upgradableItem.getUpgrades(stack)) totalCores += u.getCoresApplied(stack)[coreTier]; if (addCoreElseRemove) { - if (!player.inventory.hasItem(CORES_INDEX[coreTier]) || totalCores >= coreSlots || upgrade.getUpgradePoints(stack) >= upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) + if (!player.inventory.hasItem(CORES_INDEX[coreTier]) + || totalCores >= coreSlots + || upgrade.getUpgradePoints(stack) >= upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) return; coresApplied[coreTier]++; player.inventory.consumeInventoryItem(CORES_INDEX[coreTier]); @@ -138,7 +152,8 @@ public class ContainerUpgradeModifier extends ContainerDataSync { upgrade.setCoresApplied(stack, coresApplied); upgrade.onRemovedFromItem(stack); if (!player.inventory.addItemStackToInventory(new ItemStack(CORES_INDEX[coreTier]))) { - EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(CORES_INDEX[coreTier])); + EntityItem entityItem = new EntityItem( + player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(CORES_INDEX[coreTier])); if (!player.worldObj.isRemote) player.worldObj.spawnEntityInWorld(entityItem); } } @@ -150,13 +165,11 @@ public class ContainerUpgradeModifier extends ContainerDataSync { super(inventory1, slot, x, y); } - //Some people think this block makes a nice display stand... And i cant disagree. + // Some people think this block makes a nice display stand... And i cant disagree. @Override public boolean isItemValid(ItemStack stack) { return super.isItemValid(stack); - //return stack != null && stack.getItem() instanceof IUpgradableItem; + // return stack != null && stack.getItem() instanceof IUpgradableItem; } } } - - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java index 827fa14c..391feec4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java @@ -34,7 +34,6 @@ public class ContainerWeatherController extends Container { return tileWC.isUseableByPlayer(player); } - @Override public ItemStack transferStackInSlot(EntityPlayer player, int i) { Slot slot = getSlot(i); @@ -47,7 +46,8 @@ public class ContainerWeatherController extends Container { if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if (!stack.getItem().equals(Items.emerald) || !mergeItemStack(stack, 36, 36 + tileWC.getSizeInventory(), false)) { + } else if (!stack.getItem().equals(Items.emerald) + || !mergeItemStack(stack, 36, 36 + tileWC.getSizeInventory(), false)) { return null; } @@ -68,5 +68,4 @@ public class ContainerWeatherController extends Container { public TileWeatherController getTileWC() { return tileWC; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java b/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java index fd25b7f0..0f88bd66 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java @@ -14,8 +14,5 @@ public class DummyContainer extends Container { } @Override - public void putStackInSlot(int p_75141_1_, ItemStack p_75141_2_) { - - } - + public void putStackInSlot(int p_75141_1_, ItemStack p_75141_2_) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java index 98a760f4..a48595b0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java @@ -3,17 +3,20 @@ package com.brandon3055.draconicevolution.common.entity; import com.brandon3055.brandonscore.common.handlers.IProcess; import com.brandon3055.brandonscore.common.handlers.ProcessHandler; import com.brandon3055.brandonscore.common.utills.Utills; +import java.util.Random; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.Random; - /** * Created by brandon3055 on 12/8/2015. */ public class ChaosImplosion implements IProcess { - public static DamageSource chaosImplosion = new DamageSource("chaosImplosion").setExplosion().setDamageBypassesArmor().setDamageIsAbsolute().setDamageAllowedInCreativeMode(); + public static DamageSource chaosImplosion = new DamageSource("chaosImplosion") + .setExplosion() + .setDamageBypassesArmor() + .setDamageIsAbsolute() + .setDamageAllowedInCreativeMode(); private World worldObj; private int xCoord; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java index fe91e0e6..a6eb3c63 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java @@ -2,13 +2,12 @@ package com.brandon3055.draconicevolution.common.entity; import com.brandon3055.brandonscore.common.handlers.IProcess; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.ReactorExplosion; +import java.util.List; +import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - /** * Created by brandon3055 on 12/8/2015. */ @@ -36,10 +35,11 @@ public class ChaosImplosionTrace implements IProcess { float energy = power * 10; for (int y = yCoord; y > 0 && energy > 0; y--) { - List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + List entities = worldObj.getEntitiesWithinAABB( + Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ChaosImplosion.chaosImplosion, power * 100); - //energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); + // energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); if (energy >= 0) worldObj.setBlockToAir(xCoord, y, zCoord); energy -= 0.5F + (0.1F * (yCoord - y)); @@ -48,16 +48,16 @@ public class ChaosImplosionTrace implements IProcess { energy = power * 20; yCoord++; for (int y = yCoord; y < 255 && energy > 0; y++) { - List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + List entities = worldObj.getEntitiesWithinAABB( + Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100); - //energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); + // energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); if (energy >= 0) worldObj.setBlockToAir(xCoord, y, zCoord); energy -= 0.5F + (0.1F * (y - yCoord)); } - isDead = true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java index a49b4c7b..2cbaad3c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java @@ -17,7 +17,8 @@ public class EntityChaosBolt extends Entity { public double shardZ; public boolean burst; public int ticks = 0; - private static DamageSource chaosBurst = new DamageSource("chaosBurst").setDamageBypassesArmor().setDamageIsAbsolute(); + private static DamageSource chaosBurst = + new DamageSource("chaosBurst").setDamageBypassesArmor().setDamageIsAbsolute(); public EntityChaosBolt(World world) { this(world, 0, 0, 0, 0, 0, 0); @@ -60,30 +61,36 @@ public class EntityChaosBolt extends Entity { if (ticks == 10 && !burst) { if (worldObj.isRemote) { - DraconicEvolution.proxy.spawnParticle(new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 10), 32); + DraconicEvolution.proxy.spawnParticle( + new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 10), 32); } setDead(); } else if (ticks > 10) { if (ticks < 25) { for (int i = 0; i < 20; i++) { if (worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle(new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 0), 32); + DraconicEvolution.proxy.spawnParticle( + new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 0), + 32); } } if (ticks > 40 && !worldObj.isRemote) { -// if (ticks % 5 == 0) -// { -// double dist = Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ); -// Vec3 dir = Vec3.createVectorHelper((shardX - posX) / dist, (shardY - posY) / dist, (shardZ - posZ) / dist); -// MovingObjectPosition movingobjectposition = this.worldObj.//func_147447_a(Vec3.createVectorHelper(posX, posY, posZ), dir, false, true, false); -// Entity entity = movingobjectposition.entityHit; //WorldUtil.rayTraceEntities(worldObj, Vec3.createVectorHelper(posX, posY, posZ), dir, 20); -// -// LogHelper.info(movingobjectposition); -// if (entity instanceof EntityLivingBase) { -// entity.hurtResistantTime = 0; -// entity.attackEntityFrom(chaosBurst, 50F); -// } -// } + // if (ticks % 5 == 0) + // { + // double dist = Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ); + // Vec3 dir = Vec3.createVectorHelper((shardX - posX) / dist, (shardY - posY) / dist, (shardZ - + // posZ) / dist); + // MovingObjectPosition movingobjectposition = + // this.worldObj.//func_147447_a(Vec3.createVectorHelper(posX, posY, posZ), dir, false, true, false); + // Entity entity = movingobjectposition.entityHit; //WorldUtil.rayTraceEntities(worldObj, + // Vec3.createVectorHelper(posX, posY, posZ), dir, 20); + // + // LogHelper.info(movingobjectposition); + // if (entity instanceof EntityLivingBase) { + // entity.hurtResistantTime = 0; + // entity.attackEntityFrom(chaosBurst, 50F); + // } + // } } } @@ -96,18 +103,18 @@ public class EntityChaosBolt extends Entity { @Override protected void readEntityFromNBT(NBTTagCompound compound) { -// if (compound.hasKey("ShardPos")){ -// int[] pos = compound.getIntArray("ShardPos"); -// shardX = pos[0]; -// shardY = pos[1]; -// shardZ = pos[2]; -// LogHelper.info("read"); -// } + // if (compound.hasKey("ShardPos")){ + // int[] pos = compound.getIntArray("ShardPos"); + // shardX = pos[0]; + // shardY = pos[1]; + // shardZ = pos[2]; + // LogHelper.info("read"); + // } } @Override protected void writeEntityToNBT(NBTTagCompound compound) { -// compound.setIntArray("ShardPos", new int[] {(int)(shardX-0.5D), (int)(shardY-0.5D), (int)(shardZ-0.5D)}); -// LogHelper.info("write"); + // compound.setIntArray("ShardPos", new int[] {(int)(shardX-0.5D), (int)(shardY-0.5D), (int)(shardZ-0.5D)}); + // LogHelper.info("write"); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java index 202dea26..3f3c2ae7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.entity; import com.brandon3055.draconicevolution.common.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.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; @@ -18,8 +19,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldProviderEnd; -import java.util.List; - /** * Created by brandon3055 on 30/8/2015. */ @@ -35,7 +34,7 @@ public class EntityChaosCrystal extends EntityLivingBase { super(p_i1698_1_); this.preventEntitySpawning = true; this.setSize(2.0F, 2.0F); - //this.yOffset = -2; + // this.yOffset = -2; this.innerRotation = this.rand.nextInt(100000); this.setHealth(getMaxHealth()); this.ignoreFrustumCheck = true; @@ -73,7 +72,7 @@ public class EntityChaosCrystal extends EntityLivingBase { shieldTime = (int) dataWatcher.getWatchableObjectShort(20); health = dataWatcher.getWatchableObjectFloat(21); } - //setHealth(0); + // setHealth(0); if (health > 0) { if (shieldTime > 0) shieldTime--; if (deathAnimation < 1F) deathAnimation += 0.1F; @@ -83,7 +82,9 @@ public class EntityChaosCrystal extends EntityLivingBase { int j = MathHelper.floor_double(this.posY); int k = MathHelper.floor_double(this.posZ); - if (this.worldObj.provider instanceof WorldProviderEnd && this.worldObj.getBlock(i, j, k).isBlockSolid(this.worldObj, i, j, k, 0) && this.worldObj.getBlock(i, j, k) != Blocks.fire) { + if (this.worldObj.provider instanceof WorldProviderEnd + && this.worldObj.getBlock(i, j, k).isBlockSolid(this.worldObj, i, j, k, 0) + && this.worldObj.getBlock(i, j, k) != Blocks.fire) { this.worldObj.setBlock(i, j, k, Blocks.fire); } @@ -159,7 +160,13 @@ public class EntityChaosCrystal extends EntityLivingBase { if (getHealth() <= 0) worldObj.createExplosion(null, this.posX, this.posY, this.posZ, 6.0F, false); else { shieldTime = 100 + rand.nextInt(100); - worldObj.playSoundEffect(posX + 0.5D, posY + 0.5D, posZ + 0.5D, "draconicevolution:shieldUp", 10.0F, rand.nextFloat() * 0.1F + 1.055F); + worldObj.playSoundEffect( + posX + 0.5D, + posY + 0.5D, + posZ + 0.5D, + "draconicevolution:shieldUp", + 10.0F, + rand.nextFloat() * 0.1F + 1.055F); } if (getGuardian() != null) getGuardian().onCrystalTargeted((EntityPlayer) source.getEntity(), getHealth() <= 0); @@ -171,7 +178,10 @@ public class EntityChaosCrystal extends EntityLivingBase { private EntityChaosGuardian getGuardian() { if (guardian == null) { - List list = worldObj.getEntitiesWithinAABB(EntityChaosGuardian.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ).expand(512, 512, 512)); + List list = worldObj.getEntitiesWithinAABB( + EntityChaosGuardian.class, + AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ) + .expand(512, 512, 512)); if (list.size() > 0) guardian = list.get(0); if (guardian != null && guardian.crystals != null && !guardian.crystals.contains(this)) { guardian.crystals.add(this); @@ -203,12 +213,10 @@ public class EntityChaosCrystal extends EntityLivingBase { } @Override - public void setCurrentItemOrArmor(int p_70062_1_, ItemStack p_70062_2_) { - - } + public void setCurrentItemOrArmor(int p_70062_1_, ItemStack p_70062_2_) {} @Override public ItemStack[] getLastActiveItems() { return new ItemStack[0]; } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java index e13e16a2..acb7d484 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java @@ -1,15 +1,14 @@ package com.brandon3055.draconicevolution.common.entity; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.brandonscore.common.utills.Utills; +import java.util.ArrayList; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import java.util.ArrayList; - /** * Created by Brandon on 14/09/2014. */ @@ -42,20 +41,16 @@ public class EntityChaosDrill extends Entity { @Override public void onUpdate() { - //LogHelper.info("onUpdate"); + // LogHelper.info("onUpdate"); mineNextBlockInPattern(); entityTick(); } @Override - protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { - - } + protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {} @Override - protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { - - } + protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {} private void entityTick() { if (ENTITY_AGE >= MAX_AGE) setDead(); @@ -66,7 +61,10 @@ public class EntityChaosDrill extends Entity { ArrayList blocks = getBlocksInSphere(5); LogHelper.info(blocks.size()); if (blocks.size() > 0) - worldObj.setBlockToAir(blocks.get(1).getXCoord(), blocks.get(1).getYCoord(), blocks.get(1).getZCoord()); + worldObj.setBlockToAir( + blocks.get(1).getXCoord(), + blocks.get(1).getYCoord(), + blocks.get(1).getZCoord()); } private ArrayList getBlocksInSphere(int r) { @@ -94,5 +92,4 @@ public class EntityChaosDrill extends Entity { return blocks; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java index 67e356b2..64de2be2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java @@ -5,6 +5,9 @@ import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; import com.brandon3055.draconicevolution.common.utills.DamageSourceChaos; import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -19,14 +22,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - /** * Created by Brandon on 4/07/2014. */ -public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolution.ChaosGuardian +public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolution.ChaosGuardian private Entity target; @@ -34,6 +33,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio * The spawn coordinates of this dragon */ public int homeX = 0; + public int homeY = -1; public int homeZ = 0; public boolean homeSet = false; @@ -92,7 +92,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio @Override protected void entityInit() { super.entityInit(); -// dataWatcher.addObject(20, connectedCrystalID); + // dataWatcher.addObject(20, connectedCrystalID); dataWatcher.addObject(21, crystalX); dataWatcher.addObject(22, crystalY); dataWatcher.addObject(23, crystalZ); @@ -109,10 +109,9 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2000); } - @Override public void onLivingUpdate() { - //Set home position when spawned + // Set home position when spawned if (!homeSet) { homeX = (int) posX; homeY = (int) posY; @@ -129,19 +128,28 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio float moveSpeedMultiplier = behaviour.dragonSpeed; if (this.worldObj.isRemote) { -// connectedCrystalID = dataWatcher.getWatchableObjectInt(20); + // connectedCrystalID = dataWatcher.getWatchableObjectInt(20); crystalX = dataWatcher.getWatchableObjectInt(21); crystalY = dataWatcher.getWatchableObjectInt(22); crystalZ = dataWatcher.getWatchableObjectInt(23); -// if (ticksExisted % 10 == 0 && connectedCrystalID != -1 && worldObj.getEntityByID(connectedCrystalID) instanceof EntityChaosCrystal) healingChaosCrystal = (EntityChaosCrystal)worldObj.getEntityByID(connectedCrystalID); -// else if (connectedCrystalID == -1 && healingChaosCrystal != null) healingChaosCrystal = null; + // if (ticksExisted % 10 == 0 && connectedCrystalID != -1 && worldObj.getEntityByID(connectedCrystalID) + // instanceof EntityChaosCrystal) healingChaosCrystal = + // (EntityChaosCrystal)worldObj.getEntityByID(connectedCrystalID); + // else if (connectedCrystalID == -1 && healingChaosCrystal != null) healingChaosCrystal = null; f = MathHelper.cos(this.animTime * (float) Math.PI * 2.0F); f1 = MathHelper.cos(this.prevAnimTime * (float) Math.PI * 2.0F); if (f1 <= -0.3F && f >= -0.3F) { if (deathTicks <= 0) - this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.rand.nextFloat() * 0.3F, false); + this.worldObj.playSound( + this.posX, + this.posY, + this.posZ, + "mob.enderdragon.wings", + 5.0F, + 0.8F + this.rand.nextFloat() * 0.3F, + false); } } @@ -149,7 +157,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio float f2; if (!worldObj.isRemote) { -// dataWatcher.updateObject(20, connectedCrystalID); + // dataWatcher.updateObject(20, connectedCrystalID); dataWatcher.updateObject(21, crystalX); dataWatcher.updateObject(22, crystalY); dataWatcher.updateObject(23, crystalZ); @@ -164,8 +172,8 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio if (deathTicks > 0) DragonChunkLoader.stopLoading(this); customAIUpdate(); - if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) - moveSpeedMultiplier = 0; + if (behaviour == EnumBehaviour.FIREBOMB + && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) moveSpeedMultiplier = 0; } if (this.getHealth() <= 0.0F) { @@ -173,11 +181,20 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio f = (this.rand.nextFloat() - 0.5F) * 8.0F; f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; f2 = (this.rand.nextFloat() - 0.5F) * 8.0F; - this.worldObj.spawnParticle("largeexplode", this.posX + (double) f, this.posY + 2.0D + (double) f1, this.posZ + (double) f2, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "largeexplode", + this.posX + (double) f, + this.posY + 2.0D + (double) f1, + this.posZ + (double) f2, + 0.0D, + 0.0D, + 0.0D); } { this.updateDragonEnderCrystal(); - f = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); + f = 0.2F + / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + + 1.0F); f *= moveSpeedMultiplier == 0 ? 1 : moveSpeedMultiplier; f *= (float) Math.pow(2.0D, this.motionY); @@ -214,8 +231,11 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio d0 = this.posY + (this.newPosY - this.posY) / (double) this.newPosRotationIncrements; d1 = this.posZ + (this.newPosZ - this.posZ) / (double) this.newPosRotationIncrements; d2 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double) this.rotationYaw); - this.rotationYaw = (float) ((double) this.rotationYaw + d2 / (double) this.newPosRotationIncrements); - this.rotationPitch = (float) ((double) this.rotationPitch + (this.newRotationPitch - (double) this.rotationPitch) / (double) this.newPosRotationIncrements); + this.rotationYaw = + (float) ((double) this.rotationYaw + d2 / (double) this.newPosRotationIncrements); + this.rotationPitch = (float) ((double) this.rotationPitch + + (this.newRotationPitch - (double) this.rotationPitch) + / (double) this.newPosRotationIncrements); --this.newPosRotationIncrements; this.setPosition(d10, d0, d1); this.setRotation(this.rotationYaw, this.rotationPitch); @@ -231,7 +251,9 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio if (behaviour == EnumBehaviour.CIRCLE_PLAYER) { this.targetX = this.target.posX + (int) (Math.cos(circlePosition) * 60); this.targetZ = this.target.posZ + (int) (Math.sin(circlePosition) * 60); - moveSpeedMultiplier = 1F + Math.min(((float) Utills.getDistanceAtoB(targetX, targetZ, posX, posZ) / 50) * 3F, 3F); + moveSpeedMultiplier = 1F + + Math.min( + ((float) Utills.getDistanceAtoB(targetX, targetZ, posX, posZ) / 50) * 3F, 3F); } else { this.targetX = this.target.posX; this.targetZ = this.target.posZ; @@ -246,19 +268,22 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio d8 = 10.0D; } - this.targetY = this.target.boundingBox.minY + d8 + (behaviour == EnumBehaviour.CIRCLE_PLAYER ? 25 : 0); + this.targetY = + this.target.boundingBox.minY + d8 + (behaviour == EnumBehaviour.CIRCLE_PLAYER ? 25 : 0); } else if (behaviour != EnumBehaviour.FIREBOMB) { this.targetX += this.rand.nextGaussian() * 2.0D; this.targetZ += this.rand.nextGaussian() * 2.0D; } - if (this.forceNewTarget || d2 < 100.0D || d2 > 22500.0D || this.isCollidedHorizontally || this.isCollidedVertically) - this.setNewTarget(); - + if (this.forceNewTarget + || d2 < 100.0D + || d2 > 22500.0D + || this.isCollidedHorizontally + || this.isCollidedVertically) this.setNewTarget(); d0 /= (double) MathHelper.sqrt_double(d10 * d10 + d1 * d1); - //if (isUber) f12 = 1.0F;//Verticle Motion Speed - //else + // if (isUber) f12 = 1.0F;//Verticle Motion Speed + // else f12 = 0.6F; if (d0 < (double) (-f12)) { @@ -282,8 +307,14 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio d6 = -50.0D; } - Vec3 vec3 = Vec3.createVectorHelper(this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ).normalize(); - Vec3 vec32 = Vec3.createVectorHelper((double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), this.motionY, (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))).normalize(); + Vec3 vec3 = Vec3.createVectorHelper( + this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ) + .normalize(); + Vec3 vec32 = Vec3.createVectorHelper( + (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), + this.motionY, + (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))) + .normalize(); float f5 = (float) (vec32.dotProduct(vec3) + 0.5D) / 1.5F; if (f5 < 0.0F) { @@ -291,26 +322,35 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio } this.randomYawVelocity *= 0.8F; - float f6 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; + float f6 = + MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0D + 1.0D; if (d9 > 40.0D) { d9 = 40.0D; } - this.randomYawVelocity = (float) ((double) this.randomYawVelocity + d6 * (0.699999988079071D / d9 / (double) f6)); + this.randomYawVelocity = + (float) ((double) this.randomYawVelocity + d6 * (0.699999988079071D / d9 / (double) f6)); this.rotationYaw += this.randomYawVelocity * 0.1F; float f7 = (float) (2.0D / (d9 + 1.0D)); float f8 = 0.06F; this.moveFlying(0.0F, -1.0F, f8 * (f5 * f7 + (1.0F - f7))); if (this.slowed) { - this.moveEntity(this.motionX * 0.800000011920929D * moveSpeedMultiplier, this.motionY * 0.800000011920929D * moveSpeedMultiplier, this.motionZ * 0.800000011920929D * moveSpeedMultiplier); + this.moveEntity( + this.motionX * 0.800000011920929D * moveSpeedMultiplier, + this.motionY * 0.800000011920929D * moveSpeedMultiplier, + this.motionZ * 0.800000011920929D * moveSpeedMultiplier); } else { - this.moveEntity(this.motionX * moveSpeedMultiplier, this.motionY * moveSpeedMultiplier, this.motionZ * moveSpeedMultiplier); + this.moveEntity( + this.motionX * moveSpeedMultiplier, + this.motionY * moveSpeedMultiplier, + this.motionZ * moveSpeedMultiplier); } - Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ).normalize(); + Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ) + .normalize(); float f9 = (float) (vec31.dotProduct(vec32) + 1.0D) / 2.0F; f9 = 0.8F + 0.15F * f9; this.motionX *= (double) f9; @@ -329,23 +369,40 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio this.dragonPartWing1.width = 4.0F; this.dragonPartWing2.height = 3.0F; this.dragonPartWing2.width = 4.0F; - f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) * 10.0F / 180.0F * (float) Math.PI; + f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) + * 10.0F + / 180.0F + * (float) Math.PI; f2 = MathHelper.cos(f1); float f10 = -MathHelper.sin(f1); float f3 = this.rotationYaw * (float) Math.PI / 180.0F; float f11 = MathHelper.sin(f3); float f4 = MathHelper.cos(f3); this.dragonPartBody.onUpdate(); - this.dragonPartBody.setLocationAndAngles(this.posX + (double) (f11 * 0.5F), this.posY, this.posZ - (double) (f4 * 0.5F), 0.0F, 0.0F); + this.dragonPartBody.setLocationAndAngles( + this.posX + (double) (f11 * 0.5F), this.posY, this.posZ - (double) (f4 * 0.5F), 0.0F, 0.0F); this.dragonPartWing1.onUpdate(); - this.dragonPartWing1.setLocationAndAngles(this.posX + (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ + (double) (f11 * 4.5F), 0.0F, 0.0F); + this.dragonPartWing1.setLocationAndAngles( + this.posX + (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ + (double) (f11 * 4.5F), 0.0F, 0.0F); this.dragonPartWing2.onUpdate(); - this.dragonPartWing2.setLocationAndAngles(this.posX - (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ - (double) (f11 * 4.5F), 0.0F, 0.0F); + this.dragonPartWing2.setLocationAndAngles( + this.posX - (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ - (double) (f11 * 4.5F), 0.0F, 0.0F); if (!this.worldObj.isRemote && this.hurtTime == 0) { - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing1.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing2.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); - this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing1 + .boundingBox + .expand(4.0D, 2.0D, 4.0D) + .offset(0.0D, -2.0D, 0.0D))); + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing2 + .boundingBox + .expand(4.0D, 2.0D, 4.0D) + .offset(0.0D, -2.0D, 0.0D))); + this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); } double[] adouble1 = this.getMovementOffsets(5, 1.0F); @@ -353,7 +410,12 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio f12 = MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F - this.randomYawVelocity * 0.01F); float f13 = MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F - this.randomYawVelocity * 0.01F); this.dragonPartHead.onUpdate(); - this.dragonPartHead.setLocationAndAngles(this.posX + (double) (f12 * 5.5F * f2), this.posY + (adouble[1] - adouble1[1]) * 1.0D + (double) (f10 * 5.5F), this.posZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F); + this.dragonPartHead.setLocationAndAngles( + this.posX + (double) (f12 * 5.5F * f2), + this.posY + (adouble[1] - adouble1[1]) * 1.0D + (double) (f10 * 5.5F), + this.posZ - (double) (f13 * 5.5F * f2), + 0.0F, + 0.0F); for (int j = 0; j < 3; ++j) { EntityDragonPart entitydragonpart = null; @@ -371,20 +433,26 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio } double[] adouble2 = this.getMovementOffsets(12 + j * 2, 1.0F); - float f14 = this.rotationYaw * (float) Math.PI / 180.0F + this.simplifyAngle(adouble2[0] - adouble1[0]) * (float) Math.PI / 180.0F * 1.0F; + float f14 = this.rotationYaw * (float) Math.PI / 180.0F + + this.simplifyAngle(adouble2[0] - adouble1[0]) * (float) Math.PI / 180.0F * 1.0F; float f15 = MathHelper.sin(f14); float f16 = MathHelper.cos(f14); float f17 = 1.5F; float f18 = (float) (j + 1) * 2.0F; entitydragonpart.onUpdate(); - entitydragonpart.setLocationAndAngles(this.posX - (double) ((f11 * f17 + f15 * f18) * f2), this.posY + (adouble2[1] - adouble1[1]) * 1.0D - (double) ((f18 + f17) * f10) + 1.5D, this.posZ + (double) ((f4 * f17 + f16 * f18) * f2), 0.0F, 0.0F); + entitydragonpart.setLocationAndAngles( + this.posX - (double) ((f11 * f17 + f15 * f18) * f2), + this.posY + (adouble2[1] - adouble1[1]) * 1.0D - (double) ((f18 + f17) * f10) + 1.5D, + this.posZ + (double) ((f4 * f17 + f16 * f18) * f2), + 0.0F, + 0.0F); } if (!this.worldObj.isRemote) { - this.slowed = this.destroyBlocksInAABB(this.dragonPartHead.boundingBox) | this.destroyBlocksInAABB(this.dragonPartBody.boundingBox); + this.slowed = this.destroyBlocksInAABB(this.dragonPartHead.boundingBox) + | this.destroyBlocksInAABB(this.dragonPartBody.boundingBox); } } - } public void onCrystalTargeted(EntityPlayer player, boolean destroyed) { @@ -404,12 +472,21 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio attackTimer = 1000; } if (deathTicks <= 0) - this.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "mob.enderdragon.growl", 20.0F, 0.8F + this.rand.nextFloat() * 0.3F); + this.worldObj.playSoundEffect( + player.posX, + player.posY, + player.posZ, + "mob.enderdragon.growl", + 20.0F, + 0.8F + this.rand.nextFloat() * 0.3F); } public void updateCrystals() { if (crystals == null) crystals = new ArrayList(); - List list = worldObj.getEntitiesWithinAABB(EntityChaosCrystal.class, AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ).expand(200, 200, 200)); + List list = worldObj.getEntitiesWithinAABB( + EntityChaosCrystal.class, + AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ) + .expand(200, 200, 200)); activeCrystals = 0; for (EntityChaosCrystal crystal : list) { if (!crystals.contains(crystal)) crystals.add(crystal); @@ -425,12 +502,11 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio crystals = null; activeCrystals = 0; crystalY = -1; -// connectedCrystalID = -1; + // connectedCrystalID = -1; healingChaosCrystal = null; updateCrystals(); } - switch (behaviour) { case ROAMING: if (worldObj.getClosestVulnerablePlayer(homeX, homeY, homeZ, 200) != null) selectNewBehaviour(); @@ -443,9 +519,9 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio case GUARDING: break; - case FIREBOMB: - break; - + case FIREBOMB: + break; + case CHARGING: if (Utills.getDistanceAtoB(posX, posZ, homeX, homeZ) > 300) behaviour = EnumBehaviour.GO_HOME; break; @@ -457,7 +533,8 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case LOW_HEALTH_STRATEGY: - if (worldObj.getClosestVulnerablePlayer(targetX, targetY, targetZ, 60) != null && attackInProgress != ATTACK_TELEPORT) { + if (worldObj.getClosestVulnerablePlayer(targetX, targetY, targetZ, 60) != null + && attackInProgress != ATTACK_TELEPORT) { int escape = 0; boolean flag = false; while (!flag && escape < 50) { @@ -479,26 +556,33 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio targetZ = homeZ; break; } -//ignitionChargeTimer = 10; + // ignitionChargeTimer = 10; if (behaviour == EnumBehaviour.DEAD) return; if (ticksExisted % 1000 == 0 && rand.nextBoolean()) selectNewBehaviour(); - if (ignitionChargeTimer > 1 || (ignitionChargeTimer == 1 && ticksExisted % 20 == 0) && !ConfigHandler.disableGuardianCrystalRespawn) + if (ignitionChargeTimer > 1 + || (ignitionChargeTimer == 1 && ticksExisted % 20 == 0) && !ConfigHandler.disableGuardianCrystalRespawn) ignitionChargeTimer--; if (ignitionChargeTimer <= 0 && !worldObj.isRemote) { if ((ticksExisted - 19) % 20 == 0) - ignitionChargeTimer = (behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 1000 : 2000) + rand.nextInt(600); + ignitionChargeTimer = + (behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 1000 : 2000) + rand.nextInt(600); if (activeCrystals < crystals.size() && ticksExisted % 10 == 0) { EntityChaosCrystal closest = null; for (EntityChaosCrystal crystal : crystals) - if (!crystal.isAlive() && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) + if (!crystal.isAlive() + && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) closest = crystal; if (closest != null) { - EntityDragonProjectile charge = new EntityDragonProjectile(worldObj, EntityDragonProjectile.IGNITION_CHARGE, closest, 0, this); - charge.setPosition(dragonPartHead.posX + Math.cos((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2, dragonPartHead.posY + 1.5, dragonPartHead.posZ + Math.sin((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2); + EntityDragonProjectile charge = new EntityDragonProjectile( + worldObj, EntityDragonProjectile.IGNITION_CHARGE, closest, 0, this); + charge.setPosition( + dragonPartHead.posX + Math.cos((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2, + dragonPartHead.posY + 1.5, + dragonPartHead.posZ + Math.sin((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2); worldObj.spawnEntityInWorld(charge); } } @@ -510,30 +594,45 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio private void updateAttack() { if (worldObj.isRemote || behaviour == EnumBehaviour.DEAD) return; - if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) { + if (behaviour == EnumBehaviour.FIREBOMB + && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) { if (target == null || ticksExisted % 100 == 0) setNewTarget(); if (target != null) { - double distance = Utills.getDistanceAtoB(target.posX, target.posZ, dragonPartHead.posX, dragonPartHead.posZ); + double distance = + Utills.getDistanceAtoB(target.posX, target.posZ, dragonPartHead.posX, dragonPartHead.posZ); if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) < 5) distance *= -1; - float anglePitch = (float) Math.toDegrees(Math.atan2(target.posY - dragonPartHead.posY, distance)) * -1F; - float angleYaw = (float) Math.toDegrees(Math.atan2(target.posX - dragonPartHead.posX, target.posZ - posZ)) * -1F; + float anglePitch = + (float) Math.toDegrees(Math.atan2(target.posY - dragonPartHead.posY, distance)) * -1F; + float angleYaw = + (float) Math.toDegrees(Math.atan2(target.posX - dragonPartHead.posX, target.posZ - posZ)) * -1F; rotationPitch = anglePitch; if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) > 8) rotationYaw = angleYaw + 180; - if (ticksExisted % 2 == 0) { - EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.FIREBOMB, target instanceof EntityLivingBase ? (EntityLivingBase) target : null, 5F + (rand.nextFloat() * 8F), this); - projectile.setPosition(dragonPartHead.posX + Math.cos((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2, dragonPartHead.posY + 1.5, dragonPartHead.posZ + Math.sin((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2); + EntityDragonProjectile projectile = new EntityDragonProjectile( + worldObj, + EntityDragonProjectile.FIREBOMB, + target instanceof EntityLivingBase ? (EntityLivingBase) target : null, + 5F + (rand.nextFloat() * 8F), + this); + projectile.setPosition( + dragonPartHead.posX + Math.cos((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2, + dragonPartHead.posY + 1.5, + dragonPartHead.posZ + Math.sin((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2); worldObj.spawnEntityInWorld(projectile); } } - } else if (nextAttackTimer > 0) nextAttackTimer--; else if (nextAttackTimer == 0) { Entity attackTarget = target; - List targets = attackTarget == null ? worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ).expand(100, 100, 100)) : null; + List targets = attackTarget == null + ? worldObj.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ) + .expand(100, 100, 100)) + : null; if (targets != null && targets.size() > 0) { Iterator i = targets.iterator(); @@ -546,17 +645,17 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio attackTarget = targets.get(rand.nextInt(targets.size())); if (attackTarget == null) return; - - //Select an attack + // Select an attack if (attackInProgress == -1) { selectNewAttack(); switch (attackInProgress) { - case ATTACK_FIREBALL_CHARGE: { - attackTimer = 90 + rand.nextInt(80); - previousBehaviour = behaviour; - behaviour = EnumBehaviour.CHARGING; - } - break; + case ATTACK_FIREBALL_CHARGE: + { + attackTimer = 90 + rand.nextInt(80); + previousBehaviour = behaviour; + behaviour = EnumBehaviour.CHARGING; + } + break; case ATTACK_FIREBALL_CHASER: attackTimer = 10 + rand.nextInt(80); break; @@ -575,36 +674,61 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio switch (attackInProgress) { case ATTACK_FIREBALL_CHARGE: if (target == null && behaviour == EnumBehaviour.CHARGING) target = attackTarget; - if (Utills.getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 10) { + if (Utills.getDistanceAtoB( + posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) + > 10) { if (attackTimer % 2 == 0) { - EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.FIREBOMB, attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, 5F + (rand.nextFloat() * 8F), this); + EntityDragonProjectile projectile = new EntityDragonProjectile( + worldObj, + EntityDragonProjectile.FIREBOMB, + attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, + 5F + (rand.nextFloat() * 8F), + this); projectile.setPosition(dragonPartHead.posX, dragonPartHead.posY, dragonPartHead.posZ); worldObj.spawnEntityInWorld(projectile); } - double distance = Utills.getDistanceAtoB(attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); - float angle = (float) Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) * -1F; + double distance = Utills.getDistanceAtoB( + attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); + float angle = + (float) Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) + * -1F; rotationPitch = angle; } else attackTimer = 0; break; case ATTACK_FIREBALL_CHASER: if (attackTimer % 10 == 0) { - EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.FIRE_CHASER, attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, 5F + (rand.nextFloat() * 2F), this); + EntityDragonProjectile projectile = new EntityDragonProjectile( + worldObj, + EntityDragonProjectile.FIRE_CHASER, + attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, + 5F + (rand.nextFloat() * 2F), + this); projectile.setPosition(dragonPartHead.posX, dragonPartHead.posY, dragonPartHead.posZ); worldObj.spawnEntityInWorld(projectile); } break; case ATTACK_ENERGY_CHASER: if (attackTimer % 10 == 0) { - EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.ENERGY_CHASER, attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, 5F + (rand.nextFloat() * 10F), this); + EntityDragonProjectile projectile = new EntityDragonProjectile( + worldObj, + EntityDragonProjectile.ENERGY_CHASER, + attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, + 5F + (rand.nextFloat() * 10F), + this); projectile.setPosition(dragonPartHead.posX, dragonPartHead.posY, dragonPartHead.posZ); worldObj.spawnEntityInWorld(projectile); } break; case ATTACK_CHAOS_CHASER: if (attackTimer % 10 == 0) { - EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.CHAOS_CHASER, attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, 5F + (rand.nextFloat() * 10F), this); + EntityDragonProjectile projectile = new EntityDragonProjectile( + worldObj, + EntityDragonProjectile.CHAOS_CHASER, + attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, + 5F + (rand.nextFloat() * 10F), + this); projectile.setPosition(dragonPartHead.posX, dragonPartHead.posY, dragonPartHead.posZ); worldObj.spawnEntityInWorld(projectile); } @@ -615,15 +739,25 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio attackInProgress = -1; return; } - if (Utills.getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 15) { + if (Utills.getDistanceAtoB( + posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) + > 15) { if (attackTimer % 2 == 0) { - EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.TELEPORT, attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, 5F + (rand.nextFloat() * 8F), this); + EntityDragonProjectile projectile = new EntityDragonProjectile( + worldObj, + EntityDragonProjectile.TELEPORT, + attackTarget instanceof EntityLivingBase ? (EntityLivingBase) attackTarget : null, + 5F + (rand.nextFloat() * 8F), + this); projectile.setPosition(dragonPartHead.posX, dragonPartHead.posY, dragonPartHead.posZ); worldObj.spawnEntityInWorld(projectile); } - double distance = Utills.getDistanceAtoB(attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); - float angle = (float) Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) * -1F; + double distance = Utills.getDistanceAtoB( + attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); + float angle = + (float) Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) + * -1F; rotationPitch = angle; } else attackTimer = 0; @@ -637,14 +771,31 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio nextAttackTimer = -1; } } else - nextAttackTimer = behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 10 + rand.nextInt(50) : 60 + rand.nextInt(200); + nextAttackTimer = + behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 10 + rand.nextInt(50) : 60 + rand.nextInt(200); } - private static final WeightedRandom.Item[] weightedAttacks = new WeightedRandom.Item[]{new WeightedAttack(16, ATTACK_FIREBALL_CHARGE), new WeightedAttack(14, ATTACK_FIREBALL_CHASER), new WeightedAttack(12, ATTACK_ENERGY_CHASER), new WeightedAttack(10, ATTACK_CHAOS_CHASER),}; + private static final WeightedRandom.Item[] weightedAttacks = new WeightedRandom.Item[] { + new WeightedAttack(16, ATTACK_FIREBALL_CHARGE), + new WeightedAttack(14, ATTACK_FIREBALL_CHASER), + new WeightedAttack(12, ATTACK_ENERGY_CHASER), + new WeightedAttack(10, ATTACK_CHAOS_CHASER), + }; - private static final WeightedRandom.Item[] weightedLowHealthAttaxks = new WeightedRandom.Item[]{new WeightedAttack(5, ATTACK_FIREBALL_CHASER), new WeightedAttack(5, ATTACK_TELEPORT), new WeightedAttack(10, ATTACK_ENERGY_CHASER), new WeightedAttack(15, ATTACK_CHAOS_CHASER),}; + private static final WeightedRandom.Item[] weightedLowHealthAttaxks = new WeightedRandom.Item[] { + new WeightedAttack(5, ATTACK_FIREBALL_CHASER), + new WeightedAttack(5, ATTACK_TELEPORT), + new WeightedAttack(10, ATTACK_ENERGY_CHASER), + new WeightedAttack(15, ATTACK_CHAOS_CHASER), + }; - private static final WeightedRandom.Item[] weightedBehaviours = new WeightedRandom.Item[]{new WeightedBehaviour(1, EnumBehaviour.LOW_HEALTH_STRATEGY), new WeightedBehaviour(10, EnumBehaviour.GUARDING), new WeightedBehaviour(4, EnumBehaviour.CHARGING), new WeightedBehaviour(12, EnumBehaviour.FIREBOMB), new WeightedBehaviour(20, EnumBehaviour.CIRCLE_PLAYER),}; + private static final WeightedRandom.Item[] weightedBehaviours = new WeightedRandom.Item[] { + new WeightedBehaviour(1, EnumBehaviour.LOW_HEALTH_STRATEGY), + new WeightedBehaviour(10, EnumBehaviour.GUARDING), + new WeightedBehaviour(4, EnumBehaviour.CHARGING), + new WeightedBehaviour(12, EnumBehaviour.FIREBOMB), + new WeightedBehaviour(20, EnumBehaviour.CIRCLE_PLAYER), + }; private void selectNewAttack() { if (behaviour == EnumBehaviour.DEAD) return; @@ -667,20 +818,12 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio private void updateTarget() { switch (behaviour) { case ROAMING: - - break; case GO_HOME: - - break; case GUARDING: - - break; case CHARGING: - - break; case FIREBOMB: if (Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) > 3) { @@ -691,12 +834,8 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case CIRCLE_PLAYER: - - break; case LOW_HEALTH_STRATEGY: - - break; case DEAD: this.targetX = homeX; @@ -711,10 +850,8 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio if (behaviour == EnumBehaviour.DEAD) return; this.forceNewTarget = false; - switch (behaviour) { case ROAMING: - boolean flag = false; do { this.targetX = homeX; @@ -732,7 +869,6 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case GO_HOME: case GUARDING: - this.targetX = homeX; this.targetY = (double) (homeY + this.rand.nextFloat() * 50.0F); this.targetZ = homeZ; @@ -741,32 +877,30 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case CHARGING: case CIRCLE_PLAYER: - if (worldObj.getClosestVulnerablePlayer(homeX, homeY, homeZ, 200) != null) this.target = worldObj.getClosestVulnerablePlayer(homeX, homeY, homeZ, 200); break; case LOW_HEALTH_STRATEGY: - - break; case FIREBOMB: - List targets = worldObj.getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(150, 150, 150)); + List targets = + worldObj.getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(150, 150, 150)); target = null; while (targets.size() > 0 && target == null) { EntityPlayer potentialTarget = targets.get(rand.nextInt(targets.size())); - if (worldObj.rayTraceBlocks(Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(potentialTarget.posX, potentialTarget.posY, potentialTarget.posZ)) == null) - target = potentialTarget; + if (worldObj.rayTraceBlocks( + Vec3.createVectorHelper(posX, posY, posZ), + Vec3.createVectorHelper( + potentialTarget.posX, potentialTarget.posY, potentialTarget.posZ)) + == null) target = potentialTarget; else targets.remove(potentialTarget); } break; case DEAD: - - break; } - } @Override @@ -811,9 +945,17 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case FIREBOMB: - if ((target == null && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) || rand.nextInt(5) == 0) - selectNewBehaviour(); - if (damageSource.getEntity() instanceof EntityPlayer && damageSource.getEntity() != target && worldObj.rayTraceBlocks(Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(damageSource.getEntity().posX, damageSource.getEntity().posY, damageSource.getEntity().posZ)) == null) { + if ((target == null && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) + || rand.nextInt(5) == 0) selectNewBehaviour(); + if (damageSource.getEntity() instanceof EntityPlayer + && damageSource.getEntity() != target + && worldObj.rayTraceBlocks( + Vec3.createVectorHelper(posX, posY, posZ), + Vec3.createVectorHelper( + damageSource.getEntity().posX, + damageSource.getEntity().posY, + damageSource.getEntity().posZ)) + == null) { target = damageSource.getEntity(); } break; @@ -821,20 +963,23 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; } -// float f1 = this.rotationYaw * (float)Math.PI / 180.0F; -// float f2 = MathHelper.sin(f1); -// float f3 = MathHelper.cos(f1); -// this.targetX = this.posX + (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); -// this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D; -// this.targetZ = this.posZ - (double)(f3 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); -// this.target = null; + // float f1 = this.rotationYaw * (float)Math.PI / 180.0F; + // float f2 = MathHelper.sin(f1); + // float f3 = MathHelper.cos(f1); + // this.targetX = this.posX + (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + // this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D; + // this.targetZ = this.posZ - (double)(f3 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + // this.target = null; - if ((damageSource.getEntity() instanceof EntityPlayer || damageSource.isExplosion()) && healingChaosCrystal == null)//tod reanable this + if ((damageSource.getEntity() instanceof EntityPlayer || damageSource.isExplosion()) + && healingChaosCrystal == null) // tod reanable this { // if (getHealth() > 1F)setHealth(1F);//tod and remove this! this.func_82195_e(damageSource, dmg); } else if (damageSource.getEntity() instanceof EntityPlayer) - ((EntityPlayer) damageSource.getEntity()).addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("msg.de.guardianAttackBlocked.txt"))); + ((EntityPlayer) damageSource.getEntity()) + .addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + + StatCollector.translateToLocal("msg.de.guardianAttackBlocked.txt"))); return true; } @@ -877,7 +1022,6 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio private EnumBehaviour(float dragonSpeed) { this.dragonSpeed = dragonSpeed; } - } private static class WeightedAttack extends WeightedRandom.Item { @@ -900,25 +1044,27 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio @Override protected void onDeathUpdate() { -// if (deathTicks == 0 && !isUber) -// { -// for (int ix = -150; ix < 150; ix++) { -// for (int iz = -150; iz < 150; iz++) { -// if (worldObj.getBlock(ix, homeY, iz) == Blocks.bedrock && worldObj.getBlock(ix, homeY - 1, iz) == Blocks.bedrock) { -// homeX = ix; -// homeZ = iz; -// createPortal = false; -// break; -// } -// } -// } -// if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0) { -// createPortal = false; -// homeX = ConfigHandler.dragonEggSpawnLocation[0]; -// homeY = ConfigHandler.dragonEggSpawnLocation[1]; -// homeZ = ConfigHandler.dragonEggSpawnLocation[2]; -// } -// } + // if (deathTicks == 0 && !isUber) + // { + // for (int ix = -150; ix < 150; ix++) { + // for (int iz = -150; iz < 150; iz++) { + // if (worldObj.getBlock(ix, homeY, iz) == Blocks.bedrock && worldObj.getBlock(ix, homeY - 1, iz) == + // Blocks.bedrock) { + // homeX = ix; + // homeZ = iz; + // createPortal = false; + // break; + // } + // } + // } + // if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || + // ConfigHandler.dragonEggSpawnLocation[1] != 0) { + // createPortal = false; + // homeX = ConfigHandler.dragonEggSpawnLocation[0]; + // homeY = ConfigHandler.dragonEggSpawnLocation[1]; + // homeZ = ConfigHandler.dragonEggSpawnLocation[2]; + // } + // } if (deathTicks == 0) { if (worldObj.getTileEntity(homeX, homeY, homeZ) instanceof TileChaosShard) { @@ -940,38 +1086,45 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio ++this.deathTicks; -// if (worldObj.rand.nextInt(5) == 2) -// { -// EntityLightningBolt bolt = new EntityLightningBolt(worldObj, homeX, homeY + 1, homeZ); -// bolt.ignoreFrustumCheck = true; -// worldObj.addWeatherEffect(bolt); -// } + // if (worldObj.rand.nextInt(5) == 2) + // { + // EntityLightningBolt bolt = new EntityLightningBolt(worldObj, homeX, homeY + 1, homeZ); + // bolt.ignoreFrustumCheck = true; + // worldObj.addWeatherEffect(bolt); + // } if (this.deathTicks >= 180 && this.deathTicks <= 200) { float f = (this.rand.nextFloat() - 0.5F) * 8.0F; float f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; float f2 = (this.rand.nextFloat() - 0.5F) * 8.0F; - this.worldObj.spawnParticle("hugeexplosion", this.posX + (double) f, this.posY + 2.0D + (double) f1, this.posZ + (double) f2, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "hugeexplosion", + this.posX + (double) f, + this.posY + 2.0D + (double) f1, + this.posZ + (double) f2, + 0.0D, + 0.0D, + 0.0D); } int i; int j; -// if (!this.worldObj.isRemote) { -// if (this.deathTicks > 150 && this.deathTicks % 5 == 0) { -// i = 1000; -// -// while (i > 0) { -// j = EntityXPOrb.getXPSplit(i); -// i -= j; -// this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); -// } -// } -// -// }else + // if (!this.worldObj.isRemote) { + // if (this.deathTicks > 150 && this.deathTicks % 5 == 0) { + // i = 1000; + // + // while (i > 0) { + // j = EntityXPOrb.getXPSplit(i); + // i -= j; + // this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + // } + // } + // + // }else if (this.deathTicks == 1) { this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.end", 50.0F, 1F, false); - //this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0); + // this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0); } if (getDistance(homeX, homeY, homeZ) < 20 && deathTicks % 2 == 0) { @@ -989,7 +1142,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } - //spawnEgg(); + // spawnEgg(); updateCrystals(); for (EntityChaosCrystal crystal : crystals) crystal.setDeathTimer(); setDead(); @@ -997,28 +1150,29 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio } private void collideWithEntities(List par1List) { -// if (true) return; -// -// double d0 = (this.dragonPartBody.boundingBox.minX + this.dragonPartBody.boundingBox.maxX) / 2.0D; -// double d1 = (this.dragonPartBody.boundingBox.minZ + this.dragonPartBody.boundingBox.maxZ) / 2.0D; -// Iterator iterator = par1List.iterator(); -// -// while (iterator.hasNext()) { -// Entity entity = (Entity) iterator.next(); -// -// if (entity instanceof EntityLivingBase) { -// double d2 = entity.posX - d0; -// double d3 = entity.posZ - d1; -// double d4 = d2 * d2 + d3 * d3; -// if (rand.nextInt(isUber ? 3 : 10) == 0) entity.addVelocity(d2 / d4 * 8.0D, 5.20000000298023224D, d3 / d4 * 8.0D); -// entity.velocityChanged = true; -// ((EntityLivingBase)entity).setLastAttacker(this); -// } -// if (entity instanceof EntityLivingBase && isUber){ -// ((EntityLivingBase)entity).setLastAttacker(this); -// entity.attackEntityFrom(new DamageSourceChaos(this), 20F); -// } -// } + // if (true) return; + // + // double d0 = (this.dragonPartBody.boundingBox.minX + this.dragonPartBody.boundingBox.maxX) / 2.0D; + // double d1 = (this.dragonPartBody.boundingBox.minZ + this.dragonPartBody.boundingBox.maxZ) / 2.0D; + // Iterator iterator = par1List.iterator(); + // + // while (iterator.hasNext()) { + // Entity entity = (Entity) iterator.next(); + // + // if (entity instanceof EntityLivingBase) { + // double d2 = entity.posX - d0; + // double d3 = entity.posZ - d1; + // double d4 = d2 * d2 + d3 * d3; + // if (rand.nextInt(isUber ? 3 : 10) == 0) entity.addVelocity(d2 / d4 * 8.0D, 5.20000000298023224D, d3 / d4 * + // 8.0D); + // entity.velocityChanged = true; + // ((EntityLivingBase)entity).setLastAttacker(this); + // } + // if (entity instanceof EntityLivingBase && isUber){ + // ((EntityLivingBase)entity).setLastAttacker(this); + // entity.attackEntityFrom(new DamageSourceChaos(this), 20F); + // } + // } } private void attackEntitiesInList(List par1List) { @@ -1044,7 +1198,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio if (getHealth() <= 0) { healingChaosCrystal = null; crystalY = -1; -// connectedCrystalID = -1; + // connectedCrystalID = -1; return; } @@ -1060,17 +1214,18 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio if (this.rand.nextInt(10) == 0) { EntityChaosCrystal closest = null; for (EntityChaosCrystal crystal : crystals) - if (crystal.isAlive() && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) + if (crystal.isAlive() + && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) closest = crystal; healingChaosCrystal = closest; if (healingChaosCrystal != null) { -// connectedCrystalID = healingChaosCrystal.getEntityId(); + // connectedCrystalID = healingChaosCrystal.getEntityId(); crystalX = (int) Math.floor(healingChaosCrystal.posX); crystalY = (int) Math.floor(healingChaosCrystal.posY); crystalZ = (int) Math.floor(healingChaosCrystal.posZ); } else { crystalY = -1; -// connectedCrystalID = -1; + // connectedCrystalID = -1; } } } @@ -1097,7 +1252,8 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio Block block = this.worldObj.getBlock(k1, l1, i2); if (!block.isAir(worldObj, k1, l1, i2)) { - if (block.canEntityDestroy(worldObj, k1, l1, i2, this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { + if (block.canEntityDestroy(worldObj, k1, l1, i2, this) + && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { flag1 = this.worldObj.setBlockToAir(k1, l1, i2) || flag1; } else { flag = true; @@ -1108,9 +1264,12 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio } if (flag1) { - double d1 = par1AxisAlignedBB.minX + (par1AxisAlignedBB.maxX - par1AxisAlignedBB.minX) * (double) this.rand.nextFloat(); - double d2 = par1AxisAlignedBB.minY + (par1AxisAlignedBB.maxY - par1AxisAlignedBB.minY) * (double) this.rand.nextFloat(); - double d0 = par1AxisAlignedBB.minZ + (par1AxisAlignedBB.maxZ - par1AxisAlignedBB.minZ) * (double) this.rand.nextFloat(); + double d1 = par1AxisAlignedBB.minX + + (par1AxisAlignedBB.maxX - par1AxisAlignedBB.minX) * (double) this.rand.nextFloat(); + double d2 = par1AxisAlignedBB.minY + + (par1AxisAlignedBB.maxY - par1AxisAlignedBB.minY) * (double) this.rand.nextFloat(); + double d0 = par1AxisAlignedBB.minZ + + (par1AxisAlignedBB.maxZ - par1AxisAlignedBB.minZ) * (double) this.rand.nextFloat(); this.worldObj.spawnParticle("largeexplode", d1, d2, d0, 0.0D, 0.0D, 0.0D); } @@ -1118,51 +1277,52 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio } private void spawnEgg() { -// if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 && !isUber) { -// homeX = ConfigHandler.dragonEggSpawnLocation[0]; -// homeY = ConfigHandler.dragonEggSpawnLocation[1]; -// homeZ = ConfigHandler.dragonEggSpawnLocation[2]; -// } -// -// BlockEndPortal.field_149948_a = true; -// -// if (createPortal || isUber) { -// createEnderPortal(homeX, homeZ); -// } -// LogHelper.info("spawn egg"); -// if (worldObj.getBlock(homeX, homeY + 1, homeZ) == Blocks.air) { -// worldObj.setBlock(homeX, homeY + 1, homeZ, Blocks.dragon_egg); -// LogHelper.info("spawn egg2 " + homeX + " " + homeY + " " + homeZ); -// }else { -// for (int i = homeY + 1; i < 250; i++) { -// if (worldObj.getBlock(homeX, i, homeZ) == Blocks.air) { -// worldObj.setBlock(homeX, i, homeZ, Blocks.dragon_egg); -// LogHelper.info("spawn egg3"); -// break; -// } -// } -// } -// -// for (int iX = homeX - 2; iX <= homeX + 2; iX++) -// { -// for (int iZ = homeZ - 2; iZ <= homeZ + 2; iZ++) -// { -// -// if (worldObj.getBlock(iX, homeY - 4, iZ) == Blocks.bedrock && !(iX == homeX && iZ == homeZ)) -// { -// worldObj.setBlock(iX, homeY - 3, iZ, Blocks.end_portal); -// } -// } -// } -// -// -// worldObj.setBlock(homeX - 1, homeY - 1, homeZ, Blocks.torch); -// worldObj.setBlock(homeX + 1, homeY - 1, homeZ, Blocks.torch); -// worldObj.setBlock(homeX, homeY - 1, homeZ - 1, Blocks.torch); -// worldObj.setBlock(homeX, homeY - 1, homeZ + 1, Blocks.torch); -// -// -// BlockEndPortal.field_149948_a = false; + // if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || + // ConfigHandler.dragonEggSpawnLocation[1] != 0 && !isUber) { + // homeX = ConfigHandler.dragonEggSpawnLocation[0]; + // homeY = ConfigHandler.dragonEggSpawnLocation[1]; + // homeZ = ConfigHandler.dragonEggSpawnLocation[2]; + // } + // + // BlockEndPortal.field_149948_a = true; + // + // if (createPortal || isUber) { + // createEnderPortal(homeX, homeZ); + // } + // LogHelper.info("spawn egg"); + // if (worldObj.getBlock(homeX, homeY + 1, homeZ) == Blocks.air) { + // worldObj.setBlock(homeX, homeY + 1, homeZ, Blocks.dragon_egg); + // LogHelper.info("spawn egg2 " + homeX + " " + homeY + " " + homeZ); + // }else { + // for (int i = homeY + 1; i < 250; i++) { + // if (worldObj.getBlock(homeX, i, homeZ) == Blocks.air) { + // worldObj.setBlock(homeX, i, homeZ, Blocks.dragon_egg); + // LogHelper.info("spawn egg3"); + // break; + // } + // } + // } + // + // for (int iX = homeX - 2; iX <= homeX + 2; iX++) + // { + // for (int iZ = homeZ - 2; iZ <= homeZ + 2; iZ++) + // { + // + // if (worldObj.getBlock(iX, homeY - 4, iZ) == Blocks.bedrock && !(iX == homeX && iZ == homeZ)) + // { + // worldObj.setBlock(iX, homeY - 3, iZ, Blocks.end_portal); + // } + // } + // } + // + // + // worldObj.setBlock(homeX - 1, homeY - 1, homeZ, Blocks.torch); + // worldObj.setBlock(homeX + 1, homeY - 1, homeZ, Blocks.torch); + // worldObj.setBlock(homeX, homeY - 1, homeZ - 1, Blocks.torch); + // worldObj.setBlock(homeX, homeY - 1, homeZ + 1, Blocks.torch); + // + // + // BlockEndPortal.field_149948_a = false; } private void createEnderPortal(int par1, int par2) { @@ -1225,9 +1385,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio } @Override - protected void despawnEntity() { - - } + protected void despawnEntity() {} @Override public boolean attackEntityFrom(DamageSource damageSource, float dmg) { @@ -1236,6 +1394,5 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio } @Override - public void travelToDimension(int p_71027_1_) { - } + public void travelToDimension(int p_71027_1_) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java index 1802b631..64f8a3ef 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java @@ -5,13 +5,12 @@ import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import java.util.List; - /** * Created by brandon3055 on 3/10/2015. */ @@ -38,9 +37,11 @@ public class EntityChaosVortex extends Entity { else ticksExisted = dataWatcher.getWatchableObjectInt(20); if (ticksExisted < 30 && ticksExisted % 5 == 0 && worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, false), 512); + DraconicEvolution.proxy.spawnParticle( + new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, false), 512); if (ticksExisted >= 100 && ticksExisted < 130 && ticksExisted % 5 == 0 && worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, true), 512); + DraconicEvolution.proxy.spawnParticle( + new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, true), 512); if (ticksExisted < 100) return; for (int i = 0; i < 10; i++) { @@ -48,25 +49,29 @@ public class EntityChaosVortex extends Entity { double y = posY - 8 + rand.nextDouble() * 16; double z = posZ - 18 + rand.nextDouble() * 36; if (worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle(new Particles.AdvancedSeekerParticle(worldObj, x, y, z, posX, posY, posZ, 2, 1f, 1f, 1f, 100), 128); + DraconicEvolution.proxy.spawnParticle( + new Particles.AdvancedSeekerParticle(worldObj, x, y, z, posX, posY, posZ, 2, 1f, 1f, 1f, 100), + 128); } if (ticksExisted > 130 && worldObj.isRemote && ticksExisted % 2 == 0) shakeScreen(); if (ticksExisted == 600 && !worldObj.isRemote) { - DraconicEvolution.network.sendToAllAround(new GenericParticlePacket(GenericParticlePacket.CHAOS_IMPLOSION, posX, posY, posZ), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 512)); + DraconicEvolution.network.sendToAllAround( + new GenericParticlePacket(GenericParticlePacket.CHAOS_IMPLOSION, posX, posY, posZ), + new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 512)); ProcessHandler.addProcess(new ChaosImplosion(worldObj, (int) posX, (int) posY, (int) posZ)); } if (ticksExisted > 620) setDead(); } - private void shakeScreen() { double intensity = (ticksExisted - 130) / 100D; if (intensity > 1D) intensity = 1D; - List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(200, 200, 200)); + List players = + worldObj.getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(200, 200, 200)); for (EntityPlayer player : players) { double x = (rand.nextDouble() - 0.5) * 2 * intensity; @@ -78,12 +83,8 @@ public class EntityChaosVortex extends Entity { } @Override - protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { - - } + protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {} @Override - protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { - - } + protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java index 9022cd76..f947e873 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java @@ -9,6 +9,7 @@ import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; import cpw.mods.fml.common.network.NetworkRegistry; 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.enchantment.EnchantmentHelper; @@ -27,8 +28,6 @@ import net.minecraft.network.play.server.S2BPacketChangeGameState; import net.minecraft.util.*; import net.minecraft.world.World; -import java.util.List; - public class EntityCustomArrow extends EntityArrow { private int blockX = -1; private int blockY = -1; @@ -39,9 +38,9 @@ public class EntityCustomArrow extends EntityArrow { private int ticksInGround; private int ticksInAir; - //Arrow Properties - public boolean ignorSpeed = false; //old - public boolean explosive = false; //old + // Arrow Properties + public boolean ignorSpeed = false; // old + public boolean explosive = false; // old public int knockbackStrength = 0; public BowHandler.BowProperties bowProperties = new BowHandler.BowProperties(); @@ -56,7 +55,12 @@ public class EntityCustomArrow extends EntityArrow { renderDistanceWeight = 40; } - public EntityCustomArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) { + public EntityCustomArrow( + World p_i1755_1_, + EntityLivingBase p_i1755_2_, + EntityLivingBase p_i1755_3_, + float p_i1755_4_, + float p_i1755_5_) { super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_); renderDistanceWeight = 40; } @@ -70,7 +74,7 @@ public class EntityCustomArrow extends EntityArrow { protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(17, Byte.valueOf((byte) 0)); - //this.dataWatcher.updateObject(17, Byte.valueOf((byte)(bowProperties.energyBolt ? 1 : 0))); + // this.dataWatcher.updateObject(17, Byte.valueOf((byte)(bowProperties.energyBolt ? 1 : 0))); } @Override @@ -96,37 +100,39 @@ public class EntityCustomArrow extends EntityArrow { @Override public void onUpdate() { - //region Entity Update And motion + // region Entity Update And motion super.onEntityUpdate(); if (worldObj.isRemote) { bowProperties.energyBolt = dataWatcher.getWatchableObjectByte(17) == 1; } else dataWatcher.updateObject(17, (byte) (bowProperties.energyBolt ? 1 : 0)); - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationYaw = + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } if (this.arrowShake > 0) { --this.arrowShake; } - //endregion + // endregion - //region Block Collision Detection + // region Block Collision Detection Block block = this.worldObj.getBlock(this.blockX, this.blockY, this.blockZ); if (block.getMaterial() != Material.air) { onHitAnything(); block.setBlockBoundsBasedOnState(this.worldObj, this.blockX, this.blockY, this.blockZ); - AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); + AxisAlignedBB axisalignedbb = + block.getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); - if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { + if (axisalignedbb != null + && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { this.inGround = true; } } - //endregion + // endregion if (this.inGround) { int j = this.worldObj.getBlockMetadata(this.blockX, this.blockY, this.blockZ); @@ -134,7 +140,9 @@ public class EntityCustomArrow extends EntityArrow { if (block == this.blockHit && j == this.inData) { ++this.ticksInGround; - if (this.ticksInGround == 1200 || bowProperties.energyBolt) { //Delete the entity when it hits the ground if it is an energy bolt + if (this.ticksInGround == 1200 + || bowProperties + .energyBolt) { // Delete the entity when it hits the ground if it is an energy bolt this.setDead(); } } else { @@ -146,20 +154,29 @@ public class EntityCustomArrow extends EntityArrow { this.ticksInAir = 0; } } else { - //region Detect Entity Hit + // region Detect Entity Hit ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { - vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + vec3 = Vec3.createVectorHelper( + movingobjectposition.hitVec.xCoord, + movingobjectposition.hitVec.yCoord, + movingobjectposition.hitVec.zCoord); } Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.boundingBox + .addCoord(this.motionX, this.motionY, this.motionZ) + .expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -187,26 +204,31 @@ public class EntityCustomArrow extends EntityArrow { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { + if (movingobjectposition != null + && movingobjectposition.entityHit != null + && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { + if (entityplayer.capabilities.disableDamage + || this.shootingEntity instanceof EntityPlayer + && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } - //endregion + // endregion float velocity; float f4; - //region Process Entity Hit + // region Process Entity Hit if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { onHitAnything(); if (isDead) return; int actualDamage; - //Calculate Damage - velocity = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + // Calculate Damage + velocity = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); actualDamage = MathHelper.ceiling_double_int(velocity * bowProperties.arrowDamage); if (bowProperties.energyBolt) actualDamage *= 1.1F; @@ -220,8 +242,12 @@ public class EntityCustomArrow extends EntityArrow { } if (bowProperties.energyBolt) movingobjectposition.entityHit.hurtResistantTime = 0; - if (movingobjectposition.entityHit instanceof EntityDragonPart && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj instanceof EntityDragon && bowProperties.energyBolt) { - ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj).hurtResistantTime = 0; + if (movingobjectposition.entityHit instanceof EntityDragonPart + && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj + instanceof EntityDragon + && bowProperties.energyBolt) { + ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj) + .hurtResistantTime = 0; } if (movingobjectposition.entityHit.attackEntityFrom(getDamageSource(), actualDamage)) { @@ -236,17 +262,25 @@ public class EntityCustomArrow extends EntityArrow { f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f4 > 0.0F) { - movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); + movingobjectposition.entityHit.addVelocity( + this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, + 0.1D, + this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); } } if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); - EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); + EnchantmentHelper.func_151385_b( + (EntityLivingBase) this.shootingEntity, entitylivingbase); } - if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); + if (this.shootingEntity != null + && movingobjectposition.entityHit != this.shootingEntity + && movingobjectposition.entityHit instanceof EntityPlayer + && this.shootingEntity instanceof EntityPlayerMP) { + ((EntityPlayerMP) this.shootingEntity) + .playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); } } @@ -254,7 +288,10 @@ public class EntityCustomArrow extends EntityArrow { this.setDead(); } else { - if (!(worldObj.isRemote && ticksInAir < 5)) { //Fix arrow wobble on fire due to client side collision with shooting entity + if (!(worldObj.isRemote + && ticksInAir + < 5)) { // Fix arrow wobble on fire due to client side collision with shooting + // entity this.motionX *= -0.10000000149011612D; this.motionY *= -0.10000000149011612D; this.motionZ *= -0.10000000149011612D; @@ -273,7 +310,8 @@ public class EntityCustomArrow extends EntityArrow { this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); - velocity = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + velocity = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / velocity * 0.05000000074505806D; this.posY -= this.motionY / velocity * 0.05000000074505806D; this.posZ -= this.motionZ / velocity * 0.05000000074505806D; @@ -282,19 +320,27 @@ public class EntityCustomArrow extends EntityArrow { this.arrowShake = 7; if (this.blockHit.getMaterial() != Material.air) { - this.blockHit.onEntityCollidedWithBlock(this.worldObj, this.blockX, this.blockY, this.blockZ, this); + this.blockHit.onEntityCollidedWithBlock( + this.worldObj, this.blockX, this.blockY, this.blockZ, this); } } } - //endregion + // endregion - //region Motion + // region Motion if ((this.getIsCritical() || bowProperties.energyBolt) && worldObj.isRemote) { for (i = 0; i < 4; ++i) { if (bowProperties.energyBolt) { spawnArrowParticles(); } else { - this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); + this.worldObj.spawnParticle( + "crit", + this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, + this.posZ + this.motionZ * i / 4.0D, + -this.motionX, + -this.motionY + 0.2D, + -this.motionZ); } } } @@ -305,7 +351,9 @@ public class EntityCustomArrow extends EntityArrow { velocity = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, velocity) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, velocity) * 180.0D / Math.PI); + this.rotationPitch - this.prevRotationPitch < -180.0F; + this.prevRotationPitch -= 360.0F) { ; } @@ -329,7 +377,14 @@ public class EntityCustomArrow extends EntityArrow { if (this.isInWater()) { for (int l = 0; l < 4; ++l) { f4 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle( + "bubble", + this.posX - this.motionX * f4, + this.posY - this.motionY * f4, + this.posZ - this.motionZ * f4, + this.motionX, + this.motionY, + this.motionZ); } f3 = 0.8F; @@ -345,13 +400,19 @@ public class EntityCustomArrow extends EntityArrow { this.motionY -= f1; this.setPosition(this.posX, this.posY, this.posZ); this.func_145775_I(); - //endregion + // endregion } } @SideOnly(Side.CLIENT) private void spawnArrowParticles() { - Particles.ArrowParticle particle = new Particles.ArrowParticle(worldObj, posX - 0.25 + rand.nextDouble() * 0.5, posY + rand.nextDouble() * 0.5, posZ - 0.25 + rand.nextDouble() * 0.5, 0xff6000, 0.2F + rand.nextFloat() * 0.5f); + Particles.ArrowParticle particle = new Particles.ArrowParticle( + worldObj, + posX - 0.25 + rand.nextDouble() * 0.5, + posY + rand.nextDouble() * 0.5, + posZ - 0.25 + rand.nextDouble() * 0.5, + 0xff6000, + 0.2F + rand.nextFloat() * 0.5f); double mm = 0.2; particle.motionX = (rand.nextDouble() - 0.5) * mm; particle.motionY = (rand.nextDouble() - 0.5) * mm; @@ -397,31 +458,43 @@ public class EntityCustomArrow extends EntityArrow { public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { - boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; + boolean flag = + this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; - if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { + if (this.canBePickedUp == 1 + && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { flag = false; } if (flag) { - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.playSound( + "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } } } - public void onHitEntityLiving(EntityLivingBase entityLivingBase) { - } + public void onHitEntityLiving(EntityLivingBase entityLivingBase) {} public void onHitAnything() { if (bowProperties.explosionPower > 0 && !worldObj.isRemote) { - worldObj.createExplosion(this, prevPosX, prevPosY, prevPosZ, bowProperties.explosionPower, ConfigHandler.bowBlockDamage); + worldObj.createExplosion( + this, prevPosX, prevPosY, prevPosZ, bowProperties.explosionPower, ConfigHandler.bowBlockDamage); setDead(); } if (bowProperties.shockWavePower > 0 && !worldObj.isRemote) { - DraconicEvolution.network.sendToAllAround(new GenericParticlePacket(GenericParticlePacket.ARROW_SHOCK_WAVE, posX, posY, posZ, (int) (bowProperties.shockWavePower * 100)), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 256)); - worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + DraconicEvolution.network.sendToAllAround( + new GenericParticlePacket(GenericParticlePacket.ARROW_SHOCK_WAVE, posX, posY, posZ, (int) + (bowProperties.shockWavePower * 100)), + new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 256)); + worldObj.playSoundEffect( + posX, + posY, + posZ, + "random.explode", + 4.0F, + (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); double range = (double) bowProperties.shockWavePower + 5; List list = worldObj.getEntitiesWithinAABB(Entity.class, boundingBox.expand(range, range, range)); @@ -448,7 +521,10 @@ public class EntityCustomArrow extends EntityArrow { private DamageSource getDamageSource() { if (bowProperties.energyBolt) { - return new EntityDamageSourceIndirect("customArrowEnergy", this, shootingEntity != null ? shootingEntity : this).setProjectile().setDamageIsAbsolute(); + return new EntityDamageSourceIndirect( + "customArrowEnergy", this, shootingEntity != null ? shootingEntity : this) + .setProjectile() + .setDamageIsAbsolute(); } else return DamageSource.causeArrowDamage(this, shootingEntity != null ? shootingEntity : this); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java index 70e0fb3c..d472ecf5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java @@ -3,6 +3,8 @@ package com.brandon3055.draconicevolution.common.entity; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.utills.DamageSourceChaos; import com.brandon3055.draconicevolution.common.utills.LogHelper; +import java.util.Iterator; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockEndPortal; import net.minecraft.entity.Entity; @@ -23,9 +25,6 @@ import net.minecraft.util.Vec3; import net.minecraft.world.Explosion; import net.minecraft.world.World; -import java.util.Iterator; -import java.util.List; - /** * Created by Brandon on 4/07/2014. */ @@ -38,7 +37,6 @@ public class EntityCustomDragon extends EntityDragon { private boolean createPortal = true; public float attackDamage = 10F; protected boolean isUber = false; - private boolean needsRenderUpdate = true; private boolean initialized = false; public EntityCustomDragon(World par1World) { @@ -84,7 +82,14 @@ public class EntityCustomDragon extends EntityDragon { f1 = MathHelper.cos(this.prevAnimTime * (float) Math.PI * 2.0F); if (f1 <= -0.3F && f >= -0.3F) { - this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.rand.nextFloat() * 0.3F, false); + this.worldObj.playSound( + this.posX, + this.posY, + this.posZ, + "mob.enderdragon.wings", + 5.0F, + 0.8F + this.rand.nextFloat() * 0.3F, + false); } } @@ -95,13 +100,24 @@ public class EntityCustomDragon extends EntityDragon { f = (this.rand.nextFloat() - 0.5F) * 8.0F; f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; f2 = (this.rand.nextFloat() - 0.5F) * 8.0F; - this.worldObj.spawnParticle("largeexplode", this.posX + (double) f, this.posY + 2.0D + (double) f1, this.posZ + (double) f2, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "largeexplode", + this.posX + (double) f, + this.posY + 2.0D + (double) f1, + this.posZ + (double) f2, + 0.0D, + 0.0D, + 0.0D); } else { this.updateDragonEnderCrystal(); if (isUber) - f = 0.5F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); //Wing Speed + f = 0.5F + / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + + 1.0F); // Wing Speed else - f = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); + f = 0.2F + / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + + 1.0F); f *= (float) Math.pow(2.0D, this.motionY); if (this.slowed) { @@ -137,8 +153,11 @@ public class EntityCustomDragon extends EntityDragon { d0 = this.posY + (this.newPosY - this.posY) / (double) this.newPosRotationIncrements; d1 = this.posZ + (this.newPosZ - this.posZ) / (double) this.newPosRotationIncrements; d2 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double) this.rotationYaw); - this.rotationYaw = (float) ((double) this.rotationYaw + d2 / (double) this.newPosRotationIncrements); - this.rotationPitch = (float) ((double) this.rotationPitch + (this.newRotationPitch - (double) this.rotationPitch) / (double) this.newPosRotationIncrements); + this.rotationYaw = + (float) ((double) this.rotationYaw + d2 / (double) this.newPosRotationIncrements); + this.rotationPitch = (float) ((double) this.rotationPitch + + (this.newRotationPitch - (double) this.rotationPitch) + / (double) this.newPosRotationIncrements); --this.newPosRotationIncrements; this.setPosition(d10, d0, d1); this.setRotation(this.rotationYaw, this.rotationPitch); @@ -167,12 +186,16 @@ public class EntityCustomDragon extends EntityDragon { this.targetZ += this.rand.nextGaussian() * 2.0D; } - if (this.forceNewTarget || d2 < 100.0D || d2 > 22500.0D || this.isCollidedHorizontally || this.isCollidedVertically) { + if (this.forceNewTarget + || d2 < 100.0D + || d2 > 22500.0D + || this.isCollidedHorizontally + || this.isCollidedVertically) { this.setNewTarget(); } d0 /= (double) MathHelper.sqrt_double(d10 * d10 + d1 * d1); - if (isUber) f12 = 1.0F;//Verticle Motion Speed + if (isUber) f12 = 1.0F; // Verticle Motion Speed else f12 = 0.6F; if (d0 < (double) (-f12)) { @@ -196,8 +219,14 @@ public class EntityCustomDragon extends EntityDragon { d6 = -50.0D; } - Vec3 vec3 = Vec3.createVectorHelper(this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ).normalize(); - Vec3 vec32 = Vec3.createVectorHelper((double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), this.motionY, (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))).normalize(); + Vec3 vec3 = Vec3.createVectorHelper( + this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ) + .normalize(); + Vec3 vec32 = Vec3.createVectorHelper( + (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), + this.motionY, + (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))) + .normalize(); float f5 = (float) (vec32.dotProduct(vec3) + 0.5D) / 1.5F; if (f5 < 0.0F) { @@ -205,28 +234,34 @@ public class EntityCustomDragon extends EntityDragon { } this.randomYawVelocity *= 0.8F; - float f6 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; + float f6 = + MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0D + 1.0D; if (d9 > 40.0D) { d9 = 40.0D; } - this.randomYawVelocity = (float) ((double) this.randomYawVelocity + d6 * (0.699999988079071D / d9 / (double) f6)); + this.randomYawVelocity = + (float) ((double) this.randomYawVelocity + d6 * (0.699999988079071D / d9 / (double) f6)); this.rotationYaw += this.randomYawVelocity * 0.1F; float f7 = (float) (2.0D / (d9 + 1.0D)); float f8 = 0.06F; this.moveFlying(0.0F, -1.0F, f8 * (f5 * f7 + (1.0F - f7))); if (this.slowed) { - this.moveEntity(this.motionX * 0.800000011920929D, this.motionY * 0.800000011920929D, this.motionZ * 0.800000011920929D); + this.moveEntity( + this.motionX * 0.800000011920929D, + this.motionY * 0.800000011920929D, + this.motionZ * 0.800000011920929D); } else if (isUber) { this.moveEntity(this.motionX * 2.5D, this.motionY * 1.5D, this.motionZ * 2.5D); } else { this.moveEntity(this.motionX, this.motionY, this.motionZ); } - Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ).normalize(); + Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ) + .normalize(); float f9 = (float) (vec31.dotProduct(vec32) + 1.0D) / 2.0F; f9 = 0.8F + 0.15F * f9; this.motionX *= (double) f9; @@ -245,23 +280,40 @@ public class EntityCustomDragon extends EntityDragon { this.dragonPartWing1.width = 4.0F; this.dragonPartWing2.height = 3.0F; this.dragonPartWing2.width = 4.0F; - f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) * 10.0F / 180.0F * (float) Math.PI; + f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) + * 10.0F + / 180.0F + * (float) Math.PI; f2 = MathHelper.cos(f1); float f10 = -MathHelper.sin(f1); float f3 = this.rotationYaw * (float) Math.PI / 180.0F; float f11 = MathHelper.sin(f3); float f4 = MathHelper.cos(f3); this.dragonPartBody.onUpdate(); - this.dragonPartBody.setLocationAndAngles(this.posX + (double) (f11 * 0.5F), this.posY, this.posZ - (double) (f4 * 0.5F), 0.0F, 0.0F); + this.dragonPartBody.setLocationAndAngles( + this.posX + (double) (f11 * 0.5F), this.posY, this.posZ - (double) (f4 * 0.5F), 0.0F, 0.0F); this.dragonPartWing1.onUpdate(); - this.dragonPartWing1.setLocationAndAngles(this.posX + (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ + (double) (f11 * 4.5F), 0.0F, 0.0F); + this.dragonPartWing1.setLocationAndAngles( + this.posX + (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ + (double) (f11 * 4.5F), 0.0F, 0.0F); this.dragonPartWing2.onUpdate(); - this.dragonPartWing2.setLocationAndAngles(this.posX - (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ - (double) (f11 * 4.5F), 0.0F, 0.0F); + this.dragonPartWing2.setLocationAndAngles( + this.posX - (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ - (double) (f11 * 4.5F), 0.0F, 0.0F); if (!this.worldObj.isRemote && this.hurtTime == 0) { - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing1.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing2.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); - this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing1 + .boundingBox + .expand(4.0D, 2.0D, 4.0D) + .offset(0.0D, -2.0D, 0.0D))); + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing2 + .boundingBox + .expand(4.0D, 2.0D, 4.0D) + .offset(0.0D, -2.0D, 0.0D))); + this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); } double[] adouble1 = this.getMovementOffsets(5, 1.0F); @@ -269,7 +321,12 @@ public class EntityCustomDragon extends EntityDragon { f12 = MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F - this.randomYawVelocity * 0.01F); float f13 = MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F - this.randomYawVelocity * 0.01F); this.dragonPartHead.onUpdate(); - this.dragonPartHead.setLocationAndAngles(this.posX + (double) (f12 * 5.5F * f2), this.posY + (adouble[1] - adouble1[1]) * 1.0D + (double) (f10 * 5.5F), this.posZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F); + this.dragonPartHead.setLocationAndAngles( + this.posX + (double) (f12 * 5.5F * f2), + this.posY + (adouble[1] - adouble1[1]) * 1.0D + (double) (f10 * 5.5F), + this.posZ - (double) (f13 * 5.5F * f2), + 0.0F, + 0.0F); for (int j = 0; j < 3; ++j) { EntityDragonPart entitydragonpart = null; @@ -287,30 +344,36 @@ public class EntityCustomDragon extends EntityDragon { } double[] adouble2 = this.getMovementOffsets(12 + j * 2, 1.0F); - float f14 = this.rotationYaw * (float) Math.PI / 180.0F + this.simplifyAngle(adouble2[0] - adouble1[0]) * (float) Math.PI / 180.0F * 1.0F; + float f14 = this.rotationYaw * (float) Math.PI / 180.0F + + this.simplifyAngle(adouble2[0] - adouble1[0]) * (float) Math.PI / 180.0F * 1.0F; float f15 = MathHelper.sin(f14); float f16 = MathHelper.cos(f14); float f17 = 1.5F; float f18 = (float) (j + 1) * 2.0F; entitydragonpart.onUpdate(); - entitydragonpart.setLocationAndAngles(this.posX - (double) ((f11 * f17 + f15 * f18) * f2), this.posY + (adouble2[1] - adouble1[1]) * 1.0D - (double) ((f18 + f17) * f10) + 1.5D, this.posZ + (double) ((f4 * f17 + f16 * f18) * f2), 0.0F, 0.0F); + entitydragonpart.setLocationAndAngles( + this.posX - (double) ((f11 * f17 + f15 * f18) * f2), + this.posY + (adouble2[1] - adouble1[1]) * 1.0D - (double) ((f18 + f17) * f10) + 1.5D, + this.posZ + (double) ((f4 * f17 + f16 * f18) * f2), + 0.0F, + 0.0F); } if (!this.worldObj.isRemote) { - this.slowed = this.destroyBlocksInAABB(this.dragonPartHead.boundingBox) | this.destroyBlocksInAABB(this.dragonPartBody.boundingBox); + this.slowed = this.destroyBlocksInAABB(this.dragonPartHead.boundingBox) + | this.destroyBlocksInAABB(this.dragonPartBody.boundingBox); } } - } @Override protected void onDeathUpdate() { - if (deathTicks == 0 && !isUber) { for (int ix = -150; ix < 150; ix++) { for (int iz = -150; iz < 150; iz++) { - if (worldObj.getBlock(ix, portalY, iz) == Blocks.bedrock && worldObj.getBlock(ix, portalY - 1, iz) == Blocks.bedrock) { + if (worldObj.getBlock(ix, portalY, iz) == Blocks.bedrock + && worldObj.getBlock(ix, portalY - 1, iz) == Blocks.bedrock) { portalX = ix; portalZ = iz; createPortal = false; @@ -318,7 +381,9 @@ public class EntityCustomDragon extends EntityDragon { } } } - if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0) { + if (ConfigHandler.dragonEggSpawnLocation[0] != 0 + || ConfigHandler.dragonEggSpawnLocation[1] != 0 + || ConfigHandler.dragonEggSpawnLocation[1] != 0) { createPortal = false; portalX = ConfigHandler.dragonEggSpawnLocation[0]; portalY = ConfigHandler.dragonEggSpawnLocation[1]; @@ -338,7 +403,14 @@ public class EntityCustomDragon extends EntityDragon { float f = (this.rand.nextFloat() - 0.5F) * 8.0F; float f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; float f2 = (this.rand.nextFloat() - 0.5F) * 8.0F; - this.worldObj.spawnParticle("hugeexplosion", this.posX + (double) f, this.posY + 2.0D + (double) f1, this.posZ + (double) f2, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle( + "hugeexplosion", + this.posX + (double) f, + this.posY + 2.0D + (double) f1, + this.posZ + (double) f2, + 0.0D, + 0.0D, + 0.0D); } int i; @@ -351,12 +423,13 @@ public class EntityCustomDragon extends EntityDragon { while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; - this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + this.worldObj.spawnEntityInWorld( + new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } } } else if (this.deathTicks == 1) { this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.end", 50.0F, 1F, false); - //this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0); + // this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0); } this.moveEntity(0.0D, 0.10000000149011612D, 0.0D); @@ -376,6 +449,7 @@ public class EntityCustomDragon extends EntityDragon { } } + @SuppressWarnings("rawtypes") private void collideWithEntities(List par1List) { double d0 = (this.dragonPartBody.boundingBox.minX + this.dragonPartBody.boundingBox.maxX) / 2.0D; double d1 = (this.dragonPartBody.boundingBox.minZ + this.dragonPartBody.boundingBox.maxZ) / 2.0D; @@ -400,6 +474,7 @@ public class EntityCustomDragon extends EntityDragon { } } + @SuppressWarnings("rawtypes") private void attackEntitiesInList(List par1List) { for (int i = 0; i < par1List.size(); ++i) { Entity entity = (Entity) par1List.get(i); @@ -415,11 +490,13 @@ public class EntityCustomDragon extends EntityDragon { } } + @SuppressWarnings("rawtypes") private void updateDragonEnderCrystal() { if (this.healingEnderCrystal != null) { if (this.healingEnderCrystal.isDead) { if (!this.worldObj.isRemote) { - this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion) null), 10.0F); + this.attackEntityFromPart( + this.dragonPartHead, DamageSource.setExplosionSource((Explosion) null), 10.0F); } this.healingEnderCrystal = null; @@ -431,7 +508,8 @@ public class EntityCustomDragon extends EntityDragon { if (this.rand.nextInt(10) == 0) { float f = 32.0F; - List list = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.boundingBox.expand((double) f, (double) f, (double) f)); + List list = this.worldObj.getEntitiesWithinAABB( + EntityEnderCrystal.class, this.boundingBox.expand((double) f, (double) f, (double) f)); EntityEnderCrystal entityendercrystal = null; double d0 = Double.MAX_VALUE; Iterator iterator = list.iterator(); @@ -453,8 +531,11 @@ public class EntityCustomDragon extends EntityDragon { private void setNewTarget() { this.forceNewTarget = false; - if ((isUber || this.rand.nextInt(2) == 0) && (!isUber || 19 > this.rand.nextInt(20)) && !this.worldObj.playerEntities.isEmpty()) { - this.target = (Entity) this.worldObj.playerEntities.get(this.rand.nextInt(this.worldObj.playerEntities.size())); + if ((isUber || this.rand.nextInt(2) == 0) + && (!isUber || 19 > this.rand.nextInt(20)) + && !this.worldObj.playerEntities.isEmpty()) { + this.target = + (Entity) this.worldObj.playerEntities.get(this.rand.nextInt(this.worldObj.playerEntities.size())); } else { boolean flag = false; @@ -496,7 +577,8 @@ public class EntityCustomDragon extends EntityDragon { Block block = this.worldObj.getBlock(k1, l1, i2); if (!block.isAir(worldObj, k1, l1, i2)) { - if (block.canEntityDestroy(worldObj, k1, l1, i2, this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { + if (block.canEntityDestroy(worldObj, k1, l1, i2, this) + && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { flag1 = this.worldObj.setBlockToAir(k1, l1, i2) || flag1; } else { flag = true; @@ -507,9 +589,12 @@ public class EntityCustomDragon extends EntityDragon { } if (flag1) { - double d1 = par1AxisAlignedBB.minX + (par1AxisAlignedBB.maxX - par1AxisAlignedBB.minX) * (double) this.rand.nextFloat(); - double d2 = par1AxisAlignedBB.minY + (par1AxisAlignedBB.maxY - par1AxisAlignedBB.minY) * (double) this.rand.nextFloat(); - double d0 = par1AxisAlignedBB.minZ + (par1AxisAlignedBB.maxZ - par1AxisAlignedBB.minZ) * (double) this.rand.nextFloat(); + double d1 = par1AxisAlignedBB.minX + + (par1AxisAlignedBB.maxX - par1AxisAlignedBB.minX) * (double) this.rand.nextFloat(); + double d2 = par1AxisAlignedBB.minY + + (par1AxisAlignedBB.maxY - par1AxisAlignedBB.minY) * (double) this.rand.nextFloat(); + double d0 = par1AxisAlignedBB.minZ + + (par1AxisAlignedBB.maxZ - par1AxisAlignedBB.minZ) * (double) this.rand.nextFloat(); this.worldObj.spawnParticle("largeexplode", d1, d2, d0, 0.0D, 0.0D, 0.0D); } @@ -517,7 +602,9 @@ public class EntityCustomDragon extends EntityDragon { } private void spawnEgg() { - if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 && !isUber) { + if (ConfigHandler.dragonEggSpawnLocation[0] != 0 + || ConfigHandler.dragonEggSpawnLocation[1] != 0 + || ConfigHandler.dragonEggSpawnLocation[1] != 0 && !isUber) { portalX = ConfigHandler.dragonEggSpawnLocation[0]; portalY = ConfigHandler.dragonEggSpawnLocation[1]; portalZ = ConfigHandler.dragonEggSpawnLocation[2]; @@ -551,13 +638,11 @@ public class EntityCustomDragon extends EntityDragon { } } - worldObj.setBlock(portalX - 1, portalY - 1, portalZ, Blocks.torch); worldObj.setBlock(portalX + 1, portalY - 1, portalZ, Blocks.torch); worldObj.setBlock(portalX, portalY - 1, portalZ - 1, Blocks.torch); worldObj.setBlock(portalX, portalY - 1, portalZ + 1, Blocks.torch); - BlockEndPortal.field_149948_a = false; } @@ -626,9 +711,7 @@ public class EntityCustomDragon extends EntityDragon { } @Override - protected void despawnEntity() { - - } + protected void despawnEntity() {} public void setUber(boolean b) { isUber = b; @@ -640,24 +723,5 @@ public class EntityCustomDragon extends EntityDragon { } @Override - public boolean attackEntityFrom(DamageSource damageSource, float dmg) { -// if (damageSource.getEntity() != null && getDistanceToEntity(damageSource.getEntity()) > 100) { -// LogHelper.info("cancel attack"); -// return false; -// } - return super.attackEntityFrom(damageSource, dmg); - } - - @Override - public boolean attackEntityFromPart(EntityDragonPart p_70965_1_, DamageSource damageSource, float p_70965_3_) { -// if (damageSource.getEntity() != null && Utills.getDistanceAtoB(damageSource.getEntity().posX)getDistanceToEntity(damageSource.getEntity()) > 100) { -// LogHelper.info("cancel attack"); -// return false; -// } - return super.attackEntityFromPart(p_70965_1_, damageSource, p_70965_3_); - } - - @Override - public void travelToDimension(int p_71027_1_) { - } + public void travelToDimension(int p_71027_1_) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java index 17a70a81..d58439cb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.entity; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; 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.enchantment.EnchantmentHelper; @@ -21,8 +22,6 @@ import net.minecraft.network.play.server.S2BPacketChangeGameState; import net.minecraft.util.*; import net.minecraft.world.World; -import java.util.List; - public class EntityDraconicArrow extends EntityArrow { private int blockX = -1; private int blockY = -1; @@ -37,6 +36,7 @@ public class EntityDraconicArrow extends EntityArrow { * The amount of knockback an arrow applies when it hits a mob. */ private int knockbackStrength; + public boolean ignorSpeed = false; public boolean explosive = false; @@ -48,7 +48,12 @@ public class EntityDraconicArrow extends EntityArrow { super(p_i1754_1_, p_i1754_2_, p_i1754_4_, p_i1754_6_); } - public EntityDraconicArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) { + public EntityDraconicArrow( + World p_i1755_1_, + EntityLivingBase p_i1755_2_, + EntityLivingBase p_i1755_3_, + float p_i1755_4_, + float p_i1755_5_) { super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_); } @@ -59,7 +64,7 @@ public class EntityDraconicArrow extends EntityArrow { @Override protected void entityInit() { super.entityInit(); - //this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); + // this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); } @Override @@ -110,11 +115,12 @@ public class EntityDraconicArrow extends EntityArrow { @Override public void onUpdate() { - //super.onUpdate(); + // super.onUpdate(); super.onEntityUpdate(); if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationYaw = + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } @@ -122,14 +128,22 @@ public class EntityDraconicArrow extends EntityArrow { if (block.getMaterial() != Material.air) { if (explosive) { - worldObj.createExplosion(this.shootingEntity, this.prevPosX, this.prevPosY, this.prevPosZ, 4, ConfigHandler.bowBlockDamage); + worldObj.createExplosion( + this.shootingEntity, + this.prevPosX, + this.prevPosY, + this.prevPosZ, + 4, + ConfigHandler.bowBlockDamage); this.setDead(); return; } block.setBlockBoundsBasedOnState(this.worldObj, this.blockX, this.blockY, this.blockZ); - AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); + AxisAlignedBB axisalignedbb = + block.getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); - if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { + if (axisalignedbb != null + && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { this.inGround = true; } } @@ -158,18 +172,26 @@ public class EntityDraconicArrow extends EntityArrow { } else { ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { - vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - + vec3 = Vec3.createVectorHelper( + movingobjectposition.hitVec.xCoord, + movingobjectposition.hitVec.yCoord, + movingobjectposition.hitVec.zCoord); } Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.boundingBox + .addCoord(this.motionX, this.motionY, this.motionZ) + .expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -197,10 +219,14 @@ public class EntityDraconicArrow extends EntityArrow { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { + if (movingobjectposition != null + && movingobjectposition.entityHit != null + && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { + if (entityplayer.capabilities.disableDamage + || this.shootingEntity instanceof EntityPlayer + && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } @@ -211,14 +237,23 @@ public class EntityDraconicArrow extends EntityArrow { if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { if (explosive) { - //world.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 6, false); - //movingobjectposition.entityHit.hurtResistantTime = 0; - worldObj.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 4, ConfigHandler.bowBlockDamage); + // world.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, + // movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 6, false); + // movingobjectposition.entityHit.hurtResistantTime = 0; + worldObj.createExplosion( + this.shootingEntity, + movingobjectposition.entityHit.posX, + movingobjectposition.entityHit.posY, + movingobjectposition.entityHit.posZ, + 4, + ConfigHandler.bowBlockDamage); this.setDead(); } int k; if (!ignorSpeed) { - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + f2 = MathHelper.sqrt_double(this.motionX * this.motionX + + this.motionY * this.motionY + + this.motionZ * this.motionZ); k = MathHelper.ceiling_double_int(f2 * this.damage); if (this.getIsCritical()) { @@ -245,8 +280,11 @@ public class EntityDraconicArrow extends EntityArrow { } movingobjectposition.entityHit.hurtResistantTime = 0; - if (movingobjectposition.entityHit instanceof EntityDragonPart && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj instanceof EntityDragon) { - ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj).hurtResistantTime = 0; + if (movingobjectposition.entityHit instanceof EntityDragonPart + && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj + instanceof EntityDragon) { + ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj) + .hurtResistantTime = 0; } if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) { @@ -261,26 +299,34 @@ public class EntityDraconicArrow extends EntityArrow { f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f4 > 0.0F) { - movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); + movingobjectposition.entityHit.addVelocity( + this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, + 0.1D, + this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); } } if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); - EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); + EnchantmentHelper.func_151385_b( + (EntityLivingBase) this.shootingEntity, entitylivingbase); } - if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); + if (this.shootingEntity != null + && movingobjectposition.entityHit != this.shootingEntity + && movingobjectposition.entityHit instanceof EntityPlayer + && this.shootingEntity instanceof EntityPlayerMP) { + ((EntityPlayerMP) this.shootingEntity) + .playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); } } this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); // if (!(movingobjectposition.entityHit instanceof EntityEnderman)) - //{ + // { this.setDead(); - //} + // } } else { this.motionX *= -0.10000000149011612D; this.motionY *= -0.10000000149011612D; @@ -299,7 +345,8 @@ public class EntityDraconicArrow extends EntityArrow { this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + f2 = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / f2 * 0.05000000074505806D; this.posY -= this.motionY / f2 * 0.05000000074505806D; this.posZ -= this.motionZ / f2 * 0.05000000074505806D; @@ -308,14 +355,22 @@ public class EntityDraconicArrow extends EntityArrow { this.arrowShake = 7; if (this.blockHit.getMaterial() != Material.air) { - this.blockHit.onEntityCollidedWithBlock(this.worldObj, this.blockX, this.blockY, this.blockZ, this); + this.blockHit.onEntityCollidedWithBlock( + this.worldObj, this.blockX, this.blockY, this.blockZ, this); } } } if (this.getIsCritical()) { for (i = 0; i < 4; ++i) { - this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); + this.worldObj.spawnParticle( + "crit", + this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, + this.posZ + this.motionZ * i / 4.0D, + -this.motionX, + -this.motionY + 0.2D, + -this.motionZ); } } @@ -325,7 +380,9 @@ public class EntityDraconicArrow extends EntityArrow { f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); + this.rotationPitch - this.prevRotationPitch < -180.0F; + this.prevRotationPitch -= 360.0F) { ; } @@ -349,7 +406,14 @@ public class EntityDraconicArrow extends EntityArrow { if (this.isInWater()) { for (int l = 0; l < 4; ++l) { f4 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle( + "bubble", + this.posX - this.motionX * f4, + this.posY - this.motionY * f4, + this.posZ - this.motionZ * f4, + this.motionX, + this.motionY, + this.motionZ); } f3 = 0.8F; @@ -380,7 +444,8 @@ public class EntityDraconicArrow extends EntityArrow { par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); par1NBTTagCompound.setByte("pickup", (byte) this.canBePickedUp); par1NBTTagCompound.setDouble("damage", this.damage); - //par1NBTTagCompound.setString("shooter", getShooter() instanceof EntityPlayer ? ((EntityPlayer) getShooter()).getCommandSenderName() : ""); + // par1NBTTagCompound.setString("shooter", getShooter() instanceof EntityPlayer ? ((EntityPlayer) + // getShooter()).getCommandSenderName() : ""); } @Override @@ -393,7 +458,8 @@ public class EntityDraconicArrow extends EntityArrow { this.inData = par1NBTTagCompound.getByte("inData") & 255; this.arrowShake = par1NBTTagCompound.getByte("shake") & 255; this.inGround = par1NBTTagCompound.getByte("inGround") == 1; - //dataWatcher.updateObject(SHOOTER_DATAWATCHER_INDEX, par1NBTTagCompound.hasKey("shooter") ? par1NBTTagCompound.getString("shooter") : ""); + // dataWatcher.updateObject(SHOOTER_DATAWATCHER_INDEX, par1NBTTagCompound.hasKey("shooter") ? + // par1NBTTagCompound.getString("shooter") : ""); if (par1NBTTagCompound.hasKey("damage", 99)) { this.damage = par1NBTTagCompound.getDouble("damage"); @@ -410,14 +476,17 @@ public class EntityDraconicArrow extends EntityArrow { public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { - boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; + boolean flag = + this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; - if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { + if (this.canBePickedUp == 1 + && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { flag = false; } if (flag) { - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.playSound( + "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java index a4b02c38..7b5e358d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.common.entity; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.blocks.DraconiumBlock; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.brandonscore.common.utills.Utills; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -19,9 +21,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 21/11/2014. */ @@ -79,13 +78,12 @@ public class EntityDragonHeart extends Entity { motionZ = 0; motionY = 0; - age++; rotation += rotationInc; super.onUpdate(); switch (opPhase) { - case 0: { //Rises with particle ring + case 0: { // Rises with particle ring motionY = 0.01f; rotationInc += 0.1f; if (posY > yStop) { @@ -94,27 +92,34 @@ public class EntityDragonHeart extends Entity { } break; } - case 1: { //Particle ring retracts + case 1: { // Particle ring retracts opPhase = 2; break; } - case 2: { //Particle field accepting items + case 2: { // Particle field accepting items if (coresConsumed == 16 || age > 1240) { age = 1240; opPhase = 3; if (coresConsumed < 4) { - EntityPersistentItem item = new EntityPersistentItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart)); + EntityPersistentItem item = new EntityPersistentItem( + worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart)); item.motionX = 0; item.motionY = 0; item.motionZ = 0; item.delayBeforeCanPickup = 0; if (!worldObj.isRemote) worldObj.spawnEntityInWorld(item); - this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.worldObj.playSoundAtEntity( + this, + "random.pop", + 0.2F, + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); this.setDead(); } break; } - List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 5, posY - 5, posZ - 5, posX + 5, posY + 5, posZ + 5)); + List items = worldObj.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox(posX - 5, posY - 5, posZ - 5, posX + 5, posY + 5, posZ + 5)); for (EntityItem item : items) { ItemStack stack = item.getEntityItem(); if (Utills.getDistanceAtoB(posX, posY + 0.5, posZ, item.posX, item.posY, item.posZ) < 1) { @@ -134,7 +139,11 @@ public class EntityDragonHeart extends Entity { stack.stackSize = 0; item.setDead(); } - this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.worldObj.playSoundAtEntity( + this, + "random.pop", + 0.2F, + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } else { item.motionX = ((posX - item.posX)) * 0.1; item.motionY = ((posY + 0.5 - item.posY)) * 0.1; @@ -151,7 +160,8 @@ public class EntityDragonHeart extends Entity { for (int x = (int) posX - 5; x <= (int) posX + 5; x++) { for (int y = (int) posY - 5; y <= (int) posY + 5; y++) { for (int z = (int) posZ - 5; z <= (int) posZ + 5; z++) { - if (worldObj.getBlock(x, y, z) instanceof DraconiumBlock && worldObj.getBlockMetadata(x, y, z) == 2) { + if (worldObj.getBlock(x, y, z) instanceof DraconiumBlock + && worldObj.getBlockMetadata(x, y, z) == 2) { TileLocation block = new TileLocation(x, y, z); if (!blocks.contains(block) && blocks.size() < maxBlocks) blocks.add(block); } @@ -165,20 +175,26 @@ public class EntityDragonHeart extends Entity { case 4: { if (blocks.size() == 0) { if (!worldObj.isRemote) { - EntityPersistentItem item = new EntityPersistentItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart)); + EntityPersistentItem item = new EntityPersistentItem( + worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart)); item.motionX = 0; item.motionY = 0; item.motionZ = 0; item.delayBeforeCanPickup = 0; worldObj.spawnEntityInWorld(item); } - this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.worldObj.playSoundAtEntity( + this, + "random.pop", + 0.2F, + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); this.setDead(); break; } for (TileLocation tile : blocks) { if (!worldObj.isRemote) - worldObj.setBlock(tile.getXCoord(), tile.getYCoord(), tile.getZCoord(), ModBlocks.draconicBlock, 0, 2); + worldObj.setBlock( + tile.getXCoord(), tile.getYCoord(), tile.getZCoord(), ModBlocks.draconicBlock, 0, 2); worldObj.createExplosion(null, tile.getXCoord(), tile.getYCoord(), tile.getZCoord(), 4, false); } worldObj.createExplosion(null, posX, posY, posZ, 4, false); @@ -191,7 +207,6 @@ public class EntityDragonHeart extends Entity { this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.moveEntity(this.motionX, this.motionY, this.motionZ); - } @SideOnly(Side.CLIENT) @@ -202,7 +217,8 @@ public class EntityDragonHeart extends Entity { int nextFloat = rand.nextInt(); double offsetX = Math.sin(nextFloat); double offsetZ = Math.cos(nextFloat); - EntityFX particle = new Particles.AdvancedSeekerParticle(worldObj, posX + offsetX, correctY, posZ + offsetZ, posX, correctY, posZ, 1, 1f, 1f, 1f, 10); + EntityFX particle = new Particles.AdvancedSeekerParticle( + worldObj, posX + offsetX, correctY, posZ + offsetZ, posX, correctY, posZ, 1, 1f, 1f, 1f, 10); ParticleHandler.spawnCustomParticle(particle, 64); } } @@ -212,7 +228,20 @@ public class EntityDragonHeart extends Entity { int nextFloat = rand.nextInt(); double offsetX = Math.sin(nextFloat); double offsetZ = Math.cos(nextFloat); - EntityFX particle = new Particles.AdvancedSeekerParticle(worldObj, posX + offsetX, correctY, posZ + offsetZ, posX, correctY, posZ, 3, 1f, 1f, 1f, 100, -100); + EntityFX particle = new Particles.AdvancedSeekerParticle( + worldObj, + posX + offsetX, + correctY, + posZ + offsetZ, + posX, + correctY, + posZ, + 3, + 1f, + 1f, + 1f, + 100, + -100); ParticleHandler.spawnCustomParticle(particle, 64); } } @@ -222,7 +251,20 @@ public class EntityDragonHeart extends Entity { int nextFloat = rand.nextInt(); double offsetX = Math.sin(nextFloat) * (rand.nextFloat() * 10); double offsetZ = Math.cos(nextFloat) * (rand.nextFloat() * 10); - EntityFX particle = new Particles.AdvancedSeekerParticle(worldObj, posX + offsetX, correctY, posZ + offsetZ, posX, correctY, posZ, 3, 1f, 1f, 1f, 100, -100); + EntityFX particle = new Particles.AdvancedSeekerParticle( + worldObj, + posX + offsetX, + correctY, + posZ + offsetZ, + posX, + correctY, + posZ, + 3, + 1f, + 1f, + 1f, + 100, + -100); ParticleHandler.spawnCustomParticle(particle, 64); } } @@ -233,14 +275,39 @@ public class EntityDragonHeart extends Entity { int nextFloat = rand.nextInt(); double offsetX = Math.sin(nextFloat) * (rand.nextFloat() * 10); double offsetZ = Math.cos(nextFloat) * (rand.nextFloat() * 10); - EntityFX particle = new Particles.AdvancedSeekerParticle(worldObj, posX, correctY, posZ, posX + offsetX, correctY, posZ + offsetZ, 3, 1f, 1f - colourMod, 1f - colourMod, 100, -100); + EntityFX particle = new Particles.AdvancedSeekerParticle( + worldObj, + posX, + correctY, + posZ, + posX + offsetX, + correctY, + posZ + offsetZ, + 3, + 1f, + 1f - colourMod, + 1f - colourMod, + 100, + -100); ParticleHandler.spawnCustomParticle(particle, 64); for (TileLocation tile : blocks) { - particle = new Particles.AdvancedSeekerParticle(worldObj, posX, correctY, posZ, tile.getXCoord() + rand.nextDouble(), tile.getYCoord() + rand.nextDouble(), tile.getZCoord() + rand.nextDouble(), 3, 1f, 1f - (colourMod * 0.5f), 1f - colourMod, 100, -100); + particle = new Particles.AdvancedSeekerParticle( + worldObj, + posX, + correctY, + posZ, + tile.getXCoord() + rand.nextDouble(), + tile.getYCoord() + rand.nextDouble(), + tile.getZCoord() + rand.nextDouble(), + 3, + 1f, + 1f - (colourMod * 0.5f), + 1f - colourMod, + 100, + -100); ParticleHandler.spawnCustomParticle(particle, 64); } - } } @@ -252,7 +319,6 @@ public class EntityDragonHeart extends Entity { } } - @Override public void writeEntityToNBT(NBTTagCompound compound) { compound.setInteger("Age", age); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java index bba41c12..a1265676 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java @@ -10,6 +10,7 @@ import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.EntityDragon; @@ -21,8 +22,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.world.World; -import java.util.List; - /** * Created by brandon3055 on 23/8/2015. */ @@ -35,11 +34,19 @@ public class EntityDragonProjectile extends Entity { public boolean isChaser; private double lastTickTargetDistance = 100; private float heath = 5F; - private DamageSource damageFireball = new DamageSource("de.GuardianFireball").setDamageAllowedInCreativeMode().setMagicDamage().setExplosion(); - private DamageSource damageEnergy = new DamageSource("de.GuardianEnergyBall").setDamageAllowedInCreativeMode().setDamageBypassesArmor(); - private DamageSource damageChaos = new DamageSource("de.GuardianChaosBall").setDamageAllowedInCreativeMode().setDamageBypassesArmor().setDamageIsAbsolute(); + private DamageSource damageFireball = new DamageSource("de.GuardianFireball") + .setDamageAllowedInCreativeMode() + .setMagicDamage() + .setExplosion(); + private DamageSource damageEnergy = new DamageSource("de.GuardianEnergyBall") + .setDamageAllowedInCreativeMode() + .setDamageBypassesArmor(); + private DamageSource damageChaos = new DamageSource("de.GuardianChaosBall") + .setDamageAllowedInCreativeMode() + .setDamageBypassesArmor() + .setDamageIsAbsolute(); - //public static final int FIREBALL = 0; /** Generic fireball a lot more powerful then ghast fireball */ + // public static final int FIREBALL = 0; /** Generic fireball a lot more powerful then ghast fireball */ public static final int FIREBOMB = 1; /** * Large fireball with a trail and large fiery AOE @@ -69,7 +76,6 @@ public class EntityDragonProjectile extends Entity { /** * Reignites Crystals */ - public EntityDragonProjectile(World world) { this(world, 0, null, 10, null); } @@ -80,11 +86,21 @@ public class EntityDragonProjectile extends Entity { this.target = target; this.shooter = shooter; this.power = power; - this.isChaser = type == FIRE_CHASER || type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE; + this.isChaser = type == FIRE_CHASER + || type == ENERGY_CHASER + || type == CHAOS_CHASER + || type == MINI_CHAOS_CHASER + || type == IGNITION_CHARGE; this.setSize(1F, 1F); if (shooter != null) { - worldObj.playSoundEffect(shooter.posX + 0.5D, shooter.posY + 0.5D, shooter.posZ + 0.5D, "mob.ghast.fireball", 10.0F, rand.nextFloat() * 0.3F + 0.85F); + worldObj.playSoundEffect( + shooter.posX + 0.5D, + shooter.posY + 0.5D, + shooter.posZ + 0.5D, + "mob.ghast.fireball", + 10.0F, + rand.nextFloat() * 0.3F + 0.85F); this.rotationYaw = shooter instanceof EntityDragon ? shooter.rotationYaw + 180F : shooter.rotationYaw; this.rotationPitch = shooter.rotationPitch; @@ -93,8 +109,10 @@ public class EntityDragonProjectile extends Entity { rotationYaw += (rand.nextFloat() - 0.5F) * 20F; } this.yOffset = 0.0F; - this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); - this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); + this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); + this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); double speed = 5; this.motionX *= speed; @@ -112,10 +130,12 @@ public class EntityDragonProjectile extends Entity { @Override protected void entityInit() { - if (type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE || worldObj.isRemote) - noClip = true; + if (type == ENERGY_CHASER + || type == CHAOS_CHASER + || type == MINI_CHAOS_CHASER + || type == IGNITION_CHARGE + || worldObj.isRemote) noClip = true; dataWatcher.addObject(10, (byte) type); - } @Override @@ -127,7 +147,7 @@ public class EntityDragonProjectile extends Entity { spawnParticle(); } - //Check that there is still a target available and if not kills the projectile. + // Check that there is still a target available and if not kills the projectile. if (target == null) { if (worldObj.getClosestPlayer(posX, posY, posZ, 60) != null) target = worldObj.getClosestPlayer(posX, posY, posZ, 60); @@ -170,7 +190,11 @@ public class EntityDragonProjectile extends Entity { switch (type) { case FIREBOMB: - if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) || isCollided || ticksExisted > 600 || heath <= 0) { + if (genericHit + || (targetDistance > lastTickTargetDistance && targetDistance < power) + || isCollided + || ticksExisted > 600 + || heath <= 0) { setDead(); worldObj.newExplosion(shooter, this.posX, this.posY, this.posZ, 2F, true, true); damageEntitiesInRadius(damageFireball, power, power * 2); @@ -183,9 +207,19 @@ public class EntityDragonProjectile extends Entity { if (!(hit instanceof EntityPlayer)) break; int r = rand.nextInt(); if (shooter != null) - new Teleporter.TeleportLocation(shooter.posX + (Math.cos(r) * 600), rand.nextInt(255), shooter.posZ + (Math.sin(r) * 600), hit.dimension).sendEntityToCoords(hit); + new Teleporter.TeleportLocation( + shooter.posX + (Math.cos(r) * 600), + rand.nextInt(255), + shooter.posZ + (Math.sin(r) * 600), + hit.dimension) + .sendEntityToCoords(hit); else - new Teleporter.TeleportLocation(posX + (Math.cos(r) * 600), rand.nextInt(255), posZ + (Math.sin(r) * 600), hit.dimension).sendEntityToCoords(hit); + new Teleporter.TeleportLocation( + posX + (Math.cos(r) * 600), + rand.nextInt(255), + posZ + (Math.sin(r) * 600), + hit.dimension) + .sendEntityToCoords(hit); hit.attackEntityFrom(DamageSource.fall, 10F); @@ -193,32 +227,63 @@ public class EntityDragonProjectile extends Entity { break; case FIRE_CHASER: noClip = ticksExisted < 60; - if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power / 2) || (isCollided && ticksExisted > 60) || ticksExisted > 400 || heath <= 0) { + if (genericHit + || (targetDistance > lastTickTargetDistance && targetDistance < power / 2) + || (isCollided && ticksExisted > 60) + || ticksExisted > 400 + || heath <= 0) { setDead(); worldObj.newExplosion(shooter, this.posX, this.posY, this.posZ, 2F, true, true); damageEntitiesInRadius(damageFireball, power, power * 2); } break; case ENERGY_CHASER: - if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) || ticksExisted > 800 || heath <= 0) { + if (genericHit + || (targetDistance > lastTickTargetDistance && targetDistance < power) + || ticksExisted > 800 + || heath <= 0) { setDead(); - DraconicEvolution.network.sendToAllAround(new GenericParticlePacket(GenericParticlePacket.ENERGY_BALL_KILL, posX, posY, posZ), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 128)); + DraconicEvolution.network.sendToAllAround( + new GenericParticlePacket(GenericParticlePacket.ENERGY_BALL_KILL, posX, posY, posZ), + new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 128)); damageEntitiesInRadius(damageEnergy, power, power * 3); - worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 4.0F, (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + worldObj.playSoundEffect( + posX, + posY, + posZ, + "random.explode", + 4.0F, + (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); } break; case CHAOS_CHASER: - - if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) || ticksExisted > 800 || heath <= 0) { + if (genericHit + || (targetDistance > lastTickTargetDistance && targetDistance < power) + || ticksExisted > 800 + || heath <= 0) { setDead(); - DraconicEvolution.network.sendToAllAround(new GenericParticlePacket(GenericParticlePacket.CHAOS_BALL_KILL, posX, posY, posZ), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 128)); + DraconicEvolution.network.sendToAllAround( + new GenericParticlePacket(GenericParticlePacket.CHAOS_BALL_KILL, posX, posY, posZ), + new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 128)); damageEntitiesInRadius(damageChaos, power, power * 3); - worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 4.0F, (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + worldObj.playSoundEffect( + posX, + posY, + posZ, + "random.explode", + 4.0F, + (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); int i = 3 + rand.nextInt(3); EntityDragonProjectile newProjectile; - List list = worldObj.getEntitiesWithinAABBExcludingEntity(shooter, boundingBox.expand(60, 60, 60), Utills.selectPlayer); - for (i =+ 0; i > 0; i--) { - newProjectile = new EntityDragonProjectile(worldObj, MINI_CHAOS_CHASER, list.size() > 0 ? list.get(rand.nextInt(list.size())) : null, power / 2F, shooter); + List list = worldObj.getEntitiesWithinAABBExcludingEntity( + shooter, boundingBox.expand(60, 60, 60), Utills.selectPlayer); + for (i = +0; i > 0; i--) { + newProjectile = new EntityDragonProjectile( + worldObj, + MINI_CHAOS_CHASER, + list.size() > 0 ? list.get(rand.nextInt(list.size())) : null, + power / 2F, + shooter); newProjectile.motionY = 0; int randDir = rand.nextInt(); double speed = 1 + rand.nextDouble() * 5; @@ -231,11 +296,23 @@ public class EntityDragonProjectile extends Entity { break; case MINI_CHAOS_CHASER: - if ((genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) || ticksExisted > 800 || heath <= 0) && ticksExisted > 5) { + if ((genericHit + || (targetDistance > lastTickTargetDistance && targetDistance < power) + || ticksExisted > 800 + || heath <= 0) + && ticksExisted > 5) { setDead(); - DraconicEvolution.network.sendToAllAround(new GenericParticlePacket(GenericParticlePacket.CHAOS_BALL_KILL, posX, posY, posZ), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 128)); + DraconicEvolution.network.sendToAllAround( + new GenericParticlePacket(GenericParticlePacket.CHAOS_BALL_KILL, posX, posY, posZ), + new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 128)); damageEntitiesInRadius(damageChaos, power, power * 3); - worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 4.0F, (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + worldObj.playSoundEffect( + posX, + posY, + posZ, + "random.explode", + 4.0F, + (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); } break; case IGNITION_CHARGE: @@ -246,17 +323,21 @@ public class EntityDragonProjectile extends Entity { break; } - lastTickTargetDistance = targetDistance; return false; } private Entity getHitEntity() { Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = + Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); Entity entityHit = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.boundingBox + .addCoord(this.motionX, this.motionY, this.motionZ) + .expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -285,16 +366,29 @@ public class EntityDragonProjectile extends Entity { private void damageEntitiesInRadius(DamageSource source, double radius, float damage) { if (worldObj.isRemote) return; - List entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ).expand(radius, radius, radius)); + List entities = worldObj.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ).expand(radius, radius, radius)); for (EntityLivingBase entityLivingBase : entities) { if (entityLivingBase == shooter) continue; entityLivingBase.hurtResistantTime = 0; - entityLivingBase.attackEntityFrom(source, damage / (float) (Utills.getDistanceAtoB(entityLivingBase.posX, entityLivingBase.posY, entityLivingBase.posZ, posX, posY, posZ) / radius)); + entityLivingBase.attackEntityFrom( + source, + damage + / (float) (Utills.getDistanceAtoB( + entityLivingBase.posX, + entityLivingBase.posY, + entityLivingBase.posZ, + posX, + posY, + posZ) + / radius)); if (source == damageChaos && entityLivingBase instanceof EntityPlayer) { for (ItemStack stack : ((EntityPlayer) entityLivingBase).inventory.armorInventory) { if (stack != null && stack.getItem() instanceof IEnergyContainerItem) { - ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, 30000 + rand.nextInt(10000), false); + ((IEnergyContainerItem) stack.getItem()) + .extractEnergy(stack, 30000 + rand.nextInt(10000), false); } } } @@ -304,9 +398,10 @@ public class EntityDragonProjectile extends Entity { @Override public boolean attackEntityFrom(DamageSource source, float dmg) { if (heath <= 0) return false; - if ((source.getEntity() instanceof EntityPlayer || source.getEntity() instanceof EntityArrow) && ticksExisted > 5) - heath -= dmg; - if (source.getSourceOfDamage() instanceof EntityArrow) source.getSourceOfDamage().setDead(); + if ((source.getEntity() instanceof EntityPlayer || source.getEntity() instanceof EntityArrow) + && ticksExisted > 5) heath -= dmg; + if (source.getSourceOfDamage() instanceof EntityArrow) + source.getSourceOfDamage().setDead(); if (heath <= 0) { worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 2F, false, false); @@ -319,7 +414,12 @@ public class EntityDragonProjectile extends Entity { @SideOnly(Side.CLIENT) private void spawnParticle() { if (getParticleColour() == 0) return; - Particles.DragonProjectileParticle particle = new Particles.DragonProjectileParticle(worldObj, posX - 0.25 + rand.nextDouble() * 0.5, posY + rand.nextDouble() * 0.5, posZ - 0.25 + rand.nextDouble() * 0.5, this); + Particles.DragonProjectileParticle particle = new Particles.DragonProjectileParticle( + worldObj, + posX - 0.25 + rand.nextDouble() * 0.5, + posY + rand.nextDouble() * 0.5, + posZ - 0.25 + rand.nextDouble() * 0.5, + this); double mm = 0.2; particle.motionX = (rand.nextDouble() - 0.5) * mm; particle.motionY = (rand.nextDouble() - 0.5) * mm; @@ -366,7 +466,11 @@ public class EntityDragonProjectile extends Entity { type = compound.getInteger("Type"); if (!worldObj.isRemote) dataWatcher.updateObject(10, (byte) type); noClip = type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE; - isChaser = type == FIRE_CHASER || type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE; + isChaser = type == FIRE_CHASER + || type == ENERGY_CHASER + || type == CHAOS_CHASER + || type == MINI_CHAOS_CHASER + || type == IGNITION_CHARGE; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java index 1dd43f2f..568b5ca1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.entity; import com.brandon3055.brandonscore.common.utills.Utills; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -15,8 +16,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; -import java.util.List; - public class EntityEnderArrow extends EntityDraconicArrow { private int field_145791_d = -1; private int field_145792_e = -1; @@ -31,6 +30,7 @@ public class EntityEnderArrow extends EntityDraconicArrow { * The amount of knockback an arrow applies when it hits a mob. */ private int knockbackStrength; + public boolean ignorSpeed = false; public boolean explosive = false; @@ -42,7 +42,12 @@ public class EntityEnderArrow extends EntityDraconicArrow { super(p_i1754_1_, p_i1754_2_, p_i1754_4_, p_i1754_6_); } - public EntityEnderArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) { + public EntityEnderArrow( + World p_i1755_1_, + EntityLivingBase p_i1755_2_, + EntityLivingBase p_i1755_3_, + float p_i1755_4_, + float p_i1755_5_) { super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_); } @@ -53,7 +58,7 @@ public class EntityEnderArrow extends EntityDraconicArrow { @Override protected void entityInit() { super.entityInit(); - //this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); + // this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); } @Override @@ -105,12 +110,20 @@ public class EntityEnderArrow extends EntityDraconicArrow { @Override public void onUpdate() { for (int i = 0; i < 10; i++) - this.worldObj.spawnParticle("portal", this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, this.posY + this.rand.nextDouble() * (double) this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D); + this.worldObj.spawnParticle( + "portal", + this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, + this.posY + this.rand.nextDouble() * (double) this.height - 0.25D, + this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, + (this.rand.nextDouble() - 0.5D) * 2.0D, + -this.rand.nextDouble(), + (this.rand.nextDouble() - 0.5D) * 2.0D); super.onEntityUpdate(); if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationYaw = + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } @@ -118,10 +131,13 @@ public class EntityEnderArrow extends EntityDraconicArrow { if (block.getMaterial() != Material.air) { onImpact(null); - block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); - AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); + block.setBlockBoundsBasedOnState( + this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); + AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool( + this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); - if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { + if (axisalignedbb != null + && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { this.inGround = true; } } @@ -135,17 +151,26 @@ public class EntityEnderArrow extends EntityDraconicArrow { } else { ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { - vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + vec3 = Vec3.createVectorHelper( + movingobjectposition.hitVec.xCoord, + movingobjectposition.hitVec.yCoord, + movingobjectposition.hitVec.zCoord); } Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.boundingBox + .addCoord(this.motionX, this.motionY, this.motionZ) + .expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -175,11 +200,14 @@ public class EntityEnderArrow extends EntityDraconicArrow { movingobjectposition = new MovingObjectPosition(entity); } - - if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { + if (movingobjectposition != null + && movingobjectposition.entityHit != null + && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { + if (entityplayer.capabilities.disableDamage + || this.shootingEntity instanceof EntityPlayer + && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } @@ -188,90 +216,97 @@ public class EntityEnderArrow extends EntityDraconicArrow { float f4; if (movingobjectposition != null) { -// if (movingobjectposition.entityHit != null && movingobjectposition.entityHit != shootingEntity) { -// onImpact(movingobjectposition.entityHit); -// int k; -// if (!ignorSpeed) { -// f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); -// k = MathHelper.ceiling_double_int(f2 * this.damage); -// -// if (this.getIsCritical()) { -// k += this.rand.nextInt(k / 2 + 2); -// } -// } else { -// k = (int) this.damage; -// if (this.getIsCritical()) { -// k += this.rand.nextInt(k / 2 + 2); -// } -// } -// -// DamageSource damagesource = null; -// -// if (this.shootingEntity == null) { -// damagesource = DamageSource.causeArrowDamage(this, this); -// } else { -// damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); -// } -// if (movingobjectposition.entityHit instanceof EntityEnderman) -// damagesource = DamageSource.magic; -// -// if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { -// movingobjectposition.entityHit.setFire(5); -// } -// -// movingobjectposition.entityHit.hurtResistantTime = 0; -// -// if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) { -// if (movingobjectposition.entityHit instanceof EntityLivingBase) { -// EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; -// -// if (!this.worldObj.isRemote) { -// entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); -// } -// -// if (this.knockbackStrength > 0) { -// f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); -// -// if (f4 > 0.0F) { -// movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); -// } -// } -// -// if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { -// EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); -// EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); -// } -// -// if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { -// ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); -// } -// } -// -// this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); -// -// // if (!(movingobjectposition.entityHit instanceof EntityEnderman)) -// //{ -// this.setDead(); -// //} -// } else { -// this.motionX *= -0.10000000149011612D; -// this.motionY *= -0.10000000149011612D; -// this.motionZ *= -0.10000000149011612D; -// this.rotationYaw += 180.0F; -// this.prevRotationYaw += 180.0F; -// this.ticksInAir = 0; -// } -// } else + // if (movingobjectposition.entityHit != null && movingobjectposition.entityHit != shootingEntity) { + // onImpact(movingobjectposition.entityHit); + // int k; + // if (!ignorSpeed) { + // f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + + // this.motionZ * this.motionZ); + // k = MathHelper.ceiling_double_int(f2 * this.damage); + // + // if (this.getIsCritical()) { + // k += this.rand.nextInt(k / 2 + 2); + // } + // } else { + // k = (int) this.damage; + // if (this.getIsCritical()) { + // k += this.rand.nextInt(k / 2 + 2); + // } + // } + // + // DamageSource damagesource = null; + // + // if (this.shootingEntity == null) { + // damagesource = DamageSource.causeArrowDamage(this, this); + // } else { + // damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); + // } + // if (movingobjectposition.entityHit instanceof EntityEnderman) + // damagesource = DamageSource.magic; + // + // if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { + // movingobjectposition.entityHit.setFire(5); + // } + // + // movingobjectposition.entityHit.hurtResistantTime = 0; + // + // if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) { + // if (movingobjectposition.entityHit instanceof EntityLivingBase) { + // EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; + // + // if (!this.worldObj.isRemote) { + // entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); + // } + // + // if (this.knockbackStrength > 0) { + // f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + // + // if (f4 > 0.0F) { + // movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * + // 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); + // } + // } + // + // if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { + // EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); + // EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); + // } + // + // if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && + // movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof + // EntityPlayerMP) { + // ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new + // S2BPacketChangeGameState(6, 0.0F)); + // } + // } + // + // this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + // + // // if (!(movingobjectposition.entityHit instanceof EntityEnderman)) + // //{ + // this.setDead(); + // //} + // } else { + // this.motionX *= -0.10000000149011612D; + // this.motionY *= -0.10000000149011612D; + // this.motionZ *= -0.10000000149011612D; + // this.rotationYaw += 180.0F; + // this.prevRotationYaw += 180.0F; + // this.ticksInAir = 0; + // } + // } else if (movingobjectposition.entityHit == null) { this.field_145791_d = movingobjectposition.blockX; this.field_145792_e = movingobjectposition.blockY; this.field_145789_f = movingobjectposition.blockZ; this.field_145790_g = block; - this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f); + this.inData = this.worldObj.getBlockMetadata( + this.field_145791_d, this.field_145792_e, this.field_145789_f); this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + f2 = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / f2 * 0.05000000074505806D; this.posY -= this.motionY / f2 * 0.05000000074505806D; this.posZ -= this.motionZ / f2 * 0.05000000074505806D; @@ -281,7 +316,8 @@ public class EntityEnderArrow extends EntityDraconicArrow { this.setIsCritical(false); if (this.field_145790_g.getMaterial() != Material.air) { - this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this); + this.field_145790_g.onEntityCollidedWithBlock( + this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this); } } } @@ -292,7 +328,9 @@ public class EntityEnderArrow extends EntityDraconicArrow { f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); + this.rotationPitch - this.prevRotationPitch < -180.0F; + this.prevRotationPitch -= 360.0F) { ; } @@ -316,7 +354,14 @@ public class EntityEnderArrow extends EntityDraconicArrow { if (this.isInWater()) { for (int l = 0; l < 4; ++l) { f4 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle( + "bubble", + this.posX - this.motionX * f4, + this.posY - this.motionY * f4, + this.posZ - this.motionZ * f4, + this.motionX, + this.motionY, + this.motionZ); } f3 = 0.8F; @@ -347,7 +392,8 @@ public class EntityEnderArrow extends EntityDraconicArrow { par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); par1NBTTagCompound.setByte("pickup", (byte) this.canBePickedUp); par1NBTTagCompound.setDouble("damage", this.damage); - //par1NBTTagCompound.setString("shooter", getShooter() instanceof EntityPlayer ? ((EntityPlayer) getShooter()).getCommandSenderName() : ""); + // par1NBTTagCompound.setString("shooter", getShooter() instanceof EntityPlayer ? ((EntityPlayer) + // getShooter()).getCommandSenderName() : ""); } @Override @@ -360,7 +406,8 @@ public class EntityEnderArrow extends EntityDraconicArrow { this.inData = par1NBTTagCompound.getByte("inData") & 255; this.arrowShake = par1NBTTagCompound.getByte("shake") & 255; this.inGround = par1NBTTagCompound.getByte("inGround") == 1; - //dataWatcher.updateObject(SHOOTER_DATAWATCHER_INDEX, par1NBTTagCompound.hasKey("shooter") ? par1NBTTagCompound.getString("shooter") : ""); + // dataWatcher.updateObject(SHOOTER_DATAWATCHER_INDEX, par1NBTTagCompound.hasKey("shooter") ? + // par1NBTTagCompound.getString("shooter") : ""); if (par1NBTTagCompound.hasKey("damage", 99)) { this.damage = par1NBTTagCompound.getDouble("damage"); @@ -374,8 +421,7 @@ public class EntityEnderArrow extends EntityDraconicArrow { } @Override - public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { - } + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) {} protected void onImpact(Entity entityHit) { if (shootingEntity == null) return; @@ -384,7 +430,14 @@ public class EntityEnderArrow extends EntityDraconicArrow { double startZ = shootingEntity.posZ; for (int i = 0; i < 32; ++i) { - this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian()); + this.worldObj.spawnParticle( + "portal", + this.posX, + this.posY + this.rand.nextDouble() * 2.0D, + this.posZ, + this.rand.nextGaussian(), + 0.0D, + this.rand.nextGaussian()); } if (!(shootingEntity instanceof EntityPlayer) || shootingEntity.isDead) return; @@ -396,19 +449,22 @@ public class EntityEnderArrow extends EntityDraconicArrow { if (this.shootingEntity != null && this.shootingEntity instanceof EntityPlayerMP) { EntityPlayerMP entityplayermp = (EntityPlayerMP) this.shootingEntity; - if (entityplayermp.playerNetServerHandler.func_147362_b().isChannelOpen() && entityplayermp.worldObj == this.worldObj) { + if (entityplayermp.playerNetServerHandler.func_147362_b().isChannelOpen() + && entityplayermp.worldObj == this.worldObj) { int x = (int) Math.floor(posX); int y = (int) Math.floor(posY); int z = (int) Math.floor(posZ); double travelDist = Utills.getDistanceAtoB(startX, startY, startZ, x, y, z); float travelDmg = (float) (travelDist / 5D); - EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x + 0.5, y + 0.5, z + 0.5, travelDmg); + EnderTeleportEvent event = + new EnderTeleportEvent(entityplayermp, x + 0.5, y + 0.5, z + 0.5, travelDmg); if (!MinecraftForge.EVENT_BUS.post(event)) { if (this.shootingEntity.isRiding()) { shootingEntity.mountEntity((Entity) null); } - ((EntityPlayer) shootingEntity).setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); + ((EntityPlayer) shootingEntity) + .setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); shootingEntity.fallDistance = 0.0F; shootingEntity.attackEntityFrom(DamageSource.fall, (float) (travelDist / 5D)); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java index c374a3a5..dba6f61f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java @@ -47,7 +47,10 @@ public class EntityPersistentItem extends EntityItem { @Override public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { - if (getEntityItem().getItem() instanceof DragonHeart && par1DamageSource.isExplosion() && par2 > 10f && !this.isDead) { + if (getEntityItem().getItem() instanceof DragonHeart + && par1DamageSource.isExplosion() + && par2 > 10f + && !this.isDead) { worldObj.spawnEntityInWorld(new EntityDragonHeart(worldObj, posX, posY, posZ)); this.setDead(); } @@ -71,8 +74,11 @@ public class EntityPersistentItem extends EntityItem { public void onUpdate() { if (age + 10 >= lifespan) age = 0; boolean flag2 = false; - if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 1), MathHelper.floor_double(this.posZ)) == Blocks.end_portal) - flag2 = true; + if (this.worldObj.getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.posY - 1), + MathHelper.floor_double(this.posZ)) + == Blocks.end_portal) flag2 = true; ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); if (stack != null && stack.getItem() != null) { if (stack.getItem().onEntityItemUpdate(this)) { @@ -98,12 +104,21 @@ public class EntityPersistentItem extends EntityItem { motionY = 0; motionZ = 0; } - this.noClip = this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); + this.noClip = + this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); this.moveEntity(this.motionX, this.motionY, this.motionZ); - boolean flag = (int) this.prevPosX != (int) this.posX || (int) this.prevPosY != (int) this.posY || (int) this.prevPosZ != (int) this.posZ; + boolean flag = (int) this.prevPosX != (int) this.posX + || (int) this.prevPosY != (int) this.posY + || (int) this.prevPosZ != (int) this.posZ; if (flag || this.ticksExisted % 25 == 0) { - if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) { + if (this.worldObj + .getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.posY), + MathHelper.floor_double(this.posZ)) + .getMaterial() + == Material.lava) { this.motionY = 0.20000000298023224D; this.motionX = (double) ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); this.motionZ = (double) ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); @@ -114,7 +129,12 @@ public class EntityPersistentItem extends EntityItem { float f = 0.98F; if (this.onGround) { - f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F; + f = this.worldObj.getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)) + .slipperiness + * 0.98F; } this.motionX *= (double) f; @@ -136,7 +156,9 @@ public class EntityPersistentItem extends EntityItem { if (!this.worldObj.isRemote && this.age >= lifespan) { if (item != null) { - ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); + ItemExpireEvent event = new ItemExpireEvent( + this, + (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); if (MinecraftForge.EVENT_BUS.post(event)) { lifespan += event.extraLife; } else { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java index 76c30ee7..8ef98489 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java @@ -11,7 +11,7 @@ import net.minecraftforge.common.IExtendedEntityProperties; */ public class ExtendedPlayer implements IExtendedEntityProperties { - public final static String EXT_PROP_NAME = "DEPlayerProperties"; + public static final String EXT_PROP_NAME = "DEPlayerProperties"; private final EntityPlayer player; private int spawnCount; @@ -51,8 +51,7 @@ public class ExtendedPlayer implements IExtendedEntityProperties { } @Override - public void init(Entity entity, World world) { - } + public void init(Entity entity, World world) {} public int getSpawnCount() { return spawnCount; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java index ce7c2d5a..b347e397 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java @@ -1,18 +1,16 @@ package com.brandon3055.draconicevolution.common.handler; -import java.io.File; - import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; import cpw.mods.fml.common.registry.GameRegistry; +import java.io.File; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.init.Blocks; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -public class BalanceConfigHandler -{ +public class BalanceConfigHandler { public static final int wyvernArmorMinShieldRecovery = 5; public static final int draconicArmorMinShieldRecovery = 5; public static final int wyvernToolsMinDigAOEUpgradePoints = 1; @@ -166,454 +164,546 @@ public class BalanceConfigHandler public static int energyDeviceAdvancedLinkingRange = 50; private static Configuration config; - public static void init(File modConfigurationDirectory) - { - if (config == null) - { + public static void init(File modConfigurationDirectory) { + if (config == null) { config = new Configuration(new File(modConfigurationDirectory, "DraconicEvolution.Balance.cfg")); config.load(); config.setCategoryRequiresMcRestart("tweaks", true); - config.setCategoryComment("tweaks.armor", - "Values in this category may be replaced automatically to prevent problems"); - config.setCategoryComment("tweaks.tools", - "Values in this category may be replaced automatically to prevent problems"); - config.setCategoryComment("tweaks.weapons", - "Values in this category may be replaced automatically to prevent problems"); + config.setCategoryComment( + "tweaks.armor", "Values in this category may be replaced automatically to prevent problems"); + config.setCategoryComment( + "tweaks.tools", "Values in this category may be replaced automatically to prevent problems"); + config.setCategoryComment( + "tweaks.weapons", "Values in this category may be replaced automatically to prevent problems"); syncConfig(); } } - private static void syncConfig() - { + private static void syncConfig() { wyvernArmorBaseStorage = - getInteger("energy.armor", "Wyvern Armor: Base energy storage (RF)", wyvernArmorBaseStorage); - wyvernArmorStoragePerUpgrade = - getInteger("energy.armor", "Wyvern Armor: Additional energy storage per upgrade installed (RF)", - wyvernArmorStoragePerUpgrade); + getInteger("energy.armor", "Wyvern Armor: Base energy storage (RF)", wyvernArmorBaseStorage); + wyvernArmorStoragePerUpgrade = getInteger( + "energy.armor", + "Wyvern Armor: Additional energy storage per upgrade installed (RF)", + wyvernArmorStoragePerUpgrade); wyvernArmorMaxTransfer = - getInteger("energy.armor", "Wyvern Armor: Maximum energy transfer rate (RF/t)", wyvernArmorMaxTransfer); - wyvernArmorEnergyPerProtectionPoint = - getInteger("energy.armor", "Wyvern Armor: Amount of energy required to restore protection point (RF)", - wyvernArmorEnergyPerProtectionPoint); + getInteger("energy.armor", "Wyvern Armor: Maximum energy transfer rate (RF/t)", wyvernArmorMaxTransfer); + wyvernArmorEnergyPerProtectionPoint = getInteger( + "energy.armor", + "Wyvern Armor: Amount of energy required to restore protection point (RF)", + wyvernArmorEnergyPerProtectionPoint); draconicArmorBaseStorage = - getInteger("energy.armor", "Draconic Armor: Base energy storage (RF)", draconicArmorBaseStorage); - draconicArmorStoragePerUpgrade = - getInteger("energy.armor", "Draconic Armor: Additional energy storage per upgrade installed (RF)", - draconicArmorStoragePerUpgrade); - draconicArmorMaxTransfer = - getInteger("energy.armor", "Draconic Armor: Maximum energy transfer rate (RF/t)", draconicArmorMaxTransfer); - draconicArmorEnergyPerProtectionPoint = - getInteger("energy.armor", "Draconic Armor: Amount of energy required to restore protection point (RF)", - draconicArmorEnergyPerProtectionPoint); - draconicArmorEnergyToRemoveEffects = - getInteger("energy.armor", "Draconic Armor: Amount of energy required to remove negative effects (RF)", - draconicArmorEnergyToRemoveEffects); + getInteger("energy.armor", "Draconic Armor: Base energy storage (RF)", draconicArmorBaseStorage); + draconicArmorStoragePerUpgrade = getInteger( + "energy.armor", + "Draconic Armor: Additional energy storage per upgrade installed (RF)", + draconicArmorStoragePerUpgrade); + draconicArmorMaxTransfer = getInteger( + "energy.armor", "Draconic Armor: Maximum energy transfer rate (RF/t)", draconicArmorMaxTransfer); + draconicArmorEnergyPerProtectionPoint = getInteger( + "energy.armor", + "Draconic Armor: Amount of energy required to restore protection point (RF)", + draconicArmorEnergyPerProtectionPoint); + draconicArmorEnergyToRemoveEffects = getInteger( + "energy.armor", + "Draconic Armor: Amount of energy required to remove negative effects (RF)", + draconicArmorEnergyToRemoveEffects); wyvernToolsBaseStorage = - getInteger("energy.tools", "Wyvern Tools: Base energy storage (RF)", wyvernToolsBaseStorage); - wyvernToolsStoragePerUpgrade = - getInteger("energy.tools", "Wyvern Tools: Additional energy storage per upgrade installed (RF)", - wyvernToolsStoragePerUpgrade); + getInteger("energy.tools", "Wyvern Tools: Base energy storage (RF)", wyvernToolsBaseStorage); + wyvernToolsStoragePerUpgrade = getInteger( + "energy.tools", + "Wyvern Tools: Additional energy storage per upgrade installed (RF)", + wyvernToolsStoragePerUpgrade); wyvernToolsMaxTransfer = - getInteger("energy.tools", "Wyvern Tools: Maximum energy transfer rate (RF/t)", wyvernToolsMaxTransfer); - wyvernToolsEnergyPerAction = - getInteger("energy.tools", "Wyvern Tools: Amount of energy required to perform action (RF)", - wyvernToolsEnergyPerAction); + getInteger("energy.tools", "Wyvern Tools: Maximum energy transfer rate (RF/t)", wyvernToolsMaxTransfer); + wyvernToolsEnergyPerAction = getInteger( + "energy.tools", + "Wyvern Tools: Amount of energy required to perform action (RF)", + wyvernToolsEnergyPerAction); draconicToolsBaseStorage = - getInteger("energy.tools", "Draconic Tools: Base energy storage (RF)", draconicToolsBaseStorage); - draconicToolsStoragePerUpgrade = - getInteger("energy.tools", "Draconic Tools: Additional energy storage per upgrade installed (RF)", - draconicToolsStoragePerUpgrade); - draconicToolsMaxTransfer = - getInteger("energy.tools", "Draconic Tools: Maximum energy transfer rate (RF/t)", draconicToolsMaxTransfer); - draconicToolsEnergyPerAction = - getInteger("energy.tools", "Draconic Tools: Amount of energy required to perform action (RF)", - draconicToolsEnergyPerAction); - wyvernCapacitorBaseStorage = - getInteger("energy.tools", "Wyvern Flux Capacitor: Base energy storage (RF)", wyvernCapacitorBaseStorage); - wyvernCapacitorStoragePerUpgrade = - getInteger("energy.tools", "Wyvern Flux Capacitor: Additional energy storage per upgrade installed (RF)", - wyvernCapacitorStoragePerUpgrade); - wyvernCapacitorMaxReceive = - getInteger("energy.tools", "Wyvern Flux Capacitor: Maximum energy reception rate (RF/t)", - wyvernCapacitorMaxReceive); - wyvernCapacitorMaxExtract = - getInteger("energy.tools", "Wyvern Flux Capacitor: Maximum energy extraction rate (RF/t)", - wyvernCapacitorMaxExtract); - draconicCapacitorBaseStorage = getInteger("energy.tools", "Draconic Flux Capacitor: Base energy storage (RF)", - draconicCapacitorBaseStorage); - draconicCapacitorStoragePerUpgrade = - getInteger("energy.tools", "Draconic Flux Capacitor: Additional energy storage per upgrade installed (RF)", - draconicCapacitorStoragePerUpgrade); - draconicCapacitorMaxReceive = - getInteger("energy.tools", "Draconic Flux Capacitor: Maximum energy reception rate (RF/t)", - draconicCapacitorMaxReceive); - draconicCapacitorMaxExtract = - getInteger("energy.tools", "Draconic Flux Capacitor: Maximum energy extraction rate (RF/t)", - draconicCapacitorMaxExtract); + getInteger("energy.tools", "Draconic Tools: Base energy storage (RF)", draconicToolsBaseStorage); + draconicToolsStoragePerUpgrade = getInteger( + "energy.tools", + "Draconic Tools: Additional energy storage per upgrade installed (RF)", + draconicToolsStoragePerUpgrade); + draconicToolsMaxTransfer = getInteger( + "energy.tools", "Draconic Tools: Maximum energy transfer rate (RF/t)", draconicToolsMaxTransfer); + draconicToolsEnergyPerAction = getInteger( + "energy.tools", + "Draconic Tools: Amount of energy required to perform action (RF)", + draconicToolsEnergyPerAction); + wyvernCapacitorBaseStorage = getInteger( + "energy.tools", "Wyvern Flux Capacitor: Base energy storage (RF)", wyvernCapacitorBaseStorage); + wyvernCapacitorStoragePerUpgrade = getInteger( + "energy.tools", + "Wyvern Flux Capacitor: Additional energy storage per upgrade installed (RF)", + wyvernCapacitorStoragePerUpgrade); + wyvernCapacitorMaxReceive = getInteger( + "energy.tools", + "Wyvern Flux Capacitor: Maximum energy reception rate (RF/t)", + wyvernCapacitorMaxReceive); + wyvernCapacitorMaxExtract = getInteger( + "energy.tools", + "Wyvern Flux Capacitor: Maximum energy extraction rate (RF/t)", + wyvernCapacitorMaxExtract); + draconicCapacitorBaseStorage = getInteger( + "energy.tools", "Draconic Flux Capacitor: Base energy storage (RF)", draconicCapacitorBaseStorage); + draconicCapacitorStoragePerUpgrade = getInteger( + "energy.tools", + "Draconic Flux Capacitor: Additional energy storage per upgrade installed (RF)", + draconicCapacitorStoragePerUpgrade); + draconicCapacitorMaxReceive = getInteger( + "energy.tools", + "Draconic Flux Capacitor: Maximum energy reception rate (RF/t)", + draconicCapacitorMaxReceive); + draconicCapacitorMaxExtract = getInteger( + "energy.tools", + "Draconic Flux Capacitor: Maximum energy extraction rate (RF/t)", + draconicCapacitorMaxExtract); wyvernWeaponsBaseStorage = - getInteger("energy.weapons", "Wyvern Weapons: Base energy storage (RF)", wyvernWeaponsBaseStorage); - wyvernWeaponsStoragePerUpgrade = - getInteger("energy.weapons", "Wyvern Weapons: Additional energy storage per upgrade installed (RF)", - wyvernWeaponsStoragePerUpgrade); - wyvernWeaponsMaxTransfer = getInteger("energy.weapons", "Wyvern Weapons: Maximum energy transfer rate (RF/t)", - wyvernWeaponsMaxTransfer); - wyvernWeaponsEnergyPerAttack = - getInteger("energy.weapons", "Wyvern Weapons: Amount of energy required to perform attack (RF)", - wyvernWeaponsEnergyPerAttack); - wyvernBowEnergyPerShot = - getInteger("energy.weapons", "Wyvern Bow: Amount of energy required to shoot (RF)", wyvernBowEnergyPerShot); + getInteger("energy.weapons", "Wyvern Weapons: Base energy storage (RF)", wyvernWeaponsBaseStorage); + wyvernWeaponsStoragePerUpgrade = getInteger( + "energy.weapons", + "Wyvern Weapons: Additional energy storage per upgrade installed (RF)", + wyvernWeaponsStoragePerUpgrade); + wyvernWeaponsMaxTransfer = getInteger( + "energy.weapons", "Wyvern Weapons: Maximum energy transfer rate (RF/t)", wyvernWeaponsMaxTransfer); + wyvernWeaponsEnergyPerAttack = getInteger( + "energy.weapons", + "Wyvern Weapons: Amount of energy required to perform attack (RF)", + wyvernWeaponsEnergyPerAttack); + wyvernBowEnergyPerShot = getInteger( + "energy.weapons", "Wyvern Bow: Amount of energy required to shoot (RF)", wyvernBowEnergyPerShot); draconicWeaponsBaseStorage = - getInteger("energy.weapons", "Draconic Weapons: Base energy storage (RF)", draconicWeaponsBaseStorage); - draconicWeaponsStoragePerUpgrade = - getInteger("energy.weapons", "Draconic Weapons: Additional energy storage per upgrade installed (RF)", - draconicWeaponsStoragePerUpgrade); - draconicWeaponsMaxTransfer = - getInteger("energy.weapons", "Draconic Weapons: Maximum energy transfer rate (RF/t)", - draconicWeaponsMaxTransfer); - draconicWeaponsEnergyPerAttack = - getInteger("energy.weapons", "Draconic Weapons: Amount of energy required to perform attack (RF)", - draconicWeaponsEnergyPerAttack); - draconicBowEnergyPerShot = getInteger("energy.weapons", "Draconic Bow: Amount of energy required to shoot (RF)", - draconicBowEnergyPerShot); - draconicFireEnergyCostMultiptier = - getInteger("energy.weapons", "Arrow of Draconic Fire: Energy cost multiplier", - draconicFireEnergyCostMultiptier); - draconiumBlockEnergyToChange = - getInteger("energy.misc", "Draconium Block: Amount of energy required to charge (RF)", - draconiumBlockEnergyToChange); - draconiumBlockChargingSpeed = - getInteger("energy.misc", "Draconium Block: Maximum charging speed (RF/t)", draconiumBlockChargingSpeed); + getInteger("energy.weapons", "Draconic Weapons: Base energy storage (RF)", draconicWeaponsBaseStorage); + draconicWeaponsStoragePerUpgrade = getInteger( + "energy.weapons", + "Draconic Weapons: Additional energy storage per upgrade installed (RF)", + draconicWeaponsStoragePerUpgrade); + draconicWeaponsMaxTransfer = getInteger( + "energy.weapons", "Draconic Weapons: Maximum energy transfer rate (RF/t)", draconicWeaponsMaxTransfer); + draconicWeaponsEnergyPerAttack = getInteger( + "energy.weapons", + "Draconic Weapons: Amount of energy required to perform attack (RF)", + draconicWeaponsEnergyPerAttack); + draconicBowEnergyPerShot = getInteger( + "energy.weapons", "Draconic Bow: Amount of energy required to shoot (RF)", draconicBowEnergyPerShot); + draconicFireEnergyCostMultiptier = getInteger( + "energy.weapons", "Arrow of Draconic Fire: Energy cost multiplier", draconicFireEnergyCostMultiptier); + draconiumBlockEnergyToChange = getInteger( + "energy.misc", + "Draconium Block: Amount of energy required to charge (RF)", + draconiumBlockEnergyToChange); + draconiumBlockChargingSpeed = getInteger( + "energy.misc", "Draconium Block: Maximum charging speed (RF/t)", draconiumBlockChargingSpeed); energyInfuserStorage = - getInteger("energy.machines", "Energy Infuser: Energy buffer size (RF)", energyInfuserStorage); - energyInfuserMaxTransfer = getInteger("energy.machines", "Energy Infuser: Maximum energy transfer rate (RF/t)", - energyInfuserMaxTransfer); - energyStorageTier1Storage = - getLong("energy.machines", "Multiblock Energy Storage Tier 1: Energy buffer size (RF)", - energyStorageTier1Storage); - energyStorageTier2Storage = - getLong("energy.machines", "Multiblock Energy Storage Tier 2: Energy buffer size (RF)", - energyStorageTier2Storage); - energyStorageTier3Storage = - getLong("energy.machines", "Multiblock Energy Storage Tier 3: Energy buffer size (RF)", - energyStorageTier3Storage); - energyStorageTier4Storage = - getLong("energy.machines", "Multiblock Energy Storage Tier 4: Energy buffer size (RF)", - energyStorageTier4Storage); - energyStorageTier5Storage = - getLong("energy.machines", "Multiblock Energy Storage Tier 5: Energy buffer size (RF)", - energyStorageTier5Storage); - energyStorageTier6Storage = - getLong("energy.machines", "Multiblock Energy Storage Tier 6: Energy buffer size (RF)", - energyStorageTier6Storage); - energyStorageTier7Storage = - getLong("energy.machines", "Multiblock Energy Storage Tier 7: Energy buffer size (RF)", - energyStorageTier7Storage); - grinderInternalEnergyBufferSize = getInteger("energy.machines", "Mob Grinder: Internal energy buffer size (RF)", - grinderInternalEnergyBufferSize); - grinderExternalEnergyBufferSize = - getInteger("energy.machines", "Mob Grinder: Main energy buffer size (RF)", grinderExternalEnergyBufferSize); + getInteger("energy.machines", "Energy Infuser: Energy buffer size (RF)", energyInfuserStorage); + energyInfuserMaxTransfer = getInteger( + "energy.machines", "Energy Infuser: Maximum energy transfer rate (RF/t)", energyInfuserMaxTransfer); + energyStorageTier1Storage = getLong( + "energy.machines", + "Multiblock Energy Storage Tier 1: Energy buffer size (RF)", + energyStorageTier1Storage); + energyStorageTier2Storage = getLong( + "energy.machines", + "Multiblock Energy Storage Tier 2: Energy buffer size (RF)", + energyStorageTier2Storage); + energyStorageTier3Storage = getLong( + "energy.machines", + "Multiblock Energy Storage Tier 3: Energy buffer size (RF)", + energyStorageTier3Storage); + energyStorageTier4Storage = getLong( + "energy.machines", + "Multiblock Energy Storage Tier 4: Energy buffer size (RF)", + energyStorageTier4Storage); + energyStorageTier5Storage = getLong( + "energy.machines", + "Multiblock Energy Storage Tier 5: Energy buffer size (RF)", + energyStorageTier5Storage); + energyStorageTier6Storage = getLong( + "energy.machines", + "Multiblock Energy Storage Tier 6: Energy buffer size (RF)", + energyStorageTier6Storage); + energyStorageTier7Storage = getLong( + "energy.machines", + "Multiblock Energy Storage Tier 7: Energy buffer size (RF)", + energyStorageTier7Storage); + grinderInternalEnergyBufferSize = getInteger( + "energy.machines", "Mob Grinder: Internal energy buffer size (RF)", grinderInternalEnergyBufferSize); + grinderExternalEnergyBufferSize = getInteger( + "energy.machines", "Mob Grinder: Main energy buffer size (RF)", grinderExternalEnergyBufferSize); grinderMaxReceive = - getInteger("energy.machines", "Mob Grinder: Maximum energy reception rate (RF/t)", grinderMaxReceive); - grinderEnergyPerKill = - getInteger("energy.machines", "Mob Grinder: Amount of energy required to kill entity (RF)", - grinderEnergyPerKill); + getInteger("energy.machines", "Mob Grinder: Maximum energy reception rate (RF/t)", grinderMaxReceive); + grinderEnergyPerKill = getInteger( + "energy.machines", "Mob Grinder: Amount of energy required to kill entity (RF)", grinderEnergyPerKill); energyRelayBasicStorage = - getInteger("energy.machines", "Energy Relay: Energy buffer size (RF)", energyRelayBasicStorage); - energyRelayAdvancedStorage = - getInteger("energy.machines", "Advanced Energy Relay: Energy buffer size (RF)", energyRelayAdvancedStorage); - energyRelayBasicMaxReceive = getInteger("energy.machines", "Energy Relay: Maximum energy reception rate (RF/t)", - energyRelayBasicMaxReceive); - energyRelayAdvancedMaxReceive = - getInteger("energy.machines", "Advanced Energy Relay: Maximum energy reception rate (RF/t)", - energyRelayAdvancedMaxReceive); - energyRelayBasicMaxExtract = - getInteger("energy.machines", "Energy Relay: Maximum energy extraction rate (RF/t)", - energyRelayBasicMaxExtract); - energyRelayAdvancedMaxExtract = - getInteger("energy.machines", "Advanced Energy Relay: Maximum energy extraction rate (RF/t)", - energyRelayAdvancedMaxExtract); - energyTransceiverBasicStorage = - getInteger("energy.machines", "Energy Transceiver: Energy buffer size (RF)", energyTransceiverBasicStorage); - energyTransceiverAdvancedStorage = - getInteger("energy.machines", "Advanced Energy Transceiver: Energy buffer size (RF)", - energyTransceiverAdvancedStorage); - energyTransceiverBasicMaxReceive = - getInteger("energy.machines", "Energy Transceiver: Maximum energy reception rate (RF/t)", - energyTransceiverBasicMaxReceive); - energyTransceiverAdvancedMaxReceive = - getInteger("energy.machines", "Advanced Energy Transceiver: Maximum energy reception rate (RF/t)", - energyTransceiverAdvancedMaxReceive); - energyTransceiverBasicMaxExtract = - getInteger("energy.machines", "Energy Transceiver: Maximum energy extraction rate (RF/t)", - energyTransceiverBasicMaxExtract); - energyTransceiverAdvancedMaxExtract = - getInteger("energy.machines", "Advanced Energy Transceiver: Maximum energy extraction rate (RF/t)", - energyTransceiverAdvancedMaxExtract); - energyWirelessTransceiverBasicStorage = - getInteger("energy.machines", "Wireless Energy Transceiver: Energy buffer size (RF)", - energyWirelessTransceiverBasicStorage); - energyWirelessTransceiverAdvancedStorage = - getInteger("energy.machines", "Advanced Wireless Energy Transceiver: Energy buffer size (RF)", - energyWirelessTransceiverAdvancedStorage); - energyWirelessTransceiverBasicMaxReceive = - getInteger("energy.machines", "Wireless Energy Transceiver: Maximum energy reception rate (RF/t)", - energyWirelessTransceiverBasicMaxReceive); - energyWirelessTransceiverAdvancedMaxReceive = - getInteger("energy.machines", "Advanced Wireless Energy Transceiver: Maximum energy reception rate (RF/t)", - energyWirelessTransceiverAdvancedMaxReceive); - energyWirelessTransceiverBasicMaxExtract = - getInteger("energy.machines", "Wireless Energy Transceiver: Maximum energy extraction rate (RF/t)", - energyWirelessTransceiverBasicMaxExtract); - energyWirelessTransceiverAdvancedMaxExtract = - getInteger("energy.machines", "Advanced Wireless Energy Transceiver: Maximum energy extraction rate (RF/t)", - energyWirelessTransceiverAdvancedMaxExtract); - energyWirelessTransceiverBasicMaxSend = getInteger("energy.machines", - "Wireless Energy Transceiver: Maximum energy sending rate " + - "for each linked device (RF/t)", - energyWirelessTransceiverBasicMaxSend); - energyWirelessTransceiverAdvancedMaxSend = getInteger("energy.machines", - "Advanced Wireless Energy Transceiver: Maximum energy " + - "sending rate for each linked device (RF/t)", - energyWirelessTransceiverAdvancedMaxSend); - wyvernArmorMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernArmorBaseStorage) / - (double) Math.max(wyvernArmorStoragePerUpgrade, 1)) * - EnumUpgrade.RF_CAPACITY.pointConversion; + getInteger("energy.machines", "Energy Relay: Energy buffer size (RF)", energyRelayBasicStorage); + energyRelayAdvancedStorage = getInteger( + "energy.machines", "Advanced Energy Relay: Energy buffer size (RF)", energyRelayAdvancedStorage); + energyRelayBasicMaxReceive = getInteger( + "energy.machines", "Energy Relay: Maximum energy reception rate (RF/t)", energyRelayBasicMaxReceive); + energyRelayAdvancedMaxReceive = getInteger( + "energy.machines", + "Advanced Energy Relay: Maximum energy reception rate (RF/t)", + energyRelayAdvancedMaxReceive); + energyRelayBasicMaxExtract = getInteger( + "energy.machines", "Energy Relay: Maximum energy extraction rate (RF/t)", energyRelayBasicMaxExtract); + energyRelayAdvancedMaxExtract = getInteger( + "energy.machines", + "Advanced Energy Relay: Maximum energy extraction rate (RF/t)", + energyRelayAdvancedMaxExtract); + energyTransceiverBasicStorage = getInteger( + "energy.machines", "Energy Transceiver: Energy buffer size (RF)", energyTransceiverBasicStorage); + energyTransceiverAdvancedStorage = getInteger( + "energy.machines", + "Advanced Energy Transceiver: Energy buffer size (RF)", + energyTransceiverAdvancedStorage); + energyTransceiverBasicMaxReceive = getInteger( + "energy.machines", + "Energy Transceiver: Maximum energy reception rate (RF/t)", + energyTransceiverBasicMaxReceive); + energyTransceiverAdvancedMaxReceive = getInteger( + "energy.machines", + "Advanced Energy Transceiver: Maximum energy reception rate (RF/t)", + energyTransceiverAdvancedMaxReceive); + energyTransceiverBasicMaxExtract = getInteger( + "energy.machines", + "Energy Transceiver: Maximum energy extraction rate (RF/t)", + energyTransceiverBasicMaxExtract); + energyTransceiverAdvancedMaxExtract = getInteger( + "energy.machines", + "Advanced Energy Transceiver: Maximum energy extraction rate (RF/t)", + energyTransceiverAdvancedMaxExtract); + energyWirelessTransceiverBasicStorage = getInteger( + "energy.machines", + "Wireless Energy Transceiver: Energy buffer size (RF)", + energyWirelessTransceiverBasicStorage); + energyWirelessTransceiverAdvancedStorage = getInteger( + "energy.machines", + "Advanced Wireless Energy Transceiver: Energy buffer size (RF)", + energyWirelessTransceiverAdvancedStorage); + energyWirelessTransceiverBasicMaxReceive = getInteger( + "energy.machines", + "Wireless Energy Transceiver: Maximum energy reception rate (RF/t)", + energyWirelessTransceiverBasicMaxReceive); + energyWirelessTransceiverAdvancedMaxReceive = getInteger( + "energy.machines", + "Advanced Wireless Energy Transceiver: Maximum energy reception rate (RF/t)", + energyWirelessTransceiverAdvancedMaxReceive); + energyWirelessTransceiverBasicMaxExtract = getInteger( + "energy.machines", + "Wireless Energy Transceiver: Maximum energy extraction rate (RF/t)", + energyWirelessTransceiverBasicMaxExtract); + energyWirelessTransceiverAdvancedMaxExtract = getInteger( + "energy.machines", + "Advanced Wireless Energy Transceiver: Maximum energy extraction rate (RF/t)", + energyWirelessTransceiverAdvancedMaxExtract); + energyWirelessTransceiverBasicMaxSend = getInteger( + "energy.machines", + "Wireless Energy Transceiver: Maximum energy sending rate " + "for each linked device (RF/t)", + energyWirelessTransceiverBasicMaxSend); + energyWirelessTransceiverAdvancedMaxSend = getInteger( + "energy.machines", + "Advanced Wireless Energy Transceiver: Maximum energy " + "sending rate for each linked device (RF/t)", + energyWirelessTransceiverAdvancedMaxSend); + wyvernArmorMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernArmorBaseStorage) + / (double) Math.max(wyvernArmorStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; wyvernArmorMaxUpgrades = - getInteger("tweaks.armor", "Wyvern Armor: Maximum amount of upgrades", wyvernArmorMaxUpgrades); - wyvernArmorMaxUpgradePoints = - getInteger("tweaks.armor", "Wyvern Armor: Maximum amount of upgrade points", wyvernArmorMaxUpgradePoints, - wyvernArmorMaxUpgrades, Integer.MAX_VALUE); + getInteger("tweaks.armor", "Wyvern Armor: Maximum amount of upgrades", wyvernArmorMaxUpgrades); + wyvernArmorMaxUpgradePoints = getInteger( + "tweaks.armor", + "Wyvern Armor: Maximum amount of upgrade points", + wyvernArmorMaxUpgradePoints, + wyvernArmorMaxUpgrades, + Integer.MAX_VALUE); wyvernArmorMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernArmorMaxUpgradePoints, wyvernArmorMaxCapacityUpgradePoints), 0); - draconicArmorMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - draconicArmorBaseStorage) / Math.max(draconicArmorStoragePerUpgrade, 1)) * - EnumUpgrade.RF_CAPACITY.pointConversion; + Math.max(Math.min(wyvernArmorMaxUpgradePoints, wyvernArmorMaxCapacityUpgradePoints), 0); + draconicArmorMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - draconicArmorBaseStorage) + / Math.max(draconicArmorStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; draconicArmorMaxUpgrades = - getInteger("tweaks.armor", "Draconic Armor: Maximum amount of upgrades", draconicArmorMaxUpgrades); - draconicArmorMaxUpgradePoints = getInteger("tweaks.armor", "Draconic Armor: Maximum amount of upgrade points", - draconicArmorMaxUpgradePoints, draconicArmorMaxUpgrades, - Integer.MAX_VALUE); + getInteger("tweaks.armor", "Draconic Armor: Maximum amount of upgrades", draconicArmorMaxUpgrades); + draconicArmorMaxUpgradePoints = getInteger( + "tweaks.armor", + "Draconic Armor: Maximum amount of upgrade points", + draconicArmorMaxUpgradePoints, + draconicArmorMaxUpgrades, + Integer.MAX_VALUE); draconicArmorMaxCapacityUpgradePoints = - Math.max(Math.min(draconicArmorMaxUpgradePoints, draconicArmorMaxCapacityUpgradePoints), 0); - wyvernToolsMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernToolsBaseStorage) / - (double) Math.max(wyvernToolsStoragePerUpgrade, 1)) * - EnumUpgrade.RF_CAPACITY.pointConversion; - wyvernToolsMaxUpgrades = - getInteger("tweaks.tools", "Wyvern Tools: Maximum amount of upgrades", wyvernToolsMaxUpgrades, 0, - (wyvernToolsMaxDigAOEUpgradePoints - wyvernToolsMinDigAOEUpgradePoints) * - EnumUpgrade.DIG_AOE.pointConversion + - (wyvernToolsMaxDigSpeedUpgradePoints - wyvernToolsMinDigSpeedUpgradePoints) * - EnumUpgrade.DIG_SPEED.pointConversion + wyvernToolsMaxCapacityUpgradePoints); - wyvernToolsMaxUpgradePoints = - getInteger("tweaks.tools", "Wyvern Tools: Maximum amount of upgrade points", wyvernToolsMaxUpgradePoints, - wyvernToolsMaxUpgrades, Integer.MAX_VALUE); + Math.max(Math.min(draconicArmorMaxUpgradePoints, draconicArmorMaxCapacityUpgradePoints), 0); + wyvernToolsMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernToolsBaseStorage) + / (double) Math.max(wyvernToolsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + wyvernToolsMaxUpgrades = getInteger( + "tweaks.tools", + "Wyvern Tools: Maximum amount of upgrades", + wyvernToolsMaxUpgrades, + 0, + (wyvernToolsMaxDigAOEUpgradePoints - wyvernToolsMinDigAOEUpgradePoints) + * EnumUpgrade.DIG_AOE.pointConversion + + (wyvernToolsMaxDigSpeedUpgradePoints - wyvernToolsMinDigSpeedUpgradePoints) + * EnumUpgrade.DIG_SPEED.pointConversion + + wyvernToolsMaxCapacityUpgradePoints); + wyvernToolsMaxUpgradePoints = getInteger( + "tweaks.tools", + "Wyvern Tools: Maximum amount of upgrade points", + wyvernToolsMaxUpgradePoints, + wyvernToolsMaxUpgrades, + Integer.MAX_VALUE); wyvernToolsMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernToolsMaxUpgradePoints, wyvernToolsMaxCapacityUpgradePoints), 0); - draconicToolsMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - draconicToolsBaseStorage) / - (double) Math.max(draconicToolsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - draconicToolsMaxUpgrades = - getInteger("tweaks.tools", "Draconic Tools: Maximum amount of upgrades", draconicToolsMaxUpgrades, 0, - (draconicToolsMaxDigAOEUpgradePoints - draconicToolsMinDigAOEUpgradePoints) * - EnumUpgrade.DIG_AOE.pointConversion + - (draconicToolsMaxDigSpeedUpgradePoints - draconicToolsMinDigSpeedUpgradePoints) * - EnumUpgrade.DIG_SPEED.pointConversion + - (draconicToolsMaxDigDepthUpgradePoints - draconicToolsMinDigDepthUpgradePoints) * - EnumUpgrade.DIG_DEPTH.pointConversion + draconicToolsMaxCapacityUpgradePoints); - draconicToolsMaxUpgradePoints = getInteger("tweaks.tools", "Draconic Tools: Maximum amount of upgrade points", - draconicToolsMaxUpgradePoints, draconicToolsMaxUpgrades, - Integer.MAX_VALUE); + Math.max(Math.min(wyvernToolsMaxUpgradePoints, wyvernToolsMaxCapacityUpgradePoints), 0); + draconicToolsMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - draconicToolsBaseStorage) + / (double) Math.max(draconicToolsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + draconicToolsMaxUpgrades = getInteger( + "tweaks.tools", + "Draconic Tools: Maximum amount of upgrades", + draconicToolsMaxUpgrades, + 0, + (draconicToolsMaxDigAOEUpgradePoints - draconicToolsMinDigAOEUpgradePoints) + * EnumUpgrade.DIG_AOE.pointConversion + + (draconicToolsMaxDigSpeedUpgradePoints - draconicToolsMinDigSpeedUpgradePoints) + * EnumUpgrade.DIG_SPEED.pointConversion + + (draconicToolsMaxDigDepthUpgradePoints - draconicToolsMinDigDepthUpgradePoints) + * EnumUpgrade.DIG_DEPTH.pointConversion + + draconicToolsMaxCapacityUpgradePoints); + draconicToolsMaxUpgradePoints = getInteger( + "tweaks.tools", + "Draconic Tools: Maximum amount of upgrade points", + draconicToolsMaxUpgradePoints, + draconicToolsMaxUpgrades, + Integer.MAX_VALUE); draconicToolsMaxCapacityUpgradePoints = - Math.max(Math.min(draconicToolsMaxUpgradePoints, draconicToolsMaxCapacityUpgradePoints), 0); - wyvernWeaponsMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) / - (double) Math.max(wyvernWeaponsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - wyvernWeaponsMaxUpgrades = - getInteger("tweaks.weapons", "Wyvern Weapons: Maximum amount of upgrades", wyvernWeaponsMaxUpgrades, 0, - (wyvernWeaponsMaxAttackAOEUpgradePoints - wyvernWeaponsMinAttackAOEUpgradePoints) * - EnumUpgrade.ATTACK_AOE.pointConversion + - (wyvernWeaponsMaxAttackDamageUpgradePoints - wyvernWeaponsMinAttackDamageUpgradePoints) * - EnumUpgrade.ATTACK_DAMAGE.pointConversion + wyvernWeaponsMaxCapacityUpgradePoints); - wyvernWeaponsMaxUpgradePoints = getInteger("tweaks.weapons", "Wyvern Weapons: Maximum amount of upgrade points", - wyvernWeaponsMaxUpgradePoints, wyvernWeaponsMaxUpgrades, - Integer.MAX_VALUE); + Math.max(Math.min(draconicToolsMaxUpgradePoints, draconicToolsMaxCapacityUpgradePoints), 0); + wyvernWeaponsMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) + / (double) Math.max(wyvernWeaponsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + wyvernWeaponsMaxUpgrades = getInteger( + "tweaks.weapons", + "Wyvern Weapons: Maximum amount of upgrades", + wyvernWeaponsMaxUpgrades, + 0, + (wyvernWeaponsMaxAttackAOEUpgradePoints - wyvernWeaponsMinAttackAOEUpgradePoints) + * EnumUpgrade.ATTACK_AOE.pointConversion + + (wyvernWeaponsMaxAttackDamageUpgradePoints - wyvernWeaponsMinAttackDamageUpgradePoints) + * EnumUpgrade.ATTACK_DAMAGE.pointConversion + + wyvernWeaponsMaxCapacityUpgradePoints); + wyvernWeaponsMaxUpgradePoints = getInteger( + "tweaks.weapons", + "Wyvern Weapons: Maximum amount of upgrade points", + wyvernWeaponsMaxUpgradePoints, + wyvernWeaponsMaxUpgrades, + Integer.MAX_VALUE); wyvernWeaponsMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernWeaponsMaxUpgradePoints, wyvernWeaponsMaxCapacityUpgradePoints), 0); - draconicWeaponsMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) / - (double) Math.max(draconicWeaponsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - draconicWeaponsMaxUpgrades = - getInteger("tweaks.weapons", "Draconic Weapons: Maximum amount of upgrades", draconicWeaponsMaxUpgrades, 0, - (draconicWeaponsMaxAttackAOEUpgradePoints - draconicWeaponsMinAttackAOEUpgradePoints) * - EnumUpgrade.ATTACK_AOE.pointConversion + - (draconicWeaponsMaxAttackDamageUpgradePoints - draconicWeaponsMinAttackDamageUpgradePoints) * - EnumUpgrade.ARROW_DAMAGE.pointConversion + draconicWeaponsMaxCapacityUpgradePoints); - draconicWeaponsMaxUpgradePoints = - getInteger("tweaks.weapons", "Draconic Weapons: Maximum amount of upgrade points", - draconicWeaponsMaxUpgradePoints, draconicWeaponsMaxUpgrades, Integer.MAX_VALUE); + Math.max(Math.min(wyvernWeaponsMaxUpgradePoints, wyvernWeaponsMaxCapacityUpgradePoints), 0); draconicWeaponsMaxCapacityUpgradePoints = - Math.max(Math.min(draconicWeaponsMaxUpgradePoints, draconicWeaponsMaxCapacityUpgradePoints), 0); - wyvernBowMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) / - (double) Math.max(wyvernWeaponsStoragePerUpgrade, 1)) * - EnumUpgrade.RF_CAPACITY.pointConversion; - wyvernBowMaxUpgrades = - getInteger("tweaks.weapons", "Wyvern Bow: Maximum amount of upgrades", wyvernBowMaxUpgrades, 0, - (wyvernBowMaxDrawSpeedUpgradePoints - wyvernBowMinDrawSpeedUpgradePoints) * - EnumUpgrade.DRAW_SPEED.pointConversion + - (wyvernBowMaxArrowSpeedUpgradePoints - wyvernBowMinArrowSpeedUpgradePoints) * - EnumUpgrade.ARROW_SPEED.pointConversion + - (wyvernBowMaxArrowDamageUpgradePoints - wyvernBowMinArrowDamageUpgradePoints) * - EnumUpgrade.ARROW_DAMAGE.pointConversion + wyvernBowMaxCapacityUpgradePoints); - wyvernBowMaxUpgradePoints = - getInteger("tweaks.weapons", "Wyvern Bow: Maximum amount of upgrade points", wyvernBowMaxUpgradePoints, - wyvernBowMaxUpgrades, Integer.MAX_VALUE); + (int) Math.floor((double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) + / (double) Math.max(draconicWeaponsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + draconicWeaponsMaxUpgrades = getInteger( + "tweaks.weapons", + "Draconic Weapons: Maximum amount of upgrades", + draconicWeaponsMaxUpgrades, + 0, + (draconicWeaponsMaxAttackAOEUpgradePoints - draconicWeaponsMinAttackAOEUpgradePoints) + * EnumUpgrade.ATTACK_AOE.pointConversion + + (draconicWeaponsMaxAttackDamageUpgradePoints - draconicWeaponsMinAttackDamageUpgradePoints) + * EnumUpgrade.ARROW_DAMAGE.pointConversion + + draconicWeaponsMaxCapacityUpgradePoints); + draconicWeaponsMaxUpgradePoints = getInteger( + "tweaks.weapons", + "Draconic Weapons: Maximum amount of upgrade points", + draconicWeaponsMaxUpgradePoints, + draconicWeaponsMaxUpgrades, + Integer.MAX_VALUE); + draconicWeaponsMaxCapacityUpgradePoints = + Math.max(Math.min(draconicWeaponsMaxUpgradePoints, draconicWeaponsMaxCapacityUpgradePoints), 0); + wyvernBowMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) + / (double) Math.max(wyvernWeaponsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + wyvernBowMaxUpgrades = getInteger( + "tweaks.weapons", + "Wyvern Bow: Maximum amount of upgrades", + wyvernBowMaxUpgrades, + 0, + (wyvernBowMaxDrawSpeedUpgradePoints - wyvernBowMinDrawSpeedUpgradePoints) + * EnumUpgrade.DRAW_SPEED.pointConversion + + (wyvernBowMaxArrowSpeedUpgradePoints - wyvernBowMinArrowSpeedUpgradePoints) + * EnumUpgrade.ARROW_SPEED.pointConversion + + (wyvernBowMaxArrowDamageUpgradePoints - wyvernBowMinArrowDamageUpgradePoints) + * EnumUpgrade.ARROW_DAMAGE.pointConversion + + wyvernBowMaxCapacityUpgradePoints); + wyvernBowMaxUpgradePoints = getInteger( + "tweaks.weapons", + "Wyvern Bow: Maximum amount of upgrade points", + wyvernBowMaxUpgradePoints, + wyvernBowMaxUpgrades, + Integer.MAX_VALUE); wyvernBowMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernBowMaxUpgradePoints, wyvernBowMaxCapacityUpgradePoints), 0); - draconicBowMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) / - (double) Math.max(draconicWeaponsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - draconicBowMaxUpgrades = - getInteger("tweaks.weapons", "Draconic Bow: Maximum amount of upgrades", draconicBowMaxUpgrades, 0, - (draconicBowMaxDrawSpeedUpgradePoints - draconicBowMinDrawSpeedUpgradePoints) * - EnumUpgrade.DRAW_SPEED.pointConversion + - (draconicBowMaxArrowSpeedUpgradePoints - draconicBowMinArrowSpeedUpgradePoints) * - EnumUpgrade.ARROW_SPEED.pointConversion + - (draconicBowMaxArrowDamageUpgradePoints - draconicBowMinArrowDamageUpgradePoints) * - EnumUpgrade.ARROW_DAMAGE.pointConversion + draconicBowMaxCapacityUpgradePoints); - draconicBowMaxUpgradePoints = - getInteger("tweaks.weapons", "Draconic Bow: Maximum amount of upgrade points", draconicBowMaxUpgradePoints, - draconicBowMaxUpgrades, Integer.MAX_VALUE); + Math.max(Math.min(wyvernBowMaxUpgradePoints, wyvernBowMaxCapacityUpgradePoints), 0); + draconicBowMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) + / (double) Math.max(draconicWeaponsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + draconicBowMaxUpgrades = getInteger( + "tweaks.weapons", + "Draconic Bow: Maximum amount of upgrades", + draconicBowMaxUpgrades, + 0, + (draconicBowMaxDrawSpeedUpgradePoints - draconicBowMinDrawSpeedUpgradePoints) + * EnumUpgrade.DRAW_SPEED.pointConversion + + (draconicBowMaxArrowSpeedUpgradePoints - draconicBowMinArrowSpeedUpgradePoints) + * EnumUpgrade.ARROW_SPEED.pointConversion + + (draconicBowMaxArrowDamageUpgradePoints - draconicBowMinArrowDamageUpgradePoints) + * EnumUpgrade.ARROW_DAMAGE.pointConversion + + draconicBowMaxCapacityUpgradePoints); + draconicBowMaxUpgradePoints = getInteger( + "tweaks.weapons", + "Draconic Bow: Maximum amount of upgrade points", + draconicBowMaxUpgradePoints, + draconicBowMaxUpgrades, + Integer.MAX_VALUE); draconicBowMaxCapacityUpgradePoints = - Math.max(Math.min(draconicBowMaxUpgradePoints, draconicBowMaxCapacityUpgradePoints), 0); - draconicStaffMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - draconicToolsBaseStorage * 2 - draconicWeaponsBaseStorage) / - (double) Math.max(draconicToolsStoragePerUpgrade + draconicWeaponsStoragePerUpgrade, 1)) * - EnumUpgrade.RF_CAPACITY.pointConversion; + Math.max(Math.min(draconicBowMaxUpgradePoints, draconicBowMaxCapacityUpgradePoints), 0); + draconicStaffMaxCapacityUpgradePoints = (int) Math.floor((double) + (Integer.MAX_VALUE - draconicToolsBaseStorage * 2 - draconicWeaponsBaseStorage) + / (double) Math.max(draconicToolsStoragePerUpgrade + draconicWeaponsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; draconicStaffMaxUpgrades = draconicToolsMaxUpgrades + draconicWeaponsMaxUpgrades; draconicStaffMaxUpgradePoints = draconicToolsMaxUpgradePoints + draconicWeaponsMaxUpgradePoints; draconicStaffMaxCapacityUpgradePoints = - Math.max(Math.min(draconicStaffMaxUpgradePoints, draconicStaffMaxCapacityUpgradePoints), 0); - wyvernCapacitorMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - wyvernCapacitorBaseStorage) / - (double) Math.max(wyvernCapacitorStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - wyvernCapacitorMaxUpgrades = - getInteger("tweaks.tools", "Wyvern Flux Capacitor: Maximum amount of upgrades", wyvernCapacitorMaxUpgrades, - 0, wyvernCapacitorMaxCapacityUpgradePoints); - wyvernCapacitorMaxUpgradePoints = - getInteger("tweaks.tools", "Wyvern Flux Capacitor: Maximum amount of upgrade points", - wyvernCapacitorMaxUpgradePoints, wyvernCapacitorMaxUpgrades, Integer.MAX_VALUE); + Math.max(Math.min(draconicStaffMaxUpgradePoints, draconicStaffMaxCapacityUpgradePoints), 0); wyvernCapacitorMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernCapacitorMaxUpgradePoints, wyvernCapacitorMaxCapacityUpgradePoints), 0); - draconicCapacitorMaxCapacityUpgradePoints = (int) Math.floor( - (double) (Integer.MAX_VALUE - draconicCapacitorBaseStorage) / - (double) Math.max(draconicCapacitorStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - draconicCapacitorMaxUpgrades = getInteger("tweaks.tools", "Draconic Flux Capacitor: Maximum amount of upgrades", - draconicCapacitorMaxUpgrades, 0, - draconicCapacitorMaxCapacityUpgradePoints); - draconicCapacitorMaxUpgradePoints = - getInteger("tweaks.tools", "Draconic Flux Capacitor: Maximum amount of upgrade points", - draconicCapacitorMaxUpgradePoints, draconicCapacitorMaxUpgrades, Integer.MAX_VALUE); + (int) Math.floor((double) (Integer.MAX_VALUE - wyvernCapacitorBaseStorage) + / (double) Math.max(wyvernCapacitorStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + wyvernCapacitorMaxUpgrades = getInteger( + "tweaks.tools", + "Wyvern Flux Capacitor: Maximum amount of upgrades", + wyvernCapacitorMaxUpgrades, + 0, + wyvernCapacitorMaxCapacityUpgradePoints); + wyvernCapacitorMaxUpgradePoints = getInteger( + "tweaks.tools", + "Wyvern Flux Capacitor: Maximum amount of upgrade points", + wyvernCapacitorMaxUpgradePoints, + wyvernCapacitorMaxUpgrades, + Integer.MAX_VALUE); + wyvernCapacitorMaxCapacityUpgradePoints = + Math.max(Math.min(wyvernCapacitorMaxUpgradePoints, wyvernCapacitorMaxCapacityUpgradePoints), 0); draconicCapacitorMaxCapacityUpgradePoints = - Math.max(Math.min(draconicCapacitorMaxUpgradePoints, draconicCapacitorMaxCapacityUpgradePoints), 0); + (int) Math.floor((double) (Integer.MAX_VALUE - draconicCapacitorBaseStorage) + / (double) Math.max(draconicCapacitorStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; + draconicCapacitorMaxUpgrades = getInteger( + "tweaks.tools", + "Draconic Flux Capacitor: Maximum amount of upgrades", + draconicCapacitorMaxUpgrades, + 0, + draconicCapacitorMaxCapacityUpgradePoints); + draconicCapacitorMaxUpgradePoints = getInteger( + "tweaks.tools", + "Draconic Flux Capacitor: Maximum amount of upgrade points", + draconicCapacitorMaxUpgradePoints, + draconicCapacitorMaxUpgrades, + Integer.MAX_VALUE); + draconicCapacitorMaxCapacityUpgradePoints = + Math.max(Math.min(draconicCapacitorMaxUpgradePoints, draconicCapacitorMaxCapacityUpgradePoints), 0); grinderShouldUseLooting = - getBoolean("tweaks.machines", "Mob Grinder: Use Looting enchantment", grinderShouldUseLooting); - energyDeviceBasicLinkingRange = - getInteger("tweaks.machines", "Energy Device (Relay/Transceiver): Linking range", - energyDeviceBasicLinkingRange, 8, 32); - energyDeviceAdvancedLinkingRange = - getInteger("tweaks.machines", "Advanced Energy Device (Relay/Transceiver): Linking range", - energyDeviceAdvancedLinkingRange, 16, 64); - if (config.hasChanged()) - { + getBoolean("tweaks.machines", "Mob Grinder: Use Looting enchantment", grinderShouldUseLooting); + energyDeviceBasicLinkingRange = getInteger( + "tweaks.machines", + "Energy Device (Relay/Transceiver): Linking range", + energyDeviceBasicLinkingRange, + 8, + 32); + energyDeviceAdvancedLinkingRange = getInteger( + "tweaks.machines", + "Advanced Energy Device (Relay/Transceiver): Linking range", + energyDeviceAdvancedLinkingRange, + 16, + 64); + if (config.hasChanged()) { config.save(); } } // This method should be loaded after all mods add blocks => after pre-init - public static void finishLoading() - { - if (config == null) - { + public static void finishLoading() { + if (config == null) { return; } - energyStorageStructureBlock = - getBlock("tweaks.machines", "Multiblock Energy Storage: Main block of structure", Blocks.redstone_block, - "WARNING! Changing of this value will replace blocks of all existing Energy Storage Multiblocks!"); - energyStorageStructureBlockMetadata = - getInteger("tweaks.machines", "Multiblock Energy Storage: Metadata of main block of structure", - energyStorageStructureBlockMetadata, - "WARNING! Changing of this value will replace blocks of all existing Energy Storage " + - "Multiblocks!"); - energyStorageStructureOuterBlock = - getBlock("tweaks.machines", "Multiblock Energy Storage: Outer block of structure", ModBlocks.draconiumBlock, - "WARNING! Changing of this value will replace blocks of all existing Energy Storage Multiblocks!"); - energyStorageStructureOuterBlockMetadata = - getInteger("tweaks.machines", "Multiblock Energy Storage: Metadata of outer block of structure", - energyStorageStructureBlockMetadata, - "WARNING! Changing of this value will replace blocks of all existing Energy Storage " + - "Multiblocks!"); - if (config.hasChanged()) - { + energyStorageStructureBlock = getBlock( + "tweaks.machines", + "Multiblock Energy Storage: Main block of structure", + Blocks.redstone_block, + "WARNING! Changing of this value will replace blocks of all existing Energy Storage Multiblocks!"); + energyStorageStructureBlockMetadata = getInteger( + "tweaks.machines", + "Multiblock Energy Storage: Metadata of main block of structure", + energyStorageStructureBlockMetadata, + "WARNING! Changing of this value will replace blocks of all existing Energy Storage " + "Multiblocks!"); + energyStorageStructureOuterBlock = getBlock( + "tweaks.machines", + "Multiblock Energy Storage: Outer block of structure", + ModBlocks.draconiumBlock, + "WARNING! Changing of this value will replace blocks of all existing Energy Storage Multiblocks!"); + energyStorageStructureOuterBlockMetadata = getInteger( + "tweaks.machines", + "Multiblock Energy Storage: Metadata of outer block of structure", + energyStorageStructureBlockMetadata, + "WARNING! Changing of this value will replace blocks of all existing Energy Storage " + "Multiblocks!"); + if (config.hasChanged()) { config.save(); } } - private static Block getBlock(String category, String propertyName, Block defaultValue, String comment) - { + private static Block getBlock(String category, String propertyName, Block defaultValue, String comment) { String defaultName = Block.blockRegistry.getNameForObject(defaultValue); Property property = config.get(category, propertyName, defaultName, comment); String value = property.getString(); - if (value == null || !value.contains(":")) - { + if (value == null || !value.contains(":")) { property.set(defaultName); return defaultValue; } String modId = value.substring(0, value.indexOf(":")); String name = value.substring(value.indexOf(":") + 1); Block block = GameRegistry.findBlock(modId, name); - if (block == null || block instanceof ITileEntityProvider) - { + if (block == null || block instanceof ITileEntityProvider) { property.set(defaultName); return defaultValue; } return block; } - private static boolean getBoolean(String category, String propertyName, boolean defaultValue) - { + private static boolean getBoolean(String category, String propertyName, boolean defaultValue) { return config.get(category, propertyName, defaultValue).getBoolean(defaultValue); } - private static int getInteger(String categoty, String propertyName, int defaultValue) - { + private static int getInteger(String categoty, String propertyName, int defaultValue) { return config.get(categoty, propertyName, defaultValue).getInt(defaultValue); } - private static int getInteger(String categoty, String propertyName, int defaultValue, String comment) - { + private static int getInteger(String categoty, String propertyName, int defaultValue, String comment) { return config.get(categoty, propertyName, defaultValue, comment).getInt(defaultValue); } - private static int getInteger(String category, String propertyName, int defaultValue, int minValue, int maxValue) - { + private static int getInteger(String category, String propertyName, int defaultValue, int minValue, int maxValue) { Property property = config.get(category, propertyName, defaultValue, "", minValue, maxValue); int value = property.getInt(defaultValue); - if (value < minValue) - { + if (value < minValue) { property.set(minValue); return minValue; } - if (value > maxValue) - { + if (value > maxValue) { property.set(maxValue); return maxValue; } return value; } - private static long getLong(String category, String propertyName, long defaultValue) - { + private static long getLong(String category, String propertyName, long defaultValue) { return (long) config.get(category, propertyName, (double) defaultValue, "", 0D, (double) Long.MAX_VALUE) - .getDouble((double) defaultValue); + .getDouble((double) defaultValue); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java index 17883877..d073cc25 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java @@ -1,19 +1,18 @@ package com.brandon3055.draconicevolution.common.handler; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import net.minecraftforge.common.config.Configuration; - import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import net.minecraftforge.common.config.Configuration; public class ConfigHandler { public static Configuration config; - //GENERAL + // GENERAL public static int teleporterUsesPerPearl; public static int soulDropChance; public static int passiveSoulDropChance; @@ -52,29 +51,29 @@ public class ConfigHandler { public static Map itemDislocatorBlacklistMap = new HashMap(); public static int magnetStackLimit; - //spawner + // spawner public static String[] spawnerList; public static boolean spawnerListType; - //long range dislocator + // long range dislocator public static int dislocator_Min_Range; public static int dislocator_Max_Range; public static int admin_dislocator_Min_Range; public static int admin_dislocator_Max_Range; public static int admin_dislocator_Detect_Range; - //Potion IDs + // Potion IDs - //Enchantments + // Enchantments public static int reaperEnchantID; - //Reactor + // Reactor public static boolean enableReactorBigBoom; public static double reactorOutputMultiplier; public static double reactorFuelUsageMultiplier; - - private static String[] defaultSpawnerList = new String[]{"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"}; + private static String[] defaultSpawnerList = + new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"}; public static void init(File confFile) { if (config == null) { @@ -86,67 +85,272 @@ public class ConfigHandler { public static void syncConfig() { - try { - //General -// disableSunDial = config.get(Configuration.CATEGORY_GENERAL, "Disable Sun Dial", 0, "Disable Sun Dial 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0); -// disableXrayBlock = config.get(Configuration.CATEGORY_GENERAL, "Disable Xray Block", 0, "Disable Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0); - teleporterUsesPerPearl = config.get(Configuration.CATEGORY_GENERAL, "Teleporter Uses PerPearl", 1, "Charm of Dislocation uses per Ender pearl").getInt(1); - bowBlockDamage = config.get(Configuration.CATEGORY_GENERAL, "Bow Block Damage", true, "Dose Draconic bow explosion damage blocks").getBoolean(true); - showUnlocalizedNames = config.get(Configuration.CATEGORY_GENERAL, "Show Unlocalized Names", false, "If set to true the unlocalized name of every block and item will be displayed in its tool tip").getBoolean(false); - soulDropChance = config.get(Configuration.CATEGORY_GENERAL, "soulDropChance", 1000, "Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(1000); - passiveSoulDropChance = config.get(Configuration.CATEGORY_GENERAL, "passiveSoulDropChance", 800, "Passive (Animals) Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(800); - cometRarity = config.get(Configuration.CATEGORY_GENERAL, "Ender Comet Rarity", 10000, "Ender Comet has a 1 in {this number} chance to spawn in each chunk").getInt(10000); - generateEnderComets = config.get(Configuration.CATEGORY_GENERAL, "Generate Ender Comets", true, "Should Ender comets be generated").getBoolean(true); - generateChaosIslands = config.get(Configuration.CATEGORY_GENERAL, "Generate Chaos Islands", true, "Should Chaos Islands be generated").getBoolean(true); - pigmenBloodRage = config.get(Configuration.CATEGORY_GENERAL, "Pigmen Blood Rage", true, "Is Pigmen blood rage active").getBoolean(true); - disableLore = config.get(Configuration.CATEGORY_GENERAL, "Disable Item Lore", false, "Set to true to disable all item lore").getBoolean(false); - invertDPDSB = config.get(Configuration.CATEGORY_GENERAL, "InvertDPDSB", false, "Invert Dislocator Pedestal display name shift behavior").getBoolean(false); - //First is tool hud second is armor hud - //x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText, hudEnabled, shieldEnabled - hudSettings = config.get("Gui Stuff", "HUD Settings", new int[]{996, 825, 69, 907, 90, 100, 3, 0, 1, 1, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).getIntList(); - disableOreSpawnEnd = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (End)", false, "Set to true to prevent draconium ore from spawning in the end").getBoolean(false); - disableOreSpawnNether = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Nether)", false, "Set to true to prevent draconium ore from spawning in the nether").getBoolean(false); - disableOreSpawnOverworld = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Overworld)", false, "Set to true to prevent draconium ore from spawning in the overworld").getBoolean(false); - enableVersionChecker = config.get(Configuration.CATEGORY_GENERAL, "Enable version checker", true, "Set to false to disable the version checker").getBoolean(true); - dragonBreaksBlocks = config.get(Configuration.CATEGORY_GENERAL, "Can dragon break blocks", true, "Set to false to disable the DE dragons ability to break blocks (dose not effect vanilla dragon)").getBoolean(true); - dragonEggSpawnLocation = config.get(Configuration.CATEGORY_GENERAL, "Dragon egg spawn location", new int[]{0, 0, 0}, "Sets the exact location to spawn the dragon egg and disables the portal spawn (dose not effect vanilla dragon)").getIntList(); - oreGenDimentionBlacklist = config.get(Configuration.CATEGORY_GENERAL, "Ore gen dimension blacklist", new int[0], "Add the id's of dimensions you do not want draconium ore to spawn in").getIntList(); - disabledBlocksItems = config.getStringList("Disabled Blocks & Items", Configuration.CATEGORY_GENERAL, new String[0], "add the unlocalized name of a block or item to this list to disable it"); - maxPlayerSpeed = config.get(Configuration.CATEGORY_GENERAL, "Player speed cap", 10D, "Limits the max speed of players. Recommend between 0.5 - 1.0 for servers").getDouble(10D); - speedDimBlackList = config.get(Configuration.CATEGORY_GENERAL, "Speed limit Dim black lack list", new int[]{1}, "A list of dimensions the speed limit will not effect (speed limit is not so really required in the end)").getIntList(); - speedLimitops = config.get(Configuration.CATEGORY_GENERAL, "Speed limit effects ops", false, "Dose the speed limit effect ops").getBoolean(false); - rapidlyDespawnMinedItems = config.get(Configuration.CATEGORY_GENERAL, "Rapidly despawn aoe mined items", false, "If true items dropped by a tool in aoe mode will despawn after 5 seconds").getBoolean(false); - useOldArmorModel = config.get(Configuration.CATEGORY_GENERAL, "Use old armor model", false, "If true the armor will use the original vanilla 2D model instead of the new 3D models").getBoolean(false); - sumonRitualAccelerated = config.get(Configuration.CATEGORY_GENERAL, "Fast Summon Ritual", false, "If true the resurrection ritual will be a lot faster").getBoolean(false); - useOldD2DToolTextures = config.get(Configuration.CATEGORY_GENERAL, "Use old 2D tool textures", false, "If true the 3D tool models will be replaced with standard 2D textures").getBoolean(false); - chaosIslandSeparation = config.get(Configuration.CATEGORY_GENERAL, "Chaos Island Separation", 10000, "This sets how far apart the chaos islands will spawn. The islands spawn in a grid pattern.").getInt(10000); - useOriginal3DArmorModel = config.get(Configuration.CATEGORY_GENERAL, "Use the original 3D armor models", false, "If true the original 3D armor models created by Skeletonpunk will be used instead of the current ones").getBoolean(false); - disableGuardianCrystalRespawn = config.get(Configuration.CATEGORY_GENERAL, "Disable Guardian Crystal Respawn", false, "(Wuss mode) Setting this to true will disable the chaos guardians ability to respawn healing crystals. Under certain circumstances such as on a Spigot server where entity render distance is significantly lower this may be required.").getBoolean(false); - itemDislocatorBlacklist = config.getStringList("Item Dislocator Blacklist", Configuration.CATEGORY_GENERAL, new String[]{"appliedenergistics2:item.ItemCrystalSeed"}, "A list of items of items that should be ignored by the item dislocator. Use the items registry name e.g. minecraft:apple you can also add a meta value like so minecraft:wool|4"); - disableLog = config.get(Configuration.CATEGORY_GENERAL, "Disable Log", false, "If you are having issued with console spam that you cant fix setting this to true will disable all log output from Draconic Evolution (Not recommended)").getBoolean(false); - enableFlight = config.get(Configuration.CATEGORY_GENERAL, "Enable Flight", true, "Set this to false to disable flight given by draconic armor.").getBoolean(true); - magnetStackLimit = config.get(Configuration.CATEGORY_GENERAL, "Magnet Stack Limit", 30, "Limit how much stacks might be attracted at the same time, high values can cause both server and client lag").getInt(); + // General + // disableSunDial = config.get(Configuration.CATEGORY_GENERAL, "Disable Sun Dial", 0, "Disable Sun Dial + // 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0); + // disableXrayBlock = config.get(Configuration.CATEGORY_GENERAL, "Disable Xray Block", 0, "Disable + // Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0); + teleporterUsesPerPearl = config.get( + Configuration.CATEGORY_GENERAL, + "Teleporter Uses PerPearl", + 1, + "Charm of Dislocation uses per Ender pearl") + .getInt(1); + bowBlockDamage = config.get( + Configuration.CATEGORY_GENERAL, + "Bow Block Damage", + true, + "Dose Draconic bow explosion damage blocks") + .getBoolean(true); + showUnlocalizedNames = config.get( + Configuration.CATEGORY_GENERAL, + "Show Unlocalized Names", + false, + "If set to true the unlocalized name of every block and item will be displayed in its tool tip") + .getBoolean(false); + soulDropChance = config.get( + Configuration.CATEGORY_GENERAL, + "soulDropChance", + 1000, + "Mobs have a 1 in this number chance to drop a soul", + 1, + Integer.MAX_VALUE) + .getInt(1000); + passiveSoulDropChance = config.get( + Configuration.CATEGORY_GENERAL, + "passiveSoulDropChance", + 800, + "Passive (Animals) Mobs have a 1 in this number chance to drop a soul", + 1, + Integer.MAX_VALUE) + .getInt(800); + cometRarity = config.get( + Configuration.CATEGORY_GENERAL, + "Ender Comet Rarity", + 10000, + "Ender Comet has a 1 in {this number} chance to spawn in each chunk") + .getInt(10000); + generateEnderComets = config.get( + Configuration.CATEGORY_GENERAL, + "Generate Ender Comets", + true, + "Should Ender comets be generated") + .getBoolean(true); + generateChaosIslands = config.get( + Configuration.CATEGORY_GENERAL, + "Generate Chaos Islands", + true, + "Should Chaos Islands be generated") + .getBoolean(true); + pigmenBloodRage = config.get( + Configuration.CATEGORY_GENERAL, "Pigmen Blood Rage", true, "Is Pigmen blood rage active") + .getBoolean(true); + disableLore = config.get( + Configuration.CATEGORY_GENERAL, + "Disable Item Lore", + false, + "Set to true to disable all item lore") + .getBoolean(false); + invertDPDSB = config.get( + Configuration.CATEGORY_GENERAL, + "InvertDPDSB", + false, + "Invert Dislocator Pedestal display name shift behavior") + .getBoolean(false); + // First is tool hud second is armor hud + // x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText, hudEnabled, shieldEnabled + hudSettings = config.get( + "Gui Stuff", + "HUD Settings", + new int[] {996, 825, 69, 907, 90, 100, 3, 0, 1, 1, 1, 1}, + "Used to store the position of the armor ant tool HUD's. This should not be modified", + Integer.MIN_VALUE, + Integer.MAX_VALUE, + true, + 12) + .getIntList(); + disableOreSpawnEnd = config.get( + Configuration.CATEGORY_GENERAL, + "Disable Ore Spawn (End)", + false, + "Set to true to prevent draconium ore from spawning in the end") + .getBoolean(false); + disableOreSpawnNether = config.get( + Configuration.CATEGORY_GENERAL, + "Disable Ore Spawn (Nether)", + false, + "Set to true to prevent draconium ore from spawning in the nether") + .getBoolean(false); + disableOreSpawnOverworld = config.get( + Configuration.CATEGORY_GENERAL, + "Disable Ore Spawn (Overworld)", + false, + "Set to true to prevent draconium ore from spawning in the overworld") + .getBoolean(false); + enableVersionChecker = config.get( + Configuration.CATEGORY_GENERAL, + "Enable version checker", + true, + "Set to false to disable the version checker") + .getBoolean(true); + dragonBreaksBlocks = config.get( + Configuration.CATEGORY_GENERAL, + "Can dragon break blocks", + true, + "Set to false to disable the DE dragons ability to break blocks (dose not effect vanilla dragon)") + .getBoolean(true); + dragonEggSpawnLocation = config.get( + Configuration.CATEGORY_GENERAL, + "Dragon egg spawn location", + new int[] {0, 0, 0}, + "Sets the exact location to spawn the dragon egg and disables the portal spawn (dose not effect vanilla dragon)") + .getIntList(); + oreGenDimentionBlacklist = config.get( + Configuration.CATEGORY_GENERAL, + "Ore gen dimension blacklist", + new int[0], + "Add the id's of dimensions you do not want draconium ore to spawn in") + .getIntList(); + disabledBlocksItems = config.getStringList( + "Disabled Blocks & Items", + Configuration.CATEGORY_GENERAL, + new String[0], + "add the unlocalized name of a block or item to this list to disable it"); + maxPlayerSpeed = config.get( + Configuration.CATEGORY_GENERAL, + "Player speed cap", + 10D, + "Limits the max speed of players. Recommend between 0.5 - 1.0 for servers") + .getDouble(10D); + speedDimBlackList = config.get( + Configuration.CATEGORY_GENERAL, + "Speed limit Dim black lack list", + new int[] {1}, + "A list of dimensions the speed limit will not effect (speed limit is not so really required in the end)") + .getIntList(); + speedLimitops = config.get( + Configuration.CATEGORY_GENERAL, + "Speed limit effects ops", + false, + "Dose the speed limit effect ops") + .getBoolean(false); + rapidlyDespawnMinedItems = config.get( + Configuration.CATEGORY_GENERAL, + "Rapidly despawn aoe mined items", + false, + "If true items dropped by a tool in aoe mode will despawn after 5 seconds") + .getBoolean(false); + useOldArmorModel = config.get( + Configuration.CATEGORY_GENERAL, + "Use old armor model", + false, + "If true the armor will use the original vanilla 2D model instead of the new 3D models") + .getBoolean(false); + sumonRitualAccelerated = config.get( + Configuration.CATEGORY_GENERAL, + "Fast Summon Ritual", + false, + "If true the resurrection ritual will be a lot faster") + .getBoolean(false); + useOldD2DToolTextures = config.get( + Configuration.CATEGORY_GENERAL, + "Use old 2D tool textures", + false, + "If true the 3D tool models will be replaced with standard 2D textures") + .getBoolean(false); + chaosIslandSeparation = config.get( + Configuration.CATEGORY_GENERAL, + "Chaos Island Separation", + 10000, + "This sets how far apart the chaos islands will spawn. The islands spawn in a grid pattern.") + .getInt(10000); + useOriginal3DArmorModel = config.get( + Configuration.CATEGORY_GENERAL, + "Use the original 3D armor models", + false, + "If true the original 3D armor models created by Skeletonpunk will be used instead of the current ones") + .getBoolean(false); + disableGuardianCrystalRespawn = config.get( + Configuration.CATEGORY_GENERAL, + "Disable Guardian Crystal Respawn", + false, + "(Wuss mode) Setting this to true will disable the chaos guardians ability to respawn healing crystals. Under certain circumstances such as on a Spigot server where entity render distance is significantly lower this may be required.") + .getBoolean(false); + itemDislocatorBlacklist = config.getStringList( + "Item Dislocator Blacklist", + Configuration.CATEGORY_GENERAL, + new String[] {"appliedenergistics2:item.ItemCrystalSeed"}, + "A list of items of items that should be ignored by the item dislocator. Use the items registry name e.g. minecraft:apple you can also add a meta value like so minecraft:wool|4"); + disableLog = config.get( + Configuration.CATEGORY_GENERAL, + "Disable Log", + false, + "If you are having issued with console spam that you cant fix setting this to true will disable all log output from Draconic Evolution (Not recommended)") + .getBoolean(false); + enableFlight = config.get( + Configuration.CATEGORY_GENERAL, + "Enable Flight", + true, + "Set this to false to disable flight given by draconic armor.") + .getBoolean(true); + magnetStackLimit = config.get( + Configuration.CATEGORY_GENERAL, + "Magnet Stack Limit", + 30, + "Limit how much stacks might be attracted at the same time, high values can cause both server and client lag") + .getInt(); - //Spawner - spawnerListType = config.get("spawner", "listType", false, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)").getBoolean(false); - spawnerList = config.getStringList("Spawn List", "spawner", defaultSpawnerList, "List of names that will be ether accepted or rejected by the spawner depending on the list type"); + // Spawner + spawnerListType = config.get( + "spawner", + "listType", + false, + "Sets weather the spawner list is a white list or a black list (true = white list false = black list)") + .getBoolean(false); + spawnerList = config.getStringList( + "Spawn List", + "spawner", + defaultSpawnerList, + "List of names that will be ether accepted or rejected by the spawner depending on the list type"); - //LRD - admin_dislocator_Min_Range = config.get("long range dislocator", "Dislocator Min Range", 1000).getInt(1000); - admin_dislocator_Max_Range = config.get("long range dislocator", "Dislocator Max Range", 10000).getInt(10000); - admin_dislocator_Detect_Range = config.get("long range dislocator", "Admin Dislocator Detect Range", 5).getInt(5); + // LRD + admin_dislocator_Min_Range = config.get("long range dislocator", "Dislocator Min Range", 1000) + .getInt(1000); + admin_dislocator_Max_Range = config.get("long range dislocator", "Dislocator Max Range", 10000) + .getInt(10000); + admin_dislocator_Detect_Range = config.get("long range dislocator", "Admin Dislocator Detect Range", 5) + .getInt(5); - //Potions -// potionFlightID = config.get("magic id's", "potionFlightID", 50).getInt(50); + // Potions + // potionFlightID = config.get("magic id's", "potionFlightID", 50).getInt(50); - //Enchantments + // Enchantments reaperEnchantID = config.get("magicId's", "Reaper Enchant id", 180).getInt(180); - //Reactor - enableReactorBigBoom = config.get("Draconic Reactor", "EnableBigExplosion", true, "Setting this to false will reduce the reactor explosion to little more then a tnt blast").getBoolean(true); - reactorFuelUsageMultiplier = config.get("Draconic Reactor", "FuelUsageMultiplier", 1, "Use this to adjust how quickly the reactor uses fuel", 0, 1000000).getDouble(1); - reactorOutputMultiplier = config.get("Draconic Reactor", "EnergyOutputMultiplier", 1, "Use this to adjust the output of the reactor", 0, 1000000).getDouble(1); + // Reactor + enableReactorBigBoom = config.get( + "Draconic Reactor", + "EnableBigExplosion", + true, + "Setting this to false will reduce the reactor explosion to little more then a tnt blast") + .getBoolean(true); + reactorFuelUsageMultiplier = config.get( + "Draconic Reactor", + "FuelUsageMultiplier", + 1, + "Use this to adjust how quickly the reactor uses fuel", + 0, + 1000000) + .getDouble(1); + reactorOutputMultiplier = config.get( + "Draconic Reactor", + "EnergyOutputMultiplier", + 1, + "Use this to adjust the output of the reactor", + 0, + 1000000) + .getDouble(1); disabledNamesList.clear(); for (String s : disabledBlocksItems) { @@ -161,7 +365,8 @@ public class ConfigHandler { itemDislocatorBlacklistMap.clear(); for (String s : itemDislocatorBlacklist) { if (s.contains("|")) { - itemDislocatorBlacklistMap.put(s.substring(0, s.indexOf("|")), Integer.parseInt(s.substring(s.indexOf("|") + 1))); + itemDislocatorBlacklistMap.put( + s.substring(0, s.indexOf("|")), Integer.parseInt(s.substring(s.indexOf("|") + 1))); } else { itemDislocatorBlacklistMap.put(s, -1); } @@ -176,12 +381,10 @@ public class ConfigHandler { LogHelper.warn("###########################################"); disableLog = true; } - } - catch (Exception e) { + } catch (Exception e) { LogHelper.error("Unable to load Config"); e.printStackTrace(); - } - finally { + } finally { if (config.hasChanged()) config.save(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java index ff514fb7..915c2112 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java @@ -10,6 +10,11 @@ import com.google.common.base.Charsets; import com.google.gson.stream.JsonReader; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.gameevent.PlayerEvent; +import java.io.*; +import java.net.URL; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.UUID; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.player.EntityPlayer; @@ -18,12 +23,6 @@ import net.minecraftforge.client.event.RenderPlayerEvent; import org.apache.commons.io.IOUtils; import org.lwjgl.opengl.GL11; -import java.io.*; -import java.net.URL; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.UUID; - /** * Created by brandon3055 on 5/11/2015. */ @@ -44,13 +43,15 @@ public class ContributorHandler { Contributor contributor = contributors.get(event.entityPlayer.getCommandSenderName()); if (contributor.contributionLevel >= 1 && (contributor.contributorWingsEnabled)) renderWings(event); - if (contributor.contribution != null && contributor.contribution.toLowerCase().contains("patreon") && contributor.patreonBadgeEnabled) - renderBadge(event); + if (contributor.contribution != null + && contributor.contribution.toLowerCase().contains("patreon") + && contributor.patreonBadgeEnabled) renderBadge(event); } } public static boolean isPlayerContributor(EntityPlayer player) { - return contributors.containsKey(player.getCommandSenderName()) && contributors.get(player.getCommandSenderName()).isUserValid(player); + return contributors.containsKey(player.getCommandSenderName()) + && contributors.get(player.getCommandSenderName()).isUserValid(player); } private static void renderWings(RenderPlayerEvent event) { @@ -130,17 +131,23 @@ public class ContributorHandler { public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { if (event.player instanceof EntityPlayerMP) { for (String contribName : ContributorHandler.contributors.keySet()) { - for (String name : FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames()) { + for (String name : + FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames()) { if (name.equals(contribName)) { ContributorHandler.Contributor contributor = ContributorHandler.contributors.get(contribName); - DraconicEvolution.network.sendTo(new ContributorPacket(contribName, contributor.contributorWingsEnabled, contributor.patreonBadgeEnabled), (EntityPlayerMP) event.player); + DraconicEvolution.network.sendTo( + new ContributorPacket( + contribName, + contributor.contributorWingsEnabled, + contributor.patreonBadgeEnabled), + (EntityPlayerMP) event.player); } } } } } - //region Reading online contributors list + // region Reading online contributors list private static void readFile() { File cFile = new File(FileHandler.configFolder, "/draconicevolution/contributors.json"); @@ -180,8 +187,7 @@ public class ContributorHandler { reader.close(); cFile.delete(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -226,13 +232,11 @@ public class ContributorHandler { is.close(); os.close(); finished = true; - } - catch (Exception e) { + } catch (Exception e) { LogHelper.error("Failed to download contributors list"); failed = true; e.printStackTrace(); } - } public boolean isFinished() { @@ -243,7 +247,7 @@ public class ContributorHandler { return failed; } } - //endregion + // endregion public static class Contributor { public String name; @@ -256,23 +260,26 @@ public class ContributorHandler { * 0=Disabled, 1=Enabled when flying, 2=Always Enabled */ public boolean contributorWingsEnabled = true; + public boolean patreonBadgeEnabled = true; private boolean validated = false; private boolean isValid; - public Contributor() { - } + public Contributor() {} public boolean isUserValid(EntityPlayer player) { if (!validated) { - isValid = !UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)).equals(player.getUniqueID()); + isValid = !UUID.nameUUIDFromBytes( + ("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)) + .equals(player.getUniqueID()); } return isValid; } @Override public String toString() { - return "[Contributor: " + name + ", Contribution: " + contribution + ", Details: " + details + ", Website: " + website + "]"; + return "[Contributor: " + name + ", Contribution: " + contribution + ", Details: " + details + ", Website: " + + website + "]"; } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java index 6229c5d3..4a59d7f0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java @@ -1,8 +1,8 @@ package com.brandon3055.draconicevolution.common.handler; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utills.ShapedOreEnergyRecipe; import cpw.mods.fml.common.Loader; @@ -17,19 +17,70 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; public class CraftingHandler { public static void init() { - //todo In 1.8-1.9 when the feature modals are implemented add a dependency system to automatically disable a recipe if a required component is disabled + // todo In 1.8-1.9 when the feature modals are implemented add a dependency system to automatically disable a + // recipe if a required component is disabled ItemStack mobSoul = new ItemStack(ModItems.mobSoul); ItemNBTHelper.setString(mobSoul, "Name", "Any"); - //Components Key[C=Corner, S=Side, M=Middle ] - addOre(ModItems.draconicCore, "CSC", "SMS", "CSC", 'C', "ingotGold", 'S', ModItems.draconiumIngot, 'M', "gemDiamond"); - add(ModItems.wyvernCore, "CSC", "SMS", "CSC", 'C', ModItems.draconiumIngot, 'S', ModItems.draconicCore, 'M', Items.nether_star); + // Components Key[C=Corner, S=Side, M=Middle ] + addOre( + ModItems.draconicCore, + "CSC", + "SMS", + "CSC", + 'C', + "ingotGold", + 'S', + ModItems.draconiumIngot, + 'M', + "gemDiamond"); + add( + ModItems.wyvernCore, + "CSC", + "SMS", + "CSC", + 'C', + ModItems.draconiumIngot, + 'S', + ModItems.draconicCore, + 'M', + Items.nether_star); addOre(ModItems.awakenedCore, "CSC", "SCS", "CSC", 'C', "ingotDraconiumAwakened", 'S', ModItems.wyvernCore); - addOre(ModItems.chaoticCore, "ACA", "CSC", "ACA", 'A', "ingotDraconiumAwakened", 'C', ModItems.awakenedCore, 'S', ModItems.chaosShard); - add(ModItems.wyvernEnergyCore, "CSC", "SMS", "CSC", 'C', ModItems.draconiumIngot, 'S', Blocks.redstone_block, 'M', ModItems.draconicCore); - addOre(ModItems.draconicEnergyCore, "CSC", "SMS", "CSC", 'C', "ingotDraconiumAwakened", 'S', ModItems.wyvernEnergyCore, 'M', ModItems.wyvernCore); - //addOre(ModItems.draconiumBlend, " D ", "DID", " D ", 'I', "ingotIron", 'D', ModItems.draconiumDust); + addOre( + ModItems.chaoticCore, + "ACA", + "CSC", + "ACA", + 'A', + "ingotDraconiumAwakened", + 'C', + ModItems.awakenedCore, + 'S', + ModItems.chaosShard); + add( + ModItems.wyvernEnergyCore, + "CSC", + "SMS", + "CSC", + 'C', + ModItems.draconiumIngot, + 'S', + Blocks.redstone_block, + 'M', + ModItems.draconicCore); + addOre( + ModItems.draconicEnergyCore, + "CSC", + "SMS", + "CSC", + 'C', + "ingotDraconiumAwakened", + 'S', + ModItems.wyvernEnergyCore, + 'M', + ModItems.wyvernCore); + // addOre(ModItems.draconiumBlend, " D ", "DID", " D ", 'I', "ingotIron", 'D', ModItems.draconiumDust); addShaplessOre(getStack(ModItems.draconicIngot, 9, 0), "blockDraconiumAwakened"); addShaplessOre(getStack(ModItems.draconiumIngot, 9, 0), "blockDraconium"); @@ -45,127 +96,864 @@ public class CraftingHandler { if (ModItems.isEnabled(ModItems.draconiumIngot) && ModItems.isEnabled(ModItems.draconiumBlend)) GameRegistry.addSmelting(ModItems.draconiumBlend, getStack(ModItems.draconiumIngot, 2, 0), 1.0f); if (ModItems.isEnabled(ModItems.draconiumIngot) && ModItems.isEnabled(ModItems.draconiumDust)) - GameRegistry.addSmelting(new ItemStack(ModItems.draconiumDust), getStack(ModItems.draconiumIngot, 1, 0), 1.0f); + GameRegistry.addSmelting( + new ItemStack(ModItems.draconiumDust), getStack(ModItems.draconiumIngot, 1, 0), 1.0f); - //Reactor - addOre(ModItems.partStabFrame, "III", "CD ", "III", 'I', "ingotIron", 'C', ModItems.wyvernCore, 'D', "ingotDraconiumAwakened"); - addOre(ModItems.partStabRotorInner, " ", "III", "CWW", 'I', "ingotDraconiumAwakened", 'W', "ingotDraconium", 'C', ModItems.draconicCore); - addOre(ModItems.partStabRotorOuter, " ", "III", "CWW", 'I', "gemDiamond", 'W', "ingotDraconium", 'C', ModItems.draconicCore); - addOre(ModItems.partStabRotorAssembly, " IO", "CWW", " IO", 'I', ModItems.partStabRotorInner, 'O', ModItems.partStabRotorOuter, 'C', ModItems.wyvernCore, 'W', "ingotDraconium"); - addOre(ModItems.partStabRing, "GDG", "DCD", "GDG", 'G', "ingotGold", 'D', "gemDiamond", 'C', ModItems.wyvernCore); - addOre(ModBlocks.reactorStabilizer, "ICI", "FSR", "IEI", 'I', "ingotDraconiumAwakened", 'C', ModItems.chaoticCore, 'F', ModItems.partStabFrame, 'S', ModItems.partStabRotorAssembly, 'R', ModItems.partStabRing, 'E', ModItems.draconicEnergyCore); - addOre(ModBlocks.reactorEnergyInjector, "IRI", "RCR", "IRI", 'I', "ingotDraconium", 'R', ModItems.partStabRotorInner, 'C', ModItems.wyvernCore); + // Reactor + addOre( + ModItems.partStabFrame, + "III", + "CD ", + "III", + 'I', + "ingotIron", + 'C', + ModItems.wyvernCore, + 'D', + "ingotDraconiumAwakened"); + addOre( + ModItems.partStabRotorInner, + " ", + "III", + "CWW", + 'I', + "ingotDraconiumAwakened", + 'W', + "ingotDraconium", + 'C', + ModItems.draconicCore); + addOre( + ModItems.partStabRotorOuter, + " ", + "III", + "CWW", + 'I', + "gemDiamond", + 'W', + "ingotDraconium", + 'C', + ModItems.draconicCore); + addOre( + ModItems.partStabRotorAssembly, + " IO", + "CWW", + " IO", + 'I', + ModItems.partStabRotorInner, + 'O', + ModItems.partStabRotorOuter, + 'C', + ModItems.wyvernCore, + 'W', + "ingotDraconium"); + addOre( + ModItems.partStabRing, + "GDG", + "DCD", + "GDG", + 'G', + "ingotGold", + 'D', + "gemDiamond", + 'C', + ModItems.wyvernCore); + addOre( + ModBlocks.reactorStabilizer, + "ICI", + "FSR", + "IEI", + 'I', + "ingotDraconiumAwakened", + 'C', + ModItems.chaoticCore, + 'F', + ModItems.partStabFrame, + 'S', + ModItems.partStabRotorAssembly, + 'R', + ModItems.partStabRing, + 'E', + ModItems.draconicEnergyCore); + addOre( + ModBlocks.reactorEnergyInjector, + "IRI", + "RCR", + "IRI", + 'I', + "ingotDraconium", + 'R', + ModItems.partStabRotorInner, + 'C', + ModItems.wyvernCore); addOre(ModBlocks.reactorCore, " I ", "ISI", " I ", 'I', "ingotDraconiumAwakened", 'S', ModItems.chaosShard); - //Wyvern tools - add(ModItems.wyvernFluxCapacitor, "CSC", "SMS", "CSC", 'C', ModItems.draconiumIngot, 'S', ModItems.wyvernEnergyCore, 'M', ModItems.wyvernCore); - //tool - add(ModItems.wyvernPickaxe, " W ", "ITI", " E ", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'T', Items.diamond_pickaxe, 'E', ModItems.wyvernEnergyCore); - add(ModItems.wyvernShovel, " W ", "ITI", " E ", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'T', Items.diamond_shovel, 'E', ModItems.wyvernEnergyCore); - add(ModItems.wyvernSword, " W ", "ITI", " E ", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'T', Items.diamond_sword, 'E', ModItems.wyvernEnergyCore); - add(ModItems.wyvernBow, " W ", "ITI", " E ", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'T', Items.bow, 'E', ModItems.wyvernEnergyCore); - addOre(new ItemStack(ModItems.magnet, 1, 0), "RII", " C", "RII", 'R', Blocks.redstone_block, 'I', "ingotIron", 'C', ModItems.teleporterMKI); + // Wyvern tools + add( + ModItems.wyvernFluxCapacitor, + "CSC", + "SMS", + "CSC", + 'C', + ModItems.draconiumIngot, + 'S', + ModItems.wyvernEnergyCore, + 'M', + ModItems.wyvernCore); + // tool + add( + ModItems.wyvernPickaxe, + " W ", + "ITI", + " E ", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'T', + Items.diamond_pickaxe, + 'E', + ModItems.wyvernEnergyCore); + add( + ModItems.wyvernShovel, + " W ", + "ITI", + " E ", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'T', + Items.diamond_shovel, + 'E', + ModItems.wyvernEnergyCore); + add( + ModItems.wyvernSword, + " W ", + "ITI", + " E ", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'T', + Items.diamond_sword, + 'E', + ModItems.wyvernEnergyCore); + add( + ModItems.wyvernBow, + " W ", + "ITI", + " E ", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'T', + Items.bow, + 'E', + ModItems.wyvernEnergyCore); + addOre( + new ItemStack(ModItems.magnet, 1, 0), + "RII", + " C", + "RII", + 'R', + Blocks.redstone_block, + 'I', + "ingotIron", + 'C', + ModItems.teleporterMKI); - //armor - add(ModItems.wyvernHelm, "IWI", "IAI", "IEI", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'A', Items.diamond_helmet, 'E', ModItems.wyvernEnergyCore); - add(ModItems.wyvernChest, "IWI", "IAI", "IEI", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'A', Items.diamond_chestplate, 'E', ModItems.wyvernEnergyCore); - add(ModItems.wyvernLeggs, "IWI", "IAI", "IEI", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'A', Items.diamond_leggings, 'E', ModItems.wyvernEnergyCore); - add(ModItems.wyvernBoots, "IWI", "IAI", "IEI", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'A', Items.diamond_boots, 'E', ModItems.wyvernEnergyCore); + // armor + add( + ModItems.wyvernHelm, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'A', + Items.diamond_helmet, + 'E', + ModItems.wyvernEnergyCore); + add( + ModItems.wyvernChest, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'A', + Items.diamond_chestplate, + 'E', + ModItems.wyvernEnergyCore); + add( + ModItems.wyvernLeggs, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'A', + Items.diamond_leggings, + 'E', + ModItems.wyvernEnergyCore); + add( + ModItems.wyvernBoots, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.wyvernCore, + 'I', + ModItems.draconiumIngot, + 'A', + Items.diamond_boots, + 'E', + ModItems.wyvernEnergyCore); + // Draconic Tools + addEnergy( + ModItems.draconicFluxCapacitor, + "CMC", + "SPS", + "CSC", + 'C', + "ingotDraconiumAwakened", + 'S', + ModItems.draconicEnergyCore, + 'M', + ModItems.awakenedCore, + 'P', + ModItems.wyvernFluxCapacitor); + // tools + addEnergy( + ModItems.draconicPickaxe, + " C ", + "ITI", + " E ", + 'C', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'T', + ModItems.wyvernPickaxe, + 'E', + ModItems.draconicEnergyCore); + addEnergy( + ModItems.draconicShovel, + " C ", + "ITI", + " E ", + 'C', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'T', + ModItems.wyvernShovel, + 'E', + ModItems.draconicEnergyCore); + addOre( + ModItems.draconicAxe, + " C ", + "ITI", + " E ", + 'C', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'T', + Items.diamond_axe, + 'E', + ModItems.draconicEnergyCore); + addOre( + ModItems.draconicHoe, + " C ", + "ITI", + " E ", + 'C', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'T', + Items.diamond_hoe, + 'E', + ModItems.draconicEnergyCore); + addEnergy( + ModItems.draconicSword, + " C ", + "ITI", + " E ", + 'C', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'T', + ModItems.wyvernSword, + 'E', + ModItems.draconicEnergyCore); + addOre( + ModItems.draconicBow, + " C ", + "ITI", + " E ", + 'C', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'T', + ModItems.wyvernBow, + 'E', + ModItems.draconicEnergyCore); + addEnergy( + ModItems.draconicDestructionStaff, + "IAI", + "PIS", + "IWI", + 'I', + "ingotDraconiumAwakened", + 'A', + ModItems.awakenedCore, + 'P', + ModItems.draconicPickaxe, + 'S', + ModItems.draconicShovel, + 'W', + ModItems.draconicSword); + addOre( + new ItemStack(ModItems.magnet, 1, 1), + "RII", + " C", + "RII", + 'R', + new ItemStack(ModBlocks.draconiumBlock, 1, 2), + 'I', + "ingotDraconiumAwakened", + 'C', + new ItemStack(ModItems.magnet, 1, 0)); - //Draconic Tools - addEnergy(ModItems.draconicFluxCapacitor, "CMC", "SPS", "CSC", 'C', "ingotDraconiumAwakened", 'S', ModItems.draconicEnergyCore, 'M', ModItems.awakenedCore, 'P', ModItems.wyvernFluxCapacitor); - //tools - addEnergy(ModItems.draconicPickaxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', ModItems.wyvernPickaxe, 'E', ModItems.draconicEnergyCore); - addEnergy(ModItems.draconicShovel, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', ModItems.wyvernShovel, 'E', ModItems.draconicEnergyCore); - addOre(ModItems.draconicAxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', Items.diamond_axe, 'E', ModItems.draconicEnergyCore); - addOre(ModItems.draconicHoe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', Items.diamond_hoe, 'E', ModItems.draconicEnergyCore); - addEnergy(ModItems.draconicSword, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', ModItems.wyvernSword, 'E', ModItems.draconicEnergyCore); - addOre(ModItems.draconicBow, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', ModItems.wyvernBow, 'E', ModItems.draconicEnergyCore); - addEnergy(ModItems.draconicDestructionStaff, "IAI", "PIS", "IWI", 'I', "ingotDraconiumAwakened", 'A', ModItems.awakenedCore, 'P', ModItems.draconicPickaxe, 'S', ModItems.draconicShovel, 'W', ModItems.draconicSword); - addOre(new ItemStack(ModItems.magnet, 1, 1), "RII", " C", "RII", 'R', new ItemStack(ModBlocks.draconiumBlock, 1, 2), 'I', "ingotDraconiumAwakened", 'C', new ItemStack(ModItems.magnet, 1, 0)); + // armor + addEnergy( + ModItems.draconicHelm, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'A', + ModItems.wyvernHelm, + 'E', + ModItems.draconicEnergyCore); + addEnergy( + ModItems.draconicChest, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'A', + ModItems.wyvernChest, + 'E', + ModItems.draconicEnergyCore); + addEnergy( + ModItems.draconicLeggs, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'A', + ModItems.wyvernLeggs, + 'E', + ModItems.draconicEnergyCore); + addEnergy( + ModItems.draconicBoots, + "IWI", + "IAI", + "IEI", + 'W', + ModItems.awakenedCore, + 'I', + "ingotDraconiumAwakened", + 'A', + ModItems.wyvernBoots, + 'E', + ModItems.draconicEnergyCore); - //armor - addEnergy(ModItems.draconicHelm, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'A', ModItems.wyvernHelm, 'E', ModItems.draconicEnergyCore); - addEnergy(ModItems.draconicChest, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'A', ModItems.wyvernChest, 'E', ModItems.draconicEnergyCore); - addEnergy(ModItems.draconicLeggs, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'A', ModItems.wyvernLeggs, 'E', ModItems.draconicEnergyCore); - addEnergy(ModItems.draconicBoots, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'A', ModItems.wyvernBoots, 'E', ModItems.draconicEnergyCore); - - - //Blocks - //storage + // Blocks + // storage addOre(ModBlocks.draconiumBlock, "III", "III", "III", 'I', "ingotDraconium"); addOre(ModBlocks.draconicBlock, "III", "III", "III", 'I', "ingotDraconiumAwakened"); - //aesthetic - add(ModBlocks.particleGenerator, "RBR", "BCB", "RBR", 'R', Blocks.redstone_block, 'B', Items.blaze_rod, 'C', ModItems.draconicCore); - addOre(new ItemStack(ModBlocks.infusedObsidian, 4), "BOB", "ODO", "BOB", 'B', Items.blaze_powder, 'O', Blocks.obsidian, 'D', "dustDraconium"); + // aesthetic + add( + ModBlocks.particleGenerator, + "RBR", + "BCB", + "RBR", + 'R', + Blocks.redstone_block, + 'B', + Items.blaze_rod, + 'C', + ModItems.draconicCore); + addOre( + new ItemStack(ModBlocks.infusedObsidian, 4), + "BOB", + "ODO", + "BOB", + 'B', + Items.blaze_powder, + 'O', + Blocks.obsidian, + 'D', + "dustDraconium"); - //machines - addOre(ModBlocks.potentiometer, "ITI", "QCQ", "IRI", 'I', "ingotIron", 'T', Blocks.redstone_torch, 'Q', "gemQuartz", 'C', Items.comparator, 'R', Blocks.redstone_block); - addOre(ModBlocks.rainSensor, " ", "RBR", "SPS", 'R', "dustRedstone", 'B', Items.bucket, 'S', Blocks.stone_slab, 'P', Blocks.heavy_weighted_pressure_plate); - addOre(ModBlocks.teleporterStand, " P ", " S ", "HBH", 'P', Blocks.stone_pressure_plate, 'S', "stone", 'H', new ItemStack(Blocks.stone_slab, 1, 0), 'B', Items.blaze_powder); - addOre(ModBlocks.dislocatorReceptacle, "ICI", " O ", "ISI", 'I', "ingotIron", 'C', ModItems.draconicCore, 'O', ModBlocks.infusedObsidian, 'S', ModBlocks.teleporterStand); - addOre(ModBlocks.upgradeModifier, " ", "DCD", "III", 'I', "ingotIron", 'D', "ingotDraconium", 'C', ModItems.draconicCore); + // machines + addOre( + ModBlocks.potentiometer, + "ITI", + "QCQ", + "IRI", + 'I', + "ingotIron", + 'T', + Blocks.redstone_torch, + 'Q', + "gemQuartz", + 'C', + Items.comparator, + 'R', + Blocks.redstone_block); + addOre( + ModBlocks.rainSensor, + " ", + "RBR", + "SPS", + 'R', + "dustRedstone", + 'B', + Items.bucket, + 'S', + Blocks.stone_slab, + 'P', + Blocks.heavy_weighted_pressure_plate); + addOre( + ModBlocks.teleporterStand, + " P ", + " S ", + "HBH", + 'P', + Blocks.stone_pressure_plate, + 'S', + "stone", + 'H', + new ItemStack(Blocks.stone_slab, 1, 0), + 'B', + Items.blaze_powder); + addOre( + ModBlocks.dislocatorReceptacle, + "ICI", + " O ", + "ISI", + 'I', + "ingotIron", + 'C', + ModItems.draconicCore, + 'O', + ModBlocks.infusedObsidian, + 'S', + ModBlocks.teleporterStand); + addOre( + ModBlocks.upgradeModifier, + " ", + "DCD", + "III", + 'I', + "ingotIron", + 'D', + "ingotDraconium", + 'C', + ModItems.draconicCore); - //machines adv - addOre(ModBlocks.resurrectionStone, "CSC", "SMS", "CSC", 'C', mobSoul, 'S', ModItems.wyvernCore, 'M', "blockDraconium"); - addOre(ModBlocks.energyStorageCore, "CCC", "SMS", "CCC", 'C', "ingotDraconium", 'S', ModItems.wyvernEnergyCore, 'M', ModItems.wyvernCore); - addOre(ModBlocks.weatherController, "RIR", "TPT", "IEI", 'R', Items.blaze_rod, 'T', Blocks.tnt, 'P', ModItems.draconicCore, 'I', "ingotDraconium", 'E', Blocks.enchanting_table); - addOre(ModBlocks.playerDetectorAdvanced, "ISI", "EDE", "ICI", 'I', "ingotDraconium", 'E', Items.ender_eye, 'S', new ItemStack(Items.skull, 1, 1), 'C', Items.compass, 'D', ModBlocks.playerDetector); - addOre(ModBlocks.energyInfuser, "IPI", "CEC", "ICI", 'I', "ingotDraconium", 'P', ModBlocks.particleGenerator, 'C', ModItems.draconicCore, 'E', Blocks.enchanting_table); - addOre(ModBlocks.draconiumChest, "IFI", "SCS", "IWI", 'I', "ingotDraconium", 'C', ModItems.draconicCore, 'S', getChest(), 'W', Blocks.crafting_table, 'F', Blocks.furnace); - addOre(getStack(ModBlocks.energyPylon, 2, 0), "IEI", "MCM", "IDI", 'I', "ingotDraconium", 'E', Items.ender_eye, 'C', ModItems.draconicCore, 'D', "gemDiamond", 'M', "gemEmerald"); - addOre(getStack(ModBlocks.grinder, 1, 3), "IXI", "DCD", "IFI", 'I', "ingotIron", 'X', "ingotDraconium", 'D', Items.diamond_sword, 'C', ModItems.draconicCore, 'F', Blocks.furnace); - addOre(ModBlocks.playerDetector, "ITI", "CEC", "IDI", 'I', "ingotIron", 'E', Items.ender_eye, 'T', Blocks.redstone_torch, 'C', Items.comparator, 'D', ModItems.draconicCore); - addOre(getStack(ModBlocks.generator, 1, 3), "NIN", "IFI", "NCN", 'N', Items.netherbrick, 'I', "ingotIron", 'F', Blocks.furnace, 'C', ModItems.draconicCore); - addOre(ModBlocks.dissEnchanter, "PIP", "ETE", "CBC", 'P', Items.ender_eye, 'I', Items.enchanted_book, 'E', "gemEmerald", 'T', Blocks.enchanting_table, 'C', ModItems.draconicCore, 'B', Items.book); - addOre(getStack(ModBlocks.energyCrystal, 4, 0), "IDI", "DCD", "IDI", 'I', "ingotDraconium", 'D', "gemDiamond", 'C', ModItems.draconicCore); - addOre(getStack(ModBlocks.energyCrystal, 4, 1), "CRC", "RWR", "CRC", 'R', getStack(ModBlocks.energyCrystal, 1, 0), 'W', ModItems.wyvernCore, 'C', ModItems.draconicCore); - addShaplessOre(getStack(ModBlocks.energyCrystal, 1, 0), getStack(ModBlocks.energyCrystal, 1, 2), getStack(ModBlocks.energyCrystal, 1, 2)); + // machines adv + addOre( + ModBlocks.resurrectionStone, + "CSC", + "SMS", + "CSC", + 'C', + mobSoul, + 'S', + ModItems.wyvernCore, + 'M', + "blockDraconium"); + addOre( + ModBlocks.energyStorageCore, + "CCC", + "SMS", + "CCC", + 'C', + "ingotDraconium", + 'S', + ModItems.wyvernEnergyCore, + 'M', + ModItems.wyvernCore); + addOre( + ModBlocks.weatherController, + "RIR", + "TPT", + "IEI", + 'R', + Items.blaze_rod, + 'T', + Blocks.tnt, + 'P', + ModItems.draconicCore, + 'I', + "ingotDraconium", + 'E', + Blocks.enchanting_table); + addOre( + ModBlocks.playerDetectorAdvanced, + "ISI", + "EDE", + "ICI", + 'I', + "ingotDraconium", + 'E', + Items.ender_eye, + 'S', + new ItemStack(Items.skull, 1, 1), + 'C', + Items.compass, + 'D', + ModBlocks.playerDetector); + addOre( + ModBlocks.energyInfuser, + "IPI", + "CEC", + "ICI", + 'I', + "ingotDraconium", + 'P', + ModBlocks.particleGenerator, + 'C', + ModItems.draconicCore, + 'E', + Blocks.enchanting_table); + addOre( + ModBlocks.draconiumChest, + "IFI", + "SCS", + "IWI", + 'I', + "ingotDraconium", + 'C', + ModItems.draconicCore, + 'S', + getChest(), + 'W', + Blocks.crafting_table, + 'F', + Blocks.furnace); + addOre( + getStack(ModBlocks.energyPylon, 2, 0), + "IEI", + "MCM", + "IDI", + 'I', + "ingotDraconium", + 'E', + Items.ender_eye, + 'C', + ModItems.draconicCore, + 'D', + "gemDiamond", + 'M', + "gemEmerald"); + addOre( + getStack(ModBlocks.grinder, 1, 3), + "IXI", + "DCD", + "IFI", + 'I', + "ingotIron", + 'X', + "ingotDraconium", + 'D', + Items.diamond_sword, + 'C', + ModItems.draconicCore, + 'F', + Blocks.furnace); + addOre( + ModBlocks.playerDetector, + "ITI", + "CEC", + "IDI", + 'I', + "ingotIron", + 'E', + Items.ender_eye, + 'T', + Blocks.redstone_torch, + 'C', + Items.comparator, + 'D', + ModItems.draconicCore); + addOre( + getStack(ModBlocks.generator, 1, 3), + "NIN", + "IFI", + "NCN", + 'N', + Items.netherbrick, + 'I', + "ingotIron", + 'F', + Blocks.furnace, + 'C', + ModItems.draconicCore); + addOre( + ModBlocks.dissEnchanter, + "PIP", + "ETE", + "CBC", + 'P', + Items.ender_eye, + 'I', + Items.enchanted_book, + 'E', + "gemEmerald", + 'T', + Blocks.enchanting_table, + 'C', + ModItems.draconicCore, + 'B', + Items.book); + addOre( + getStack(ModBlocks.energyCrystal, 4, 0), + "IDI", + "DCD", + "IDI", + 'I', + "ingotDraconium", + 'D', + "gemDiamond", + 'C', + ModItems.draconicCore); + addOre( + getStack(ModBlocks.energyCrystal, 4, 1), + "CRC", + "RWR", + "CRC", + 'R', + getStack(ModBlocks.energyCrystal, 1, 0), + 'W', + ModItems.wyvernCore, + 'C', + ModItems.draconicCore); + addShaplessOre( + getStack(ModBlocks.energyCrystal, 1, 0), + getStack(ModBlocks.energyCrystal, 1, 2), + getStack(ModBlocks.energyCrystal, 1, 2)); addShaplessOre(getStack(ModBlocks.energyCrystal, 2, 2), getStack(ModBlocks.energyCrystal, 1, 0)); - addShaplessOre(getStack(ModBlocks.energyCrystal, 1, 1), getStack(ModBlocks.energyCrystal, 1, 3), getStack(ModBlocks.energyCrystal, 1, 3)); + addShaplessOre( + getStack(ModBlocks.energyCrystal, 1, 1), + getStack(ModBlocks.energyCrystal, 1, 3), + getStack(ModBlocks.energyCrystal, 1, 3)); addShaplessOre(getStack(ModBlocks.energyCrystal, 2, 3), getStack(ModBlocks.energyCrystal, 1, 1)); - addOre(getStack(ModBlocks.energyCrystal, 1, 4), "PGP", "ECE", "PGP", 'P', Items.ender_pearl, 'G', ModBlocks.particleGenerator, 'E', Items.ender_eye, 'C', getStack(ModBlocks.energyCrystal, 1, 0)); - addOre(getStack(ModBlocks.energyCrystal, 1, 5), "PGP", "ECE", "PGP", 'P', Items.ender_pearl, 'G', ModBlocks.particleGenerator, 'E', Items.ender_eye, 'C', getStack(ModBlocks.energyCrystal, 1, 1)); + addOre( + getStack(ModBlocks.energyCrystal, 1, 4), + "PGP", + "ECE", + "PGP", + 'P', + Items.ender_pearl, + 'G', + ModBlocks.particleGenerator, + 'E', + Items.ender_eye, + 'C', + getStack(ModBlocks.energyCrystal, 1, 0)); + addOre( + getStack(ModBlocks.energyCrystal, 1, 5), + "PGP", + "ECE", + "PGP", + 'P', + Items.ender_pearl, + 'G', + ModBlocks.particleGenerator, + 'E', + Items.ender_eye, + 'C', + getStack(ModBlocks.energyCrystal, 1, 1)); if (Loader.isModLoaded("ThermalDynamics")) { - addOre(getStack(ModBlocks.flowGate, 1, 0), "ICI", "RSR", "ICI", 'I', "ingotDraconium", 'C', getStack(ModItems.draconicCore, 1, 0), 'R', Items.comparator, 'S', new ItemStack(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_0"), 1, 1)); - addOre(getStack(ModBlocks.flowGate, 1, 6), "ICI", "RSR", "ICI", 'I', "ingotDraconium", 'C', getStack(ModItems.draconicCore, 1, 0), 'R', Items.comparator, 'S', new ItemStack(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_16"), 1, 2)); + addOre( + getStack(ModBlocks.flowGate, 1, 0), + "ICI", + "RSR", + "ICI", + 'I', + "ingotDraconium", + 'C', + getStack(ModItems.draconicCore, 1, 0), + 'R', + Items.comparator, + 'S', + new ItemStack(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_0"), 1, 1)); + addOre( + getStack(ModBlocks.flowGate, 1, 6), + "ICI", + "RSR", + "ICI", + 'I', + "ingotDraconium", + 'C', + getStack(ModItems.draconicCore, 1, 0), + 'R', + Items.comparator, + 'S', + new ItemStack(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_16"), 1, 2)); } else { - addOre(getStack(ModBlocks.flowGate, 1, 0), "ICI", "RSR", "ICI", 'I', "ingotDraconium", 'C', getStack(ModItems.draconicCore, 1, 0), 'R', Items.comparator, 'S', getStack(ModItems.draconiumEnergyCore, 1, 0)); - addOre(getStack(ModBlocks.flowGate, 1, 6), "ICI", "RSR", "ICI", 'I', "ingotDraconium", 'C', getStack(ModItems.draconicCore, 1, 0), 'R', Items.comparator, 'S', Items.bucket); + addOre( + getStack(ModBlocks.flowGate, 1, 0), + "ICI", + "RSR", + "ICI", + 'I', + "ingotDraconium", + 'C', + getStack(ModItems.draconicCore, 1, 0), + 'R', + Items.comparator, + 'S', + getStack(ModItems.draconiumEnergyCore, 1, 0)); + addOre( + getStack(ModBlocks.flowGate, 1, 6), + "ICI", + "RSR", + "ICI", + 'I', + "ingotDraconium", + 'C', + getStack(ModItems.draconicCore, 1, 0), + 'R', + Items.comparator, + 'S', + Items.bucket); } - //Tools - addOre(ModItems.teleporterMKII, "IEI", "ETE", "IWI", 'I', "ingotDraconium", 'E', Items.ender_pearl, 'T', ModItems.teleporterMKI, 'W', ModItems.wyvernCore); - addOre(ModItems.teleporterMKI, "CSC", "SMS", "CSC", 'C', Items.blaze_powder, 'S', "dustDraconium", 'M', Items.ender_eye); + // Tools + addOre( + ModItems.teleporterMKII, + "IEI", + "ETE", + "IWI", + 'I', + "ingotDraconium", + 'E', + Items.ender_pearl, + 'T', + ModItems.teleporterMKI, + 'W', + ModItems.wyvernCore); + addOre( + ModItems.teleporterMKI, + "CSC", + "SMS", + "CSC", + 'C', + Items.blaze_powder, + 'S', + "dustDraconium", + 'M', + Items.ender_eye); addOre(getStack(ModItems.safetyMatch, 1, 1000), " O ", " S ", " ", 'O', "dyeOrange", 'S', "stickWood"); add(ModItems.safetyMatch, "MMM", "MMM", "MMM", 'M', getStack(ModItems.safetyMatch, 1, 1000)); - addOre(ModItems.wrench, " ID", " RI", "C ", 'I', "ingotDraconium", 'D', "gemDiamond", 'R', Items.blaze_rod, 'C', ModItems.draconicCore); + addOre( + ModItems.wrench, + " ID", + " RI", + "C ", + 'I', + "ingotDraconium", + 'D', + "gemDiamond", + 'R', + Items.blaze_rod, + 'C', + ModItems.draconicCore); - //Other + // Other addOre(ModItems.infoTablet, "SSS", "SDS", "SSS", 'S', "stone", 'D', "dustDraconium"); addShaplessOre(getStack(ModItems.enderArrow, 1, 0), Items.arrow, Items.ender_pearl); - addShaplessOre(new ItemStack(Blocks.dirt), Item.getItemFromBlock(Blocks.sand), Items.rotten_flesh, "treeSapling", "treeSapling", "treeSapling"); - addShaplessOre(new ItemStack(Blocks.dirt), Item.getItemFromBlock(Blocks.sand), Items.rotten_flesh, "treeLeaves", "treeLeaves", "treeLeaves"); - - - //Disable able - //if(ConfigHandler.disableSunDial == 0) - addOre(ModBlocks.sunDial, "IAI", "CDC", "IEI", 'I', "ingotDraconium", 'A', ModItems.awakenedCore, 'C', ModItems.draconicCore, 'E', Blocks.enchanting_table, 'D', Blocks.dragon_egg); - //if(ConfigHandler.disableXrayBlock == 0) - addOre(getStack(ModBlocks.xRayBlock, 4, 0), "SGS", "GDG", "SGS", 'S', Items.nether_star, 'G', "blockGlassColorless", 'D', "gemDiamond"); + addShaplessOre( + new ItemStack(Blocks.dirt), + Item.getItemFromBlock(Blocks.sand), + Items.rotten_flesh, + "treeSapling", + "treeSapling", + "treeSapling"); + addShaplessOre( + new ItemStack(Blocks.dirt), + Item.getItemFromBlock(Blocks.sand), + Items.rotten_flesh, + "treeLeaves", + "treeLeaves", + "treeLeaves"); + // Disable able + // if(ConfigHandler.disableSunDial == 0) + addOre( + ModBlocks.sunDial, + "IAI", + "CDC", + "IEI", + 'I', + "ingotDraconium", + 'A', + ModItems.awakenedCore, + 'C', + ModItems.draconicCore, + 'E', + Blocks.enchanting_table, + 'D', + Blocks.dragon_egg); + // if(ConfigHandler.disableXrayBlock == 0) + addOre( + getStack(ModBlocks.xRayBlock, 4, 0), + "SGS", + "GDG", + "SGS", + 'S', + Items.nether_star, + 'G', + "blockGlassColorless", + 'D', + "gemDiamond"); } private static ItemStack getChest() { if (Loader.isModLoaded("IronChest")) { LogHelper.info("Adding Iron Chests Integration"); return new ItemStack(GameRegistry.findBlock("IronChest", "BlockIronChest"), 1, 6); - } else - - LogHelper.info("Iron Chests was not detected! using fallback chest recipe"); + } else LogHelper.info("Iron Chests was not detected! using fallback chest recipe"); return new ItemStack(Blocks.chest); } @@ -181,7 +969,9 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; + String s = o instanceof Item + ? ((Item) o).getUnlocalizedName() + : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } @@ -192,7 +982,9 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; + String s = o instanceof Item + ? ((Item) o).getUnlocalizedName() + : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } @@ -211,7 +1003,9 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; + String s = o instanceof Item + ? ((Item) o).getUnlocalizedName() + : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } @@ -230,7 +1024,9 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; + String s = o instanceof Item + ? ((Item) o).getUnlocalizedName() + : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } @@ -244,4 +1040,4 @@ public class CraftingHandler { private static ItemStack getStack(Item item, int count, int meta) { return ModItems.isEnabled(item) ? new ItemStack(item, count, meta) : null; } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java index f12a2b9f..7bb9c843 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.common.handler; - import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; import com.brandon3055.draconicevolution.common.lib.References; @@ -50,7 +49,12 @@ public class FMLEventHandler { if (!mmGiven && event.player.getCommandSenderName().toLowerCase().equals("dezil_nz")) { mmGiven = true; event.player.addChatComponentMessage(new ChatComponentText("Hello Dez! Here have a Marshmallow")); - event.player.worldObj.spawnEntityInWorld(new EntityItem(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(ModItems.dezilsMarshmallow))); + event.player.worldObj.spawnEntityInWorld(new EntityItem( + event.player.worldObj, + event.player.posX, + event.player.posY, + event.player.posZ, + new ItemStack(ModItems.dezilsMarshmallow))); } ContributorHandler.onPlayerLogin(event); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java index b06242f0..87fe202d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.common.handler; - import com.brandon3055.brandonscore.common.handlers.ProcessHandler; import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -23,6 +22,11 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.entity.EntityPlayerSP; @@ -58,12 +62,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import net.minecraftforge.event.world.WorldEvent; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Random; - public class MinecraftForgeEventHandler { Random random = new Random(); @@ -77,9 +75,9 @@ public class MinecraftForgeEventHandler { public MinecraftForgeEventHandler() { try { - persistenceRequired = ReflectionHelper.findField(EntityLiving.class, "field_82179_bU", "persistenceRequired"); - } - catch (Exception e) { + persistenceRequired = + ReflectionHelper.findField(EntityLiving.class, "field_82179_bU", "persistenceRequired"); + } catch (Exception e) { LogHelper.error("Unable to find field \"persistenceRequired\""); } } @@ -96,15 +94,13 @@ public class MinecraftForgeEventHandler { try { persistenceRequired.setBoolean(entity, false); entity.getEntityData().removeTag("SpawnedByDESpawner"); - } - catch (Exception e) { + } catch (Exception e) { LogHelper.warn("Error occured while resetting entity persistence: " + e); entity.getEntityData().removeTag("SpawnedByDESpawner"); } } } - if (!event.entityLiving.worldObj.isRemote || !(event.entityLiving instanceof EntityPlayerSP)) return; EntityPlayerSP player = (EntityPlayerSP) entity; @@ -162,23 +158,44 @@ public class MinecraftForgeEventHandler { @SubscribeEvent public void onDropEvent(LivingDropsEvent event) { - if (!event.entity.worldObj.isRemote && ((event.entity instanceof EntityDragon) || (EntityList.getEntityString(event.entity) != null && !EntityList.getEntityString(event.entity).isEmpty() && EntityList.getEntityString(event.entity).equals("HardcoreEnderExpansion.Dragon")))) { - EntityItem item = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(ModItems.dragonHeart)); - event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart(event.entity.worldObj, ((int) event.entity.posX) + 0.5, event.entity.posY, ((int) event.entity.posZ) + 0.5)); + if (!event.entity.worldObj.isRemote + && ((event.entity instanceof EntityDragon) + || (EntityList.getEntityString(event.entity) != null + && !EntityList.getEntityString(event.entity).isEmpty() + && EntityList.getEntityString(event.entity).equals("HardcoreEnderExpansion.Dragon")))) { + EntityItem item = new EntityItem( + event.entity.worldObj, + event.entity.posX, + event.entity.posY, + event.entity.posZ, + new ItemStack(ModItems.dragonHeart)); + event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart( + event.entity.worldObj, + ((int) event.entity.posX) + 0.5, + event.entity.posY, + ((int) event.entity.posZ) + 0.5)); if (event.entity instanceof EntityCustomDragon && ((EntityCustomDragon) event.entity).getIsUber()) { - event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart(event.entity.worldObj, event.entity.posX, event.entity.posY + 2, event.entity.posZ)); + event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart( + event.entity.worldObj, event.entity.posX, event.entity.posY + 2, event.entity.posZ)); } for (Object o : event.entity.worldObj.playerEntities) { if (o instanceof EntityPlayer) { - ((EntityPlayer) o).addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt"))); + ((EntityPlayer) o) + .addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt"))); } } int count = 30 + event.entity.worldObj.rand.nextInt(30); for (int i = 0; i < count; i++) { float mm = 0.3F; - EntityItem item2 = new EntityItem(event.entity.worldObj, event.entity.posX - 2 + event.entity.worldObj.rand.nextInt(4), event.entity.posY - 2 + event.entity.worldObj.rand.nextInt(4), event.entity.posZ - 2 + event.entity.worldObj.rand.nextInt(4), new ItemStack(ModItems.draconiumDust)); + EntityItem item2 = new EntityItem( + event.entity.worldObj, + event.entity.posX - 2 + event.entity.worldObj.rand.nextInt(4), + event.entity.posY - 2 + event.entity.worldObj.rand.nextInt(4), + event.entity.posZ - 2 + event.entity.worldObj.rand.nextInt(4), + new ItemStack(ModItems.draconiumDust)); item.motionX = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F); item.motionY = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F); item.motionZ = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F); @@ -186,7 +203,9 @@ public class MinecraftForgeEventHandler { } } - if (event.entity.worldObj.isRemote || !(event.source.damageType.equals("player") || event.source.damageType.equals("arrow")) || !isValidEntity(event.entityLiving)) { + if (event.entity.worldObj.isRemote + || !(event.source.damageType.equals("player") || event.source.damageType.equals("arrow")) + || !isValidEntity(event.entityLiving)) { return; } @@ -236,7 +255,8 @@ public class MinecraftForgeEventHandler { for (int i = 0; i < ConfigHandler.spawnerList.length; i++) { if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && ConfigHandler.spawnerListType) { return true; - } else if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && !ConfigHandler.spawnerListType) { + } else if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) + && !ConfigHandler.spawnerListType) { return false; } } @@ -272,7 +292,8 @@ public class MinecraftForgeEventHandler { private boolean makeChange(ExtendedBlockStorage storage, int x, int y, int z, Block block) { if (block == null) return false; - LogHelper.info("Changing block at [X:" + x + " Y:" + y + " Z:" + z + "] from " + storage.getBlockByExtId(x, y, z).getUnlocalizedName() + " to " + block.getUnlocalizedName()); + LogHelper.info("Changing block at [X:" + x + " Y:" + y + " Z:" + z + "] from " + + storage.getBlockByExtId(x, y, z).getUnlocalizedName() + " to " + block.getUnlocalizedName()); storage.func_150818_a(x, y, z, block); return true; } @@ -306,7 +327,15 @@ public class MinecraftForgeEventHandler { World world = event.entityPlayer.worldObj; if (world.isRemote) return; EntityPlayer player = event.entityPlayer; - List list = world.getEntitiesWithinAABB(EntityPigZombie.class, AxisAlignedBB.getBoundingBox(player.posX - 32, player.posY - 32, player.posZ - 32, player.posX + 32, player.posY + 32, player.posZ + 32)); + List list = world.getEntitiesWithinAABB( + EntityPigZombie.class, + AxisAlignedBB.getBoundingBox( + player.posX - 32, + player.posY - 32, + player.posZ - 32, + player.posX + 32, + player.posY + 32, + player.posZ + 32)); EntityZombie entityAtPlayer = new EntityPigZombie(world); entityAtPlayer.setPosition(player.posX, player.posY, player.posZ); @@ -317,22 +346,25 @@ public class MinecraftForgeEventHandler { if (o instanceof EntityPigZombie) { EntityPigZombie zombie = (EntityPigZombie) o; if (becomeAngryAt == null) { - becomeAngryAt = ReflectionHelper.findMethod(EntityPigZombie.class, zombie, new String[]{"becomeAngryAt", "func_70835_c"}, Entity.class); + becomeAngryAt = ReflectionHelper.findMethod( + EntityPigZombie.class, + zombie, + new String[] {"becomeAngryAt", "func_70835_c"}, + Entity.class); becomeAngryAt.setAccessible(true); } try { becomeAngryAt.invoke(zombie, player); - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { e.printStackTrace(); - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { e.printStackTrace(); } - if (Math.abs(zombie.posX - player.posX) < 14 && Math.abs(zombie.posY - player.posY) < 14 && Math.abs(zombie.posZ - player.posZ) < 14) - flag = true; + if (Math.abs(zombie.posX - player.posX) < 14 + && Math.abs(zombie.posY - player.posY) < 14 + && Math.abs(zombie.posZ - player.posZ) < 14) flag = true; zombie.addPotionEffect(new PotionEffect(5, 10000, 3)); zombie.addPotionEffect(new PotionEffect(11, 10000, 2)); } @@ -355,7 +387,8 @@ public class MinecraftForgeEventHandler { public void getBreakSpeed(PlayerEvent.BreakSpeed event) { if (event.entityPlayer != null) { float newDigSpeed = event.originalSpeed; - CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(event.entityPlayer); + CustomArmorHandler.ArmorSummery summery = + new CustomArmorHandler.ArmorSummery().getSummery(event.entityPlayer); if (summery == null) return; if (event.entityPlayer.isInsideOfMaterial(Material.water)) { @@ -388,7 +421,8 @@ public class MinecraftForgeEventHandler { int z = event.z + face.offsetZ; if (event.world.getBlock(x, y, z) == ModBlocks.safetyFlame) { event.world.setBlockToAir(x, y, z); - event.world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.fizz", 1F, event.world.rand.nextFloat() * 0.1F + 2F); + event.world.playSoundEffect( + x + 0.5D, y + 0.5D, z + 0.5D, "random.fizz", 1F, event.world.rand.nextFloat() * 0.1F + 2F); event.setCanceled(true); } } @@ -397,8 +431,10 @@ public class MinecraftForgeEventHandler { @SubscribeEvent public void entityJoinWorld(EntityJoinWorldEvent event) { if (!event.world.isRemote && event.entity instanceof EntityEnderCrystal && event.entity.dimension == 1) { - DataUtills.XZPair location = ChaosWorldGenHandler.getClosestChaosSpawn((int) event.entity.posX / 16, (int) event.entity.posZ / 16); - if ((location.x != 0 || location.z != 0) && Utills.getDistanceAtoB(event.entity.posX, event.entity.posZ, location.x, location.z) < 500) { + DataUtills.XZPair location = ChaosWorldGenHandler.getClosestChaosSpawn( + (int) event.entity.posX / 16, (int) event.entity.posZ / 16); + if ((location.x != 0 || location.z != 0) + && Utills.getDistanceAtoB(event.entity.posX, event.entity.posZ, location.x, location.z) < 500) { ProcessHandler.addProcess(new ChaosWorldGenHandler.CrystalRemover(event.entity)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/GenericInventory.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/GenericInventory.java index e2146428..a30851c3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/GenericInventory.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/GenericInventory.java @@ -74,17 +74,13 @@ public abstract class GenericInventory implements IInventory { } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override - public void markDirty() { - - } + public void markDirty() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java index af6cd272..77f7d244 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java @@ -19,6 +19,7 @@ public class InventoryCraftingChest extends InventoryCrafting { * on_CraftMaxtrixChanged. */ private Container eventHandler; + private TileDraconiumChest tile; public InventoryCraftingChest(Container par1Container, int size, int height, TileDraconiumChest tile) { @@ -119,8 +120,7 @@ public class InventoryCraftingChest extends InventoryCrafting { * Called when an the contents of an Inventory change, usually */ @Override - public void markDirty() { - } + public void markDirty() {} /** * Do not make give this method the name canInteractWith because it clashes @@ -131,11 +131,9 @@ public class InventoryCraftingChest extends InventoryCrafting { return true; } - public void openChest() { - } + public void openChest() {} - public void closeChest() { - } + public void closeChest() {} /** * Returns true if automation is allowed to insert the given stack (ignoring diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java index 01b358da..393a1f5c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java @@ -28,7 +28,7 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { */ @Override public ItemStack getStackInSlot(int par1) { - return tile.getStackInCraftingSlot(0);// this.stackResult[0]; + return tile.getStackInCraftingSlot(0); // this.stackResult[0]; } /** @@ -95,8 +95,7 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { * Called when an the contents of an Inventory change, usually */ @Override - public void markDirty() { - } + public void markDirty() {} /** * Do not make give this method the name canInteractWith because it clashes @@ -107,11 +106,9 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { return true; } - public void openChest() { - } + public void openChest() {} - public void closeChest() { - } + public void closeChest() {} /** * Returns true if automation is allowed to insert the given stack (ignoring diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java index 48cdd588..af579ce3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java @@ -90,7 +90,11 @@ public class InventoryTool implements IInventory { @Override public String getInventoryName() { - return inventoryItem != null && inventoryItem.getItem() instanceof IInventoryTool ? !StringUtils.isNullOrEmpty(((IInventoryTool) inventoryItem.getItem()).getInventoryName()) ? ((IInventoryTool) inventoryItem.getItem()).getInventoryName() : "" : ""; + return inventoryItem != null && inventoryItem.getItem() instanceof IInventoryTool + ? !StringUtils.isNullOrEmpty(((IInventoryTool) inventoryItem.getItem()).getInventoryName()) + ? ((IInventoryTool) inventoryItem.getItem()).getInventoryName() + : "" + : ""; } @Override @@ -119,7 +123,6 @@ public class InventoryTool implements IInventory { LogHelper.error("[InventoryItem] storage item == null This is not a good thing..."); } - container.detectAndSendChanges(); } @@ -129,7 +132,10 @@ public class InventoryTool implements IInventory { } private ItemStack getItem() { - if (slot != -1 && player.inventory.getStackInSlot(slot) != null && inventoryItem != null && player.inventory.getStackInSlot(slot).getItem() == inventoryItem.getItem()) { + if (slot != -1 + && player.inventory.getStackInSlot(slot) != null + && inventoryItem != null + && player.inventory.getStackInSlot(slot).getItem() == inventoryItem.getItem()) { return player.inventory.getStackInSlot(slot); } else { LogHelper.error("Error getting inventory item [InventoryTool#getItem() - " + slot + "]"); @@ -138,12 +144,10 @@ public class InventoryTool implements IInventory { } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { @@ -166,20 +170,24 @@ public class InventoryTool implements IInventory { } else if (inventoryStacks[i] != null) { if (inventoryStacks[i].getTagCompound() == null) inventoryStacks[i] = null; else { - enchList.appendTag(inventoryStacks[i].getTagCompound().getTagList("StoredEnchantments", 10).getCompoundTagAt(0)); + enchList.appendTag(inventoryStacks[i] + .getTagCompound() + .getTagList("StoredEnchantments", 10) + .getCompoundTagAt(0)); } } compound.setTag("ench", enchList); } -// for (int i = size; i < getSizeInventory(); i++) -// { -// if (inventoryStacks[i] != null && inventoryStacks[i].getItem() == Items.enchanted_book && inventoryStacks[i].hasTagCompound() && inventoryStacks[i].getTagCompound().hasKey("StoredEnchantments")) -// { -// NBTTagList enchants = inventoryStacks[i].getTagCompound().getTagList("StoredEnchantments", 10); -// compound.setTag("ench", enchants); -// } -// } + // for (int i = size; i < getSizeInventory(); i++) + // { + // if (inventoryStacks[i] != null && inventoryStacks[i].getItem() == Items.enchanted_book && + // inventoryStacks[i].hasTagCompound() && inventoryStacks[i].getTagCompound().hasKey("StoredEnchantments")) + // { + // NBTTagList enchants = inventoryStacks[i].getTagCompound().getTagList("StoredEnchantments", 10); + // compound.setTag("ench", enchants); + // } + // } if (compound.hasKey("ench") && compound.getTagList("ench", 10).tagCount() == 0) compound.removeTag("ench"); } @@ -203,25 +211,23 @@ public class InventoryTool implements IInventory { } } -// if (compound.hasKey("ench")) -// { -// NBTTagList enchants = compound.getTagList("ench", 10); -// for (int i = size; i < getSizeInventory(); i++) -// { -// if (!enchants.getCompoundTagAt(i - size).hasNoTags()) -// { -// inventoryStacks[i] = new ItemStack(Items.enchanted_book); -// NBTTagCompound compound1 = new NBTTagCompound(); -// NBTTagList list = new NBTTagList(); -// list.appendTag(enchants.getCompoundTagAt(i - size)); -// compound1.setTag("StoredEnchantments", list); -// inventoryStacks[i].setTagCompound(compound1); -// } -// } -// } + // if (compound.hasKey("ench")) + // { + // NBTTagList enchants = compound.getTagList("ench", 10); + // for (int i = size; i < getSizeInventory(); i++) + // { + // if (!enchants.getCompoundTagAt(i - size).hasNoTags()) + // { + // inventoryStacks[i] = new ItemStack(Items.enchanted_book); + // NBTTagCompound compound1 = new NBTTagCompound(); + // NBTTagList list = new NBTTagList(); + // list.appendTag(enchants.getCompoundTagAt(i - size)); + // compound1.setTag("StoredEnchantments", list); + // inventoryStacks[i].setTagCompound(compound1); + // } + // } + // } if (compound.hasKey("ench") && compound.getTagList("ench", 10).tagCount() == 0) compound.removeTag("ench"); - } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java index 0578c168..c854fc89 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java @@ -8,10 +8,8 @@ import net.minecraft.item.ItemStack; public class SlotChargable extends Slot { - public SlotChargable(IInventory inventory, int id, int x, int y) { super(inventory, id, x, y); - } @Override @@ -27,7 +25,6 @@ public class SlotChargable extends Slot { return 1; } - @Override public boolean func_111238_b() { return !((TileEnergyInfuser) inventory).running; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java index a29259b3..9a56f313 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java @@ -1,5 +1,6 @@ package com.brandon3055.draconicevolution.common.inventory; +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -12,7 +13,6 @@ import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; -import cpw.mods.fml.common.registry.GameRegistry; public class SlotItemValid extends Slot { @@ -59,9 +59,12 @@ public class SlotItemValid extends Slot { } } - if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemTool + && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword + && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe + && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; @@ -71,13 +74,13 @@ public class SlotItemValid extends Slot { } } /* - @Override - public IIcon getBackgroundIconIndex() - { - IIcon icon = Items.coal.getIconIndex(new ItemStack(Items.coal)); - if (false) - return icon; - else - return super.getBackgroundIconIndex(); - }*/ + @Override + public IIcon getBackgroundIconIndex() + { + IIcon icon = Items.coal.getIconIndex(new ItemStack(Items.coal)); + if (false) + return icon; + else + return super.getBackgroundIconIndex(); + }*/ } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOpaqueBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOpaqueBlock.java index cda99b7b..4cb7a4b5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOpaqueBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOpaqueBlock.java @@ -7,10 +7,8 @@ import net.minecraft.item.ItemStack; public class SlotOpaqueBlock extends Slot { - public SlotOpaqueBlock(IInventory inventory, int id, int x, int y) { super(inventory, id, x, y); - } @Override @@ -26,6 +24,4 @@ public class SlotOpaqueBlock extends Slot { public int getSlotStackLimit() { return 1; } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java index 6c3d75a2..a6cb4e1d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java @@ -16,4 +16,4 @@ public class AwakenedCore extends ItemDE { public boolean hasEffect(ItemStack par1ItemStack, int pass) { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java index e5c65e32..ec2ee19f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java @@ -1,12 +1,11 @@ package com.brandon3055.draconicevolution.common.items; import com.brandon3055.draconicevolution.common.ModItems; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import java.util.List; - /** * Created by brandon3055 on 8/10/2015. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java index 1668c165..80955795 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java @@ -19,8 +19,7 @@ public class ChaosShard extends ItemDE { } @Override - public void registerIcons(IIconRegister iconRegister) { - } + public void registerIcons(IIconRegister iconRegister) {} @Override public boolean hasCustomEntity(ItemStack stack) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java index 4c159a4b..cdaaf3fe 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java @@ -9,6 +9,7 @@ import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -16,8 +17,6 @@ import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - public class DraconicCore extends ItemDE { public DraconicCore() { this.setUnlocalizedName(Strings.draconicCoreName); @@ -33,15 +32,29 @@ public class DraconicCore extends ItemDE { } @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 (world.getBlock(x, y, z) == Blocks.mob_spawner) { - TileEntityMobSpawner oldSpawner = world.getTileEntity(x, y, z) instanceof TileEntityMobSpawner ? (TileEntityMobSpawner) world.getTileEntity(x, y, z) : null; + TileEntityMobSpawner oldSpawner = world.getTileEntity(x, y, z) instanceof TileEntityMobSpawner + ? (TileEntityMobSpawner) world.getTileEntity(x, y, z) + : null; if (oldSpawner == null) return false; String mobName = oldSpawner.func_145881_a().getEntityNameToSpawn(); LogHelper.info(mobName); world.setBlock(x, y, z, ModBlocks.customSpawner); - TileCustomSpawner newSpawner = world.getTileEntity(x, y, z) instanceof TileCustomSpawner ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; + TileCustomSpawner newSpawner = world.getTileEntity(x, y, z) instanceof TileCustomSpawner + ? (TileCustomSpawner) world.getTileEntity(x, y, z) + : null; if (newSpawner != null) { newSpawner.getBaseLogic().entityName = mobName; newSpawner.isSetToSpawn = true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java index 257a7f06..9171d90f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java @@ -10,5 +10,4 @@ public class DraconiumBlend extends ItemDE { this.setCreativeTab(DraconicEvolution.tabBlocksItems); ModItems.register(this); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java index dbc35466..950168e1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java @@ -10,5 +10,4 @@ public class DraconiumDust extends ItemDE { this.setCreativeTab(DraconicEvolution.tabBlocksItems); ModItems.register(this); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java index 09f73bcd..8348eb10 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java @@ -5,14 +5,13 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - /** * Created by Brandon on 24/11/2014. */ @@ -44,7 +43,6 @@ public class DraconiumEnergyCore extends ItemDE { public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(new ItemStack(item, 1, 0)); list.add(new ItemStack(item, 1, 1)); - } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java index 26da03e9..eab92c65 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java @@ -26,4 +26,4 @@ public class DragonHeart extends ItemDE { public Entity createEntity(World world, Entity location, ItemStack itemstack) { return new EntityPersistentItem(world, location, itemstack); } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java b/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java index 856a86eb..6e605552 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java @@ -21,7 +21,7 @@ public class InfoTablet extends ItemDE { this.setCreativeTab(DraconicEvolution.tabBlocksItems); this.setMaxStackSize(1); ModItems.register(this); - //GameRegistry.registerItem(this, Strings.infoTabletName); + // GameRegistry.registerItem(this, Strings.infoTabletName); } @Override @@ -31,7 +31,14 @@ public class InfoTablet extends ItemDE { @Override public ItemStack onItemRightClick(ItemStack p_77659_1_, World world, EntityPlayer player) { - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_MANUAL, world, (int) player.posX, (int) player.posY, (int) player.posZ); + FMLNetworkHandler.openGui( + player, + DraconicEvolution.instance, + GuiHandler.GUIID_MANUAL, + world, + (int) player.posX, + (int) player.posY, + (int) player.posZ); return super.onItemRightClick(p_77659_1_, world, player); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java index 25c7a90f..a1cd661e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java @@ -14,7 +14,9 @@ public class ItemDE extends Item { @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @@ -25,7 +27,8 @@ public class ItemDE extends Item { @Override @SideOnly(Side.CLIENT) public void registerIcons(final IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + this.itemIcon = iconRegister.registerIcon( + References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java index f42c7c30..2ea15253 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java @@ -1,18 +1,17 @@ package com.brandon3055.draconicevolution.common.items; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.lib.Strings; 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; import net.minecraft.item.ItemStack; -import java.util.List; - /** * Created by Brandon on 27/08/2014. */ @@ -46,10 +45,13 @@ public class Key extends ItemDE { list.add(keyCode == 0 ? "Un-Bound" : "Key Code: " + String.valueOf(keyCode)); if (keyCode != 0) { - list.add("Linked to {X:" + ItemNBTHelper.getInteger(key, "X", 0) + " Y:" + ItemNBTHelper.getInteger(key, "Y", 0) + " X:" + ItemNBTHelper.getInteger(key, "Z", 0) + "}"); + list.add("Linked to {X:" + ItemNBTHelper.getInteger(key, "X", 0) + " Y:" + + ItemNBTHelper.getInteger(key, "Y", 0) + " X:" + ItemNBTHelper.getInteger(key, "Z", 0) + "}"); if (ItemNBTHelper.getInteger(key, "LockCount", 0) == 0) return; for (int i = 1; i <= ItemNBTHelper.getInteger(key, "LockCount", 0); i++) { - list.add("Linked to {X:" + ItemNBTHelper.getInteger(key, "X_" + i, 0) + " Y:" + ItemNBTHelper.getInteger(key, "Y_" + i, 0) + " X:" + ItemNBTHelper.getInteger(key, "Z_" + i, 0) + "}"); + list.add("Linked to {X:" + ItemNBTHelper.getInteger(key, "X_" + i, 0) + " Y:" + + ItemNBTHelper.getInteger(key, "Y_" + i, 0) + " X:" + + ItemNBTHelper.getInteger(key, "Z_" + i, 0) + "}"); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java b/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java index 22a70604..a5139097 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java @@ -1,11 +1,12 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; 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.*; import net.minecraft.entity.player.EntityPlayer; @@ -15,8 +16,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - /** * Created by Brandon on 7/07/2014. */ @@ -37,12 +36,20 @@ public class MobSoul extends ItemDE { @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) { - - } + public void registerIcons(IIconRegister iconRegister) {} @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float p_77648_8_, + float p_77648_9_, + float p_77648_10_) { if (!player.isSneaking()) return false; String name = ItemNBTHelper.getString(stack, "Name", "Pig"); Entity entity = EntityList.createEntityByName(name, world); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java index 8c15b6c2..b4ede07f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java @@ -3,14 +3,13 @@ package com.brandon3055.draconicevolution.common.items; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.References; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - /** * Created by brandon3055 on 8/10/2015. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java index dd01568a..d3d71f8b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java @@ -2,27 +2,28 @@ package com.brandon3055.draconicevolution.common.items; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * Created by brandon3055 on 2/10/2015. */ public class ReactorStabiliserPart extends ItemDE { - public static final Map parts = new HashMap() {{ - put(0, "frame"); - put(1, "rotorInner"); - put(2, "rotorOuter"); - put(3, "rotorAssembly"); - put(4, "stabilizerRing"); - }}; + public static final Map parts = new HashMap() { + { + put(0, "frame"); + put(1, "rotorInner"); + put(2, "rotorOuter"); + put(3, "rotorAssembly"); + put(4, "stabilizerRing"); + } + }; public ReactorStabiliserPart() { this.setUnlocalizedName("reactorCraftingPart"); @@ -44,6 +45,5 @@ public class ReactorStabiliserPart extends ItemDE { } @Override - public void registerIcons(IIconRegister iconRegister) { - } + public void registerIcons(IIconRegister iconRegister) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java b/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java index c7f06073..16cdb485 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java @@ -6,8 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; public class SunFocus extends ItemDE { public SunFocus() { this.setUnlocalizedName(Strings.sunFocusName); - //this.setCreativeTab(DraconicEvolution.tabBlocksItems); + // this.setCreativeTab(DraconicEvolution.tabBlocksItems); ModItems.register(this); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java index 091b7f8a..779dfd7f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java @@ -11,6 +11,7 @@ import cpw.mods.fml.common.FMLCommonHandler; 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.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; @@ -20,16 +21,13 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import java.util.List; - public class Tclogo extends ItemDE { public Tclogo() { this.setUnlocalizedName(Strings.tclogoName); - //this.setCreativeTab(draconicevolution.getCreativeTab()); + // this.setCreativeTab(draconicevolution.getCreativeTab()); ModItems.register(this); } - @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 100; @@ -37,53 +35,55 @@ public class Tclogo extends ItemDE { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { -// if (entity instanceof EntityPlayerMP && !entity.onGround) { -// //for (int i = 0; i < 10; i++) -// EntityPlayer player = (EntityPlayer)entity; -// if (player.posX < 500){ -// -// ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(player.posX + 10, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); -// player.motionX += 10; -// if (player.posX > 128) { -// -// ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(501, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); -// -// } -// -// } -// else player.motionX = 0; + // if (entity instanceof EntityPlayerMP && !entity.onGround) { + // //for (int i = 0; i < 10; i++) + // EntityPlayer player = (EntityPlayer)entity; + // if (player.posX < 500){ + // + // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(player.posX + 10, entity.posY, + // entity.posZ, entity.rotationYaw, entity.rotationPitch); + // player.motionX += 10; + // if (player.posX > 128) { + // + // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(501, entity.posY, entity.posZ, + // entity.rotationYaw, entity.rotationPitch); + // + // } + // + // } + // else player.motionX = 0; - -// ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(entity.posX + 10, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); -// ((EntityPlayerMP) entity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 1000)); -// if (entity.posX > 500) ((EntityPlayerMP) entity).destroyCurrentEquippedItem(); -// } + // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(entity.posX + 10, entity.posY, + // entity.posZ, entity.rotationYaw, entity.rotationPitch); + // ((EntityPlayerMP) entity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 1000)); + // if (entity.posX > 500) ((EntityPlayerMP) entity).destroyCurrentEquippedItem(); + // } /* - //if (entity.isCollidedHorizontally)// && !world.isRemote) - //entity.setLocationAndAngles(entity.posX+30D, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);; - /* - //System.out.println("Update Tick"); - int X = (int)entity.posX; - int Y = (int)entity.posY; - int Z = (int)entity.posZ; - - entity.worldObj.spawnParticle("flame", 613, 5, -822, 0, 0, 0); - if (((EntityPlayer)entity).getHeldItem() != null && ((EntityPlayer)entity).getHeldItem().isItemEqual(new ItemStack(ModItems.tclogo))) - { - - for(int x = X - 5; x <= X + 5; x++) - { - for(int y = Y; y <= Y; y++) - { - for(int z = Z - 5; z <= Z + 5; z++) - { - entity.worldObj.spawnParticle("flame", x - 0.5, y - 0.5, z - 0.5, 0, 0, 0); - entity.worldObj.scheduleBlockUpdate(x, y, z, entity.worldObj.getBlock(x, y, z), 1); - System.out.println("Update Tick " +X+ " " +Y+ " " +Z); - } - } - } - }*/ + //if (entity.isCollidedHorizontally)// && !world.isRemote) + //entity.setLocationAndAngles(entity.posX+30D, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);; + /* + //System.out.println("Update Tick"); + int X = (int)entity.posX; + int Y = (int)entity.posY; + int Z = (int)entity.posZ; + + entity.worldObj.spawnParticle("flame", 613, 5, -822, 0, 0, 0); + if (((EntityPlayer)entity).getHeldItem() != null && ((EntityPlayer)entity).getHeldItem().isItemEqual(new ItemStack(ModItems.tclogo))) + { + + for(int x = X - 5; x <= X + 5; x++) + { + for(int y = Y; y <= Y; y++) + { + for(int z = Z - 5; z <= Z + 5; z++) + { + entity.worldObj.spawnParticle("flame", x - 0.5, y - 0.5, z - 0.5, 0, 0, 0); + entity.worldObj.scheduleBlockUpdate(x, y, z, entity.worldObj.getBlock(x, y, z), 1); + System.out.println("Update Tick " +X+ " " +Y+ " " +Z); + } + } + } + }*/ } @Override @@ -100,288 +100,291 @@ public class Tclogo extends ItemDE { private void particle(World world, EntityPlayer player) { MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 10000); if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - FMLClientHandler.instance().getClient().effectRenderer.addEffect(new Particles.ReactorExplosionParticle(world, mop.blockX, mop.blockY, mop.blockZ, 100)); - + FMLClientHandler.instance() + .getClient() + .effectRenderer + .addEffect(new Particles.ReactorExplosionParticle(world, mop.blockX, mop.blockY, mop.blockZ, 100)); } - @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - //int meta = Integer.parseInt()); + // int meta = Integer.parseInt()); LogHelper.info("21=vserfegz".substring(0, "21=vserfegz".indexOf("="))); try { if (!world.isRemote) { - //ExtendedPlayer.get(player).setSpawnCount(6); + // ExtendedPlayer.get(player).setSpawnCount(6); LogHelper.info(ExtendedPlayer.get(player).getSpawnCount()); // player.getEntityData().setTag("Tag", new NBTTagCompound()); } else LogHelper.info(ExtendedPlayer.get(player).getSpawnCount()); - //LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().func_152358_ax().func_152655_a(player.getCommandSenderName()).getId()); - //LogHelper.info(player.getUniqueID()); - //LogHelper.info(UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8))); - //LogHelper.info(UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)).equals(player.getUniqueID())); + // LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().func_152358_ax().func_152655_a(player.getCommandSenderName()).getId()); + // LogHelper.info(player.getUniqueID()); + // LogHelper.info(UUID.nameUUIDFromBytes(("OfflinePlayer:" + + // player.getCommandSenderName()).getBytes(Charsets.UTF_8))); + // LogHelper.info(UUID.nameUUIDFromBytes(("OfflinePlayer:" + + // player.getCommandSenderName()).getBytes(Charsets.UTF_8)).equals(player.getUniqueID())); if (FMLCommonHandler.instance().getMinecraftServerInstance() instanceof IntegratedServer) { // LogHelper.info(FMLClientHandler.instance().getClient().getSession().getToken()); // LogHelper.info(((YggdrasilMinecraftSessionService)FMLCommonHandler.instance().getMinecraftServerInstance().func_147130_as()).getAuthenticationService().); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } -// LogHelper.info(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode()); -// -// ResourceLocation rs = new ResourceLocation(References.RESOURCESPREFIX + "manual-en_US.json"); -// -// try { -// LogHelper.info(Minecraft.getMinecraft().getResourceManager().getResource(rs)); -// } -// catch (IOException e) { -// e.printStackTrace(); -// } + // LogHelper.info(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode()); + // + // ResourceLocation rs = new ResourceLocation(References.RESOURCESPREFIX + "manual-en_US.json"); + // + // try { + // LogHelper.info(Minecraft.getMinecraft().getResourceManager().getResource(rs)); + // } + // catch (IOException e) { + // e.printStackTrace(); + // } + // if ((int)System.currentTimeMillis() < lts + 10) return stack; + // else lts = (int)System.currentTimeMillis(); + // world.playSound(player.posX, player.posY, player.posZ, "DraconicEvolution:fusionExplosion", 1F, 1F, false); + // LogHelper.info(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_0")); + // if (player.inventory.getStackInSlot(0) != null) + // LogHelper.info(GameRegistry.findUniqueIdentifierFor(player.inventory.getStackInSlot(0).getItem())); + // + // if (world.isRemote){ + // particle(world, player); + // //if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + // ProcessHandler.addProcess(new ReactorExplosion(world, mop.blockX, mop.blockY, mop.blockZ, 10F)); + // } + // else { + // MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 10000); + // //LogHelper.info(mop); + // //FMLClientHandler.instance().getClient().effectRenderer.addEffect(new + // Particles.ReactorExplosionParticle(world, mop.blockX, mop.blockY, mop.blockZ)); + // if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + // ProcessHandler.addProcess(new ReactorExplosion(world, mop.blockX, mop.blockY, mop.blockZ, 20F)); + // } -// if ((int)System.currentTimeMillis() < lts + 10) return stack; -// else lts = (int)System.currentTimeMillis(); - //world.playSound(player.posX, player.posY, player.posZ, "DraconicEvolution:fusionExplosion", 1F, 1F, false); -// LogHelper.info(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_0")); -// if (player.inventory.getStackInSlot(0) != null) LogHelper.info(GameRegistry.findUniqueIdentifierFor(player.inventory.getStackInSlot(0).getItem())); -// -// if (world.isRemote){ -// particle(world, player); -// //if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) ProcessHandler.addProcess(new ReactorExplosion(world, mop.blockX, mop.blockY, mop.blockZ, 10F)); -// } -// else { -// MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 10000); -// //LogHelper.info(mop); -// //FMLClientHandler.instance().getClient().effectRenderer.addEffect(new Particles.ReactorExplosionParticle(world, mop.blockX, mop.blockY, mop.blockZ)); -// if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) ProcessHandler.addProcess(new ReactorExplosion(world, mop.blockX, mop.blockY, mop.blockZ, 20F)); -// } - - //EntityDragonProjectile projectile = new EntityDragonProjectile(world, 6, null, 10, player); - //projectile.setPosition(player.posX, player.posY, player.posZ); - - -// -// if (!world.isRemote) -// { -// int x = 45622; -// LogHelper.info("45622".hashCode()); -// -// -// File file = new File("C:/Users/Brandon/Desktop/0to"+String.valueOf(Integer.MAX_VALUE)+".txt"); -// -// try { -// FileWriter writer = new FileWriter(file); -// for (int i = 0; i < Integer.MAX_VALUE; i++) writer.write(i+","); -// writer.close(); -// LogHelper.info("Done"); -// } -// catch (Exception e) { -// e.printStackTrace(); -// } -// -// -// int xCoord = 0; -// int yCoord = 0; -// int zCoord = 0; -// -// -// -// int locationHash = (String.valueOf(xCoord)+String.valueOf(yCoord)+String.valueOf(zCoord)).hashCode(); -// -// + // EntityDragonProjectile projectile = new EntityDragonProjectile(world, 6, null, 10, player); + // projectile.setPosition(player.posX, player.posY, player.posZ); + // + // if (!world.isRemote) + // { + // int x = 45622; + // LogHelper.info("45622".hashCode()); + // + // + // File file = new File("C:/Users/Brandon/Desktop/0to"+String.valueOf(Integer.MAX_VALUE)+".txt"); + // + // try { + // FileWriter writer = new FileWriter(file); + // for (int i = 0; i < Integer.MAX_VALUE; i++) writer.write(i+","); + // writer.close(); + // LogHelper.info("Done"); + // } + // catch (Exception e) { + // e.printStackTrace(); + // } + // + // + // int xCoord = 0; + // int yCoord = 0; + // int zCoord = 0; + // + // + // + // int locationHash = (String.valueOf(xCoord)+String.valueOf(yCoord)+String.valueOf(zCoord)).hashCode(); + // + // // LogHelper.info(ContributorHandler.contributors); // ContributorHandler.init(); // LogHelper.info(ContributorHandler.contributors); - //EntityFallingBlock fallingBlock = new EntityFallingBlock(world, (int)player.posX + 0.5, (int)player.posY + 0.5, (int)player.posZ + 0.5, Blocks.obsidian, 0); - //fallingBlock.field_145812_b = 2; + // EntityFallingBlock fallingBlock = new EntityFallingBlock(world, (int)player.posX + 0.5, (int)player.posY + + // 0.5, (int)player.posZ + 0.5, Blocks.obsidian, 0); + // fallingBlock.field_145812_b = 2; float motion = 0.005F; - //fallingBlock.motionX = (rand.nextFloat()-0.5F) * motion; - //fallingBlock.motionY = (rand.nextFloat()-0.5F) * motion; - //fallingBlock.motionZ = (rand.nextFloat()-0.5F) * motion; - //world.spawnEntityInWorld(fallingBlock); + // fallingBlock.motionX = (rand.nextFloat()-0.5F) * motion; + // fallingBlock.motionY = (rand.nextFloat()-0.5F) * motion; + // fallingBlock.motionZ = (rand.nextFloat()-0.5F) * motion; + // world.spawnEntityInWorld(fallingBlock); + // try + // { + // for (Object o : AchievementList.achievementList) + // { + // LogHelper.info(o); + // if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) + // player).func_147099_x().hasAchievementUnlocked((Achievement) o)); + // if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) + // player).func_147099_x().canUnlockAchievement((Achievement) o)); + // LogHelper.info(o instanceof Achievement); + // } + // + // //LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList); + // } + // catch (Exception e) {e.printStackTrace();} -// try -// { -// for (Object o : AchievementList.achievementList) -// { -// LogHelper.info(o); -// if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) player).func_147099_x().hasAchievementUnlocked((Achievement) o)); -// if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) player).func_147099_x().canUnlockAchievement((Achievement) o)); -// LogHelper.info(o instanceof Achievement); -// } -// //LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList); -// } -// catch (Exception e) {e.printStackTrace();} + // LogHelper.info(); - //LogHelper.info(); + // LogHelper.info("#########################"); + // Map blocks = new HashMap(); + // List l = new ArrayList(); + // int rand = itemRand.nextInt(); + // + // long u = System.nanoTime(); + // + // for (int i = 0; i < 100000; i++) blocks.containsKey(i+rand); + // + // LogHelper.info("Time1:"+(System.nanoTime()-u)/1000000D); + // u = System.nanoTime(); + // + // for (int i = 0; i < 100000; i++) l.get(i + rand); + // + // LogHelper.info("Time2:"+(System.nanoTime()-u)/1000000D); -// LogHelper.info("#########################"); -// Map blocks = new HashMap(); -// List l = new ArrayList(); + // DraconicWorldGenerator.chaosIslandGen = new WorldGenChaosIsland(); + // LogHelper.info("Reinitialized"); + // long u = System.nanoTime(); + // long m = System.currentTimeMillis(); + // BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); + // LogHelper.info(blocks.getIndex(30285000, 45, -30927500)); + //// + // LogHelper.info("Generated in:"+(System.nanoTime()-u)+"ns, "+(System.currentTimeMillis()-m)+"ms"); + // for (float f = 0; f < 1; f+=0.01) LogHelper.info((0.5D-Math.abs(f-0.5D))*2D); -// int rand = itemRand.nextInt(); -// -// long u = System.nanoTime(); -// -// for (int i = 0; i < 100000; i++) blocks.containsKey(i+rand); -// -// LogHelper.info("Time1:"+(System.nanoTime()-u)/1000000D); -// u = System.nanoTime(); -// -// for (int i = 0; i < 100000; i++) l.get(i + rand); -// -// LogHelper.info("Time2:"+(System.nanoTime()-u)/1000000D); + // short id = (short)itemRand.nextInt(4000); + // byte meta = (byte)itemRand.nextInt(16); + // LogHelper.info("#########################"); + // LogHelper.info("ID:"+id+" Meta:"+meta); + // + // byte data1 = (byte)(id >> 4); + // byte data2 = (byte)(((id & 0xF) << 4) | meta); + // + // int decodedID = (((data1 & 0xFF) << 4) | ((data2 & 0xF0) >> 4)); + // int decodedMeta = (data2 & 0x0F); + // LogHelper.info("DecodedID:"+decodedID+" DecodedMeta:"+decodedMeta); + // LogHelper.info(Integer.toBinaryString(id) + " "+Integer.toBinaryString(meta)); + // LogHelper.info(Integer.toBinaryString(id >> 4) +" " +Integer.toBinaryString(id & 0xF)); + // LogHelper.info(id+" "+meta); + //// LogHelper.info(b1+" "+b2); + // LogHelper.info(Integer.toBinaryString(b1 & 0xFF)+" "+Integer.toBinaryString(b2 & 0xFF));// +" " + // +Integer.toBinaryString(0xF0)); + //// LogHelper.info((((b1 & 0xF0) << 8) + (b2 & 0xFF)) +" "+meta); + // LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4)) +" "+ Integer.toBinaryString(((b2 & 0xF0) + // >>> 4))); + // LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4) | ((b2 & 0xF0) >> 4))+" "+(((b1 & 0xFF) << + // 4) | ((b2 & 0xF0) >> 4))); + // LogHelper.info("Meta: "+Integer.toBinaryString(b2 & 0x0F)+" "+(b2 & 0x0F)); + // LogHelper.info("Meta: "+Integer.toBinaryString(4095)); -// DraconicWorldGenerator.chaosIslandGen = new WorldGenChaosIsland(); -// LogHelper.info("Reinitialized"); -// long u = System.nanoTime(); -// long m = System.currentTimeMillis(); -// BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); -// LogHelper.info(blocks.getIndex(30285000, 45, -30927500)); -//// -// LogHelper.info("Generated in:"+(System.nanoTime()-u)+"ns, "+(System.currentTimeMillis()-m)+"ms"); + // for (int index = 0; index < blockId.length; index++) { + // if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index + // blocks[index] = (short) (blockId[index] & 0xFF); + // } else { + // if ((index & 1) != 0) { + // blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (short) (blockId[index] & 0xFF)); + // } else { + // blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (short) (blockId[index] & 0xFF)); + // } + // } + // } - //for (float f = 0; f < 1; f+=0.01) LogHelper.info((0.5D-Math.abs(f-0.5D))*2D); + // long s = (652800000L * 8L) + (652800000L * 8L); + // LogHelper.info((s / 1000000000D) / 8D); -// short id = (short)itemRand.nextInt(4000); -// byte meta = (byte)itemRand.nextInt(16); -// LogHelper.info("#########################"); -// LogHelper.info("ID:"+id+" Meta:"+meta); -// -// byte data1 = (byte)(id >> 4); -// byte data2 = (byte)(((id & 0xF) << 4) | meta); -// -// int decodedID = (((data1 & 0xFF) << 4) | ((data2 & 0xF0) >> 4)); -// int decodedMeta = (data2 & 0x0F); -// LogHelper.info("DecodedID:"+decodedID+" DecodedMeta:"+decodedMeta); + // int posX = (int)player.posX; + // int posZ = (int)player.posZ; + // + // BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); + // LogHelper.info("Generated"); + // + // for (int x = -400; x < 400; x++){ + // for (int y = 0; y < 255; y++){ + // for (int z = -400; z < 400; z++){ + // world.setBlock(posX+x, y, posZ+z, blocks.getBlock(x, y, z)); + // } + // } + // System.out.print(x+", "); + // } + // int rand1 = itemRand.nextInt(); + // int rand2 = itemRand.nextInt(); + // int rand3 = itemRand.nextInt(); + // int rand4 = itemRand.nextInt(); + // int rand5 = itemRand.nextInt(); + // int rand6 = itemRand.nextInt(); + // + // long l = System.currentTimeMillis(); + // for (int i = 0; i < 2000000000; i++){ + // + // int x1 = rand1 + i; + // int x2 = rand2 + i; + // int y1 = rand3 + i; + // int y2 = rand4 + i; + // int z1 = rand5 + i; + // int z2 = rand6 + i; + // + // double dx = x1-x2; + // double dy = y1-y2; + // double dz = z1-z2; + // double d = dx * dx + dy * dy + dz * dz; + // Math.sqrt(d+i); + // } + // LogHelper.info("Time 1:"+ (System.currentTimeMillis()-l)); -// LogHelper.info(Integer.toBinaryString(id) + " "+Integer.toBinaryString(meta)); -// LogHelper.info(Integer.toBinaryString(id >> 4) +" " +Integer.toBinaryString(id & 0xF)); -// LogHelper.info(id+" "+meta); -//// LogHelper.info(b1+" "+b2); -// LogHelper.info(Integer.toBinaryString(b1 & 0xFF)+" "+Integer.toBinaryString(b2 & 0xFF));// +" " +Integer.toBinaryString(0xF0)); -//// LogHelper.info((((b1 & 0xF0) << 8) + (b2 & 0xFF)) +" "+meta); -// LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4)) +" "+ Integer.toBinaryString(((b2 & 0xF0) >>> 4))); -// LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4) | ((b2 & 0xF0) >> 4))+" "+(((b1 & 0xFF) << 4) | ((b2 & 0xF0) >> 4))); -// LogHelper.info("Meta: "+Integer.toBinaryString(b2 & 0x0F)+" "+(b2 & 0x0F)); -// LogHelper.info("Meta: "+Integer.toBinaryString(4095)); - - -// for (int index = 0; index < blockId.length; index++) { -// if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index -// blocks[index] = (short) (blockId[index] & 0xFF); -// } else { -// if ((index & 1) != 0) { -// blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (short) (blockId[index] & 0xFF)); -// } else { -// blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (short) (blockId[index] & 0xFF)); -// } -// } -// } - - -// long s = (652800000L * 8L) + (652800000L * 8L); -// LogHelper.info((s / 1000000000D) / 8D); - -// int posX = (int)player.posX; -// int posZ = (int)player.posZ; -// -// BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); -// LogHelper.info("Generated"); -// -// for (int x = -400; x < 400; x++){ -// for (int y = 0; y < 255; y++){ -// for (int z = -400; z < 400; z++){ -// world.setBlock(posX+x, y, posZ+z, blocks.getBlock(x, y, z)); -// } -// } -// System.out.print(x+", "); -// } - - -// int rand1 = itemRand.nextInt(); -// int rand2 = itemRand.nextInt(); -// int rand3 = itemRand.nextInt(); -// int rand4 = itemRand.nextInt(); -// int rand5 = itemRand.nextInt(); -// int rand6 = itemRand.nextInt(); -// -// long l = System.currentTimeMillis(); -// for (int i = 0; i < 2000000000; i++){ -// -// int x1 = rand1 + i; -// int x2 = rand2 + i; -// int y1 = rand3 + i; -// int y2 = rand4 + i; -// int z1 = rand5 + i; -// int z2 = rand6 + i; -// -// double dx = x1-x2; -// double dy = y1-y2; -// double dz = z1-z2; -// double d = dx * dx + dy * dy + dz * dz; -// Math.sqrt(d+i); -// } -// LogHelper.info("Time 1:"+ (System.currentTimeMillis()-l)); - - -// long l = System.currentTimeMillis(); -// new WorldGenChaosIsland().initialize(world.rand); -// LogHelper.info(System.currentTimeMillis() - l); -// -// - + // long l = System.currentTimeMillis(); + // new WorldGenChaosIsland().initialize(world.rand); + // LogHelper.info(System.currentTimeMillis() - l); + // + // // } - //List l = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX, player.posY, player.posZ).expand(500, 500, 500)); - //for (Entity e : l) if (!(e instanceof EntityPlayer)) e.setDead(); + // List l = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(player.posX, + // player.posY, player.posZ, player.posX, player.posY, player.posZ).expand(500, 500, 500)); + // for (Entity e : l) if (!(e instanceof EntityPlayer)) e.setDead(); - //if (1==1) return stack; - /*if (player instanceof EntityPlayerMP) { - for (int i = 0; i < 10; i++) - ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(player.posX + 1, player.posY, player.posZ, player.rotationYaw, player.rotationPitch); - } + // if (1==1) return stack; + /*if (player instanceof EntityPlayerMP) { + for (int i = 0; i < 10; i++) + ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(player.posX + 1, player.posY, player.posZ, player.rotationYaw, player.rotationPitch); + } - if (1==1) return stack;*/ + if (1==1) return stack;*/ - //Minecraft.getMinecraft().gameSettings.mouseSensitivity = -0.34F; - -// if (world.isRemote) -// { -// ResourceHandler.init(null); -// String str = "A String"; -// IChatComponent localIChatComponent; -// -// -// localIChatComponent = IChatComponent.Serializer.func_150699_a("[{\"text\":\"" + str + "\",\"color\":\"aqua\"}," + "{\"text\":\" " + EnumChatFormatting.WHITE + "[" + EnumChatFormatting.GREEN + -// "info.cofh.updater.download" + EnumChatFormatting.WHITE + "]\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + -// -// "info.cofh.updater.tooltip" + ".\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "www.google.com" + "\"}}]"); -// -// //player.addChatMessage(localIChatComponent); -// } -// else -// { -// //for (Object o : EntityList.classToStringMapping.values()) LogHelper.info(o); -// } + // Minecraft.getMinecraft().gameSettings.mouseSensitivity = -0.34F; + // if (world.isRemote) + // { + // ResourceHandler.init(null); + // String str = "A String"; + // IChatComponent localIChatComponent; + // + // + // localIChatComponent = IChatComponent.Serializer.func_150699_a("[{\"text\":\"" + str + + // "\",\"color\":\"aqua\"}," + "{\"text\":\" " + EnumChatFormatting.WHITE + "[" + EnumChatFormatting.GREEN + + // "info.cofh.updater.download" + EnumChatFormatting.WHITE + "]\"," + + // "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + + // + // "info.cofh.updater.tooltip" + ".\",\"color\":\"yellow\"}}," + + // "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "www.google.com" + "\"}}]"); + // + // //player.addChatMessage(localIChatComponent); + // } + // else + // { + // //for (Object o : EntityList.classToStringMapping.values()) LogHelper.info(o); + // } if (!player.isSneaking()) { player.capabilities.allowFlying = true; - //player.setPosition(player.posX, player.posY+1, player.posZ); + // player.setPosition(player.posX, player.posY+1, player.posZ); player.onGround = false; player.capabilities.isFlying = true; player.noClip = !player.noClip; @@ -400,64 +403,60 @@ public class Tclogo extends ItemDE { } } - world.markBlockRangeForRenderUpdate(xi - rad, yi - 20, zi - rad, xi + rad, yi + 20, zi + rad); } -// -// LogHelper.info("Downloading Image"); -// -// try { -// URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); -// String fileName = url.getFile(); -// String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/")); -// System.out.println(destName); -// -// InputStream is = url.openStream(); -// OutputStream os = new FileOutputStream(destName); -// -// byte[] b = new byte[2048]; -// int length; -// -// while ((length = is.read(b)) != -1) { -// os.write(b, 0, length); -// } -// -// is.close(); -// os.close(); -// }catch (IOException e){ -// LogHelper.info(e); -// } + // + // LogHelper.info("Downloading Image"); + // + // try { + // URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); + // String fileName = url.getFile(); + // String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/")); + // System.out.println(destName); + // + // InputStream is = url.openStream(); + // OutputStream os = new FileOutputStream(destName); + // + // byte[] b = new byte[2048]; + // int length; + // + // while ((length = is.read(b)) != -1) { + // os.write(b, 0, length); + // } + // + // is.close(); + // os.close(); + // }catch (IOException e){ + // LogHelper.info(e); + // } - -// player.addPotionEffect(new PotionEffect(PotionHandler.potionFlight.id, 100, 0)); -// player.addPotionEffect(new PotionEffect(PotionHandler.potionFireResist.id, 100, 1)); -// player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 100, 1)); -// player.addPotionEffect(new PotionEffect(PotionHandler.potionUpHillStep.id, 100, 1)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionFlight.id, 100, 0)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionFireResist.id, 100, 1)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 100, 1)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionUpHillStep.id, 100, 1)); int xi = (int) player.posX; int yi = (int) player.posY; int zi = (int) player.posZ; int rad = 1000; -// Block block; -// for (int x = xi-rad; x < xi+rad; x++){ -// for (int y = yi-10; y < yi+30; y++){ -// for (int z = zi-rad; z < zi+rad; z++){ -// // block = world.getBlock(x, y, z); -// //if (block.getMaterial().equals(Material.vine) || block.getMaterial().equals(Material.plants)){ -// //world.setBlockToAir(x, y, z); -// //} -// -// //world.markBlockForUpdate(x, y, z); -// } -// } -// } - - - //world.markBlockRangeForRenderUpdate(xi-rad, yi-rad, zi-rad, xi+rad, yi+rad, zi+rad); - //if (world.isRemote)player.displayGUIWorkbench((int)player.posX, (int)player.posY, (int)player.posZ); - //world.setBlock(0, 0, 0, Blocks.crafting_table); - //if (!world.isRemote)player.displayGUIWorkbench(0, 0, 0); + // Block block; + // for (int x = xi-rad; x < xi+rad; x++){ + // for (int y = yi-10; y < yi+30; y++){ + // for (int z = zi-rad; z < zi+rad; z++){ + // // block = world.getBlock(x, y, z); + // //if (block.getMaterial().equals(Material.vine) || block.getMaterial().equals(Material.plants)){ + // //world.setBlockToAir(x, y, z); + // //} + // + // //world.markBlockForUpdate(x, y, z); + // } + // } + // } + // world.markBlockRangeForRenderUpdate(xi-rad, yi-rad, zi-rad, xi+rad, yi+rad, zi+rad); + // if (world.isRemote)player.displayGUIWorkbench((int)player.posX, (int)player.posY, (int)player.posZ); + // world.setBlock(0, 0, 0, Blocks.crafting_table); + // if (!world.isRemote)player.displayGUIWorkbench(0, 0, 0); return stack; } @@ -466,7 +465,7 @@ public class Tclogo extends ItemDE { public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) { LogHelper.info(GameRegistry.findUniqueIdentifierFor(player.worldObj.getBlock(X, Y, Z))); - //player.worldObj.scheduleBlockUpdate(X, Y, Z, player.worldObj.getBlock(X, Y, Z), 10); + // player.worldObj.scheduleBlockUpdate(X, Y, Z, player.worldObj.getBlock(X, Y, Z), 10); return false; } @@ -479,32 +478,34 @@ public class Tclogo extends ItemDE { @Override @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { - list.add(EnumChatFormatting.RED + "Warning! this is an item used to test random bits of code. You should not play with it"); + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + list.add(EnumChatFormatting.RED + + "Warning! this is an item used to test random bits of code. You should not play with it"); list.add(EnumChatFormatting.RED + "because depending on what i used it for last it could do anything."); list.add(EnumChatFormatting.RED + "It may even break your world"); list.add("At the time this warning was added it created a 200x200 block smoking creator"); -// list.add(EnumChatFormatting.AQUA + "AQUA"); -// list.add(EnumChatFormatting.BLACK + "BLACK"); -// list.add(EnumChatFormatting.BLUE + "BLUE"); -// list.add(EnumChatFormatting.DARK_AQUA + "DARK_AQUA"); -// list.add(EnumChatFormatting.DARK_BLUE + "DARK_BLUE"); -// list.add(EnumChatFormatting.DARK_GRAY + "DARK_GRAY"); -// list.add(EnumChatFormatting.DARK_GREEN + "DARK_GREEN"); -// list.add(EnumChatFormatting.DARK_PURPLE + "DARK_PURPLE"); -// list.add(EnumChatFormatting.DARK_RED + "DARK_RED"); -// list.add(EnumChatFormatting.GOLD + "GOLD"); -// list.add(EnumChatFormatting.GRAY + "GRAY"); -// list.add(EnumChatFormatting.GREEN + "GREEN"); -// list.add(EnumChatFormatting.LIGHT_PURPLE + "LIGHT_PURPLE"); -// list.add(EnumChatFormatting.RED + "RED"); -// list.add(EnumChatFormatting.WHITE + "WHITE"); -// list.add(EnumChatFormatting.YELLOW + "YELLOW"); -// list.add(EnumChatFormatting.BOLD + "BOLD"); -// list.add(EnumChatFormatting.ITALIC + "ITALIC"); -// list.add(EnumChatFormatting.OBFUSCATED + "OBFUSCATED"); -// list.add(EnumChatFormatting.UNDERLINE + "UNDERLINE"); -// list.add(EnumChatFormatting.STRIKETHROUGH + "STRIKETHROUGH"); + // list.add(EnumChatFormatting.AQUA + "AQUA"); + // list.add(EnumChatFormatting.BLACK + "BLACK"); + // list.add(EnumChatFormatting.BLUE + "BLUE"); + // list.add(EnumChatFormatting.DARK_AQUA + "DARK_AQUA"); + // list.add(EnumChatFormatting.DARK_BLUE + "DARK_BLUE"); + // list.add(EnumChatFormatting.DARK_GRAY + "DARK_GRAY"); + // list.add(EnumChatFormatting.DARK_GREEN + "DARK_GREEN"); + // list.add(EnumChatFormatting.DARK_PURPLE + "DARK_PURPLE"); + // list.add(EnumChatFormatting.DARK_RED + "DARK_RED"); + // list.add(EnumChatFormatting.GOLD + "GOLD"); + // list.add(EnumChatFormatting.GRAY + "GRAY"); + // list.add(EnumChatFormatting.GREEN + "GREEN"); + // list.add(EnumChatFormatting.LIGHT_PURPLE + "LIGHT_PURPLE"); + // list.add(EnumChatFormatting.RED + "RED"); + // list.add(EnumChatFormatting.WHITE + "WHITE"); + // list.add(EnumChatFormatting.YELLOW + "YELLOW"); + // list.add(EnumChatFormatting.BOLD + "BOLD"); + // list.add(EnumChatFormatting.ITALIC + "ITALIC"); + // list.add(EnumChatFormatting.OBFUSCATED + "OBFUSCATED"); + // list.add(EnumChatFormatting.UNDERLINE + "UNDERLINE"); + // list.add(EnumChatFormatting.STRIKETHROUGH + "STRIKETHROUGH"); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java index e2032484..f334820f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java @@ -10,4 +10,4 @@ public class WyvernCore extends ItemDE { this.setCreativeTab(DraconicEvolution.tabBlocksItems); ModItems.register(this); } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java index 83385665..17b81513 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java @@ -11,6 +11,7 @@ import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.integration.ModHelper; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.network.NetworkRegistry; +import java.util.*; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.IAttribute; @@ -24,55 +25,60 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; -import java.util.*; - /** * Created by Brandon on 13/11/2014. */ public class CustomArmorHandler { public static final UUID WALK_SPEED_UUID = UUID.fromString("0ea6ce8e-d2e8-11e5-ab30-625662870761"); - private static final DamageSource ADMIN_KILL = new DamageSource("administrative.kill").setDamageAllowedInCreativeMode().setDamageBypassesArmor().setDamageIsAbsolute(); + private static final DamageSource ADMIN_KILL = new DamageSource("administrative.kill") + .setDamageAllowedInCreativeMode() + .setDamageBypassesArmor() + .setDamageIsAbsolute(); public static Map playersWithFlight = new WeakHashMap(); public static List playersWithUphillStep = new ArrayList(); public static void onPlayerHurt(LivingHurtEvent event) { -// EntityPlayer player = (EntityPlayer) event.entityLiving; -// ArmorSummery summery = new ArmorSummery().getSummery(player); -// if (summery == null || summery.protectionPoints <= 0) return; -// float newEntropy = Math.min(summery.entropy + Math.min(3, event.ammount/5) + player.worldObj.rand.nextFloat(), 100F); -// -// //Divide the damage between the armor peaces based on how many of the protection points each peace has -// float totalAbsorbed = 0; -// for (int i = 0; i < summery.allocation.length; i++){ -// if (summery.allocation[i] == 0) continue; -// ItemStack armorPeace = summery.armorStacks[i]; -// -// float dmgShear = summery.allocation[i] / summery.protectionPoints; -// float dmg = dmgShear * event.ammount; -// -// float absorbed = Math.min(dmg, summery.allocation[i]); -// dmg -= absorbed; -// totalAbsorbed += absorbed; -// summery.allocation[i]-=absorbed; -// ItemNBTHelper.setFloat(armorPeace, "ProtectionPoints", summery.allocation[i]); -// ItemNBTHelper.setInteger(armorPeace, "ShieldHitTimer", 20); -// ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", newEntropy); -// -//// if (dmg > 0 && absorbed >= dmgShear*20F){ -//// int energyCost = (int)(dmg * OVER_DRAIN_COST); -//// int extracted = ((IEnergyContainerItem)armorPeace.getItem()).extractEnergy(armorPeace, energyCost, false); -//// dmg = (energyCost-extracted) / OVER_DRAIN_COST; -//// totalAbsorbed += extracted / OVER_DRAIN_COST; -//// ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", 100); -//// } -// -//// LogHelper.info(dmg); -// } -// -// event.ammount-=totalAbsorbed; -// if (event.ammount <= 0) event.setCanceled(true); -// player.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).removeModifier(new AttributeModifier(KB_ATTRIB_UUID, SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), 100, 0)); -// LogHelper.info("hurt"); + // EntityPlayer player = (EntityPlayer) event.entityLiving; + // ArmorSummery summery = new ArmorSummery().getSummery(player); + // if (summery == null || summery.protectionPoints <= 0) return; + // float newEntropy = Math.min(summery.entropy + Math.min(3, event.ammount/5) + + // player.worldObj.rand.nextFloat(), 100F); + // + // //Divide the damage between the armor peaces based on how many of the protection points each peace has + // float totalAbsorbed = 0; + // for (int i = 0; i < summery.allocation.length; i++){ + // if (summery.allocation[i] == 0) continue; + // ItemStack armorPeace = summery.armorStacks[i]; + // + // float dmgShear = summery.allocation[i] / summery.protectionPoints; + // float dmg = dmgShear * event.ammount; + // + // float absorbed = Math.min(dmg, summery.allocation[i]); + // dmg -= absorbed; + // totalAbsorbed += absorbed; + // summery.allocation[i]-=absorbed; + // ItemNBTHelper.setFloat(armorPeace, "ProtectionPoints", summery.allocation[i]); + // ItemNBTHelper.setInteger(armorPeace, "ShieldHitTimer", 20); + // ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", newEntropy); + // + //// if (dmg > 0 && absorbed >= dmgShear*20F){ + //// int energyCost = (int)(dmg * OVER_DRAIN_COST); + //// int extracted = ((IEnergyContainerItem)armorPeace.getItem()).extractEnergy(armorPeace, energyCost, + // false); + //// dmg = (energyCost-extracted) / OVER_DRAIN_COST; + //// totalAbsorbed += extracted / OVER_DRAIN_COST; + //// ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", 100); + //// } + // + //// LogHelper.info(dmg); + // } + // + // event.ammount-=totalAbsorbed; + // if (event.ammount <= 0) event.setCanceled(true); + // player.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).removeModifier(new + // AttributeModifier(KB_ATTRIB_UUID, SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + // 100, 0)); + // LogHelper.info("hurt"); } public static void onPlayerAttacked(LivingAttackEvent event) { @@ -92,7 +98,7 @@ public class CustomArmorHandler { return; } event.setCanceled(true); - //Ensure that the /kill command can still kill the player + // Ensure that the /kill command can still kill the player if (hitAmount == Float.MAX_VALUE && !event.source.damageType.equals(ADMIN_KILL.damageType)) { player.attackEntityFrom(ADMIN_KILL, Float.MAX_VALUE); return; @@ -101,7 +107,7 @@ public class CustomArmorHandler { float newEntropy = Math.min(summery.entropy + 1 + (hitAmount / 20), 100F); - //Divide the damage between the armor peaces based on how many of the protection points each peace has + // Divide the damage between the armor peaces based on how many of the protection points each peace has float totalAbsorbed = 0; int remainingPoints = 0; for (int i = 0; i < summery.allocation.length; i++) { @@ -120,8 +126,16 @@ public class CustomArmorHandler { } if (summery.protectionPoints > 0) { - DraconicEvolution.network.sendToAllAround(new ShieldHitPacket(player, summery.protectionPoints / summery.maxProtectionPoints), new NetworkRegistry.TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 64)); - player.worldObj.playSoundEffect(player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, "draconicevolution:shieldStrike", 0.9F, player.worldObj.rand.nextFloat() * 0.1F + 1.055F); + DraconicEvolution.network.sendToAllAround( + new ShieldHitPacket(player, summery.protectionPoints / summery.maxProtectionPoints), + new NetworkRegistry.TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 64)); + player.worldObj.playSoundEffect( + player.posX + 0.5D, + player.posY + 0.5D, + player.posZ + 0.5D, + "draconicevolution:shieldStrike", + 0.9F, + player.worldObj.rand.nextFloat() * 0.1F + 1.055F); } if (remainingPoints > 0) { @@ -144,7 +158,8 @@ public class CustomArmorHandler { if (summery.protectionPoints > 500) { event.setCanceled(true); event.entityLiving.setHealth(10); - // LogHelper.warn("Something is trying to bypass the draconic shield. [Culprit: {Damage Type=" + event.source.damageType + ", Damage Class=" + event.source.toString() + "]"); + // LogHelper.warn("Something is trying to bypass the draconic shield. [Culprit: {Damage Type=" + + // event.source.damageType + ", Damage Class=" + event.source.toString() + "]"); return; } @@ -154,7 +169,8 @@ public class CustomArmorHandler { int totalCharge = 0; for (int i = 0; i < summery.armorStacks.length; i++) { if (summery.armorStacks[i] != null) { - charge[i] = ((IEnergyContainerItem) summery.armorStacks[i].getItem()).getEnergyStored(summery.armorStacks[i]); + charge[i] = ((IEnergyContainerItem) summery.armorStacks[i].getItem()) + .getEnergyStored(summery.armorStacks[i]); totalCharge += charge[i]; } } @@ -163,11 +179,17 @@ public class CustomArmorHandler { for (int i = 0; i < summery.armorStacks.length; i++) { if (summery.armorStacks[i] != null) { - ((IEnergyContainerItem) summery.armorStacks[i].getItem()).extractEnergy(summery.armorStacks[i], (int) ((charge[i] / (double) totalCharge) * BalanceConfigHandler.draconicArmorBaseStorage), false); + ((IEnergyContainerItem) summery.armorStacks[i].getItem()) + .extractEnergy( + summery.armorStacks[i], + (int) ((charge[i] / (double) totalCharge) + * BalanceConfigHandler.draconicArmorBaseStorage), + false); } } - player.addChatComponentMessage(new ChatComponentTranslation("msg.de.shieldDepleted.txt").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED))); + player.addChatComponentMessage(new ChatComponentTranslation("msg.de.shieldDepleted.txt") + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED))); event.setCanceled(true); player.setHealth(1); } @@ -182,12 +204,19 @@ public class CustomArmorHandler { } public static void tickShield(ArmorSummery summery, EntityPlayer player) { - if (summery == null || (summery.maxProtectionPoints - summery.protectionPoints < 0.01 && summery.entropy == 0) || player.worldObj.isRemote) - return; + if (summery == null + || (summery.maxProtectionPoints - summery.protectionPoints < 0.01 && summery.entropy == 0) + || player.worldObj.isRemote) return; - float totalPointsToAdd = Math.min(summery.maxProtectionPoints - summery.protectionPoints, summery.maxProtectionPoints / 60F); + float totalPointsToAdd = + Math.min(summery.maxProtectionPoints - summery.protectionPoints, summery.maxProtectionPoints / 60F); totalPointsToAdd *= (1F - (summery.entropy / 100F)); - totalPointsToAdd = Math.min(totalPointsToAdd, summery.totalEnergyStored / (summery.hasDraconic ? BalanceConfigHandler.draconicArmorEnergyPerProtectionPoint : BalanceConfigHandler.wyvernArmorEnergyPerProtectionPoint)); + totalPointsToAdd = Math.min( + totalPointsToAdd, + summery.totalEnergyStored + / (summery.hasDraconic + ? BalanceConfigHandler.draconicArmorEnergyPerProtectionPoint + : BalanceConfigHandler.wyvernArmorEnergyPerProtectionPoint)); if (totalPointsToAdd < 0F) totalPointsToAdd = 0F; summery.entropy -= (summery.meanRecoveryPoints * 0.01F); @@ -198,8 +227,15 @@ public class CustomArmorHandler { if (stack == null || summery.totalEnergyStored <= 0) continue; float maxForPeace = ((ICustomArmor) stack.getItem()).getProtectionPoints(stack); int energyAmount = ((ICustomArmor) summery.armorStacks[i].getItem()).getEnergyPerProtectionPoint(); - ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, (int) (((double) summery.energyAllocation[i] / (double) summery.totalEnergyStored) * (totalPointsToAdd * energyAmount)), false); - float pointsForPeace = (summery.pointsDown[i] / Math.max(1, summery.maxProtectionPoints - summery.protectionPoints)) * totalPointsToAdd; + ((IEnergyContainerItem) stack.getItem()) + .extractEnergy( + stack, + (int) (((double) summery.energyAllocation[i] / (double) summery.totalEnergyStored) + * (totalPointsToAdd * energyAmount)), + false); + float pointsForPeace = + (summery.pointsDown[i] / Math.max(1, summery.maxProtectionPoints - summery.protectionPoints)) + * totalPointsToAdd; summery.allocation[i] += pointsForPeace; if (summery.allocation[i] > maxForPeace || maxForPeace - summery.allocation[i] < 0.1F) summery.allocation[i] = maxForPeace; @@ -210,7 +246,7 @@ public class CustomArmorHandler { public static void tickArmorEffects(ArmorSummery summery, EntityPlayer player) { - //region/*----------------- Flight ------------------*/ + // region/*----------------- Flight ------------------*/ if (ConfigHandler.enableFlight) { if (summery != null && summery.flight[0]) { playersWithFlight.put(player, true); @@ -219,11 +255,13 @@ public class CustomArmorHandler { if (player.worldObj.isRemote) setPlayerFlySpeed(player, 0.05F + (0.05F * summery.flightSpeedModifier)); - if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && summery.flightVModifier > 0) { -// float percentIncrease = summery.flightVModifier; + if ((!player.onGround && player.capabilities.isFlying) + && player.motionY != 0 + && summery.flightVModifier > 0) { + // float percentIncrease = summery.flightVModifier; if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown()) { - //LogHelper.info(player.motionY); + // LogHelper.info(player.motionY); player.motionY = 0.225F * summery.flightVModifier; } @@ -232,7 +270,10 @@ public class CustomArmorHandler { } } - if (summery.flight[2] && player.moveForward == 0 && player.moveStrafing == 0 && player.capabilities.isFlying) { + if (summery.flight[2] + && player.moveForward == 0 + && player.moveStrafing == 0 + && player.capabilities.isFlying) { player.motionX *= 0.5; player.motionZ *= 0.5; } @@ -262,29 +303,38 @@ public class CustomArmorHandler { } } } - //endregion + // endregion - //region/*---------------- Swiftness ----------------*/ + // region/*---------------- Swiftness ----------------*/ IAttribute speedAttr = SharedMonsterAttributes.movementSpeed; if (summery != null && summery.speedModifier > 0) { double value = summery.speedModifier; if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID) == null) { - player.getEntityAttribute(speedAttr).applyModifier(new AttributeModifier(WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); - } else if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID).getAmount() != value) { - player.getEntityAttribute(speedAttr).removeModifier(player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID)); - player.getEntityAttribute(speedAttr).applyModifier(new AttributeModifier(WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); + player.getEntityAttribute(speedAttr) + .applyModifier(new AttributeModifier( + WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); + } else if (player.getEntityAttribute(speedAttr) + .getModifier(WALK_SPEED_UUID) + .getAmount() + != value) { + player.getEntityAttribute(speedAttr) + .removeModifier(player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID)); + player.getEntityAttribute(speedAttr) + .applyModifier(new AttributeModifier( + WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); } if (!player.onGround && player.ridingEntity == null) player.jumpMovementFactor = 0.02F + (0.02F * summery.speedModifier); } else if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID) != null) { - player.getEntityAttribute(speedAttr).removeModifier(player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID)); + player.getEntityAttribute(speedAttr) + .removeModifier(player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID)); } - //endregion + // endregion - //region/*---------------- HillStep -----------------*/ + // region/*---------------- HillStep -----------------*/ if (summery != null && player.worldObj.isRemote) { boolean highStepListed = playersWithUphillStep.contains(player.getDisplayName()) && player.stepHeight >= 1f; boolean hasHighStep = summery.hasHillStep; @@ -299,7 +349,7 @@ public class CustomArmorHandler { player.stepHeight = 0.5F; } } - //endregion + // endregion } private static void setPlayerFlySpeed(EntityPlayer player, float speed) { @@ -320,7 +370,8 @@ public class CustomArmorHandler { return true; } - if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && summery.armorStacks[3] != null) { + if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) + && summery.armorStacks[3] != null) { if (event.ammount <= 2f) event.setCanceled(true); return true; } @@ -375,7 +426,7 @@ public class CustomArmorHandler { */ public int[] energyAllocation; /*---- Effects ----*/ - public boolean[] flight = new boolean[]{false, false, false}; + public boolean[] flight = new boolean[] {false, false, false}; public float flightVModifier = 0F; public float speedModifier = 0F; public float jumpModifier = 0F; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java index b69732b8..d46c890d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java @@ -1,9 +1,5 @@ package com.brandon3055.draconicevolution.common.items.armor; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -32,6 +28,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.IArmorApiarist; import forestry.api.core.IArmorNaturalist; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -56,24 +55,36 @@ import thaumcraft.api.nodes.IRevealer; /** * Created by Brandon on 3/07/2014. */ -@InterfaceList(value = { - @Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"), - @Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"), - @Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), - @Interface(iface = "forestry.api.apiculture.IArmorApiarist", modid = "Forestry"), - @Interface(iface = "forestry.api.core.IArmorNaturalist", modid = "Forestry") -}) -public class DraconicArmor - extends ItemArmor - implements ISpecialArmor, IConfigurableItem, IInventoryTool, IGoggles, IVisDiscountGear, IRevealer, IUpgradableItem, ICustomArmor, IArmorNaturalist, IArmorApiarist { +@InterfaceList( + value = { + @Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), + @Interface(iface = "forestry.api.apiculture.IArmorApiarist", modid = "Forestry"), + @Interface(iface = "forestry.api.core.IArmorNaturalist", modid = "Forestry") + }) +public class DraconicArmor extends ItemArmor + implements ISpecialArmor, + IConfigurableItem, + IInventoryTool, + IGoggles, + IVisDiscountGear, + IRevealer, + IUpgradableItem, + ICustomArmor, + IArmorNaturalist, + IArmorApiarist { - //TODO Wings + // TODO Wings @SideOnly(Side.CLIENT) private IIcon helmIcon; + @SideOnly(Side.CLIENT) private IIcon chestIcon; + @SideOnly(Side.CLIENT) private IIcon leggsIcon; + @SideOnly(Side.CLIENT) private IIcon bootsIcon; @@ -101,7 +112,10 @@ public class DraconicArmor @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", + super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); } @Override @@ -141,7 +155,9 @@ public class DraconicArmor public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if (!ConfigHandler.useOldArmorModel) return References.RESOURCESPREFIX + "textures/models/armor/armorDraconic.png"; - if (stack.getItem() == ModItems.draconicHelm || stack.getItem() == ModItems.draconicChest || stack.getItem() == ModItems.draconicBoots) { + if (stack.getItem() == ModItems.draconicHelm + || stack.getItem() == ModItems.draconicChest + || stack.getItem() == ModItems.draconicBoots) { return References.RESOURCESPREFIX + "textures/models/armor/draconic_layer_1.png"; } else { return References.RESOURCESPREFIX + "textures/models/armor/draconic_layer_2.png"; @@ -177,9 +193,10 @@ public class DraconicArmor return 0; } - //region ISpecialArmor + // region ISpecialArmor @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) { if (source.isUnblockable() || source.isDamageAbsolute() || source.isMagicDamage()) return new ArmorProperties(0, damageReduceAmount / 100D, 15); return new ArmorProperties(0, damageReduceAmount / 24.5D, 1000); @@ -191,24 +208,27 @@ public class DraconicArmor } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - } - //endregion + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {} + // endregion @Override public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { if (stack == null) return; if (stack.getItem() == ModItems.draconicHelm) { if (world.isRemote) return; - if (this.getEnergyStored(stack) >= BalanceConfigHandler.draconicArmorEnergyToRemoveEffects && clearNegativeEffects(player)) { + if (this.getEnergyStored(stack) >= BalanceConfigHandler.draconicArmorEnergyToRemoveEffects + && clearNegativeEffects(player)) { this.extractEnergy(stack, BalanceConfigHandler.draconicArmorEnergyToRemoveEffects, false); } - if (player.worldObj.getBlockLightValue((int) Math.floor(player.posX), (int) player.posY + 1, (int) Math.floor(player.posZ)) < 5 && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false)) { + if (player.worldObj.getBlockLightValue( + (int) Math.floor(player.posX), (int) player.posY + 1, (int) Math.floor(player.posZ)) + < 5 + && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false)) { player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 419, 0, true)); - } else if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false) && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVLock", true)) + } else if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false) + && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVLock", true)) player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 419, 0, true)); else if (player.isPotionActive(Potion.nightVision.id)) player.removePotionEffect(Potion.nightVision.id); - } } @@ -230,16 +250,20 @@ public class DraconicArmor if (player.isBurning()) { player.extinguish(); /* - * Wyvern Armor doesn't require energy to extinguish player => Draconic Armor shouldn't require. - * See CustomArmorHandler.applyArmorDamageBlocking - * */ - //flag = false; + * Wyvern Armor doesn't require energy to extinguish player => Draconic Armor shouldn't require. + * See CustomArmorHandler.applyArmorDamageBlocking + * */ + // flag = false; } for (PotionEffect potion : potions) { int id = potion.getPotionID(); - if ((Boolean) ReflectionHelper.getPrivateValue(Potion.class, Potion.potionTypes[id], new String[]{"isBadEffect", "field_76418_K", "J"})) { + if ((Boolean) ReflectionHelper.getPrivateValue( + Potion.class, Potion.potionTypes[id], new String[] {"isBadEffect", "field_76418_K", "J"})) { if (potion.getPotionID() == Potion.digSlowdown.id && ModHelper.isHoldingCleaver(player)) break; - if ((player.getHeldItem() == null || (player.getHeldItem().getItem() != ModItems.wyvernBow && player.getHeldItem().getItem() != ModItems.draconicBow)) || id != 2) { + if ((player.getHeldItem() == null + || (player.getHeldItem().getItem() != ModItems.wyvernBow + && player.getHeldItem().getItem() != ModItems.draconicBow)) + || id != 2) { player.removePotionEffect(id); flag = true; } @@ -282,7 +306,8 @@ public class DraconicArmor @Override public int getMaxEnergyStored(ItemStack container) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(container); - return BalanceConfigHandler.draconicArmorBaseStorage + points * BalanceConfigHandler.draconicArmorStoragePerUpgrade; + return BalanceConfigHandler.draconicArmorBaseStorage + + points * BalanceConfigHandler.draconicArmorStoragePerUpgrade; } /* Misc */ @@ -303,29 +328,43 @@ public class DraconicArmor list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorNVActive").readFromItem(stack, false)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorNVLock").readFromItem(stack, true)); if (Loader.isModLoaded("Thaumcraft")) { - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "GogglesOfRevealing").readFromItem(stack, true)); + list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "GogglesOfRevealing") + .readFromItem(stack, true)); } if (Loader.isModLoaded("Forestry")) { list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ApiaristArmor").readFromItem(stack, true)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "NaturalistArmor").readFromItem(stack, true)); } } else if (armorType == 1) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "VerticalAcceleration").setMinMaxAndIncromente(0f, 8f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorFlightSpeedMult").setMinMaxAndIncromente(0f, 6f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "VerticalAcceleration") + .setMinMaxAndIncromente(0f, 8f, 0.1f) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorFlightSpeedMult") + .setMinMaxAndIncromente(0f, 6f, 0.1f) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "EffectiveOnSprint").readFromItem(stack, false)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorFlightLock").readFromItem(stack, false)); - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorInertiaCancellation").readFromItem(stack, false)); + list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorInertiaCancellation") + .readFromItem(stack, false)); if (Loader.isModLoaded("Forestry")) { list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ApiaristArmor").readFromItem(stack, true)); } } else if (armorType == 2) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult").setMinMaxAndIncromente(0f, 8f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult") + .setMinMaxAndIncromente(0f, 8f, 0.1f) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); if (Loader.isModLoaded("Forestry")) { list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ApiaristArmor").readFromItem(stack, true)); } } else if (armorType == 3) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult").setMinMaxAndIncromente(0f, 15f, 0.1f).readFromItem(stack, 0f).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult") + .setMinMaxAndIncromente(0f, 15f, 0.1f) + .readFromItem(stack, 0f) + .setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorHillStep").readFromItem(stack, true)); if (Loader.isModLoaded("Forestry")) { @@ -347,7 +386,11 @@ public class DraconicArmor @Override public boolean isEnchantValid(Enchantment enchant) { - return enchant.type == EnumEnchantmentType.armor || (armorType == 0 && enchant.type == EnumEnchantmentType.armor_head) || (armorType == 1 && enchant.type == EnumEnchantmentType.armor_torso) || (armorType == 2 && enchant.type == EnumEnchantmentType.armor_legs) || (armorType == 3 && enchant.type == EnumEnchantmentType.armor_feet); + return enchant.type == EnumEnchantmentType.armor + || (armorType == 0 && enchant.type == EnumEnchantmentType.armor_head) + || (armorType == 1 && enchant.type == EnumEnchantmentType.armor_torso) + || (armorType == 2 && enchant.type == EnumEnchantmentType.armor_legs) + || (armorType == 3 && enchant.type == EnumEnchantmentType.armor_feet); } @Override @@ -365,12 +408,12 @@ public class DraconicArmor @Override @Method(modid = "Thaumcraft") public int getVisDiscount(ItemStack itemStack, EntityPlayer entityPlayer, Aspect aspect) { - if (itemStack == null || itemStack.getItem() != ModItems.draconicHelm) - { + if (itemStack == null || itemStack.getItem() != ModItems.draconicHelm) { return 0; } return IConfigurableItem.ProfileHelper.getBoolean(itemStack, "GogglesOfRevealing", true) ? 5 : 0; } + @SideOnly(Side.CLIENT) public ModelBiped model; @@ -419,7 +462,8 @@ public class DraconicArmor if ((entityLiving instanceof EntityPlayer)) { if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { - EnumAction enumaction = ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); + EnumAction enumaction = + ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); if (enumaction == EnumAction.block) { this.model.heldItemRight = 3; } else if (enumaction == EnumAction.bow) { @@ -428,19 +472,20 @@ public class DraconicArmor } } - return model; } @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.SHIELD_CAPACITY); - add(EnumUpgrade.SHIELD_RECOVERY); - // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); - // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.SHIELD_CAPACITY); + add(EnumUpgrade.SHIELD_RECOVERY); + // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); + // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); + } + }; } @Override @@ -457,9 +502,12 @@ public class DraconicArmor public List getUpgradeStats(ItemStack stack) { List strings = new ArrayList(); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " + InfoHelper.HITC() + (int) getProtectionPoints(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + " EPS"); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " + + InfoHelper.HITC() + (int) getProtectionPoints(stack)); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + " EPS"); return strings; } @@ -488,7 +536,7 @@ public class DraconicArmor return 0; } - //region//----------------- ICustomArmor Start -----------------// + // region//----------------- ICustomArmor Start -----------------// @Override public float getProtectionPoints(ItemStack stack) { @@ -503,21 +551,26 @@ public class DraconicArmor @Override public float getSpeedModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F; + return player.isSprinting() + ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) + : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f); } @Override public float getJumpModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F; + return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() + ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) + : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f); } @Override public boolean hasHillStep(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return (player.isSprinting() || BrandonsCore.proxy.isCtrlDown()) && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorHillStep", true); + return (player.isSprinting() || BrandonsCore.proxy.isCtrlDown()) + && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorHillStep", true); } else return IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorHillStep", true); } @@ -528,20 +581,28 @@ public class DraconicArmor @Override public boolean[] hasFlight(ItemStack stack) { - return new boolean[]{true, IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorFlightLock", false), IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorInertiaCancellation", false)}; + return new boolean[] { + true, + IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorFlightLock", false), + IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorInertiaCancellation", false) + }; } @Override public float getFlightSpeedModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "EffectiveOnSprint", false)) { - return BrandonsCore.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorFlightSpeedMult", 0f) : 0F; + return BrandonsCore.proxy.isCtrlDown() + ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorFlightSpeedMult", 0f) + : 0F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorFlightSpeedMult", 0f); } @Override public float getFlightVModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "EffectiveOnSprint", false)) { - return BrandonsCore.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "VerticalAcceleration", 0F) : 0F; + return BrandonsCore.proxy.isCtrlDown() + ? IConfigurableItem.ProfileHelper.getFloat(stack, "VerticalAcceleration", 0F) + : 0F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "VerticalAcceleration", 0F); } @@ -550,7 +611,7 @@ public class DraconicArmor return BalanceConfigHandler.draconicArmorEnergyPerProtectionPoint; } - //endregion + // endregion @Override public boolean hasProfiles() { @@ -559,25 +620,23 @@ public class DraconicArmor @Override @Method(modid = "Forestry") - public boolean canSeePollination(EntityPlayer entityPlayer, ItemStack itemStack, boolean flag) - { - if (itemStack == null || itemStack.getItem() != ModItems.draconicHelm) - { + public boolean canSeePollination(EntityPlayer entityPlayer, ItemStack itemStack, boolean flag) { + if (itemStack == null || itemStack.getItem() != ModItems.draconicHelm) { return false; } - return IConfigurableItem.ProfileHelper.getBoolean(itemStack, "NaturalistArmor", true) || - IConfigurableItem.ProfileHelper.getBoolean(itemStack, "ApiaristArmor", true); + return IConfigurableItem.ProfileHelper.getBoolean(itemStack, "NaturalistArmor", true) + || IConfigurableItem.ProfileHelper.getBoolean(itemStack, "ApiaristArmor", true); } + @Override @Method(modid = "Forestry") - public boolean protectEntity(EntityLivingBase entityLivingBase, ItemStack itemStack, String s, boolean b) - { + public boolean protectEntity(EntityLivingBase entityLivingBase, ItemStack itemStack, String s, boolean b) { return IConfigurableItem.ProfileHelper.getBoolean(itemStack, "ApiaristArmor", true); } + @Override @Method(modid = "Forestry") - public boolean protectPlayer(EntityPlayer entityPlayer, ItemStack itemStack, String s, boolean b) - { + public boolean protectPlayer(EntityPlayer entityPlayer, ItemStack itemStack, String s, boolean b) { return protectEntity(entityPlayer, itemStack, s, b); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java index bddb46fd..6e9ed846 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java @@ -9,38 +9,38 @@ import net.minecraft.item.ItemStack; */ public interface ICustomArmor extends IEnergyContainerItem { - /**Returns the max number of protection points this armor piece can provide - * 1 protection point equals 1 half heart of protection. - * */ - float getProtectionPoints(ItemStack stack); + /**Returns the max number of protection points this armor piece can provide + * 1 protection point equals 1 half heart of protection. + * */ + float getProtectionPoints(ItemStack stack); - /**Returns the number of Upgrade points applied to shield recovery*/ - int getRecoveryPoints(ItemStack stack); + /**Returns the number of Upgrade points applied to shield recovery*/ + int getRecoveryPoints(ItemStack stack); - /**Returns the movement speed modifier for this armor*/ - float getSpeedModifier(ItemStack stack, EntityPlayer player); + /**Returns the movement speed modifier for this armor*/ + float getSpeedModifier(ItemStack stack, EntityPlayer player); - /**Returns the jump height modifier for this armor*/ - float getJumpModifier(ItemStack stack, EntityPlayer player); + /**Returns the jump height modifier for this armor*/ + float getJumpModifier(ItemStack stack, EntityPlayer player); - /**Returns true if this armor has up-hill step enabled*/ - boolean hasHillStep(ItemStack stack, EntityPlayer player); + /**Returns true if this armor has up-hill step enabled*/ + boolean hasHillStep(ItemStack stack, EntityPlayer player); - /**Returns the fire resistance modifier for this armor - * This is the percentage of fire damage this armor should absorb - * If the total resistance for all armor peaces the player is wearing is >= 1 the player will not be damaged by fire. - * Should return a number between 0 and 1*/ - float getFireResistance(ItemStack stack); + /**Returns the fire resistance modifier for this armor + * This is the percentage of fire damage this armor should absorb + * If the total resistance for all armor peaces the player is wearing is >= 1 the player will not be damaged by fire. + * Should return a number between 0 and 1*/ + float getFireResistance(ItemStack stack); - /**Returns {true, false} if this armor gives the player flight - * Returns {true, true} if flight lock is also enables on this armor*/ - boolean[] hasFlight(ItemStack stack); + /**Returns {true, false} if this armor gives the player flight + * Returns {true, true} if flight lock is also enables on this armor*/ + boolean[] hasFlight(ItemStack stack); - float getFlightSpeedModifier(ItemStack stack, EntityPlayer player); + float getFlightSpeedModifier(ItemStack stack, EntityPlayer player); - /**Returns the vertical acceleration speed*/ - float getFlightVModifier(ItemStack stack, EntityPlayer player); + /**Returns the vertical acceleration speed*/ + float getFlightVModifier(ItemStack stack, EntityPlayer player); - /**Returns amount of energy, required to restore protection point */ - int getEnergyPerProtectionPoint(); + /**Returns amount of energy, required to restore protection point */ + int getEnergyPerProtectionPoint(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java index 31be3a45..115e65cc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.items.armor; -import java.util.ArrayList; -import java.util.List; - import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -23,6 +20,8 @@ import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -41,13 +40,17 @@ import net.minecraftforge.common.ISpecialArmor; /** * Created by Brandon on 3/07/2014. */ -public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurableItem, IInventoryTool, IUpgradableItem, ICustomArmor { +public class WyvernArmor extends ItemArmor + implements ISpecialArmor, IConfigurableItem, IInventoryTool, IUpgradableItem, ICustomArmor { @SideOnly(Side.CLIENT) private IIcon helmIcon; + @SideOnly(Side.CLIENT) private IIcon chestIcon; + @SideOnly(Side.CLIENT) private IIcon leggsIcon; + @SideOnly(Side.CLIENT) private IIcon bootsIcon; @@ -75,7 +78,10 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", + super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); } @Override @@ -115,7 +121,9 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if (!ConfigHandler.useOldArmorModel) return References.RESOURCESPREFIX + "textures/models/armor/armorWyvern.png"; - if (stack.getItem() == ModItems.wyvernHelm || stack.getItem() == ModItems.wyvernChest || stack.getItem() == ModItems.wyvernBoots) { + if (stack.getItem() == ModItems.wyvernHelm + || stack.getItem() == ModItems.wyvernChest + || stack.getItem() == ModItems.wyvernBoots) { return References.RESOURCESPREFIX + "textures/models/armor/wyvern_layer_1.png"; } else { return References.RESOURCESPREFIX + "textures/models/armor/wyvern_layer_2.png"; @@ -151,9 +159,10 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab return 0; } - //region ISpecialArmor + // region ISpecialArmor @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) { if (source.isUnblockable() || source.isDamageAbsolute() || source.isMagicDamage()) return new ArmorProperties(0, damageReduceAmount / 100D, 15); return new ArmorProperties(0, damageReduceAmount / 25D, 1000); @@ -165,14 +174,11 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - } - //endregion + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {} + // endregion @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { - - } + public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {} @Override @SideOnly(Side.CLIENT) @@ -229,10 +235,16 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); if (armorType == 2) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult").setMinMaxAndIncromente(0f, 5f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult") + .setMinMaxAndIncromente(0f, 5f, 0.1f) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); } else if (armorType == 3) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult").setMinMaxAndIncromente(0f, 5f, 0.1f).readFromItem(stack, 0f).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult") + .setMinMaxAndIncromente(0f, 5f, 0.1f) + .readFromItem(stack, 0f) + .setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); } return list; @@ -250,7 +262,11 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab @Override public boolean isEnchantValid(Enchantment enchant) { - return enchant.type == EnumEnchantmentType.armor || (armorType == 0 && enchant.type == EnumEnchantmentType.armor_head) || (armorType == 1 && enchant.type == EnumEnchantmentType.armor_torso) || (armorType == 2 && enchant.type == EnumEnchantmentType.armor_legs) || (armorType == 3 && enchant.type == EnumEnchantmentType.armor_feet); + return enchant.type == EnumEnchantmentType.armor + || (armorType == 0 && enchant.type == EnumEnchantmentType.armor_head) + || (armorType == 1 && enchant.type == EnumEnchantmentType.armor_torso) + || (armorType == 2 && enchant.type == EnumEnchantmentType.armor_legs) + || (armorType == 3 && enchant.type == EnumEnchantmentType.armor_feet); } @SideOnly(Side.CLIENT) @@ -302,7 +318,8 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab if ((entityLiving instanceof EntityPlayer)) { if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { - EnumAction enumaction = ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); + EnumAction enumaction = + ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); if (enumaction == EnumAction.block) { this.model.heldItemRight = 3; } else if (enumaction == EnumAction.bow) { @@ -311,19 +328,20 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab } } - return model; } @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.SHIELD_CAPACITY); - add(EnumUpgrade.SHIELD_RECOVERY); - // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); - // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.SHIELD_CAPACITY); + add(EnumUpgrade.SHIELD_RECOVERY); + // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); + // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); + } + }; } @Override @@ -340,9 +358,12 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab public List getUpgradeStats(ItemStack stack) { List strings = new ArrayList(); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " + InfoHelper.HITC() + (int) getProtectionPoints(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + " EPS"); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " + + InfoHelper.HITC() + (int) getProtectionPoints(stack)); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + " EPS"); return strings; } @@ -371,7 +392,7 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab return 0; } - //region//----------------- ICustomArmor Start -----------------// + // region//----------------- ICustomArmor Start -----------------// @Override public float getProtectionPoints(ItemStack stack) { return EnumUpgrade.SHIELD_CAPACITY.getUpgradePoints(stack) * 20F; @@ -385,14 +406,18 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab @Override public float getSpeedModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F; + return player.isSprinting() + ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) + : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f); } @Override public float getJumpModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F; + return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() + ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) + : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f); } @@ -408,7 +433,7 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab @Override public boolean[] hasFlight(ItemStack stack) { - return new boolean[]{false, false, false}; + return new boolean[] {false, false, false}; } @Override @@ -426,7 +451,7 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab return BalanceConfigHandler.wyvernArmorEnergyPerProtectionPoint; } - //endregion + // endregion @Override public boolean hasProfiles() { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java index 99355b19..f5c717f1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java @@ -1,14 +1,15 @@ package com.brandon3055.draconicevolution.common.items.tools; -import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; 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.EntityList; @@ -19,8 +20,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - /** * Created by Brandon on 25/09/2014. */ @@ -32,7 +31,8 @@ public class AdminSpawnEgg extends ItemDE { } public String getItemStackDisplayName(ItemStack stack) { - NBTTagCompound compound = (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); + NBTTagCompound compound = + (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); if (compound == null) return null; String name = compound.getString("EntityName"); return "Spawn " + name; @@ -72,8 +72,19 @@ public class AdminSpawnEgg extends ItemDE { } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float p_77648_8_, float p_77648_9_, float p_77648_10_) { - NBTTagCompound compound = (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float p_77648_8_, + float p_77648_9_, + float p_77648_10_) { + NBTTagCompound compound = + (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); if (compound == null) return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java index 2a8c27d0..3a036642 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java @@ -8,15 +8,14 @@ import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - /** * Created by Brandon on 29/08/2014. */ @@ -40,13 +39,14 @@ public class CreativeStructureSpawner extends ItemDE { switch (stack.getItemDamage()) { case 0: - new WorldGenEnderComet().generate(world, new Random(), (int) player.posX, (int) player.posY + 10, (int) player.posZ); + new WorldGenEnderComet() + .generate(world, new Random(), (int) player.posX, (int) player.posY + 10, (int) player.posZ); break; case 1: - //new WorldGenEnderIsland().generate(world, new Random(), (int)player.posX, (int)player.posY + 10, (int)player.posZ); + // new WorldGenEnderIsland().generate(world, new Random(), (int)player.posX, (int)player.posY + 10, + // (int)player.posZ); break; case 2: - break; case 3: break; @@ -55,7 +55,17 @@ public class CreativeStructureSpawner extends ItemDE { } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int p_77648_7_, + float p_77648_8_, + float p_77648_9_, + float p_77648_10_) { if (world.isRemote) return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java index 5bdd8e11..0aa63542 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.List; - import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -12,6 +10,7 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; @@ -39,13 +38,17 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 0).setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH).setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1).readFromItem(stack, 1)); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0) + .setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.TREE_MODE).readFromItem(stack, false)); return list; } - @Override public String getInventoryName() { return StatCollector.translateToLocal("info.de.toolInventoryEnch.txt"); @@ -63,10 +66,17 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw @Override public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { - if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.TREE_MODE, false) && isTree(player.worldObj, x, y, z)) { + if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.TREE_MODE, false) + && isTree(player.worldObj, x, y, z)) { trimLeavs(x, y, z, player, player.worldObj, stack); for (int i = 0; i < 9; i++) - player.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(player.worldObj.getBlock(x, y, z)) + (player.worldObj.getBlockMetadata(x, y, z) << 12)); + player.worldObj.playAuxSFX( + 2001, + x, + y, + z, + Block.getIdFromBlock(player.worldObj.getBlock(x, y, z)) + + (player.worldObj.getBlockMetadata(x, y, z) << 12)); chopTree(x, y, z, player, player.worldObj, stack); return false; } @@ -92,7 +102,8 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw @Override public int getCapacity(ItemStack stack) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return BalanceConfigHandler.draconicToolsBaseStorage + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; + return BalanceConfigHandler.draconicToolsBaseStorage + + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; } @Override @@ -127,32 +138,32 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw } // @Override -// public boolean onBlockStartBreak(ItemStack stack, int X, int Y, int Z, EntityPlayer player) { -// World world = player.worldObj; -// boolean tree = isTree(world, X, Y, Z); -// -// if (player.isSneaking()) { -// return false; -// } -// -// Block block = world.getBlock(X, Y, Z); -// Material mat = block.getMaterial(); -// if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) { -// return false; -// } -// -// if (!tree) { -// ToolHandler.disSquare(X, Y, Z, player, world, false, 0, ToolHandler.materialsAxe, stack); -// return false; -// } -// -// if (!world.isRemote) world.playAuxSFX(2001, X, Y, Z, Block.getIdFromBlock(world.getBlock(X, Y, Z))); -// trimLeavs(X, Y, Z, player, world, stack); -// chopTree(X, Y, Z, player, world, stack); -// -// return true; -// } -// + // public boolean onBlockStartBreak(ItemStack stack, int X, int Y, int Z, EntityPlayer player) { + // World world = player.worldObj; + // boolean tree = isTree(world, X, Y, Z); + // + // if (player.isSneaking()) { + // return false; + // } + // + // Block block = world.getBlock(X, Y, Z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) { + // return false; + // } + // + // if (!tree) { + // ToolHandler.disSquare(X, Y, Z, player, world, false, 0, ToolHandler.materialsAxe, stack); + // return false; + // } + // + // if (!world.isRemote) world.playAuxSFX(2001, X, Y, Z, Block.getIdFromBlock(world.getBlock(X, Y, Z))); + // trimLeavs(X, Y, Z, player, world, stack); + // chopTree(X, Y, Z, player, world, stack); + // + // return true; + // } + // private boolean isTree(World world, int X, int Y, int Z) { final Block wood = world.getBlock(X, Y, Z); if (wood == null || !wood.isWood(world, X, Y, Z)) { @@ -160,7 +171,8 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw } else { int top = Y; for (int y = Y; y <= Y + 50; y++) { - if (!world.getBlock(X, y, Z).isWood(world, X, y, Z) && !world.getBlock(X, y, Z).isLeaves(world, X, y, Z)) { + if (!world.getBlock(X, y, Z).isWood(world, X, y, Z) + && !world.getBlock(X, y, Z).isLeaves(world, X, y, Z)) { top += y; break; } @@ -197,8 +209,8 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player); } chopTree(xPos, yPos, zPos, player, world, stack); - }//else - //trimLeavs(xPos, yPos, zPos, player, world, stack); + } // else + // trimLeavs(xPos, yPos, zPos, player, world, stack); } } } @@ -241,18 +253,18 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw } } - -// @SuppressWarnings({"rawtypes", "unchecked"}) -// @Override -// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { -// if (InfoHelper.holdShiftForDetails(list)){ -// InfoHelper.addEnergyInfo(stack, list); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe2.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe3.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe4.txt")); -// InfoHelper.addLore(stack, list); -// -// }else list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe1.txt")); -// } + // @SuppressWarnings({"rawtypes", "unchecked"}) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // extraInformation) { + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe2.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe3.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe4.txt")); + // InfoHelper.addLore(stack, list); + // + // }else list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe1.txt")); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java index b3471620..5e3bd50a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.List; - import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; @@ -17,6 +15,7 @@ import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; @@ -29,7 +28,8 @@ import net.minecraft.world.World; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -public class DraconicDistructionStaff extends MiningTool implements IInventoryTool, IRenderTweak, IEnergyContainerWeaponItem { +public class DraconicDistructionStaff extends MiningTool + implements IInventoryTool, IRenderTweak, IEnergyContainerWeaponItem { public DraconicDistructionStaff() { super(ModItems.CHAOTIC); @@ -37,9 +37,12 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo this.setHarvestLevel("pickaxe", 10); this.setHarvestLevel("shovel", 10); this.setHarvestLevel("axe", 10); - this.setCapacity(BalanceConfigHandler.draconicToolsBaseStorage * 2 + BalanceConfigHandler.draconicWeaponsBaseStorage); - this.setMaxExtract(BalanceConfigHandler.draconicToolsMaxTransfer * 2 + BalanceConfigHandler.draconicWeaponsMaxTransfer); - this.setMaxReceive(BalanceConfigHandler.draconicToolsMaxTransfer * 2 + BalanceConfigHandler.draconicWeaponsMaxTransfer); + this.setCapacity( + BalanceConfigHandler.draconicToolsBaseStorage * 2 + BalanceConfigHandler.draconicWeaponsBaseStorage); + this.setMaxExtract( + BalanceConfigHandler.draconicToolsMaxTransfer * 2 + BalanceConfigHandler.draconicWeaponsMaxTransfer); + this.setMaxReceive( + BalanceConfigHandler.draconicToolsMaxTransfer * 2 + BalanceConfigHandler.draconicWeaponsMaxTransfer); this.energyPerOperation = BalanceConfigHandler.draconicToolsEnergyPerAction; ModItems.register(this); } @@ -49,13 +52,20 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo return this.getEfficiency(stack); } - @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 0).setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH).setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1).readFromItem(stack, 1)); - list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE).setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 1).setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0) + .setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); + list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 1) + .setModifier("AOE")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.OBLITERATE).readFromItem(stack, false)); return list; } @@ -79,7 +89,8 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { entity.hurtResistantTime = 0; ToolHandler.damageEntityBasedOnHealth(entity, player, 0.3F); - ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); + ToolHandler.AOEAttack( + player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); return true; } @@ -94,8 +105,10 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo super.addInformation(stack, player, list, extended); list.add(""); - list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " + StatCollector.translateToLocal("info.de.attackDamage.txt")); - list.add(EnumChatFormatting.BLUE + "+30%" + " " + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); + list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " + + StatCollector.translateToLocal("info.de.attackDamage.txt")); + list.add(EnumChatFormatting.BLUE + "+30%" + " " + + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); } @Override @@ -167,8 +180,11 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo @Override public int getCapacity(ItemStack stack) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return BalanceConfigHandler.draconicToolsBaseStorage * 2 + BalanceConfigHandler.draconicWeaponsBaseStorage + - points * (BalanceConfigHandler.draconicToolsStoragePerUpgrade + BalanceConfigHandler.draconicWeaponsStoragePerUpgrade); + return BalanceConfigHandler.draconicToolsBaseStorage * 2 + + BalanceConfigHandler.draconicWeaponsBaseStorage + + points + * (BalanceConfigHandler.draconicToolsStoragePerUpgrade + + BalanceConfigHandler.draconicWeaponsStoragePerUpgrade); } @Override @@ -184,7 +200,8 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo @Override public List getUpgradeStats(ItemStack stack) { List list = super.getUpgradeStats(stack); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java index 6aacef77..20b6ffe4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.ArrayList; -import java.util.List; - import cofh.api.energy.IEnergyContainerItem; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -20,6 +17,8 @@ import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.registry.GameRegistry; 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; @@ -38,7 +37,8 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.UseHoeEvent; import org.lwjgl.opengl.GL11; -public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRenderTweak, IUpgradableItem, IConfigurableItem, IHudDisplayItem { +public class DraconicHoe extends ItemHoe + implements IEnergyContainerItem, IRenderTweak, IUpgradableItem, IConfigurableItem, IHudDisplayItem { protected int capacity = BalanceConfigHandler.draconicToolsBaseStorage; protected int maxReceive = BalanceConfigHandler.draconicToolsMaxTransfer; @@ -59,7 +59,10 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende @Override public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 0).setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0) + .setModifier("AOE")); return list; } @@ -79,7 +82,10 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", + super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); } @Override @@ -94,15 +100,30 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende } @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) { boolean successfull = false; Block clicked = world.getBlock(x, y, z); - if (!player.isSneaking() && player.canPlayerEdit(x, y, z, par7, stack) && (clicked == Blocks.dirt || clicked == Blocks.grass || clicked == Blocks.farmland) && par7 == 1) { + if (!player.isSneaking() + && player.canPlayerEdit(x, y, z, par7, stack) + && (clicked == Blocks.dirt || clicked == Blocks.grass || clicked == Blocks.farmland) + && par7 == 1) { int size = IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0); LogHelper.info(size); for (int x1 = -size; x1 <= size; x1++) { for (int z1 = -size; z1 <= size; z1++) { - if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < BalanceConfigHandler.draconicToolsEnergyPerAction) { + if (!(stack.getItem() instanceof IEnergyContainerItem) + || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) + < BalanceConfigHandler.draconicToolsEnergyPerAction) { if (!player.capabilities.isCreativeMode) return false; } Block topBlock = world.getBlock(x + x1, y + 1, z + z1); @@ -114,20 +135,31 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende world.setBlockToAir(x + x1, y + 2, z + z1); } Block block = world.getBlock(x + x1, y, z + z1); - if (block.isReplaceable(world, x + x1, y, z + z1) && !block.getMaterial().equals(Material.water)) { + if (block.isReplaceable(world, x + x1, y, z + z1) + && !block.getMaterial().equals(Material.water)) { world.setBlockToAir(x + x1, y, z + z1); } - if (world.getBlock(x + x1, y, z + z1) == Blocks.air && world.getBlock(x + x1, y - 1, z + z1).isBlockSolid(world, x, y, z, 1)) { - if (player.inventory.hasItem(Item.getItemFromBlock(Blocks.dirt)) || player.capabilities.isCreativeMode) { + if (world.getBlock(x + x1, y, z + z1) == Blocks.air + && world.getBlock(x + x1, y - 1, z + z1).isBlockSolid(world, x, y, z, 1)) { + if (player.inventory.hasItem(Item.getItemFromBlock(Blocks.dirt)) + || player.capabilities.isCreativeMode) { world.setBlock(x + x1, y, z + z1, Blocks.dirt); player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.dirt)); } } - if ((world.getBlock(x + x1, y + 1, z + z1) == Blocks.dirt || world.getBlock(x + x1, y + 1, z + z1) == Blocks.grass || world.getBlock(x + x1, y + 1, z + z1) == Blocks.farmland) && world.getBlock(x + x1, y + 2, z + z1) == Blocks.air) { + if ((world.getBlock(x + x1, y + 1, z + z1) == Blocks.dirt + || world.getBlock(x + x1, y + 1, z + z1) == Blocks.grass + || world.getBlock(x + x1, y + 1, z + z1) == Blocks.farmland) + && world.getBlock(x + x1, y + 2, z + z1) == Blocks.air) { if (!world.isRemote) - world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(Item.getItemFromBlock(Blocks.dirt)))); + world.spawnEntityInWorld(new EntityItem( + world, + player.posX, + player.posY, + player.posZ, + new ItemStack(Item.getItemFromBlock(Blocks.dirt)))); world.setBlock(x + x1, y + 1, z + z1, Blocks.air); } @@ -137,16 +169,25 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende } else successfull = hoe(stack, player, world, x, y, z, par7); Block block1 = Blocks.farmland; if (successfull) - world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F); + world.playSoundEffect( + x + 0.5F, + y + 0.5F, + z + 0.5F, + block1.stepSound.getStepResourcePath(), + (block1.stepSound.getVolume() + 1.0F) / 2.0F, + block1.stepSound.getPitch() * 0.8F); return successfull; } private boolean hoe(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7) { - if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < BalanceConfigHandler.draconicToolsEnergyPerAction) { + if (!(stack.getItem() instanceof IEnergyContainerItem) + || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) + < BalanceConfigHandler.draconicToolsEnergyPerAction) { if (!player.capabilities.isCreativeMode) return false; } else { if (!player.capabilities.isCreativeMode) - ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, BalanceConfigHandler.draconicToolsEnergyPerAction, false); + ((IEnergyContainerItem) stack.getItem()) + .extractEnergy(stack, BalanceConfigHandler.draconicToolsEnergyPerAction, false); } if (!player.canPlayerEdit(x, y, z, par7, stack)) { return false; @@ -163,7 +204,9 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende Block block = world.getBlock(x, y, z); - if (par7 != 0 && world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && (block == Blocks.grass || block == Blocks.dirt)) { + if (par7 != 0 + && world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) + && (block == Blocks.grass || block == Blocks.dirt)) { Block block1 = Blocks.farmland; if (world.isRemote) { @@ -180,7 +223,8 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende } @Override - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { InfoHelper.addEnergyInfo(stack, list); ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addLore(stack, list); @@ -219,7 +263,8 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende @Override public int getMaxEnergyStored(ItemStack container) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(container); - return BalanceConfigHandler.draconicToolsBaseStorage + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; + return BalanceConfigHandler.draconicToolsBaseStorage + + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; } @Override @@ -262,13 +307,14 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende } } - @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.DIG_AOE); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.DIG_AOE); + } + }; } @Override @@ -313,9 +359,11 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende for (ItemConfigField field : getFields(itemstack, 0)) if (field.name.equals(References.DIG_AOE)) digaoe = 1 + ((Integer) field.max * 2); - - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(itemstack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() + digaoe + "x" + digaoe); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(itemstack))); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() + digaoe + "x" + + digaoe); return strings; } @@ -330,8 +378,9 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende List list = new ArrayList(); for (ItemConfigField field : getFields(stack, 0)) - list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); + list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java index 78c6d7d9..29386cbb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.List; - import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -11,6 +9,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.List; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; @@ -20,7 +19,6 @@ import org.lwjgl.opengl.GL11; public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRenderTweak { - public DraconicPickaxe() { super(ModItems.AWAKENED); this.setHarvestLevel("pickaxe", 10); @@ -32,12 +30,16 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRend ModItems.register(this); } - @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 0).setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH).setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1).readFromItem(stack, 1)); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0) + .setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.OBLITERATE).readFromItem(stack, false)); return list; } @@ -93,7 +95,8 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRend @Override public int getCapacity(ItemStack stack) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return BalanceConfigHandler.draconicToolsBaseStorage + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; + return BalanceConfigHandler.draconicToolsBaseStorage + + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; } @Override @@ -127,179 +130,185 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRend return 0; } -// @Override -// public boolean isItemTool(ItemStack p_77616_1_) { -// return true; -// } -// -// @SideOnly(Side.CLIENT) -// @SuppressWarnings("unchecked") -// @Override -// public void getSubItems(Item item, CreativeTabs tab, List list) { -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); -// } -// -// @Override -// public String getUnlocalizedName(){ -// -// return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); -// } -// -// @Override -// public String getUnlocalizedName(final ItemStack itemStack){ -// return getUnlocalizedName(); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public void registerIcons(final IIconRegister iconRegister) -// { -// this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick"); -// this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_active"); -// this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_obliterate"); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) -// return itemIcon2; -// else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIconIndex(ItemStack stack) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) -// return itemIcon2; -// else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } -// -// @Override -// public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer player) -// { -// World world = player.worldObj; -// Block block = world.getBlock(x, y, z); -// Material mat = block.getMaterial(); -// if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { -// return false; -// } -// int fortune = EnchantmentHelper.getFortuneModifier(player); -// boolean silk = EnchantmentHelper.getSilkTouchModifier(player); -// ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); -// return false; -// } -// -// @Override -// public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) -// { -// return ToolHandler.changeMode(stack, player, true, 3); -// } -// -// @SuppressWarnings({ "rawtypes", "unchecked" }) -// @Override -// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) -// { -// int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; -// boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); -// if (InfoHelper.holdShiftForDetails(list)){ -// InfoHelper.addEnergyInfo(stack, list); -// -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); -// -// InfoHelper.addLore(stack, list); -// } -// } -// -// @Override -// public EnumRarity getRarity(ItemStack stack) -// { -// return EnumRarity.rare; -// } -// -// @Override -// public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { -// -// if (container.stackTagCompound == null) { -// container.stackTagCompound = new NBTTagCompound(); -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); -// -// if (!simulate) { -// energy += energyReceived; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyReceived; -// } -// -// @Override -// public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { -// -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); -// -// if (!simulate) { -// energy -= energyExtracted; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyExtracted; -// } -// -// @Override -// public int getEnergyStored(ItemStack container) { -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// return container.stackTagCompound.getInteger("Energy"); -// } -// -// @Override -// public int getMaxEnergyStored(ItemStack container) { -// return capacity; -// } -// -// @Override -// public boolean showDurabilityBar(ItemStack stack) { -// return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); -// } -// -// @Override -// public double getDurabilityForDisplay(ItemStack stack) { -// return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); -// } -// -// @Override -// public float getDigSpeed(ItemStack stack, Block block, int meta) { -// if ((stack.getItem() instanceof IEnergyContainerItem) && ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) -// return super.getDigSpeed(stack, block, meta); -// else -// return 1F; -// } -// -// @Override -// public boolean hasCustomEntity(ItemStack stack) { -// return true; -// } -// -// @Override -// public Entity createEntity(World world, Entity location, ItemStack itemstack) { -// return new EntityPersistentItem(world, location, itemstack); -// } + // @Override + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } + // + // @SideOnly(Side.CLIENT) + // @SuppressWarnings("unchecked") + // @Override + // public void getSubItems(Item item, CreativeTabs tab, List list) { + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); + // } + // + // @Override + // public String getUnlocalizedName(){ + // + // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", + // super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + // } + // + // @Override + // public String getUnlocalizedName(final ItemStack itemStack){ + // return getUnlocalizedName(); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_active"); + // this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_obliterate"); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } + // + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // player) + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); + // return false; + // } + // + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, true, 3); + // } + // + // @SuppressWarnings({ "rawtypes", "unchecked" }) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // extraInformation) + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); + // + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // + size + "x" + size); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + + // InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); + // + // InfoHelper.addLore(stack, list); + // } + // } + // + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.rare; + // } + // + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } + // + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } + // + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } + // + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } + // + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } + // + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } + // + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && + // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } + // + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } + // + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java index 3a2789b1..91877bde 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.List; - import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -11,6 +9,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.List; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; @@ -19,9 +18,9 @@ import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; public class DraconicShovel extends MiningTool implements IInventoryTool, IRenderTweak { -// public IIcon itemIcon0; -// public IIcon itemIcon1; -// public IIcon itemIcon2; + // public IIcon itemIcon0; + // public IIcon itemIcon1; + // public IIcon itemIcon2; public DraconicShovel() { super(ModItems.AWAKENED); @@ -37,8 +36,13 @@ public class DraconicShovel extends MiningTool implements IInventoryTool, IRende @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 0).setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH).setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1).readFromItem(stack, 1)); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0) + .setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.OBLITERATE).readFromItem(stack, false)); return list; } @@ -96,7 +100,8 @@ public class DraconicShovel extends MiningTool implements IInventoryTool, IRende @Override public int getCapacity(ItemStack stack) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return BalanceConfigHandler.draconicToolsBaseStorage + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; + return BalanceConfigHandler.draconicToolsBaseStorage + + points * BalanceConfigHandler.draconicToolsStoragePerUpgrade; } @Override @@ -129,184 +134,190 @@ public class DraconicShovel extends MiningTool implements IInventoryTool, IRende } return 0; } -// @Override -// public boolean isItemTool(ItemStack p_77616_1_) { -// return true; -// } -// -// @SideOnly(Side.CLIENT) -// @SuppressWarnings("unchecked") -// @Override -// public void getSubItems(Item item, CreativeTabs tab, List list) { -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); -// } -// -// @Override -// public String getUnlocalizedName(){ -// -// return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); -// } -// -// @Override -// public String getUnlocalizedName(final ItemStack itemStack){ -// return getUnlocalizedName(); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public void registerIcons(final IIconRegister iconRegister) -// { -// this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel"); -// this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_active"); -// this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_obliterate"); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) -// return itemIcon2; -// else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIconIndex(ItemStack stack) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) -// return itemIcon2; -// else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } -// -// @Override -// public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer player) -// { -// World world = player.worldObj; -// Block block = world.getBlock(x, y, z); -// Material mat = block.getMaterial(); -// if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { -// return false; -// } -// int fortune = EnchantmentHelper.getFortuneModifier(player); -// boolean silk = EnchantmentHelper.getSilkTouchModifier(player); -// ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); -// return false; -// } -// -// @Override -// public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) -// { -// return ToolHandler.changeMode(stack, player, true, 3); -// } -// -// public static int getMode(final ItemStack tool) -// { -// return tool.getItemDamage(); -// } -// -// @SuppressWarnings({ "rawtypes", "unchecked" }) -// @Override -// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) -// { -// int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; -// boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); -// if (InfoHelper.holdShiftForDetails(list)){ -// InfoHelper.addEnergyInfo(stack, list); -// -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); -// -// InfoHelper.addLore(stack, list); -// } -// } -// -// @Override -// public EnumRarity getRarity(ItemStack stack) -// { -// return EnumRarity.rare; -// } -// -// @Override -// public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { -// -// if (container.stackTagCompound == null) { -// container.stackTagCompound = new NBTTagCompound(); -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); -// -// if (!simulate) { -// energy += energyReceived; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyReceived; -// } -// -// @Override -// public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { -// -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); -// -// if (!simulate) { -// energy -= energyExtracted; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyExtracted; -// } -// -// @Override -// public int getEnergyStored(ItemStack container) { -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// return container.stackTagCompound.getInteger("Energy"); -// } -// -// @Override -// public int getMaxEnergyStored(ItemStack container) { -// return capacity; -// } -// -// @Override -// public boolean showDurabilityBar(ItemStack stack) { -// return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); -// } -// -// @Override -// public double getDurabilityForDisplay(ItemStack stack) { -// return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); -// } -// -// @Override -// public float getDigSpeed(ItemStack stack, Block block, int meta) { -// if ((stack.getItem() instanceof IEnergyContainerItem) && ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= References.ENERGYPERBLOCK) -// return super.getDigSpeed(stack, block, meta); -// else -// return 1F; -// } -// -// @Override -// public boolean hasCustomEntity(ItemStack stack) { -// return true; -// } -// -// @Override -// public Entity createEntity(World world, Entity location, ItemStack itemstack) { -// return new EntityPersistentItem(world, location, itemstack); -// } + // @Override + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } + // + // @SideOnly(Side.CLIENT) + // @SuppressWarnings("unchecked") + // @Override + // public void getSubItems(Item item, CreativeTabs tab, List list) { + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); + // } + // + // @Override + // public String getUnlocalizedName(){ + // + // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", + // super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + // } + // + // @Override + // public String getUnlocalizedName(final ItemStack itemStack){ + // return getUnlocalizedName(); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_active"); + // this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_obliterate"); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } + // + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // player) + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); + // return false; + // } + // + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, true, 3); + // } + // + // public static int getMode(final ItemStack tool) + // { + // return tool.getItemDamage(); + // } + // + // @SuppressWarnings({ "rawtypes", "unchecked" }) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // extraInformation) + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); + // + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // + size + "x" + size); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + + // InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); + // + // InfoHelper.addLore(stack, list); + // } + // } + // + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.rare; + // } + // + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } + // + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } + // + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } + // + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } + // + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } + // + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } + // + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && + // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= References.ENERGYPERBLOCK) + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } + // + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } + // + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java index a4d69baa..298ec61f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.ArrayList; -import java.util.List; - import cofh.api.energy.IEnergyContainerItem; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -16,6 +13,8 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -58,9 +57,11 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); - list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", BalanceConfigHandler.wyvernCapacitorBaseStorage)); + list.add(ItemNBTHelper.setInteger( + new ItemStack(item, 1, 0), "Energy", BalanceConfigHandler.wyvernCapacitorBaseStorage)); list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 1), "Energy", 0)); - list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 1), "Energy", BalanceConfigHandler.draconicCapacitorBaseStorage)); + list.add(ItemNBTHelper.setInteger( + new ItemStack(item, 1, 1), "Energy", BalanceConfigHandler.draconicCapacitorBaseStorage)); } @Override @@ -71,17 +72,27 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public int getCapacity(ItemStack stack) { int points = EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorBaseStorage + points * BalanceConfigHandler.wyvernCapacitorStoragePerUpgrade : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorBaseStorage + points * BalanceConfigHandler.draconicCapacitorStoragePerUpgrade : 0; + return stack.getItemDamage() == 0 + ? BalanceConfigHandler.wyvernCapacitorBaseStorage + + points * BalanceConfigHandler.wyvernCapacitorStoragePerUpgrade + : stack.getItemDamage() == 1 + ? BalanceConfigHandler.draconicCapacitorBaseStorage + + points * BalanceConfigHandler.draconicCapacitorStoragePerUpgrade + : 0; } @Override public int getMaxExtract(ItemStack stack) { - return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxExtract : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxExtract : 0; + return stack.getItemDamage() == 0 + ? BalanceConfigHandler.wyvernCapacitorMaxExtract + : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxExtract : 0; } @Override public int getMaxReceive(ItemStack stack) { - return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxReceive : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxReceive : 0; + return stack.getItemDamage() == 0 + ? BalanceConfigHandler.wyvernCapacitorMaxReceive + : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxReceive : 0; } @Override @@ -91,24 +102,28 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte int mode = ItemNBTHelper.getShort(container, "Mode", (short) 0); - if (mode == 1 || mode == 3) { //Charge Hotbar + if (mode == 1 || mode == 3) { // Charge Hotbar for (int i = 0; i < 9; i++) { int max = Math.min(getEnergyStored(container), getMaxExtract(container)); ItemStack stack = player.inventory.getStackInSlot(i); - if (stack != null && stack.getItem() instanceof IEnergyContainerItem && stack.getItem() != ModItems.draconiumFluxCapacitor) { + if (stack != null + && stack.getItem() instanceof IEnergyContainerItem + && stack.getItem() != ModItems.draconiumFluxCapacitor) { IEnergyContainerItem item = (IEnergyContainerItem) stack.getItem(); extractEnergy(container, item.receiveEnergy(stack, max, false), false); } } } - if (mode == 2 || mode == 3) { //Charge Armor and held item + if (mode == 2 || mode == 3) { // Charge Armor and held item for (int i = mode == 3 ? 1 : 0; i < 5; i++) { int max = Math.min(getEnergyStored(container), getMaxExtract(container)); ItemStack stack = player.getEquipmentInSlot(i); - if (stack != null && stack.getItem() instanceof IEnergyContainerItem && stack.getItem() != ModItems.draconiumFluxCapacitor) { + if (stack != null + && stack.getItem() instanceof IEnergyContainerItem + && stack.getItem() != ModItems.draconiumFluxCapacitor) { IEnergyContainerItem item = (IEnergyContainerItem) stack.getItem(); extractEnergy(container, item.receiveEnergy(stack, max, false), false); } @@ -128,19 +143,26 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte int newMode = mode == 3 ? 0 : mode + 1; ItemNBTHelper.setShort(stack, "Mode", (short) newMode); if (world.isRemote) - player.addChatComponentMessage(new ChatComponentTranslation(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + ".txt"))); + player.addChatComponentMessage(new ChatComponentTranslation(InfoHelper.ITC() + + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + InfoHelper.HITC() + + StatCollector.translateToLocal( + "info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + ".txt"))); } return stack; } @Override @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { if (InfoHelper.holdShiftForDetails(list)) { list.add(StatCollector.translateToLocal("info.de.changwMode.txt")); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + ".txt")); - //InfoHelper.addLore(stack, list); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + + InfoHelper.HITC() + + StatCollector.translateToLocal( + "info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + ".txt")); + // InfoHelper.addLore(stack, list); } ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addEnergyInfo(stack, list); @@ -153,15 +175,18 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + } + }; } - @Override public int getUpgradeCap(ItemStack stack) { - return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxUpgrades : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxUpgrades : 0; + return stack.getItemDamage() == 0 + ? BalanceConfigHandler.wyvernCapacitorMaxUpgrades + : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxUpgrades : 0; } @Override @@ -171,7 +196,9 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public int getMaxUpgradePoints(int upgradeIndex) { - return Math.max(BalanceConfigHandler.wyvernCapacitorMaxUpgradePoints, BalanceConfigHandler.draconicCapacitorMaxUpgradePoints); + return Math.max( + BalanceConfigHandler.wyvernCapacitorMaxUpgradePoints, + BalanceConfigHandler.draconicCapacitorMaxUpgradePoints); } @Override @@ -180,9 +207,17 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte return getMaxUpgradePoints(upgradeIndex); } if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) { - return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxCapacityUpgradePoints : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxCapacityUpgradePoints : getMaxUpgradePoints(upgradeIndex); + return stack.getItemDamage() == 0 + ? BalanceConfigHandler.wyvernCapacitorMaxCapacityUpgradePoints + : stack.getItemDamage() == 1 + ? BalanceConfigHandler.draconicCapacitorMaxCapacityUpgradePoints + : getMaxUpgradePoints(upgradeIndex); } - return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxUpgradePoints : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxUpgradePoints : getMaxUpgradePoints(upgradeIndex); + return stack.getItemDamage() == 0 + ? BalanceConfigHandler.wyvernCapacitorMaxUpgradePoints + : stack.getItemDamage() == 1 + ? BalanceConfigHandler.draconicCapacitorMaxUpgradePoints + : getMaxUpgradePoints(upgradeIndex); } @Override @@ -193,7 +228,8 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public List getUpgradeStats(ItemStack stack) { List strings = new ArrayList(); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); return strings; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java index cdcf4711..01ea9238 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java @@ -1,18 +1,17 @@ package com.brandon3055.draconicevolution.common.items.tools; import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; +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.EnumChatFormatting; import net.minecraft.util.StatCollector; -import java.util.List; - /** * Created by Brandon on 15/08/2014. */ @@ -30,9 +29,9 @@ public class EnderArrow extends ItemDE { @Override public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.arrowInfo.txt")); - list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.arrowInfo0.txt")); + list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.arrowInfo.txt")); + list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.arrowInfo0.txt")); } } - - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java index a84d9536..714d6d0a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java @@ -9,6 +9,8 @@ import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.References; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.stream.Collectors; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -24,9 +26,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; -import java.util.List; -import java.util.stream.Collectors; - /** * Created by brandon3055 on 9/3/2016. */ @@ -77,11 +76,19 @@ public class Magnet extends ItemDE { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean hotbar) { - if (!entity.isSneaking() && entity.ticksExisted % 5 == 0 && isEnabled(stack) && entity instanceof EntityPlayer) { + if (!entity.isSneaking() + && entity.ticksExisted % 5 == 0 + && isEnabled(stack) + && entity instanceof EntityPlayer) { int range = stack.getItemDamage() == 0 ? 8 : 32; - List items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ).expand(range, range, range)); - List nearestItems = items.stream().limit(ConfigHandler.magnetStackLimit).collect(Collectors.toList()); + List items = world.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox( + entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) + .expand(range, range, range)); + List nearestItems = + items.stream().limit(ConfigHandler.magnetStackLimit).collect(Collectors.toList()); boolean flag = false; @@ -90,20 +97,35 @@ public class Magnet extends ItemDE { continue; } - String name = Item.itemRegistry.getNameForObject(item.getEntityItem().getItem()); - if (ConfigHandler.itemDislocatorBlacklistMap.containsKey(name) && (ConfigHandler.itemDislocatorBlacklistMap.get(name) == -1 || ConfigHandler.itemDislocatorBlacklistMap.get(name) == item.getEntityItem().getItemDamage())) { + String name = + Item.itemRegistry.getNameForObject(item.getEntityItem().getItem()); + if (ConfigHandler.itemDislocatorBlacklistMap.containsKey(name) + && (ConfigHandler.itemDislocatorBlacklistMap.get(name) == -1 + || ConfigHandler.itemDislocatorBlacklistMap.get(name) + == item.getEntityItem().getItemDamage())) { continue; } flag = true; if (item.delayBeforeCanPickup > 0) item.delayBeforeCanPickup = 0; item.motionX = item.motionY = item.motionZ = 0; - item.setPosition(entity.posX - 0.2 + (world.rand.nextDouble() * 0.4), entity.posY - 0.6, entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4)); + item.setPosition( + entity.posX - 0.2 + (world.rand.nextDouble() * 0.4), + entity.posY - 0.6, + entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4)); } if (flag) - world.playSoundAtEntity(entity, "random.orb", 0.1F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F)); + world.playSoundAtEntity( + entity, + "random.orb", + 0.1F, + 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F)); - List xp = world.getEntitiesWithinAABB(EntityXPOrb.class, AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ).expand(4, 4, 4)); + List xp = world.getEntitiesWithinAABB( + EntityXPOrb.class, + AxisAlignedBB.getBoundingBox( + entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) + .expand(4, 4, 4)); EntityPlayer player = (EntityPlayer) entity; @@ -111,7 +133,11 @@ public class Magnet extends ItemDE { if (!world.isRemote) { if (orb.field_70532_c == 0 && orb.isEntityAlive()) { if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, orb))) continue; - world.playSoundAtEntity(player, "random.orb", 0.1F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F)); + world.playSoundAtEntity( + player, + "random.orb", + 0.1F, + 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F)); player.onItemPickup(orb, 1); player.addExperience(orb.xpValue); orb.setDead(); @@ -145,6 +171,7 @@ public class Magnet extends ItemDE { public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { list.add(StatCollector.translateToLocal("info.de.shiftRightClickToActivate.txt")); int range = stack.getItemDamage() == 0 ? 8 : 32; - list.add(InfoHelper.HITC() + range + InfoHelper.ITC() + " " + StatCollector.translateToLocal("info.de.blockRange.txt")); + list.add(InfoHelper.HITC() + range + InfoHelper.ITC() + " " + + StatCollector.translateToLocal("info.de.blockRange.txt")); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java index 71126ba8..2e43f64f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java @@ -1,11 +1,11 @@ package com.brandon3055.draconicevolution.common.items.tools; import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityChaosDrill; import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -31,31 +31,40 @@ public class ObliterationCatalyst extends ItemDE { } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i1, int i2, int i3, int i4, float f1, float f2, float f3) { - //LogHelper.info("onItemUse"); + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int i1, + int i2, + int i3, + int i4, + float f1, + float f2, + float f3) { + // LogHelper.info("onItemUse"); return false; } @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int i1, boolean b1) { - } + public void onUpdate(ItemStack stack, World world, Entity entity, int i1, boolean b1) {} @Override public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { - //LogHelper.info("onUsingTick"); + // LogHelper.info("onUsingTick"); super.onUsingTick(stack, player, count); } @Override public int getMaxItemUseDuration(ItemStack p_77626_1_) { - //LogHelper.info("getMaxItemUseDuration"); + // LogHelper.info("getMaxItemUseDuration"); return 70000; } @Override public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int meta) { - //LogHelper.info("onPlayerStoppedUsing"); + // LogHelper.info("onPlayerStoppedUsing"); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java index fd8140c8..67138907 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java @@ -9,6 +9,7 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; 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; @@ -18,8 +19,6 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - /** * Created by Brandon on 23/08/2014. */ @@ -74,7 +73,17 @@ public class SafetyMatch extends ItemDE { return damage == 1000 ? itemIcon : boxIcon; } - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int p_77648_7_, + float p_77648_8_, + float p_77648_9_, + float p_77648_10_) { if (p_77648_7_ == 0) { --y; } @@ -103,7 +112,13 @@ public class SafetyMatch extends ItemDE { return false; } else { if (world.isAirBlock(x, y, z)) { - world.playSoundEffect((double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + world.playSoundEffect( + (double) x + 0.5D, + (double) y + 0.5D, + (double) z + 0.5D, + "fire.ignite", + 1.0F, + itemRand.nextFloat() * 0.4F + 0.8F); world.setBlock(x, y, z, ModBlocks.safetyFlame); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java index 68eeb183..11a07ec0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java @@ -11,6 +11,7 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; 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; @@ -24,12 +25,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.List; - public class TeleporterMKI extends ItemDE { - public TeleporterMKI(boolean MKII) { - } + public TeleporterMKI(boolean MKII) {} public TeleporterMKI() { this.setUnlocalizedName(Strings.teleporterMKIName); @@ -66,7 +64,12 @@ public class TeleporterMKI extends ItemDE { if (!player.capabilities.isCreativeMode) player.setHealth(player.getHealth() - 2); getLocation(stack).sendEntityToCoords(entity); if (player.worldObj.isRemote) - player.addChatMessage(new ChatComponentText(new ChatComponentTranslation("msg.teleporterSentMob.txt").getFormattedText() + " x:" + (int) getLocation(stack).getXCoord() + " y:" + (int) getLocation(stack).getYCoord() + " z:" + (int) getLocation(stack).getZCoord() + " Dimension: " + getLocation(stack).getDimensionName())); + player.addChatMessage(new ChatComponentText( + new ChatComponentTranslation("msg.teleporterSentMob.txt").getFormattedText() + " x:" + + (int) getLocation(stack).getXCoord() + " y:" + + (int) getLocation(stack).getYCoord() + " z:" + + (int) getLocation(stack).getZCoord() + " Dimension: " + + getLocation(stack).getDimensionName())); } else if (player.worldObj.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); @@ -78,7 +81,10 @@ public class TeleporterMKI extends ItemDE { if (player.isSneaking()) { if (getLocation(stack) == null) { if (world.isRemote) { - player.addChatMessage(new ChatComponentText(new ChatComponentTranslation("msg.teleporterBound.txt").getFormattedText() + "{X:" + (int) player.posX + " Y:" + (int) player.posY + " Z:" + (int) player.posZ + " Dim:" + player.worldObj.provider.getDimensionName() + "}")); + player.addChatMessage(new ChatComponentText( + new ChatComponentTranslation("msg.teleporterBound.txt").getFormattedText() + "{X:" + + (int) player.posX + " Y:" + (int) player.posY + " Z:" + (int) player.posZ + + " Dim:" + player.worldObj.provider.getDimensionName() + "}")); } else { ItemNBTHelper.setDouble(stack, "X", player.posX); ItemNBTHelper.setDouble(stack, "Y", player.posY); @@ -87,7 +93,14 @@ public class TeleporterMKI extends ItemDE { ItemNBTHelper.setFloat(stack, "Pitch", player.rotationPitch); ItemNBTHelper.setInteger(stack, "Dimension", player.dimension); ItemNBTHelper.setBoolean(stack, "IsSet", true); - ItemNBTHelper.setString(stack, "DimentionName", BrandonsCore.proxy.getMCServer().worldServerForDimension(player.dimension).provider.getDimensionName()); + ItemNBTHelper.setString( + stack, + "DimentionName", + BrandonsCore.proxy + .getMCServer() + .worldServerForDimension(player.dimension) + .provider + .getDimensionName()); } return stack; } else if (world.isRemote) @@ -108,11 +121,11 @@ public class TeleporterMKI extends ItemDE { player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); return stack; } - } @Override - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { if (!ItemNBTHelper.getBoolean(stack, "IsSet", false)) { list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("info.teleporterInfUnset1.txt")); list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfUnset2.txt")); @@ -121,8 +134,12 @@ public class TeleporterMKI extends ItemDE { list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfUnset5.txt")); } else { list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("info.teleporterInfSet1.txt")); - list.add(EnumChatFormatting.WHITE + "{x:" + (int) ItemNBTHelper.getDouble(stack, "X", 0) + " y:" + (int) ItemNBTHelper.getDouble(stack, "Y", 0) + " z:" + (int) ItemNBTHelper.getDouble(stack, "Z", 0) + " Dim:" + getLocation(stack).getDimensionName() + "}"); - list.add(EnumChatFormatting.BLUE + String.valueOf(stack.getMaxDamage() - stack.getItemDamage() + 1) + " " + StatCollector.translateToLocal("info.teleporterInfSet2.txt")); + list.add(EnumChatFormatting.WHITE + "{x:" + (int) ItemNBTHelper.getDouble(stack, "X", 0) + " y:" + + (int) ItemNBTHelper.getDouble(stack, "Y", 0) + " z:" + + (int) ItemNBTHelper.getDouble(stack, "Z", 0) + " Dim:" + + getLocation(stack).getDimensionName() + "}"); + list.add(EnumChatFormatting.BLUE + String.valueOf(stack.getMaxDamage() - stack.getItemDamage() + 1) + " " + + StatCollector.translateToLocal("info.teleporterInfSet2.txt")); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java index cd7fdc80..60894552 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java @@ -1,5 +1,8 @@ package com.brandon3055.draconicevolution.common.items.tools; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; import com.brandon3055.draconicevolution.common.ModItems; @@ -7,12 +10,11 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -26,9 +28,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { public TeleporterMKII() { @@ -52,7 +51,14 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { if (getLocation(stack) == null) { if (world.isRemote) - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_TELEPORTER, world, (int) player.posX, (int) player.posY, (int) player.posZ); + FMLNetworkHandler.openGui( + player, + DraconicEvolution.instance, + GuiHandler.GUIID_TELEPORTER, + world, + (int) player.posX, + (int) player.posY, + (int) player.posZ); return true; } @@ -84,13 +90,27 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { if (player.isSneaking()) { if (world.isRemote) { - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_TELEPORTER, world, (int) player.posX, (int) player.posY, (int) player.posZ); + FMLNetworkHandler.openGui( + player, + DraconicEvolution.instance, + GuiHandler.GUIID_TELEPORTER, + world, + (int) player.posX, + (int) player.posY, + (int) player.posZ); } } else { if (getLocation(stack) == null) { if (world.isRemote) - FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_TELEPORTER, world, (int) player.posX, (int) player.posY, (int) player.posZ); + FMLNetworkHandler.openGui( + player, + DraconicEvolution.instance, + GuiHandler.GUIID_TELEPORTER, + world, + (int) player.posX, + (int) player.posY, + (int) player.posZ); return stack; } @@ -107,9 +127,9 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { return stack; } - @Override - public void addInformation(final ItemStack teleporter, final EntityPlayer player, final List list2, final boolean extraInformation) { + public void addInformation( + final ItemStack teleporter, final EntityPlayer player, final List list2, final boolean extraInformation) { short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0); int selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0); NBTTagCompound compound = teleporter.getTagCompound(); @@ -120,9 +140,12 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { list2.add(EnumChatFormatting.GOLD + "" + selectedDest); if (InfoHelper.holdShiftForDetails(list2)) { - list2.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + ItemNBTHelper.getInteger(teleporter, "Fuel", 0)); - list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.teleporterInfGUI.txt")); - list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.teleporterInfScroll.txt")); + list2.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + + ItemNBTHelper.getInteger(teleporter, "Fuel", 0)); + list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.teleporterInfGUI.txt")); + list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.teleporterInfScroll.txt")); } } @@ -149,9 +172,11 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) { -// if (world.isRemote && entity instanceof EntityPlayer && ((EntityPlayer) entity).getHeldItem() != null && ((EntityPlayer) entity).getHeldItem().getItem() instanceof TeleporterMKII){ -// if (getLocation(((EntityPlayer) entity).getHeldItem()) != null) HudHandler.setTooltip(getLocation(((EntityPlayer) entity).getHeldItem()).getName()); -// } + // if (world.isRemote && entity instanceof EntityPlayer && ((EntityPlayer) entity).getHeldItem() != null && + // ((EntityPlayer) entity).getHeldItem().getItem() instanceof TeleporterMKII){ + // if (getLocation(((EntityPlayer) entity).getHeldItem()) != null) + // HudHandler.setTooltip(getLocation(((EntityPlayer) entity).getHeldItem()).getName()); + // } } @Override @@ -177,7 +202,8 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { if (location != null) { list.add(location.getName()); } - list.add(StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + ItemNBTHelper.getInteger(stack, "Fuel", 0)); + list.add(StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + + ItemNBTHelper.getInteger(stack, "Fuel", 0)); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java index a4b7e761..c2e6ca66 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java @@ -11,6 +11,8 @@ import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirel import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; 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.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -21,9 +23,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 23/08/2014. */ @@ -45,16 +44,18 @@ public class Wrench extends ItemDE implements IHudDisplayItem { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - //if (world.isRemote)FMLCommonHandler.instance().bus().register(new UpdateChecker()); - //player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.BLUE + "[Draconic Evolution]" + EnumChatFormatting.RESET + " New version available:")); + // if (world.isRemote)FMLCommonHandler.instance().bus().register(new UpdateChecker()); + // player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.BLUE + "[Draconic Evolution]" + + // EnumChatFormatting.RESET + " New version available:")); if (player.isSneaking()) cycleMode(stack, world, player); - else if (ItemNBTHelper.getCompound(stack).hasKey("LinkData") && ItemNBTHelper.getCompound(stack).getCompoundTag("LinkData").getBoolean("Bound")) + else if (ItemNBTHelper.getCompound(stack).hasKey("LinkData") + && ItemNBTHelper.getCompound(stack).getCompoundTag("LinkData").getBoolean("Bound")) ItemNBTHelper.getCompound(stack).getCompoundTag("LinkData").setBoolean("Bound", false); return super.onItemRightClick(stack, world, player); } - static final String[] modes = new String[]{BIND_MODE, UNBIND_MODE, CLEAR_BINDINGS, MODE_SWITCH}; + static final String[] modes = new String[] {BIND_MODE, UNBIND_MODE, CLEAR_BINDINGS, MODE_SWITCH}; private static void cycleMode(ItemStack stack, World world, EntityPlayer player) { String currentMode = ItemNBTHelper.getString(stack, "Mode", "bind"); @@ -75,12 +76,14 @@ public class Wrench extends ItemDE implements IHudDisplayItem { @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean bool) { - list.add(StatCollector.translateToLocal("msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); + list.add(StatCollector.translateToLocal( + "msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); NBTTagCompound linkDat = null; if (stack.hasTagCompound() && stack.getTagCompound().hasKey("LinkData")) linkDat = stack.getTagCompound().getCompoundTag("LinkData"); if (linkDat != null && linkDat.getBoolean("Bound")) { - list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); + list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") + + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); list.add(StatCollector.translateToLocal("msg.de.rightClickUnbind.txt")); } } @@ -88,12 +91,14 @@ public class Wrench extends ItemDE implements IHudDisplayItem { @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - list.add(StatCollector.translateToLocal("msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); + list.add(StatCollector.translateToLocal( + "msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); NBTTagCompound linkDat = null; if (stack.hasTagCompound() && stack.getTagCompound().hasKey("LinkData")) linkDat = stack.getTagCompound().getCompoundTag("LinkData"); if (linkDat != null && linkDat.getBoolean("Bound")) { - list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); + list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") + + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); list.add(StatCollector.translateToLocal("msg.de.rightClickUnbind.txt")); } return list; @@ -104,10 +109,21 @@ public class Wrench extends ItemDE implements IHudDisplayItem { } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { Block clicked = world.getBlock(x, y, z); - if (getMode(stack).equals(MODE_SWITCH) && clicked.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side)) && !world.isRemote) - return true; + if (getMode(stack).equals(MODE_SWITCH) + && clicked.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side)) + && !world.isRemote) return true; if (world.isRemote) return false; @@ -122,9 +138,10 @@ public class Wrench extends ItemDE implements IHudDisplayItem { int zCoord = linkData.getInteger("ZCoord"); if (world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileWirelessEnergyTransceiver) { - ((TileWirelessEnergyTransceiver) world.getTileEntity(xCoord, yCoord, zCoord)).linkDevice(x, y, z, side, player, ItemNBTHelper.getString(stack, "Mode", "bind")); + ((TileWirelessEnergyTransceiver) world.getTileEntity(xCoord, yCoord, zCoord)) + .linkDevice(x, y, z, side, player, ItemNBTHelper.getString(stack, "Mode", "bind")); - //linkData.setBoolean("Bound", false); + // linkData.setBoolean("Bound", false); return true; } else return false; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java index d7c335ca..8dbc6ab5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.List; - import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -11,6 +9,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.List; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; @@ -34,7 +33,10 @@ public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRender @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 0).setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0) + .setModifier("AOE")); return list; } @@ -127,172 +129,175 @@ public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRender } // @Override -// public boolean isItemTool(ItemStack p_77616_1_) { -// return true; -// } -// -// @SideOnly(Side.CLIENT) -// @SuppressWarnings("unchecked") -// @Override -// public void getSubItems(Item item, CreativeTabs tab, List list) { -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); -// } -// -// @Override -// public String getUnlocalizedName(){ -// -// return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); -// } -// -// @Override -// public String getUnlocalizedName(final ItemStack itemStack){ -// return getUnlocalizedName(); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public void registerIcons(final IIconRegister iconRegister) -// { -// this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick"); -// this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick_active"); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIconIndex(ItemStack stack) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } -// -// @Override -// public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer player) -// { -// World world = player.worldObj; -// Block block = world.getBlock(x, y, z); -// Material mat = block.getMaterial(); -// if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { -// return false; -// } -// int fortune = EnchantmentHelper.getFortuneModifier(player); -// boolean silk = EnchantmentHelper.getSilkTouchModifier(player); -// ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); -// return false; -// } -// -// @Override -// public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) -// { -// return ToolHandler.changeMode(stack, player, false, 1); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// @SuppressWarnings({ "unchecked", "rawtypes" }) -// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) -// { -// int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; -// if (InfoHelper.holdShiftForDetails(list)){ -// InfoHelper.addEnergyInfo(stack, list); -// -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); -// -// InfoHelper.addLore(stack, list); -// } -// } -// -// @Override -// public EnumRarity getRarity(ItemStack stack) -// { -// return EnumRarity.uncommon; -// } -// -// @Override -// public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { -// -// if (container.stackTagCompound == null) { -// container.stackTagCompound = new NBTTagCompound(); -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); -// -// if (!simulate) { -// energy += energyReceived; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyReceived; -// } -// -// @Override -// public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { -// -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); -// -// if (!simulate) { -// energy -= energyExtracted; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyExtracted; -// } -// -// @Override -// public int getEnergyStored(ItemStack container) { -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// return container.stackTagCompound.getInteger("Energy"); -// } -// -// @Override -// public int getMaxEnergyStored(ItemStack container) { -// return capacity; -// } -// -// @Override -// public boolean showDurabilityBar(ItemStack stack) { -// return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); -// } -// -// @Override -// public double getDurabilityForDisplay(ItemStack stack) { -// return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); -// } -// -// @Override -// public float getDigSpeed(ItemStack stack, Block block, int meta) { -// if ((stack.getItem() instanceof IEnergyContainerItem) && ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) -// return super.getDigSpeed(stack, block, meta); -// else -// return 1F; -// } -// -// @Override -// public boolean hasCustomEntity(ItemStack stack) { -// return true; -// } -// -// @Override -// public Entity createEntity(World world, Entity location, ItemStack itemstack) { -// return new EntityPersistentItem(world, location, itemstack); -// } + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } + // + // @SideOnly(Side.CLIENT) + // @SuppressWarnings("unchecked") + // @Override + // public void getSubItems(Item item, CreativeTabs tab, List list) { + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); + // } + // + // @Override + // public String getUnlocalizedName(){ + // + // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", + // super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + // } + // + // @Override + // public String getUnlocalizedName(final ItemStack itemStack){ + // return getUnlocalizedName(); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick_active"); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } + // + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // player) + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); + // return false; + // } + // + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, false, 1); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // @SuppressWarnings({ "unchecked", "rawtypes" }) + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // extraInformation) + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); + // + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // + size + "x" + size); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // + // InfoHelper.addLore(stack, list); + // } + // } + // + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.uncommon; + // } + // + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } + // + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } + // + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } + // + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } + // + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } + // + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } + // + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && + // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } + // + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } + // + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } - - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java index 40e92693..8e28ac80 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools; -import java.util.List; - import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -11,6 +9,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import java.util.List; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemStack; @@ -20,7 +19,6 @@ import org.lwjgl.opengl.GL11; public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderTweak { - public WyvernShovel() { super(ModItems.WYVERN); this.setHarvestLevel("shovel", 10); @@ -35,7 +33,10 @@ public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderT @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 0).setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0) + .setModifier("AOE")); return list; } @@ -126,152 +127,155 @@ public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderT return list; } -// @Override -// public boolean isItemTool(ItemStack p_77616_1_) { -// return true; -// } + // @Override + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } -// @Override -// @SideOnly(Side.CLIENT) -// public void registerIcons(final IIconRegister iconRegister) -// { -// this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel"); -// this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel_active"); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIconIndex(ItemStack stack) -// { -// if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) -// return itemIcon1; -// else -// return itemIcon0; -// } + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel_active"); + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } + // + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } -// @Override -// public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer player) -// { -// World world = player.worldObj; -// Block block = world.getBlock(x, y, z); -// Material mat = block.getMaterial(); -// if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { -// return false; -// } -// int fortune = EnchantmentHelper.getFortuneModifier(player); -// boolean silk = EnchantmentHelper.getSilkTouchModifier(player); -// ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); -// return false; -// } -// -// @Override -// public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) -// { -// return ToolHandler.changeMode(stack, player, false, 1); -// } -// -// @SuppressWarnings({ "rawtypes", "unchecked" }) -// @Override -// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) -// { -// int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; -// if (InfoHelper.holdShiftForDetails(list)){ -// InfoHelper.addEnergyInfo(stack, list); -// -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); -// -// InfoHelper.addLore(stack, list); -// } -// } -// -// @Override -// public EnumRarity getRarity(ItemStack stack) -// { -// return EnumRarity.uncommon; -// } -// -// @Override -// public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { -// -// if (container.stackTagCompound == null) { -// container.stackTagCompound = new NBTTagCompound(); -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); -// -// if (!simulate) { -// energy += energyReceived; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyReceived; -// } -// -// @Override -// public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { -// -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); -// -// if (!simulate) { -// energy -= energyExtracted; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyExtracted; -// } -// -// @Override -// public int getEnergyStored(ItemStack container) { -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// return container.stackTagCompound.getInteger("Energy"); -// } -// -// @Override -// public int getMaxEnergyStored(ItemStack container) { -// return capacity; -// } -// -// @Override -// public boolean showDurabilityBar(ItemStack stack) { -// return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); -// } -// -// @Override -// public double getDurabilityForDisplay(ItemStack stack) { -// return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); -// } -// -// @Override -// public float getDigSpeed(ItemStack stack, Block block, int meta) { -// if ((stack.getItem() instanceof IEnergyContainerItem) && ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) -// return super.getDigSpeed(stack, block, meta); -// else -// return 1F; -// } -// -// @Override -// public boolean hasCustomEntity(ItemStack stack) { -// return true; -// } -// -// @Override -// public Entity createEntity(World world, Entity location, ItemStack itemstack) { -// return new EntityPersistentItem(world, location, itemstack); -// } + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // player) + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); + // return false; + // } + // + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, false, 1); + // } + // + // @SuppressWarnings({ "rawtypes", "unchecked" }) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // extraInformation) + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); + // + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // + size + "x" + size); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // + // InfoHelper.addLore(stack, list); + // } + // } + // + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.uncommon; + // } + // + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } + // + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } + // + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } + // + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } + // + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } + // + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } + // + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && + // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } + // + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } + // + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java index 7438a4ae..8d651ab6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java @@ -1,10 +1,5 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.brandonscore.common.utills.Utills; @@ -14,12 +9,13 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.brandon3055.draconicevolution.integration.ModHelper; - -import cpw.mods.fml.common.Loader; +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.material.MaterialLiquid; import net.minecraft.client.Minecraft; -import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -47,7 +43,6 @@ import net.minecraftforge.event.world.BlockEvent; */ public abstract class MiningTool extends ToolBase implements IUpgradableItem { - public MiningTool(ToolMaterial material) { super(0, material, null); } @@ -78,14 +73,24 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { int radius = IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0); int depth = IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_DEPTH, 1) - 1; - return getEnergyStored(stack) >= energyPerOperation && (radius > 0) ? breakAOEBlocks(stack, x, y, z, radius, depth, player) : super.onBlockStartBreak(stack, x, y, z, player); + return getEnergyStored(stack) >= energyPerOperation && (radius > 0) + ? breakAOEBlocks(stack, x, y, z, radius, depth, player) + : super.onBlockStartBreak(stack, x, y, z, player); } @Override - public boolean onBlockDestroyed(ItemStack stack, World p_150894_2_, Block p_150894_3_, int p_150894_4_, int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) { + public boolean onBlockDestroyed( + ItemStack stack, + World p_150894_2_, + Block p_150894_3_, + int p_150894_4_, + int p_150894_5_, + int p_150894_6_, + EntityLivingBase p_150894_7_) { if (IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0) == 0) extractEnergy(stack, energyPerOperation, false); - return super.onBlockDestroyed(stack, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_); + return super.onBlockDestroyed( + stack, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_); } @Override @@ -94,8 +99,11 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { return super.onItemRightClick(stack, world, player); } - public boolean breakAOEBlocks(ItemStack stack, int x, int y, int z, int breakRadius, int breakDepth, EntityPlayer player) { - Map blockMap = IConfigurableItem.ProfileHelper.getBoolean(stack, References.OBLITERATE, false) ? getObliterationList(stack) : new HashMap(); + public boolean breakAOEBlocks( + ItemStack stack, int x, int y, int z, int breakRadius, int breakDepth, EntityPlayer player) { + Map blockMap = IConfigurableItem.ProfileHelper.getBoolean(stack, References.OBLITERATE, false) + ? getObliterationList(stack) + : new HashMap(); Block block = player.worldObj.getBlock(x, y, z); int meta = player.worldObj.getBlockMetadata(x, y, z); boolean effective = false; @@ -110,7 +118,6 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { float refStrength = ForgeHooks.blockStrength(block, player, player.worldObj, x, y, z); - MovingObjectPosition mop = ToolHandler.raytraceFromEntity(player.worldObj, player, 4.5d); if (mop == null) { ToolHandler.updateGhostBlocks(player, player.worldObj); @@ -167,12 +174,14 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { for (int xPos = x - xMin; xPos <= x + xMax; xPos++) { for (int yPos = y + yOffset - yMin; yPos <= y + yOffset + yMax; yPos++) { for (int zPos = z - zMin; zPos <= z + zMax; zPos++) { - TileEntity te = player.worldObj.getTileEntity(xPos, yPos, zPos); + TileEntity te = player.worldObj.getTileEntity(xPos, yPos, zPos); if (te != null && !ModHelper.isGregTechTileEntityOre(te)) { if (player.worldObj.isRemote) { player.addChatComponentMessage(new ChatComponentTranslation("msg.de.baseSafeAOW.txt")); } else - ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, ((EntityPlayerMP) player).worldObj)); + ((EntityPlayerMP) player) + .playerNetServerHandler.sendPacket( + new S23PacketBlockChange(x, y, z, ((EntityPlayerMP) player).worldObj)); return true; } } @@ -180,26 +189,37 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { } } - - for (int xPos = x - xMin; xPos <= x + xMax; xPos++) { for (int yPos = y + yOffset - yMin; yPos <= y + yOffset + yMax; yPos++) { for (int zPos = z - zMin; zPos <= z + zMax; zPos++) { - player.worldObj.getChunkFromBlockCoords(xPos, zPos).sendUpdates=false; - breakExtraBlock(stack, player.worldObj, xPos, yPos, zPos, breakRadius * ((breakDepth / 2) + 1), player, refStrength, Math.abs(x - xPos) <= 1 && Math.abs(y - yPos) <= 1 && Math.abs(z - zPos) <= 1, blockMap); + player.worldObj.getChunkFromBlockCoords(xPos, zPos).sendUpdates = false; + breakExtraBlock( + stack, + player.worldObj, + xPos, + yPos, + zPos, + breakRadius * ((breakDepth / 2) + 1), + player, + refStrength, + Math.abs(x - xPos) <= 1 && Math.abs(y - yPos) <= 1 && Math.abs(z - zPos) <= 1, + blockMap); } } } for (int xPos = x - xMin; xPos <= x + xMax; xPos++) { for (int yPos = y + yOffset - yMin; yPos <= y + yOffset + yMax; yPos++) { for (int zPos = z - zMin; zPos <= z + zMax; zPos++) { - player.worldObj.getChunkFromBlockCoords(x, z).sendUpdates=true; - player.worldObj.getChunkFromBlockCoords(x, z).isModified=true; + player.worldObj.getChunkFromBlockCoords(x, z).sendUpdates = true; + player.worldObj.getChunkFromBlockCoords(x, z).isModified = true; } } } - - List items = player.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - xMin, y + yOffset - yMin, z - zMin, x + xMax + 1, y + yOffset + yMax + 1, z + zMax + 1)); + + List items = player.worldObj.getEntitiesWithinAABB( + EntityItem.class, + AxisAlignedBB.getBoundingBox( + x - xMin, y + yOffset - yMin, z - zMin, x + xMax + 1, y + yOffset + yMax + 1, z + zMax + 1)); for (EntityItem item : items) { if (!player.worldObj.isRemote) { item.setLocationAndAngles(player.posX, player.posY, player.posZ, 0, 0); @@ -211,13 +231,23 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { return true; } - - protected void breakExtraBlock(ItemStack stack, World world, int x, int y, int z, int totalSize, EntityPlayer player, float refStrength, boolean breakSound, Map blockMap) { + + protected void breakExtraBlock( + ItemStack stack, + World world, + int x, + int y, + int z, + int totalSize, + EntityPlayer player, + float refStrength, + boolean breakSound, + Map blockMap) { if (world.isAirBlock(x, y, z)) return; Block block = world.getBlock(x, y, z); - if (block.getMaterial() instanceof MaterialLiquid || (block.getBlockHardness(world, x, y, x) == -1 && !player.capabilities.isCreativeMode)) - return; + if (block.getMaterial() instanceof MaterialLiquid + || (block.getBlockHardness(world, x, y, x) == -1 && !player.capabilities.isCreativeMode)) return; int meta = world.getBlockMetadata(x, y, z); @@ -231,11 +261,13 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { float strength = ForgeHooks.blockStrength(block, player, world, x, y, z); - if (!player.canHarvestBlock(block) || !ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f && !player.capabilities.isCreativeMode) - return; + if (!player.canHarvestBlock(block) + || !ForgeHooks.canHarvestBlock(block, player, meta) + || refStrength / strength > 10f && !player.capabilities.isCreativeMode) return; if (!world.isRemote) { - BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, world.getWorldInfo().getGameType(), (EntityPlayerMP) player, x, y, z); + BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent( + world, world.getWorldInfo().getGameType(), (EntityPlayerMP) player, x, y, z); if (event.isCanceled()) { ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); return; @@ -262,49 +294,56 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { extractEnergy(stack, scaledPower, false); if (!world.isRemote) { - + block.onBlockHarvested(world, x, y, z, meta, player); - - ArrayList drops = block.getDrops(world, x, y, z, meta, EnchantmentHelper.getFortuneModifier(player)); + + ArrayList drops = + block.getDrops(world, x, y, z, meta, EnchantmentHelper.getFortuneModifier(player)); for (ItemStack is : drops) { - if (!player.inventory.addItemStackToInventory(is)) { - if (world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots){ - float f = 0.7F; - double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, is); - entityitem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityitem); - } - } - } + if (!player.inventory.addItemStackToInventory(is)) { + if (world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { + float f = 0.7F; + double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + EntityItem entityitem = + new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, is); + entityitem.delayBeforeCanPickup = 10; + world.spawnEntityInWorld(entityitem); + } + } + } block.onBlockDestroyedByPlayer(world, x, y, z, meta); - world.setBlock(x, y, z, Blocks.air, 0, 2); + world.setBlock(x, y, z, Blocks.air, 0, 2); player.addExhaustion(-0.025F); if (block.getExpDrop(world, meta, EnchantmentHelper.getFortuneModifier(player)) > 0) - player.addExperience(block.getExpDrop(world, meta, EnchantmentHelper.getFortuneModifier(player))); + player.addExperience(block.getExpDrop(world, meta, EnchantmentHelper.getFortuneModifier(player))); EntityPlayerMP mpPlayer = (EntityPlayerMP) player; mpPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); - + } else { if (breakSound) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); if (block.removedByPlayer(world, player, x, y, z, false)) { - block.onBlockDestroyedByPlayer(world, x, y, z, meta); + block.onBlockDestroyedByPlayer(world, x, y, z, meta); } - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit)); + Minecraft.getMinecraft() + .getNetHandler() + .addToSendQueue( + new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit)); } } @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.DIG_SPEED); - add(EnumUpgrade.DIG_AOE); - add(EnumUpgrade.DIG_DEPTH); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.DIG_SPEED); + add(EnumUpgrade.DIG_AOE); + add(EnumUpgrade.DIG_DEPTH); + } + }; } @Override @@ -331,16 +370,22 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { else if (field.name.equals(References.ATTACK_AOE)) attackaoe = 1 + ((Integer) field.max * 2); } - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() + digaoe + "x" + digaoe); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() + digaoe + "x" + + digaoe); if (depth > 0) - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigDepth.txt") + ": " + InfoHelper.HITC() + depth); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigSpeed.txt") + ": " + InfoHelper.HITC() + getEfficiency(stack)); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.DigDepth.txt") + ": " + InfoHelper.HITC() + depth); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.DigSpeed.txt") + ": " + InfoHelper.HITC() + + getEfficiency(stack)); if (attackaoe > 0) - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + "x" + attackaoe); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + + "x" + attackaoe); return strings; } } - - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java index e09cbbc8..ca6bec1a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java @@ -12,6 +12,8 @@ import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -21,9 +23,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - /** * Created by Brandon on 8/01/2015. */ @@ -53,7 +52,7 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu return new EntityPersistentItem(world, location, itemstack); } - /* Energy */ + /* Energy */ public void setCapacity(int capacity) { this.capacity = capacity; @@ -136,7 +135,7 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu return capacity > 0; } - /* IConfigurableItem */ + /* IConfigurableItem */ @Override public List getFields(ItemStack stack, int slot) { @@ -148,15 +147,17 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu List list = new ArrayList(); if (hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); } - for (ItemConfigField field : getFields(stack, 0)){ - list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); + for (ItemConfigField field : getFields(stack, 0)) { + list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); } if (getCapacity(stack) > 0) { - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); } return list; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java index 7add93e2..f01ff1fa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java @@ -15,6 +15,9 @@ import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.google.common.collect.Sets; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -29,24 +32,78 @@ import net.minecraftforge.common.ForgeHooks; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * Created by Brandon on 2/01/2015. */ public class ToolBase extends RFItemBase { - private static final Set SHOVEL_OVERRIDES = Sets.newHashSet(Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium, Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay); - private static final Set PICKAXE_OVERRIDES = Sets.newHashSet(Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block, Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail, Material.iron, Material.anvil, Material.rock, Material.glass, Material.ice, Material.packedIce); - private static final Set AXE_OVERRIDES = Sets.newHashSet(Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Material.wood, Material.leaves, Material.coral, Material.cactus, Material.plants, Material.vine); - + private static final Set SHOVEL_OVERRIDES = Sets.newHashSet( + Blocks.grass, + Blocks.dirt, + Blocks.sand, + Blocks.gravel, + Blocks.snow_layer, + Blocks.snow, + Blocks.clay, + Blocks.farmland, + Blocks.soul_sand, + Blocks.mycelium, + Material.grass, + Material.ground, + Material.sand, + Material.snow, + Material.craftedSnow, + Material.clay); + private static final Set PICKAXE_OVERRIDES = Sets.newHashSet( + Blocks.cobblestone, + Blocks.double_stone_slab, + Blocks.stone_slab, + Blocks.stone, + Blocks.sandstone, + Blocks.mossy_cobblestone, + Blocks.iron_ore, + Blocks.iron_block, + Blocks.coal_ore, + Blocks.gold_block, + Blocks.gold_ore, + Blocks.diamond_ore, + Blocks.diamond_block, + Blocks.ice, + Blocks.netherrack, + Blocks.lapis_ore, + Blocks.lapis_block, + Blocks.redstone_ore, + Blocks.lit_redstone_ore, + Blocks.rail, + Blocks.detector_rail, + Blocks.golden_rail, + Blocks.activator_rail, + Material.iron, + Material.anvil, + Material.rock, + Material.glass, + Material.ice, + Material.packedIce); + private static final Set AXE_OVERRIDES = Sets.newHashSet( + Blocks.planks, + Blocks.bookshelf, + Blocks.log, + Blocks.log2, + Blocks.chest, + Blocks.pumpkin, + Blocks.lit_pumpkin, + Material.wood, + Material.leaves, + Material.coral, + Material.cactus, + Material.plants, + Material.vine); /** * A list of blocks this tool can mine that are not covered by the tool class. */ private Set blockOverrides; + private float efficiencyOnProperMaterial = 4.0F; /** * Damage versus entities. @@ -88,7 +145,9 @@ public class ToolBase extends RFItemBase { */ @Override public float func_150893_a(ItemStack stack, Block block) { - return blockOverrides.contains(block) || blockOverrides.contains(block.getMaterial()) ? getEfficiency(stack) : 1.0F; + return blockOverrides.contains(block) || blockOverrides.contains(block.getMaterial()) + ? getEfficiency(stack) + : 1.0F; } /** @@ -111,7 +170,6 @@ public class ToolBase extends RFItemBase { return this.toolMaterial.getEnchantability(); } - @Override public float getDigSpeed(ItemStack stack, Block block, int meta) { float speed; @@ -134,9 +192,13 @@ public class ToolBase extends RFItemBase { public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); if (!getToolClasses(stack).isEmpty()) - list.add(new ItemConfigField(References.FLOAT_ID, slot, References.DIG_SPEED_MULTIPLIER).setMinMaxAndIncromente(0f, 1f, 0.01f).readFromItem(stack, 1f).setModifier("PERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, References.DIG_SPEED_MULTIPLIER) + .setMinMaxAndIncromente(0f, 1f, 0.01f) + .readFromItem(stack, 1f) + .setModifier("PERCENT")); if (!getToolClasses(stack).isEmpty()) - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.BASE_SAFE_AOE).readFromItem(stack, false)); + list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.BASE_SAFE_AOE) + .readFromItem(stack, false)); return list; } @@ -147,11 +209,14 @@ public class ToolBase extends RFItemBase { if (show) { if (hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); } List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); - // if (getCapacity(stack) > 0) list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getCapacity(stack))); + // if (getCapacity(stack) > 0) list.add(InfoHelper.ITC() + + // StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + + // Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getCapacity(stack))); } holdCTRLForUpgrades(list, stack); @@ -167,7 +232,8 @@ public class ToolBase extends RFItemBase { key = Keyboard.getKeyName(KeyBindings.toolConfig.getKeyCode()); else key = Mouse.getButtonName(KeyBindings.toolConfig.getKeyCode() + 101); - list.add(StatCollector.translateToLocal("info.de.press.txt") + " " + key + " " + StatCollector.translateToLocal("info.de.toOpenConfigGUI.txt")); + list.add(StatCollector.translateToLocal("info.de.press.txt") + " " + key + " " + + StatCollector.translateToLocal("info.de.toOpenConfigGUI.txt")); } @Override @@ -183,7 +249,8 @@ public class ToolBase extends RFItemBase { handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - DraconicEvolution.network.sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); + DraconicEvolution.network.sendToServer( + new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); } return super.onItemRightClick(stack, world, player); @@ -201,7 +268,11 @@ public class ToolBase extends RFItemBase { aoe++; if (aoe > (Integer) field.max) aoe = (Integer) field.min; field.value = aoe; - DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name); + DataUtills.writeObjectToCompound( + IConfigurableItem.ProfileHelper.getProfileCompound(stack), + field.value, + field.datatype, + field.name); } } } else if (ctrl && !shift) { @@ -212,7 +283,11 @@ public class ToolBase extends RFItemBase { aoe++; if (aoe > (Integer) field.max) aoe = (Integer) field.min; field.value = aoe; - DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name); + DataUtills.writeObjectToCompound( + IConfigurableItem.ProfileHelper.getProfileCompound(stack), + field.value, + field.datatype, + field.name); } } } else if (ctrl && shift) { @@ -223,7 +298,11 @@ public class ToolBase extends RFItemBase { aoe++; if (aoe > (Integer) field.max) aoe = (Integer) field.min; field.value = aoe; - DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name); + DataUtills.writeObjectToCompound( + IConfigurableItem.ProfileHelper.getProfileCompound(stack), + field.value, + field.datatype, + field.name); } } } @@ -236,10 +315,14 @@ public class ToolBase extends RFItemBase { public static void holdCTRLForUpgrades(List list, ItemStack stack) { if (stack == null || !(stack.getItem() instanceof IUpgradableItem)) return; if (!InfoHelper.isCtrlKeyDown()) - list.add(StatCollector.translateToLocal("info.de.hold.txt") + " " + EnumChatFormatting.AQUA + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.de.ctrl.txt") + EnumChatFormatting.RESET + " " + EnumChatFormatting.GRAY + StatCollector.translateToLocal("info.de.forUpgrades.txt")); + list.add(StatCollector.translateToLocal("info.de.hold.txt") + " " + EnumChatFormatting.AQUA + "" + + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.de.ctrl.txt") + + EnumChatFormatting.RESET + " " + EnumChatFormatting.GRAY + + StatCollector.translateToLocal("info.de.forUpgrades.txt")); else { list.addAll(((IUpgradableItem) stack.getItem()).getUpgradeStats(stack)); - list.add(EnumChatFormatting.GOLD + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.de.useUpgradeModifier.txt")); + list.add(EnumChatFormatting.GOLD + "" + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.de.useUpgradeModifier.txt")); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java index 9b6467ab..14e570ec 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java @@ -1,12 +1,11 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; -import java.util.List; - import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile; import com.brandon3055.draconicevolution.common.items.weapons.IEnergyContainerWeaponItem; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.LogHelper; +import java.util.List; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -24,121 +23,132 @@ import net.minecraft.util.*; import net.minecraft.world.World; public class ToolHandler { -// public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, Blocks.grass, Blocks.netherrack}; -// -// public static boolean isRightMaterial(final Material material, final Material[] materialsListing) { -// for (final Material mat : materialsListing) { -// if (material == mat) { -// return true; -// } -// } -// return false; -// } -// -// public static boolean checkDestroyList(Block curBlock) { -// for (Block block : destroyList) { -// if (curBlock == block) { -// return true; -// } -// } -// return false; -// } -// -// public static boolean disSquare(int x, int y, int z, final EntityPlayer player, final World world, final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) { -// int size = stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0); -// MovingObjectPosition mop = raytraceFromEntity(world, player, 4.5D); -// if (mop == null) { -// updateGhostBlocks(player, world); -// return false; -// } -// -// int sizeX = size; -// int sizeY = size; -// int sizeZ = size; -// int yOff = (size * -1); -// Block targetBlock = world.getBlock(x, y, z); -// if (size > 0) yOff++; -// //if (size == 0) return false; -// int side = (stack.getItem().equals(ModItems.draconicAxe)) ? 6 : mop.sideHit; -// switch (side) { -// case 0: -// case 1: -// sizeY = 0; -// yOff = 0; -// break; -// case 2: -// case 3: -// sizeZ = 0; -// break; -// case 4: -// case 5: -// sizeX = 0; -// break; -// } -// -// for (int x1 = x - sizeX; x1 <= x + sizeX; x1++) { -// for (int y1 = y - (sizeY + yOff); y1 <= y + (sizeY - yOff); y1++) { -// for (int z1 = z - sizeZ; z1 <= z + sizeZ; z1++) { -// mineBlock(x1, y1, z1, player, world, silk, fortune, materialsListing, stack); -// //player.worldObj.scheduleBlockUpdate(x1, y1, z1, Blocks.stone, 100); -// } -// } -// } -// world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, targetBlock.stepSound.getStepResourcePath(), (targetBlock.stepSound.getVolume() + 1.0F) / 2.0F, targetBlock.stepSound.getPitch() * 0.8F); -// return true; -// } -// -// @SuppressWarnings({"rawtypes", "unchecked"}) -// public static void mineBlock(final int x, final int y, final int z, final EntityPlayer player, final World world, final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) { -// Block block = world.getBlock(x, y, z); -// int meta = world.getBlockMetadata(x, y, z); -// Material mat = block.getMaterial(); -// if ((block != null) && (!block.isAir(world, x, y, z)) && (block.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0.0F)) { -// List items = new ArrayList(); -// -// if ((!block.canHarvestBlock(player, meta)) || (!isRightMaterial(mat, materialsListing))) { -// return; -// } -// -// if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) { -// if (!player.capabilities.isCreativeMode) return; -// } else { -// if (!player.capabilities.isCreativeMode) -// ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false); -// } -// -// if (checkDestroyList(block) && (IConfigurableItem.ProfileHelper.getBoolean(stack, "obliterate", false))) { -// world.setBlockToAir(x, y, z); -// return; -// } -// -// if ((stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0)) == 0) return; -// -// if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) { -// if (block == Blocks.lit_redstone_ore) -// items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore))); -// else items.add(new ItemStack(block, 1, meta)); -// } else { -// items.addAll(block.getDrops(world, x, y, z, meta, fortune)); -// //block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, block.getExpDrop(world, meta, fortune)); -// int xp = block.getExpDrop(world, meta, fortune); -// player.addExperience(xp); -// } -// -// world.setBlockToAir(x, y, z); -// -// if (!world.isRemote && !player.capabilities.isCreativeMode && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { -// for (ItemStack item : items) { -// world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item)); -// } -// } -// } -// } + // public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, + // Blocks.grass, Blocks.netherrack}; + // + // public static boolean isRightMaterial(final Material material, final Material[] materialsListing) { + // for (final Material mat : materialsListing) { + // if (material == mat) { + // return true; + // } + // } + // return false; + // } + // + // public static boolean checkDestroyList(Block curBlock) { + // for (Block block : destroyList) { + // if (curBlock == block) { + // return true; + // } + // } + // return false; + // } + // + // public static boolean disSquare(int x, int y, int z, final EntityPlayer player, final World world, final boolean + // silk, final int fortune, Material[] materialsListing, ItemStack stack) { + // int size = stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0); + // MovingObjectPosition mop = raytraceFromEntity(world, player, 4.5D); + // if (mop == null) { + // updateGhostBlocks(player, world); + // return false; + // } + // + // int sizeX = size; + // int sizeY = size; + // int sizeZ = size; + // int yOff = (size * -1); + // Block targetBlock = world.getBlock(x, y, z); + // if (size > 0) yOff++; + // //if (size == 0) return false; + // int side = (stack.getItem().equals(ModItems.draconicAxe)) ? 6 : mop.sideHit; + // switch (side) { + // case 0: + // case 1: + // sizeY = 0; + // yOff = 0; + // break; + // case 2: + // case 3: + // sizeZ = 0; + // break; + // case 4: + // case 5: + // sizeX = 0; + // break; + // } + // + // for (int x1 = x - sizeX; x1 <= x + sizeX; x1++) { + // for (int y1 = y - (sizeY + yOff); y1 <= y + (sizeY - yOff); y1++) { + // for (int z1 = z - sizeZ; z1 <= z + sizeZ; z1++) { + // mineBlock(x1, y1, z1, player, world, silk, fortune, materialsListing, stack); + // //player.worldObj.scheduleBlockUpdate(x1, y1, z1, Blocks.stone, 100); + // } + // } + // } + // world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, targetBlock.stepSound.getStepResourcePath(), + // (targetBlock.stepSound.getVolume() + 1.0F) / 2.0F, targetBlock.stepSound.getPitch() * 0.8F); + // return true; + // } + // + // @SuppressWarnings({"rawtypes", "unchecked"}) + // public static void mineBlock(final int x, final int y, final int z, final EntityPlayer player, final World world, + // final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) { + // Block block = world.getBlock(x, y, z); + // int meta = world.getBlockMetadata(x, y, z); + // Material mat = block.getMaterial(); + // if ((block != null) && (!block.isAir(world, x, y, z)) && (block.getPlayerRelativeBlockHardness(player, world, x, + // y, z) != 0.0F)) { + // List items = new ArrayList(); + // + // if ((!block.canHarvestBlock(player, meta)) || (!isRightMaterial(mat, materialsListing))) { + // return; + // } + // + // if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) + // stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) { + // if (!player.capabilities.isCreativeMode) return; + // } else { + // if (!player.capabilities.isCreativeMode) + // ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false); + // } + // + // if (checkDestroyList(block) && (IConfigurableItem.ProfileHelper.getBoolean(stack, "obliterate", false))) { + // world.setBlockToAir(x, y, z); + // return; + // } + // + // if ((stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0)) == 0) + // return; + // + // if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) { + // if (block == Blocks.lit_redstone_ore) + // items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore))); + // else items.add(new ItemStack(block, 1, meta)); + // } else { + // items.addAll(block.getDrops(world, x, y, z, meta, fortune)); + // //block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, + // block.getExpDrop(world, meta, fortune)); + // int xp = block.getExpDrop(world, meta, fortune); + // player.addExperience(xp); + // } + // + // world.setBlockToAir(x, y, z); + // + // if (!world.isRemote && !player.capabilities.isCreativeMode && + // world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { + // for (ItemStack item : items) { + // world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item)); + // } + // } + // } + // } public static void damageEntityBasedOnHealth(Entity entity, EntityPlayer player, float dmgMult) { ItemStack stack = player.getCurrentEquippedItem(); if (stack == null || !(stack.getItem() instanceof IEnergyContainerWeaponItem)) { - LogHelper.error("[ToolHandler.java:147] WTF? I don't get it... Player " + player.getCommandSenderName() + " whacked something with a DE weapon but that they are not holding? Ok someone is messing with my shit..."); + LogHelper.error( + "[ToolHandler.java:147] WTF? I don't get it... Player " + player.getCommandSenderName() + + " whacked something with a DE weapon but that they are not holding? Ok someone is messing with my shit..."); return; } @@ -151,7 +161,8 @@ public class ToolHandler { } if (entity instanceof EntityDragonPart) { - List list = player.worldObj.getEntitiesWithinAABB(EntityDragon.class, entity.boundingBox.expand(10, 10, 10)); + List list = + player.worldObj.getEntitiesWithinAABB(EntityDragon.class, entity.boundingBox.expand(10, 10, 10)); if (!list.isEmpty() && list.get(0) instanceof EntityDragon) { EntityDragon dragon = list.get(0); float entHealth = dragon.getHealth(); @@ -172,18 +183,23 @@ public class ToolHandler { if (!player.capabilities.isCreativeMode) item.extractEnergy(stack, rf, false); - if (entity instanceof EntityLivingBase) { EntityLivingBase entityLivingBase = (EntityLivingBase) entity; double d1 = player.posX - entityLivingBase.posX; double d0; - for (d0 = player.posZ - entityLivingBase.posZ; d1 * d1 + d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) { + for (d0 = player.posZ - entityLivingBase.posZ; + d1 * d1 + d0 * d0 < 1.0E-4D; + d0 = (Math.random() - Math.random()) * 0.01D) { d1 = (Math.random() - Math.random()) * 0.01D; } - entityLivingBase.attackedAtYaw = (float) (Math.atan2(d0, d1) * 180.0D / Math.PI) - entityLivingBase.rotationYaw; + entityLivingBase.attackedAtYaw = + (float) (Math.atan2(d0, d1) * 180.0D / Math.PI) - entityLivingBase.rotationYaw; - if (entityLivingBase.worldObj.rand.nextDouble() >= entityLivingBase.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) { + if (entityLivingBase.worldObj.rand.nextDouble() + >= entityLivingBase + .getEntityAttribute(SharedMonsterAttributes.knockbackResistance) + .getAttributeValue()) { entityLivingBase.isAirBorne = true; float f1 = MathHelper.sqrt_double(d1 * d1 + d0 * d0); float f2 = 0.1F + EnchantmentHelper.getKnockbackModifier(player, entityLivingBase) * 0.4F; @@ -203,7 +219,14 @@ public class ToolHandler { public static void AOEAttack(EntityPlayer player, Entity entity, ItemStack stack, int range) { World world = player.worldObj; - AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range).expand(1.0D, 1.0D, 1.0D); + AxisAlignedBB box = AxisAlignedBB.getBoundingBox( + entity.posX - range, + entity.posY - range, + entity.posZ - range, + entity.posX + range, + entity.posY + range, + entity.posZ + range) + .expand(1.0D, 1.0D, 1.0D); List list = world.getEntitiesWithinAABBExcludingEntity(player, box); if (range == 0) return; IEnergyContainerWeaponItem item = (IEnergyContainerWeaponItem) stack.getItem(); @@ -224,17 +247,22 @@ public class ToolHandler { entityLivingBase.attackEntityFrom(DamageSource.causePlayerDamage(player), dmg); item.extractEnergy(stack, rf, false); if (EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) > 0) - entityLivingBase.setFire(EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) * 15); - + entityLivingBase.setFire( + EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) * 15); double d1 = player.posX - entityLivingBase.posX; double d0; - for (d0 = player.posZ - entityLivingBase.posZ; d1 * d1 + d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) { + for (d0 = player.posZ - entityLivingBase.posZ; + d1 * d1 + d0 * d0 < 1.0E-4D; + d0 = (Math.random() - Math.random()) * 0.01D) { d1 = (Math.random() - Math.random()) * 0.01D; } - if (entityLivingBase.worldObj.rand.nextDouble() >= entityLivingBase.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) { + if (entityLivingBase.worldObj.rand.nextDouble() + >= entityLivingBase + .getEntityAttribute(SharedMonsterAttributes.knockbackResistance) + .getAttributeValue()) { entityLivingBase.isAirBorne = true; float f1 = MathHelper.sqrt_double(d1 * d1 + d0 * d0); float f2 = 0.1F + (EnchantmentHelper.getKnockbackModifier(player, entityLivingBase) * 0.4F); @@ -262,10 +290,10 @@ public class ToolHandler { item.extractEnergy(stack, rf, false); } } - } - public static MovingObjectPosition raytraceFromEntity(World world, Entity player, double range) {//todo move to core and make the range work as expected + public static MovingObjectPosition raytraceFromEntity( + World world, Entity player, double range) { // todo move to core and make the range work as expected float f = 1.0F; float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; @@ -297,8 +325,9 @@ public class ToolHandler { for (int x = xPos - 6; x < xPos + 6; x++) { for (int y = yPos - 6; y < yPos + 6; y++) { for (int z = zPos - 6; z < zPos + 6; z++) { - ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); - //world.markBlockForUpdate(x, y, z); + ((EntityPlayerMP) player) + .playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); + // world.markBlockForUpdate(x, y, z); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java index f525631d..c57c149e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items.weapons; -import java.util.Random; - import cofh.api.energy.IEnergyContainerItem; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow; @@ -9,6 +7,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; +import java.util.Random; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; @@ -64,7 +63,7 @@ public class BowHandler { return; } - float velocity = properties.arrowSpeed * drawArrowSpeedModifier * 2F; //2F is the speed of a vanilla arrow + float velocity = properties.arrowSpeed * drawArrowSpeedModifier * 2F; // 2F is the speed of a vanilla arrow EntityCustomArrow customArrow = new EntityCustomArrow(world, player, velocity); customArrow.bowProperties = properties; @@ -81,10 +80,23 @@ public class BowHandler { if (!world.isRemote) world.spawnEntityInWorld(customArrow); - world.playSoundAtEntity(player, "random.bow", 1.0F, (1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + (drawArrowSpeedModifier + (velocity / 40F)) * 0.5F)); + world.playSoundAtEntity( + player, + "random.bow", + 1.0F, + (1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + (drawArrowSpeedModifier + (velocity / 40F)) * 0.5F)); } - public static void enderShot(ItemStack stack, World world, EntityPlayer player, int count, Random itemRand, float pullSpeedModifier, float speedModifier, float soundPitchModifier, int minRelease) { + public static void enderShot( + ItemStack stack, + World world, + EntityPlayer player, + int count, + Random itemRand, + float pullSpeedModifier, + float speedModifier, + float soundPitchModifier, + int minRelease) { int j = 72000 - count; ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j); MinecraftForge.EVENT_BUS.post(event); @@ -105,9 +117,12 @@ public class BowHandler { EntityEnderArrow entityArrow = new EntityEnderArrow(world, player, f * 2.0F); - - stack.damageItem(1, player); // - world.playSoundAtEntity(player, "random.bow", 1.0F, soundPitchModifier * (1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.3F)); + stack.damageItem(1, player); // + world.playSoundAtEntity( + player, + "random.bow", + 1.0F, + soundPitchModifier * (1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.3F)); if (player.inventory.hasItem(ModItems.enderArrow)) player.inventory.consumeInventoryItem(ModItems.enderArrow); @@ -116,11 +131,9 @@ public class BowHandler { world.spawnEntityInWorld(entityArrow); player.mountEntity(entityArrow); } - } } - public static class BowProperties { public ItemStack bow; public EntityPlayer player; @@ -149,7 +162,9 @@ public class BowHandler { public int calculateEnergyCost() { updateValues(); - double rfCost = (bow.getItem() instanceof IEnergyContainerWeaponItem) ? ((IEnergyContainerWeaponItem) bow.getItem()).getEnergyPerAttack() : 80; + double rfCost = (bow.getItem() instanceof IEnergyContainerWeaponItem) + ? ((IEnergyContainerWeaponItem) bow.getItem()).getEnergyPerAttack() + : 80; rfCost *= 1 + arrowDamage; rfCost *= (1 + arrowSpeed) * (1 + arrowSpeed) * (1 + arrowSpeed); @@ -165,7 +180,8 @@ public class BowHandler { if (player == null) return false; if (!(bow.getItem() instanceof IEnergyContainerWeaponItem)) { - cantFireMessage = "[Error] This bow is not a valid energy container (This is a bug, Please report on the Draconic Evolution github)"; + cantFireMessage = + "[Error] This bow is not a valid energy container (This is a bug, Please report on the Draconic Evolution github)"; return false; } else if (!energyBolt && shockWavePower > 0) { cantFireMessage = "msg.de.shockWaveForEnergyBoltsOnly.txt"; @@ -173,21 +189,25 @@ public class BowHandler { } else if (energyBolt && explosionPower > 0) { cantFireMessage = "msg.de.explosiveNotForEnergyBolts.txt"; return false; - } else if (calculateEnergyCost() > ((IEnergyContainerWeaponItem) bow.getItem()).getEnergyStored(bow) && !player.capabilities.isCreativeMode) { + } else if (calculateEnergyCost() > ((IEnergyContainerWeaponItem) bow.getItem()).getEnergyStored(bow) + && !player.capabilities.isCreativeMode) { cantFireMessage = "msg.de.insufficientPowerToFire.txt"; return false; - } else if (!energyBolt && !player.inventory.hasItem(Items.arrow) && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 && !player.capabilities.isCreativeMode) { + } else if (!energyBolt + && !player.inventory.hasItem(Items.arrow) + && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 + && !player.capabilities.isCreativeMode) { cantFireMessage = "msg.de.outOfArrows.txt"; return false; } - cantFireMessage = null; return true; } private void updateValues() { - arrowDamage = IConfigurableItem.ProfileHelper.getFloat(bow, "BowArrowDamage", IUpgradableItem.EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(bow)); + arrowDamage = IConfigurableItem.ProfileHelper.getFloat( + bow, "BowArrowDamage", IUpgradableItem.EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(bow)); arrowSpeed = 1F + IConfigurableItem.ProfileHelper.getFloat(bow, "BowArrowSpeedModifier", 0F); explosionPower = IConfigurableItem.ProfileHelper.getFloat(bow, "BowExplosionPower", 0F); shockWavePower = IConfigurableItem.ProfileHelper.getFloat(bow, "BowShockWavePower", 0F); @@ -210,7 +230,9 @@ public class BowHandler { if (!player.capabilities.isCreativeMode) ((IEnergyContainerWeaponItem) bow.getItem()).extractEnergy(bow, calculateEnergyCost(), false); - if (!energyBolt && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 && !player.capabilities.isCreativeMode) { + if (!energyBolt + && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 + && !player.capabilities.isCreativeMode) { player.inventory.consumeInventoryItem(Items.arrow); return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java index 175d5f87..3b85ee97 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java @@ -19,6 +19,8 @@ import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; @@ -33,15 +35,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; - -public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerWeaponItem, IHudDisplayItem { - public static final String[] bowPullIconNameArray = new String[]{"pulling_0", "pulling_1", "pulling_2"}; +public class DraconicBow extends ItemBow + implements IInventoryTool, IUpgradableItem, IEnergyContainerWeaponItem, IHudDisplayItem { + public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; protected int capacity = BalanceConfigHandler.draconicWeaponsBaseStorage; protected int maxReceive = BalanceConfigHandler.draconicWeaponsMaxTransfer; protected int maxExtract = BalanceConfigHandler.draconicWeaponsMaxTransfer; + @SideOnly(Side.CLIENT) private IIcon[] iconArray; @@ -53,7 +54,7 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI if (ModItems.isEnabled(this)) GameRegistry.registerItem(this, Strings.draconicBowName); } - //region Regular Item Stuff + // region Regular Item Stuff @Override public boolean isItemTool(ItemStack p_77616_1_) { @@ -63,7 +64,10 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", + super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); } @Override @@ -78,7 +82,8 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI this.iconArray = new IIcon[bowPullIconNameArray.length]; for (int i = 0; i < this.iconArray.length; ++i) { - this.iconArray[i] = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_bow" + "_" + bowPullIconNameArray[i]); + this.iconArray[i] = iconRegister.registerIcon( + References.RESOURCESPREFIX + "draconic_bow" + "_" + bowPullIconNameArray[i]); } } @@ -111,11 +116,13 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI @Override @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { boolean show = InfoHelper.holdShiftForDetails(list); if (show) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); } @@ -146,7 +153,6 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI return 1D - ((double) getEnergyStored(stack) / (double) getMaxEnergyStored(stack)); } - @Override public boolean hasCustomEntity(ItemStack stack) { return true; @@ -157,7 +163,7 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI return new EntityPersistentItem(world, location, itemstack); } - //endregion + // endregion @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { @@ -174,7 +180,7 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI BowHandler.onPlayerStoppedUsingBow(stack, world, player, count); } - //region Interfaces + // region Interfaces @Override public String getInventoryName() { @@ -195,25 +201,42 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage").setMinMaxAndIncromente((float) getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), 0.1F).readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier").setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage") + .setMinMaxAndIncromente( + (float) getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), + (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), + 0.1F) + .readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier") + .setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowAutoFire").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower").setMinMaxAndIncromente(0F, 6F, 0.1F).readFromItem(stack, 0F)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 10F, 0.1F).readFromItem(stack, 0F)); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower") + .setMinMaxAndIncromente(0F, 6F, 0.1F) + .readFromItem(stack, 0F)); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower") + .setMinMaxAndIncromente(0F, 10F, 0.1F) + .readFromItem(stack, 0F)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier").setMinMaxAndIncromente(0F, 6F, 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier") + .setMinMaxAndIncromente(0F, 6F, 0.01F) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); return list; } @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.DRAW_SPEED); - add(EnumUpgrade.ARROW_SPEED); - add(EnumUpgrade.ARROW_DAMAGE); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.DRAW_SPEED); + add(EnumUpgrade.ARROW_SPEED); + add(EnumUpgrade.ARROW_DAMAGE); + } + }; } @Override @@ -266,10 +289,16 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI public List getUpgradeStats(ItemStack stack) { BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, null); List list = new ArrayList(); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+" + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + "%"); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack) + ""); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() + properties.getDrawTicks() / 20D + "s"); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+" + + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + "%"); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + + EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack) + ""); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() + + properties.getDrawTicks() / 20D + "s"); return list; } @@ -309,32 +338,43 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI @Override public int getMaxEnergyStored(ItemStack stack) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return BalanceConfigHandler.draconicWeaponsBaseStorage + points * BalanceConfigHandler.draconicWeaponsStoragePerUpgrade; + return BalanceConfigHandler.draconicWeaponsBaseStorage + + points * BalanceConfigHandler.draconicWeaponsStoragePerUpgrade; } @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - if (BrandonsCore.proxy.getClientPlayer() != null && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null && BrandonsCore.proxy.getClientPlayer().getItemInUseDuration() > 2) { + if (BrandonsCore.proxy.getClientPlayer() != null + && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null + && BrandonsCore.proxy.getClientPlayer().getItemInUseDuration() > 2) { EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); - int power = (int) Math.min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() + power + "%"); + int power = (int) + Math.min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() + + power + "%"); } else { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); for (ItemConfigField field : getFields(stack, 0)) { - if ((field.datatype == References.FLOAT_ID && (Float) field.value > 0) || (field.datatype == References.BOOLEAN_ID && (Boolean) field.value)) + if ((field.datatype == References.FLOAT_ID && (Float) field.value > 0) + || (field.datatype == References.BOOLEAN_ID && (Boolean) field.value)) list.add(field.getTooltipInfo()); } - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + " / " + + Utills.formatNumber(getMaxEnergyStored(stack))); if (BrandonsCore.proxy.getClientPlayer() != null) { - BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); + BowHandler.BowProperties properties = + new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); if (!properties.canFire() && properties.cantFireMessage != null) list.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal(properties.cantFireMessage)); } @@ -347,5 +387,5 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI return BalanceConfigHandler.draconicBowEnergyPerShot; } - //endregion + // endregion } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java index aa375d79..8c700be8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.items.weapons; -import java.util.ArrayList; -import java.util.List; - import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -22,6 +19,8 @@ import com.google.common.collect.Multimap; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; @@ -38,7 +37,8 @@ import net.minecraft.world.World; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -public class DraconicSword extends ItemSword implements IEnergyContainerWeaponItem, IInventoryTool, IRenderTweak, IUpgradableItem, IHudDisplayItem { +public class DraconicSword extends ItemSword + implements IEnergyContainerWeaponItem, IInventoryTool, IRenderTweak, IUpgradableItem, IHudDisplayItem { protected int capacity = BalanceConfigHandler.draconicWeaponsBaseStorage; protected int maxReceive = BalanceConfigHandler.draconicWeaponsMaxTransfer; protected int maxExtract = BalanceConfigHandler.draconicWeaponsMaxTransfer; @@ -65,7 +65,10 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", + super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); } @Override @@ -82,13 +85,15 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { entity.hurtResistantTime = 0; - ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); + ToolHandler.AOEAttack( + player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); ToolHandler.damageEntityBasedOnHealth(entity, player, 0.2F); return true; } @Override - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { if (InfoHelper.holdShiftForDetails(list)) { List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); @@ -98,8 +103,10 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addEnergyInfo(stack, list); list.add(""); - list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " + StatCollector.translateToLocal("info.de.attackDamage.txt")); - list.add(EnumChatFormatting.BLUE + "+20%" + " " + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); + list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " + + StatCollector.translateToLocal("info.de.attackDamage.txt")); + list.add(EnumChatFormatting.BLUE + "+20%" + " " + + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); } @Override @@ -140,7 +147,8 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt @Override public int getMaxEnergyStored(ItemStack container) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(container); - return BalanceConfigHandler.draconicWeaponsBaseStorage + points * BalanceConfigHandler.draconicWeaponsStoragePerUpgrade; + return BalanceConfigHandler.draconicWeaponsBaseStorage + + points * BalanceConfigHandler.draconicWeaponsStoragePerUpgrade; } @Override @@ -181,7 +189,10 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt @Override public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE).setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 1).setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 1) + .setModifier("AOE")); return list; } @@ -215,11 +226,13 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.ATTACK_AOE); - add(EnumUpgrade.ATTACK_DAMAGE); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.ATTACK_AOE); + add(EnumUpgrade.ATTACK_DAMAGE); + } + }; } @Override @@ -270,10 +283,13 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt for (ItemConfigField field : getFields(stack, 0)) if (field.name.equals(References.ATTACK_AOE)) attackaoe = 1 + ((Integer) field.max * 2); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + "x" + attackaoe); - + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + "x" + + attackaoe); return strings; } @@ -282,7 +298,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt public List getDisplayData(ItemStack stack) { List list = new ArrayList(); for (ItemConfigField field : getFields(stack, 0)) - list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); + list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); return list; } @@ -292,7 +308,8 @@ public class DraconicSword extends ItemSword implements IEnergyContainerWeaponIt ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - DraconicEvolution.network.sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); + DraconicEvolution.network.sendToServer( + new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); } return super.onItemRightClick(stack, world, player); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java index a0744943..3575b8fb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java @@ -19,6 +19,8 @@ import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; @@ -33,16 +35,15 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; +public class WyvernBow extends ItemBow + implements IInventoryTool, IUpgradableItem, IEnergyContainerWeaponItem, IHudDisplayItem { -public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerWeaponItem, IHudDisplayItem { - - public static final String[] bowPullIconNameArray = new String[]{"pulling_0", "pulling_1", "pulling_2"}; + public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; protected int capacity = BalanceConfigHandler.wyvernWeaponsBaseStorage; protected int maxReceive = BalanceConfigHandler.wyvernWeaponsMaxTransfer; protected int maxExtract = BalanceConfigHandler.wyvernWeaponsMaxTransfer; + @SideOnly(Side.CLIENT) private IIcon[] iconArray; @@ -54,7 +55,7 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte if (ModItems.isEnabled(this)) GameRegistry.registerItem(this, Strings.wyvernBowName); } - //region Regular Item Stuff + // region Regular Item Stuff @Override public boolean isItemTool(ItemStack p_77616_1_) { return true; @@ -63,7 +64,10 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", + super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); } @Override @@ -78,7 +82,8 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte this.iconArray = new IIcon[bowPullIconNameArray.length]; for (int i = 0; i < this.iconArray.length; ++i) { - this.iconArray[i] = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_bow" + "_" + bowPullIconNameArray[i]); + this.iconArray[i] = iconRegister.registerIcon( + References.RESOURCESPREFIX + "wyvern_bow" + "_" + bowPullIconNameArray[i]); } } @@ -100,7 +105,6 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte if (j2 < 0) j2 = 0; else if (j2 > 2) j2 = 2; - return getItemIconForUseDuration(j2); } @@ -122,11 +126,13 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte @Override @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { boolean show = InfoHelper.holdShiftForDetails(list); if (show) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); } @@ -156,7 +162,7 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte public double getDurabilityForDisplay(ItemStack stack) { return 1D - ((double) getEnergyStored(stack) / (double) getMaxEnergyStored(stack)); } - //endregion + // endregion @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { @@ -173,7 +179,7 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte BowHandler.onPlayerStoppedUsingBow(stack, world, player, count); } - //region Interfaces + // region Interfaces @Override public String getInventoryName() { return StatCollector.translateToLocal("info.de.toolInventoryEnch.txt"); @@ -193,13 +199,27 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage").setMinMaxAndIncromente((float) getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), 0.1F).readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier").setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage") + .setMinMaxAndIncromente( + (float) getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), + (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), + 0.1F) + .readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier") + .setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowAutoFire").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower").setMinMaxAndIncromente(0F, 4F, 0.1F).readFromItem(stack, 0F)); - // list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 4F, 0.1F).readFromItem(stack, 0F)); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower") + .setMinMaxAndIncromente(0F, 4F, 0.1F) + .readFromItem(stack, 0F)); + // list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 4F, + // 0.1F).readFromItem(stack, 0F)); // list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier").setMinMaxAndIncromente(0F, 3F, 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier") + .setMinMaxAndIncromente(0F, 3F, 0.01F) + .readFromItem(stack, 0F) + .setModifier("PLUSPERCENT")); return list; } @@ -211,12 +231,14 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.DRAW_SPEED); - add(EnumUpgrade.ARROW_SPEED); - add(EnumUpgrade.ARROW_DAMAGE); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.DRAW_SPEED); + add(EnumUpgrade.ARROW_SPEED); + add(EnumUpgrade.ARROW_DAMAGE); + } + }; } @Override @@ -269,10 +291,15 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte public List getUpgradeStats(ItemStack stack) { BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, null); List list = new ArrayList(); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+" + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + "%"); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + properties.arrowDamage + ""); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() + properties.getDrawTicks() / 20D + "s"); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+" + + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + "%"); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + + properties.arrowDamage + ""); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() + + properties.getDrawTicks() / 20D + "s"); return list; } @@ -307,36 +334,45 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte @Override public int getMaxEnergyStored(ItemStack stack) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return BalanceConfigHandler.wyvernWeaponsBaseStorage + points * BalanceConfigHandler.wyvernWeaponsStoragePerUpgrade; + return BalanceConfigHandler.wyvernWeaponsBaseStorage + + points * BalanceConfigHandler.wyvernWeaponsStoragePerUpgrade; } @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - if (BrandonsCore.proxy.getClientPlayer() != null && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null) { + if (BrandonsCore.proxy.getClientPlayer() != null + && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null) { EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); - int power = (int) Math.min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() + power + "%"); + int power = (int) + Math.min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() + + power + "%"); } else { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); for (ItemConfigField field : getFields(stack, 0)) { - if ((field.datatype == References.FLOAT_ID && (Float) field.value > 0) || (field.datatype == References.BOOLEAN_ID && (Boolean) field.value)) + if ((field.datatype == References.FLOAT_ID && (Float) field.value > 0) + || (field.datatype == References.BOOLEAN_ID && (Boolean) field.value)) list.add(field.getTooltipInfo()); } - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + " / " + + Utills.formatNumber(getMaxEnergyStored(stack))); if (BrandonsCore.proxy.getClientPlayer() != null) { - BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); + BowHandler.BowProperties properties = + new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); if (!properties.canFire() && properties.cantFireMessage != null) list.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal(properties.cantFireMessage)); } - } return list; } @@ -345,6 +381,5 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte public int getEnergyPerAttack() { return BalanceConfigHandler.wyvernBowEnergyPerShot; } - //endregion + // endregion } - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java index 48645506..5cb59e20 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.items.weapons; -import java.util.ArrayList; -import java.util.List; - import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -22,6 +19,8 @@ import com.google.common.collect.Multimap; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; @@ -39,7 +38,8 @@ import net.minecraft.world.World; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem, IInventoryTool, IRenderTweak, IUpgradableItem, IHudDisplayItem { +public class WyvernSword extends ItemSword + implements IEnergyContainerWeaponItem, IInventoryTool, IRenderTweak, IUpgradableItem, IHudDisplayItem { protected int capacity = BalanceConfigHandler.wyvernWeaponsBaseStorage; protected int maxReceive = BalanceConfigHandler.wyvernWeaponsMaxTransfer; @@ -57,7 +57,6 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem return true; } - @Override public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); @@ -67,7 +66,10 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem @Override public String getUnlocalizedName() { - return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); + return String.format( + "item.%s%s", + References.MODID.toLowerCase() + ":", + super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); } @Override @@ -75,7 +77,6 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem return getUnlocalizedName(); } - @Override @SideOnly(Side.CLIENT) public void registerIcons(final IIconRegister iconRegister) { @@ -84,13 +85,15 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { - ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); + ToolHandler.AOEAttack( + player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); ToolHandler.damageEntityBasedOnHealth(entity, player, 0.1F); return true; } @Override - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation( + final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { if (InfoHelper.holdShiftForDetails(list)) { List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); @@ -100,8 +103,10 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addEnergyInfo(stack, list); list.add(""); - list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " + StatCollector.translateToLocal("info.de.attackDamage.txt")); - list.add(EnumChatFormatting.BLUE + "+10%" + " " + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); + list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " + + StatCollector.translateToLocal("info.de.attackDamage.txt")); + list.add(EnumChatFormatting.BLUE + "+10%" + " " + + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); } @Override @@ -110,7 +115,8 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem } @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + public boolean hitEntity( + ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { return super.hitEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase); } @@ -147,7 +153,8 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem @Override public int getMaxEnergyStored(ItemStack container) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(container); - return BalanceConfigHandler.wyvernWeaponsBaseStorage + points * BalanceConfigHandler.wyvernWeaponsStoragePerUpgrade; + return BalanceConfigHandler.wyvernWeaponsBaseStorage + + points * BalanceConfigHandler.wyvernWeaponsStoragePerUpgrade; } @Override @@ -188,7 +195,10 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem @Override public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE).setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1).readFromItem(stack, 1).setModifier("AOE")); + list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 1) + .setModifier("AOE")); return list; } @@ -219,11 +229,13 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() {{ - add(EnumUpgrade.RF_CAPACITY); - add(EnumUpgrade.ATTACK_AOE); - add(EnumUpgrade.ATTACK_DAMAGE); - }}; + return new ArrayList() { + { + add(EnumUpgrade.RF_CAPACITY); + add(EnumUpgrade.ATTACK_AOE); + add(EnumUpgrade.ATTACK_DAMAGE); + } + }; } @Override @@ -274,10 +286,13 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem for (ItemConfigField field : getFields(stack, 0)) if (field.name.equals(References.ATTACK_AOE)) attackaoe = 1 + ((Integer) field.max * 2); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + "x" + attackaoe); - + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); + strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + "x" + + attackaoe); return strings; } @@ -286,7 +301,7 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem public List getDisplayData(ItemStack stack) { List list = new ArrayList(); for (ItemConfigField field : getFields(stack, 0)) - list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); + list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); return list; } @@ -296,7 +311,8 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - DraconicEvolution.network.sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); + DraconicEvolution.network.sendToServer( + new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); } return super.onItemRightClick(stack, world, player); } @@ -311,4 +327,3 @@ public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem return BalanceConfigHandler.wyvernWeaponsEnergyPerAttack; } } - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java index 33b927c9..e21d7a7a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java @@ -1,8 +1,10 @@ package com.brandon3055.draconicevolution.common.lib; -import com.brandon3055.draconicevolution.common.items.DraconiumBlend; import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.DraconiumBlend; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.HashMap; +import java.util.Map; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -10,15 +12,26 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.oredict.OreDictionary; -import java.util.HashMap; -import java.util.Map; - /** * Created by Brandon on 2/11/2014. */ public class OreDoublingRegistry { private static Map oreResults = new HashMap(); - private static String[] names = {"oreGold", "oreIron", "oreAluminum", "oreCopper", "oreLead", "oreSilver", "oreTin", "oreUranium", "orePlatinum", "oreNickel", "oreMithril", "oreCobalt", "oreArdite"}; + private static String[] names = { + "oreGold", + "oreIron", + "oreAluminum", + "oreCopper", + "oreLead", + "oreSilver", + "oreTin", + "oreUranium", + "orePlatinum", + "oreNickel", + "oreMithril", + "oreCobalt", + "oreArdite" + }; public static Map resultOverrides = new HashMap(); public static void init() { @@ -33,13 +46,14 @@ public class OreDoublingRegistry { oreResults.put(oreName, resultIngot); } - } public static ItemStack getOreResult(ItemStack stack) { if (stack == null) return null; if (resultOverrides.containsKey(stack.getItem().getUnlocalizedName(stack))) - return resultOverrides.get(stack.getItem().getUnlocalizedName(stack)).copy(); + return resultOverrides + .get(stack.getItem().getUnlocalizedName(stack)) + .copy(); if (FurnaceRecipes.smelting().getSmeltingResult(stack) == null) return null; if (stack.getItem() instanceof DraconiumBlend) return new ItemStack(ModItems.draconiumIngot, 4); else if (stack.getItem() == Item.getItemFromBlock(Blocks.cobblestone)) return new ItemStack(Blocks.stone, 2); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java index 09db54fc..879f20a7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java @@ -10,11 +10,11 @@ public final class References { public static final String GUIFACTORY = "com.brandon3055.draconicevolution.client.gui.DEGUIFactory"; public static final String RESOURCESPREFIX = MODID.toLowerCase() + ":"; - //======================Render IDs========================// + // ======================Render IDs========================// public static int idTeleporterStand = -1; public static int idPortal = -1; - //======================Data Types========================// + // ======================Data Types========================// public static final byte BYTE_ID = 0; public static final byte SHORT_ID = 1; @@ -27,7 +27,7 @@ public final class References { public static final byte STRING_ID = 8; public static final byte INT_PAIR_ID = 9; - //======================Tags========================// + // ======================Tags========================// public static final String DIG_SPEED_MULTIPLIER = "ToolDigMultiplier"; public static final String DIG_AOE = "ToolDigAOE"; @@ -36,5 +36,4 @@ public final class References { public static final String OBLITERATE = "ToolVoidJunk"; public static final String TREE_MODE = "AxeTreeMode"; public static final String BASE_SAFE_AOE = "BaseSafeAOE"; - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java index ced143e0..8821a2e0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java @@ -1,6 +1,6 @@ package com.brandon3055.draconicevolution.common.lib; -public class Strings {// public static Block name +public class Strings { // public static Block name public static final String blockWeatherControllerName = "weatherController"; public static final String tclogoName = "tclogo"; public static final String xrayBlockName = "xRayBlock"; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java index 2dff52be..00c7ab6a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java @@ -6,12 +6,9 @@ package com.brandon3055.draconicevolution.common.lib; public class VersionHandler { public static final String VERSION = "GRADLETOKEN_VERSION"; - public static final int SNAPSHOT = 0; public static final String MCVERSION = "1.7.10"; @SuppressWarnings({"unused"}) public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT : ""); } - - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java index 3d0b4119..2fe42823 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java @@ -9,10 +9,7 @@ import net.minecraft.potion.PotionEffect; */ public class PotionHandler { - - public static void init() { - - } + public static void init() {} public static class PotionBase extends Potion { @@ -27,20 +24,24 @@ public class PotionHandler { @Override public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { -// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.effect.txt"), x+7, y+6, 0xffffff); -// if (effect.getPotionID() == potionFlight.id) -// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.flight.txt"), x+7, y+17, 0x00ff00); -// else if (effect.getPotionID() == potionUpHillStep.id) -// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.highStep.txt"), x+7, y+17, 0x00ff00); -// else if (effect.getPotionID() == potionSpeed.id) -// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.swiftness.txt"), x+7, y+17, 0x00ff00); -// else if (effect.getPotionID() == potionFireResist.id) -// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.fireImmune.txt"), x+7, y+17, 0x00ff00); -// else if (effect.getPotionID() == potionJumpBoost.id) -// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.jumpBoost.txt"), x+7, y+17, 0x00ff00); -// if (effect.getAmplifier() > 0)mc.fontRenderer.drawString("lvl: "+(effect.getAmplifier()+1), x+86, y+12, 0xff0000); + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.effect.txt"), x+7, y+6, 0xffffff); + // if (effect.getPotionID() == potionFlight.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.flight.txt"), x+7, y+17, + // 0x00ff00); + // else if (effect.getPotionID() == potionUpHillStep.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.highStep.txt"), x+7, y+17, + // 0x00ff00); + // else if (effect.getPotionID() == potionSpeed.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.swiftness.txt"), x+7, y+17, + // 0x00ff00); + // else if (effect.getPotionID() == potionFireResist.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.fireImmune.txt"), x+7, y+17, + // 0x00ff00); + // else if (effect.getPotionID() == potionJumpBoost.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.jumpBoost.txt"), x+7, y+17, + // 0x00ff00); + // if (effect.getAmplifier() > 0)mc.fontRenderer.drawString("lvl: "+(effect.getAmplifier()+1), x+86, y+12, + // 0xff0000); } } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java index e54caac8..cabc65b5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java @@ -9,8 +9,7 @@ import net.minecraft.network.play.server.S23PacketBlockChange; public class BlockUpdatePacket implements IMessage { int x, y, z; - public BlockUpdatePacket() { - } + public BlockUpdatePacket() {} public BlockUpdatePacket(int x, int y, int z) { this.x = x; @@ -36,8 +35,12 @@ public class BlockUpdatePacket implements IMessage { @Override public IMessage onMessage(BlockUpdatePacket message, MessageContext ctx) { - ctx.getServerHandler().playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(message.x, message.y, message.z, ctx.getServerHandler().playerEntity.worldObj)); + ctx.getServerHandler() + .playerEntity + .playerNetServerHandler + .sendPacket(new S23PacketBlockChange( + message.x, message.y, message.z, ctx.getServerHandler().playerEntity.worldObj)); return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java index a7ff0116..4c4bb453 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java @@ -30,8 +30,7 @@ public class ButtonPacket implements IMessage { byte buttonId = 0; boolean state = false; - public ButtonPacket() { - } + public ButtonPacket() {} public ButtonPacket(byte buttonId, boolean state) { this.buttonId = buttonId; @@ -112,12 +111,22 @@ public class ButtonPacket implements IMessage { break; } case ID_TOOLCONFIG: { - ctx.getServerHandler().playerEntity.openGui(DraconicEvolution.instance, GuiHandler.GUIID_TOOL_CONFIG, ctx.getServerHandler().playerEntity.worldObj, (int) ctx.getServerHandler().playerEntity.posX, (int) ctx.getServerHandler().playerEntity.posY, (int) ctx.getServerHandler().playerEntity.posZ); + ctx.getServerHandler() + .playerEntity + .openGui( + DraconicEvolution.instance, + GuiHandler.GUIID_TOOL_CONFIG, + ctx.getServerHandler().playerEntity.worldObj, + (int) ctx.getServerHandler().playerEntity.posX, + (int) ctx.getServerHandler().playerEntity.posY, + (int) ctx.getServerHandler().playerEntity.posZ); break; } case ID_TOOL_PROFILE_CHANGE: { ItemStack stack = ctx.getServerHandler().playerEntity.getHeldItem(); - if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem) stack.getItem()).hasProfiles()) { + if (stack != null + && stack.getItem() instanceof IConfigurableItem + && ((IConfigurableItem) stack.getItem()).hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); if (++preset >= 5) preset = 0; ItemNBTHelper.setInteger(stack, "ConfigProfile", preset); @@ -131,4 +140,4 @@ public class ButtonPacket implements IMessage { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java index 76df5674..d51446e7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java @@ -16,8 +16,7 @@ public class ContributorPacket implements IMessage { public boolean wings; public boolean badge; - public ContributorPacket() { - } + public ContributorPacket() {} public ContributorPacket(String contributor, boolean wings, boolean badge) { this.contributor = contributor; @@ -57,7 +56,8 @@ public class ContributorPacket implements IMessage { DraconicEvolution.network.sendToAll(message); } else { EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); - if (!contributor1.isUserValid(player) || message.contributor.equals(player.getCommandSenderName())) { + if (!contributor1.isUserValid(player) + || message.contributor.equals(player.getCommandSenderName())) { return null; } @@ -69,4 +69,4 @@ public class ContributorPacket implements IMessage { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java index 49836007..708e76a2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java @@ -22,8 +22,7 @@ public class GenericParticlePacket implements IMessage { private double posZ; private int additionalData; - public GenericParticlePacket() { - } + public GenericParticlePacket() {} public GenericParticlePacket(byte particleId, double posX, double posY, double posZ) { this.particleId = particleId; @@ -73,7 +72,12 @@ public class GenericParticlePacket implements IMessage { case ENERGY_BALL_KILL: { Particles.DragonProjectileParticle particle; for (int i = 0; i < 100; i++) { - particle = new Particles.DragonProjectileParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, 0x00FFFF); + particle = new Particles.DragonProjectileParticle( + BrandonsCore.proxy.getClientWorld(), + message.posX, + message.posY, + message.posZ, + 0x00FFFF); double m = 0.5D; particle.motionX = (particle.worldObj.rand.nextDouble() - 0.5) * m; particle.motionY = (particle.worldObj.rand.nextDouble() - 0.5) * m; @@ -85,7 +89,12 @@ public class GenericParticlePacket implements IMessage { case CHAOS_BALL_KILL: { Particles.DragonProjectileParticle particle; for (int i = 0; i < 100; i++) { - particle = new Particles.DragonProjectileParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, 0x440000); + particle = new Particles.DragonProjectileParticle( + BrandonsCore.proxy.getClientWorld(), + message.posX, + message.posY, + message.posZ, + 0x440000); double m = 0.5D; particle.motionX = (particle.worldObj.rand.nextDouble() - 0.5) * m; particle.motionY = (particle.worldObj.rand.nextDouble() - 0.5) * m; @@ -95,28 +104,67 @@ public class GenericParticlePacket implements IMessage { break; } case CHAOS_IMPLOSION: { - ParticleHandler.spawnCustomParticle(new Particles.ChaosImplosionParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, 200F), 512); + ParticleHandler.spawnCustomParticle( + new Particles.ChaosImplosionParticle( + BrandonsCore.proxy.getClientWorld(), + message.posX, + message.posY, + message.posZ, + 200F), + 512); break; } case ARROW_SHOCK_WAVE: { - ParticleHandler.spawnCustomParticle(new Particles.ArrowShockParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, message.additionalData), 256); + ParticleHandler.spawnCustomParticle( + new Particles.ArrowShockParticle( + BrandonsCore.proxy.getClientWorld(), + message.posX, + message.posY, + message.posZ, + message.additionalData), + 256); for (int i = 0; i < 100; i++) { - Particles.ArrowParticle particle = new Particles.ArrowParticle(BrandonsCore.proxy.getClientWorld(), message.posX - 0.25 + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, message.posY + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, message.posZ - 0.25 + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, 0xff6000, 0.2F + BrandonsCore.proxy.getClientWorld().rand.nextFloat() * 10f); + Particles.ArrowParticle particle = new Particles.ArrowParticle( + BrandonsCore.proxy.getClientWorld(), + message.posX + - 0.25 + + BrandonsCore.proxy + .getClientWorld() + .rand + .nextDouble() + * 0.5, + message.posY + + BrandonsCore.proxy + .getClientWorld() + .rand + .nextDouble() + * 0.5, + message.posZ + - 0.25 + + BrandonsCore.proxy + .getClientWorld() + .rand + .nextDouble() + * 0.5, + 0xff6000, + 0.2F + BrandonsCore.proxy.getClientWorld().rand.nextFloat() * 10f); double mm = 2; - particle.motionX = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; - particle.motionY = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; - particle.motionZ = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionX = + (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionY = + (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionZ = + (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; ParticleHandler.spawnCustomParticle(particle, 64); } break; } - default: break; } return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java index 420fa3e7..490c12c1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java @@ -10,11 +10,10 @@ 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 java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import java.util.List; - public class ItemConfigPacket implements IMessage { public byte datatype; public int slot; @@ -22,8 +21,7 @@ public class ItemConfigPacket implements IMessage { public String name; public boolean renameProfile = false; - public ItemConfigPacket() { - } + public ItemConfigPacket() {} public ItemConfigPacket(ItemConfigField field) { this.datatype = (byte) field.datatype; @@ -71,7 +69,8 @@ public class ItemConfigPacket implements IMessage { if (stack != null && stack.getItem() instanceof IConfigurableItem) { if (message.renameProfile) { - ItemNBTHelper.setString(stack, "ProfileName" + ItemNBTHelper.getInteger(stack, "ConfigProfile", 0), message.name); + ItemNBTHelper.setString( + stack, "ProfileName" + ItemNBTHelper.getInteger(stack, "ConfigProfile", 0), message.name); return null; } @@ -80,10 +79,16 @@ public class ItemConfigPacket implements IMessage { for (ItemConfigField field : fields) { if (field.name.equals(message.name) && message.datatype == field.datatype) { - ItemConfigField newValue = new ItemConfigField(message.datatype, message.value, message.slot, message.name); + ItemConfigField newValue = + new ItemConfigField(message.datatype, message.value, message.slot, message.name); - if (newValue.castToDouble() <= field.castMaxToDouble() && newValue.castToDouble() >= field.castMinToDouble()) { - DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), message.value, message.datatype, message.name); + if (newValue.castToDouble() <= field.castMaxToDouble() + && newValue.castToDouble() >= field.castMinToDouble()) { + DataUtills.writeObjectToCompound( + IConfigurableItem.ProfileHelper.getProfileCompound(stack), + message.value, + message.datatype, + message.name); } } } @@ -91,4 +96,4 @@ public class ItemConfigPacket implements IMessage { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java index 05db7dee..fece76d5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java @@ -9,12 +9,11 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; +import java.util.Optional; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import java.util.Optional; - public final class MagnetToggleAckPacket implements IMessage { private boolean status; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java index 388f7fa3..ec0fd1d7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java @@ -7,11 +7,10 @@ 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 java.util.Optional; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import java.util.Optional; - public final class MagnetTogglePacket implements IMessage { public MagnetTogglePacket() {} @@ -26,7 +25,6 @@ public final class MagnetTogglePacket implements IMessage { // do nothing } - public static final class Handler implements IMessageHandler { @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java index 2392cd94..1945bccc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java @@ -14,8 +14,7 @@ public class MountUpdatePacket implements IMessage { public int entityID; - public MountUpdatePacket() { - } + public MountUpdatePacket() {} public MountUpdatePacket(int id) { this.entityID = id; @@ -40,7 +39,8 @@ public class MountUpdatePacket implements IMessage { ctx.getServerHandler().playerEntity.mountEntity(null); return null; } else if (ctx.getServerHandler().playerEntity.ridingEntity != null) { - return new MountUpdatePacket(ctx.getServerHandler().playerEntity.ridingEntity.getEntityId()); + return new MountUpdatePacket( + ctx.getServerHandler().playerEntity.ridingEntity.getEntityId()); } return null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java index 7a6efedb..0b20ab27 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java @@ -21,8 +21,7 @@ public class ParticleGenPacket implements IMessage { int tileY = 0; int tileZ = 0; - public ParticleGenPacket() { - } + public ParticleGenPacket() {} public ParticleGenPacket(byte buttonId, short value, int x, int y, int z) { this.buttonId = buttonId; @@ -54,248 +53,259 @@ public class ParticleGenPacket implements IMessage { @Override public IMessage onMessage(ParticleGenPacket message, MessageContext ctx) { - TileEntity tile = ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.tileX, message.tileY, message.tileZ); - TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileEntity tile = ctx.getServerHandler() + .playerEntity + .worldObj + .getTileEntity(message.tileX, message.tileY, message.tileZ); + TileParticleGenerator gen = + (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; if (gen != null) { - //System.out.println(buttonId + " " + value); + // System.out.println(buttonId + " " + value); switch (message.buttonId) { - case 0://red + case 0: // red gen.red = (int) message.value; break; - case 1://green + case 1: // green gen.green = (int) message.value; break; - case 2://blue + case 2: // blue gen.blue = (int) message.value; break; - case 3://mx + case 3: // mx gen.motion_x = (float) message.value / 1000F; break; - case 4://my + case 4: // my gen.motion_y = (float) message.value / 1000F; break; - case 5://mz + case 5: // mz gen.motion_z = (float) message.value / 1000F; break; - case 6://ged + case 6: // ged gen.red = (int) message.value; break; - case 7://green + case 7: // green gen.green = (int) message.value; break; - case 8://blue + case 8: // blue gen.blue = (int) message.value; break; - case 9://mx + case 9: // mx gen.motion_x = (float) message.value / 1000F; break; - case 10://my + case 10: // my gen.motion_y = (float) message.value / 1000F; break; - case 11://mz + case 11: // mz gen.motion_z = (float) message.value / 1000F; break; - case 12://red + case 12: // red gen.random_red = (int) message.value; break; - case 13://green + case 13: // green gen.random_green = (int) message.value; break; - case 14://blue + case 14: // blue gen.random_blue = (int) message.value; break; - case 15://mx + case 15: // mx gen.random_motion_x = (float) message.value / 1000F; break; - case 16://my + case 16: // my gen.random_motion_y = (float) message.value / 1000F; break; - case 17://mz + case 17: // mz gen.random_motion_z = (float) message.value / 1000F; break; - case 18://ged + case 18: // ged gen.random_red = (int) message.value; break; - case 19://green + case 19: // green gen.random_green = (int) message.value; break; - case 20://blue + case 20: // blue gen.random_blue = (int) message.value; break; - case 21://mx + case 21: // mx gen.random_motion_x = (float) message.value / 1000F; break; - case 22://my + case 22: // my gen.random_motion_y = (float) message.value / 1000F; break; - case 23://mz + case 23: // mz gen.random_motion_z = (float) message.value / 1000F; break; - case 24://Life + + case 24: // Life + gen.life = (int) message.value; break; - case 25://Life - + case 25: // Life - gen.life = (int) message.value; break; - case 26://RLife + + case 26: // RLife + gen.random_life = (int) message.value; break; - case 27://RLife - + case 27: // RLife - gen.random_life = (int) message.value; break; - case 28://Size + + case 28: // Size + gen.scale = (float) message.value / 100F; break; - case 29://Size - + case 29: // Size - gen.scale = (float) message.value / 100F; break; - case 30://RSize + + case 30: // RSize + gen.random_scale = (float) message.value / 100F; break; - case 31://RSize - + case 31: // RSize - gen.random_scale = (float) message.value / 100F; break; - case 32://SX + + case 32: // SX + gen.page = (int) message.value; break; - case 33://SX - + case 33: // SX - gen.page = (int) message.value; break; - case 34://SX + + case 34: // SX + gen.spawn_x = (float) message.value / 100F; break; - case 35://SX - + case 35: // SX - gen.spawn_x = (float) message.value / 100F; break; - case 36://RSX + + case 36: // RSX + gen.random_spawn_x = (float) message.value / 100F; break; - case 37://RSX - + case 37: // RSX - gen.random_spawn_x = (float) message.value / 100F; break; - case 38://SY + + case 38: // SY + gen.spawn_y = (float) message.value / 100F; break; - case 39://SY - + case 39: // SY - gen.spawn_y = (float) message.value / 100F; break; - case 40://RSY + + case 40: // RSY + gen.random_spawn_y = (float) message.value / 100F; break; - case 41://RSY - + case 41: // RSY - gen.random_spawn_y = (float) message.value / 100F; break; - case 42://SZ + + case 42: // SZ + gen.spawn_z = (float) message.value / 100F; break; - case 43://SZ - + case 43: // SZ - gen.spawn_z = (float) message.value / 100F; break; - case 44://RSZ + + case 44: // RSZ + gen.random_spawn_z = (float) message.value / 100F; break; - case 45://RSZ - + case 45: // RSZ - gen.random_spawn_z = (float) message.value / 100F; break; - case 46://Delay - + case 46: // Delay - gen.spawn_rate = (int) message.value; break; - case 47://Delay - + case 47: // Delay - gen.spawn_rate = (int) message.value; break; - case 48://Fade - + case 48: // Fade - gen.fade = (int) message.value; break; - case 49://Fade - + case 49: // Fade - gen.fade = (int) message.value; break; - case 50://Collision - + case 50: // Collision - gen.collide = message.value == 0 ? false : true; break; - case 51://Particle Selected - + case 51: // Particle Selected - gen.selected_particle = (int) message.value; break; - case 52://Gravity + + case 52: // Gravity + gen.gravity = (float) message.value / 1000F; break; - case 53://Gravity - + case 53: // Gravity - gen.gravity = (float) message.value / 1000F; break; - case 54://Info Page (3) + case 54: // Info Page (3) gen.page = (int) message.value; break; - case 55://Back + case 55: // Back gen.page = (int) message.value; break; - case 58://Back + case 58: // Back LogHelper.info(message.value); gen.particles_enabled = message.value == 1; break; - case 100: //beam red + + case 100: // beam red + gen.beam_red = message.value; break; - case 101: //beam green + + case 101: // beam green + gen.beam_green = message.value; break; - case 102: //beam blue + + case 102: // beam blue + gen.beam_blue = message.value; break; - case 103: //beam pitch + + case 103: // beam pitch + gen.beam_pitch = (float) message.value / 100F; break; - case 104: //beam yaw + + case 104: // beam yaw + gen.beam_yaw = (float) message.value / 100F; break; - case 105: //beam length + + case 105: // beam length + gen.beam_length = (float) message.value / 100F; break; - case 106: //beam rotation + + case 106: // beam rotation + gen.beam_rotation = (float) message.value / 100F; break; - case 107: //beam scale + + case 107: // beam scale + gen.beam_scale = (float) message.value / 100F; break; - case 108: //beam red - + case 108: // beam red - gen.beam_red = message.value; break; - case 109: //beam green - + case 109: // beam green - gen.beam_green = message.value; break; - case 110: //beam blue - + case 110: // beam blue - gen.beam_blue = message.value; break; - case 111: //beam pitch - + case 111: // beam pitch - gen.beam_pitch = (float) message.value / 100F; break; - case 112: //beam yaw - + case 112: // beam yaw - gen.beam_yaw = (float) message.value / 100F; break; - case 113: //beam length - + case 113: // beam length - gen.beam_length = (float) message.value / 100F; break; - case 114: //beam rotation - + case 114: // beam rotation - gen.beam_rotation = (float) message.value / 100F; break; - case 115: //beam scale - + case 115: // beam scale - gen.beam_scale = (float) message.value / 100F; break; - case 116: //beam enabled + case 116: // beam enabled gen.beam_enabled = message.value == 1; break; - case 117: //beam enabled + case 117: // beam enabled gen.render_core = message.value == 1; break; } if (message.buttonId == 127) { - if (ctx.getServerHandler().playerEntity.capabilities.isCreativeMode || ctx.getServerHandler().playerEntity.inventory.hasItem(Items.paper)) { + if (ctx.getServerHandler().playerEntity.capabilities.isCreativeMode + || ctx.getServerHandler().playerEntity.inventory.hasItem(Items.paper)) { giveNote(message, ctx); } else - ctx.getServerHandler().playerEntity.addChatComponentMessage(new ChatComponentText("You need paper in your inventory to do that")); + ctx.getServerHandler() + .playerEntity + .addChatComponentMessage( + new ChatComponentText("You need paper in your inventory to do that")); } - ctx.getServerHandler().playerEntity.worldObj.markBlockForUpdate(message.tileX, message.tileY, message.tileZ); + ctx.getServerHandler() + .playerEntity + .worldObj + .markBlockForUpdate(message.tileX, message.tileY, message.tileZ); } return null; } @@ -305,13 +315,18 @@ public class ParticleGenPacket implements IMessage { if (!player.capabilities.isCreativeMode) player.inventory.consumeInventoryItem(Items.paper); ItemStack stack = new ItemStack(Items.paper); stack.setTagCompound(new NBTTagCompound()); - TileEntity tile = ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.tileX, message.tileY, message.tileZ); - TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileEntity tile = ctx.getServerHandler() + .playerEntity + .worldObj + .getTileEntity(message.tileX, message.tileY, message.tileZ); + TileParticleGenerator gen = + (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; if (gen != null) { gen.getBlockNBT(stack.getTagCompound()); stack.setStackDisplayName("Saved Particle Gen Settings"); - player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, stack)); + player.worldObj.spawnEntityInWorld( + new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, stack)); } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java index e1c592a0..03f95d44 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java @@ -23,8 +23,7 @@ public class PlacedItemPacket implements IMessage { int blockY = 0; int blockZ = 0; - public PlacedItemPacket() { - } + public PlacedItemPacket() {} public PlacedItemPacket(byte side, int x, int y, int z) { this.side = side; @@ -60,10 +59,14 @@ public class PlacedItemPacket implements IMessage { World world = ctx.getServerHandler().playerEntity.worldObj; EntityPlayer player = ctx.getServerHandler().playerEntity; - if (!world.isAirBlock(x, y, z) || player.getHeldItem() == null || !ModBlocks.isEnabled(ModBlocks.placedItem)) - return null; + if (!world.isAirBlock(x, y, z) + || player.getHeldItem() == null + || !ModBlocks.isEnabled(ModBlocks.placedItem)) return null; - BlockEvent.PlaceEvent event = new BlockEvent.PlaceEvent(new BlockSnapshot(world, x, y, z, ModBlocks.placedItem, 0), world.getBlock(message.blockX, message.blockY, message.blockZ), player); + BlockEvent.PlaceEvent event = new BlockEvent.PlaceEvent( + new BlockSnapshot(world, x, y, z, ModBlocks.placedItem, 0), + world.getBlock(message.blockX, message.blockY, message.blockZ), + player); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { @@ -73,7 +76,10 @@ public class PlacedItemPacket implements IMessage { ItemStack stack = player.getHeldItem(); world.setBlock(x, y, z, ModBlocks.placedItem, message.side, 2); - TilePlacedItem tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; + TilePlacedItem tile = + (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + ? (TilePlacedItem) world.getTileEntity(x, y, z) + : null; if (tile == null) { world.setBlockToAir(x, y, z); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java index a53e87a2..9e8976ba 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java @@ -7,13 +7,11 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; - public class PlayerDetectorButtonPacket implements IMessage { private short index = 0; private short value = 0; - public PlayerDetectorButtonPacket() { - } + public PlayerDetectorButtonPacket() {} public PlayerDetectorButtonPacket(byte index, short value) { this.index = index; @@ -36,8 +34,12 @@ public class PlayerDetectorButtonPacket implements IMessage { @Override public IMessage onMessage(PlayerDetectorButtonPacket message, MessageContext ctx) { - ContainerPlayerDetector container = (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) ? (ContainerPlayerDetector) ctx.getServerHandler().playerEntity.openContainer : null; - TilePlayerDetectorAdvanced tile = (container != null) ? ((ContainerPlayerDetector) container).getTileDetector() : null; + ContainerPlayerDetector container = + (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) + ? (ContainerPlayerDetector) ctx.getServerHandler().playerEntity.openContainer + : null; + TilePlayerDetectorAdvanced tile = + (container != null) ? ((ContainerPlayerDetector) container).getTileDetector() : null; if (tile != null) { switch (message.index) { @@ -56,4 +58,4 @@ public class PlayerDetectorButtonPacket implements IMessage { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java index dbdd83e6..d0a9397e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java @@ -8,13 +8,11 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; - public class PlayerDetectorStringPacket implements IMessage { private int index = 0; private String name = ""; - public PlayerDetectorStringPacket() { - } + public PlayerDetectorStringPacket() {} public PlayerDetectorStringPacket(byte index, String name) { this.index = index; @@ -37,7 +35,10 @@ public class PlayerDetectorStringPacket implements IMessage { @Override public IMessage onMessage(PlayerDetectorStringPacket message, MessageContext ctx) { - ContainerPlayerDetector container = (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) ? (ContainerPlayerDetector) ctx.getServerHandler().playerEntity.openContainer : null; + ContainerPlayerDetector container = + (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) + ? (ContainerPlayerDetector) ctx.getServerHandler().playerEntity.openContainer + : null; TilePlayerDetectorAdvanced tile = (container != null) ? container.getTileDetector() : null; if (tile != null) { @@ -47,4 +48,4 @@ public class PlayerDetectorStringPacket implements IMessage { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java index d2fca0af..0601e9bc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java @@ -18,8 +18,7 @@ public class ShieldHitPacket implements IMessage { public byte shieldPowerB; public float shieldPowerF; - public ShieldHitPacket() { - } + public ShieldHitPacket() {} public ShieldHitPacket(EntityPlayer playerHit, float shieldPower) { this.playerID = playerHit.getEntityId(); @@ -45,7 +44,9 @@ public class ShieldHitPacket implements IMessage { public IMessage onMessage(ShieldHitPacket message, MessageContext ctx) { Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.playerID); if (entity instanceof EntityPlayer) - ClientEventHandler.playerShieldStatus.put((EntityPlayer) entity, new DataUtills.XZPair(message.shieldPowerF, ClientEventHandler.elapsedTicks)); + ClientEventHandler.playerShieldStatus.put( + (EntityPlayer) entity, + new DataUtills.XZPair(message.shieldPowerF, ClientEventHandler.elapsedTicks)); return null; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java index b9e6ae59..e983ba61 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java @@ -16,8 +16,7 @@ import io.netty.buffer.ByteBuf; public class SpeedRequestPacket implements IMessage { double speed = 0F; - public SpeedRequestPacket() { - } + public SpeedRequestPacket() {} public SpeedRequestPacket(double speed) { this.speed = speed; @@ -38,8 +37,10 @@ public class SpeedRequestPacket implements IMessage { @Override public IMessage onMessage(SpeedRequestPacket message, MessageContext ctx) { if (ctx.side == Side.SERVER) { - if (ConfigHandler.speedLimitDimList.contains(ctx.getServerHandler().playerEntity.dimension) || (BrandonsCore.proxy.isOp(ctx.getServerHandler().playerEntity.getCommandSenderName()) && !ConfigHandler.speedLimitops)) - return new SpeedRequestPacket(20F); + if (ConfigHandler.speedLimitDimList.contains(ctx.getServerHandler().playerEntity.dimension) + || (BrandonsCore.proxy.isOp( + ctx.getServerHandler().playerEntity.getCommandSenderName()) + && !ConfigHandler.speedLimitops)) return new SpeedRequestPacket(20F); return new SpeedRequestPacket(ConfigHandler.maxPlayerSpeed); } else { MinecraftForgeEventHandler.maxSpeed = message.speed; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java index 49276b7f..10d8985c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java @@ -33,8 +33,7 @@ public class TeleporterPacket implements IMessage { private byte function = -1; private TeleportLocation location; - public TeleporterPacket() { - } + public TeleporterPacket() {} public TeleporterPacket(int function, int data, boolean b) { this.data = data; @@ -64,7 +63,7 @@ public class TeleporterPacket implements IMessage { bytes.writeFloat(location.getPitch()); bytes.writeFloat(location.getYaw()); ByteBufUtils.writeUTF8String(bytes, location.getName()); - //ByteBufUtils.writeUTF8String(bytes, location.getDimensionName()); + // ByteBufUtils.writeUTF8String(bytes, location.getDimensionName()); if (function == UPDATEDESTINATION) bytes.writeInt(data); } @@ -73,7 +72,11 @@ public class TeleporterPacket implements IMessage { bytes.writeBoolean(dataB); } - if (function == UPDATEOFFSET || function == CHANGESELECTION || function == REMOVEDESTINATION || function == ADDFUEL || function == SCROLL) { + if (function == UPDATEOFFSET + || function == CHANGESELECTION + || function == REMOVEDESTINATION + || function == ADDFUEL + || function == SCROLL) { bytes.writeInt(data); } @@ -99,7 +102,7 @@ public class TeleporterPacket implements IMessage { location.setPitch(bytes.readFloat()); location.setYaw(bytes.readFloat()); location.setName(ByteBufUtils.readUTF8String(bytes)); - //location.setDimentionName(ByteBufUtils.readUTF8String(bytes)); + // location.setDimentionName(ByteBufUtils.readUTF8String(bytes)); if (function == UPDATEDESTINATION) data = bytes.readInt(); } @@ -108,7 +111,11 @@ public class TeleporterPacket implements IMessage { dataB = bytes.readBoolean(); } - if (function == UPDATEOFFSET || function == CHANGESELECTION || function == REMOVEDESTINATION || function == ADDFUEL || function == SCROLL) { + if (function == UPDATEOFFSET + || function == CHANGESELECTION + || function == REMOVEDESTINATION + || function == ADDFUEL + || function == SCROLL) { data = bytes.readInt(); } @@ -137,7 +144,11 @@ public class TeleporterPacket implements IMessage { if (message.function == ADDDESTINATION) { NBTTagCompound tag = new NBTTagCompound(); - message.location.setDimentionName(BrandonsCore.proxy.getMCServer().worldServerForDimension(message.location.getDimension()).provider.getDimensionName()); + message.location.setDimentionName(BrandonsCore.proxy + .getMCServer() + .worldServerForDimension(message.location.getDimension()) + .provider + .getDimensionName()); message.location.writeToNBT(tag); list.appendTag(tag); compound.setTag("Locations", list); @@ -166,12 +177,15 @@ public class TeleporterPacket implements IMessage { ItemNBTHelper.setInteger(teleporter, "SelectionOffset", selectionOffset - 1); return null; } - } if (message.function == UPDATEDESTINATION) { NBTTagCompound tag = list.getCompoundTagAt(message.data); - message.location.setDimentionName(BrandonsCore.proxy.getMCServer().worldServerForDimension(message.location.getDimension()).provider.getDimensionName()); + message.location.setDimentionName(BrandonsCore.proxy + .getMCServer() + .worldServerForDimension(message.location.getDimension()) + .provider + .getDimensionName()); message.location.writeToNBT(tag); list.func_150304_a(message.data, tag); compound.setTag("Locations", list); @@ -211,25 +225,29 @@ public class TeleporterPacket implements IMessage { int maxSelect = Math.min(list.tagCount() - 1, 11); int maxOffset = Math.max(list.tagCount() - 12, 0); - if (message.dataB) //up + if (message.dataB) // up { if (selected > 0) { NBTTagCompound temp = list.getCompoundTagAt(selected + selectionOffset); - list.func_150304_a(selected + selectionOffset, list.getCompoundTagAt(selected + selectionOffset - 1)); + list.func_150304_a( + selected + selectionOffset, list.getCompoundTagAt(selected + selectionOffset - 1)); list.func_150304_a(selected + selectionOffset - 1, temp); compound.setTag("Locations", list); teleporter.setTagCompound(compound); - ItemNBTHelper.setShort(teleporter, "Selection", (short) (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) - 1)); + ItemNBTHelper.setShort(teleporter, "Selection", (short) + (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) - 1)); } - } else //down + } else // down { if (selected < maxSelect) { NBTTagCompound temp = list.getCompoundTagAt(selected + selectionOffset); - list.func_150304_a(selected + selectionOffset, list.getCompoundTagAt(selected + selectionOffset + 1)); + list.func_150304_a( + selected + selectionOffset, list.getCompoundTagAt(selected + selectionOffset + 1)); list.func_150304_a(selected + selectionOffset + 1, temp); compound.setTag("Locations", list); teleporter.setTagCompound(compound); - ItemNBTHelper.setShort(teleporter, "Selection", (short) (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) + 1)); + ItemNBTHelper.setShort(teleporter, "Selection", (short) + (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) + 1)); } } } @@ -256,4 +274,4 @@ public class TeleporterPacket implements IMessage { return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java index a7b763b6..782479ce 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java @@ -1,8 +1,8 @@ package com.brandon3055.draconicevolution.common.network; +import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.common.container.ContainerDataSync; import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; -import com.brandon3055.brandonscore.common.utills.DataUtills; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -26,8 +26,7 @@ public class TileObjectPacket implements IMessage { /** * Used for Tile and Container synchronization */ - public TileObjectPacket() { - } + public TileObjectPacket() {} public TileObjectPacket(TileObjectSync tile, byte dataType, int index, Object object) { this.isContainerPacket = tile == null; @@ -55,7 +54,6 @@ public class TileObjectPacket implements IMessage { bytes.writeShort(index); DataUtills.instance.writeObjectToBytes(bytes, dataType, object); - } @Override @@ -80,23 +78,34 @@ public class TileObjectPacket implements IMessage { public IMessage onMessage(TileObjectPacket message, MessageContext ctx) { if (ctx.side == Side.CLIENT) { if (message.isContainerPacket) { - ContainerDataSync container = Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerDataSync ? (ContainerDataSync) Minecraft.getMinecraft().thePlayer.openContainer : null; + ContainerDataSync container = + Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerDataSync + ? (ContainerDataSync) Minecraft.getMinecraft().thePlayer.openContainer + : null; if (container == null) return null; container.receiveSyncData(message.index, (Integer) message.object); } else { - if (!(Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z) instanceof TileObjectSync)) - return null; - ((TileObjectSync) Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z)).receiveObjectFromServer(message.index, message.object); + if (!(Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z) + instanceof TileObjectSync)) return null; + ((TileObjectSync) Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z)) + .receiveObjectFromServer(message.index, message.object); } } else { if (message.isContainerPacket) { - ContainerDataSync container = ctx.getServerHandler().playerEntity.openContainer instanceof ContainerDataSync ? (ContainerDataSync) ctx.getServerHandler().playerEntity.openContainer : null; + ContainerDataSync container = + ctx.getServerHandler().playerEntity.openContainer instanceof ContainerDataSync + ? (ContainerDataSync) ctx.getServerHandler().playerEntity.openContainer + : null; if (container == null) return null; container.receiveSyncData(message.index, (Integer) message.object); } else { - if (!(ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z) instanceof TileObjectSync)) - return null; - ((TileObjectSync) ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z)).receiveObjectFromClient(message.index, message.object); + if (!(ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z) + instanceof TileObjectSync)) return null; + ((TileObjectSync) ctx.getServerHandler() + .playerEntity + .worldObj + .getTileEntity(message.x, message.y, message.z)) + .receiveObjectFromClient(message.index, message.object); } } return null; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java index d57dcd4e..ff33fc3a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java @@ -14,8 +14,7 @@ public class ToolModePacket implements IMessage { public boolean shift; public boolean ctrl; - public ToolModePacket() { - } + public ToolModePacket() {} public ToolModePacket(boolean shift, boolean ctrl) { this.shift = shift; @@ -37,8 +36,12 @@ public class ToolModePacket implements IMessage { public static class Handler implements IMessageHandler { @Override public IMessage onMessage(ToolModePacket message, MessageContext ctx) { - ToolBase.handleModeChange(ctx.getServerHandler().playerEntity.getHeldItem(), ctx.getServerHandler().playerEntity, message.shift, message.ctrl); + ToolBase.handleModeChange( + ctx.getServerHandler().playerEntity.getHeldItem(), + ctx.getServerHandler().playerEntity, + message.shift, + message.ctrl); return null; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java index b57e4a4a..694998b4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java @@ -3,10 +3,10 @@ package com.brandon3055.draconicevolution.common.tileentities; /** * Created by Brandon on 5/07/2014. */ - import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Arrays; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; @@ -19,8 +19,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.Arrays; - public abstract class CustomSpawnerBaseLogic { /** * The delay to spawn. @@ -39,12 +37,14 @@ public abstract class CustomSpawnerBaseLogic { * A counter for spawn tries. */ private int spawnCount = 6; + private Entity renderedEntity; private int maxNearbyEntities = 20; /** * Is receiving a redstone signal */ public boolean powered = false; + public boolean ltPowered = false; /** * Dose the spawner require a player nearby @@ -66,6 +66,7 @@ public abstract class CustomSpawnerBaseLogic { * The range coefficient for spawning entities around. */ private int spawnRange = 4; + public int skeletonType = 0; /** @@ -85,7 +86,13 @@ public abstract class CustomSpawnerBaseLogic { public boolean isActivated() { if (!requiresPlayer) return true; else - return this.getSpawnerWorld().getClosestPlayer((double) this.getSpawnerX() + 0.5D, (double) this.getSpawnerY() + 0.5D, (double) this.getSpawnerZ() + 0.5D, (double) this.activatingRangeFromPlayer) != null; + return this.getSpawnerWorld() + .getClosestPlayer( + (double) this.getSpawnerX() + 0.5D, + (double) this.getSpawnerY() + 0.5D, + (double) this.getSpawnerZ() + 0.5D, + (double) this.activatingRangeFromPlayer) + != null; } public void updateSpawner() { @@ -93,9 +100,12 @@ public abstract class CustomSpawnerBaseLogic { double d2; if (this.getSpawnerWorld().isRemote) { - double d0 = (double) ((float) this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat()); - double d1 = (double) ((float) this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat()); - d2 = (double) ((float) this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat()); + double d0 = (double) ((float) this.getSpawnerX() + + this.getSpawnerWorld().rand.nextFloat()); + double d1 = (double) ((float) this.getSpawnerY() + + this.getSpawnerWorld().rand.nextFloat()); + d2 = (double) ((float) this.getSpawnerZ() + + this.getSpawnerWorld().rand.nextFloat()); this.getSpawnerWorld().spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); this.getSpawnerWorld().spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); @@ -104,7 +114,8 @@ public abstract class CustomSpawnerBaseLogic { } this.renderRotation1 = this.renderRotation0; - this.renderRotation0 = (this.renderRotation0 + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; + this.renderRotation0 = + (this.renderRotation0 + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; } else { if (this.spawnDelay == -1) { this.resetTimer(); @@ -124,29 +135,55 @@ public abstract class CustomSpawnerBaseLogic { return; } - int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), AxisAlignedBB.getBoundingBox((double) this.getSpawnerX(), (double) this.getSpawnerY(), (double) this.getSpawnerZ(), (double) (this.getSpawnerX() + 1), (double) (this.getSpawnerY() + 1), (double) (this.getSpawnerZ() + 1)).expand((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))).size(); + int j = this.getSpawnerWorld() + .getEntitiesWithinAABB( + entity.getClass(), + AxisAlignedBB.getBoundingBox( + (double) this.getSpawnerX(), + (double) this.getSpawnerY(), + (double) this.getSpawnerZ(), + (double) (this.getSpawnerX() + 1), + (double) (this.getSpawnerY() + 1), + (double) (this.getSpawnerZ() + 1)) + .expand((double) (this.spawnRange * 2), 4.0D, (double) + (this.spawnRange * 2))) + .size(); if (j >= this.maxNearbyEntities) { this.resetTimer(); return; } - int x = this.getSpawnerX() + (int) ((this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange); + int x = this.getSpawnerX() + + (int) ((this.getSpawnerWorld().rand.nextDouble() + - this.getSpawnerWorld().rand.nextDouble()) + * (double) this.spawnRange); int y = this.getSpawnerY() + this.getSpawnerWorld().rand.nextInt(3) - 1; - int z = this.getSpawnerZ() + (int) ((this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange); + int z = this.getSpawnerZ() + + (int) ((this.getSpawnerWorld().rand.nextDouble() + - this.getSpawnerWorld().rand.nextDouble()) + * (double) this.spawnRange); EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null; - entity.setLocationAndAngles(x + 0.5, y + 0.5, z + 0.5, this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); + entity.setLocationAndAngles( + x + 0.5, + y + 0.5, + z + 0.5, + this.getSpawnerWorld().rand.nextFloat() * 360.0F, + 0.0F); - if (entityliving == null || (entityliving.getCanSpawnHere() || ignoreSpawnRequirements && getSpawnerWorld().getBlock(x, y, z) == Blocks.air)) { + if (entityliving == null + || (entityliving.getCanSpawnHere() + || ignoreSpawnRequirements + && getSpawnerWorld().getBlock(x, y, z) == Blocks.air)) { this.spawnEntity(entity); - this.getSpawnerWorld().playAuxSFX(2004, this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), 0); + this.getSpawnerWorld() + .playAuxSFX(2004, this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), 0); if (entityliving != null) { entityliving.spawnExplosionParticle(); } flag = true; - } } @@ -172,7 +209,9 @@ public abstract class CustomSpawnerBaseLogic { if (!requiresPlayer) { ((EntityLiving) par1Entity).func_110163_bv(); - par1Entity.getEntityData().setLong("SpawnedByDESpawner", getSpawnerWorld().getTotalWorldTime()); + par1Entity + .getEntityData() + .setLong("SpawnedByDESpawner", getSpawnerWorld().getTotalWorldTime()); } if (!getSpawnerWorld().isRemote) this.getSpawnerWorld().spawnEntityInWorld(par1Entity); @@ -195,7 +234,10 @@ public abstract class CustomSpawnerBaseLogic { public void readFromNBT(NBTTagCompound par1NBTTagCompound) { this.entityName = par1NBTTagCompound.getString("EntityId"); this.spawnDelay = par1NBTTagCompound.getShort("Delay"); - if ((!ConfigHandler.spawnerListType && Arrays.asList(ConfigHandler.spawnerList).contains(this.entityName)) || (ConfigHandler.spawnerListType && !Arrays.asList(ConfigHandler.spawnerList).contains(this.entityName))) { + if ((!ConfigHandler.spawnerListType + && Arrays.asList(ConfigHandler.spawnerList).contains(this.entityName)) + || (ConfigHandler.spawnerListType + && !Arrays.asList(ConfigHandler.spawnerList).contains(this.entityName))) { this.entityName = "Pig"; par1NBTTagCompound.setBoolean("Running", false); } @@ -288,4 +330,4 @@ public abstract class CustomSpawnerBaseLogic { if (maxSpawnDelay < 1) maxSpawnDelay = 1; resetTimer(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java index d577780b..4722c88e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java @@ -30,15 +30,23 @@ public class TileCKeyStone extends TileEntity { activeTicks = 0; isActivated = false; updateBlocks(); - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.5F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.5F); } } } public boolean onActivated(ItemStack stack, EntityPlayer player) { if (stack == null || stack.getItem() != ModItems.key) { - if (player.capabilities.isCreativeMode && stack == null && player.isSneaking() && (getMeta() == 1 || getMeta() == 3)) - delay += 5; + if (player.capabilities.isCreativeMode + && stack == null + && player.isSneaking() + && (getMeta() == 1 || getMeta() == 3)) delay += 5; if (player.capabilities.isCreativeMode && stack == null) giveInformation(player); return false; } @@ -47,26 +55,56 @@ public class TileCKeyStone extends TileEntity { if (!isKeyValid(stack, player)) return false; switch (getMeta()) { - case 0: //Permanent Activation + case 0: // Permanent Activation isActivated = true; player.destroyCurrentEquippedItem(); - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.6F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.6F); break; - case 1: //Button Activation + case 1: // Button Activation isActivated = true; - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.6F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.6F); break; - case 2: //Toggle Activation + case 2: // Toggle Activation if (!isActivated) - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.6F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.6F); else - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.5F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.5F); isActivated = !isActivated; break; - case 3: //Button Activation (Consume Key) + case 3: // Button Activation (Consume Key) isActivated = true; player.destroyCurrentEquippedItem(); - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.6F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.6F); break; case 4: break; @@ -81,16 +119,29 @@ public class TileCKeyStone extends TileEntity { player.addChatComponentMessage(new ChatComponentTranslation("msg.cKeyStoneType" + getMeta() + ".txt")); player.addChatComponentMessage(new ChatComponentText("Key: " + keyCode)); if (getMeta() == 1 || getMeta() == 3) - player.addChatComponentMessage(new ChatComponentText("Delay: " + delay + "t (" + (((double) delay) / 20D) + "s)")); + player.addChatComponentMessage( + new ChatComponentText("Delay: " + delay + "t (" + (((double) delay) / 20D) + "s)")); } } private boolean isMasterKey(ItemStack key) { if (key.getItemDamage() == 1) { if (!isActivated) - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.6F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.6F); else - worldObj.playSoundEffect((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D, "random.click", 0.3F, 0.5F); + worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.5F); isActivated = !isActivated; updateBlocks(); return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java index 7ca13b29..502e8a0d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java @@ -23,25 +23,36 @@ public class TileChaosShard extends TileEntity { public void updateEntity() { tick++; - if (tick > 1 && !worldObj.isRemote && locationHash != getLocationHash(xCoord, yCoord, zCoord, worldObj.provider.dimensionId)) + if (tick > 1 + && !worldObj.isRemote + && locationHash != getLocationHash(xCoord, yCoord, zCoord, worldObj.provider.dimensionId)) worldObj.setBlockToAir(xCoord, yCoord, zCoord); if (worldObj.isRemote && soundTimer-- <= 0) { soundTimer = 3600 + worldObj.rand.nextInt(1200); - worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:chaosChamberAmbient", 1.5F, worldObj.rand.nextFloat() * 0.4F + 0.8F, false); + worldObj.playSound( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:chaosChamberAmbient", + 1.5F, + worldObj.rand.nextFloat() * 0.4F + 0.8F, + false); } if (!worldObj.isRemote && guardianDefeated && worldObj.rand.nextInt(50) == 0) { int x = 5 - worldObj.rand.nextInt(11); int z = 5 - worldObj.rand.nextInt(11); - EntityLightningBolt bolt = new EntityLightningBolt(worldObj, xCoord + x, worldObj.getTopSolidOrLiquidBlock(xCoord + x, zCoord + z), zCoord + z); + EntityLightningBolt bolt = new EntityLightningBolt( + worldObj, xCoord + x, worldObj.getTopSolidOrLiquidBlock(xCoord + x, zCoord + z), zCoord + z); bolt.ignoreFrustumCheck = true; worldObj.addWeatherEffect(bolt); } } public void detonate() { - if (!worldObj.isRemote && locationHash != getLocationHash(xCoord, yCoord, zCoord, worldObj.provider.dimensionId)) + if (!worldObj.isRemote + && locationHash != getLocationHash(xCoord, yCoord, zCoord, worldObj.provider.dimensionId)) worldObj.setBlockToAir(xCoord, yCoord, zCoord); else { EntityChaosVortex vortex = new EntityChaosVortex(worldObj); @@ -87,6 +98,7 @@ public class TileChaosShard extends TileEntity { } public int getLocationHash(int xCoord, int yCoord, int zCoord, int dimension) { - return (String.valueOf(xCoord) + String.valueOf(yCoord) + String.valueOf(zCoord) + String.valueOf(dimension)).hashCode(); + return (String.valueOf(xCoord) + String.valueOf(yCoord) + String.valueOf(zCoord) + String.valueOf(dimension)) + .hashCode(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java index 5f1a6943..e658cc07 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java @@ -15,15 +15,12 @@ import net.minecraft.tileentity.TileEntity; public class TileContainerTemplate extends TileEntity implements ISidedInventory { ItemStack[] items = new ItemStack[9]; - //==============================================LOGIC=======================================================// + // ==============================================LOGIC=======================================================// @Override - public void updateEntity() { + public void updateEntity() {} - } - - - //==========================================SYNCHRONIZATION==================================================// + // ==========================================SYNCHRONIZATION==================================================// @Override public Packet getDescriptionPacket() { @@ -37,7 +34,7 @@ public class TileContainerTemplate extends TileEntity implements ISidedInventory readFromNBT(pkt.func_148857_g()); } - //==============================================INVENTORY====================================================// + // ==============================================INVENTORY====================================================// @Override public int getSizeInventory() { @@ -102,12 +99,10 @@ public class TileContainerTemplate extends TileEntity implements ISidedInventory } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { @@ -116,7 +111,7 @@ public class TileContainerTemplate extends TileEntity implements ISidedInventory @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8}; + return new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; } @Override @@ -129,7 +124,7 @@ public class TileContainerTemplate extends TileEntity implements ISidedInventory return true; } - //===========================================================================================================// + // ===========================================================================================================// @Override public void writeToNBT(NBTTagCompound compound) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java index a3ba2084..63b7c324 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java @@ -40,45 +40,45 @@ public class TileCustomSpawner extends TileEntity { spawnerBaseLogic.updateSpawner(); } /* - else if (trySet && owner != null){ + else if (trySet && owner != null){ - if (worldObj.isRemote) spawnParticles(false); + if (worldObj.isRemote) spawnParticles(false); - if (!foundTarget && setTick > 70 && target == null && setTick % 10 == 0) - { - foundTarget = findTargetEntity(); - setTick = 71; - } + if (!foundTarget && setTick > 70 && target == null && setTick % 10 == 0) + { + foundTarget = findTargetEntity(); + setTick = 71; + } - if (foundTarget) - { - target.setHealth(10); - if (setTick < 150) { - target.setPosition(xCoord + 0.5, yCoord, zCoord + 0.5); - } else { - target.setPosition(xCoord + 0.5, yCoord - 0.5, zCoord + 0.5); - } - spawnParticles(true); - if (setTick > 151){ - spawnerBaseLogic.entityName = target.getCommandSenderName(); - target.setDead(); - setTick = 0; - trySet = false; - isSetToSpawn = true; - } + if (foundTarget) + { + target.setHealth(10); + if (setTick < 150) { + target.setPosition(xCoord + 0.5, yCoord, zCoord + 0.5); + } else { + target.setPosition(xCoord + 0.5, yCoord - 0.5, zCoord + 0.5); + } + spawnParticles(true); + if (setTick > 151){ + spawnerBaseLogic.entityName = target.getCommandSenderName(); + target.setDead(); + setTick = 0; + trySet = false; + isSetToSpawn = true; + } - } + } - setTick++; - if (setTick > 200){ - setTick = 0; - trySet = false; - } - } else { - trySet = false; - } - */ + setTick++; + if (setTick > 200){ + setTick = 0; + trySet = false; + } + } else { + trySet = false; + } + */ } public void writeToNBT(NBTTagCompound tagCompound) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java index 2b45214f..807ca277 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java @@ -1,6 +1,9 @@ package com.brandon3055.draconicevolution.common.tileentities; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -14,10 +17,6 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeHooks; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - /** * Created by Brandon on 27/06/2014. */ @@ -28,13 +27,20 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { public int timer = 0; public float bookPower = 0f; - //==============================================LOGIC=======================================================// + // ==============================================LOGIC=======================================================// @Override public void updateEntity() { timer++; if (worldObj.isRemote && isValidRecipe && worldObj.rand.nextFloat() > 0.5f) { - worldObj.spawnParticle("enchantmenttable", xCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), yCoord + 0.7 + (worldObj.rand.nextDouble() * 0.5), zCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), 0D, 0.3D, 0D); + worldObj.spawnParticle( + "enchantmenttable", + xCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), + yCoord + 0.7 + (worldObj.rand.nextDouble() * 0.5), + zCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), + 0D, + 0.3D, + 0D); } } @@ -44,12 +50,12 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { flag = false; dissenchantCost = 0; } else { - if (items[1].getItem() != Items.book || EnchantmentHelper.getEnchantments(items[0]).size() == 0) - flag = false; + if (items[1].getItem() != Items.book + || EnchantmentHelper.getEnchantments(items[0]).size() == 0) flag = false; } if (items[0] != null) dissenchantCost = ItemNBTHelper.getInteger(items[0], "RepairCost", 0); - //if (flag) dissenchantCost = ItemNBTHelper.getInteger(items[0], "RepairCost", 0); - //else dissenchantCost = 0; + // if (flag) dissenchantCost = ItemNBTHelper.getInteger(items[0], "RepairCost", 0); + // else dissenchantCost = 0; isValidRecipe = flag; if (!this.worldObj.isRemote) { @@ -58,7 +64,9 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { for (j = -1; j <= 1; ++j) { for (int k = -1; k <= 1; ++k) { - if ((j != 0 || k != 0) && this.worldObj.isAirBlock(this.xCoord + k, this.yCoord, this.zCoord + j) && this.worldObj.isAirBlock(this.xCoord + k, this.yCoord + 1, this.zCoord + j)) { + if ((j != 0 || k != 0) + && this.worldObj.isAirBlock(this.xCoord + k, this.yCoord, this.zCoord + j) + && this.worldObj.isAirBlock(this.xCoord + k, this.yCoord + 1, this.zCoord + j)) { bookPower += ForgeHooks.getEnchantPower(worldObj, xCoord + k * 2, yCoord, zCoord + j * 2); bookPower += ForgeHooks.getEnchantPower(worldObj, xCoord + k * 2, yCoord + 1, zCoord + j * 2); @@ -111,7 +119,11 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { if (input.getItem() == Items.enchanted_book && list.tagCount() == 0) setInventorySlotContents(0, null); if (!player.capabilities.isCreativeMode) player.addExperienceLevel(-dissenchantCost); if (items[0] != null && ItemNBTHelper.getInteger(items[0], "RepairCost", 0) > 0) - ItemNBTHelper.setInteger(items[0], "RepairCost", ItemNBTHelper.getInteger(items[0], "RepairCost", 0) - Math.min(2, ItemNBTHelper.getInteger(items[0], "RepairCost", 0))); + ItemNBTHelper.setInteger( + items[0], + "RepairCost", + ItemNBTHelper.getInteger(items[0], "RepairCost", 0) + - Math.min(2, ItemNBTHelper.getInteger(items[0], "RepairCost", 0))); if (!player.capabilities.isCreativeMode) decrStackSize(1, 1); int maxDamage = items[0] != null ? items[0].getMaxDamage() : 0; float damageF = (40f - bookPower) / 100f; @@ -126,8 +138,7 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { onInventoryChanged(); } - - //==========================================SYNCHRONIZATION==============================================e====// + // ==========================================SYNCHRONIZATION==============================================e====// @Override public Packet getDescriptionPacket() { @@ -141,7 +152,7 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { readFromNBT(pkt.func_148857_g()); } - //==============================================INVENTORY====================================================// + // ==============================================INVENTORY====================================================// @Override public int getSizeInventory() { @@ -212,12 +223,10 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { @@ -227,7 +236,7 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[]{1}; + return new int[] {1}; } @Override @@ -240,7 +249,7 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { return true; } - //===========================================================================================================// + // ===========================================================================================================// @Override public void writeToNBT(NBTTagCompound compound) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java index 3b9b1872..5249457d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java @@ -9,6 +9,7 @@ import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChes import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import com.brandon3055.draconicevolution.common.utills.ICustomItemData; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -23,8 +24,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - /** * Created by Brandon on 27/06/2014. */ @@ -52,6 +51,7 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I * How fast the furnace is smelting (used by flame animation) range:0 - 100 */ public int smeltingBurnSpeed; + public final int smeltingMaxBurnSpeed = 50; public final int smeltingCompleateTime = 1600; public int smeltingAutoFeed = 0; @@ -62,10 +62,21 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I @Override public void updateEntity() { // Resynchronize clients with the server state - if (worldObj != null && !this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) { + if (worldObj != null + && !this.worldObj.isRemote + && this.numUsingPlayers != 0 + && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) { this.numUsingPlayers = 0; float var1 = 5.0F; - List var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox((double) ((float) this.xCoord - var1), (double) ((float) this.yCoord - var1), (double) ((float) this.zCoord - var1), (double) ((float) (this.xCoord + 1) + var1), (double) ((float) (this.yCoord + 1) + var1), (double) ((float) (this.zCoord + 1) + var1))); + List var2 = this.worldObj.getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox( + (double) ((float) this.xCoord - var1), + (double) ((float) this.yCoord - var1), + (double) ((float) this.zCoord - var1), + (double) ((float) (this.xCoord + 1) + var1), + (double) ((float) (this.yCoord + 1) + var1), + (double) ((float) (this.zCoord + 1) + var1))); for (EntityPlayer var4 : var2) { if (var4.openContainer instanceof ContainerDraconiumChest) { @@ -75,7 +86,13 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I } if (worldObj != null && !worldObj.isRemote && ticksSinceSync < 0) { - worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.draconiumChest, 3, ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7)); + worldObj.addBlockEvent( + xCoord, + yCoord, + zCoord, + ModBlocks.draconiumChest, + 3, + ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7)); } this.ticksSinceSync++; @@ -84,7 +101,8 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I if (numUsingPlayers > 0 && lidAngle == 0.0F) { double d = (double) xCoord + 0.5D; double d1 = (double) zCoord + 0.5D; - worldObj.playSoundEffect(d, (double) yCoord + 0.5D, d1, "random.chestopen", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + worldObj.playSoundEffect( + d, (double) yCoord + 0.5D, d1, "random.chestopen", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (numUsingPlayers == 0 && lidAngle > 0.0F || numUsingPlayers > 0 && lidAngle < 1.0F) { float f1 = lidAngle; @@ -100,7 +118,13 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I if (lidAngle < f2 && f1 >= f2) { double d2 = (double) xCoord + 0.5D; double d3 = (double) zCoord + 0.5D; - worldObj.playSoundEffect(d2, (double) yCoord + 0.5D, d3, "random.chestclosed", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + worldObj.playSoundEffect( + d2, + (double) yCoord + 0.5D, + d3, + "random.chestclosed", + 0.5F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (lidAngle < 0.0F) { lidAngle = 0.0F; @@ -110,10 +134,19 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I updateEnergy(); } - public void updateEnergy() {//todo if no charging item wait a sec before checking again - if (energy.getEnergyStored() < energy.getMaxEnergyStored() && getStackInSlot(239) != null && getStackInSlot(239).getItem() instanceof IEnergyContainerItem) { - IEnergyContainerItem item = (IEnergyContainerItem) getStackInSlot(239).getItem(); - item.extractEnergy(getStackInSlot(239), receiveEnergy(ForgeDirection.DOWN, item.extractEnergy(getStackInSlot(239), energy.getMaxReceive(), true), false), false); + public void updateEnergy() { // todo if no charging item wait a sec before checking again + if (energy.getEnergyStored() < energy.getMaxEnergyStored() + && getStackInSlot(239) != null + && getStackInSlot(239).getItem() instanceof IEnergyContainerItem) { + IEnergyContainerItem item = + (IEnergyContainerItem) getStackInSlot(239).getItem(); + item.extractEnergy( + getStackInSlot(239), + receiveEnergy( + ForgeDirection.DOWN, + item.extractEnergy(getStackInSlot(239), energy.getMaxReceive(), true), + false), + false); } } @@ -132,19 +165,19 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I requiresUpdate = false; } - //LogHelper.info("S.I.P: " + smeltInProgress + " S.S.D: " + updateSuspended + " C.F.R: " + canFurnaceRun()); + // LogHelper.info("S.I.P: " + smeltInProgress + " S.S.D: " + updateSuspended + " C.F.R: " + canFurnaceRun()); if (updateSuspended && (getTick() % 500) != 0) return; updateSuspended = false; inTick = true; - //======= Try to start the furnace ==================================================== + // ======= Try to start the furnace ==================================================== if (!smeltInProgress && (getTick() % 500) == 0 && energy.getEnergyStored() > 1000) { if (getFill() || getLock() || getAll()) feedNextItem(); smeltInProgress = canFurnaceRun(); } - //===================================================================================== - //======= Furnace running ============================================================= + // ===================================================================================== + // ======= Furnace running ============================================================= if (smeltInProgress) { smeltingBurnSpeed = Math.min(energy.getEnergyStored() / 1000, smeltingMaxBurnSpeed); @@ -171,12 +204,11 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I inTick = false; } - private void confirmRunningState() { - } + private void confirmRunningState() {} private boolean canFurnaceRun() { boolean flag = false; - //====== Check if there is anything to smelt ========================================= + // ====== Check if there is anything to smelt ========================================= for (int i = 0; i < 5; i++) { if (getStackInSlot(234 + i) == null) continue; ItemStack stack = getStackInSlot(234 + i); @@ -185,33 +217,34 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I break; } } - if (!flag) return false; //Return false if there is nothing to smelt - //===================================================================================== - //===== Confirm that the furnace can still run when lock mode is enabled ============== + if (!flag) return false; // Return false if there is nothing to smelt + // ===================================================================================== + // ===== Confirm that the furnace can still run when lock mode is enabled ============== if (getLock()) { flag = false; for (int i = 0; i < 5; i++) { ItemStack recipe = getStackInSlot(234 + i); if (recipe == null || recipe.stackSize == 1) - continue; //checks that there is more then one of at least one item in the input + continue; // checks that there is more then one of at least one item in the input flag = true; } if (!flag) return false; } - //===================================================================================== - //====== Check if there is room for the output ======================================== + // ===================================================================================== + // ====== Check if there is room for the output ======================================== for (int i = 0; i < 5; i++) { if (getStackInSlot(234 + i) == null) continue; ItemStack output = getResult(getStackInSlot(234 + i)).copy(); for (int j = 0; j < getSizeInventory(); j++) { - //if (getStackInSlot(234 + j).stackSize >= getStackInSlot(234 + j).getMaxStackSize()) continue;todo consider? + // if (getStackInSlot(234 + j).stackSize >= getStackInSlot(234 + j).getMaxStackSize()) continue;todo + // consider? InventoryUtils.insertItemIntoInventory(this, output, ForgeDirection.DOWN, j, false); if (output.stackSize == 0) break; } - if (output.stackSize > 0) return false; //return false if the output could not be added to the inventory + if (output.stackSize > 0) return false; // return false if the output could not be added to the inventory } - //===================================================================================== + // ===================================================================================== return true; } @@ -229,14 +262,14 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I ItemStack result = getResult(recipe).copy(); - //Try to merge with existing stacks todo needed? + // Try to merge with existing stacks todo needed? for (int j = 0; j < getSizeInventory(); j++) { if (getStackInSlot(j) == null) continue; InventoryUtils.tryMergeStacks(result, getStackInSlot(j)); } if (result.stackSize > 0) - InventoryUtils.insertItemIntoInventory(this, result); //Insert stack into inventory + InventoryUtils.insertItemIntoInventory(this, result); // Insert stack into inventory if (result.stackSize == 0) { recipe.stackSize--; @@ -256,7 +289,7 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I } public void feedNextItem() { - boolean[] stacksFull = new boolean[]{false, false, false, false, false}; + boolean[] stacksFull = new boolean[] {false, false, false, false, false}; for (int i = 0; i < getSizeInventory(); i++) { if (getStackInSlot(i) == null) continue; @@ -310,7 +343,8 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I } private boolean isSmeltable(ItemStack stack) { - return FurnaceRecipes.smelting().getSmeltingResult(stack) != null || OreDoublingRegistry.getOreResult(stack) != null; + return FurnaceRecipes.smelting().getSmeltingResult(stack) != null + || OreDoublingRegistry.getOreResult(stack) != null; } private ItemStack getResult(ItemStack stack) { @@ -337,7 +371,8 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I public void rotateAround(ForgeDirection axis) { setFacing((byte) ForgeDirection.getOrientation(facing).getRotation(axis).ordinal()); - worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.draconiumChest, 3, ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7)); + worldObj.addBlockEvent( + xCoord, yCoord, zCoord, ModBlocks.draconiumChest, 3, ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7)); } public int getFacing() { @@ -362,9 +397,9 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I super.writeToNBT(compound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, compound); -// NBTTagCompound tagCompound = new NBTTagCompound(); -// this.writeToNBT(tagCompound); -// return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound); + // NBTTagCompound tagCompound = new NBTTagCompound(); + // this.writeToNBT(tagCompound); + // return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound); } @Override @@ -427,7 +462,9 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I @Override public String getInventoryName() { - return hasCustomInventoryName() ? customName : StatCollector.translateToLocal(ModBlocks.draconiumChest.getUnlocalizedName() + ".name"); + return hasCustomInventoryName() + ? customName + : StatCollector.translateToLocal(ModBlocks.draconiumChest.getUnlocalizedName() + ".name"); } public void setCustomName(String s) { @@ -638,12 +675,10 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I public void markDirty() { super.markDirty(); if (!worldObj.isRemote) requiresUpdate = true; - } } - -//inTick = true; +// inTick = true; // tick++; // // boolean canSmelt = false; @@ -725,7 +760,8 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I // } while (itemsToProccess > 0 && proccessAttempts < 5); // } // -// if ((flag && (getFill() || getLock() || getAll())) || (!canSmelt && (getLock() || getAll()) && (tick + xCoord + yCoord + zCoord) % 60 == 0)) feedNextItem(); +// if ((flag && (getFill() || getLock() || getAll())) || (!canSmelt && (getLock() || getAll()) && (tick + xCoord + +// yCoord + zCoord) % 60 == 0)) feedNextItem(); // // if (canSmelt) { // smeltingBurnSpeed = Math.min(energy.getEnergyStored() / 1000, smeltingMaxBurnSpeed); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java index 5a247a08..c3a9773e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities; -import java.util.Random; - import cofh.api.energy.IEnergyContainerItem; import cofh.api.energy.IEnergyReceiver; import com.brandon3055.draconicevolution.client.handler.ParticleHandler; @@ -11,6 +9,7 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -25,7 +24,8 @@ import net.minecraftforge.common.util.ForgeDirection; */ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver, ISidedInventory { ItemStack[] items = new ItemStack[1]; - public EnergyStorage energy = new EnergyStorage(BalanceConfigHandler.energyInfuserStorage, BalanceConfigHandler.energyInfuserMaxTransfer); + public EnergyStorage energy = + new EnergyStorage(BalanceConfigHandler.energyInfuserStorage, BalanceConfigHandler.energyInfuserMaxTransfer); public boolean running = false; public boolean runningCach = false; private int tick = 0; @@ -34,9 +34,10 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver * True is energy was transferred this tick */ public boolean transfer = false; + public boolean transferCach = false; - //==============================================LOGIC=======================================================// + // ==============================================LOGIC=======================================================// @Override public void updateEntity() { @@ -54,7 +55,6 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver if (tick % 100 == 0) tryStartOrStop(); if (tick % 400 == 0) detectAndSendChanges(true); - if (running && tryStartOrStop()) { IEnergyContainerItem item = (IEnergyContainerItem) items[0].getItem(); setTransfer(energy.extractEnergy(item.receiveEnergy(items[0], energy.getEnergyStored(), false), false) > 0); @@ -65,7 +65,10 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver } private boolean tryStartOrStop() { - if (items[0] != null && items[0].stackSize == 1 && items[0] != null && items[0].getItem() instanceof IEnergyContainerItem) { + if (items[0] != null + && items[0].stackSize == 1 + && items[0] != null + && items[0].getItem() instanceof IEnergyContainerItem) { IEnergyContainerItem item = (IEnergyContainerItem) items[0].getItem(); if (item.getEnergyStored(items[0]) < item.getMaxEnergyStored(items[0])) { running = true; @@ -96,47 +99,111 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver yRand = ((rand.nextFloat() - 0.5) / 2); radRand = 1 - rand.nextFloat() / 2; rotationF = rotation / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y + yRand, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 1); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y + yRand, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 1); ParticleHandler.spawnCustomParticle(particle); yRand = ((rand.nextFloat() - 0.5) / 2); radRand = 1 - rand.nextFloat() / 2; rotationF = (rotation + 90) / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y + yRand, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 1); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y + yRand, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 1); ParticleHandler.spawnCustomParticle(particle); yRand = ((rand.nextFloat() - 0.5) / 2); radRand = 1 - rand.nextFloat() / 2; rotationF = (rotation + 180) / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y + yRand, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 1); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y + yRand, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 1); ParticleHandler.spawnCustomParticle(particle); yRand = ((rand.nextFloat() - 0.5) / 2); radRand = 1 - rand.nextFloat() / 2; rotationF = (rotation + 270) / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y + yRand, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 1); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y + yRand, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 1); ParticleHandler.spawnCustomParticle(particle); y = 0.79f; radRand = 0.35; rotationF = rotation / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 0); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 0); ParticleHandler.spawnCustomParticle(particle); rotationF = (rotation + 90) / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 0); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 0); ParticleHandler.spawnCustomParticle(particle); rotationF = (rotation + 180) / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 0); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 0); ParticleHandler.spawnCustomParticle(particle); rotationF = (rotation + 270) / 57F; - particle = new ParticleEnergy(worldObj, xCoord + 0.5 + radRand * Math.sin(rotationF), yCoord + y, zCoord + 0.5 + radRand * Math.cos(rotationF), xCoord + 0.5, yCoord + 0.7, zCoord + 0.5, 0); + particle = new ParticleEnergy( + worldObj, + xCoord + 0.5 + radRand * Math.sin(rotationF), + yCoord + y, + zCoord + 0.5 + radRand * Math.cos(rotationF), + xCoord + 0.5, + yCoord + 0.7, + zCoord + 0.5, + 0); ParticleHandler.spawnCustomParticle(particle); } } - //==============================================ENERGY======================================================// + // ==============================================ENERGY======================================================// @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { @@ -158,7 +225,7 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver return true; } - //==========================================SYNCHRONIZATION==================================================// + // ==========================================SYNCHRONIZATION==================================================// @Override public Packet getDescriptionPacket() { @@ -181,7 +248,6 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver } } - @SideOnly(Side.CLIENT) @Override public void receiveObjectFromServer(int index, Object object) { @@ -189,7 +255,7 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver if (index == 1) transfer = (Boolean) object; } - //==============================================INVENTORY====================================================// + // ==============================================INVENTORY====================================================// @Override public int getSizeInventory() { @@ -277,7 +343,7 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[]{0}; + return new int[] {0}; } @Override @@ -289,12 +355,13 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver public boolean canExtractItem(int slot, ItemStack item, int side) { if (item == null || !(item.getItem() instanceof IEnergyContainerItem)) return true; - if ((((IEnergyContainerItem) item.getItem()).getEnergyStored(item) >= ((IEnergyContainerItem) item.getItem()).getMaxEnergyStored(item)) || ((IEnergyContainerItem) item.getItem()).receiveEnergy(item, 1, true) == 0) - return true; + if ((((IEnergyContainerItem) item.getItem()).getEnergyStored(item) + >= ((IEnergyContainerItem) item.getItem()).getMaxEnergyStored(item)) + || ((IEnergyContainerItem) item.getItem()).receiveEnergy(item, 1, true) == 0) return true; else return false; } - //===========================================================================================================// + // ===========================================================================================================// @Override public void writeToNBT(NBTTagCompound compound) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java index 01cd4500..b12c1a97 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java @@ -22,7 +22,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; public class TileGenerator extends TileObjectSync implements ISidedInventory, IEnergyProvider { - //########### variables #############// + // ########### variables #############// private ItemStack[] items; public int burnTime = 1; public int burnTimeRemaining = 0; @@ -34,9 +34,10 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE * Energy per burn tick */ private int EPBT = 14; + public EnergyStorage storage = new EnergyStorage(100000, 0, 1000); - //##################################// + // ##################################// public TileGenerator() { items = new ItemStack[1]; @@ -50,14 +51,24 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE if (burnTimeRemaining > 0 && storage.getEnergyStored() < storage.getMaxEnergyStored()) { burnTimeRemaining -= burnSpeed; - storage.setEnergyStored(storage.getEnergyStored() + Math.min(burnSpeed * EPBT, storage.getMaxEnergyStored() - storage.getEnergyStored())); + storage.setEnergyStored(storage.getEnergyStored() + + Math.min(burnSpeed * EPBT, storage.getMaxEnergyStored() - storage.getEnergyStored())); } else if (burnTimeRemaining <= 0) tryRefuel(); if ((storage.getEnergyStored() > 0)) { for (int i = 0; i < 6; i++) { - TileEntity tile = worldObj.getTileEntity(xCoord + ForgeDirection.getOrientation(i).offsetX, yCoord + ForgeDirection.getOrientation(i).offsetY, zCoord + ForgeDirection.getOrientation(i).offsetZ); + TileEntity tile = worldObj.getTileEntity( + xCoord + ForgeDirection.getOrientation(i).offsetX, + yCoord + ForgeDirection.getOrientation(i).offsetY, + zCoord + ForgeDirection.getOrientation(i).offsetZ); if (tile != null && tile instanceof IEnergyReceiver) { - storage.extractEnergy(((IEnergyReceiver) tile).receiveEnergy(ForgeDirection.getOrientation(i).getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), false); + storage.extractEnergy( + ((IEnergyReceiver) tile) + .receiveEnergy( + ForgeDirection.getOrientation(i).getOpposite(), + storage.extractEnergy(storage.getMaxExtract(), true), + false), + false); } } } @@ -66,7 +77,6 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE tick++; } - public void tryRefuel() { if (burnTimeRemaining > 0 || storage.getEnergyStored() >= storage.getMaxEnergyStored()) return; if (items[0] != null && items[0].stackSize > 0) { @@ -105,9 +115,12 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE } } - if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemTool + && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword + && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe + && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; @@ -186,12 +199,10 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack stack) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java index 7000d486..61cc7bfd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java @@ -8,10 +8,13 @@ import com.mojang.authlib.GameProfile; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.UUID; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.IEntityMultiPart; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -29,11 +32,8 @@ import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; -import java.util.UUID; - public class TileGrinder extends TileObjectSync implements ISidedInventory, IEnergyReceiver { - //########### variables #############// + // ########### variables #############// public int meta = -1; List killList; AxisAlignedBB killBox; @@ -49,8 +49,10 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne public boolean hasPower = false; public boolean hasPowerCach = false; private boolean readyNext = false; - public EnergyStorage internalGenBuffer = new EnergyStorage(BalanceConfigHandler.grinderInternalEnergyBufferSize, BalanceConfigHandler.grinderMaxReceive, 0); - public EnergyStorage externalInputBuffer = new EnergyStorage(BalanceConfigHandler.grinderExternalEnergyBufferSize, BalanceConfigHandler.grinderMaxReceive, 0); + public EnergyStorage internalGenBuffer = new EnergyStorage( + BalanceConfigHandler.grinderInternalEnergyBufferSize, BalanceConfigHandler.grinderMaxReceive, 0); + public EnergyStorage externalInputBuffer = new EnergyStorage( + BalanceConfigHandler.grinderExternalEnergyBufferSize, BalanceConfigHandler.grinderMaxReceive, 0); public int energyPerKill = BalanceConfigHandler.grinderEnergyPerKill; private ItemStack diamondSword; public static FakePlayer fakePlayer; @@ -82,7 +84,7 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne } } } - //##################################// + // ##################################// public TileGrinder() { items = new ItemStack[1]; @@ -105,7 +107,10 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne if (burnTimeRemaining > 0 && internalGenBuffer.getEnergyStored() < internalGenBuffer.getMaxEnergyStored()) { burnTimeRemaining -= burnSpeed; - internalGenBuffer.setEnergyStored(internalGenBuffer.getEnergyStored() + Math.min(burnSpeed * EPBT, internalGenBuffer.getMaxEnergyStored() - internalGenBuffer.getEnergyStored())); + internalGenBuffer.setEnergyStored(internalGenBuffer.getEnergyStored() + + Math.min( + burnSpeed * EPBT, + internalGenBuffer.getMaxEnergyStored() - internalGenBuffer.getEnergyStored())); } else if (burnTimeRemaining <= 0) tryRefuel(); if (readyNext && !disabled && getActiveBuffer().getEnergyStored() >= energyPerKill) { @@ -115,7 +120,7 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne } if (tick % 100 == 0) { - //checkSignal(); + // checkSignal(); readyNext = true; } detectAndSendChanges(tick % 500 == 0); @@ -147,16 +152,22 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne } } + @SuppressWarnings("unchecked") public boolean killNextEntity() { if (worldObj.isRemote) return false; - //fakePlayer = null; + // fakePlayer = null; if (fakePlayer == null) { - fakePlayer = FakePlayerFactory.get((WorldServer) worldObj, new GameProfile(UUID.fromString("5b5689b9-e43d-4282-a42a-dc916f3616b7"), "[Draconic-Evolution]")); + fakePlayer = FakePlayerFactory.get( + (WorldServer) worldObj, + new GameProfile(UUID.fromString("5b5689b9-e43d-4282-a42a-dc916f3616b7"), "[Draconic-Evolution]")); } - if (BalanceConfigHandler.grinderShouldUseLooting && (fakePlayer.getHeldItem() == null || !ItemStack.areItemStacksEqual(fakePlayer.getHeldItem(), diamondSword))) { + if (BalanceConfigHandler.grinderShouldUseLooting + && (fakePlayer.getHeldItem() == null + || !ItemStack.areItemStacksEqual(fakePlayer.getHeldItem(), diamondSword))) { fakePlayer.setCurrentItemOrArmor(0, diamondSword); } - killBox = AxisAlignedBB.getBoundingBox(centreX - 4.5, centreY - 4.5, centreZ - 4.5, centreX + 4.5, centreY + 4.5, centreZ + 4.5); + killBox = AxisAlignedBB.getBoundingBox( + centreX - 4.5, centreY - 4.5, centreZ - 4.5, centreX + 4.5, centreY + 4.5, centreZ + 4.5); killList = worldObj.getEntitiesWithinAABB(EntityLiving.class, killBox); List xp = worldObj.getEntitiesWithinAABB(EntityXPOrb.class, killBox.expand(4, 4, 4)); @@ -165,7 +176,12 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne if (killList.size() > 0) { EntityLiving mob = killList.get(worldObj.rand.nextInt(killList.size())); if (mob.isEntityAlive()) { - mob.attackEntityFrom(DamageSource.causePlayerDamage(fakePlayer), 50000F); + if (mob instanceof IEntityMultiPart) { + ((IEntityMultiPart) mob) + .attackEntityFromPart(null, DamageSource.causePlayerDamage(fakePlayer), 50000F); + } else { + mob.attackEntityFrom(DamageSource.causePlayerDamage(fakePlayer), 50000F); + } readyNext = true; return true; } @@ -198,9 +214,12 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne } } - if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemTool + && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword + && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe + && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; @@ -279,12 +298,10 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack stack) { @@ -404,5 +421,4 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne public EnergyStorage getInternalBuffer() { return internalGenBuffer; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java index d9b99b0b..7fab4ba0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java @@ -5,5 +5,4 @@ import net.minecraft.tileentity.TileEntity; /** * Created by Brandon on 21/07/2014. */ -public class TileLRD extends TileEntity { -} +public class TileLRD extends TileEntity {} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java index 310604c5..13b64ee8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java @@ -14,7 +14,8 @@ public abstract class TileObjectSync extends TileEntity { * Sends a primitive to the client in the form of an object */ public Object sendObjectToClient(byte dataType, int index, Object object) { - return sendObjectToClient(dataType, index, object, new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64)); + return sendObjectToClient( + dataType, index, object, new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64)); } /** @@ -33,12 +34,10 @@ public abstract class TileObjectSync extends TileEntity { /** * Receives an object from the server */ - public void receiveObjectFromClient(int index, Object object) { - } + public void receiveObjectFromClient(int index, Object object) {} /** * Receives an object from the server */ - public void receiveObjectFromServer(int index, Object object) { - } + public void receiveObjectFromServer(int index, Object object) {} } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java index f43aa1fb..d540275d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.common.tileentities; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom; import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -16,10 +18,6 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - public class TileParticleGenerator extends TileEntity implements IDEPeripheral { public boolean particles_enabled = true; @@ -59,7 +57,7 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { public float rotation = 0; public boolean stabalizerMode = false; - //beam + // beam public boolean beam_enabled = false; public boolean render_core = false; @@ -108,7 +106,17 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { double spawnY = yCoord + spawn_y + (random_spawn_y * rand.nextFloat()); double spawnZ = zCoord + spawn_z + (random_spawn_z * rand.nextFloat()); - ParticleCustom particle = new ParticleCustom(worldObj, spawnX + 0.5, spawnY + 0.5, spawnZ + 0.5, MX, MY, MZ, SCALE, collide, this.selected_particle); + ParticleCustom particle = new ParticleCustom( + worldObj, + spawnX + 0.5, + spawnY + 0.5, + spawnZ + 0.5, + MX, + MY, + MZ, + SCALE, + collide, + this.selected_particle); particle.red = this.red + rand.nextInt(random_red + 1); particle.green = this.green + rand.nextInt(random_green + 1); particle.blue = this.blue + rand.nextInt(random_blue + 1); @@ -136,8 +144,10 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { else if (getMaster().zCoord > zCoord) direction = 2; else if (getMaster().zCoord < zCoord) direction = 3; - Particles.EnergyBeamParticle particle = new Particles.EnergyBeamParticle(worldObj, x, y, z, getMaster().xCoord + 0.5, getMaster().zCoord + 0.5, direction, false); - Particles.EnergyBeamParticle particle2 = new Particles.EnergyBeamParticle(worldObj, x, y, z, getMaster().xCoord + 0.5, getMaster().zCoord + 0.5, direction, true); + Particles.EnergyBeamParticle particle = new Particles.EnergyBeamParticle( + worldObj, x, y, z, getMaster().xCoord + 0.5, getMaster().zCoord + 0.5, direction, false); + Particles.EnergyBeamParticle particle2 = new Particles.EnergyBeamParticle( + worldObj, x, y, z, getMaster().xCoord + 0.5, getMaster().zCoord + 0.5, direction, true); ParticleHandler.spawnCustomParticle(particle, 60); ParticleHandler.spawnCustomParticle(particle2, 60); } @@ -178,7 +188,13 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { public TileEnergyStorageCore getMaster() { if (master == null) return null; - TileEnergyStorageCore tile = (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) : null; + TileEnergyStorageCore tile = + (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null + && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) + worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + : null; return tile; } @@ -303,16 +319,16 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { @Override public String[] getMethodNames() { - return new String[]{"setGeneratorProperty", "getGeneratorState", "resetGeneratorState"}; + return new String[] {"setGeneratorProperty", "getGeneratorState", "resetGeneratorState"}; } @Override public Object[] callMethod(String method, Object... args) { if (method.startsWith("setGeneratorProperty")) { - if (args.length != 2) return new Object[]{false}; - else if (!(args[0] instanceof String)) return new Object[]{false}; + if (args.length != 2) return new Object[] {false}; + else if (!(args[0] instanceof String)) return new Object[] {false}; - /* Particles */ + /* Particles */ if (args[0].equals("particles_enabled") && args[1] instanceof Boolean) { particles_enabled = (Boolean) args[1]; } else if (args[0].equals("red") && args[1] instanceof Double) { @@ -392,15 +408,15 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { } else if (args[0].equals("beam_rotation") && args[1] instanceof Double) { beam_rotation = (float) limit((Double) args[1], -1F, 1F); } else { - return new Object[]{false}; + return new Object[] {false}; } worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - return new Object[]{true}; + return new Object[] {true}; } else if (method.startsWith("getGeneratorState")) { Map map = new HashMap(); - /* Particles */ + /* Particles */ map.put("particles_enabled", particles_enabled); map.put("red", red); map.put("green", green); @@ -430,7 +446,7 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { map.put("selected_particle", selected_particle); map.put("gravity", gravity); - /* Beam */ + /* Beam */ map.put("beam_enabled", beam_enabled); map.put("render_core", render_core); map.put("beam_red", beam_red); @@ -442,7 +458,7 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { map.put("beam_length", beam_length); map.put("beam_rotation", beam_rotation); - return new Object[]{map}; + return new Object[] {map}; } else if (method.startsWith("resetGeneratorState")) { particles_enabled = true; red = 0; @@ -474,7 +490,7 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { selected_particle = 1; gravity = 0F; - //beam + // beam beam_enabled = false; render_core = false; @@ -488,9 +504,9 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { beam_rotation = 0F; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - return new Object[]{true}; + return new Object[] {true}; } - return new Object[]{0}; + return new Object[] {0}; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java index 8fb743a1..7e8597e1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java @@ -26,7 +26,6 @@ public class TilePlayerDetector extends TileEntity { if (output) setOutput(false); } } else tick++; - } private void setOutput(boolean out) { @@ -80,6 +79,4 @@ public class TilePlayerDetector extends TileEntity { super.readFromNBT(compound); } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java index 70b92668..612b78bf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java @@ -1,6 +1,8 @@ package com.brandon3055.draconicevolution.common.tileentities; import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; +import java.util.Iterator; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; @@ -15,9 +17,6 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -import java.util.Iterator; -import java.util.List; - public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory { public String[] names = new String[42]; private ItemStack[] items; @@ -30,8 +29,7 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory private List EntityList; public TilePlayerDetectorAdvanced() { - for (int i = 0; i < names.length; i++) - if (names[i] == null) names[i] = ""; + for (int i = 0; i < names.length; i++) if (names[i] == null) names[i] = ""; items = new ItemStack[1]; } @@ -67,7 +65,6 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory } else { if (!isPlayerListed(name)) return true; } - } return b; } @@ -80,12 +77,14 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory double y2 = yCoord + 0.5 + range; double z2 = zCoord + 0.5 + range; - //System.out.println(x1 + " " + y1 + " " + z1 + " " + x2 + " " + y2 + " " + z2); + // System.out.println(x1 + " " + y1 + " " + z1 + " " + x2 + " " + y2 + " " + z2); - //ScanBox = AxisAlignedBB.getBoundingBox(x1, y1, z1, x2, y2, z2); - //ScanBox = AxisAlignedBB.getAABBPool().getAABB(xCoord + 0.5 - range, yCoord + 0.5 - range, zCoord + 0.5 - range, xCoord + 0.5 + range, yCoord + 0.5 + range, zCoord + 0.5 + range); - EntityList = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x1, y1, z1, x2, y2, z2)); - //System.out.println(EntityList); + // ScanBox = AxisAlignedBB.getBoundingBox(x1, y1, z1, x2, y2, z2); + // ScanBox = AxisAlignedBB.getAABBPool().getAABB(xCoord + 0.5 - range, yCoord + 0.5 - range, zCoord + 0.5 - + // range, xCoord + 0.5 + range, yCoord + 0.5 + range, zCoord + 0.5 + range); + EntityList = worldObj.getEntitiesWithinAABB( + EntityPlayer.class, AxisAlignedBB.getBoundingBox(x1, y1, z1, x2, y2, z2)); + // System.out.println(EntityList); } private void setOutput(boolean out) { @@ -113,7 +112,7 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory return false; } - //###################INVENTORY########################### + // ###################INVENTORY########################### public int getSizeInventory() { return items.length; } @@ -183,19 +182,17 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return false; } - //###################################################### + // ###################################################### public Packet getDescriptionPacket() { NBTTagCompound tagCompound = new NBTTagCompound(); @@ -213,7 +210,6 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory return new ContainerPlayerDetector(inventoryplayer, this); } - @Override public void writeToNBT(NBTTagCompound compound) { NBTTagCompound[] tag = new NBTTagCompound[items.length]; @@ -250,8 +246,7 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory items[i] = ItemStack.loadItemStackFromNBT(tag[i]); } - for (int i = 0; i < names.length; i++) - names[i] = compound.getString("Name_" + i); + for (int i = 0; i < names.length; i++) names[i] = compound.getString("Name_" + i); whiteList = compound.getBoolean("WhiteList"); range = compound.getInteger("Range"); @@ -260,6 +255,4 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory super.readFromNBT(compound); } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java index c41a5c25..69a27f2b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java @@ -32,19 +32,26 @@ public class TilePotentiometer extends TileEntity { worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); if (meta == 1) { - worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 2) { - worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 3) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 4) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 5) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord + 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord + 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 6) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); } else { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java index fb8eab6c..49aa74e0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java @@ -27,14 +27,26 @@ public class TileSunDial extends TileEntity implements IInventory { tick = 0; tick2 = 0; running = false; - worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:discharge", 5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + worldObj.playSoundEffect( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:discharge", + 5F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); } } } private void Runn() { if (tick == 1) { - worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:charge", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + worldObj.playSoundEffect( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:charge", + 10F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } if (tick < 74) { @@ -44,16 +56,56 @@ public class TileSunDial extends TileEntity implements IInventory { worldObj.spawnParticle("explode", xCoord + 1, yCoord + 0.1, zCoord + 0.5, 0.01D, 0D, 0D); } if (tick > 74 && tick2 == 1) { - worldObj.spawnParticle("flame", xCoord + worldObj.rand.nextFloat(), yCoord + worldObj.rand.nextFloat(), zCoord, 0D, 0D, -0.01D); - worldObj.spawnParticle("flame", xCoord + worldObj.rand.nextFloat(), yCoord + worldObj.rand.nextFloat(), zCoord + 1, 0D, 0D, 0.01D); - worldObj.spawnParticle("flame", xCoord + 0, yCoord + worldObj.rand.nextFloat(), zCoord + worldObj.rand.nextFloat(), -0.01D, 0D, 0D); - worldObj.spawnParticle("flame", xCoord + 1, yCoord + worldObj.rand.nextFloat(), zCoord + worldObj.rand.nextFloat(), 0.01D, 0D, 0D); + worldObj.spawnParticle( + "flame", + xCoord + worldObj.rand.nextFloat(), + yCoord + worldObj.rand.nextFloat(), + zCoord, + 0D, + 0D, + -0.01D); + worldObj.spawnParticle( + "flame", + xCoord + worldObj.rand.nextFloat(), + yCoord + worldObj.rand.nextFloat(), + zCoord + 1, + 0D, + 0D, + 0.01D); + worldObj.spawnParticle( + "flame", + xCoord + 0, + yCoord + worldObj.rand.nextFloat(), + zCoord + worldObj.rand.nextFloat(), + -0.01D, + 0D, + 0D); + worldObj.spawnParticle( + "flame", + xCoord + 1, + yCoord + worldObj.rand.nextFloat(), + zCoord + worldObj.rand.nextFloat(), + 0.01D, + 0D, + 0D); } if (tick > 74) Track(getTime()); if (tick > 74) - worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:beam", 5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + worldObj.playSoundEffect( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:beam", + 5F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); if (tick > 74) - worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:boom", 20F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + worldObj.playSoundEffect( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:boom", + 20F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); if (tick2 == 5) tick2 = 0; } @@ -125,12 +177,12 @@ public class TileSunDial extends TileEntity implements IInventory { return time4; } - private double map(final double x, final double in_min, final double in_max, final double out_min, final double out_max) { + private double map( + final double x, final double in_min, final double in_max, final double out_min, final double out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } - - //###################################Inventory#####################################################// + // ###################################Inventory#####################################################// @Override public int getSizeInventory() { return 0; @@ -152,8 +204,7 @@ public class TileSunDial extends TileEntity implements IInventory { } @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - } + public void setInventorySlotContents(int i, ItemStack itemstack) {} @Override public String getInventoryName() { @@ -176,16 +227,13 @@ public class TileSunDial extends TileEntity implements IInventory { } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return false; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java index d9e973a4..ea600f40 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java @@ -12,18 +12,16 @@ import net.minecraft.tileentity.TileEntity; /** * Created by Brandon on 27/06/2014. */ -public class TileTeleporterStand extends TileEntity implements IInventory {//todo Create IRotatable Tile and gui +public class TileTeleporterStand extends TileEntity implements IInventory { // todo Create IRotatable Tile and gui ItemStack[] items = new ItemStack[1]; public int rotation = 0; - //==============================================LOGIC=======================================================// + // ==============================================LOGIC=======================================================// @Override - public void updateEntity() { - } + public void updateEntity() {} - - //==========================================SYNCHRONIZATION==================================================// + // ==========================================SYNCHRONIZATION==================================================// @Override public Packet getDescriptionPacket() { @@ -37,7 +35,7 @@ public class TileTeleporterStand extends TileEntity implements IInventory {//tod readFromNBT(pkt.func_148857_g()); } - //==============================================INVENTORY====================================================// + // ==============================================INVENTORY====================================================// @Override public int getSizeInventory() { @@ -102,19 +100,17 @@ public class TileTeleporterStand extends TileEntity implements IInventory {//tod } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } - //===========================================================================================================// + // ===========================================================================================================// @Override public void writeToNBT(NBTTagCompound compound) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java index 76e2fab2..9d4b0bc6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java @@ -1,12 +1,14 @@ package com.brandon3055.draconicevolution.common.tileentities; +import static net.minecraftforge.common.util.ForgeDirection.UP; + import cofh.api.energy.IEnergyHandler; import cofh.api.energy.IEnergyReceiver; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.brandonscore.common.utills.Utills; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -16,8 +18,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -import static net.minecraftforge.common.util.ForgeDirection.UP; - /** * Created by Brandon on 24/06/2014. */ @@ -25,85 +25,88 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { public EnergyStorage energy = new EnergyStorage(100000000); public int maxInput = 100000000; public float modelRotation; - //Use a map for the beam to each target (Target, Beam) + // Use a map for the beam to each target (Target, Beam) private ParticleEnergyBeam beam = null; private ParticleEnergyField ring = null; - @Override public void updateEntity() { - //beam = DraconicEvolution.proxy.energyBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0.5, 4.5, 0.5, 100, true, beam); - //ring = DraconicEvolution.proxy.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, ClientEventHandler.elapsedTicks % 100, true, ring); + // beam = DraconicEvolution.proxy.energyBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0.5, 4.5, 0.5, + // 100, true, beam); + // ring = DraconicEvolution.proxy.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, + // ClientEventHandler.elapsedTicks % 100, true, ring); if (worldObj.isRemote) return; for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { - if (worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ) instanceof IEnergyReceiver) - ((IEnergyReceiver) worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ)).receiveEnergy(d.getOpposite(), Integer.MAX_VALUE, false); + if (worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ) + instanceof IEnergyReceiver) + ((IEnergyReceiver) worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ)) + .receiveEnergy(d.getOpposite(), Integer.MAX_VALUE, false); } -// LogHelper.info(Integer.MAX_VALUE); - //if (1==1)return; + // LogHelper.info(Integer.MAX_VALUE); + // if (1==1)return; -// for (Field f : StatList.class.getDeclaredFields()) { -// f.setAccessible(true); -// -// try { -// if (f.getName().equals("oneShotStats")) { -// f.set(null, new HashMap()); -// } -// } -// catch (Exception e) { -// LogHelper.error("Severe error, please report this to the mod author:"); -// LogHelper.error(e); -// } -// } + // for (Field f : StatList.class.getDeclaredFields()) { + // f.setAccessible(true); + // + // try { + // if (f.getName().equals("oneShotStats")) { + // f.set(null, new HashMap()); + // } + // } + // catch (Exception e) { + // LogHelper.error("Severe error, please report this to the mod author:"); + // LogHelper.error(e); + // } + // } -// for (Field f : AchievementPage.class.getDeclaredFields()) {// -// f.setAccessible(true); -// -// try { -// if (f.getName().equals("achievementPages")) { -// f.set(null, new LinkedList()); -// } -// } -// catch (Exception e) { -// LogHelper.error("Severe error, please report this to the mod author:"); -// LogHelper.error(e); -// } -// } + // for (Field f : AchievementPage.class.getDeclaredFields()) {// + // f.setAccessible(true); + // + // try { + // if (f.getName().equals("achievementPages")) { + // f.set(null, new LinkedList()); + // } + // } + // catch (Exception e) { + // LogHelper.error("Severe error, please report this to the mod author:"); + // LogHelper.error(e); + // } + // } -// Achievements.addModAchievements(); -// Achievements.registerAchievementPane(); + // Achievements.addModAchievements(); + // Achievements.registerAchievementPane(); -// if (worldObj.isRemote) modelRotation += 0.5; + // if (worldObj.isRemote) modelRotation += 0.5; - //LogHelper.info(modelCoreRotation); + // LogHelper.info(modelCoreRotation); - -// int test = 4; -// //if (!worldObj.isRemote) -// //System.out.println(energy.getEnergyStored()); -// -// if ((this.energy.getEnergyStored() > 0)) { -// -// TileEntity tile = worldObj.getTileEntity(xCoord + UP.offsetX, yCoord + UP.offsetY, zCoord + UP.offsetZ); -// -// if ((tile instanceof IEnergyHandler)) { -// this.energy.extractEnergy(((IEnergyHandler)tile).receiveEnergy(UP.getOpposite(), this.energy.extractEnergy(maxInput, true), false), false); -// } -// } + // int test = 4; + // //if (!worldObj.isRemote) + // //System.out.println(energy.getEnergyStored()); + // + // if ((this.energy.getEnergyStored() > 0)) { + // + // TileEntity tile = worldObj.getTileEntity(xCoord + UP.offsetX, yCoord + UP.offsetY, zCoord + UP.offsetZ); + // + // if ((tile instanceof IEnergyHandler)) { + // this.energy.extractEnergy(((IEnergyHandler)tile).receiveEnergy(UP.getOpposite(), + // this.energy.extractEnergy(maxInput, true), false), false); + // } + // } } @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - if (from != UP) return 0;//this.energy.receiveEnergy(Math.min(maxInput, maxReceive), simulate); + if (from != UP) return 0; // this.energy.receiveEnergy(Math.min(maxInput, maxReceive), simulate); else return 0; } @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { ; - if (from == UP) return 0;//return this.energy.extractEnergy(maxExtract, simulate); + if (from == UP) return 0; // return this.energy.extractEnergy(maxExtract, simulate); else return 0; } @@ -139,14 +142,14 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { readFromNBT(pkt.func_148857_g()); } - @Override public void readFromNBT(NBTTagCompound p_145839_1_) { super.readFromNBT(p_145839_1_); EntityPlayer player = null; if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); if (player != null) - LogHelper.info("Read: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + LogHelper.info( + "Read: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); LogHelper.info(worldObj + " " + player); } @@ -156,6 +159,7 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { EntityPlayer player = null; if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); if (player != null) - LogHelper.info("Write: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + LogHelper.info( + "Write: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java index 69ec7e59..25beaa28 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java @@ -19,7 +19,7 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { public float rotationSpeed = 0; private float targetSpeed = 0; - //==============================================LOGIC=======================================================// + // ==============================================LOGIC=======================================================// @Override public void updateEntity() { @@ -32,8 +32,7 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { rotation += rotationSpeed; } - - //==========================================SYNCHRONIZATION==================================================// + // ==========================================SYNCHRONIZATION==================================================// @Override public Packet getDescriptionPacket() { @@ -47,7 +46,7 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { readFromNBT(pkt.func_148857_g()); } - //==============================================INVENTORY====================================================// + // ==============================================INVENTORY====================================================// @Override public int getSizeInventory() { @@ -118,12 +117,10 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { @@ -132,7 +129,7 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[]{0}; + return new int[] {0}; } @Override @@ -145,7 +142,7 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { return true; } - //===========================================================================================================// + // ===========================================================================================================// @Override public void writeToNBT(NBTTagCompound compound) { @@ -173,4 +170,4 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { } super.readFromNBT(compound); } -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java index 94aaddf2..a8848d5f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java @@ -1,5 +1,6 @@ package com.brandon3055.draconicevolution.common.tileentities; +import com.brandon3055.draconicevolution.DraconicEvolution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; @@ -10,14 +11,13 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.storage.WorldInfo; -import com.brandon3055.draconicevolution.DraconicEvolution; public class TileWeatherController extends TileEntity implements IInventory { int tick = 0; boolean running = false; public boolean lastTickInput = false; public int mode = 0; - private final static boolean debug = DraconicEvolution.debug; + private static final boolean debug = DraconicEvolution.debug; private ItemStack[] items; public int charges; @@ -50,7 +50,6 @@ public class TileWeatherController extends TileEntity implements IInventory { if (fuel.stackSize > 0 && fuel.isItemEqual(new ItemStack(Items.emerald))) { addCharge(10); - } } } @@ -69,12 +68,46 @@ public class TileWeatherController extends TileEntity implements IInventory { worldObj.spawnParticle("largesmoke", xCoord + 0.5, yCoord + 1.2, zCoord + 0.5, 0D, -0.3D, 0D); worldObj.spawnParticle("largesmoke", xCoord + 0.5, yCoord + 1.2, zCoord + 0.5, 0D, -0.3D, 0D); - worldObj.spawnParticle("flame", xCoord + 0.2, yCoord + 1, zCoord + 0.8, (worldObj.rand.nextFloat() - 0.5) * 1.5, 1.7D, (worldObj.rand.nextFloat() - 0.5) * 1.5); - worldObj.spawnParticle("flame", xCoord + 0.8, yCoord + 1, zCoord + 0.8, (worldObj.rand.nextFloat() - 0.5) * 1.5, 1.7D, (worldObj.rand.nextFloat() - 0.5) * 1.5); - worldObj.spawnParticle("flame", xCoord + 0.2, yCoord + 1, zCoord + 0.2, (worldObj.rand.nextFloat() - 0.5) * 1.5, 1.7D, (worldObj.rand.nextFloat() - 0.5) * 1.5); - worldObj.spawnParticle("flame", xCoord + 0.8, yCoord + 1, zCoord + 0.2, (worldObj.rand.nextFloat() - 0.5) * 1.5, 1.7D, (worldObj.rand.nextFloat() - 0.5) * 1.5); - worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "mob.ghast.fireball", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F, false); - + worldObj.spawnParticle( + "flame", + xCoord + 0.2, + yCoord + 1, + zCoord + 0.8, + (worldObj.rand.nextFloat() - 0.5) * 1.5, + 1.7D, + (worldObj.rand.nextFloat() - 0.5) * 1.5); + worldObj.spawnParticle( + "flame", + xCoord + 0.8, + yCoord + 1, + zCoord + 0.8, + (worldObj.rand.nextFloat() - 0.5) * 1.5, + 1.7D, + (worldObj.rand.nextFloat() - 0.5) * 1.5); + worldObj.spawnParticle( + "flame", + xCoord + 0.2, + yCoord + 1, + zCoord + 0.2, + (worldObj.rand.nextFloat() - 0.5) * 1.5, + 1.7D, + (worldObj.rand.nextFloat() - 0.5) * 1.5); + worldObj.spawnParticle( + "flame", + xCoord + 0.8, + yCoord + 1, + zCoord + 0.2, + (worldObj.rand.nextFloat() - 0.5) * 1.5, + 1.7D, + (worldObj.rand.nextFloat() - 0.5) * 1.5); + worldObj.playSound( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "mob.ghast.fireball", + 10F, + worldObj.rand.nextFloat() * 0.1F + 0.9F, + false); } if (tick > 80 && tick < 90) { if (!worldObj.isRemote) { @@ -85,16 +118,28 @@ public class TileWeatherController extends TileEntity implements IInventory { worldinfo.setThundering(true); } } - worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:boom", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + worldObj.playSoundEffect( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:boom", + 10F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (tick > 110 && worldObj.isRemote) { - worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "random.fizz", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F, false); + worldObj.playSound( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "random.fizz", + 10F, + worldObj.rand.nextFloat() * 0.1F + 0.9F, + false); worldObj.spawnParticle("explode", xCoord + 0.5, yCoord + 0, zCoord + 0, 0D, 0D, 0D); worldObj.spawnParticle("explode", xCoord + 0.5, yCoord + 0, zCoord + 1, 0D, 0D, 0D); worldObj.spawnParticle("explode", xCoord + 0, yCoord + 0, zCoord + 0.5, 0D, 0D, 0D); worldObj.spawnParticle("explode", xCoord + 1, yCoord + 0, zCoord + 0.5, 0D, 0D, 0D); - } if (tick > 130) { tick = 0; @@ -103,7 +148,6 @@ public class TileWeatherController extends TileEntity implements IInventory { } tick++; } - } private void addCharge(int count) { @@ -131,7 +175,7 @@ public class TileWeatherController extends TileEntity implements IInventory { readFromNBT(pkt.func_148857_g()); } - //==============================================INVENTORY====================================================// + // ==============================================INVENTORY====================================================// @Override public int getSizeInventory() { @@ -202,19 +246,17 @@ public class TileWeatherController extends TileEntity implements IInventory { } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return itemstack.isItemEqual(new ItemStack(Items.emerald)); } - //############################################################################################################// + // ############################################################################################################// @Override public void writeToNBT(NBTTagCompound compound) { NBTTagCompound[] tag = new NBTTagCompound[items.length]; @@ -261,5 +303,4 @@ public class TileWeatherController extends TileEntity implements IInventory { } worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java index 44b4e63f..d4239ac6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java @@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; * Created by Brandon on 10/02/2015. */ public interface IRemoteEnergyHandler extends IEnergyHandler { - //todo add method for linking + // todo add method for linking /** * @param player The player binding the tiles diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java index 1ee9fe06..74158d42 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java @@ -17,13 +17,13 @@ public class LinkedEnergyDevice { * Energy Flow to this device (range: 0D - 100D) */ public double energyFlow = 0; + public double lastTickEnergyFlow = 0; public int xCoord; public int yCoord; public int zCoord; - public LinkedEnergyDevice() { - } + public LinkedEnergyDevice() {} public LinkedEnergyDevice(int xCoord, int yCoord, int zCoord) { this.xCoord = xCoord; @@ -31,12 +31,12 @@ public class LinkedEnergyDevice { this.zCoord = zCoord; } -// public LinkedEnergyDevice(int xCoord, int yCoord, int zCoord, ParticleEnergyBeam beam) { -// this.xCoord = xCoord; -// this.yCoord = yCoord; -// this.zCoord = zCoord; -// this.beam = beam; -// } + // public LinkedEnergyDevice(int xCoord, int yCoord, int zCoord, ParticleEnergyBeam beam) { + // this.xCoord = xCoord; + // this.yCoord = yCoord; + // this.zCoord = zCoord; + // this.beam = beam; + // } public TileEntity getTile(World world) { return world.getTileEntity(xCoord, yCoord, zCoord); @@ -54,8 +54,7 @@ public class LinkedEnergyDevice { if (beam != null) { compound.setShort("Flow_" + key, (short) beam.getFlow()); } - } - catch (Throwable e) { + } catch (Throwable e) { } return this; } @@ -69,8 +68,7 @@ public class LinkedEnergyDevice { if (beam != null) { beam.setFlow(compound.getShort("Flow" + key)); } - } - catch (Throwable e) { + } catch (Throwable e) { } return this; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java index 464d29ef..33df0227 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java @@ -25,8 +25,7 @@ public class LinkedReceiver { private double tBBZMin = -1; private double tBBZMax = -1; - public LinkedReceiver() { - } + public LinkedReceiver() {} public LinkedReceiver(int xCoord, int yCoord, int zCoord, int connectionSide) { this.xCoord = xCoord; @@ -37,7 +36,8 @@ public class LinkedReceiver { public boolean isStillValid(World world) { TileEntity tile = world.getTileEntity(xCoord, yCoord, zCoord); - return tile instanceof IEnergyReceiver && ((IEnergyReceiver) tile).canConnectEnergy(ForgeDirection.getOrientation(connectionSide)); + return tile instanceof IEnergyReceiver + && ((IEnergyReceiver) tile).canConnectEnergy(ForgeDirection.getOrientation(connectionSide)); } public IEnergyReceiver getReceiver(World world) { @@ -46,7 +46,8 @@ public class LinkedReceiver { public int receiveEnergy(World world, int maxReceive, boolean simulate) { if (isStillValid(world)) - return getReceiver(world).receiveEnergy(ForgeDirection.getOrientation(connectionSide), maxReceive, simulate); + return getReceiver(world) + .receiveEnergy(ForgeDirection.getOrientation(connectionSide), maxReceive, simulate); else return 0; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java index bb13e4ec..a77c0314 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java @@ -14,34 +14,32 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { @SideOnly(Side.CLIENT) private ParticleEnergyField ring; - public TileEnergyRelay() { - } + public TileEnergyRelay() {} public TileEnergyRelay(int powerTier) { this.powerTier = powerTier; this.updateStorage(); } - @Override public int getCap() { - return powerTier == 0 ? - BalanceConfigHandler.energyRelayBasicStorage : - BalanceConfigHandler.energyRelayAdvancedStorage; + return powerTier == 0 + ? BalanceConfigHandler.energyRelayBasicStorage + : BalanceConfigHandler.energyRelayAdvancedStorage; } @Override public int getRec() { - return powerTier == 0 ? - BalanceConfigHandler.energyRelayBasicMaxReceive : - BalanceConfigHandler.energyRelayAdvancedMaxReceive; + return powerTier == 0 + ? BalanceConfigHandler.energyRelayBasicMaxReceive + : BalanceConfigHandler.energyRelayAdvancedMaxReceive; } @Override public int getExt() { - return powerTier == 0 ? - BalanceConfigHandler.energyRelayBasicMaxExtract : - BalanceConfigHandler.energyRelayAdvancedMaxExtract; + return powerTier == 0 + ? BalanceConfigHandler.energyRelayBasicMaxExtract + : BalanceConfigHandler.energyRelayAdvancedMaxExtract; } @Override @@ -49,12 +47,12 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { super.updateEntity(); if (worldObj.isRemote) { - ring = DraconicEvolution.proxy.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0, powerTier == 1, ring, inView > 0); + ring = DraconicEvolution.proxy.energyField( + worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0, powerTier == 1, ring, inView > 0); return; } } - @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); @@ -65,10 +63,11 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { super.readFromNBT(compound); } -// @Override -// public double getCapacity() { -// return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) * 100D; -// } + // @Override + // public double getCapacity() { + // return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) + // * 100D; + // } /** * Calculates the energy flow based on the local buffer @@ -76,7 +75,7 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { * return double between 0 to 100 */ public double getFlow(double localCap, double remoteCap) { - return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D/*Flow Multiplier*/)); + return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D /*Flow Multiplier*/)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java index 559ad4f2..890b5788 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java @@ -19,14 +19,14 @@ import net.minecraftforge.common.util.ForgeDirection; */ public class TileEnergyTransceiver extends TileRemoteEnergyBase { - public int facing = 0;//0=up, 1=down, 3=north, 2=south, 4=east, 5=west + public int facing = 0; // 0=up, 1=down, 3=north, 2=south, 4=east, 5=west private boolean input = false; public boolean transferBoost = false; + @SideOnly(Side.CLIENT) private ParticleEnergyField particle; - public TileEnergyTransceiver() { - } + public TileEnergyTransceiver() {} public TileEnergyTransceiver(int powerTier) { this.powerTier = powerTier; @@ -39,26 +39,44 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase { if (!worldObj.isRemote) { ForgeDirection direction = ForgeDirection.getOrientation(facing).getOpposite(); - TileEntity adjacentTile = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); + TileEntity adjacentTile = worldObj.getTileEntity( + xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); if (!input && adjacentTile instanceof IEnergyReceiver) { IEnergyReceiver handler = (IEnergyReceiver) adjacentTile; - storage.extractEnergy(handler.receiveEnergy(direction.getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), false); + storage.extractEnergy( + handler.receiveEnergy( + direction.getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), + false); if (transferBoost) { for (int i = 0; i < 4; i++) - storage.extractEnergy(handler.receiveEnergy(direction.getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), false); + storage.extractEnergy( + handler.receiveEnergy( + direction.getOpposite(), + storage.extractEnergy(storage.getMaxExtract(), true), + false), + false); } } else if (input && adjacentTile instanceof IEnergyProvider) { IEnergyProvider handler = (IEnergyProvider) adjacentTile; - storage.receiveEnergy(handler.extractEnergy(direction.getOpposite(), storage.receiveEnergy(storage.getMaxExtract(), true), false), false); + storage.receiveEnergy( + handler.extractEnergy( + direction.getOpposite(), storage.receiveEnergy(storage.getMaxExtract(), true), false), + false); if (transferBoost) { for (int i = 0; i < 4; i++) - storage.receiveEnergy(handler.extractEnergy(direction.getOpposite(), storage.receiveEnergy(storage.getMaxExtract(), true), false), false); + storage.receiveEnergy( + handler.extractEnergy( + direction.getOpposite(), + storage.receiveEnergy(storage.getMaxExtract(), true), + false), + false); } } } if (worldObj.isRemote) - particle = DraconicEvolution.proxy.energyField(worldObj, getBeamX(), getBeamY(), getBeamZ(), 1, powerTier == 1, particle, inView > 0); + particle = DraconicEvolution.proxy.energyField( + worldObj, getBeamX(), getBeamY(), getBeamZ(), 1, powerTier == 1, particle, inView > 0); } @Override @@ -106,23 +124,23 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase { @Override public int getCap() { - return powerTier == 0 ? - BalanceConfigHandler.energyTransceiverBasicStorage : - BalanceConfigHandler.energyTransceiverAdvancedStorage; + return powerTier == 0 + ? BalanceConfigHandler.energyTransceiverBasicStorage + : BalanceConfigHandler.energyTransceiverAdvancedStorage; } @Override public int getRec() { - return powerTier == 0 ? - BalanceConfigHandler.energyTransceiverBasicMaxReceive : - BalanceConfigHandler.energyTransceiverAdvancedMaxReceive; + return powerTier == 0 + ? BalanceConfigHandler.energyTransceiverBasicMaxReceive + : BalanceConfigHandler.energyTransceiverAdvancedMaxReceive; } @Override public int getExt() { - return powerTier == 0 ? - BalanceConfigHandler.energyTransceiverBasicMaxExtract : - BalanceConfigHandler.energyTransceiverAdvancedMaxExtract; + return powerTier == 0 + ? BalanceConfigHandler.energyTransceiverBasicMaxExtract + : BalanceConfigHandler.energyTransceiverAdvancedMaxExtract; } @Override @@ -148,12 +166,16 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase { @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - return from == ForgeDirection.getOrientation(facing).getOpposite() && input ? storage.receiveEnergy(maxReceive, simulate) : 0; + return from == ForgeDirection.getOrientation(facing).getOpposite() && input + ? storage.receiveEnergy(maxReceive, simulate) + : 0; } @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - return from == ForgeDirection.getOrientation(facing).getOpposite() && !input ? storage.extractEnergy(maxExtract, simulate) : 0; + return from == ForgeDirection.getOrientation(facing).getOpposite() && !input + ? storage.extractEnergy(maxExtract, simulate) + : 0; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java index 263f46b8..86fa859a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; -import java.util.ArrayList; -import java.util.List; - import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.brandonscore.common.utills.Utills; @@ -16,6 +13,8 @@ import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -30,12 +29,14 @@ import net.minecraftforge.common.util.ForgeDirection; /** * Created by Brandon on 10/02/2015. */ -public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRemoteEnergyHandler {//todo optimize (add cutoff, explore possible cach optimization) +public abstract class TileRemoteEnergyBase extends TileObjectSync + implements IRemoteEnergyHandler { // todo optimize (add cutoff, explore possible cach optimization) /** * The tier of the relay (0-1) */ protected int powerTier; + protected EnergyStorage storage = new EnergyStorage(0); public List linkedDevices = new ArrayList(); protected int lastTickEnergy; @@ -67,7 +68,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe } } - //**********Distribution Logic********** + // **********Distribution Logic********** private void updateLinkedDevices() { for (LinkedEnergyDevice device : linkedDevices) { @@ -93,15 +94,32 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe rType = 1; else rType = 0; } - device.beam = DraconicEvolution.proxy.energyBeam(worldObj, getBeamX(), getBeamY(), getBeamZ(), remoteTile.getBeamX(), remoteTile.getBeamY(), remoteTile.getBeamZ(), (int) device.energyFlow, getPowerTier() == 1, device.beam, true, rType); + device.beam = DraconicEvolution.proxy.energyBeam( + worldObj, + getBeamX(), + getBeamY(), + getBeamZ(), + remoteTile.getBeamX(), + remoteTile.getBeamY(), + remoteTile.getBeamZ(), + (int) device.energyFlow, + getPowerTier() == 1, + device.beam, + true, + rType); } else { double difference = getCapacity() - remoteTile.getCapacity(); - double energyToEqual = Math.round(difference / 100D * (double) remoteTile.getStorage().getMaxEnergyStored() / 2.01D); - double maxFlow = Math.min(energyToEqual, (double) Math.min(storage.getMaxExtract(), remoteTile.getStorage().getMaxEnergyStored() - remoteTile.getStorage().getEnergyStored())); + double energyToEqual = Math.round( + difference / 100D * (double) remoteTile.getStorage().getMaxEnergyStored() / 2.01D); + double maxFlow = Math.min(energyToEqual, (double) Math.min( + storage.getMaxExtract(), + remoteTile.getStorage().getMaxEnergyStored() + - remoteTile.getStorage().getEnergyStored())); device.energyFlow = getFlow(getCapacity(), remoteTile.getCapacity()); int flow = (int) ((device.energyFlow / 100D) * maxFlow); - int transfered = storage.extractEnergy(remoteTile.getStorage().receiveEnergy(storage.extractEnergy(flow, true), false), false); + int transfered = storage.extractEnergy( + remoteTile.getStorage().receiveEnergy(storage.extractEnergy(flow, true), false), false); device.energyFlow = Math.min(((double) transfered / 10000D) * 100D, 100D); @@ -116,8 +134,11 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe boolean forceSend = (tick + xCoord + yCoord + zCoord) % 100 == 0; if ((tick + xCoord + yCoord + zCoord) % 20 == 0 || forceSend) { - if (index >= 0 && (linkedDevices.get(index).energyFlow != linkedDevices.get(index).lastTickEnergyFlow || forceSend)) { - sendObjectToClient(References.INT_PAIR_ID, 0, new DataUtills.IntPair(index, (int) linkedDevices.get(index).energyFlow)); + if (index >= 0 + && (linkedDevices.get(index).energyFlow != linkedDevices.get(index).lastTickEnergyFlow + || forceSend)) { + sendObjectToClient(References.INT_PAIR_ID, 0, new DataUtills.IntPair(index, (int) + linkedDevices.get(index).energyFlow)); linkedDevices.get(index).lastTickEnergyFlow = linkedDevices.get(index).energyFlow; } @@ -129,12 +150,13 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe @SideOnly(Side.CLIENT) @Override public void receiveObjectFromServer(int index, Object object) { - if (index == 0 && object instanceof DataUtills.IntPair && linkedDevices.size() > ((DataUtills.IntPair) object).i1) { + if (index == 0 + && object instanceof DataUtills.IntPair + && linkedDevices.size() > ((DataUtills.IntPair) object).i1) { linkedDevices.get(((DataUtills.IntPair) object).i1).energyFlow = ((DataUtills.IntPair) object).i2; } else if (index == 1) storage.setEnergyStored((Integer) object); } - @Override public double getCapacity() { return ((double) storage.getEnergyStored() / (double) storage.getMaxEnergyStored()) * 100D; @@ -146,7 +168,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe * return double between 0 to 100 */ public double getFlow(double localCap, double remoteCap) { - return Math.max(0, Math.min(100, (localCap - remoteCap) * 10D/*Flow Multiplier*/)); + return Math.max(0, Math.min(100, (localCap - remoteCap) * 10D /*Flow Multiplier*/)); } public int getPowerTier() { @@ -170,11 +192,16 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe if (mode.equals(Wrench.BIND_MODE)) { if (linkDat != null && linkDat.hasKey("Bound") && linkDat.getBoolean("Bound")) { - //LogHelper.info("Bind"); - handleBinding(player, linkDat.getInteger("XCoord"), linkDat.getInteger("YCoord"), linkDat.getInteger("ZCoord"), true); + // LogHelper.info("Bind"); + handleBinding( + player, + linkDat.getInteger("XCoord"), + linkDat.getInteger("YCoord"), + linkDat.getInteger("ZCoord"), + true); linkDat.setBoolean("Bound", false); } else { - //LogHelper.info("Bind2"); + // LogHelper.info("Bind2"); linkDat = new NBTTagCompound(); linkDat.setInteger("XCoord", xCoord); linkDat.setInteger("YCoord", yCoord); @@ -187,10 +214,13 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe } else if (mode.equals(Wrench.UNBIND_MODE)) { if (linkDat != null && linkDat.hasKey("Bound") && linkDat.getBoolean("Bound")) { for (LinkedEnergyDevice ld : linkedDevices) { - if (ld.xCoord == linkDat.getInteger("XCoord") && ld.yCoord == linkDat.getInteger("YCoord") && ld.zCoord == linkDat.getInteger("ZCoord")) { + if (ld.xCoord == linkDat.getInteger("XCoord") + && ld.yCoord == linkDat.getInteger("YCoord") + && ld.zCoord == linkDat.getInteger("ZCoord")) { if (!(ld.getTile(worldObj) instanceof TileRemoteEnergyBase)) { - LogHelper.error("TileRemoteEnergyBase - UNBIND - Remote tile invalid (This should be reported)"); + LogHelper.error( + "TileRemoteEnergyBase - UNBIND - Remote tile invalid (This should be reported)"); break; } @@ -233,7 +263,6 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe break; } } - } linkedDevices.clear(); @@ -244,8 +273,12 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe @Override public boolean handleBinding(EntityPlayer player, int x, int y, int z, boolean callOther) { - int range = powerTier == 0 ? BalanceConfigHandler.energyDeviceBasicLinkingRange : BalanceConfigHandler.energyDeviceAdvancedLinkingRange; - IRemoteEnergyHandler tile = worldObj.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler ? (IRemoteEnergyHandler) worldObj.getTileEntity(x, y, z) : null; + int range = powerTier == 0 + ? BalanceConfigHandler.energyDeviceBasicLinkingRange + : BalanceConfigHandler.energyDeviceAdvancedLinkingRange; + IRemoteEnergyHandler tile = worldObj.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler + ? (IRemoteEnergyHandler) worldObj.getTileEntity(x, y, z) + : null; if (tile == null || (x == xCoord && y == yCoord && z == zCoord)) { if (worldObj.isRemote) @@ -262,7 +295,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe } if (callOther && !tile.handleBinding(player, xCoord, yCoord, zCoord, false)) { - //LogHelper.info("other Invalid"); + // LogHelper.info("other Invalid"); return false; } @@ -288,7 +321,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe return storage; } - //************************************** + // ************************************** @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java index 8661a9f6..2320d954 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; -import java.util.ArrayList; -import java.util.List; - import cofh.api.energy.IEnergyReceiver; import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; @@ -13,6 +10,8 @@ import com.brandon3055.draconicevolution.common.items.tools.Wrench; import com.brandon3055.draconicevolution.common.lib.References; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -30,34 +29,32 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { public List receiverList = new ArrayList(); - public TileWirelessEnergyTransceiver() { - } + public TileWirelessEnergyTransceiver() {} public TileWirelessEnergyTransceiver(int powerTier) { this.powerTier = powerTier; this.updateStorage(); } - @Override public int getCap() { - return powerTier == 0 ? - BalanceConfigHandler.energyWirelessTransceiverBasicStorage : - BalanceConfigHandler.energyWirelessTransceiverAdvancedStorage; + return powerTier == 0 + ? BalanceConfigHandler.energyWirelessTransceiverBasicStorage + : BalanceConfigHandler.energyWirelessTransceiverAdvancedStorage; } @Override public int getRec() { - return powerTier == 0 ? - BalanceConfigHandler.energyWirelessTransceiverBasicMaxReceive : - BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxReceive; + return powerTier == 0 + ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxReceive + : BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxReceive; } @Override public int getExt() { - return powerTier == 0 ? - BalanceConfigHandler.energyWirelessTransceiverBasicMaxExtract : - BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxExtract; + return powerTier == 0 + ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxExtract + : BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxExtract; } @Override @@ -65,26 +62,47 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { super.updateEntity(); if (worldObj.isRemote) { - ring = DraconicEvolution.proxy.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 2, powerTier == 1, ring, inView > 0); + ring = DraconicEvolution.proxy.energyField( + worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 2, powerTier == 1, ring, inView > 0); for (LinkedReceiver receiver : receiverList) { int particleValue = 200; if (receiver.particleEnergyCounter > particleValue) { receiver.particleEnergyCounter -= particleValue; - //todo detect box size - DraconicEvolution.proxy.spawnParticle(new Particles.TransceiverParticle(worldObj, xCoord + 0.5, yCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), zCoord + 0.5, receiver.xCoord + worldObj.rand.nextDouble(), receiver.yCoord + worldObj.rand.nextDouble(), receiver.zCoord + worldObj.rand.nextDouble()), 64); + // todo detect box size + DraconicEvolution.proxy.spawnParticle( + new Particles.TransceiverParticle( + worldObj, + xCoord + 0.5, + yCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), + zCoord + 0.5, + receiver.xCoord + worldObj.rand.nextDouble(), + receiver.yCoord + worldObj.rand.nextDouble(), + receiver.zCoord + worldObj.rand.nextDouble()), + 64); } } } else { for (LinkedReceiver receiver : receiverList) { - if (!receiver.isStillValid(worldObj) && worldObj.getChunkFromBlockCoords(receiver.xCoord, receiver.zCoord).isChunkLoaded) { + if (!receiver.isStillValid(worldObj) + && worldObj.getChunkFromBlockCoords(receiver.xCoord, receiver.zCoord).isChunkLoaded) { receiverList.remove(receiver); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); break; } - int sent = receiver.receiveEnergy(worldObj, storage.extractEnergy(receiver.receiveEnergy(worldObj, powerTier == 0 ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxSend : BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxSend, true), false), false); + int sent = receiver.receiveEnergy( + worldObj, + storage.extractEnergy( + receiver.receiveEnergy( + worldObj, + powerTier == 0 + ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxSend + : BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxSend, + true), + false), + false); sent = (sent / 20); @@ -131,12 +149,14 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { return; } - if (mode.equals(Wrench.BIND_MODE)) { LinkedReceiver r = new LinkedReceiver(x, y, z, side); for (LinkedReceiver r2 : receiverList) { - if (r.xCoord == r2.xCoord && r.yCoord == r2.yCoord && r.zCoord == r2.zCoord && r.connectionSide == r2.connectionSide) { + if (r.xCoord == r2.xCoord + && r.yCoord == r2.yCoord + && r.zCoord == r2.zCoord + && r.connectionSide == r2.connectionSide) { player.addChatComponentMessage(new ChatComponentTranslation("msg.de.linked.txt")); return; } @@ -175,10 +195,11 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { } } -// @Override -// public double getCapacity() { -// return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) * 100D; -// } + // @Override + // public double getCapacity() { + // return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) + // * 100D; + // } /** * Calculates the energy flow based on the local buffer @@ -186,7 +207,7 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { * return double between 0 to 100 */ public double getFlow(double localCap, double remoteCap) { - return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D/*Flow Multiplier*/)); + return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D /*Flow Multiplier*/)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java index 10347ae1..f8db223a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java @@ -57,7 +57,8 @@ public class TileFluidGate extends TileGate implements IFluidHandler { } private IFluidHandler getOutputTarget() { - TileEntity tile = worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); + TileEntity tile = + worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); return tile instanceof IFluidHandler ? (IFluidHandler) tile : null; } @@ -91,5 +92,4 @@ public class TileFluidGate extends TileGate implements IFluidHandler { public String getName() { return "fluid_gate"; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java index 800e5f93..fe23884a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java @@ -23,32 +23,40 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { IEnergyReceiver target = getOutputTarget(); -// int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - buffer.getEnergyStored()))), simulate); -// return i; - int transfer = target == null ? 0 : target.receiveEnergy(from, Math.min(Math.max(0, getActualFlow() - transferredThisTick), target.receiveEnergy(from, maxReceive, true)), simulate); + // int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - + // buffer.getEnergyStored()))), simulate); + // return i; + int transfer = target == null + ? 0 + : target.receiveEnergy( + from, + Math.min( + Math.max(0, getActualFlow() - transferredThisTick), + target.receiveEnergy(from, maxReceive, true)), + simulate); transferredThisTick += transfer; return transfer; } -// private EnergyStorage buffer = new EnergyStorage(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); -// -// @Override -// public void updateEntity() { -// super.updateEntity(); -// -// IEnergyReceiver receiver = getOutputTarget(); -// if (receiver != null && !worldObj.isRemote){ -// buffer.extractEnergy(receiver.receiveEnergy(output.getOpposite(), getActualFlow(), false), false); -// } -// } -// -// @Override -// public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { -// if (buffer.getEnergyStored() > 0) return 0; -// int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - buffer.getEnergyStored()))), simulate); -// return i; -// } - + // private EnergyStorage buffer = new EnergyStorage(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); + // + // @Override + // public void updateEntity() { + // super.updateEntity(); + // + // IEnergyReceiver receiver = getOutputTarget(); + // if (receiver != null && !worldObj.isRemote){ + // buffer.extractEnergy(receiver.receiveEnergy(output.getOpposite(), getActualFlow(), false), false); + // } + // } + // + // @Override + // public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { + // if (buffer.getEnergyStored() > 0) return 0; + // int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - + // buffer.getEnergyStored()))), simulate); + // return i; + // } @Override public int getEnergyStored(ForgeDirection from) { @@ -68,7 +76,8 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { } private IEnergyReceiver getOutputTarget() { - TileEntity tile = worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); + TileEntity tile = + worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); return tile instanceof IEnergyReceiver ? (IEnergyReceiver) tile : null; } @@ -79,7 +88,8 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { @Override public void incrementFlow(int selector, boolean ctrl, boolean shift, boolean add, int button) { - int amount = button == 0 ? shift ? ctrl ? 10000 : 1000 : ctrl ? 5 : 50 : shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10; + int amount = + button == 0 ? shift ? ctrl ? 10000 : 1000 : ctrl ? 5 : 50 : shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10; if (selector == 0) { if (ctrl && shift && button == 0) amount += flowRSLow / 100000 * 1000; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java index 3d0de006..76ceaee7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java @@ -90,39 +90,52 @@ public abstract class TileGate extends TileObjectSync implements IDEPeripheral { @Override public String[] getMethodNames() { - return new String[]{"getFlow", "setOverrideEnabled", "getOverrideEnabled", "setFlowOverride", "setSignalHighFlow", "getSignalHighFlow", "setSignalLowFlow", "getSignalLowFlow"}; + return new String[] { + "getFlow", + "setOverrideEnabled", + "getOverrideEnabled", + "setFlowOverride", + "setSignalHighFlow", + "getSignalHighFlow", + "setSignalLowFlow", + "getSignalLowFlow" + }; } @Override public Object[] callMethod(String method, Object... args) { if (method.equals("getFlow")) { - return new Object[]{getActualFlow()}; + return new Object[] {getActualFlow()}; } else if (method.equals("setOverrideEnabled")) { if (args.length == 0 || !(args[0] instanceof Boolean)) - throw new IllegalArgumentException("Expected Boolean got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + throw new IllegalArgumentException("Expected Boolean got " + + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowOverridden = (Boolean) args[0]; if (!worldObj.isRemote) sendObjectToClient(References.BOOLEAN_ID, 2, flowOverridden); } else if (method.equals("getOverrideEnabled")) { - return new Object[]{flowOverridden}; + return new Object[] {flowOverridden}; } else if (method.equals("setFlowOverride")) { if (args.length == 0 || !(args[0] instanceof Number)) - throw new IllegalArgumentException("Expected Number got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + throw new IllegalArgumentException("Expected Number got " + + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowOverride = Utills.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 3, flowOverride); } else if (method.equals("setSignalHighFlow")) { if (args.length == 0 || !(args[0] instanceof Number)) - throw new IllegalArgumentException("Expected Number got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + throw new IllegalArgumentException("Expected Number got " + + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowRSHigh = Utills.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 4, flowRSHigh); } else if (method.equals("getSignalHighFlow")) { - return new Object[]{flowRSHigh}; + return new Object[] {flowRSHigh}; } else if (method.equals("setSignalLowFlow")) { if (args.length == 0 || !(args[0] instanceof Number)) - throw new IllegalArgumentException("Expected Number got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + throw new IllegalArgumentException("Expected Number got " + + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowRSLow = Utills.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 5, flowRSLow); } else if (method.equals("getSignalLowFlow")) { - return new Object[]{flowRSLow}; + return new Object[] {flowRSLow}; } return new Object[0]; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java index 783ffcef..5238ca4a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java @@ -39,7 +39,8 @@ public class TileDislocatorReceptacle extends TileEntity implements IInventory { isActive = false; return; } - isActive = structure.checkFrameIsValid(worldObj, xCoord, yCoord, zCoord) && structure.scanPortal(worldObj, xCoord, yCoord, zCoord, false, true); + isActive = structure.checkFrameIsValid(worldObj, xCoord, yCoord, zCoord) + && structure.scanPortal(worldObj, xCoord, yCoord, zCoord, false, true); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -161,16 +162,16 @@ public class TileDislocatorReceptacle extends TileEntity implements IInventory { } @Override - public void openInventory() { - } + public void openInventory() {} @Override - public void closeInventory() { - } + public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return itemstack != null && itemstack.getItem() instanceof TeleporterMKI && ((TeleporterMKI) itemstack.getItem()).getLocation(itemstack) != null; + return itemstack != null + && itemstack.getItem() instanceof TeleporterMKI + && ((TeleporterMKI) itemstack.getItem()).getLocation(itemstack) != null; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java index 9369792a..3414244f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java @@ -1,15 +1,16 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.client.render.particle.Particles.AdvancedSeekerParticle; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon; import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.effect.EntityLightningBolt; @@ -22,8 +23,6 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; -import java.util.Random; - /** * Created by Brandon on 8/08/2014. */ @@ -49,7 +48,7 @@ public class TileEnderResurrection extends TileEntity { @Override public void updateEntity() { if (spawnInProgress) { - //if (timer < 1800) timer = 2200; + // if (timer < 1800) timer = 2200; if (!arePillarsValid() || !isBaseValid()) spawnInProgress = false; effectDrive(); findAndActivateChrystals(timer - 200, true); @@ -67,29 +66,41 @@ public class TileEnderResurrection extends TileEntity { if (owner == null) return; for (int i = 0; i < diamondPillars.length; i++) { if (diamondPillars[i] == null) return; - worldObj.setBlockToAir(diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord(), diamondPillars[i].getZCoord()); + worldObj.setBlockToAir( + diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord(), diamondPillars[i].getZCoord()); if (!worldObj.isRemote) - worldObj.createExplosion(owner, diamondPillars[i].getXCoord() + 0.5, diamondPillars[i].getYCoord() + 0.5, diamondPillars[i].getZCoord() + 0.5, 3, true); + worldObj.createExplosion( + owner, + diamondPillars[i].getXCoord() + 0.5, + diamondPillars[i].getYCoord() + 0.5, + diamondPillars[i].getZCoord() + 0.5, + 3, + true); } for (int i = 0; i < draconiumPillars.length; i++) { if (draconiumPillars[i] == null) return; - worldObj.setBlockToAir(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord()); + worldObj.setBlockToAir( + draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord()); if (!worldObj.isRemote) - worldObj.createExplosion(owner, draconiumPillars[i].getXCoord() + 0.5, draconiumPillars[i].getYCoord() + 0.5, draconiumPillars[i].getZCoord() + 0.5, 3, true); + worldObj.createExplosion( + owner, + draconiumPillars[i].getXCoord() + 0.5, + draconiumPillars[i].getYCoord() + 0.5, + draconiumPillars[i].getZCoord() + 0.5, + 3, + true); } worldObj.setBlockToAir(xCoord, yCoord, zCoord); if (!worldObj.isRemote) worldObj.createExplosion(owner, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 3, true); if (!worldObj.isRemote) worldObj.createExplosion(null, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 10, false); - if (level > 10) level = 10; EntityCustomDragon dragon = new EntityCustomDragon(worldObj, 200D + level * 50, 10F + (float) level * 5F); dragon.setPosition(xCoord, yCoord + 60, zCoord); dragon.onSpawnWithEgg(null); if (!worldObj.isRemote) worldObj.spawnEntityInWorld(dragon); playerProps.setSpawnCount(playerProps.getSpawnCount() + 1); - } private void lEffects() { @@ -103,8 +114,8 @@ public class TileEnderResurrection extends TileEntity { float mod = 0.1F; yaw += worldObj.rand.nextBoolean() ? mod : -mod; pitch += worldObj.rand.nextBoolean() ? mod : -mod; - //yaw += (-0.5F+worldObj.rand.nextFloat())*mod; - //pitch += (-0.5F+worldObj.rand.nextFloat())*mod; + // yaw += (-0.5F+worldObj.rand.nextFloat())*mod; + // pitch += (-0.5F+worldObj.rand.nextFloat())*mod; if (worldObj.isRemote) p.setLocationAndAngles(p.posX, p.posY - 1.6, p.posZ, yaw, pitch); } @@ -121,10 +132,10 @@ public class TileEnderResurrection extends TileEntity { findAndActivateChrystals(timer - 50, false); findAndActivateChrystals(timer - 100, false); - - //if (timer == 1) worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:boom", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F); - //if (timer == 1 || worldObj.rand.nextInt(50) == 0) worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "ambient.weather.thunder", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F); - + // if (timer == 1) worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, + // "draconicevolution:boom", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + // if (timer == 1 || worldObj.rand.nextInt(50) == 0) worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, + // zCoord + 0.5D, "ambient.weather.thunder", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F); if (worldObj.rand.nextInt(50) == 0 && timer < 300) centreStrike(); } @@ -133,7 +144,11 @@ public class TileEnderResurrection extends TileEntity { if (pillar != 1 && pillar != 2 && pillar != 3 && pillar != 4) return; pillar--; if (draconiumPillars[pillar] == null) return; - EntityLightningBolt bolt = new EntityLightningBolt(worldObj, draconiumPillars[pillar].getXCoord(), draconiumPillars[pillar].getYCoord(), draconiumPillars[pillar].getZCoord()); + EntityLightningBolt bolt = new EntityLightningBolt( + worldObj, + draconiumPillars[pillar].getXCoord(), + draconiumPillars[pillar].getYCoord(), + draconiumPillars[pillar].getZCoord()); if (!worldObj.isRemote) worldObj.addWeatherEffect(bolt); } @@ -155,9 +170,9 @@ public class TileEnderResurrection extends TileEntity { if (flag && !worldObj.isRemote) { if (spawnCrystal) { - //EntityEnderCrystal crystal = new EntityEnderCrystal(worldObj); - //crystal.setPosition(x + 0.5, y + 1, z + 0.5); - //worldObj.spawnEntityInWorld(crystal); + // EntityEnderCrystal crystal = new EntityEnderCrystal(worldObj); + // crystal.setPosition(x + 0.5, y + 1, z + 0.5); + // worldObj.spawnEntityInWorld(crystal); NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setString("id", "EnderCrystal"); @@ -201,7 +216,11 @@ public class TileEnderResurrection extends TileEntity { if (spawnInProgress) { for (int i = 0; i < draconiumPillars.length; i++) { if (draconiumPillars[i] == null || !arePillarsValid()) return false; - worldObj.setBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord(), ModBlocks.draconiumBlock); + worldObj.setBlock( + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord(), + draconiumPillars[i].getZCoord(), + ModBlocks.draconiumBlock); } flag = false; } @@ -219,23 +238,53 @@ public class TileEnderResurrection extends TileEntity { } private boolean isBaseValid() { - if (worldObj.getBlock(xCoord + 1, yCoord, zCoord) != Blocks.obsidian || worldObj.getBlock(xCoord - 1, yCoord, zCoord) != Blocks.obsidian || worldObj.getBlock(xCoord, yCoord, zCoord + 1) != Blocks.obsidian || worldObj.getBlock(xCoord, yCoord, zCoord - 1) != Blocks.obsidian) - return false; - if (worldObj.getBlock(xCoord + 1, yCoord, zCoord + 1) != Blocks.glowstone || worldObj.getBlock(xCoord - 1, yCoord, zCoord - 1) != Blocks.glowstone || worldObj.getBlock(xCoord - 1, yCoord, zCoord + 1) != Blocks.glowstone || worldObj.getBlock(xCoord + 1, yCoord, zCoord - 1) != Blocks.glowstone) - return false; + if (worldObj.getBlock(xCoord + 1, yCoord, zCoord) != Blocks.obsidian + || worldObj.getBlock(xCoord - 1, yCoord, zCoord) != Blocks.obsidian + || worldObj.getBlock(xCoord, yCoord, zCoord + 1) != Blocks.obsidian + || worldObj.getBlock(xCoord, yCoord, zCoord - 1) != Blocks.obsidian) return false; + if (worldObj.getBlock(xCoord + 1, yCoord, zCoord + 1) != Blocks.glowstone + || worldObj.getBlock(xCoord - 1, yCoord, zCoord - 1) != Blocks.glowstone + || worldObj.getBlock(xCoord - 1, yCoord, zCoord + 1) != Blocks.glowstone + || worldObj.getBlock(xCoord + 1, yCoord, zCoord - 1) != Blocks.glowstone) return false; return true; } private boolean arePillarsValid() { for (int i = 0; i < diamondPillars.length; i++) { if (diamondPillars[i] == null) return false; - if (worldObj.getBlock(diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord(), diamondPillars[i].getZCoord()) != Blocks.diamond_block || worldObj.getBlock(diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord() - 1, diamondPillars[i].getZCoord()) != Blocks.quartz_block) - return false; + if (worldObj.getBlock( + diamondPillars[i].getXCoord(), + diamondPillars[i].getYCoord(), + diamondPillars[i].getZCoord()) + != Blocks.diamond_block + || worldObj.getBlock( + diamondPillars[i].getXCoord(), + diamondPillars[i].getYCoord() - 1, + diamondPillars[i].getZCoord()) + != Blocks.quartz_block) return false; } for (int i = 0; i < draconiumPillars.length; i++) { if (draconiumPillars[i] == null) return false; - if ((worldObj.getBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord()) != ModBlocks.draconiumBlock && worldObj.getBlockMetadata(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord()) != 2) || worldObj.getBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord() - 1, draconiumPillars[i].getZCoord()) != Blocks.quartz_block || worldObj.getBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord() - 2, draconiumPillars[i].getZCoord()) != Blocks.quartz_block) - return false; + if ((worldObj.getBlock( + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord(), + draconiumPillars[i].getZCoord()) + != ModBlocks.draconiumBlock + && worldObj.getBlockMetadata( + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord(), + draconiumPillars[i].getZCoord()) + != 2) + || worldObj.getBlock( + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord() - 1, + draconiumPillars[i].getZCoord()) + != Blocks.quartz_block + || worldObj.getBlock( + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord() - 2, + draconiumPillars[i].getZCoord()) + != Blocks.quartz_block) return false; } return true; } @@ -247,7 +296,10 @@ public class TileEnderResurrection extends TileEntity { for (int x = xCoord - xzRange; x < xCoord + xzRange; x++) { for (int y = yCoord + 2; y < yCoord + 5; y++) { for (int z = zCoord - xzRange; z < zCoord + xzRange; z++) { - if (worldObj.getBlock(x, y, z) == ModBlocks.draconiumBlock && isPillarValid(0, x, y, z) && worldObj.getBlockMetadata(x, y, z) == 2 && draconiumCount < 4) { + if (worldObj.getBlock(x, y, z) == ModBlocks.draconiumBlock + && isPillarValid(0, x, y, z) + && worldObj.getBlockMetadata(x, y, z) == 2 + && draconiumCount < 4) { draconiumPillars[draconiumCount] = new MultiblockHelper.TileLocation(x, y, z); draconiumCount++; } @@ -258,7 +310,9 @@ public class TileEnderResurrection extends TileEntity { for (int x = xCoord - xzRange; x < xCoord + xzRange; x++) { for (int y = yCoord + 1; y < yCoord + 4; y++) { for (int z = zCoord - xzRange; z < zCoord + xzRange; z++) { - if (worldObj.getBlock(x, y, z) == Blocks.diamond_block && isPillarValid(1, x, y, z) && diamondCount < 4) { + if (worldObj.getBlock(x, y, z) == Blocks.diamond_block + && isPillarValid(1, x, y, z) + && diamondCount < 4) { diamondPillars[diamondCount] = new MultiblockHelper.TileLocation(x, y, z); diamondCount++; } @@ -275,23 +329,84 @@ public class TileEnderResurrection extends TileEntity { float mM = 0.4F; for (int i = 0; i < draconiumPillars.length; i++) { if (draconiumPillars[i] == null) return; - AdvancedSeekerParticle particle = new AdvancedSeekerParticle(worldObj, draconiumPillars[i].getXCoord() + 0.5, draconiumPillars[i].getYCoord() + 0.5, draconiumPillars[i].getZCoord() + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 2, 0F, 1.0F, 1.0F, 100); + AdvancedSeekerParticle particle = new AdvancedSeekerParticle( + worldObj, + draconiumPillars[i].getXCoord() + 0.5, + draconiumPillars[i].getYCoord() + 0.5, + draconiumPillars[i].getZCoord() + 0.5, + xCoord + 0.5, + yCoord + 0.5, + zCoord + 0.5, + 2, + 0F, + 1.0F, + 1.0F, + 100); AdvancedSeekerParticle particle2; if (timer < 300) - particle2 = new AdvancedSeekerParticle(worldObj, draconiumPillars[i].getXCoord() + 0.5, draconiumPillars[i].getYCoord() + 0.5, draconiumPillars[i].getZCoord() + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 1, 1F, 0.0F, 0F, 40); + particle2 = new AdvancedSeekerParticle( + worldObj, + draconiumPillars[i].getXCoord() + 0.5, + draconiumPillars[i].getYCoord() + 0.5, + draconiumPillars[i].getZCoord() + 0.5, + xCoord + 0.5, + yCoord + 0.5, + zCoord + 0.5, + 1, + 1F, + 0.0F, + 0F, + 40); else { - particle2 = new AdvancedSeekerParticle(worldObj, draconiumPillars[i].getXCoord() + 0.5, draconiumPillars[i].getYCoord() + 0.5, draconiumPillars[i].getZCoord() + 0.5, xCoord + rand.nextFloat(), yCoord + 3 + rand.nextFloat(), zCoord + rand.nextFloat(), 3, 1F, 0.0F, 0F, 70, timer); + particle2 = new AdvancedSeekerParticle( + worldObj, + draconiumPillars[i].getXCoord() + 0.5, + draconiumPillars[i].getYCoord() + 0.5, + draconiumPillars[i].getZCoord() + 0.5, + xCoord + rand.nextFloat(), + yCoord + 3 + rand.nextFloat(), + zCoord + rand.nextFloat(), + 3, + 1F, + 0.0F, + 0F, + 70, + timer); } if (timer > 2000) { - AdvancedSeekerParticle toDiamond = new AdvancedSeekerParticle(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, diamondPillars[i].getXCoord() + rand.nextFloat(), diamondPillars[i].getYCoord() + rand.nextFloat(), diamondPillars[i].getZCoord() + rand.nextFloat(), 3, 0, 1, 0, 100); + AdvancedSeekerParticle toDiamond = new AdvancedSeekerParticle( + worldObj, + xCoord + 0.5, + yCoord + 0.5, + zCoord + 0.5, + diamondPillars[i].getXCoord() + rand.nextFloat(), + diamondPillars[i].getYCoord() + rand.nextFloat(), + diamondPillars[i].getZCoord() + rand.nextFloat(), + 3, + 0, + 1, + 0, + 100); ParticleHandler.spawnCustomParticle(toDiamond, 250); if (timer > 2100) { - AdvancedSeekerParticle toSpawn = new AdvancedSeekerParticle(worldObj, diamondPillars[i].getXCoord() + rand.nextFloat(), diamondPillars[i].getYCoord() + rand.nextFloat(), diamondPillars[i].getZCoord() + rand.nextFloat(), xCoord - 3.5 + (double) (rand.nextFloat() * 7F), yCoord + 60 + rand.nextInt(5), zCoord - 3.5 + (double) (rand.nextFloat() * 7F), 3, 0F, 1F, 0F, 100, timer); + AdvancedSeekerParticle toSpawn = new AdvancedSeekerParticle( + worldObj, + diamondPillars[i].getXCoord() + rand.nextFloat(), + diamondPillars[i].getYCoord() + rand.nextFloat(), + diamondPillars[i].getZCoord() + rand.nextFloat(), + xCoord - 3.5 + (double) (rand.nextFloat() * 7F), + yCoord + 60 + rand.nextInt(5), + zCoord - 3.5 + (double) (rand.nextFloat() * 7F), + 3, + 0F, + 1F, + 0F, + 100, + timer); ParticleHandler.spawnCustomParticle(toSpawn, 250); } } - particle.motionX = (rand.nextFloat() - 0.5) * mM; particle.motionZ = (rand.nextFloat() - 0.5) * mM; particle2.motionX = (rand.nextFloat() - 0.5) * mM; @@ -304,7 +419,20 @@ public class TileEnderResurrection extends TileEntity { int t; if (timer > 700) t = timer; else t = 700; - AdvancedSeekerParticle particle3 = new AdvancedSeekerParticle(worldObj, xCoord + rand.nextFloat(), yCoord + 0.5, zCoord + rand.nextFloat(), xCoord + rand.nextFloat(), yCoord + 3 + rand.nextFloat(), zCoord + rand.nextFloat(), 3, 0F, 1.0F, 1.0F, 70, t); + AdvancedSeekerParticle particle3 = new AdvancedSeekerParticle( + worldObj, + xCoord + rand.nextFloat(), + yCoord + 0.5, + zCoord + rand.nextFloat(), + xCoord + rand.nextFloat(), + yCoord + 3 + rand.nextFloat(), + zCoord + rand.nextFloat(), + 3, + 0F, + 1.0F, + 1.0F, + 70, + t); ParticleHandler.spawnCustomParticle(particle3, 250); } if (timer > 1000) { @@ -315,7 +443,19 @@ public class TileEnderResurrection extends TileEntity { red = green = blue = 1.0F * f; green *= 0.3F; red *= 0.9F; - AdvancedSeekerParticle particle4 = new AdvancedSeekerParticle(worldObj, xCoord + 0.5, yCoord + 3.5, zCoord + 0.5, xCoord + rand.nextFloat(), yCoord + 3 + rand.nextFloat(), zCoord + rand.nextFloat(), 1, red, green, blue, 100); + AdvancedSeekerParticle particle4 = new AdvancedSeekerParticle( + worldObj, + xCoord + 0.5, + yCoord + 3.5, + zCoord + 0.5, + xCoord + rand.nextFloat(), + yCoord + 3 + rand.nextFloat(), + zCoord + rand.nextFloat(), + 1, + red, + green, + blue, + 100); particle4.motionX = (rand.nextFloat() - 0.5) * mM; particle4.motionZ = (rand.nextFloat() - 0.5) * mM; ParticleHandler.spawnCustomParticle(particle4, 250); @@ -328,8 +468,10 @@ public class TileEnderResurrection extends TileEntity { */ private boolean isPillarValid(int type, int x, int y, int z) { if (type == 0) { - if (worldObj.getBlock(x, y - 1, z) == Blocks.quartz_block && worldObj.getBlock(x, y - 2, z) == Blocks.quartz_block && worldObj.getBlockMetadata(x, y - 1, z) == 2 && worldObj.getBlockMetadata(x, y - 2, z) == 2) - return true; + if (worldObj.getBlock(x, y - 1, z) == Blocks.quartz_block + && worldObj.getBlock(x, y - 2, z) == Blocks.quartz_block + && worldObj.getBlockMetadata(x, y - 1, z) == 2 + && worldObj.getBlockMetadata(x, y - 2, z) == 2) return true; } else if (type == 1) { if (worldObj.getBlock(x, y - 1, z) == Blocks.quartz_block && worldObj.getBlockMetadata(x, y - 1, z) == 2) return true; @@ -363,7 +505,6 @@ public class TileEnderResurrection extends TileEntity { } } - @Override public Packet getDescriptionPacket() { NBTTagCompound tagCompound = new NBTTagCompound(); @@ -375,5 +516,4 @@ public class TileEnderResurrection extends TileEntity { public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { readFromNBT(pkt.func_148857_g()); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java index 91267c63..fdae07ce 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java @@ -13,6 +13,9 @@ import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -21,17 +24,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - /** * Created by Brandon on 28/07/2014. */ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, IExtendedRFStorage, IDEPeripheral { public boolean active = false; public boolean lastTickActive = false; - public boolean reciveEnergy = false; //Power Flow to system + public boolean reciveEnergy = false; // Power Flow to system public boolean lastTickReciveEnergy = false; public float modelRotation = 0; public float modelScale = 0; @@ -42,7 +41,6 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I private int lastCheckCompOverride = 0; private int tick = 0; - @Override public void updateEntity() { if (active && worldObj.isRemote) { @@ -59,13 +57,20 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I if (tick % 20 == 0) { int cOut = (int) (getEnergyStored() / getMaxEnergyStored() * 15D); if (cOut != lastCheckCompOverride) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord + 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord + 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.notifyBlocksOfNeighborChange( + xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord)); lastCheckCompOverride = cOut; } } @@ -74,7 +79,11 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { TileEntity tile = worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ); if (tile != null && tile instanceof IEnergyReceiver) { - extractEnergy(d, ((IEnergyReceiver) tile).receiveEnergy(d.getOpposite(), extractEnergy(d, Integer.MAX_VALUE, true), false), false); + extractEnergy( + d, + ((IEnergyReceiver) tile) + .receiveEnergy(d.getOpposite(), extractEnergy(d, Integer.MAX_VALUE, true), false), + false); } } } @@ -94,8 +103,9 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I if (coreLocatios.isEmpty()) return null; if (selectedCore >= coreLocatios.size()) selectedCore = coreLocatios.size() - 1; TileLocation core = coreLocatios.get(selectedCore); - if (core == null || !(worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()) instanceof TileEnergyStorageCore)) - return null; + if (core == null + || !(worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()) + instanceof TileEnergyStorageCore)) return null; return (TileEnergyStorageCore) worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()); } @@ -138,7 +148,17 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I int z = getMaster().zCoord; int cYCoord = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? yCoord + 1 : yCoord - 1; - float disMod = getMaster().getTier() == 0 ? 0.5F : getMaster().getTier() == 1 ? 1F : getMaster().getTier() == 2 ? 1F : getMaster().getTier() == 3 ? 2F : getMaster().getTier() == 4 ? 2F : getMaster().getTier() == 5 ? 3F : 4F; + float disMod = getMaster().getTier() == 0 + ? 0.5F + : getMaster().getTier() == 1 + ? 1F + : getMaster().getTier() == 2 + ? 1F + : getMaster().getTier() == 3 + ? 2F + : getMaster().getTier() == 4 + ? 2F + : getMaster().getTier() == 5 ? 3F : 4F; double spawnX; double spawnY; double spawnZ; @@ -154,7 +174,8 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I targetY = cYCoord + 0.5; targetZ = zCoord + 0.5; if (rand.nextFloat() < 0.05F) { - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true); + Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( + worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } if (particleRate > 0) { @@ -163,14 +184,16 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I spawnX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( + worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0) { spawnX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( + worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } @@ -183,7 +206,8 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I spawnY = cYCoord + 0.5; spawnZ = zCoord + 0.5; if (rand.nextFloat() < 0.05F) { - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true); + Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( + worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } @@ -193,14 +217,16 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I targetX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); targetY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); targetZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( + worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0) { targetX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); targetY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); targetZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( + worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } @@ -208,7 +234,8 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I } private boolean isValidStructure() { - return (isGlass(xCoord, yCoord + 1, zCoord) || isGlass(xCoord, yCoord - 1, zCoord)) && (!isGlass(xCoord, yCoord + 1, zCoord) || !isGlass(xCoord, yCoord - 1, zCoord)); + return (isGlass(xCoord, yCoord + 1, zCoord) || isGlass(xCoord, yCoord - 1, zCoord)) + && (!isGlass(xCoord, yCoord + 1, zCoord) || !isGlass(xCoord, yCoord - 1, zCoord)); } private boolean isGlass(int x, int y, int z) { @@ -302,9 +329,17 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I private void detectAndSendChanges() { if (lastTickActive != active) - lastTickActive = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 0, active, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); + lastTickActive = (Boolean) sendObjectToClient( + References.BOOLEAN_ID, + 0, + active, + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); if (lastTickReciveEnergy != reciveEnergy) - lastTickReciveEnergy = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 1, reciveEnergy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); + lastTickReciveEnergy = (Boolean) sendObjectToClient( + References.BOOLEAN_ID, + 1, + reciveEnergy, + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); if (lastTickParticleRate != particleRate) lastTickParticleRate = (Byte) sendObjectToClient(References.BYTE_ID, 2, particleRate); } @@ -352,13 +387,13 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I @Override public String[] getMethodNames() { - return new String[]{"getEnergyStored", "getMaxEnergyStored"}; + return new String[] {"getEnergyStored", "getMaxEnergyStored"}; } @Override public Object[] callMethod(String method, Object... args) { - if (method.equals("getEnergyStored")) return new Object[]{getExtendedStorage()}; - else if (method.equals("getMaxEnergyStored")) return new Object[]{getExtendedCapacity()}; + if (method.equals("getEnergyStored")) return new Object[] {getExtendedStorage()}; + else if (method.equals("getMaxEnergyStored")) return new Object[] {getExtendedCapacity()}; return new Object[0]; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java index b479c673..282823a9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java @@ -37,18 +37,16 @@ public class TileEnergyStorageCore extends TileObjectSync { @Override public void updateEntity() { - //energy = 200000000; + // energy = 200000000; if (!online) return; if (worldObj.isRemote) modelRotation += 0.5; if (!worldObj.isRemote) detectAndRendChanges(); tick++; } - /** * ######################MultiBlock Methods####################### */ - public boolean tryActivate() { if (!findStabalyzers()) return false; if (!setTier(false)) return false; @@ -86,7 +84,9 @@ public class TileEnergyStorageCore extends TileObjectSync { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); if (!online) deactivateStabilizers(); if (update && !online) reIntegrate(); - //if (update && !online && worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) != null && worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) instanceof TileInvisibleMultiblock) ((TileInvisibleMultiblock)worldObj.getTileEntity(xCoord, yCoord + 1, zCoord)).isStructureStillValid(); + // if (update && !online && worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) != null && + // worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) instanceof TileInvisibleMultiblock) + // ((TileInvisibleMultiblock)worldObj.getTileEntity(xCoord, yCoord + 1, zCoord)).isStructureStillValid(); return online; } @@ -96,9 +96,21 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z = zCoord - 1; z <= zCoord + 1; z++) { if (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock) { if (worldObj.getBlockMetadata(x, y, z) == 0) { - worldObj.setBlock(x, y, z, BalanceConfigHandler.energyStorageStructureOuterBlock, BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, 3); + worldObj.setBlock( + x, + y, + z, + BalanceConfigHandler.energyStorageStructureOuterBlock, + BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, + 3); } else if (worldObj.getBlockMetadata(x, y, z) == 1) { - worldObj.setBlock(x, y, z, BalanceConfigHandler.energyStorageStructureBlock, BalanceConfigHandler.energyStorageStructureBlockMetadata, 3); + worldObj.setBlock( + x, + y, + z, + BalanceConfigHandler.energyStorageStructureBlock, + BalanceConfigHandler.energyStorageStructureBlockMetadata, + 3); } } } @@ -119,7 +131,6 @@ public class TileEnergyStorageCore extends TileObjectSync { } else if (x == xCoord + 11) { flag = false; } - } for (int x = xCoord; x >= xCoord - 11; x--) { if (worldObj.getBlock(x, yCoord, zCoord) == ModBlocks.particleGenerator) { @@ -228,12 +239,32 @@ public class TileEnergyStorageCore extends TileObjectSync { if (!testOrActivateRect(1, 1, 1, "air", setBlocks, activate)) return false; break; case 1: - if (!testForOrActivateDraconium(xCoord + 1, yCoord, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord - 1, yCoord, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord + 1, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord - 1, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord, zCoord + 1, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord, zCoord - 1, setBlocks, activate)) - return false; - if (!isReplacable(xCoord + 1, yCoord + 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord + 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord - 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord - 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord - 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord - 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord, zCoord - 1, setBlocks) || !isReplacable(xCoord - 1, yCoord, zCoord + 1, setBlocks)) - return false; - if (!isReplacable(xCoord + 1, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord + 1, zCoord - 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord + 1, yCoord - 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord - 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord - 1, zCoord - 1, setBlocks) || !isReplacable(xCoord - 1, yCoord - 1, zCoord + 1, setBlocks)) - return false; + if (!testForOrActivateDraconium(xCoord + 1, yCoord, zCoord, setBlocks, activate) + || !testForOrActivateDraconium(xCoord - 1, yCoord, zCoord, setBlocks, activate) + || !testForOrActivateDraconium(xCoord, yCoord + 1, zCoord, setBlocks, activate) + || !testForOrActivateDraconium(xCoord, yCoord - 1, zCoord, setBlocks, activate) + || !testForOrActivateDraconium(xCoord, yCoord, zCoord + 1, setBlocks, activate) + || !testForOrActivateDraconium(xCoord, yCoord, zCoord - 1, setBlocks, activate)) return false; + if (!isReplacable(xCoord + 1, yCoord + 1, zCoord, setBlocks) + || !isReplacable(xCoord, yCoord + 1, zCoord + 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord + 1, zCoord, setBlocks) + || !isReplacable(xCoord, yCoord + 1, zCoord - 1, setBlocks) + || !isReplacable(xCoord + 1, yCoord - 1, zCoord, setBlocks) + || !isReplacable(xCoord, yCoord - 1, zCoord + 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord - 1, zCoord, setBlocks) + || !isReplacable(xCoord, yCoord - 1, zCoord - 1, setBlocks) + || !isReplacable(xCoord + 1, yCoord, zCoord + 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord, zCoord - 1, setBlocks) + || !isReplacable(xCoord + 1, yCoord, zCoord - 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord, zCoord + 1, setBlocks)) return false; + if (!isReplacable(xCoord + 1, yCoord + 1, zCoord + 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord + 1, zCoord - 1, setBlocks) + || !isReplacable(xCoord + 1, yCoord + 1, zCoord - 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord + 1, zCoord + 1, setBlocks) + || !isReplacable(xCoord + 1, yCoord - 1, zCoord + 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord - 1, zCoord - 1, setBlocks) + || !isReplacable(xCoord + 1, yCoord - 1, zCoord - 1, setBlocks) + || !isReplacable(xCoord - 1, yCoord - 1, zCoord + 1, setBlocks)) return false; break; case 2: if (!testOrActivateRect(1, 1, 1, "draconiumBlock", setBlocks, activate)) return false; @@ -276,11 +307,11 @@ public class TileEnergyStorageCore extends TileObjectSync { if (block.equals("air")) { if (!(x == xCoord && y == yCoord && z == zCoord) && !isReplacable(x, y, z, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(x, y, z, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateRedstone(x, y, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && y == yCoord && z == zCoord) && !testForOrActivateDraconium(x, y, z, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateDraconium(x, y, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -297,14 +328,14 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord + dist, y, z, set)) - return false; + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) + && !isReplacable(xCoord + dist, y, z, set)) return false; } else if (block.equals("redstone")) { - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) - return false; + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) - return false; + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -317,14 +348,14 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord - dist, y, z, set)) - return false; + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) + && !isReplacable(xCoord - dist, y, z, set)) return false; } else if (block.equals("redstone")) { - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) - return false; + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) - return false; + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -338,14 +369,14 @@ public class TileEnergyStorageCore extends TileObjectSync { if (x == xCoord - size || x == xCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !isReplacable(x, yCoord + dist, z, set)) - return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) + && !isReplacable(x, yCoord + dist, z, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) + && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) + && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -358,14 +389,14 @@ public class TileEnergyStorageCore extends TileObjectSync { if (x == xCoord - size || x == xCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !isReplacable(x, yCoord - dist, z, set)) - return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) + && !isReplacable(x, yCoord - dist, z, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) + && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) + && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -379,14 +410,14 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || x == xCoord - size || x == xCoord + size) { if (block.equals("air")) { - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !isReplacable(x, y, zCoord + dist, set)) - return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) + && !isReplacable(x, y, zCoord + dist, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) + && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) + && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -399,14 +430,14 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || x == xCoord - size || x == xCoord + size) { if (block.equals("air")) { - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !isReplacable(x, y, zCoord - dist, set)) - return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) + && !isReplacable(x, y, zCoord - dist, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) + && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) + && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -423,14 +454,14 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z = zCoord - 1; z <= zCoord + 1; z++) { if (block.equals("air")) { - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord + dist, y, z, set)) - return false; + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) + && !isReplacable(xCoord + dist, y, z, set)) return false; } else if (block.equals("redstone")) { - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) - return false; + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) - return false; + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -441,14 +472,14 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z = zCoord - 1; z <= zCoord + 1; z++) { if (block.equals("air")) { - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord - dist, y, z, set)) - return false; + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) + && !isReplacable(xCoord - dist, y, z, set)) return false; } else if (block.equals("redstone")) { - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) - return false; + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) - return false; + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) + && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -460,14 +491,14 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z = zCoord - 1; z <= zCoord + 1; z++) { if (block.equals("air")) { - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !isReplacable(x, yCoord + dist, z, set)) - return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) + && !isReplacable(x, yCoord + dist, z, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) + && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) + && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -478,14 +509,14 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z = zCoord - 1; z <= zCoord + 1; z++) { if (block.equals("air")) { - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !isReplacable(x, yCoord - dist, z, set)) - return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) + && !isReplacable(x, yCoord - dist, z, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) + && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) - return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) + && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -497,14 +528,14 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int x = xCoord - 1; x <= xCoord + 1; x++) { if (block.equals("air")) { - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !isReplacable(x, y, zCoord + dist, set)) - return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) + && !isReplacable(x, y, zCoord + dist, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) + && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) + && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -515,14 +546,14 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int x = xCoord - 1; x <= xCoord + 1; x++) { if (block.equals("air")) { - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !isReplacable(x, y, zCoord - dist, set)) - return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) + && !isReplacable(x, y, zCoord - dist, set)) return false; } else if (block.equals("redstone")) { - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) + && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) return false; } else if (block.equals("draconiumBlock")) { - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) - return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) + && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -536,11 +567,20 @@ public class TileEnergyStorageCore extends TileObjectSync { private boolean testForOrActivateDraconium(int x, int y, int z, boolean set, boolean activate) { if (!activate) { if (set) { - worldObj.setBlock(x, y, z, BalanceConfigHandler.energyStorageStructureOuterBlock, BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, 3); + worldObj.setBlock( + x, + y, + z, + BalanceConfigHandler.energyStorageStructureOuterBlock, + BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, + 3); return true; } else - return (worldObj.getBlock(x, y, z) == BalanceConfigHandler.energyStorageStructureOuterBlock && worldObj.getBlockMetadata(x, y, z) == BalanceConfigHandler.energyStorageStructureOuterBlockMetadata) || - (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock && worldObj.getBlockMetadata(x, y, z) == 0); + return (worldObj.getBlock(x, y, z) == BalanceConfigHandler.energyStorageStructureOuterBlock + && worldObj.getBlockMetadata(x, y, z) + == BalanceConfigHandler.energyStorageStructureOuterBlockMetadata) + || (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock + && worldObj.getBlockMetadata(x, y, z) == 0); } else { return activateDraconium(x, y, z); } @@ -549,11 +589,20 @@ public class TileEnergyStorageCore extends TileObjectSync { private boolean testForOrActivateRedstone(int x, int y, int z, boolean set, boolean activate) { if (!activate) { if (set) { - worldObj.setBlock(x, y, z, BalanceConfigHandler.energyStorageStructureBlock, BalanceConfigHandler.energyStorageStructureBlockMetadata, 3); + worldObj.setBlock( + x, + y, + z, + BalanceConfigHandler.energyStorageStructureBlock, + BalanceConfigHandler.energyStorageStructureBlockMetadata, + 3); return true; } else { - return (worldObj.getBlock(x, y, z) == BalanceConfigHandler.energyStorageStructureBlock && worldObj.getBlockMetadata(x, y, z) == BalanceConfigHandler.energyStorageStructureBlockMetadata) || - (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock && worldObj.getBlockMetadata(x, y, z) == 1); + return (worldObj.getBlock(x, y, z) == BalanceConfigHandler.energyStorageStructureBlock + && worldObj.getBlockMetadata(x, y, z) + == BalanceConfigHandler.energyStorageStructureBlockMetadata) + || (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock + && worldObj.getBlockMetadata(x, y, z) == 1); } } else { return activateRedstone(x, y, z); @@ -563,7 +612,10 @@ public class TileEnergyStorageCore extends TileObjectSync { private boolean activateDraconium(int x, int y, int z) { if (testForOrActivateDraconium(x, y, z, false, false)) { worldObj.setBlock(x, y, z, ModBlocks.invisibleMultiblock, 0, 2); - TileInvisibleMultiblock tile = (worldObj.getTileEntity(x, y, z) != null && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) : null; + TileInvisibleMultiblock tile = (worldObj.getTileEntity(x, y, z) != null + && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) + : null; if (tile != null) { tile.master = new TileLocation(xCoord, yCoord, zCoord); } @@ -576,7 +628,10 @@ public class TileEnergyStorageCore extends TileObjectSync { private boolean activateRedstone(int x, int y, int z) { if (testForOrActivateRedstone(x, y, z, false, false)) { worldObj.setBlock(x, y, z, ModBlocks.invisibleMultiblock, 1, 2); - TileInvisibleMultiblock tile = (worldObj.getTileEntity(x, y, z) != null && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) : null; + TileInvisibleMultiblock tile = (worldObj.getTileEntity(x, y, z) != null + && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) + : null; if (tile != null) { tile.master = new TileLocation(xCoord, yCoord, zCoord); } @@ -603,14 +658,27 @@ public class TileEnergyStorageCore extends TileObjectSync { LogHelper.error("activateStabilizers stabalizers[" + i + "] == null!!!"); return; } - TileParticleGenerator tile = (worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) != null && worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) instanceof TileParticleGenerator) ? (TileParticleGenerator) worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) : null; + TileParticleGenerator tile = (worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( + stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Particle Generator)"); return; } tile.stabalizerMode = true; tile.setMaster(new TileLocation(xCoord, yCoord, zCoord)); - worldObj.setBlockMetadataWithNotify(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord(), 1, 2); + worldObj.setBlockMetadataWithNotify( + stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord(), 1, 2); } initializeCapacity(); } @@ -649,12 +717,25 @@ public class TileEnergyStorageCore extends TileObjectSync { if (stabilizers[i] == null) { LogHelper.error("activateStabilizers stabalizers[" + i + "] == null!!!"); } else { - TileParticleGenerator tile = (worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) != null && worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) instanceof TileParticleGenerator) ? (TileParticleGenerator) worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) : null; + TileParticleGenerator tile = (worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( + stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + : null; if (tile == null) { - //LogHelper.error("Missing Tile Entity (Particle Generator)"); + // LogHelper.error("Missing Tile Entity (Particle Generator)"); } else { tile.stabalizerMode = false; - worldObj.setBlockMetadataWithNotify(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord(), 0, 2); + worldObj.setBlockMetadataWithNotify( + stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord(), 0, 2); } } } @@ -666,13 +747,27 @@ public class TileEnergyStorageCore extends TileObjectSync { LogHelper.error("activateStabilizers stabalizers[" + i + "] == null!!!"); return false; } - TileParticleGenerator tile = (worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) != null && worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) instanceof TileParticleGenerator) ? (TileParticleGenerator) worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) : null; + TileParticleGenerator tile = (worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( + stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + : null; if (tile == null) { - //LogHelper.error("Missing Tile Entity (Particle Generator)"); + // LogHelper.error("Missing Tile Entity (Particle Generator)"); return false; } - if (!tile.stabalizerMode || worldObj.getBlockMetadata(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) != 1) - return false; + if (!tile.stabalizerMode + || worldObj.getBlockMetadata( + stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + != 1) return false; } return true; } @@ -680,10 +775,23 @@ public class TileEnergyStorageCore extends TileObjectSync { private boolean checkStabilizers() { for (int i = 0; i < stabilizers.length; i++) { if (stabilizers[i] == null) return false; - TileParticleGenerator gen = (worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) != null && worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) instanceof TileParticleGenerator) ? (TileParticleGenerator) worldObj.getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) : null; + TileParticleGenerator gen = (worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) + instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( + stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + : null; if (gen == null || !gen.stabalizerMode) return false; - if (gen.getMaster().xCoord != xCoord || gen.getMaster().yCoord != yCoord || gen.getMaster().zCoord != zCoord) - return false; + if (gen.getMaster().xCoord != xCoord + || gen.getMaster().yCoord != yCoord + || gen.getMaster().zCoord != zCoord) return false; } return true; } @@ -695,8 +803,6 @@ public class TileEnergyStorageCore extends TileObjectSync { /** * ############################################################### */ - - @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); @@ -733,7 +839,7 @@ public class TileEnergyStorageCore extends TileObjectSync { readFromNBT(pkt.func_148857_g()); } - /* EnergyHandler */ + /* EnergyHandler */ public int receiveEnergy(int maxReceive, boolean simulate) { long energyReceived = Math.min(capacity - energy, maxReceive); @@ -773,7 +879,11 @@ public class TileEnergyStorageCore extends TileObjectSync { private void detectAndRendChanges() { if (lastTickCapacity != energy) - lastTickCapacity = (Long) sendObjectToClient(References.LONG_ID, 0, energy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20)); + lastTickCapacity = (Long) sendObjectToClient( + References.LONG_ID, + 0, + energy, + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java index 95fa197a..346cc119 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java @@ -21,7 +21,13 @@ public class TileInvisibleMultiblock extends TileEntity { } public boolean isMasterOnline() { - TileEnergyStorageCore tile = (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) : null; + TileEnergyStorageCore tile = + (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null + && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) + worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + : null; if (tile == null) { return false; } @@ -30,21 +36,27 @@ public class TileInvisibleMultiblock extends TileEntity { public TileEnergyStorageCore getMaster() { if (master == null) return null; - TileEnergyStorageCore tile = (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) : null; + TileEnergyStorageCore tile = + (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null + && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) + worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + : null; return tile; } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); - //if (master != null) + // if (master != null) master.writeToNBT(compound, "Key"); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); - //if (master != null) + // if (master != null) master.readFromNBT(compound, "Key"); } @@ -72,10 +84,21 @@ public class TileInvisibleMultiblock extends TileEntity { private void revert() { int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); if (meta == 0) { - worldObj.setBlock(xCoord, yCoord, zCoord, BalanceConfigHandler.energyStorageStructureOuterBlock, BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, 3); - } - else if (meta == 1) { - worldObj.setBlock(xCoord, yCoord, zCoord, BalanceConfigHandler.energyStorageStructureBlock, BalanceConfigHandler.energyStorageStructureBlockMetadata, 3); + worldObj.setBlock( + xCoord, + yCoord, + zCoord, + BalanceConfigHandler.energyStorageStructureOuterBlock, + BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, + 3); + } else if (meta == 1) { + worldObj.setBlock( + xCoord, + yCoord, + zCoord, + BalanceConfigHandler.energyStorageStructureBlock, + BalanceConfigHandler.energyStorageStructureBlockMetadata, + 3); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java index abbd7875..034a17e1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java @@ -28,7 +28,13 @@ public class TilePortalBlock extends TileEntity { @SideOnly(Side.CLIENT) public void updateEntity() { if (!worldObj.isRemote) return; - double distanceMod = Utills.getDistanceAtoB(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, RenderManager.renderPosX, RenderManager.renderPosY, RenderManager.renderPosZ); + double distanceMod = Utills.getDistanceAtoB( + xCoord + 0.5, + yCoord + 0.5, + zCoord + 0.5, + RenderManager.renderPosX, + RenderManager.renderPosY, + RenderManager.renderPosZ); if (worldObj.rand.nextInt(Math.max((int) (distanceMod * (distanceMod / 5D)), 1)) == 0) { if (blockMetadata == -1) blockMetadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); @@ -37,24 +43,79 @@ public class TilePortalBlock extends TileEntity { double rO1 = -0.1 + worldObj.rand.nextDouble() * 0.2; double rO2 = -0.1 + worldObj.rand.nextDouble() * 0.2; - if (blockMetadata == 1 && RenderManager.renderPosZ < zCoord + 0.5) - DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord + rD2, zCoord, xCoord + rD1 + rO1, yCoord + rD2 + rO2, zCoord + 0.75), 256); + DraconicEvolution.proxy.spawnParticle( + new Particles.PortalParticle( + worldObj, + xCoord + rD1, + yCoord + rD2, + zCoord, + xCoord + rD1 + rO1, + yCoord + rD2 + rO2, + zCoord + 0.75), + 256); else if (blockMetadata == 1 && RenderManager.renderPosZ > zCoord + 0.5) - DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord + rD2, zCoord + 1, xCoord + rD1 + rO1, yCoord + rD2 + rO2, zCoord + 0.25), 256); + DraconicEvolution.proxy.spawnParticle( + new Particles.PortalParticle( + worldObj, + xCoord + rD1, + yCoord + rD2, + zCoord + 1, + xCoord + rD1 + rO1, + yCoord + rD2 + rO2, + zCoord + 0.25), + 256); else if (blockMetadata == 2 && RenderManager.renderPosX < xCoord + 0.5) - DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord, yCoord + rD1, zCoord + rD2, xCoord + 0.75, yCoord + rD1 + rO1, zCoord + rD2 + rO2), 256); + DraconicEvolution.proxy.spawnParticle( + new Particles.PortalParticle( + worldObj, + xCoord, + yCoord + rD1, + zCoord + rD2, + xCoord + 0.75, + yCoord + rD1 + rO1, + zCoord + rD2 + rO2), + 256); else if (blockMetadata == 2 && RenderManager.renderPosX > xCoord + 0.5) - DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + 1, yCoord + rD1, zCoord + rD2, xCoord + 0.25, yCoord + rD1 + rO1, zCoord + rD2 + rO2), 256); + DraconicEvolution.proxy.spawnParticle( + new Particles.PortalParticle( + worldObj, + xCoord + 1, + yCoord + rD1, + zCoord + rD2, + xCoord + 0.25, + yCoord + rD1 + rO1, + zCoord + rD2 + rO2), + 256); else if (blockMetadata == 3 && RenderManager.renderPosY > yCoord + 0.5) - DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord + 1, zCoord + rD2, xCoord + rD1 + rO1, yCoord + 0.25, zCoord + rD2 + rO2), 256); + DraconicEvolution.proxy.spawnParticle( + new Particles.PortalParticle( + worldObj, + xCoord + rD1, + yCoord + 1, + zCoord + rD2, + xCoord + rD1 + rO1, + yCoord + 0.25, + zCoord + rD2 + rO2), + 256); else if (blockMetadata == 3 && RenderManager.renderPosY < yCoord + 0.5) - DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord, zCoord + rD2, xCoord + rD1 + rO1, yCoord + 0.75, zCoord + rD2 + rO2), 256); + DraconicEvolution.proxy.spawnParticle( + new Particles.PortalParticle( + worldObj, + xCoord + rD1, + yCoord, + zCoord + rD2, + xCoord + rD1 + rO1, + yCoord + 0.75, + zCoord + rD2 + rO2), + 256); } } public TileDislocatorReceptacle getMaster() { - return worldObj.getTileEntity(masterX, masterY, masterZ) instanceof TileDislocatorReceptacle ? (TileDislocatorReceptacle) worldObj.getTileEntity(masterX, masterY, masterZ) : null; + return worldObj.getTileEntity(masterX, masterY, masterZ) instanceof TileDislocatorReceptacle + ? (TileDislocatorReceptacle) worldObj.getTileEntity(masterX, masterY, masterZ) + : null; } public boolean isPortalStillValid() { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java index f4626aef..f07ad318 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java @@ -3,17 +3,20 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.re import com.brandon3055.brandonscore.common.handlers.IProcess; import com.brandon3055.brandonscore.common.handlers.ProcessHandler; import com.brandon3055.brandonscore.common.utills.Utills; +import java.util.Random; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import java.util.Random; - /** * Created by brandon3055 on 12/8/2015. */ public class ReactorExplosion implements IProcess { - public static DamageSource fusionExplosion = new DamageSource("damage.de.fusionExplode").setExplosion().setDamageBypassesArmor().setDamageIsAbsolute().setDamageAllowedInCreativeMode(); + public static DamageSource fusionExplosion = new DamageSource("damage.de.fusionExplode") + .setExplosion() + .setDamageBypassesArmor() + .setDamageIsAbsolute() + .setDamageAllowedInCreativeMode(); private World worldObj; private int xCoord; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java index f82d8c1e..b9a7e40e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java @@ -1,6 +1,8 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor; import com.brandon3055.brandonscore.common.handlers.IProcess; +import java.util.List; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.entity.Entity; @@ -8,9 +10,6 @@ import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import java.util.List; -import java.util.Random; - /** * Created by brandon3055 on 12/8/2015. */ @@ -40,7 +39,8 @@ public class ReactorExplosionTrace implements IProcess { for (int y = yCoord; y > 0 && energy > 0; y--) { Block block = worldObj.getBlock(xCoord, y, zCoord); - List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + List entities = worldObj.getEntitiesWithinAABB( + Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100); energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); @@ -56,7 +56,7 @@ public class ReactorExplosionTrace implements IProcess { if (random.nextInt(3) > 0) worldObj.setBlock(xCoord, y, zCoord, Blocks.fire); else { worldObj.setBlock(xCoord, y, zCoord, Blocks.flowing_lava); - //worldObj.scheduleBlockUpdate(xCoord, y, zCoord, Blocks.flowing_lava, 100); + // worldObj.scheduleBlockUpdate(xCoord, y, zCoord, Blocks.flowing_lava, 100); } } } @@ -66,7 +66,8 @@ public class ReactorExplosionTrace implements IProcess { for (int y = yCoord; y < 255 && energy > 0; y++) { Block block = worldObj.getBlock(xCoord, y, zCoord); - List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + List entities = worldObj.getEntitiesWithinAABB( + Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100); energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); @@ -75,7 +76,6 @@ public class ReactorExplosionTrace implements IProcess { energy -= 0.5F + (0.1F * (y - yCoord)); } - isDead = true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java index 1246f472..f200039f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java @@ -16,6 +16,9 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.NetworkRegistry; 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 net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -25,10 +28,6 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - /** * Created by Brandon on 16/6/2015. */ @@ -48,10 +47,12 @@ public class TileReactorCore extends TileObjectSync { private boolean startupInitialized = false; public int tick = 0; - //Key operational figures + // Key operational figures public int reactorFuel = 0; - public int convertedFuel = 0; //The amount of fuel that has converted - public double conversionUnit = 0; //used to smooth out the conversion between int and floating point. When >= 1 minus one and convert one int worth of fuel + public int convertedFuel = 0; // The amount of fuel that has converted + public double conversionUnit = + 0; // used to smooth out the conversion between int and floating point. When >= 1 minus one and convert one + // int worth of fuel public double reactionTemperature = 20; public double maxReactTemperature = 10000; @@ -65,23 +66,22 @@ public class TileReactorCore extends TileObjectSync { @SideOnly(Side.CLIENT) private ReactorSound reactorSound; - //####################### - - //TODO DONT FORGET TO ACTUALLY FINISH ALL THESE THINGS!!!! -//Check //-Bounding box -//Check //-Custom player collision -//Check //-Finish stabilizer place and break mechanics -//Check //-Have the GUI tell you if the structure is invalid -//Check //-Config - //TODO things for later - //-GUI info (maby speed up gui sync via the container) - //-GUI warning red bars - //-Maby get around to setting the angle of the stabiliser elements -//Check //-SOUND!!!!! -//Check //-CC Integration -//Check //-Redstone - //-Add reactor and gates to tablet + // ####################### + // TODO DONT FORGET TO ACTUALLY FINISH ALL THESE THINGS!!!! + // Check //-Bounding box + // Check //-Custom player collision + // Check //-Finish stabilizer place and break mechanics + // Check //-Have the GUI tell you if the structure is invalid + // Check //-Config + // TODO things for later + // -GUI info (maby speed up gui sync via the container) + // -GUI warning red bars + // -Maby get around to setting the angle of the stabiliser elements + // Check //-SOUND!!!!! + // Check //-CC Integration + // Check //-Redstone + // -Add reactor and gates to tablet public List stabilizerLocations = new ArrayList(); @@ -94,12 +94,11 @@ public class TileReactorCore extends TileObjectSync { renderSpeed = (float) Math.min((reactionTemperature - 20) / 2000D, 1D); stabilizerRender = (float) Math.min(fieldCharge / (maxFieldCharge * 0.1D), 1D); renderRotation += renderSpeed; - //LogHelper.info(renderSpeed +" "+(reactionTemperature)); + // LogHelper.info(renderSpeed +" "+(reactionTemperature)); checkPlayerCollision(); return; } - //else injectEnergy(10000000); - + // else injectEnergy(10000000); switch (reactorState) { case STATE_OFFLINE: @@ -127,7 +126,8 @@ public class TileReactorCore extends TileObjectSync { private void checkPlayerCollision() { EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); - double distance = Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); + double distance = + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); if (distance < (getCoreDiameter() / 2) + 0.5) { double dMod = 1D - (distance / Math.max(0.1, (getCoreDiameter() / 2) + 0.5)); double offsetX = player.posX - xCoord + 0.5; @@ -157,7 +157,6 @@ public class TileReactorCore extends TileObjectSync { } } - private boolean hasExploded = false; public double tempDrainFactor; @@ -167,20 +166,25 @@ public class TileReactorCore extends TileObjectSync { public double fuelUseRate; private void runTick() { - //Inverted core saturation (if multiplied by 100 this creates infinite numbers which breaks the code) + // Inverted core saturation (if multiplied by 100 this creates infinite numbers which breaks the code) double saturation = ((double) energySaturation / (double) maxEnergySaturation); double saturationI = (1D - ((double) energySaturation / (double) maxEnergySaturation)) * 99D; double temp = ((reactionTemperature) / maxReactTemperature) * 50D; - //The conversion level. Ranges from -0.3 to 1.0 - double conversion = (((double) convertedFuel + conversionUnit) / ((double) (convertedFuel + reactorFuel) - conversionUnit) * 1.3) - 0.3D; + // The conversion level. Ranges from -0.3 to 1.0 + double conversion = (((double) convertedFuel + conversionUnit) + / ((double) (convertedFuel + reactorFuel) - conversionUnit) + * 1.3) + - 0.3D; - //Temperature Calculation - double tempOffset = 444.7; //Adjusts where the temp falls to at 100% saturation - //The exponential temperature rise which increases as the core saturation goes down + // Temperature Calculation + double tempOffset = 444.7; // Adjusts where the temp falls to at 100% saturation + // The exponential temperature rise which increases as the core saturation goes down double tempRiseExpo = (saturationI * saturationI * saturationI) / (100 - saturationI) + tempOffset; - //This is used to add resistance as the temp rises because the hotter something gets the more energy it takes to get it hotter + // This is used to add resistance as the temp rises because the hotter something gets the more energy it takes + // to get it hotter double tempRiseResist = (temp * temp * temp * temp) / (100 - temp); - //This puts all the numbers together and gets the value to raise or lower the temp by this tick. This is dealing with very big numbers so the result is divided by 10000 + // This puts all the numbers together and gets the value to raise or lower the temp by this tick. This is + // dealing with very big numbers so the result is divided by 10000 double riseAmount = (tempRiseExpo - (tempRiseResist * (1D - conversion)) + conversion * 1000) / 10000; if (reactorState == STATE_STOP) { if (reactionTemperature <= 2001) { @@ -193,38 +197,44 @@ public class TileReactorCore extends TileObjectSync { else reactionTemperature += riseAmount * 10; } else reactionTemperature += riseAmount * 10; + // ====================== - //====================== - - //Energy Calculation + // Energy Calculation int baseMaxRFt = (int) ((maxEnergySaturation / 1000D) * ConfigHandler.reactorOutputMultiplier * 1.5D); int maxRFt = (int) (baseMaxRFt * (1D + (conversion * 2))); generationRate = (1D - saturation) * maxRFt; energySaturation += generationRate; - //LogHelper.info((1D - saturation) * maxRFt); - //====================== + // LogHelper.info((1D - saturation) * maxRFt); + // ====================== - //When temp < 1000 power drain is 0, when temp > 2000 power drain is 1, when temp > 8000 power drain increases exponentially - tempDrainFactor = reactionTemperature > 8000 ? 1 + ((reactionTemperature - 8000) * (reactionTemperature - 8000) * 0.0000025) : reactionTemperature > 2000 ? 1 : reactionTemperature > 1000 ? (reactionTemperature - 1000) / 1000 : 0; - //todo add to guiInfo - //-temp drain factor - //-mass - //-generation - //-field drain + // When temp < 1000 power drain is 0, when temp > 2000 power drain is 1, when temp > 8000 power drain increases + // exponentially + tempDrainFactor = reactionTemperature > 8000 + ? 1 + ((reactionTemperature - 8000) * (reactionTemperature - 8000) * 0.0000025) + : reactionTemperature > 2000 ? 1 : reactionTemperature > 1000 ? (reactionTemperature - 1000) / 1000 : 0; + // todo add to guiInfo + // -temp drain factor + // -mass + // -generation + // -field drain - //Field Drain Calculation - fieldDrain = (int) Math.min(tempDrainFactor * (1D - saturation) * (baseMaxRFt / 10.923556), (double) Integer.MAX_VALUE); //<(baseMaxRFt/make smaller to increase field power drain) + // Field Drain Calculation + fieldDrain = (int) Math.min(tempDrainFactor * (1D - saturation) * (baseMaxRFt / 10.923556), (double) + Integer.MAX_VALUE); // <(baseMaxRFt/make smaller to increase field power drain) double fieldNegPercent = 1D - (fieldCharge / maxFieldCharge); fieldInputRate = fieldDrain / fieldNegPercent; -// LogHelper.info(fieldDrain+" "+tempDrainFactor+" "+(1D-saturation)+" "+tempDrainFactor * (1D-saturation) * (baseMaxRFt/10.923556)); + // LogHelper.info(fieldDrain+" "+tempDrainFactor+" "+(1D-saturation)+" "+tempDrainFactor * (1D-saturation) * + // (baseMaxRFt/10.923556)); fieldCharge -= fieldDrain; - //====================== + // ====================== - //Calculate Fuel Usage - fuelUseRate = tempDrainFactor * (1D - saturation) * (0.001 * ConfigHandler.reactorFuelUsageMultiplier); //= 1 && reactorFuel > 0) { conversionUnit--; @@ -232,50 +242,58 @@ public class TileReactorCore extends TileObjectSync { convertedFuel++; } - //==================== + // ==================== - //Make BOOM!!! + // Make BOOM!!! if ((fieldCharge <= 0) && !hasExploded) { hasExploded = true; goBoom(); } - //=========== + // =========== } private void goBoom() { if (!ConfigHandler.enableReactorBigBoom) { worldObj.createExplosion(null, xCoord, yCoord, zCoord, 5, true); } else { - //float power = 10F + Math.min(10F, ((float) (convertedFuel + reactorFuel) / 10369F) * 10F); + // float power = 10F + Math.min(10F, ((float) (convertedFuel + reactorFuel) / 10369F) * 10F); float power = 2F + (((float) (convertedFuel + reactorFuel) / 10369F) * 18F); ProcessHandler.addProcess(new ReactorExplosion(worldObj, xCoord, yCoord, zCoord, power)); - sendObjectToClient(References.INT_ID, 100, (int) (power * 10F), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 512)); + sendObjectToClient( + References.INT_ID, + 100, + (int) (power * 10F), + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 512)); } worldObj.setBlockToAir(xCoord, yCoord, zCoord); } - public void validateStructure() { boolean updateRequired = false; - //Check that all of the stabilizers are still valid + // Check that all of the stabilizers are still valid Iterator i = stabilizerLocations.iterator(); List stabilizers = new ArrayList(); while (i.hasNext()) { TileLocation location = i.next(); - if (!(location.getTileEntity(worldObj) instanceof TileReactorStabilizer) || !((TileReactorStabilizer) location.getTileEntity(worldObj)).masterLocation.isThisLocation(xCoord, yCoord, zCoord)) { + if (!(location.getTileEntity(worldObj) instanceof TileReactorStabilizer) + || !((TileReactorStabilizer) location.getTileEntity(worldObj)) + .masterLocation.isThisLocation(xCoord, yCoord, zCoord)) { i.remove(); updateRequired = true; } else stabilizers.add((TileReactorStabilizer) location.getTileEntity(worldObj)); } - //Check that there are 4 stabilizers in the correct configuration + // Check that there are 4 stabilizers in the correct configuration isStructureValid = false; List checkList = new ArrayList(); for (TileReactorStabilizer stabilizer : stabilizers) { if (checkList.contains(stabilizer)) continue; for (TileReactorStabilizer comp : stabilizers) { - if (!(comp == stabilizer || checkList.contains(comp)) && ForgeDirection.getOrientation(comp.facingDirection) == ForgeDirection.getOrientation(stabilizer.facingDirection).getOpposite()) { + if (!(comp == stabilizer || checkList.contains(comp)) + && ForgeDirection.getOrientation(comp.facingDirection) + == ForgeDirection.getOrientation(stabilizer.facingDirection) + .getOpposite()) { checkList.add(comp); checkList.add(stabilizer); if (checkList.size() == 4) { @@ -288,13 +306,13 @@ public class TileReactorCore extends TileObjectSync { } for (TileReactorStabilizer stabilizer : stabilizers) { - if (Utills.getDistanceAtoB(stabilizer.xCoord, stabilizer.yCoord, stabilizer.zCoord, xCoord, yCoord, zCoord) < (getMaxCoreDiameter() / 2) + 1) { + if (Utills.getDistanceAtoB(stabilizer.xCoord, stabilizer.yCoord, stabilizer.zCoord, xCoord, yCoord, zCoord) + < (getMaxCoreDiameter() / 2) + 1) { isStructureValid = false; break; } } - if (!isStructureValid) { reactorState = STATE_INVALID; if (reactionTemperature >= 2000) { @@ -309,9 +327,11 @@ public class TileReactorCore extends TileObjectSync { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { boolean flag = false; for (int i = 1; i < MAX_SLAVE_RANGE && !flag; i++) { - TileLocation location = new TileLocation(xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); + TileLocation location = new TileLocation( + xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); if (location.getTileEntity(worldObj) != null) { - if (location.getTileEntity(worldObj) instanceof IReactorPart && !((IReactorPart) location.getTileEntity(worldObj)).getMaster().initialized) + if (location.getTileEntity(worldObj) instanceof IReactorPart + && !((IReactorPart) location.getTileEntity(worldObj)).getMaster().initialized) ((IReactorPart) location.getTileEntity(worldObj)).checkForMaster(); flag = true; } @@ -323,16 +343,19 @@ public class TileReactorCore extends TileObjectSync { public void onBroken() { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { for (int i = 1; i < MAX_SLAVE_RANGE; i++) { - TileLocation location = new TileLocation(xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); - if (location.getTileEntity(worldObj) instanceof IReactorPart && ((IReactorPart) location.getTileEntity(worldObj)).getMaster().compareTo(new TileLocation(xCoord, yCoord, zCoord)) == 0) - ((IReactorPart) location.getTileEntity(worldObj)).shutDown(); + TileLocation location = new TileLocation( + xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); + if (location.getTileEntity(worldObj) instanceof IReactorPart + && ((IReactorPart) location.getTileEntity(worldObj)) + .getMaster() + .compareTo(new TileLocation(xCoord, yCoord, zCoord)) + == 0) ((IReactorPart) location.getTileEntity(worldObj)).shutDown(); } } if (reactionTemperature >= 2000) { goBoom(); } - } public boolean onStructureRightClicked(EntityPlayer player) { @@ -367,7 +390,11 @@ public class TileReactorCore extends TileObjectSync { public boolean canStart() { validateStructure(); - return reactionTemperature >= 2000 && fieldCharge >= (maxFieldCharge / 2) && energySaturation >= (maxEnergySaturation / 2) && isStructureValid && convertedFuel + reactorFuel + conversionUnit >= 144; + return reactionTemperature >= 2000 + && fieldCharge >= (maxFieldCharge / 2) + && energySaturation >= (maxEnergySaturation / 2) + && isStructureValid + && convertedFuel + reactorFuel + conversionUnit >= 144; } public boolean canCharge() { @@ -380,28 +407,26 @@ public class TileReactorCore extends TileObjectSync { return reactorState != STATE_OFFLINE && isStructureValid; } - public void processButtonPress(int button) { if (button == 0 && canCharge()) reactorState = STATE_START; else if (button == 1 && canStart()) reactorState = STATE_ONLINE; else if (button == 2 && canStop()) reactorState = STATE_STOP; } - public double getCoreDiameter() {//todo adjust so the core dose not expand before 1000>2000c - //return (((1F + Math.sin((float)tick/50F)) / 2F) * 4) + 0.3; + public double getCoreDiameter() { // todo adjust so the core dose not expand before 1000>2000c + // return (((1F + Math.sin((float)tick/50F)) / 2F) * 4) + 0.3; double volume = (double) (reactorFuel + convertedFuel) / 1296D; volume *= 1 + (reactionTemperature / maxReactTemperature) * 10D; return Math.cbrt(volume / (4 / 3 * Math.PI)) * 2; } public double getMaxCoreDiameter() { - //return (((1F + Math.sin((float)tick/50F)) / 2F) * 4) + 0.3; + // return (((1F + Math.sin((float)tick/50F)) / 2F) * 4) + 0.3; double volume = (double) (reactorFuel + convertedFuel) / 1296D; volume *= 1 + 1 * 10D; return Math.cbrt(volume / (4 / 3 * Math.PI)) * 2; } - private boolean isStructureValidCach = false; private boolean startupInitializedCach = false; private int reactorStateCach = -1; @@ -415,13 +440,15 @@ public class TileReactorCore extends TileObjectSync { private double maxFieldChargeCach = -1; private void detectAndSendChanges() { - NetworkRegistry.TargetPoint tp = new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 128); + NetworkRegistry.TargetPoint tp = + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 128); if (reactionTemperatureCach != reactionTemperature) reactionTemperatureCach = (Double) sendObjectToClient(References.DOUBLE_ID, 8, reactionTemperature, tp); if (tick % 10 != 0) return; if (isStructureValidCach != isStructureValid) isStructureValidCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 0, isStructureValid, tp); - //if (isActiveCach != isActive) isActiveCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 1, isActive, tp); + // if (isActiveCach != isActive) isActiveCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, + // 1, isActive, tp); if (startupInitializedCach != startupInitialized) startupInitializedCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 2, startupInitialized, tp); if (reactorStateCach != reactorState) @@ -490,7 +517,7 @@ public class TileReactorCore extends TileObjectSync { case 0: isStructureValid = (Boolean) object; break; - //case 1: isActive = (Boolean) object; break; + // case 1: isActive = (Boolean) object; break; case 2: startupInitialized = (Boolean) object; break; @@ -522,7 +549,11 @@ public class TileReactorCore extends TileObjectSync { maxFieldCharge = (Double) object; break; case 100: - FMLClientHandler.instance().getClient().effectRenderer.addEffect(new Particles.ReactorExplosionParticle(worldObj, xCoord, yCoord, zCoord, (Integer) object)); + FMLClientHandler.instance() + .getClient() + .effectRenderer + .addEffect(new Particles.ReactorExplosionParticle( + worldObj, xCoord, yCoord, zCoord, (Integer) object)); } super.receiveObjectFromServer(index, object); } @@ -565,7 +596,7 @@ public class TileReactorCore extends TileObjectSync { compound.setByte("State", (byte) reactorState); compound.setBoolean("isStructureValid", isStructureValid); compound.setBoolean("startupInitialized", startupInitialized); - //compound.setBoolean("isActive", isActive); + // compound.setBoolean("isActive", isActive); compound.setInteger("energySaturation", energySaturation); compound.setInteger("maxEnergySaturation", maxEnergySaturation); compound.setInteger("reactorFuel", reactorFuel); @@ -593,7 +624,7 @@ public class TileReactorCore extends TileObjectSync { reactorState = compound.getByte("State"); isStructureValid = compound.getBoolean("isStructureValid"); startupInitialized = compound.getBoolean("startupInitialized"); - //isActive = compound.getBoolean("isActive"); + // isActive = compound.getBoolean("isActive"); energySaturation = compound.getInteger("energySaturation"); maxEnergySaturation = compound.getInteger("maxEnergySaturation"); reactorFuel = compound.getInteger("reactorFuel"); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java index a490f45c..7b858f72 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java @@ -9,6 +9,8 @@ import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelp import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.Map; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -18,9 +20,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; -import java.util.Map; - /** * Created by Brandon on 23/7/2015. */ @@ -200,7 +199,7 @@ public class TileReactorEnergyInjector extends TileEntity implements IReactorPar @Override public String[] getMethodNames() { - return new String[]{"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"}; + return new String[] {"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"}; } @Override @@ -222,24 +221,34 @@ public class TileReactorEnergyInjector extends TileEntity implements IReactorPar map.put("generationRate", (int) reactor.generationRate); map.put("fieldDrainRate", reactor.fieldDrain); map.put("fuelConversionRate", (int) Math.round(reactor.fuelUseRate * 1000000D)); - map.put("status", reactor.reactorState == 0 ? "offline" : reactor.reactorState == 1 && !reactor.canStart() ? "charging" : reactor.reactorState == 1 && reactor.canStart() ? "charged" : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid"); - return new Object[]{map}; + map.put( + "status", + reactor.reactorState == 0 + ? "offline" + : reactor.reactorState == 1 && !reactor.canStart() + ? "charging" + : reactor.reactorState == 1 && reactor.canStart() + ? "charged" + : reactor.reactorState == 2 + ? "online" + : reactor.reactorState == 3 ? "stopping" : "invalid"); + return new Object[] {map}; } else if (method.equals("chargeReactor")) { if (reactor.canCharge()) { reactor.reactorState = TileReactorCore.STATE_START; - return new Object[]{true}; - } else return new Object[]{false}; + return new Object[] {true}; + } else return new Object[] {false}; } else if (method.equals("activateReactor")) { if (reactor.canStart()) { reactor.reactorState = TileReactorCore.STATE_ONLINE; - return new Object[]{true}; - } else return new Object[]{false}; + return new Object[] {true}; + } else return new Object[] {false}; } else if (method.equals("stopReactor")) { if (reactor.canStop()) { reactor.reactorState = TileReactorCore.STATE_STOP; - return new Object[]{true}; - } else return new Object[]{false}; + return new Object[] {true}; + } else return new Object[] {false}; } - return new Object[]{}; + return new Object[] {}; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java index 39d67002..7f682967 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java @@ -10,6 +10,8 @@ import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelp import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.Map; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -18,9 +20,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; -import java.util.Map; - /** * Created by brandon3055 on 5/7/2015. */ @@ -52,11 +51,19 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I } TileEntity master = masterLocation.getTileEntity(worldObj); - if (master instanceof TileReactorCore && ((TileReactorCore) master).reactorState == TileReactorCore.STATE_ONLINE) { + if (master instanceof TileReactorCore + && ((TileReactorCore) master).reactorState == TileReactorCore.STATE_ONLINE) { ForgeDirection back = ForgeDirection.getOrientation(facingDirection).getOpposite(); - TileEntity output = worldObj.getTileEntity(xCoord + back.offsetX, yCoord + back.offsetY, zCoord + back.offsetZ); + TileEntity output = + worldObj.getTileEntity(xCoord + back.offsetX, yCoord + back.offsetY, zCoord + back.offsetZ); if (output instanceof IEnergyReceiver) { - int sent = ((IEnergyReceiver) output).receiveEnergy(back.getOpposite(), Math.min(((TileReactorCore) master).energySaturation, ((TileReactorCore) master).maxEnergySaturation / 100), false); + int sent = ((IEnergyReceiver) output) + .receiveEnergy( + back.getOpposite(), + Math.min( + ((TileReactorCore) master).energySaturation, + ((TileReactorCore) master).maxEnergySaturation / 100), + false); ((TileReactorCore) master).energySaturation -= sent; } } @@ -68,7 +75,6 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I Utills.updateNeabourBlocks(worldObj, xCoord, yCoord, zCoord); } } - } @SideOnly(Side.CLIENT) @@ -96,9 +102,7 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I checkForMaster(); } - public void onBroken() { - - } + public void onBroken() {} public boolean checkForMaster() { for (int i = 1; i < 10; i++) { @@ -108,7 +112,9 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I int z = zCoord + (dir.offsetZ * i); if (!worldObj.isAirBlock(x, y, z)) { TileEntity tile = worldObj.getTileEntity(x, y, z); - if (tile instanceof TileReactorCore && ((TileReactorCore) tile).stabilizerLocations.size() < 4) //todo add check reactor side to make sure this aligns with other stabilizers + if (tile instanceof TileReactorCore + && ((TileReactorCore) tile).stabilizerLocations.size() + < 4) // todo add check reactor side to make sure this aligns with other stabilizers { ((TileReactorCore) tile).stabilizerLocations.add(new TileLocation(xCoord, yCoord, zCoord)); masterLocation.set(x, y, z); @@ -227,7 +233,7 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I @Override public String[] getMethodNames() { - return new String[]{"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"}; + return new String[] {"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"}; } @Override @@ -249,24 +255,34 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I map.put("generationRate", (int) reactor.generationRate); map.put("fieldDrainRate", reactor.fieldDrain); map.put("fuelConversionRate", (int) Math.round(reactor.fuelUseRate * 1000000D)); - map.put("status", reactor.reactorState == 0 ? "offline" : reactor.reactorState == 1 && !reactor.canStart() ? "charging" : reactor.reactorState == 1 && reactor.canStart() ? "charged" : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid"); - return new Object[]{map}; + map.put( + "status", + reactor.reactorState == 0 + ? "offline" + : reactor.reactorState == 1 && !reactor.canStart() + ? "charging" + : reactor.reactorState == 1 && reactor.canStart() + ? "charged" + : reactor.reactorState == 2 + ? "online" + : reactor.reactorState == 3 ? "stopping" : "invalid"); + return new Object[] {map}; } else if (method.equals("chargeReactor")) { if (reactor.canCharge()) { reactor.reactorState = TileReactorCore.STATE_START; - return new Object[]{true}; - } else return new Object[]{false}; + return new Object[] {true}; + } else return new Object[] {false}; } else if (method.equals("activateReactor")) { if (reactor.canStart()) { reactor.reactorState = TileReactorCore.STATE_ONLINE; - return new Object[]{true}; - } else return new Object[]{false}; + return new Object[] {true}; + } else return new Object[] {false}; } else if (method.equals("stopReactor")) { if (reactor.canStop()) { reactor.reactorState = TileReactorCore.STATE_STOP; - return new Object[]{true}; - } else return new Object[]{false}; + return new Object[] {true}; + } else return new Object[] {false}; } - return new Object[]{}; + return new Object[] {}; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java index d96b1b97..a6ec6380 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java @@ -1,10 +1,7 @@ package com.brandon3055.draconicevolution.common.utills; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EntityDamageSource; -import net.minecraft.util.IChatComponent; - /** * Created by Brandon on 1/09/2014. @@ -15,12 +12,6 @@ public class DamageSourceChaos extends EntityDamageSource { this.setDamageBypassesArmor(); } - @Override - public IChatComponent func_151519_b(EntityLivingBase par1EntityLivingBase) { - return super.func_151519_b(par1EntityLivingBase); - //return new ChatComponentTranslation("death.attack.Chaos", par1EntityLivingBase.func_145748_c_()); - } - @Override public boolean isUnblockable() { return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java index e006c9e1..4ac07a42 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java @@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; +import java.util.*; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager; @@ -9,8 +10,6 @@ import net.minecraftforge.common.ForgeChunkManager.LoadingCallback; import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.MinecraftForge; -import java.util.*; - /** * Created by brandon3055 on 21/10/2015. */ @@ -31,7 +30,8 @@ public class DragonChunkLoader implements LoadingCallback { if (ticketList.containsKey(guardian)) { ticket = ticketList.get(guardian); } else { - ticket = ForgeChunkManager.requestTicket(DraconicEvolution.instance, guardian.worldObj, ForgeChunkManager.Type.ENTITY); + ticket = ForgeChunkManager.requestTicket( + DraconicEvolution.instance, guardian.worldObj, ForgeChunkManager.Type.ENTITY); if (ticket != null) { ticket.bindEntity(guardian); @@ -40,12 +40,15 @@ public class DragonChunkLoader implements LoadingCallback { } else { if (!hasReportedIssue) { - LogHelper.error("##########################################################################################"); + LogHelper.error( + "##########################################################################################"); LogHelper.error("Could not get ticket for dragon"); - LogHelper.error("Fore some reason forge has denied DE's request for a loader ticket for the chaos guardian"); + LogHelper.error( + "Fore some reason forge has denied DE's request for a loader ticket for the chaos guardian"); LogHelper.error("This means the chaos guardian may not behave as indented"); LogHelper.error("This error will not show again."); - LogHelper.error("##########################################################################################"); + LogHelper.error( + "##########################################################################################"); hasReportedIssue = true; } return; @@ -92,7 +95,8 @@ public class DragonChunkLoader implements LoadingCallback { public void ticketsLoaded(List tickets, World world) { if (!tickets.isEmpty()) { for (Ticket ticket : tickets) { - if (ticket.getType() == ForgeChunkManager.Type.ENTITY && ticket.getEntity() instanceof EntityChaosGuardian) { + if (ticket.getType() == ForgeChunkManager.Type.ENTITY + && ticket.getEntity() instanceof EntityChaosGuardian) { updateLoaded((EntityChaosGuardian) ticket.getEntity()); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java index f274e358..365751c8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java @@ -155,7 +155,7 @@ public class EnergyStorage implements IEnergyStorage { return capacity; } - /* Added By Brandon3055 24/07/2014 */ + /* Added By Brandon3055 24/07/2014 */ public EnergyStorage readFromNBT(NBTTagCompound nbt, String tag) { @@ -175,5 +175,4 @@ public class EnergyStorage implements IEnergyStorage { nbt.setInteger(tag, energy); return nbt; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java index 49bb71b9..5a16a13d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java @@ -1,12 +1,11 @@ package com.brandon3055.draconicevolution.common.utills; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import java.util.List; - /** * Created by Brandon on 29/12/2014. */ @@ -20,7 +19,8 @@ public interface IConfigurableItem { public static NBTTagCompound getProfileCompound(ItemStack stack) { int profile = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); NBTTagCompound stackCompound = ItemNBTHelper.getCompound(stack); - if (!stackCompound.hasKey("ConfigProfiles") && stackCompound.getTagList("ConfigProfiles", 10).tagCount() < 5) { + if (!stackCompound.hasKey("ConfigProfiles") + && stackCompound.getTagList("ConfigProfiles", 10).tagCount() < 5) { NBTTagList profileList = new NBTTagList(); for (int i = 0; i < 5; i++) profileList.appendTag(new NBTTagCompound()); stackCompound.setTag("ConfigProfiles", profileList); @@ -49,25 +49,34 @@ public interface IConfigurableItem { getProfileCompound(stack).setString(tag, s); } - public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) { - return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getBoolean(tag) : defaultExpected; + return getProfileCompound(stack).hasKey(tag) + ? getProfileCompound(stack).getBoolean(tag) + : defaultExpected; } public static int getInteger(ItemStack stack, String tag, int defaultExpected) { - return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getInteger(tag) : defaultExpected; + return getProfileCompound(stack).hasKey(tag) + ? getProfileCompound(stack).getInteger(tag) + : defaultExpected; } public static float getFloat(ItemStack stack, String tag, float defaultExpected) { - return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getFloat(tag) : defaultExpected; + return getProfileCompound(stack).hasKey(tag) + ? getProfileCompound(stack).getFloat(tag) + : defaultExpected; } public static double getDouble(ItemStack stack, String tag, double defaultExpected) { - return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getDouble(tag) : defaultExpected; + return getProfileCompound(stack).hasKey(tag) + ? getProfileCompound(stack).getDouble(tag) + : defaultExpected; } public static String getString(ItemStack stack, String tag, String defaultExpected) { - return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getString(tag) : defaultExpected; + return getProfileCompound(stack).hasKey(tag) + ? getProfileCompound(stack).getString(tag) + : defaultExpected; } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java index 2bcdcb76..e7068101 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java @@ -1,8 +1,7 @@ package com.brandon3055.draconicevolution.common.utills; -import net.minecraft.world.World; - import java.util.List; +import net.minecraft.world.World; /** * Created by Brandon on 27/01/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java index 4e4810f9..b6e6ceff 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java @@ -1,8 +1,7 @@ package com.brandon3055.draconicevolution.common.utills; -import net.minecraft.item.ItemStack; - import java.util.List; +import net.minecraft.item.ItemStack; /** * Created by Brandon on 26/01/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java index fd6bd2f7..d406a889 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java @@ -1,10 +1,9 @@ package com.brandon3055.draconicevolution.common.utills; -import java.util.List; - import cofh.api.energy.IEnergyContainerItem; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.lib.References; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; @@ -46,8 +45,11 @@ public interface IUpgradableItem { public void onRemovedFromItem(ItemStack itemStack) { if (itemStack != null && itemStack.getItem() instanceof IEnergyContainerItem) { IEnergyContainerItem item = (IEnergyContainerItem) itemStack.getItem(); - for (int i = 0; i < 500 && item.getEnergyStored(itemStack) > item.getMaxEnergyStored(itemStack); i++) { - item.extractEnergy(itemStack, item.getEnergyStored(itemStack) - item.getMaxEnergyStored(itemStack), false); + for (int i = 0; + i < 500 && item.getEnergyStored(itemStack) > item.getMaxEnergyStored(itemStack); + i++) { + item.extractEnergy( + itemStack, item.getEnergyStored(itemStack) - item.getMaxEnergyStored(itemStack), false); } } } @@ -60,8 +62,10 @@ public interface IUpgradableItem { for (int i = 0; i < 5; i++) { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); - if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_AOE, 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger(itemStack, References.DIG_AOE, getUpgradePoints(itemStack)); + if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_AOE, 0) + > getUpgradePoints(itemStack)) + IConfigurableItem.ProfileHelper.setInteger( + itemStack, References.DIG_AOE, getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -74,8 +78,10 @@ public interface IUpgradableItem { for (int i = 0; i < 5; i++) { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); - if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_DEPTH, 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger(itemStack, References.DIG_DEPTH, getUpgradePoints(itemStack)); + if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_DEPTH, 0) + > getUpgradePoints(itemStack)) + IConfigurableItem.ProfileHelper.setInteger( + itemStack, References.DIG_DEPTH, getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -89,8 +95,10 @@ public interface IUpgradableItem { for (int i = 0; i < 5; i++) { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); - if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.ATTACK_AOE, 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger(itemStack, References.ATTACK_AOE, getUpgradePoints(itemStack)); + if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.ATTACK_AOE, 0) + > getUpgradePoints(itemStack)) + IConfigurableItem.ProfileHelper.setInteger( + itemStack, References.ATTACK_AOE, getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -103,8 +111,10 @@ public interface IUpgradableItem { for (int i = 0; i < 5; i++) { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); - if (IConfigurableItem.ProfileHelper.getInteger(itemStack, "BowArrowDamage", 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger(itemStack, "BowArrowDamage", getUpgradePoints(itemStack)); + if (IConfigurableItem.ProfileHelper.getInteger(itemStack, "BowArrowDamage", 0) + > getUpgradePoints(itemStack)) + IConfigurableItem.ProfileHelper.setInteger( + itemStack, "BowArrowDamage", getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -118,8 +128,10 @@ public interface IUpgradableItem { for (int i = 0; i < 5; i++) { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); - if (IConfigurableItem.ProfileHelper.getInteger(itemStack, "BowArrowSpeedModifier", 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger(itemStack, "BowArrowSpeedModifier", getUpgradePoints(itemStack)); + if (IConfigurableItem.ProfileHelper.getInteger(itemStack, "BowArrowSpeedModifier", 0) + > getUpgradePoints(itemStack)) + IConfigurableItem.ProfileHelper.setInteger( + itemStack, "BowArrowSpeedModifier", getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -135,6 +147,7 @@ public interface IUpgradableItem { * How many core points dose it take to add 1 upgrade point */ public int pointConversion; + public String name; private final String COMPOUND_NAME = "Upgrades"; @@ -152,12 +165,12 @@ public interface IUpgradableItem { * with wyvern and awakened in between */ public int[] getCoresApplied(ItemStack stack) { - if (stack == null) return new int[]{0, 0, 0, 0}; + if (stack == null) return new int[] {0, 0, 0, 0}; NBTTagCompound compound = ItemNBTHelper.getCompound(stack); - if (!compound.hasKey(COMPOUND_NAME)) return new int[]{0, 0, 0, 0}; + if (!compound.hasKey(COMPOUND_NAME)) return new int[] {0, 0, 0, 0}; NBTTagCompound upgrades = compound.getCompoundTag(COMPOUND_NAME); if (upgrades.hasKey(name) && upgrades.getIntArray(name).length == 4) return upgrades.getIntArray(name); - return new int[]{0, 0, 0, 0}; + return new int[] {0, 0, 0, 0}; } /** @@ -196,7 +209,8 @@ public interface IUpgradableItem { int[] applied = getCoresApplied(itemStack); int totalPoints = applied[0] + (applied[1] * 2) + (applied[2] * 4) + (applied[3] * 8); if (itemStack != null && itemStack.getItem() instanceof IUpgradableItem) { - int points = ((IUpgradableItem) itemStack.getItem()).getBaseUpgradePoints(index) + (totalPoints / pointConversion); + int points = ((IUpgradableItem) itemStack.getItem()).getBaseUpgradePoints(index) + + (totalPoints / pointConversion); return Math.min(points, ((IUpgradableItem) itemStack.getItem()).getMaxUpgradePoints(index, itemStack)); } return 0; @@ -205,16 +219,11 @@ public interface IUpgradableItem { /** * Called when this upgrade is applied to an item */ - public void onAppliedToItem(ItemStack itemStack) { - - } + public void onAppliedToItem(ItemStack itemStack) {} /** * Called when this upgrade is removed from an item */ - public void onRemovedFromItem(ItemStack itemStack) { - - } - + public void onRemovedFromItem(ItemStack itemStack) {} } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java index 18a9fff8..2fc76c05 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java @@ -1,15 +1,15 @@ package com.brandon3055.draconicevolution.common.utills; +import java.util.Arrays; +import java.util.Optional; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import java.util.Arrays; -import java.util.Optional; - public final class InventoryUtils { private InventoryUtils() {} + public static Optional getItemInPlayerInventory(EntityPlayer player, Class item) { return Arrays.stream(player.inventory.mainInventory) .filter(itemStack -> itemStack != null && item.isInstance(itemStack.getItem())) diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java index 53e747e4..8812ac68 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java @@ -24,7 +24,6 @@ public class ItemConfigField { public Object incroment; public String modifier; - public ItemConfigField(int datatype, int slot, String name) { this.slot = slot; this.datatype = datatype; @@ -49,12 +48,13 @@ public class ItemConfigField { return StatCollector.translateToLocal("button.de." + name + ".name"); } -// public void writeToItem(ItemStack stack){ -// DataUtills.writeObjectToItem(stack, value, datatype, name); -// } + // public void writeToItem(ItemStack stack){ + // DataUtills.writeObjectToItem(stack, value, datatype, name); + // } public ItemConfigField readFromItem(ItemStack stack, Object defaultExpected) { - value = DataUtills.readObjectFromCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), datatype, name, defaultExpected); + value = DataUtills.readObjectFromCompound( + IConfigurableItem.ProfileHelper.getProfileCompound(stack), datatype, name, defaultExpected); return this; } @@ -69,10 +69,16 @@ public class ItemConfigField { i *= 2; return String.valueOf((i + 1) + "x" + (i + 1)); } else if (datatype == References.BOOLEAN_ID) { - return (Boolean) value ? StatCollector.translateToLocal("gui.de.on.txt") : StatCollector.translateToLocal("gui.de.off.txt"); - } else if (datatype == References.FLOAT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("PERCENT")) { + return (Boolean) value + ? StatCollector.translateToLocal("gui.de.on.txt") + : StatCollector.translateToLocal("gui.de.off.txt"); + } else if (datatype == References.FLOAT_ID + && !StringUtils.isNullOrEmpty(modifier) + && modifier.equals("PERCENT")) { return Math.round((Float) value * 100D) + "%"; - } else if (datatype == References.FLOAT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("PLUSPERCENT")) { + } else if (datatype == References.FLOAT_ID + && !StringUtils.isNullOrEmpty(modifier) + && modifier.equals("PLUSPERCENT")) { return "+" + Math.round((Float) value * 100D) + "%"; } else { return String.valueOf(value); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java index bbca7f35..8d8b386f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java @@ -43,49 +43,53 @@ public class PortalHelper { return null; } - public static PortalStructure traceFrame(World world, int x, int y, int z, ForgeDirection startDir, ForgeDirection plane) { + public static PortalStructure traceFrame( + World world, int x, int y, int z, ForgeDirection startDir, ForgeDirection plane) { int MAX_SIZE = 150; int startX = x + startDir.offsetX; int startY = y + startDir.offsetY; int startZ = z + startDir.offsetZ; - //Check that the trace is starting from a receptacle + // Check that the trace is starting from a receptacle if (!world.isAirBlock(startX, startY, startZ)) return null; int xSize = 0; int ySize = 0; int yOffset = 0; - //Get X size + // Get X size for (int i = 0; i <= MAX_SIZE; i++) { - Block block = world.getBlock(startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ); + Block block = world.getBlock( + startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ); if (isFrame(block)) { xSize = i; break; - } else if (!world.isAirBlock(startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ)) + } else if (!world.isAirBlock( + startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ)) return null; } - //Get Y size above receptacle + // Get Y size above receptacle for (int i = 0; i <= MAX_SIZE; i++) { - Block block = world.getBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ); + Block block = + world.getBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ); if (isFrame(block)) { ySize = i; break; - } else if (!world.isAirBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ)) - return null; + } else if (!world.isAirBlock( + startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ)) return null; } - //Get Y size below receptacle and get y offset + // Get Y size below receptacle and get y offset for (int i = 0; i <= MAX_SIZE; i++) { - Block block = world.getBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ); + Block block = + world.getBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ); if (isFrame(block)) { ySize += i - 1; yOffset = i; break; - } else if (!world.isAirBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ)) - return null; - + } else if (!world.isAirBlock( + startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ)) return null; } if (xSize == 0 || ySize == 0 || ySize > MAX_SIZE) return null; @@ -95,7 +99,6 @@ public class PortalHelper { if (!structure.checkFrameIsValid(world, x, y, z) || !structure.scanPortal(world, x, y, z, false, false)) return null; - return structure; } @@ -107,8 +110,7 @@ public class PortalHelper { public ForgeDirection startDir; public ForgeDirection plane; - public PortalStructure() { - } + public PortalStructure() {} public PortalStructure(int xSize, int ySize, int yOffset, ForgeDirection startDir, ForgeDirection plane) { this.xSize = xSize; @@ -124,7 +126,7 @@ public class PortalHelper { int startY = y + startDir.offsetY; int startZ = z + startDir.offsetZ; - //Check structure for y size + // Check structure for y size for (int y1 = 1; y1 <= ySize; y1++) { int y2 = y1 - yOffset; @@ -140,7 +142,7 @@ public class PortalHelper { if (!isFrame(world.getBlock(outX, outY, outZ))) return false; } - //Check structure for x size + // Check structure for x size for (int x1 = 0; x1 < xSize; x1++) { int upX = startX + x1 * startDir.offsetX - yOffset * plane.offsetX; int upY = startY + x1 * startDir.offsetY - yOffset * plane.offsetY; @@ -157,7 +159,8 @@ public class PortalHelper { return true; } - public boolean scanPortal(World world, int x, int y, int z, boolean setPortalBlocks, boolean checkPortalBlocks) { + public boolean scanPortal( + World world, int x, int y, int z, boolean setPortalBlocks, boolean checkPortalBlocks) { int startX = x + startDir.offsetX; int startY = y + startDir.offsetY; int startZ = z + startDir.offsetZ; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java index 4369cb80..cfa77800 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java @@ -4,13 +4,12 @@ import com.brandon3055.draconicevolution.common.lib.VersionHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StringUtils; - import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; /** * Created by Brandon on 24/02/2015. @@ -38,16 +37,21 @@ public class UpdateChecker { playerNotified = true; FMLCommonHandler.instance().bus().unregister(this); - if (!thread.getVersion().equals(VersionHandler.VERSION) || (VersionHandler.SNAPSHOT > 0 && thread.getSnapshot() == 0)) { - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "[Draconic Evolution]" + EnumChatFormatting.RESET + " New version available:")); - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Draconic Evolution v" + thread.getVersion())); - if (!StringUtils.isNullOrEmpty(thread.getNote())){ + if (!thread.getVersion().equals(VersionHandler.VERSION) + || (VersionHandler.SNAPSHOT > 0 && thread.getSnapshot() == 0)) { + event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + + "[Draconic Evolution]" + EnumChatFormatting.RESET + " New version available:")); + event.player.addChatComponentMessage( + new ChatComponentText(EnumChatFormatting.GREEN + "Draconic Evolution v" + thread.getVersion())); + if (!StringUtils.isNullOrEmpty(thread.getNote())) { event.player.addChatComponentMessage(new ChatComponentText(thread.getNote())); } } else if (thread.getSnapshot() > VersionHandler.SNAPSHOT) { - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "[Draconic Evolution]" + EnumChatFormatting.RESET + " New snapshot version available:")); - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.BLUE + "Draconic Evolution v" + thread.getVersion() + "-snapshot_" + thread.getSnapshot())); - if (!StringUtils.isNullOrEmpty(thread.getNote())){ + event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + + "[Draconic Evolution]" + EnumChatFormatting.RESET + " New snapshot version available:")); + event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.BLUE + + "Draconic Evolution v" + thread.getVersion() + "-snapshot_" + thread.getSnapshot())); + if (!StringUtils.isNullOrEmpty(thread.getNote())) { event.player.addChatComponentMessage(new ChatComponentText(thread.getNote())); } } @@ -56,15 +60,13 @@ public class UpdateChecker { playerNotified = true; FMLCommonHandler.instance().bus().unregister(this); - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "[Draconic Evolution]" + EnumChatFormatting.RED + " Version check failed")); + event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + + "[Draconic Evolution]" + EnumChatFormatting.RED + " Version check failed")); if (!StringUtils.isNullOrEmpty(thread.getNote())) event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + thread.getNote())); } - - } - public class UpdateCheckThread extends Thread { private String version = null; private int snapshot = -1; @@ -76,7 +78,8 @@ public class UpdateChecker { public void run() { LogHelper.info("[Update Checker] Thread Started"); try { - URL versionURL = new URL("https://raw.githubusercontent.com/brandon3055/Draconic-Evolution/master/VERSION.txt"); + URL versionURL = + new URL("https://raw.githubusercontent.com/brandon3055/Draconic-Evolution/master/VERSION.txt"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader((versionURL).openStream())); @@ -98,27 +101,28 @@ public class UpdateChecker { } LogHelper.info("[Update Checker] Thread Finished"); -// if (complete) -// { -// if (!getVersion().equals(VersionHandler.VERSION) || (VersionHandler.SNAPSHOT > 0 && getSnapshot() == 0)) -// { -// LogHelper.info("###############################"); -// LogHelper.info("New version available:"); -// LogHelper.info("Draconic Evolution v" + thread.getVersion()); -// if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); -// LogHelper.info("###############################"); -// } -// else if (getSnapshot() > VersionHandler.SNAPSHOT) -// { -// LogHelper.info("###############################"); -// LogHelper.info("New snapshot version available:"); -// LogHelper.info("Draconic Evolution v" + thread.getVersion() + "-snapshot_" + thread.getSnapshot()); -// if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); -// LogHelper.info("###############################"); -// } -// } - } - catch (Exception e) { + // if (complete) + // { + // if (!getVersion().equals(VersionHandler.VERSION) || (VersionHandler.SNAPSHOT > 0 && getSnapshot() + // == 0)) + // { + // LogHelper.info("###############################"); + // LogHelper.info("New version available:"); + // LogHelper.info("Draconic Evolution v" + thread.getVersion()); + // if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); + // LogHelper.info("###############################"); + // } + // else if (getSnapshot() > VersionHandler.SNAPSHOT) + // { + // LogHelper.info("###############################"); + // LogHelper.info("New snapshot version available:"); + // LogHelper.info("Draconic Evolution v" + thread.getVersion() + "-snapshot_" + + // thread.getSnapshot()); + // if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); + // LogHelper.info("###############################"); + // } + // } + } catch (Exception e) { LogHelper.info("[Update Checker] Check Failed"); failed = true; note = e.getClass().toString(); @@ -146,5 +150,4 @@ public class UpdateChecker { return failed; } } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java index b1e186e7..dfeba12f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java @@ -9,19 +9,17 @@ import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal; import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import java.util.Random; - /** * Created by brandon3055 on 9/9/2015. */ public class ChaosWorldGenHandler { - /** * Used to generate the chaos island chunk by chunk * @@ -30,8 +28,10 @@ public class ChaosWorldGenHandler { * @param chunkZ The Z position of the chunk being generated. * @param islandCenter Where to generate the island. If left null the islands will generate in a 10000 by 10000 grid. */ - public static void generateChunk(World world, int chunkX, int chunkZ, DataUtills.XZPair islandCenter, Random random) { - DataUtills.XZPair closestSpawn = islandCenter == null ? getClosestChaosSpawn(chunkX, chunkZ) : islandCenter; + public static void generateChunk( + World world, int chunkX, int chunkZ, DataUtills.XZPair islandCenter, Random random) { + DataUtills.XZPair closestSpawn = + islandCenter == null ? getClosestChaosSpawn(chunkX, chunkZ) : islandCenter; if (closestSpawn.x == 0 && closestSpawn.z == 0) return; int posX = chunkX * 16; @@ -40,10 +40,12 @@ public class ChaosWorldGenHandler { if (Math.abs(posX - closestSpawn.x) > copyStartDistance || Math.abs(posZ - closestSpawn.z) > copyStartDistance) return; - if (closestSpawn.x > posX && closestSpawn.x <= posX + 16 && closestSpawn.z > posZ && closestSpawn.z <= posZ + 16) - generateStructures(world, closestSpawn, random); + if (closestSpawn.x > posX + && closestSpawn.x <= posX + 16 + && closestSpawn.z > posZ + && closestSpawn.z <= posZ + 16) generateStructures(world, closestSpawn, random); - //long l = System.nanoTime(); + // long l = System.nanoTime(); for (int trueX = posX; trueX < posX + 16; trueX++) { for (int y = 0; y < 255; y++) { @@ -59,25 +61,29 @@ public class ChaosWorldGenHandler { yd = (double) y / (32); zd = (double) z / size; - //Calculate Center Falloff + // Calculate Center Falloff double diameterScale = 150D; - //centerFalloff = (1D - (dist / diameterScale)) * 1D; + // centerFalloff = (1D - (dist / diameterScale)) * 1D; centerFalloff = 1D / (dist * 0.05D); if (centerFalloff < 0) centerFalloff = 0; - //Calculate Plateau Falloff + // Calculate Plateau Falloff if (yd < 0.4D) plateauFalloff = yd * 2.5D; else if (yd <= 0.6D) plateauFalloff = 1D; else if (yd > 0.6D && yd < 1D) plateauFalloff = 1D - (yd - 0.6D) * 2.5D; else plateauFalloff = 0; - //Trim Further calculations + // Trim Further calculations if (plateauFalloff == 0 || centerFalloff == 0) continue; - //Calculate heightMapFalloff + // Calculate heightMapFalloff heightMapFalloff = 0; for (int octave = 1; octave < 5; octave++) - heightMapFalloff += ((SimplexNoise.noise(xd * octave + closestSpawn.x, zd * octave + closestSpawn.z) + 1) * 0.5D) * 0.01D * (octave * 10D * 1 - (dist * 0.001D)); + heightMapFalloff += + ((SimplexNoise.noise(xd * octave + closestSpawn.x, zd * octave + closestSpawn.z) + 1) + * 0.5D) + * 0.01D + * (octave * 10D * 1 - (dist * 0.001D)); if (heightMapFalloff <= 0) heightMapFalloff = 0; heightMapFalloff += ((0.5D - Math.abs(yd - 0.5D)) * 0.15D); if (heightMapFalloff == 0) continue; @@ -85,22 +91,28 @@ public class ChaosWorldGenHandler { density = centerFalloff * plateauFalloff * heightMapFalloff; if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == Blocks.air) - world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, (dist > 60 || dist > random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian); + world.setBlock( + x + closestSpawn.x, + y + 64, + z + closestSpawn.z, + (dist > 60 || dist > random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian); -// if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == Blocks.air) { -// boolean b = dist > 60 || dist > random.nextInt(60); -// world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, (dist > 60 || dist > random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian); -// } + // if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == + // Blocks.air) { + // boolean b = dist > 60 || dist > random.nextInt(60); + // world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, (dist > 60 || dist > + // random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian); + // } } } } } - public static void generateStructures(World world, DataUtills.XZPair islandCenter, Random random) { + public static void generateStructures( + World world, DataUtills.XZPair islandCenter, Random random) { int outerRadius = 330; - - //Gen Chaos Cavern + // Gen Chaos Cavern int shardY = 80; int coreHeight = 10; @@ -119,14 +131,14 @@ public class ChaosWorldGenHandler { world.setBlock(islandCenter.x, shardY, islandCenter.z, ModBlocks.chaosCrystal); TileChaosShard tileChaosShard = (TileChaosShard) world.getTileEntity(islandCenter.x, shardY, islandCenter.z); - tileChaosShard.locationHash = tileChaosShard.getLocationHash(islandCenter.x, shardY, islandCenter.z, world.provider.dimensionId); + tileChaosShard.locationHash = + tileChaosShard.getLocationHash(islandCenter.x, shardY, islandCenter.z, world.provider.dimensionId); EntityChaosGuardian guardian = new EntityChaosGuardian(world); guardian.setPositionAndUpdate(islandCenter.x, shardY, islandCenter.z); world.spawnEntityInWorld(guardian); - - //Gen Ring + // Gen Ring int rings = 4; int width = 20; int spacing = 8; @@ -134,8 +146,9 @@ public class ChaosWorldGenHandler { for (int z = islandCenter.z - outerRadius; z <= islandCenter.z + outerRadius; z++) { int dist = (int) (Utills.getDistanceAtoB(x, z, islandCenter.x, islandCenter.z)); for (int i = 0; i < rings; i++) { - //if (dist < outerRadius1 && dist >= innerRadius1 || dist < outerRadius2 && dist >= innerRadius2) - if (dist < (outerRadius - ((width + spacing) * i)) && dist >= (outerRadius - width - ((width + spacing) * i))) { + // if (dist < outerRadius1 && dist >= innerRadius1 || dist < outerRadius2 && dist >= innerRadius2) + if (dist < (outerRadius - ((width + spacing) * i)) + && dist >= (outerRadius - width - ((width + spacing) * i))) { int y = 90 + (int) ((double) (islandCenter.x - x) * 0.1D) + (random.nextInt(10) - 5); if (0.1F > random.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); if (0.001F > random.nextFloat()) world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2); @@ -146,7 +159,8 @@ public class ChaosWorldGenHandler { generateObelisks(world, islandCenter, random); } - public static void genCoreSlice(World world, int xi, int yi, int zi, int ringRadius, int yc, int coreRadious, boolean fillIn, Random rand) { + public static void genCoreSlice( + World world, int xi, int yi, int zi, int ringRadius, int yc, int coreRadious, boolean fillIn, Random rand) { for (int x = xi - coreRadious; x <= xi + coreRadious; x++) { for (int z = zi - coreRadious; z <= zi + coreRadious; z++) { double dist = Utills.getDistanceAtoB(x, yi, z, xi, yc, zi); @@ -164,14 +178,14 @@ public class ChaosWorldGenHandler { if (b == Blocks.air || b == Blocks.end_stone || b == Blocks.obsidian) world.setBlock(x, yi, z, ModBlocks.chaosShardAtmos); } - } } } - public static DataUtills.XZPair getClosestChaosSpawn(int chunkX, int chunkZ) { - return new DataUtills.XZPair(Utills.getNearestMultiple(chunkX * 16, ConfigHandler.chaosIslandSeparation), Utills.getNearestMultiple(chunkZ * 16, ConfigHandler.chaosIslandSeparation)); + return new DataUtills.XZPair( + Utills.getNearestMultiple(chunkX * 16, ConfigHandler.chaosIslandSeparation), + Utills.getNearestMultiple(chunkZ * 16, ConfigHandler.chaosIslandSeparation)); } private static void generateObelisks(World world, DataUtills.XZPair islandCenter, Random rand) { @@ -189,7 +203,6 @@ public class ChaosWorldGenHandler { int sZ = islandCenter.z + (int) (Math.cos(rotation) * 90D); generateObelisk(world, sX, 90, sZ, true, rand); } - } private static void generateObelisk(World world, int x1, int y1, int z1, boolean outer, Random rand) { @@ -250,7 +263,6 @@ public class ChaosWorldGenHandler { if (0.8F > rand.nextFloat()) world.setBlock(x, y1 + 44, z, Blocks.stone_slab, 6, 2); } } - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java index e027717b..4784ed03 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java @@ -3,21 +3,26 @@ package com.brandon3055.draconicevolution.common.world; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import cpw.mods.fml.common.IWorldGenerator; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; -import java.util.Random; - public class DraconicWorldGenerator implements IWorldGenerator { public static boolean chaosIslandsEnabled = true; public static boolean cometsEnabled = true; public static boolean oreEnabledInEnd = true; @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { + public void generate( + Random random, + int chunkX, + int chunkZ, + World world, + IChunkProvider chunkGenerator, + IChunkProvider chunkProvider) { switch (world.provider.dimensionId) { case 0: generateSurface(random, chunkX * 16, chunkZ * 16, world); @@ -35,10 +40,14 @@ public class DraconicWorldGenerator implements IWorldGenerator { addOreSpawn(ModBlocks.draconiumOre, world, random, chunkX * 16, chunkZ * 16, 3, 4, 2, 2, 8); break; } - } - public void generateSurface(Random random, int x, int z, World world) {// minVainSise, maxVainSize, spawnChance(Def2), minY, maxY + public void generateSurface( + Random random, + int x, + int z, + World world) { // minVainSise, + // maxVainSize, spawnChance(Def2), minY, maxY if (!ConfigHandler.disableOreSpawnOverworld) addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 3, 4, 2, 2, 8); } @@ -47,7 +56,10 @@ public class DraconicWorldGenerator implements IWorldGenerator { int x1 = x + random.nextInt(16); int y = 20 + random.nextInt(170); int z1 = z + random.nextInt(16); - if (cometsEnabled && ConfigHandler.generateEnderComets && Math.sqrt(x * x + z * z) > 200 && random.nextInt(Math.max(1, ConfigHandler.cometRarity)) == 0) + if (cometsEnabled + && ConfigHandler.generateEnderComets + && Math.sqrt(x * x + z * z) > 200 + && random.nextInt(Math.max(1, ConfigHandler.cometRarity)) == 0) new WorldGenEnderComet().generate(world, random, x1, y, z1); if (chaosIslandsEnabled && ConfigHandler.generateChaosIslands) ChaosWorldGenHandler.generateChunk(world, x / 16, z / 16, null, random); @@ -74,16 +86,26 @@ public class DraconicWorldGenerator implements IWorldGenerator { * max y * * */ - public void addOreSpawn(Block block, World world, Random random, int chunkXPos, int chunkZPos, int minVainSize, int maxVainSize, int chancesToSpawn, int minY, int maxY) { + public void addOreSpawn( + Block block, + World world, + Random random, + int chunkXPos, + int chunkZPos, + int minVainSize, + int maxVainSize, + int chancesToSpawn, + int minY, + int maxY) { for (int i = 0; i < chancesToSpawn; i++) { int posX = chunkXPos + random.nextInt(16); int posY = minY + random.nextInt(maxY - minY); int posZ = chunkZPos + random.nextInt(16); - new WorldGenMinable(block, 0, (minVainSize + random.nextInt(maxVainSize - minVainSize)), Blocks.end_stone).generate(world, random, posX, posY, posZ); + new WorldGenMinable(block, 0, (minVainSize + random.nextInt(maxVainSize - minVainSize)), Blocks.end_stone) + .generate(world, random, posX, posY, posZ); new WorldGenMinable(block, 0, 3, Blocks.stone).generate(world, random, posX, posY, posZ); - new WorldGenMinable(block, 0, (minVainSize + random.nextInt(maxVainSize - minVainSize)), Blocks.netherrack).generate(world, random, posX, posY, posZ); + new WorldGenMinable(block, 0, (minVainSize + random.nextInt(maxVainSize - minVainSize)), Blocks.netherrack) + .generate(world, random, posX, posY, posZ); } } - - } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java index c34aedb2..d3304180 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java @@ -3,14 +3,13 @@ package com.brandon3055.draconicevolution.common.world; import com.brandon3055.brandonscore.common.utills.SimplexNoise; import com.brandon3055.brandonscore.common.world.BlockCollection; import com.brandon3055.draconicevolution.common.utills.LogHelper; +import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.NoiseGeneratorImproved; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.NoiseGeneratorSimplex; -import java.util.Random; - /** * Created by brandon3055 on 1/9/2015. */ @@ -32,31 +31,31 @@ public class WorldGenChaosIsland { } public boolean generate(BlockCollection world, Random random) { - //LogHelper.info("Generate"); -// for (int y1 = y - 10; y1 < y + 10; y1++) { -// if (world.getBlock(x, y1, z) == Blocks.end_stone) { -// //LogHelper.info("cancel"); -// return false; -// } -// } + // LogHelper.info("Generate"); + // for (int y1 = y - 10; y1 < y + 10; y1++) { + // if (world.getBlock(x, y1, z) == Blocks.end_stone) { + // //LogHelper.info("cancel"); + // return false; + // } + // } size = 400; generateCentre(world, random); -// generateBelt(world, random, size + 50, size + 200); -// generateObelisks(world, random); -// EntityChaosGuardian dragon = new EntityChaosGuardian(world); -// dragon.setPositionAndUpdate(x, 180, z); -// world.spawnEntityInWorld(dragon); + // generateBelt(world, random, size + 50, size + 200); + // generateObelisks(world, random); + // EntityChaosGuardian dragon = new EntityChaosGuardian(world); + // dragon.setPositionAndUpdate(x, 180, z); + // world.spawnEntityInWorld(dragon); return true; } double[] noiseData; private void generateCentre(BlockCollection blocks, Random rand) { - //int centreThikness = 10; //multiplied by 2 and + 1 + // int centreThikness = 10; //multiplied by 2 and + 1 int curve = 2; - int diffStart = 20;//(int)((double)size * 0.1D); - //int offPoint = size * curve; + int diffStart = 20; // (int)((double)size * 0.1D); + // int offPoint = size * curve; int coreDiameter = 90; @@ -85,11 +84,12 @@ public class WorldGenChaosIsland { double density, center_falloff, plateau_falloff, densityZ; - - center_falloff = 0.1;///(Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + Math.pow((zf - 0.5) * 1.5, 2)); + center_falloff = + 0.1; /// (Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + Math.pow((zf - + // 0.5) * 1.5, 2)); double diameterScale = 100D; - //center_falloff = 1;//(1D - (dist / diameterScale)) * 4D; + // center_falloff = 1;//(1D - (dist / diameterScale)) * 4D; if (center_falloff < 0) center_falloff = 0; if (yf <= 0.8) { @@ -102,27 +102,27 @@ public class WorldGenChaosIsland { density = 0.1; for (int octave = 0; octave < 4; octave++) { - //density += Math.abs(SimplexNoise.noise(xf*Math.pow(2, octave), yf*Math.pow(2, octave), zf*Math.pow(2, octave))); + // density += Math.abs(SimplexNoise.noise(xf*Math.pow(2, octave), yf*Math.pow(2, octave), + // zf*Math.pow(2, octave))); } density *= center_falloff * plateau_falloff; - //if (y % 50 == 0) LogHelper.info((density) + " " + center_falloff + " " + yf); - //LogHelper.info(yf); + // if (y % 50 == 0) LogHelper.info((density) + " " + center_falloff + " " + yf); + // LogHelper.info(yf); f = false; - -// //setup fields -// -// -// dist += rand.nextInt(4) - 2; -// -// //Generate core island -// double yMod = dist / (500D/dist+1D); -// if (dist <= coreDiameter && y <= spawnY + yMod){ -// blocks.setBlock(x, y, z, Blocks.end_stone); -// } -// + // //setup fields + // + // + // dist += rand.nextInt(4) - 2; + // + // //Generate core island + // double yMod = dist / (500D/dist+1D); + // if (dist <= coreDiameter && y <= spawnY + yMod){ + // blocks.setBlock(x, y, z, Blocks.end_stone); + // } + // } } @@ -135,7 +135,7 @@ public class WorldGenChaosIsland { int size = 300; - //double dist = Math.sqrt(x*x + (y-spawnHeight)*(y-spawnHeight) + z*z); + // double dist = Math.sqrt(x*x + (y-spawnHeight)*(y-spawnHeight) + z*z); double xf, yf, zf; xf = (double) x / size; @@ -144,11 +144,12 @@ public class WorldGenChaosIsland { double density, center_falloff, plateau_falloff, densityZ; - - center_falloff = 0.1;///(Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + Math.pow((zf - 0.5) * 1.5, 2)); + center_falloff = + 0.1; /// (Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + Math.pow((zf - 0.5) * 1.5, + // 2)); double diameterScale = 100D; - //center_falloff = 1;//(1D - (dist / diameterScale)) * 4D; + // center_falloff = 1;//(1D - (dist / diameterScale)) * 4D; if (center_falloff < 0) center_falloff = 0; if (yf <= 0.8) { @@ -161,261 +162,284 @@ public class WorldGenChaosIsland { density = 0.1; for (int octave = 0; octave < 4; octave++) { - density += Math.abs(SimplexNoise.noise(xf * Math.pow(2, octave), yf * Math.pow(2, octave), zf * Math.pow(2, octave))); + density += Math.abs( + SimplexNoise.noise(xf * Math.pow(2, octave), yf * Math.pow(2, octave), zf * Math.pow(2, octave))); } - //density *= center_falloff * plateau_falloff; + // density *= center_falloff * plateau_falloff; if (y % 50 == 0) LogHelper.info((density) + " " + center_falloff + " " + yf); - //LogHelper.info(yf); + // LogHelper.info(yf); if (density > 1) world.setBlock(x + offsetX, y, z + offsetZ, Blocks.end_stone); - } // if(yf <= 0.8){ -// plateau_falloff = 1.0F; -// } -// else if(0.8 < yf && yf < 0.9){ -// plateau_falloff = 1.0F-(yf-0.8F)*10.0F; -// } -// else{ -// plateau_falloff = 0.0F; -// } -// -// center_falloff = 0.1F/ (float)( -// Math.pow((xf - 0.5F) * 1.5F, 2) + -// Math.pow((yf - 1.0F) * 0.8F, 2F) + -// Math.pow((zf - 0.5F) * 1.5F, 2F) -// ); -// caves = (float)Math.pow(simplex_noise(1, xf * 5, yf * 5, zf * 5), 3); - //density = ( simplex_noise(5, xf, yf * 0.5F, zf));// * center_falloff * plateau_falloff); + // plateau_falloff = 1.0F; + // } + // else if(0.8 < yf && yf < 0.9){ + // plateau_falloff = 1.0F-(yf-0.8F)*10.0F; + // } + // else{ + // plateau_falloff = 0.0F; + // } + // + // center_falloff = 0.1F/ (float)( + // Math.pow((xf - 0.5F) * 1.5F, 2) + + // Math.pow((yf - 1.0F) * 0.8F, 2F) + + // Math.pow((zf - 0.5F) * 1.5F, 2F) + // ); + // caves = (float)Math.pow(simplex_noise(1, xf * 5, yf * 5, zf * 5), 3); + // density = ( simplex_noise(5, xf, yf * 0.5F, zf));// * center_falloff * plateau_falloff); - //density *= Math.pow( noise((xf+1)*3.0F, (yf+1)*3.0F, (zf+1)*3.0F)+0.4, 1.8F); -// if(caves<0.5){ -// density = 0; -// } + // density *= Math.pow( noise((xf+1)*3.0F, (yf+1)*3.0F, (zf+1)*3.0F)+0.4, 1.8F); + // if(caves<0.5){ + // density = 0; + // } - //put(x, y, z, density>3.1 ? ROCK : 0); - //endfor + // put(x, y, z, density>3.1 ? ROCK : 0); + // endfor -// public float dot(float x, float y, float z, float... g){ -// return x*g[0] + y*g[1] + z*g[2]; -// } -// -//public static int[] perm = {151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180, 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180}; -// -// public float[][] grad = { -// {1.0F,1.0F,0.0F},{-1.0F,1.0F,0.0F},{1.0F,-1.0F,0.0F},{-1.0F,-1.0F,0.0F}, -// {1.0F,0.0F,1.0F},{-1.0F,0.0F,1.0F},{1.0F,0.0F,-1.0F},{-1.0F,0.0F,-1.0F}, -// {0.0F,1.0F,1.0F},{0.0F,-1.0F,1.0F},{0.0F,1.0F,-1.0F},{0.0F,-1.0F,-1.0F} -// }; -// -//public float noise(float xin, float yin, float zin){ -// float F3, G3, t, X0, Y0, Z0, x0, y0, z0, s, x1, y1, z1, x2, y2, z2, x3, y3, z3, t0, t1, t2, t3, n0, n1, n2, n3; -// int i, j, k, ii, jj, kk, i1, j1, k1, i2, j2, k2, gi0, gi1, gi2, gi3; -// -// F3 = 1.0F/3.0F; -// s = (xin+yin+zin)*F3; -// i = (int)(xin+s); -// j = (int)(yin+s); -// k = (int)(zin+s); -// G3 = 1.0F/6.0F; -// t = (i+j+k)*G3; -// X0 = i-t; -// Y0 = j-t; -// Z0 = k-t; -// x0 = xin-X0; -// y0 = yin-Y0; -// z0 = zin-Z0; -// -// if(x0 >= y0){ -// if(y0 >= z0){ -// i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; -// } -// else if(x0 >= z0){ -// i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; -// } -// else{ -// i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; -// } -// } -// else{ -// if(y0 < z0){ -// i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; -// } -// else if(x0 < z0){ -// i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; -// } -// else{ -// i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; -// } -// } -// -// x1 = x0 - i1 + G3; -// y1 = y0 - j1 + G3; -// z1 = z0 - k1 + G3; -// x2 = x0 - i2 + 2.0F*G3; -// y2 = y0 - j2 + 2.0F*G3; -// z2 = z0 - k2 + 2.0F*G3; -// x3 = x0 - 1.0F + 3.0F*G3; -// y3 = y0 - 1.0F + 3.0F*G3; -// z3 = z0 - 1.0F + 3.0F*G3; -// -// ii = i & 255; -// jj = j & 255; -// kk = k & 255; -// -// gi0 = perm[ii+perm[jj+perm[kk]]] % 12; -// gi1 = perm[ii+i1+perm[jj+j1+perm[kk+k1]]] % 12; -// gi2 = perm[ii+i2+perm[jj+j2+perm[kk+k2]]] % 12; -// gi3 = perm[ii+1+perm[jj+1+perm[kk+1]]] % 12; -// -// t0 = 0.6F - x0*x0 - y0*y0 - z0*z0; -// if(t0<0){ -// n0 = 0.0F; -// } -// else{ -// t0 *= t0; -// n0 = t0 * t0 * dot(x0, y0, z0, grad[gi0]); -// } -// -// t1 = 0.6F - x1*x1 - y1*y1 - z1*z1; -// if(t1<0){ -// n1 = 0.0F; -// } -// else{ -// t1 *= t1; -// n1 = t1 * t1 * dot(x1, y1, z1, grad[gi1]); -// } -// -// t2 = 0.6F - x2*x2 - y2*y2 - z2*z2; -// if(t2<0){ -// n2 = 0.0F; -// } -// else{ -// t2 *= t2; -// n2 = t2 * t2 * dot(x2, y2, z2, grad[gi2]); -// } -// -// t3 = 0.6F - x3*x3 - y3*y3 - z3*z3; -// if(t3<0){ -// n3 = 0.0F; -// } -// else{ -// t3 *= t3; -// n3 = t3 * t3 * dot(x3, y3, z3, grad[gi3]); -// } -// -// return 16.0F*(n0 + n1 + n2 + n3)+1.0F; -// } -// -// public float simplex_noise(int octaves, float x, float y, float z){ -// float value = 0.0F; -// int i; -// for(i=0; i= y0){ + // if(y0 >= z0){ + // i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; + // } + // else if(x0 >= z0){ + // i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; + // } + // else{ + // i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; + // } + // } + // else{ + // if(y0 < z0){ + // i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; + // } + // else if(x0 < z0){ + // i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; + // } + // else{ + // i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; + // } + // } + // + // x1 = x0 - i1 + G3; + // y1 = y0 - j1 + G3; + // z1 = z0 - k1 + G3; + // x2 = x0 - i2 + 2.0F*G3; + // y2 = y0 - j2 + 2.0F*G3; + // z2 = z0 - k2 + 2.0F*G3; + // x3 = x0 - 1.0F + 3.0F*G3; + // y3 = y0 - 1.0F + 3.0F*G3; + // z3 = z0 - 1.0F + 3.0F*G3; + // + // ii = i & 255; + // jj = j & 255; + // kk = k & 255; + // + // gi0 = perm[ii+perm[jj+perm[kk]]] % 12; + // gi1 = perm[ii+i1+perm[jj+j1+perm[kk+k1]]] % 12; + // gi2 = perm[ii+i2+perm[jj+j2+perm[kk+k2]]] % 12; + // gi3 = perm[ii+1+perm[jj+1+perm[kk+1]]] % 12; + // + // t0 = 0.6F - x0*x0 - y0*y0 - z0*z0; + // if(t0<0){ + // n0 = 0.0F; + // } + // else{ + // t0 *= t0; + // n0 = t0 * t0 * dot(x0, y0, z0, grad[gi0]); + // } + // + // t1 = 0.6F - x1*x1 - y1*y1 - z1*z1; + // if(t1<0){ + // n1 = 0.0F; + // } + // else{ + // t1 *= t1; + // n1 = t1 * t1 * dot(x1, y1, z1, grad[gi1]); + // } + // + // t2 = 0.6F - x2*x2 - y2*y2 - z2*z2; + // if(t2<0){ + // n2 = 0.0F; + // } + // else{ + // t2 *= t2; + // n2 = t2 * t2 * dot(x2, y2, z2, grad[gi2]); + // } + // + // t3 = 0.6F - x3*x3 - y3*y3 - z3*z3; + // if(t3<0){ + // n3 = 0.0F; + // } + // else{ + // t3 *= t3; + // n3 = t3 * t3 * dot(x3, y3, z3, grad[gi3]); + // } + // + // return 16.0F*(n0 + n1 + n2 + n3)+1.0F; + // } + // + // public float simplex_noise(int octaves, float x, float y, float z){ + // float value = 0.0F; + // int i; + // for(i=0; i= offPoint && (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) >= offPoint && (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY, spawnZ)) <= r) { -// -// int dist = (int) Math.sqrt((x-spawnX)*(x-spawnX) + (y-spawnY)*(y-spawnY) + (z-spawnZ)*(z-spawnZ)); -// -// int diffusionPCt = getDiffusionPct(dist - diffStart, size - diffStart); -// int yRand = (int) (Math.max(0, getDiffusionPctD(dist - 40, size - 40)) * (double) (40 - rand.nextInt(80))); -// -// if (dist <= diffStart) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (dist < (int) ((double) size * 0.3D) && diffusionPCt > rand.nextInt(3000)) { -// if (0.95F > rand.nextFloat()) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); -// } -// } -// else if (dist < (int) ((double) size * 0.4D) && diffusionPCt > rand.nextInt(4000)) { -// if (0.95F > rand.nextFloat()) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); -// } -// } -// else if (dist < (int) ((double) size * 0.5D) && diffusionPCt > rand.nextInt(5000)) { -// if (0.95F > rand.nextFloat()) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); -// } -// } -// else if (dist < (int) ((double) size * 0.6D) && diffusionPCt > rand.nextInt(6000)) { -// if (0.95F > rand.nextFloat()) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); -// } -// } -// else if (dist < (int) ((double) size * 0.7D) && diffusionPCt > rand.nextInt(7000)) { -// if (0.95F > rand.nextFloat()) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); -// } -// } -// else if (dist < (int) ((double) size * 0.8D) && diffusionPCt > rand.nextInt(8000)) { -// if (0.95F > rand.nextFloat()) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); -// } -// } -// else if (diffusionPCt > rand.nextInt(9000)) { -// if (0.95F > rand.nextFloat()) { -// if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); -// } -// } -// else if (world.isAirBlock(x, y + yRand, z)) { -// world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); -// } -// } -// } -// } -// } -// } -// } + // private void generateCentre(BlockCollection world, Random rand) { + // int centreThikness = 10; //multiplied by 2 and + 1 + // int curve = 2; + // int diffStart = 20;//(int)((double)size * 0.1D); + // int r = size; + // int offPoint = size * curve; + // + // for (int x = spawnX - r; x <= spawnX + r; x++) { + // for (int z = spawnZ - r; z <= spawnZ + r; z++) { + // for (int y = spawnY - (r / 2); y <= spawnY + (r / 2); y++) { + // if ((int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY + offPoint + centreThikness, spawnZ)) >= offPoint + // && (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) >= offPoint && + // (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY, spawnZ)) <= r) { + // + // int dist = (int) Math.sqrt((x-spawnX)*(x-spawnX) + (y-spawnY)*(y-spawnY) + (z-spawnZ)*(z-spawnZ)); + // + // int diffusionPCt = getDiffusionPct(dist - diffStart, size - diffStart); + // int yRand = (int) (Math.max(0, getDiffusionPctD(dist - 40, size - 40)) * (double) (40 - rand.nextInt(80))); + // + // if (dist <= diffStart) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.3D) && diffusionPCt > rand.nextInt(3000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.4D) && diffusionPCt > rand.nextInt(4000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.5D) && diffusionPCt > rand.nextInt(5000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.6D) && diffusionPCt > rand.nextInt(6000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.7D) && diffusionPCt > rand.nextInt(7000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.8D) && diffusionPCt > rand.nextInt(8000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (diffusionPCt > rand.nextInt(9000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // } + // } + // } + // } + // } private int getDiffusionPct(int dist, int maxDist) { double d = (double) dist / (double) maxDist; @@ -430,96 +454,96 @@ public class WorldGenChaosIsland { private void generateObelisks(BlockCollection world, Random rand) { -// for (int i = 0; i < 7; i++) { -// double rotation = i * 0.9D; -// int sX = spawnX + (int) (Math.sin(rotation) * 35D); -// int sZ = spawnZ + (int) (Math.cos(rotation) * 35D); -// generateObelisk(world, sX, spawnY + 10, sZ, false, rand); -// } -// -// for (int i = 0; i < 14; i++) { -// double rotation = i * 0.45D; -// int sX = spawnX + (int) (Math.sin(rotation) * 70D); -// int sZ = spawnZ + (int) (Math.cos(rotation) * 70D); -// generateObelisk(world, sX, spawnY + 10, sZ, true, rand); -// } + // for (int i = 0; i < 7; i++) { + // double rotation = i * 0.9D; + // int sX = spawnX + (int) (Math.sin(rotation) * 35D); + // int sZ = spawnZ + (int) (Math.cos(rotation) * 35D); + // generateObelisk(world, sX, spawnY + 10, sZ, false, rand); + // } + // + // for (int i = 0; i < 14; i++) { + // double rotation = i * 0.45D; + // int sX = spawnX + (int) (Math.sin(rotation) * 70D); + // int sZ = spawnZ + (int) (Math.cos(rotation) * 70D); + // generateObelisk(world, sX, spawnY + 10, sZ, true, rand); + // } } private void generateObelisk(BlockCollection world, int x1, int y1, int z1, boolean outer, Random rand) { -// if (!outer) { -// world.setBlock(x1, y1 + 20, z1, ModBlocks.infusedObsidian, 0, 2); -//// if (!world.isRemote) { -//// EntityChaosCrystal crystal = new EntityChaosCrystal(world); -//// crystal.setPosition(x1 + 0.5, y1 + 21, z1 + 0.5); -//// world.spawnEntityInWorld(crystal); -//// } -// for (int y = y1; y < y1 + 20; y++) { -// world.setBlock(x1, y, z1, Blocks.obsidian, 0, 2); -// world.setBlock(x1 + 1, y, z1, Blocks.obsidian, 0, 2); -// world.setBlock(x1 - 1, y, z1, Blocks.obsidian, 0, 2); -// world.setBlock(x1, y, z1 + 1, Blocks.obsidian, 0, 2); -// world.setBlock(x1, y, z1 - 1, Blocks.obsidian, 0, 2); -// world.setBlock(x1 + 1, y, z1 + 1, Blocks.obsidian, 0, 2); -// world.setBlock(x1 - 1, y, z1 - 1, Blocks.obsidian, 0, 2); -// world.setBlock(x1 + 1, y, z1 - 1, Blocks.obsidian, 0, 2); -// world.setBlock(x1 - 1, y, z1 + 1, Blocks.obsidian, 0, 2); -// } -// } else { -// world.setBlock(x1, y1 + 40, z1, ModBlocks.infusedObsidian, 0, 2); -//// if (!world.isRemote) { -//// EntityChaosCrystal crystal = new EntityChaosCrystal(world); -//// crystal.setPosition(x1 + 0.5, y1 + 41, z1 + 0.5); -//// world.spawnEntityInWorld(crystal); -//// } -// int diff = 0; -// for (int y = y1 + 20; y < y1 + 40; y++) { -// diff++; -// double pct = (double) diff / 25D; -// int r = 3; -// for (int x = x1 - r; x <= x1 + r; x++) { -// for (int z = z1 - r; z <= z1 + r; z++) { -// if (Utills.getDistanceAtoB(x, z, x1, z1) <= r) { -// if (pct > rand.nextDouble()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); -// } -// } -// } -// } -// -// -// int cageS = 2; -// for (int x = x1 - cageS; x <= x1 + cageS; x++) { -// for (int y = y1 - cageS; y <= y1 + cageS; y++) { -// if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 + cageS, Blocks.iron_bars, 0, 2); -// if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 - cageS, Blocks.iron_bars, 0, 2); -// } -// } -// for (int z = z1 - cageS; z <= z1 + cageS; z++) { -// for (int y = y1 - cageS; y <= y1 + cageS; y++) { -// if (0.8F > rand.nextFloat()) world.setBlock(x1 + cageS, y + 41, z, Blocks.iron_bars, 0, 2); -// if (0.8F > rand.nextFloat()) world.setBlock(x1 - cageS, y + 41, z, Blocks.iron_bars, 0, 2); -// } -// } -// for (int z = z1 - cageS; z <= z1 + cageS; z++) { -// for (int x = x1 - cageS; x <= x1 + cageS; x++) { -// if (0.8F > rand.nextFloat()) world.setBlock(x, y1 + 44, z, Blocks.stone_slab, 6, 2); -// } -// } -// -// } + // if (!outer) { + // world.setBlock(x1, y1 + 20, z1, ModBlocks.infusedObsidian, 0, 2); + //// if (!world.isRemote) { + //// EntityChaosCrystal crystal = new EntityChaosCrystal(world); + //// crystal.setPosition(x1 + 0.5, y1 + 21, z1 + 0.5); + //// world.spawnEntityInWorld(crystal); + //// } + // for (int y = y1; y < y1 + 20; y++) { + // world.setBlock(x1, y, z1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 + 1, y, z1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 - 1, y, z1, Blocks.obsidian, 0, 2); + // world.setBlock(x1, y, z1 + 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1, y, z1 - 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 + 1, y, z1 + 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 - 1, y, z1 - 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 + 1, y, z1 - 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 - 1, y, z1 + 1, Blocks.obsidian, 0, 2); + // } + // } else { + // world.setBlock(x1, y1 + 40, z1, ModBlocks.infusedObsidian, 0, 2); + //// if (!world.isRemote) { + //// EntityChaosCrystal crystal = new EntityChaosCrystal(world); + //// crystal.setPosition(x1 + 0.5, y1 + 41, z1 + 0.5); + //// world.spawnEntityInWorld(crystal); + //// } + // int diff = 0; + // for (int y = y1 + 20; y < y1 + 40; y++) { + // diff++; + // double pct = (double) diff / 25D; + // int r = 3; + // for (int x = x1 - r; x <= x1 + r; x++) { + // for (int z = z1 - r; z <= z1 + r; z++) { + // if (Utills.getDistanceAtoB(x, z, x1, z1) <= r) { + // if (pct > rand.nextDouble()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); + // } + // } + // } + // } + // + // + // int cageS = 2; + // for (int x = x1 - cageS; x <= x1 + cageS; x++) { + // for (int y = y1 - cageS; y <= y1 + cageS; y++) { + // if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 + cageS, Blocks.iron_bars, 0, 2); + // if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 - cageS, Blocks.iron_bars, 0, 2); + // } + // } + // for (int z = z1 - cageS; z <= z1 + cageS; z++) { + // for (int y = y1 - cageS; y <= y1 + cageS; y++) { + // if (0.8F > rand.nextFloat()) world.setBlock(x1 + cageS, y + 41, z, Blocks.iron_bars, 0, 2); + // if (0.8F > rand.nextFloat()) world.setBlock(x1 - cageS, y + 41, z, Blocks.iron_bars, 0, 2); + // } + // } + // for (int z = z1 - cageS; z <= z1 + cageS; z++) { + // for (int x = x1 - cageS; x <= x1 + cageS; x++) { + // if (0.8F > rand.nextFloat()) world.setBlock(x, y1 + 44, z, Blocks.stone_slab, 6, 2); + // } + // } + // + // } } private void generateBelt(BlockCollection world, Random random, int innerRadius, int outerRadius) { -// int r = outerRadius; -// for (int x = spawnX - r; x <= spawnX + r; x++) { -// for (int z = spawnZ - r; z <= spawnZ + r; z++) { -// int dist = (int) (Utills.getDistanceAtoB(x, z, spawnX, spawnZ)); -// if (dist < outerRadius && dist >= innerRadius) { -// int y = spawnY + (int) ((double) (spawnX - x) * 0.2D) + (random.nextInt(10) - 5); -// if (0.1F > random.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); -// if (0.001F > random.nextFloat()) world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2); -// } -// } -// } + // int r = outerRadius; + // for (int x = spawnX - r; x <= spawnX + r; x++) { + // for (int z = spawnZ - r; z <= spawnZ + r; z++) { + // int dist = (int) (Utills.getDistanceAtoB(x, z, spawnX, spawnZ)); + // if (dist < outerRadius && dist >= innerRadius) { + // int y = spawnY + (int) ((double) (spawnX - x) * 0.2D) + (random.nextInt(10) - 5); + // if (0.1F > random.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); + // if (0.001F > random.nextFloat()) world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2); + // } + // } + // } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java index e476d98d..4517a44e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java @@ -1,12 +1,11 @@ package com.brandon3055.draconicevolution.common.world; import com.brandon3055.draconicevolution.common.ModBlocks; +import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -import java.util.Random; - /** * Created by Brandon on 28/08/2014. */ @@ -81,7 +80,6 @@ public class WorldGenEnderComet extends WorldGenerator { density = 1000 - (int) (pc * 10000); generateTrailSphere(world, cX, cY, cZ, (size + 3) - (int) (pc * (size - 2)), density, rand); - } } @@ -91,7 +89,9 @@ public class WorldGenEnderComet extends WorldGenerator { for (int x = xi - r; x <= xi + r; x++) { for (int z = zi - r; z <= zi + r; z++) { for (int y = yi - r; y <= yi + r; y++) { - if ((density >= rand.nextInt(10000)) && world.isAirBlock(x, y, z) && (int) (getDistance(x, y, z, xi, yi, zi)) == r) { + if ((density >= rand.nextInt(10000)) + && world.isAirBlock(x, y, z) + && (int) (getDistance(x, y, z, xi, yi, zi)) == r) { if (0.9F >= rand.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); else if (rand.nextBoolean()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); else world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2); @@ -108,4 +108,3 @@ public class WorldGenEnderComet extends WorldGenerator { return Math.sqrt((dx * dx + dy * dy + dz * dz)); } } - diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java index 4e44cbee..83131545 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java @@ -3,12 +3,11 @@ package com.brandon3055.draconicevolution.common.world; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal; import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; +import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -import java.util.Random; - /** * Created by Brandon on 29/08/2014. */ @@ -23,15 +22,15 @@ public class WorldGenEnderIsland extends WorldGenerator { spawnX = x; spawnY = y; spawnZ = z; - size = 150;// + rand.nextInt(8); + size = 150; // + rand.nextInt(8); } @Override public boolean generate(World world, Random random, int x, int y, int z) { - //LogHelper.info("Generate"); + // LogHelper.info("Generate"); for (int y1 = y - 10; y1 < y + 10; y1++) { if (world.getBlock(x, y1, z) == Blocks.end_stone) { - //LogHelper.info("cancel"); + // LogHelper.info("cancel"); return false; } } @@ -46,19 +45,23 @@ public class WorldGenEnderIsland extends WorldGenerator { } private void generateCentre(World world, Random rand) { - int centreThikness = 10; //multiplied by 2 and + 1 + int centreThikness = 10; // multiplied by 2 and + 1 int curve = 2; - int diffStart = 20;//(int)((double)size * 0.1D); + int diffStart = 20; // (int)((double)size * 0.1D); int r = size; int offPoint = size * curve; for (int x = spawnX - r; x <= spawnX + r; x++) { for (int z = spawnZ - r; z <= spawnZ + r; z++) { for (int y = spawnY - (r / 2); y <= spawnY + (r / 2); y++) { - if ((int) (getDistance(x, y, z, spawnX, spawnY + offPoint + centreThikness, spawnZ)) >= offPoint && (int) (getDistance(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) >= offPoint && (int) (getDistance(x, y, z, spawnX, spawnY, spawnZ)) <= r) { + if ((int) (getDistance(x, y, z, spawnX, spawnY + offPoint + centreThikness, spawnZ)) >= offPoint + && (int) (getDistance(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) + >= offPoint + && (int) (getDistance(x, y, z, spawnX, spawnY, spawnZ)) <= r) { int dist = (int) getDistance(x, y, z, spawnX, spawnY, spawnZ); int diffusionPCt = getDiffusionPct(dist - diffStart, size - diffStart); - int yRand = (int) (Math.max(0, getDiffusionPctD(dist - 40, size - 40)) * (double) (40 - rand.nextInt(80))); + int yRand = (int) (Math.max(0, getDiffusionPctD(dist - 40, size - 40)) + * (double) (40 - rand.nextInt(80))); if (dist <= diffStart) { if (world.isAirBlock(x, y + yRand, z)) world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); @@ -137,7 +140,6 @@ public class WorldGenEnderIsland extends WorldGenerator { int sZ = spawnZ + (int) (Math.cos(rotation) * 70D); generateObelisk(world, sX, spawnY + 10, sZ, true, rand); } - } private void generateObelisk(World world, int x1, int y1, int z1, boolean outer, Random rand) { @@ -180,7 +182,6 @@ public class WorldGenEnderIsland extends WorldGenerator { } } - int cageS = 2; for (int x = x1 - cageS; x <= x1 + cageS; x++) { for (int y = y1 - cageS; y <= y1 + cageS; y++) { @@ -199,7 +200,6 @@ public class WorldGenEnderIsland extends WorldGenerator { if (0.8F > rand.nextFloat()) world.setBlock(x, y1 + 44, z, Blocks.stone_slab, 6, 2); } } - } } diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java b/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java index 3fdd7bd6..d347f258 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java @@ -15,12 +15,12 @@ public class ModHelper { private static boolean isTConInstalled; private static boolean isAvaritiaInstalled; - //private static boolean isRotaryCraftInstalled; + // private static boolean isRotaryCraftInstalled; private static boolean isGregTechInstalled; private static Item cleaver; private static Item avaritiaSword; - //private static Item bedrockSword; + // private static Item bedrockSword; private static Class bwores; private static Class GTores; @@ -28,43 +28,52 @@ public class ModHelper { static { isTConInstalled = Loader.isModLoaded("TConstruct"); isAvaritiaInstalled = Loader.isModLoaded("Avaritia"); - //isRotaryCraftInstalled = Loader.isModLoaded("RotaryCraft"); + // isRotaryCraftInstalled = Loader.isModLoaded("RotaryCraft"); isGregTechInstalled = Loader.isModLoaded("gregtech"); if (isGregTechInstalled) try { GTores = Class.forName("gregtech.common.blocks.GT_TileEntity_Ores"); - } catch (ClassNotFoundException e) {} + } catch (ClassNotFoundException e) { + } if (Loader.isModLoaded("bartworks")) try { bwores = Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE"); - } catch (ClassNotFoundException e) {} + } catch (ClassNotFoundException e) { + } } public static boolean isHoldingCleaver(EntityPlayer player) { if (!isTConInstalled) return false; else if (cleaver == null) cleaver = GameRegistry.findItem("TConstruct", "cleaver"); - return cleaver != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(cleaver); + return cleaver != null + && player.getHeldItem() != null + && player.getHeldItem().getItem().equals(cleaver); } public static boolean isHoldingAvaritiaSword(EntityPlayer player) { if (!isAvaritiaInstalled) return false; else if (avaritiaSword == null) avaritiaSword = GameRegistry.findItem("Avaritia", "Infinity_Sword"); - return avaritiaSword != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(avaritiaSword); + return avaritiaSword != null + && player.getHeldItem() != null + && player.getHeldItem().getItem().equals(avaritiaSword); } -// public static boolean isHoldingBedrockSword(EntityPlayer player) { -// if (!isRotaryCraftInstalled) return false; -// else if (bedrockSword == null) bedrockSword = GameRegistry.findItem("RotaryCraft", "rotarycraft_item_bedsword"); -// -// return bedrockSword != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(bedrockSword); -// } + // public static boolean isHoldingBedrockSword(EntityPlayer player) { + // if (!isRotaryCraftInstalled) return false; + // else if (bedrockSword == null) bedrockSword = GameRegistry.findItem("RotaryCraft", + // "rotarycraft_item_bedsword"); + // + // return bedrockSword != null && player.getHeldItem() != null && + // player.getHeldItem().getItem().equals(bedrockSword); + // } public static float applyModDamageAdjustments(ArmorSummery summery, LivingAttackEvent event) { if (summery == null) return event.ammount; - EntityPlayer attacker = event.source.getEntity() instanceof EntityPlayer ? (EntityPlayer) event.source.getEntity() : null; + EntityPlayer attacker = + event.source.getEntity() instanceof EntityPlayer ? (EntityPlayer) event.source.getEntity() : null; if (attacker == null) { return event.ammount; @@ -74,15 +83,15 @@ public class ModHelper { event.entityLiving.hurtResistantTime = 0; return 300F; } -// else if (isHoldingBedrockSword(attacker)) { -// summery.entropy += 10; -// -// if (summery.entropy > 100) { -// summery.entropy = 100; -// } -// -// return Math.max(event.ammount, Math.min(50F, summery.protectionPoints)); -// } + // else if (isHoldingBedrockSword(attacker)) { + // summery.entropy += 10; + // + // if (summery.entropy > 100) { + // summery.entropy = 100; + // } + // + // return Math.max(event.ammount, Math.min(50F, summery.protectionPoints)); + // } else if (event.source.isUnblockable() || event.source.canHarmInCreative()) { summery.entropy += 3; @@ -97,7 +106,7 @@ public class ModHelper { } public static boolean isGregTechTileEntityOre(TileEntity te) { - return isGregTechInstalled && GTores.isInstance(te) || isGregTechInstalled && Loader.isModLoaded("bartworks") && bwores.isInstance(te); + return isGregTechInstalled && GTores.isInstance(te) + || isGregTechInstalled && Loader.isModLoaded("bartworks") && bwores.isInstance(te); } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java b/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java index 06d7fc8b..5cc91b47 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java @@ -56,5 +56,4 @@ public class CCOCIntegration { } else return null; } } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java b/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java index 920c6156..e89c2125 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java @@ -27,22 +27,20 @@ public class CCAdapter implements IPeripheral { } @Override - public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException { + public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) + throws LuaException, InterruptedException { try { return peripheral.callMethod(peripheral.getMethodNames()[method], arguments); - } - catch (Exception e) { + } catch (Exception e) { throw new LuaException(e.getMessage()); } } @Override - public void attach(IComputerAccess iComputerAccess) { - } + public void attach(IComputerAccess iComputerAccess) {} @Override - public void detach(IComputerAccess iComputerAccess) { - } + public void detach(IComputerAccess iComputerAccess) {} @Override public boolean equals(IPeripheral iPeripheral) { diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java index 91209148..419aa7b5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java @@ -7,13 +7,12 @@ import codechicken.nei.api.IOverlayHandler; import codechicken.nei.recipe.IRecipeHandler; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import com.brandon3055.draconicevolution.common.utills.LogHelper; +import java.util.*; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import java.util.*; - /** * Created by Brandon on 30/10/2014. */ @@ -131,13 +130,13 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { return quantity; } - private Slot[][] assignIngredSlots(GuiContainer gui, List ingredients, List assignedIngredients) { - Slot[][] recipeSlots = mapIngredSlots(gui, ingredients);//setup the slot map + private Slot[][] assignIngredSlots( + GuiContainer gui, List ingredients, List assignedIngredients) { + Slot[][] recipeSlots = mapIngredSlots(gui, ingredients); // setup the slot map HashMap distribution = new HashMap(); for (int i = 0; i < recipeSlots.length; i++) - for (Slot slot : recipeSlots[i]) - if (!distribution.containsKey(slot)) distribution.put(slot, -1); + for (Slot slot : recipeSlots[i]) if (!distribution.containsKey(slot)) distribution.put(slot, -1); HashSet avaliableSlots = new HashSet(distribution.keySet()); HashSet remainingIngreds = new HashSet(); @@ -175,9 +174,10 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { return recipeSlots; } - private List assignIngredients(List ingredients, List ingredStacks) { + private List assignIngredients( + List ingredients, List ingredStacks) { ArrayList assignedIngredients = new ArrayList(); - for (PositionedStack posstack : ingredients)//assign what we need and have + for (PositionedStack posstack : ingredients) // assign what we need and have { DistributedIngred biggestIngred = null; ItemStack permutation = null; @@ -186,10 +186,12 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { if (pstack.stackSize == 0) continue; for (int j = 0; j < ingredStacks.size(); j++) { DistributedIngred istack = ingredStacks.get(j); - if (!InventoryUtils.canStack(pstack, istack.stack) || istack.invAmount - istack.distributed < pstack.stackSize) - continue; - LogHelper.info(istack.invAmount - istack.invAmount + " " + istack.recipeAmount * istack.distributed + " " + pstack.stackSize); - int relsize = (istack.invAmount - istack.invAmount / istack.recipeAmount * istack.distributed) / pstack.stackSize; + if (!InventoryUtils.canStack(pstack, istack.stack) + || istack.invAmount - istack.distributed < pstack.stackSize) continue; + LogHelper.info(istack.invAmount - istack.invAmount + " " + istack.recipeAmount * istack.distributed + + " " + pstack.stackSize); + int relsize = (istack.invAmount - istack.invAmount / istack.recipeAmount * istack.distributed) + / pstack.stackSize; if (relsize > biggestSize) { biggestSize = relsize; biggestIngred = istack; @@ -199,9 +201,8 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { } } - if (biggestIngred == null)//not enough ingreds - return null; - + if (biggestIngred == null) // not enough ingreds + return null; biggestIngred.distributed += permutation.stackSize; assignedIngredients.add(new IngredientDistribution(biggestIngred, permutation)); @@ -211,7 +212,7 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { } private void findInventoryQuantities(GuiContainer gui, List ingredStacks) { - for (Slot slot : (List) gui.inventorySlots.inventorySlots)//work out how much we have to go round + for (Slot slot : (List) gui.inventorySlots.inventorySlots) // work out how much we have to go round { if (slot.getHasStack() && canMoveFrom(slot, gui)) { ItemStack pstack = slot.getStack(); @@ -223,7 +224,7 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { private List getPermutationIngredients(List ingredients) { ArrayList ingredStacks = new ArrayList(); - for (PositionedStack posstack : ingredients)//work out what we need + for (PositionedStack posstack : ingredients) // work out what we need { for (ItemStack pstack : posstack.items) { DistributedIngred istack = findIngred(ingredStacks, pstack); @@ -242,7 +243,7 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { int offsetx = getOffsetX(gui); int offsety = getOffsetY(gui); Slot[][] recipeSlotList = new Slot[ingredients.size()][]; - for (int i = 0; i < ingredients.size(); i++)//identify slots + for (int i = 0; i < ingredients.size(); i++) // identify slots { LinkedList recipeSlots = new LinkedList(); PositionedStack pstack = ingredients.get(i); @@ -258,8 +259,7 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { } public DistributedIngred findIngred(List ingredStacks, ItemStack pstack) { - for (DistributedIngred istack : ingredStacks) - if (InventoryUtils.canStack(pstack, istack.stack)) return istack; + for (DistributedIngred istack : ingredStacks) if (InventoryUtils.canStack(pstack, istack.stack)) return istack; return null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java index cc56b41f..7c1fe5aa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java @@ -5,9 +5,8 @@ import codechicken.nei.api.IStackPositioner; import codechicken.nei.recipe.GuiRecipe; import com.brandon3055.draconicevolution.client.gui.GUIDraconiumChest; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import net.minecraft.client.Minecraft; - import java.util.ArrayList; +import net.minecraft.client.Minecraft; /** * Created by Brandon on 30/10/2014. @@ -38,5 +37,4 @@ public class CraftingChestStackPositioner implements IStackPositioner { return stacks; } - } diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java index 2eae9aa9..45555bbc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java @@ -6,11 +6,10 @@ import codechicken.nei.api.TaggedInventoryArea; import com.brandon3055.draconicevolution.client.gui.GUIUpgradeModifier; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; - import java.util.Collections; import java.util.List; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; /** * Created by brandon3055 on 27/1/2016. diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java index 350620f7..1a3290ba 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java @@ -43,5 +43,4 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI { public String getVersion() { return References.VERSION; } - }