Is this sand going to fall?

Discussion in 'Plugin Development' started by Zwander, Jun 10, 2014.

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

    Zwander

    Basically, I need a way to detect when sand is about to fall.

    The purpose of this is to spawn a custom EntityFallingBlock in the place of the default one. Only some falling sand needs to be replaced, the condition being a piece of metadata placed on the original piece of sand.

    So I need to know when a block starts to fall and the block (mainly its metadata) itself.

    BlockPhysics event will trigger, however there doesn't appear to be a way of telling what kind of event it is. IE: Whether it was just a normal block update (I'm told BlockPhysicsEvent triggers on any kind of update, even if the update has no effect), one that breaks the block (water+torch) or if its a falling event.

    So ah, if you have any ideas, do tell.
    Thanks C:

    /*(Also I'm not keen on looping every entity in existence and checking if its EntityFallingBlock then trying to predict where it came from etc etc, nor do I want to track every block in existence and check if it was removed in the same tick as an EntityFallingBlock was spawned or anything as ridiculous as that) */
     
  2. you could do is use the blockevent and check if it's the block with the metadata, and add it to a arraylist, then a tick later you remove it from the list (location is the best thing to store in the list (I think), and the remove after a tick can be longer but is to make sure it isn't a normal update but a update that says that the block will be turned into a falling sand entity. you can change the way on how to remove it after each tick). then when a entity spawns you check if it's a fallingsand entity and if it's on the same location (It's important that you remove it from the list before you do anything else), then you cancle the event and spawn your custom fallingsand entity.
     
Thread Status:
Not open for further replies.

Share This Page