Entity Teleport Whenever Item is swung

Started by WolffLandDev on

Topic category: Help with modding (Java Edition)

Last seen on 22:54, 30. Aug 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity Teleport Whenever Item is swung

Hello! Weston Landesman here. I'm working on a tool for my mod that summons little probes to protect you from hostile mobs. So, since they usually go out of range, I'm trying to make it when Target Entity Swings Item, all entities of type=Vanguard are teleported to the person holding the remote. The right click just summons them. Any help?

Last seen on 06:13, 28. Aug 2023
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
One way you could try is…
Mon, 06/20/2022 - 02:49

One way you could try is simply having "Follows (Item)" in main hand

For example I have a mod with 5 slimes and they follow players who are holding any sword or any pickaxe. Adjust the follow items as you see fit and just swap back to it when you want them to follow you again. There will be better/more advanced ways but that could work for the time being

You could also do ways like checking the radius for the mob type, teleporting those to the player, depending how far they travel you may need a higher radius + it would effect other players summons if they are within range unless you use tags or something.

As I am typing this I just thought as well, can you make it so when the player summons them, it gives them a specific name based off that player? For example they spawn as "Weston's Vanguard". Because then you could just right click the tool and run a similar command that kills the "Weston's Vanguard" mobs in the world and then after a few ticks or more summons new ones at your position

Last seen on 22:54, 30. Aug 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks! I will look into…
Tue, 06/28/2022 - 11:14

Thanks! I will look into this, good luck on your mod!