Making FallingBlock ignore collisions and interactions

Discussion in 'Spigot Plugin Development' started by Artur, Oct 9, 2019.

  1. TL;DR: I want a riding falling block to ignore player hits, arrow hits, and all interactions and apply the above to the entity it rides without the use of scoreboards and events.

    Hello! Hope you have a fantastic day/night! I got a question for you.

    So, let's say we have an entity. Let's call him Mike.
    I've been trying to figure out how to make a block disguise. Disguising Mike with an actual falling block does not show smooth movements as I wanted it to, so I decided to disguise Mike as a small invisible entity, for example, baby chicken, and create a falling block that will ride the disguise. I managed to pull it off, and it looks pretty cool! The movements are very smooth and I'm very happy with the result. One problem with it is that all interactions that happen to the "disguise", doesn't happen to the Mike. When I try to punch Mike, nothing happens. When I try to shoot an arrow at him, nothing happens. All of it is because of this FallingBlock on top of Mike's head.

    So, my question is, is there a way I can make that falling block to completely ignore all interactions, so arrows go through the FallingBlock and hit Mike? Like a ghost entity..? Mind you, I don't want to do it through the scoreboard or damage and interaction events. It's not practical.

    Other suggestions about making a FallingBlock disguise with smooth movements are also welcomed! Thanks in advance!
     
  2. Have you tried LivingEntity#setCollidable? Sounds like what you want to do.
     
  3. You can try checking out Nms there is something that looks like 'noclip'
     
    • Like Like x 1
  4. FallingBlock is not a LivingEntity. FallingBlock extends Entity and setCollidable is always false there.

    I always thought that noclip will make you go though solid blocks. Like in spectator gamemode. But I will try that.
     
  5. @Artur it doesn't stop you from overriding it
     
  6. Right, nevermind.
     
  7. You can turn the gravity off just like how you see ArmorStands does it.

    ArmorStand#setMarker #setGravity

    and same goes for fallingblock just that it's a bit tricky because you'll have to use nms to enable the noclip.
     
  8. if no other way works, translate any actions you want performed on your fallign block to the player, since its within the player's hitbox i imagine
     
  9. In the entity class for nms (i checked this in 1.8.8) theres a method called getBoundingBox which returns an AxisAlignedBB and directly underneath that there is also a method called a(AxisAlignedBB boundingBox) that allows you to pass in a value which it will then set it's bounding box to, it seems like you can just completely remove the hitbox together. Like I said I found this in 1.8.8 but just look around for a method that takes an AxisAlignedBB and sets all its values to it, should be a pretty easy find, though let me know if you are having trouble.
     
  10. Wouldn't it work to spawn the falling block on a packet level?
     
    • Creative Creative x 1
  11. Good thought, if anything that would probably be more efficient, you can spawn them just using packets such as PacketPlayOutSpawnEntityLiving, which would eliminate the need for collision detection at all. Nice solution
     
  12. Given that collisions are processed server side not sure how this would help.
     
    • Funny Funny x 1
  13. Don't know which post you are referring to but both of our posts would help, my suggestion was to remove the bounding box, setting all its values to zero (which would effectively remove all collisions), and Blutkrone said that he should spawn the falling block on a packet based level, meaning don't actually spawn it, just send out packets that make the clients think they are spawned when the entity doesn't exist, which would not only be lighter on performance but would completely solve the problem.