Search in sources :

Example 1 with AMFlower

use of am2.blocks.AMFlower in project ArsMagica2 by Mithion.

the class BlocksCommonProxy method InstantiateBlocks.

public void InstantiateBlocks() {
    essenceRefiner = new BlockEssenceRefiner().setUnlocalizedNameAndID("arsmagica2:essence_refiner").setCreativeTab(blockTab);
    blockMageTorch = new BlockMageLight().setUnlocalizedNameAndID("arsmagica2:magetorch").setCreativeTab(blockTab);
    illusionBlock = (IllusionBlock) new IllusionBlock().setUnlocalizedNameAndID("arsmagica2:illusionBlock").setCreativeTab(blockTab);
    essenceConduit = new BlockEssenceConduit().setUnlocalizedNameAndID("arsmagica2:essenceconduit").setCreativeTab(blockTab);
    obelisk = new BlockEssenceGenerator(BlockEssenceGenerator.NEXUS_STANDARD).setUnlocalizedNameAndID("arsmagica2:obelisk").setCreativeTab(blockTab);
    calefactor = new BlockCalefactor().setUnlocalizedNameAndID("arsmagica2:calefactor").setCreativeTab(blockTab);
    keystoneRecepticle = (BlockKeystoneReceptacle) new BlockKeystoneReceptacle().setUnlocalizedNameAndID("arsmagica2:blockkeystonerecepticle").setCreativeTab(blockTab);
    astralBarrier = new BlockAstralBarrier().setUnlocalizedNameAndID("arsmagica2:blockastralbarrier").setCreativeTab(blockTab);
    blackAurem = new BlockEssenceGenerator(BlockEssenceGenerator.NEXUS_DARK).setUnlocalizedNameAndID("arsmagica2:blackaurem").setCreativeTab(blockTab);
    seerStone = new BlockSeerStone().setUnlocalizedNameAndID("arsmagica2:blockseerstone").setCreativeTab(blockTab);
    celestialPrism = new BlockEssenceGenerator(BlockEssenceGenerator.NEXUS_LIGHT).setUnlocalizedNameAndID("arsmagica2:celestialprism").setCreativeTab(blockTab);
    AMOres = (BlockAMOre) new BlockAMOre().setBlockName("arsmagica2:ores").setHardness(3.0f).setResistance(3.0f).setCreativeTab(blockTab);
    cerublossom = (AMFlower) new AMFlower().setUnlocalizedNameAndID("arsmagica2:cerublossom").setLightLevel(0.325f).setCreativeTab(blockTab);
    desertNova = (BlockDesertNova) new BlockDesertNova().setUnlocalizedNameAndID("arsmagica2:desert_nova").setCreativeTab(blockTab);
    keystoneChest = (BlockKeystoneChest) new BlockKeystoneChest().setUnlocalizedNameAndID("arsmagica2:keystonechest").setCreativeTab(blockTab);
    blockLectern = new BlockLectern().setUnlocalizedNameAndID("arsmagica2:lectern").setCreativeTab(blockTab);
    blockArcaneReconstructor = new BlockArcaneReconstructor().setUnlocalizedNameAndID("arsmagica2:arcanereconstructor").setCreativeTab(blockTab);
    manaBattery = new BlockManaBattery().setUnlocalizedNameAndID("arsmagica2:mana_battery").setCreativeTab(blockTab);
    magicWall = new BlockMagicWall().setUnlocalizedNameAndID("arsmagica2:magicWall").setCreativeTab(blockTab);
    occulus = new BlockOcculus().setUnlocalizedNameAndID("arsmagica2:occulus").setCreativeTab(blockTab);
    craftingAltar = (BlockCraftingAltar) new BlockCraftingAltar().setUnlocalizedNameAndID("arsmagica2:altarOfCreation").setCreativeTab(blockTab);
    spellRune = (BlockGroundRuneSpell) new BlockGroundRuneSpell().setUnlocalizedNameAndID("arsmagica2:spellRune");
    particleEmitter = (BlockParticleEmitter) new BlockParticleEmitter().setUnlocalizedNameAndID("arsmagica2:particleEmitter").setCreativeTab(blockTab);
    vinteumTorch = (VinteumTorch) new VinteumTorch().setBlockName("arsmagica2:vinteumTorch").setCreativeTab(blockTab);
    inscriptionTable = (BlockInscriptionTable) new BlockInscriptionTable().setUnlocalizedNameAndID("arsmagica2:inscriptionTable").setCreativeTab(blockTab);
    invisibleUtility = (BlockInvisibleUtility) new BlockInvisibleUtility().setUnlocalizedNameAndID("arsmagica2:invisibleUtility");
    aum = (AMFlower) new AMFlower().setUnlocalizedNameAndID("arsmagica2:aum").setCreativeTab(blockTab);
    wakebloom = (BlockWakebloom) new BlockWakebloom().setUnlocalizedNameAndID("arsmagica2:wakebloom").setCreativeTab(blockTab);
    tarmaRoot = (BlockTarmaRoot) new BlockTarmaRoot().setUnlocalizedNameAndID("arsmagica2:tarmaroot").setCreativeTab(blockTab);
    witchwoodLog = (BlockWitchwoodLog) new BlockWitchwoodLog().setBlockName("arsmagica2:witchwoodlog").setCreativeTab(blockTab);
    witchwoodLeaves = (BlockWitchwoodLeaves) new BlockWitchwoodLeaves().setBlockName("arsmagica2:witchwoodleaves").setCreativeTab(blockTab);
    summoner = (BlockSummoner) new BlockSummoner().setUnlocalizedNameAndID("arsmagica2:summoner").setCreativeTab(blockTab);
    liquidEssence = (BlockLiquidEssence) new BlockLiquidEssence().setBlockName("arsmagica2:liquidEssence");
    redstoneInlay = (BlockInlay) new BlockInlay(BlockInlay.TYPE_REDSTONE).setBlockName("arsmagica2:redstone_inlay").setCreativeTab(blockTab);
    ironInlay = (BlockInlay) new BlockInlay(BlockInlay.TYPE_IRON).setBlockName("arsmagica2:iron_inlay").setCreativeTab(blockTab);
    goldInlay = (BlockInlay) new BlockInlay(BlockInlay.TYPE_GOLD).setBlockName("arsmagica2:gold_inlay").setCreativeTab(blockTab);
    witchwoodPlanks = (WitchwoodPlanks) new WitchwoodPlanks().setBlockName("arsmagica2:planksWitchwood").setCreativeTab(blockTab);
    witchwoodSingleSlab = (WitchwoodSlabs) new WitchwoodSlabs(false).setBlockName("arsmagica2:witchwoodSingleSlab").setCreativeTab(blockTab);
    witchwoodDoubleSlab = (WitchwoodSlabs) new WitchwoodSlabs(true).setBlockName("arsmagica2:witchwoodDoubleSlab");
    witchwoodStairs = (WitchwoodStairs) new WitchwoodStairs(witchwoodPlanks, 0).setBlockName("arsmagica2:stairsWitchwood").setCreativeTab(blockTab);
    witchwoodSapling = (WitchwoodSapling) new WitchwoodSapling().setBlockName("arsmagica2:saplingWitchwood").setCreativeTab(blockTab);
    magiciansWorkbench = (BlockMagiciansWorkbench) new BlockMagiciansWorkbench().setBlockName("arsmagica2:magiciansWorkbench").setCreativeTab(blockTab);
    everstone = (BlockEverstone) new BlockEverstone().setBlockName("arsmagica2:everstone").setCreativeTab(blockTab);
    keystoneDoor = (BlockKeystoneDoor) new BlockKeystoneDoor().setBlockName("arsmagica2:keystoneDoor");
    keystoneTrapDoor = (BlockKeystoneTrapdoor) new BlockKeystoneTrapdoor().setBlockName("arsmagica2:keystoneTrapdoor");
    slipstreamGenerator = (BlockSlipstreamGenerator) new BlockSlipstreamGenerator().setBlockName("arsmagica2:slipstreamGenerator").setCreativeTab(blockTab);
    crystalMarker = (BlockCrystalMarker) new BlockCrystalMarker().setBlockName("arsmagica2:crystalMarker").setCreativeTab(blockTab);
    elementalAttuner = (BlockFlickerHabitat) new BlockFlickerHabitat().setBlockName("arsmagica2:flickerHabitat").setCreativeTab(blockTab);
    wizardChalk = (BlockWizardsChalk) new BlockWizardsChalk().setBlockName("arsmagica2:wizardChalk");
    inertSpawner = (BlockInertSpawner) new BlockInertSpawner().setBlockName("arsmagica2:inertSpawner").setCreativeTab(blockTab);
    candle = (BlockCandle) new BlockCandle().setBlockName("arsmagica2:candle").setCreativeTab(blockTab);
    brokenLinkBlock = (BlockBrokenPowerLink) new BlockBrokenPowerLink().setBlockName("arsmagica2:brokenLink").setCreativeTab(blockTab);
    armorInfuser = (BlockArmorInfuser) new BlockArmorInfuser().setBlockName("arsmagica2:armor_infuser").setCreativeTab(blockTab);
    flickerLure = (BlockFlickerLure) new BlockFlickerLure().setBlockName("arsmagica2:flicker_lure").setCreativeTab(blockTab);
    arcaneDeconstructor = (BlockArcaneDeconstructor) new BlockArcaneDeconstructor().setBlockName("arsmagica2:arcane_deconstructor").setCreativeTab(blockTab);
    otherworldAura = (BlockOtherworldAura) new BlockOtherworldAura().setBlockName("arsmagica2:otherworld_aura").setCreativeTab(blockTab);
    spellSealedDoor = (BlockSpellSealedDoor) new BlockSpellSealedDoor().setBlockName("arsmagica2:spell_sealed_door");
    blockTab.setIconItemIndex(new ItemBlock(manaBattery));
}
Also used : BlockLiquidEssence(am2.blocks.liquid.BlockLiquidEssence)

