Stop FallingBlock from... falling?

Discussion in 'Plugin Development' started by finalblade1234, Oct 29, 2013.

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

    finalblade1234

    Hey, So I was wondering if there was a way to stop FallingBlocks from moving downward?
    Code:
    final FallingBlock fb = Bukkit.getWorld("world").spawnFallingBlock(new Location(Bukkit.getWorld("world"), -116, 74 ,-34), Material.WOOL, (byte) 14);
    Spawns the FallingBlock and fb.setVelocity(0,0,0); Makes it go slow.... but how to i stop it entirly?
    Thank you, and sorry for my lack of knowledge =)
     
  2. Offline

    _Filip

    Keep regenerating the block with a y velocity of 0.4
     
  3. Offline

    xTrollxDudex

    finalblade1234
    Dude: Falling blocks that doesn't fall = block.

    It's simple:
    PHP:
    fb.getLocation().getBlock().setType(Material.WOOL);
    fb.getLocation().getBlock().setData((byte14);
     
    DarkBladee12 likes this.
  4. Offline

    DarkBladee12

    finalblade1234 It's not possible to stop a FallingBlock! If you set the y velocity every tick to 0 it will still keep falling down and teleporting up, because the falling is also handled client-side! (I've played around with them a long time ago, but gave it up since there's no way to prevent the falling...)
     
  5. Offline

    _Filip

  6. Offline

    one4me

    See this post for an example on how to extend a block's class (dragon egg used in example) to stop it from calling the method that makes it fall and see this post for an explanation on how it works.

    Note: You would now override a(World world, int i, int j, int k, Random random), instead of b(World world, int i, int j, int k, Random random).
     
  7. Offline

    joehot2000

    With a repeating task executing every tick you could go through an arrayList of falling blocks and set their velocity to 0,0,0.

    As said before it will fall client side which is a problem.

    Edit: May be possible to set the falling block upon another entity such as a snowball which would counteract this.
     
  8. Offline

    DarkBladee12

    swampshark19 Well setting the velocity to 0.4 will make it go upwards a bit and not prevent him straight from falling!
     
  9. Offline

    TheUpdater

    do, if block is in air set the velocity to 0.4 and just repeat it
     
  10. Offline

    Ugleh



    This is falling block staying still. as you can see the client side still causes it toshake.
     
    fromgate likes this.
  11. Offline

    xize

    I think its possible but very hard to acomplish I think the best practice is like others say repeating a velocity which is faster and add every time a + height again, or just try teleport the entity (if possible).

    however if people say all is calculated inside the client and it actually forms blocks when you do this, you may want to destroy the block each time in EntityChangeBlockEvent by: e.getBlock() where it is allready the formed block.

    I'm very confused with falling blocks lately and with the event it self as sand would halt falling and other blocks only gets stopped for creating to a real block when canceled.
     
  12. Offline

    xTrollxDudex

  13. Offline

    finalblade1234

    xTrollxDudex
    Yes... Ive noticed that blocks dont move...

    And thanks everyone, i got it to work
     
Thread Status:
Not open for further replies.

Share This Page