How to give entity ability to go through blocks

Started by tuonkhung on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to give entity ability to go through blocks

So I was trying to make a custom ghost entity and I wan it to fly through block (like Vex). So I tried disable collision box since it was suggested in other forum topic but sadly it doesn't make my entity go through wall. All it did was making my entity go through other mob but not blocks. So is there any other way to do it? 

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How about setting ur mob as…
Wed, 06/01/2022 - 17:57

How about setting ur mob as a flying entity. As far as i know that affects motion controller aswell

 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah I did set it to flying…
Fri, 06/03/2022 - 04:52

Yeah I did set it to flying mob but it doesn't seem to improve anything, so I guess for the meantime I'm just gonna have to deal with it then. Anyway thanks for replying

 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
May be try to make teleport…
Fri, 06/03/2022 - 05:45

May be try to make teleport through blocks for your mob or when your mob collide solid blocks just make blocks without collider and in some time return block again

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for your suggestion…
Sat, 06/04/2022 - 03:25

Thanks for your suggestion. I haven't try it yet, but I think it may work for the first method. For the second one, I don't think I know how to actually do it if it's related to coding. I don't really know how to code though, the most I can do is just edit some already exist code in code editor not adding a whole new line of code or define a new one. Anyway thanks for helping me out.

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you can find the code for…
Mon, 06/20/2022 - 05:53

If you can find the code for Vexes then you might be able to see how you can do that yourself

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for your respond, it…
Wed, 06/22/2022 - 04:05

Thanks for your respond, it was very nice. It's true that if I could find the code for Vex then I might be able to do it? Except I do not know where or how to find it, maybe you could say that it lied inside of Minecraft's file but with a person without any knowing of coding or programing, it just like a big maze with bunch of words, lines throwing into my face. Even if I do find the file that contains those code for Vex, there's still no way for me to indicate which line of code is for phasing through walls. Anyway, I do appreciate for your responding and I wish you a good luck on your mod :D

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ping on me when you will…
Mon, 12/11/2023 - 06:37

Ping on me when you will find the answer pls! :)
I have seen many mobs in different mods with same ability, like worms and ghosts from Ice and Fire, SCP-106 from SCP Lockdown, but i think that my understanding of code may be even lower than yours, so you may try to check these ones.
I have already tried the method with blocks raplacing to non-collidable for a few ticks, but it seems too complicated and i bilieve there is a way more light solution. Vex doesnt switch any blocks to move throu it, as i know.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, it should be an…
Mon, 03/25/2024 - 03:16

Yeah, it should be an override tag of some sort. It seems like disable-collisions used to do this, judging from a lot of the responses? I imagine it may have changed in the latest version.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay, figured it out by…
Mon, 03/25/2024 - 03:46

Okay, figured it out by looking at the Vex code. In the latest version, you need to add this somewhere in your entity's code in order for it to phase through walls. (Keep in mind this won't necessarily work with its pathfinding!)

public void tick() {
      this.noPhysics = true;
      super.tick();
      this.noPhysics = false;
      this.setNoGravity(true);
   }
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you are a saint mr Mind
Sun, 04/21/2024 - 02:34

you are a saint mr Mind

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mindthemoods, do you know…
Sat, 11/02/2024 - 10:36

Mindthemoods, do you know any way to make this togglable via a procedure *using the text editor not the block editor*