In my map, I am trying to make a fishing rod behave much like Blitzcrank's "Rocket Grab".
A quick summary of the purpose is that when the fishing bobber hits an entity, that entity is quickly teleported to the player that cast the fishing rod.
I have tried designing a few different versions, but none seem to achieve what I am looking for.
A quick summary of requirements:
Must be multiplayer friendly. If it isn't, I'm afraid it won't do.
Fishing bobber teleports the first entity it hits to the player that cast it.
Fishing bobber is removed after it teleports an entity to the player that cast it.
Fishing bobber is removed if it misses.
Less redstone if possible, to reduce lag.
Few entities. This means no spam of armor stands. The main idea here is for the grappling hook to be used in multiplayer, so if there are hundreds of entities being spawned, players will lag a lot.
The only way to target the bobber is with "@e[name=unknown]". What we are doing here is teleporing an entity that is within 1 block of the bobber to the closest player that has cast their rod, then we mark the bobber if it has touched the ground/water/entity, finally we reset the caster's score and kill the marked bobber.
Thanks for the reply nigathan, but I'm afraid it isn't working for me.
I set up the commands to a fill clock, but the commands won't run (failed to execute "command" at "entity", invalid command, etc)
I tried retyping all of them, but it still wouldn't run.
Here is a list of the things I believe are not working:
The first command (execute @e ~ ~ ~ execute @e[name=unknown,r=1] ~ ~ ~ scoreboard players set @e[name=unknown,c=1] useRod 1) is targeting both the player that cast it and the bobber itself. In short, the bobber constantly has a useRod score of 1, and therefore is killed as soon as it spawns.
Since the first command is setting the bobber to have a useRod score of 1, it will constantly be teleported to the nearest player with a useRod score of 1 if the /kill command block is removed.
Attempting to modify the second command: "tp @e[name=!unknown,c=1,r=1]" so that the bobber is ignored simply refuses to work. Nothing is teleported.
The third command takes time to register.
The fourth command works perfectly. But it's kind of useless without the rest of the commands working.
The fifth command constantly sets the player's score to 0, so you can't teleport anything. Removing it allows the teleportation command block to work, but at the cost of not being able to reset the player's score.
The /kill command block is repeatedly killing the bobber, since it will always set its own score to 1.
Thank you for replying with an idea, however. It was very kind.
The second method (or third?) works most of the time. There are a few times where the fishing bobber disappears immediately, but I get the feeling that it is a minecraft bug. (I got it to work 95% of the time. Simply change the second command to:
Instead of setting the bobber's useRod to 1 if it detects an entity, set it to 2, then only kill when min and max are 1 and when min is 2, clear the player that used the rod of 1 rod.
The current method is not going to work on players at all. You need to create a second scoreboard objective to track the bobber with, instead of useRod. Only ever reset the useRod objective as it gets set when a player uses the rod, then when a bobber needs to be killed, use a different objective. Use the same objective in the target selectors for the bobber as well.
In my map, I am trying to make a fishing rod behave much like Blitzcrank's "Rocket Grab".
A quick summary of the purpose is that when the fishing bobber hits an entity, that entity is quickly teleported to the player that cast the fishing rod.
I have tried designing a few different versions, but none seem to achieve what I am looking for.
A quick summary of requirements:
Thanks in advance.
Hello. I am a noob. Help please? Thanks.
Simple:
First setup a scoreboard objective:
/scoreboard objectives add useRod stat.useItem.minecraft:fishing_rod
And throw these on a clock:
/execute @e ~ ~ ~ execute @e[name=unknown,r=1] ~ ~ ~ scoreboard players set @e[name=unknown,c=1] useRod 1
/execute @e[name=unknown,score_useRod_min=1] ~ ~ ~ tp @e[c=1,r=1] @p[score_useRod_min=1]
/scoreboard players set @e[name=unknown] useRod 1 {OnGround:1b}
/execute @e[name=unknown] ~ ~ ~ detect ~ ~-0.1 ~ minecraft:water -1 scoreboard players set @e[name=unknown,c=1] useRod 1
/execute @e[name=unknown,score_useRod_min=1] ~ ~ ~ scoreboard players set @p[score_useRod_min=1] useRod 0
/kill @e[name=unknown,score_useRod_min=1]
The only way to target the bobber is with "@e[name=unknown]". What we are doing here is teleporing an entity that is within 1 block of the bobber to the closest player that has cast their rod, then we mark the bobber if it has touched the ground/water/entity, finally we reset the caster's score and kill the marked bobber.
Thanks for the reply nigathan, but I'm afraid it isn't working for me.
I set up the commands to a fill clock, but the commands won't run (failed to execute "command" at "entity", invalid command, etc)
I tried retyping all of them, but it still wouldn't run.
Here is a list of the things I believe are not working:
Thank you for replying with an idea, however. It was very kind.
Hello. I am a noob. Help please? Thanks.
Oh whoops, you're absolutely right, let me fix it:
Add this command to the top:
/scoreboard players add @e[type=!Player] useRod 0
Change the first two commands to this:
/execute @e[type=!Player] ~ ~ ~ execute @e[name=unknown,r=1] ~ ~ ~ scoreboard players set @e[name=unknown,c=1] useRod 1
/execute @e[name=unknown,score_useRod_min=1] ~ ~ ~ tp @e[c=1,r=1,score_useRod=0,type=!Player] @p[score_useRod_min=1]
Now it should work as intended.After some testing, there were a few more issues, here is what I came up with, it works for the most part:
/scoreboard players add @e[type=!Player] useRod 0
/execute @e[name=unknown] ~ ~ ~ execute @e[type=!Player,rm=1] ~ ~ ~ execute @e[name=unknown,r=2] ~ ~ ~ scoreboard players set @e[name=unknown,c=1] useRod 1
/execute @e[name=unknown,score_useRod_min=1] ~ ~ ~ tp @e[c=1,r=2,score_useRod=0,type=!Player] @p[score_useRod_min=1]
/scoreboard players set @e[name=unknown] useRod 1 {OnGround:1b}
/execute @e[name=unknown] ~ ~ ~ detect ~ ~-0.1 ~ minecraft:water -1 scoreboard players set @e[name=unknown,c=1] useRod 1
/execute @e[name=unknown,score_useRod_min=1] ~ ~ ~ scoreboard players set @p[score_useRod_min=1] useRod 0
/kill @e[name=unknown,score_useRod_min=1]
Thank you!
The second method (or third?) works most of the time.
There are a few times where the fishing bobber disappears immediately, but I get the feeling that it is a minecraft bug.(I got it to work 95% of the time. Simply change the second command to:"/execute @e[name=unknown] ~ ~ ~ execute @e[type=!Player,rm=1] ~ ~ ~ execute @e[name=unknown,r=1] ~ ~ ~ scoreboard players set @e[name=unknown,c=1] useRod 1"
The remaining 5% of the time is when you hit a 2 block tall mob in the upper head area. But I don't expect players to do that in my map )
Since I intended this to work on players and mobs, I changed the third command to read:
/execute @e[name=unknown,score_useRod_min=1] ~ ~ ~ tp @e[c=1,r=2,score_useRod=0,name=!unknown] @p[score_useRod_min=1]
I was also wondering if you could add one last feature to the commands, if it isn't too much work.
Basically, after casting the and grabbing an entity, the fishing rod is cleared from your inventory.
I tried doing this myself with:
/execute @e[name=unknown,score_useRod_min=1] ~ ~ ~ /clear @p[score_useRod_min=1] fishing_rod 0 1
but the output read "Failed to execute /clear @p[score_useRod_min=1] fishing_rod 0 1 as unknown".
Sorry for asking more from you, please add this if you feel like it.
But both ways, thanks very much!
Hello. I am a noob. Help please? Thanks.
Instead of setting the bobber's useRod to 1 if it detects an entity, set it to 2, then only kill when min and max are 1 and when min is 2, clear the player that used the rod of 1 rod.
Alright. Final question (sorry!)
This was meant to be multiplayer friendly, but when I have another player join and attempt to use it, there are two problems:
Sorry for taking up so much of your time.
Hello. I am a noob. Help please? Thanks.
The current method is not going to work on players at all. You need to create a second scoreboard objective to track the bobber with, instead of useRod. Only ever reset the useRod objective as it gets set when a player uses the rod, then when a bobber needs to be killed, use a different objective. Use the same objective in the target selectors for the bobber as well.