Custom potion effect on entities around the player

Started by IneedHelpSobadly on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom potion effect on entities around the player

what I want to create is an object that when right clicked gives a custom effect to entities around the player (about 30 blocks?) 

A photo of the procedure would be appreciated or a good explanation, im stupid haha 

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am not sure what you mean…
Tue, 07/11/2023 - 09:13

I am not sure what you mean by an object, but both blocks and items have options on right clicked within the triggers tab.

You can make a procedure for it that has the 'execute command/"{}" at x:{} y:{} z:{}' procedure block. In this procedure block you can put a command the command for your need is: 

/execute as @p run effect give @e[distance=1..30] mod_id:effect_id 60 1

 

Explanation of command:

execute as @p run = makes the nearest player do the command

effect give @e[distance=1..30] = gives an effect to all entities within 30 blocks. within the brackets you can also give more entity selectors.

mod_id:effect_id = the mod_id from you're mod and effect_id from you're effect.

60 1 = first one is the time in seconds and the second can be left empty but in case youre effect has multiple levels can be used to give a specific level.