Making black hole/ orb pulls entities into it

Started by Aplhau on Thu, 07/08/2021 - 16:10

Topic category: Help with modding (Java Edition)

Last seen on 14:31, 20. Sep 2021
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Making black hole/ orb pulls entities into it
Fri, 07/09/2021 - 16:53 (edited)

Hello hope everyone is having a nice day. I need some help with making an orb the spawns where the cursor is and entities start to get pulled into it and it despawns after 5 seconds. I have figured out how to spawn the orb where the cursor is. I have a procedure that pulls entities in but I don't know if it is ok because it looks like it teleports the entities to Narnia. If this way works can you tell me how to make it slower.

this is the procedure im using. the bottom if statement is for it to despawn after 5 seconnds

Edited by Aplhau on Fri, 07/09/2021 - 16:53
You could, instead of…
Fri, 07/09/2021 - 05:13

You could, instead of teleporting them, set their movement vector in the direction of your orb. This would, however, require a bit math to be done.

Last seen on 14:31, 20. Sep 2021
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
(No subject)
Fri, 07/09/2021 - 16:51

like this?

You're setting the motion…
Sat, 07/10/2021 - 08:43

You're setting the motion vector to the item/mob's coordinates which is usually a rather big number. vx, vy and vz are components of a speed vector and together they need to point in the direction of your black hole. value 1 in a certain direction means that the entity moves 1 block/second (or tick, not really sure at this moment), but I'm sure you can figure it out yourself with some tweaking.

Last seen on 14:31, 20. Sep 2021
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Yeah someone just told me…
Sat, 07/10/2021 - 08:45

Yeah someone just told me that so now I'm trying to figure out some math to make it point towards the orb