Topic category: Help with Minecraft modding (Java Edition)
So I've ran around, looking at past forums on this subject, but none of them could get the projectiles to function correctly.
I've done my research and figured out that I need to use the NBT tag "NoGravity" to disable the gravity on the entity.
When I did this, it worked. The bullets no longer had gravity and zoomed through the air. However, there was one other problem: Every other entity also had no gravity.
I can't figure out how to fix this while still keeping the bullets gravity-less. Any help?
Here's the code that is triggered during "While projectile flying tick":
when (global trigger): Entity Spawns
Execute command / "data merge entity @s {NoGravity: 1b}" in the name of Event/target entity
Just do if is NBT(Your proyectile) do the command
So from what I understand is that you want the projectile to not be pulled down by gravity? All you do is get the no gravity block and replace event entity with immediate event entity. Pretty simple
it looks like your command dosent have anything specifying your projectile
Go to your ranged item, select "while projectile flying tick" and make this procedure:
Set no-gravity of [Immediate source entity] to True
Then to prevent it from flying forever:
Wait [number (depending on how far you want it to go)] ticks then on server-side
do despawn Immediate source entity.
It is very important that you change the [entity] to [immediate source entity]. Hope this helps.
omg i have got this stupid problem for years
and it was just a google search away
i feel i lost 20 iq.
Im having problems with setting the No Gravity to projectiles. Projectiles that apply potion effects also affects the shooter. Any way to solve this?
Same.
Maybe use an if statement in order to filter which entities are affected by the potion effect?