Started by
theeminer20
on
Topic category: Help with Minecraft modding (Java Edition)
I am working on a weapons mod, which includes a "Sickle".
I need this sickle to pull hit entities toward the player (reverse knockback).
I want them to be launched in the opposite direction the player is facing. So if the player is looking down and hits the entity, the entity flies upward. I also don't want this to be that strong, just a gentle pull.
I have something working already, but it's based on where the entity is looking; they get launched in that direction.
This is under "living entity is hit with":
Well this may be overcomplicated, but here is one thing you could do. Set the X, Y, and Z of the player to different variables. (So basically On player tick update set the variables to those positions) and then make the mob look at said position when it is hit with the sickle, and then get launched where they are looking, AKA get launched toward the player. (However, I must say that I don't really see a use for reverse knockback as that just lets the monster bap you easier.)
Oh! I just realized you meant they are blasted away from where the player is looking. hmm. I'm afraid that one stumps me. Anyone else?
Also if you are making the sickle have a cooldown for the wielder. It should be source entity not event entity because event entity would be the one being hit.
You were right the first time; it is reverse knockback, as it pulls the mob toward the player with every hit.
Yes, if you're not too careful, the mob will hit you, but as you can see, I apply one second of weakness to give you a chance to chain attacks before getting hit.
I've played with the mechanic as it is, and it's pretty fun; however, sometimes the mob doesn't look at you immediately, or turns its head during the fight, and you can end up flinging it slightly off course, it also throws off the rhythm. On top of that, non-hostile mobs are almost never looking at you, at least immediately.
I'll play with your suggestion a bit later.
Thank you!