help with fragmentation grenade

Started by JPZamps on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
help with fragmentation grenade

so I made this grenade for my mod which focuses on only causing damage to the entities around it, so the level of explosion is very low to not the damage blocks around, the problem is that the only entity that takes damage is the entity that it was hit by the grenade, is there any way to damage (and apply a potion effect) to the surrounding mobs ?? I've tried some procedures but I haven't gotten anywhere so far

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have not tested or know if…
Sun, 02/28/2021 - 23:22

I have not tested or know if it works, it is just an idea:
create a block (it could have an animated "smoke" texture to fit the idea more) that is traversable, when the grenade (a projectile I suppose) hits an entity or when it hits a block, do:
If: get block at X Y Z (leaving it like this will make it appear in the center, add +1 in one or more coordinates to make the area, the procedure will be long) = air
do: replace block whit (block) and ignore the other
then say that when an entity collides with the block, it deals X damage to it
Now two things: if you want it to only do the damage, you must set the ticks of the block to 1 and put when it is updated tick "replace block in X Y Z with air"
if you want the visual effect is longer and you should enable the NTB in the block
create two NTBs, the example names will be:
Damage, smoke
in the part of when an entity collides with the block:
If: damage variable = true
do: do X damage
(By the way, when the block is placed, put the damage NTB to be true, it is normal for it to be false)
then in when update tick:
Set Damage to false, set Smoke get Variable "smoke" + 1, then put
if: smoke = (X ticks)
do: replace block at X Y Z whit air
I recommend that the X ticks be exactly the number of ticks that the texture animation lasts, and make the texture appear to be fading
I hope it's helpful and not too messy (:
A and potion effect: simply say that if damage is true (when an entity collides) it deals the effect
now I hope to help

Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
wow thank you it seems a…
Mon, 03/01/2021 - 00:23

wow thank you it seems a little complicated for my level but all this already gives me a very good idea thank you very much