Search in sources :

Example 11 with BlockGrowEvent

use of org.bukkit.event.block.BlockGrowEvent in project Glowstone by GlowstoneMC.

the class BlockNetherWart method updateBlock.

@Override
public void updateBlock(GlowBlock block) {
    int cropState = block.getData();
    if (cropState < NetherWartsState.RIPE.ordinal() && random.nextInt(10) == 0) {
        cropState++;
        GlowBlockState state = block.getState();
        state.setRawData((byte) cropState);
        BlockGrowEvent growEvent = new BlockGrowEvent(block, state);
        EventFactory.callEvent(growEvent);
        if (!growEvent.isCancelled()) {
            state.update(true);
        }
    }
}
Also used : GlowBlockState(net.glowstone.block.GlowBlockState) BlockGrowEvent(org.bukkit.event.block.BlockGrowEvent)

Aggregations

GlowBlockState (net.glowstone.block.GlowBlockState)11 BlockGrowEvent (org.bukkit.event.block.BlockGrowEvent)11 GlowBlock (net.glowstone.block.GlowBlock)4 MaterialData (org.bukkit.material.MaterialData)3 Block (org.bukkit.block.Block)2 CocoaPlant (org.bukkit.material.CocoaPlant)2 CocoaPlantSize (org.bukkit.material.CocoaPlant.CocoaPlantSize)2 LongGrass (org.bukkit.material.LongGrass)2 GlowWorld (net.glowstone.GlowWorld)1 FlowerType (net.glowstone.generator.objects.FlowerType)1 GrassSpecies (org.bukkit.GrassSpecies)1 Material (org.bukkit.Material)1 BlockFace (org.bukkit.block.BlockFace)1 DoublePlant (org.bukkit.material.DoublePlant)1 Pumpkin (org.bukkit.material.Pumpkin)1 DoublePlantSpecies (org.bukkit.material.types.DoublePlantSpecies)1