how do i actually make an enchantment?

Started by the random dude. on

Topic category: Help with modding (Java Edition)

Last seen on 16:26, 13. Apr 2024
Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do i actually make an enchantment?

i want to make a multishot enchantment that actually multishots instead of only shooting 2-3 arrows. how can i either get the multishot code or multiply arrows by procedures?

Last seen on 10:38, 22. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Once you make a custom…
Sat, 04/13/2024 - 14:12

Once you make a custom enchantment, you then need to make procedures to make it work. By 'actual multishot,' I assume you mean shooting multiple arrows with a short delay, but with the same velocity. I'd try something like this:

  • Make a procedure with an 'entity spawned' global trigger, and an if-bracket that checks if the target entity is an arrow.
  • Then, use another if bracket to check if a living entity exists in a 3 or 4 block radius. And another if bracket to check if the item in the main hand of that entity is a bow with your custom enchantment.
  • If it is, save the x/y/z velocities of the target entity, (the arrow), as player-lifetime number variables. You will also want to set up an additional number variable to count how many times the player is allowed to shoot another arrow. (Set it to 1 for level 1 of the enchantment, 2 for level 2, etc.), which should reset once they're no longer firing.
  • Then wait 2 or 3 ticks. If the counter variable is greater than zero, spawn an arrow at the player's position, with its velocity set to the saved x/y/z velocities, and decrease the counter by one. You will probably also want to make these arrows non-grabbable if you don't want this to be a dupe exploit, though you could also check that the player has arrows in their inventory and decrease them by one for each shot fired.