How to make a projectile unaffected by water?

Started by TheCatalystGaming on

Topic category: Help with modding (Java Edition)

Last seen on 19:36, 13. Nov 2022
Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a projectile unaffected by water?

I'm trying to make a harpoon gun, the advantage of which is supposed to be that the projectile isn't impeded by water. Unfortunately, I don't know how to actually do this. Any help would be appreciated.

Last seen on 21:12, 25. Jul 2022
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you are willing to change…
Mon, 08/17/2020 - 08:05

If you are willing to change your harpoon to a living entity, you can have it save its horizontal velocities to a NBT tag when it spawns, and then set its velocity to those values every tick.

The tricky part of doing this is making sure your harpoon flies in the right direction originally (once the velocity is saved and repeating, it should continue fine, so the original push is the only hard part).

I haven't tried it to see how it works, but this post might be able to help give that initial push: https://mcreator.net/forum/61838/how-accelerate-player-direction-they-are-looking?page=0

Last seen on 19:36, 13. Nov 2022
Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thats a good idea, I'll try…
Mon, 08/17/2020 - 20:50

Thats a good idea, I'll try that.

Also the post you linked was posted by me, I ended up figuring that out myself eventually so I should be able to copy what I done with that to the harpoon. Thanks for the help!

Last seen on 21:12, 25. Jul 2022
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Haha! Sorry, I didn't notice…
Mon, 08/17/2020 - 21:02

Haha! Sorry, I didn't notice. :)

You're welcome!

Last seen on 01:49, 18. Apr 2024
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
did work?
Thu, 08/26/2021 - 20:45

did work?

Last seen on 23:28, 18. Apr 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I know this is a bit old but…
Fri, 06/30/2023 - 20:52

I know this is a bit old but heres a code that could help:

protected float getWaterInertia() {
      return 0.99F;
   }