How to make a projectile unaffected by water?

Started by TheCatalystGaming on

Topic category: Help with Minecraft modding (Java Edition)

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.

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

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!

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!

Joined Nov 2020
Points:

User statistics:

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

did work?

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;
   }