Keeping a FallingBlockEntity up

Discussion in 'Plugin Development' started by beeselmane, Apr 21, 2014.

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

    beeselmane

    Alright, so I've got some code:

    Code:java
    1. @EventHandler
    2. public void onInteract(PlayerInteractEvent e)
    3. {
    4. Player p = e.getPlayer();
    5. Vector vec = p.getLocation().getDirection();
    6. if((e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) && p.getItemInHand() != null)
    7. {
    8. if (p.getItemInHand().getType() == Material.BLAZE_ROD)
    9. {
    10. Random r = new Random();
    11. FallingBlock f;
    12.  
    13. for (int i = 0; i < 10; i++)
    14. {
    15. f = p.getWorld().spawnFallingBlock(p.getEyeLocation(), Material.FIRE, (byte) 0x0);
    16. f.setDropItem(false);
    17. f.setVelocity(vec.multiply(r.nextDouble()).add(Vector.getRandom()).normalize());
    18. }
    19. }
    20. }
    21. }


    now, the point of this code is to spawn fire entities and then have them shoot out in a random direction.. However, I don't want the entities to clip to the standard grid when they hit the ground. Is there any way I could do this with the code that I've written for this event?
     
Thread Status:
Not open for further replies.

Share This Page