Throwing an item, returning it back to the thrower.

Started by ValX on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Throwing an item, returning it back to the thrower.

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!

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can override motion…
Thu, 10/06/2022 - 01:42

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.

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also, you can make…
Thu, 10/06/2022 - 01:43

also, you can make projectiles spin when you add the model.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
do you know how i could keep…
Thu, 10/06/2022 - 13:36

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?

 

 

 

 

 

 

 

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For the motion vector,…
Fri, 10/07/2022 - 03:12

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.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Its fine, im not really good…
Fri, 10/07/2022 - 13:41

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.

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, also, motion vectors act…
Fri, 10/07/2022 - 15:36

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

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey did you end up figuring…
Mon, 06/12/2023 - 22:03

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.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only possible with hard…
Mon, 06/12/2023 - 22:21

Only possible with hard coding ornusinf the vector plus plugin for mcreator, but still not accurate enough.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only possible with hard…
Mon, 06/12/2023 - 22:21

Only possible with hard coding or using* the vector plus plugin for mcreator, but still not accurate enough.

Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is a simple way to do…
Tue, 06/13/2023 - 00:31

There is a simple way to do this, but it doesn't look that great, and there is the complicated way:

I can't really type out this long code, so you will have to keep retrying until this image loads.

Btw, this code is not final, it mostly will work, unless if I did not catch some details correctly, it should work as planned.