Launch Fire Projectile

Discussion in 'Plugin Development' started by Pink__Slime, May 31, 2013.

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

    Pink__Slime

  2. Offline

    chasechocolate

    You could either use the fire item or a projectile. For the fire item, you would need to spawn a fire item drop at the player's location, make it unable to be picked up, set it's velocity to player.getLocation().getDirection() (and multiply that depending on how far/fast you want it to go) and then create a scheduler that will check if the block under it's location is not air. Then, spawn fire on the block.getRelative(BlockFace.UP). For projectile, make the player launch a projectile, save it's UUID in a List<UUID>, listen for ProjectileHitEvent, check if the list contains the event.getProjectile().getUniqueId(), and then get the projectile location, spawn fire there and remove the projectile.
     
  3. Offline

    Technius

    Pink__Slime
    You could spawn a FallingBlock and set its block type to fire. Then you will have to set its velocity.
     
  4. Offline

    Pink__Slime

    Ok I have two questions.
    I currently have this:
    Code:java
    1. FallingBlock fire = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection().normalize()), Material.FIRE, (byte)0);
    2. fire.setVelocity(player.getLocation().getDirection().multiply(2));


    How would I be able to check if the fire block hit a player.
    And, when the fire lands, it places it on the ground which isn't a problem on most surfaced but on leaves/logs it spreads and all and on netherrack it just sits there. My question is, is there a way to leave the fire there for a second then remove it without affecting any other fire on the map?
     
  5. Offline

    microgeek

    Have a sync repeating task checking the positing and then check for collisions with other players.
     
  6. Offline

    Pink__Slime

    microgeek
    I'm sorry but how would I do that?

    And do you have any ideas for the second part?
     
  7. Offline

    microgeek


    Pseudo code:

    new bukkit runnable {
    entity e = get closest entity
    if distance to e < .5 blocks {
    light on fire and remove
    }
    }.run repeating task
     
Thread Status:
Not open for further replies.

Share This Page