Need help with the procedure for the mob to walk on lava

Started by MakiRoll on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need help with the procedure for the mob to walk on lava

I'm making a mob for hell and I need it to walk on lava like a strider, can someone help with that? Please?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There's some basic motion…
Sat, 04/06/2024 - 12:57

There's some basic motion override stuff you could do- if you just use a 'attempt to override motion vector' function, you can set the entity's velocity to its current velocity, plus however much upwards force you need, if it's standing on lava. The trouble is that this will definitely mess with pathfinding, and probably cause problems down the road.

The better method would probably be to lock your entity, look at the code for the strider, and see if you can replicate it. You can find files for vanilla stuff in the file manager on the left hand side of the workspace. You'd want to look under external libraries/minecraft forge 1.20.1/net/minecraft/world/entity/monster. 

Taking a peek, it looks like this is the tag that allows it to walk on a fluid. You would likely need to make some changes and make sure you add the proper dependencies if you wanted to add it into a locked mod element.

   public boolean canStandOnFluid(FluidState p_204067_) {
      return p_204067_.is(FluidTags.LAVA);
   }
Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok im maked them "walk" in…
Sun, 04/07/2024 - 03:45

Ok im maked them "walk" in lava, but now im need that they move faster. :]

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did you get it to work with…
Sun, 04/07/2024 - 17:19

Did you get it to work with the custom code? Or just using a motion override? (I'm kind of curious if that boolean tag actually works :] ). You could try adjusting the mob's default speed in their 'properties' or 'AI' tab, but if that's not working, you could also try giving them a speed status effect.

You could also use another motion override to move the entity in the direction it's looking. If you set their x/z velocity to their x/z look angle vectors, it will move at a constant rate in the direction it's facing, and you can then multiply the look angle vectors to increase or decrease the speed.