Started by
ValX
on
Topic category: Help with Minecraft modding (Java Edition)
So, I wanna make a weapon kinda similar to a boomerang. You can click a keybind to throw it, it kinda makes a spinning animation, goes forward, stops, and then comes back. Kinda like Darth Vader's lightsaber throwing scene. Not sure really how to make that in MCreator, or if its even possible without the use of coding, but that'd be great to know how to use. If anyone has any ideas, comment them here!
You can override motion vectors of projectiles.(immediate source entities) my suggestion is to make the weapon fire a projectile that has the same model as your weapon, shrink your itemstack when you right click it so it leaves your inventory, then have a motion vector pull the projectile back, and when it gets close to you, make a entity iterator procedure that despawns the immediate source entity and adds the weapon item back to your mainhand. hehe sounds complicated, it would probably take me an hour or so to do it.
also, you can make projectiles spin when you add the model.
do you know how i could keep the NBT data (etc: enchantments/name) of the tool thats being thrown, along with how to make the item go forward and back, what blocks should I use for the motion vector. Direction of the player's head?
For the motion vector, simply firing the projectile would make it go forward, to make it come back would be the hard part. You could use the instance where "when projectile hits mob entity" and make it fire a projectile back at you somehow. And if it doesn't hit a mob, you would need to use the "while projectile is flying tick" to set it to override motion vector after a set time in ticks has passed. The motion vector procedures are complicated. There's info out there that uses cos and darn I forget the other one, to launch things in the direction you are looking. Research alot lol. As for keeping NBT, I'm afraid I haven't used that before... Sorry I can't be more help right now, I would need to put alot of effort into this and I don't have the time.
Its fine, im not really good at either, but thanks for the help!
Ill play around with procedures and make a motion vector that goes maybe in the negative direction of the way the player is looking.
If I find anytihng out, I'll post the finished version of the procedures here.
Oh, also, motion vectors act funny in multiplayer. Some don't execute the procedures. They will work for the host of the world but not for server players for some reason. I'm having troubles figuring out how to fix that in my mod. Just a warning. They're great for singleplayer but not multiplayer
Hey did you end up figuring it out Pexuls? I have been trying for a long time to get a working projectile that does this.
Only possible with hard coding ornusinf the vector plus plugin for mcreator, but still not accurate enough.
Only possible with hard coding or using* the vector plus plugin for mcreator, but still not accurate enough.
There is a simple way to do this, but it doesn't look that great, and there is the complicated way:
Btw, this code is not final, it mostly will work, unless if I did not catch some details correctly, it should work as planned.