How to make an arrow that upon hitting a player steals xp and gives it to the player who shot it?

Started by AlfonixJohnson on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make an arrow that upon hitting a player steals xp and gives it to the player who shot it?

I tried and couldn't get it to work but I could do it on a sword

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay so those need variables…
Tue, 11/25/2025 - 07:55

Okay so those need variables, the one I used is a local variable I created, those don't save outside the procedure so they are only useful for when you don't need to worry about saving info, what you can do is on the right above where my variables show, click the plus and create a variable for what you need, also you only need that "saveFirst" the rest are not needed for this, and you need to add your own custom arrow in that list with the arrows and spectral arrows (in the for each inventory slot).

What that procedure does
first it checks if the player is using a bow
Then checks what the arrow in the closest slot is (that will be the arrow the bow uses to fire)
It will check each slot in that order, and move on to the next
if the variable is null(air) then set it that that arrow
then it checks what arrow is about to fire
and replaces the nearest arrow (the one that is closest to the players head which is the arrow shot) after 1 tick
and fires the custom one instead (with stats matching a normal arrow)

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can also name it…
Tue, 11/25/2025 - 07:56

You can also name it whatever you need, does not have to be "saveFirst".

Hope this helped.

Joined Nov 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
when i create the custom…
Wed, 11/26/2025 - 03:54

when i create the custom variable to drop down menu is still blank

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You have to refresh it, by…
Wed, 11/26/2025 - 04:38

You have to refresh it, by either deleting the blank variable block and replacing it, or saving and reopening.


 

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So you need to set the…
Wed, 11/26/2025 - 16:51

So you need to set the variable to be an itemStack, there is a drop down you can click to switch the type of variable.

Joined Nov 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that worked thanks!
Wed, 11/26/2025 - 16:55

that worked thanks!

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What version of MCreator are…
Thu, 11/27/2025 - 02:42

What version of MCreator are you using and are you using a generator plugin?

Joined Nov 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
2025.3 1.21.8 fabric…
Thu, 11/27/2025 - 16:04

2025.3 1.21.8 fabric generator

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It seems like fabric doesn't…
Fri, 11/28/2025 - 01:37

It seems like fabric doesn't support those blocks, or the version doesn't support them.

Joined Nov 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So its not possible?
Fri, 11/28/2025 - 15:53

So its not possible?

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfortunately not, at least…
Sat, 11/29/2025 - 00:19

Unfortunately not, at least with the procedure I provided.