Started by
Miru
on
Topic category: Help with Minecraft modding (Java Edition)
Hello! I'm trying to create a weapon that when hitting a entity, the player bounces a couple blocks in the air. So I made a procedure that adds to entity's Y axis, set to go when a living entity is hit with tool. However this applies the bounce to the entity being hit, not the player. So I put it on when swung, and now I can fly. Any suggestions?
use source entity instead of event/target entity in the on hit procedure.
With velocities, there's a very significant difference between things that trigger once, and things that trigger continuously. You want to make sure you do this on the 'before entity hurt' procedure, and target the source entity. If you do it on something like 'when swung' or 'update tick,' it will constantly add or reset the y velocity. (You will also probably want to set the player's y velocity to their current y velocity plus something, instead of just completely overriding it.)