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);
}
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;
}
Aggregations