How to get the block a FallingBlock transforms to?

Discussion in 'Plugin Development' started by V10lator, Nov 28, 2012.

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

    V10lator

    I need a way to remove the block a FallingBlock placed. This is what I tried: http://pastie.org/5450289 - As you see I spawn a lot of FallingBlocks, track their UUID, use the EntityRemoveEvent from BKCommonLib and try to remove the block with the help of the FallingBlocks location. The problem is that this sometimes (when the FallingBlock has a high velocity, you may need to change the sources I linked to reach that, I use another plugin for it) the locations spots the wrong block, so I remove the wrong, too.

    Does anyone know how to get the right block for sure?
     
  2. Offline

    gomeow

    Try when spawning the falling blocks, cast it to Block while assigning it.

    Block b = (Block) //spawning stuff here
     
  3. Offline

    V10lator

    gomeow A FallingBlock is a entity. AFAIK you can't cast entities to blocks. Also at the time I spawned the block it hasn't reached its destination (and that destination can change while the block flies) so even if it would be possible it would give me wrong coordinates.

    //EDIT: I just realized that the boolean e in net.minecraft.server.EntityFallingBlock.java controls if the block is placed when touching ground or not. The bad thing is that it's private and I wanted to avoid NMS code in the plugin. :(
     
Thread Status:
Not open for further replies.

Share This Page