1.14.4 How to tell if a block is attached.

Discussion in 'Spigot Plugin Development' started by Fr33styler, Feb 15, 2020.

  1. So I'm trying to remove the Blocks that are attached to a block (Like snow or flowers etc) and remove them first so the rollback system doesn't freak out, my question is I looked thru blockdata blockstate and it seems there is no method to tell anymore, is there some other way to do this that i don't know about? I'm trying to use BlockPhysicsEvent but strip it out only to the blocks that are attached to another.
     
  2. You can use Directionals to get surrounding blocks then just use an if statement to target what ever blocks your after
     
  3. Is a carpet directional? Because i need to know which blocks gets removed before i remove the block, it seems like the only idea i'm left with is to create a list with all the blocks like sand/gravel/flowers etc..
     
  4. You can use block#getRelative to get a block connected to one of another block's face. (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/BlockFace.html)
     
  5. I don't really understand what do you need exactly sorry :(
     
  6. Example:
    I'm removing a block: the block holds a carpet or flower or etc, if i remove the block the carpet or the flower will be destroyed too but i want to know if it's getting removed before so i can save it in the rollback state, it can be anything from a layer of snow/ a sign sand etc, and there it seems there is no way to know with ease those blocks so i can save them in the order they need to be saved
     
  7. When a carpet or a flower drops because of it's block below not present, it's firing a BlockPhysicsEvent iirc
     
  8. yeah but that event has no cause or anything of sort, it triggers for every block nearby for no apparent reason
     
  9. get the block being removed check for what it is using block face above or whatever then if it is carpet or snow remove it then remove the other block
     
  10. You can store the location of the block below and then check if the block in the PhysicsEvent has a type that can have physics, then check if the location below is one of the location you have stored ?
     
  11. There are waaay more than those 2, it's like 1/3 of the materials that can do physics and i can't do them by hand with more being added every version

    "has a type that can have physics" this is what i'm trying to ask
     
  12. There is no real solution in the API afaik. Your best bet is having a list of the materials that can have fake physics update.