1.14.4 NMS Entity Block Collisions

Discussion in 'Spigot Plugin Development' started by KuramaStone, Dec 7, 2019.

  1. I'm trying to make a custom jar that will allow certain entities to ignore block collisions. I've found a method Block#checkBlockCollisions, but that doesn't seem to be the method involved.

    There's another method Block#a(IBlockAccess, Entity), but that's to do with friction - which made an interesting effect, but not what I'm looking for.
  2. I think NMS entities have a boolean that disables collisions.
    In the deobfuscated class the field is called noPhysics:

    In the Paper fork it is called noclip:

    try setting it to true.
  3. The noClip boolean doesn't discriminate against certain blocks, and my idea is making only certain blocks not interact with the entity. I'm having a very difficult time finding where the Spigot does calculations for it.
  4. In Entity#move(...) a portion of it is dedicated to ensuring that the bounding box doesn’t intersect with blocks using World#getCubes(...) or something like that. That might have changed in the more recent versions but I can suggest you start looking there.

    Entities will navigate around obstacles so simply allowing them to move through blocks is not sufficient to make them do so.
  5. I found the getCubes method which looks promising! Now I just have to find it's source code and exclude certain blocks - and the source code doesn't seem easy to find.
  6. As mentioned above you will also need to update the path finding or the pathing will not take into account your change to the blocks behavior leading to broken path finding.
  7. getCubes seems to be a dead end because even when I completely override it to return either true or false, it doesn't seem to be the method involved here.

    I might have to update the pathfinding if I extend it to living entities, but I'm only messing with items atm. That's something important to remember though, thank you.