Replicating PVP fishing-rod function

Started by ShatteredVessel on

Topic category: Advanced modding

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Replicating PVP fishing-rod function

I'm currently trying to make a weapon which has the main focus of being similar to the fishing-rod as a melee-ranged weapon. Essentially, you throw it on right-click, it latches onto an entity, and upon right-clicking again it reels the entity in towards you. I've ran into several problems while trying different things:

1: Making a projectile spawn an entity once hitting a mob that teleports to the hit mob repeatedly.
Multiple issues with this one. First, I couldn't figure out how to get the entity to teleport to the designated hit entity and only the hit entity. I did try using entity iterator to detect the entity, but it could potentially go onto other entities instead if grouped up which isnt the intended function.

2: Making just one entity that damages a mob like a projectile, which then sticks into them.
The problem with this one is that the on-tick procedure cannot detect source entities (the player.) so it was incapable of checking if the hit entity was the player or not, which would lead to bugs revolving around hitting yourself with the thrown entity.

using UUID almost solved my problems, only issue is there isnt a clear way to define an entity with a UUID (If I make the entity projectile get the UUID of the entity it first collides with, then disable damaging functions while teleporting to that specific UUID repeatedly, it would work as intended; the only thing left to do then would be to tackle the reeling mechanic.)