Example 2 with AMFlower

use of am2.blocks.AMFlower in project ArsMagica2 by Mithion.

the class Grow method applyEffectBlock.

@Override
public boolean applyEffectBlock(ItemStack stack, World world, int blockx, int blocky, int blockz, int blockFace, double impactX, double impactY, double impactZ, EntityLivingBase caster) {
    Block block = world.getBlock(blockx, blocky, blockz);
    BonemealEvent event = new BonemealEvent(DummyEntityPlayer.fromEntityLiving(caster), world, block, blockx, blocky, blockz);
    if (MinecraftForge.EVENT_BUS.post(event)) {
        return false;
    }
    if (event.getResult() == Result.ALLOW) {
        return true;
    }
    //EoD: Spawn AM2 flowers with 3% chance. This has to be the first one in the list to override all others
    if (world.rand.nextInt(100) < 3 && block.isNormalCube() && (world.getBlock(blockx, blocky + 1, blockz).isAir(null, 0, 0, 0) || world.getBlock(blockx, blocky + 1, blockz) == Blocks.tallgrass)) {
        // shuffle the flower list every time we want to try to find one.
        Collections.shuffle(growableAMflowers);
        for (AMFlower flower : growableAMflowers) {
            if (flower.canGrowOn(world, blockx, blocky + 1, blockz)) {
                if (!world.isRemote) {
                    world.setBlock(blockx, blocky + 1, blockz, flower, 0, 2);
                }
                return true;
            }
        }
    // We did not find a flower or we have been executed on the wrong block. Either way, we continue
    }
    //Grow huge mushrooms 10% of the time.
    if (block instanceof BlockMushroom) {
        if (!world.isRemote && world.rand.nextInt(10) < 1) {
            ((BlockMushroom) block).func_149884_c(world, blockx, blocky, blockz, world.rand);
        }
        return true;
    }
    //If the spell is executed in water, check if we have space for a wakebloom above and create one 3% of the time.
    if (block == Blocks.water) {
        if (world.getBlock(blockx, blocky + 1, blockz) == Blocks.air) {
            if (!world.isRemote && world.rand.nextInt(100) < 3) {
                world.setBlock(blockx, blocky + 1, blockz, BlocksCommonProxy.wakebloom);
            }
            return true;
        }
    }
    //EoD: If there is already tallgrass present, let's grow it further 20% of the time.
    if (block == Blocks.tallgrass) {
        if (Blocks.tallgrass.canBlockStay(world, blockx, blocky + 1, blockz)) {
            if (!world.isRemote && world.rand.nextInt(10) < 2) {
                world.setBlock(blockx, blocky, blockz, Blocks.tallgrass, 1, 2);
            }
            return true;
        }
    }
    //     This works only on podzol in vanilla MC.
    if (block == Blocks.deadbush) {
        if (Blocks.tallgrass.canBlockStay(world, blockx, blocky, blockz)) {
            if (!world.isRemote && world.rand.nextInt(10) < 2) {
                world.setBlock(blockx, blocky, blockz, Blocks.tallgrass, 1, 2);
            }
            return true;
        }
    }
    //      See ItemDye.applyBonemeal().
    if (block instanceof IGrowable) {
        IGrowable igrowable = (IGrowable) block;
        if (igrowable.func_149851_a(world, blockx, blocky, blockz, world.isRemote)) {
            if (!world.isRemote && world.rand.nextInt(10) < 3) {
                if (igrowable.func_149852_a(world, world.rand, blockx, blocky, blockz)) {
                    igrowable.func_149853_b(world, world.rand, blockx, blocky, blockz);
                }
            }
            return true;
        }
    }
    return true;
}
Also used : BonemealEvent(net.minecraftforge.event.entity.player.BonemealEvent) AMFlower(am2.blocks.AMFlower)

Aggregations

AMFlower (am2.blocks.AMFlower)1 BlockLiquidEssence (am2.blocks.liquid.BlockLiquidEssence)1 BonemealEvent (net.minecraftforge.event.entity.player.BonemealEvent)1