Trouble with player delta movement after striking an enemy

Started by Miru on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Trouble with player delta movement after striking an enemy

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?

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
use source entity instead of…
Sat, 05/04/2024 - 22:10

use source entity instead of event/target entity in the on hit procedure.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
With velocities, there's a…
Mon, 06/03/2024 - 15:34

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.)