Generating an Explosion

Discussion in 'Plugin Development' started by Lactem, Jun 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Lactem

    If I'm using
    Code:
                        double posX = e.getEntity().getLocation().getX();
                        double posY = e.getEntity().getLocation().getY();
                        double posZ = e.getEntity().getLocation().getZ();
                        e.getEntity().getWorld().createExplosion(posX, posY, posZ, 2.1F, false, false);
    to generate an explosion, how can I make the explosion be ten blocks in front of where the player? Please do not say "Just add 10 to x" because x is relative. I think I need to do something with Yaw or Pitch and somehow set that + 10 in the explosion. There's no room for Yaw or Pitch in .createExplosion(), though.
     
  2. Offline

    ZeusAllMighty11 Retired Staff

    Why can't you add 10 to x?
     
  3. Offline

    WolfClash

    Try this, or something like it.
    Code:
    e.getEntity().getWorld().createExplosion(posX, posY, posZ, 2.1F, false, false + e.sendBlockChange(args0, arg1, arg2));
    
    and put in something in the args. I don't know anything about explosions and only am starting with java.

    If that doesn't do it, try:
    Code:
    int blockId = player.getItemInHand().getType().getId();
    if(blockId == 280){
    Block block = player.getTargetBlock(null, 50);
    Location location = block.getLocation();
    World world = player.getWorld();
    world.createExplosion(location, 5);
    
    That should work.
     
  4. Offline

    Lactem

    X is not relative to where the player is facing. X is a set direction. I've already tested with setting X plus 10.
    Thanks. I already got something else figured out, though.
     
  5. Offline

    WolfClash

    No prob, glad you got it figured out ^-^
     
Thread Status:
Not open for further replies.

Share This Page