Search in sources :

Example 1 with GlowTNTPrimed

use of net.glowstone.entity.GlowTNTPrimed in project Glowstone by GlowstoneMC.

the class BlockTNT method igniteBlock.

/**
     * Convert a TNT block into a primed TNT entity.
     *
     * @param tntBlock           The block to ignite.
     * @param ignitedByExplosion True if another explosion caused this ignition.
     */
public static void igniteBlock(GlowBlock tntBlock, boolean ignitedByExplosion) {
    tntBlock.setType(Material.AIR);
    World world = tntBlock.getWorld();
    GlowTNTPrimed tnt = (GlowTNTPrimed) world.spawnEntity(tntBlock.getLocation().add(0.5, 0, 0.5), EntityType.PRIMED_TNT);
    tnt.setIgnitedByExplosion(ignitedByExplosion);
    world.playSound(tntBlock.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1);
}
Also used : World(org.bukkit.World) GlowTNTPrimed(net.glowstone.entity.GlowTNTPrimed)

Example 2 with GlowTNTPrimed

use of net.glowstone.entity.GlowTNTPrimed in project Glowstone by GlowstoneMC.

the class TNTDispenseBehavior method dispenseStack.

@Override
protected ItemStack dispenseStack(GlowBlock block, ItemStack stack) {
    GlowWorld world = block.getWorld();
    GlowBlock target = block.getRelative(BlockDispenser.getFacing(block));
    GlowTNTPrimed tnt = (GlowTNTPrimed) world.spawnEntity(target.getLocation().add(0.5, 0, 0.5), EntityType.PRIMED_TNT);
    world.playSound(tnt.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1);
    stack.setAmount(stack.getAmount() - 1);
    return stack.getAmount() > 0 ? stack : null;
}
Also used : GlowBlock(net.glowstone.block.GlowBlock) GlowWorld(net.glowstone.GlowWorld) GlowTNTPrimed(net.glowstone.entity.GlowTNTPrimed)

Aggregations

GlowTNTPrimed (net.glowstone.entity.GlowTNTPrimed)2 GlowWorld (net.glowstone.GlowWorld)1 GlowBlock (net.glowstone.block.GlowBlock)1 World (org.bukkit.World)1