Block that deals damage within a radius when redstone activated

Started by TheHylian on

Topic category: Help with modding (Java Edition)

Last seen on 21:21, 21. Feb 2021
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Block that deals damage within a radius when redstone activated
Fri, 04/10/2020 - 19:42 (edited)

I'm making a mod that in part contains a poison gas vent. This vent, when redstone activated, should damage all entities withing a 16 block radius of it. I attempted to use procedures for this, but I'm not sure how exactly to set up the XYZ and world dependencies for it. How can I anchor the block's position to the AoE?

Edited by TheHylian on Fri, 04/10/2020 - 19:42
Last seen on 03:09, 16. Apr 2024
Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can someone give an example…
Wed, 07/01/2020 - 15:55

Can someone give an example of the code blocks for this?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
An example sure, with code…
Wed, 07/01/2020 - 17:27

An example sure, with code blocks no.

List<LivingEntity> mobs = entity.world.getEntitiesWithinAABB(LivingEntity.class, entity.getBoundingBox().grow(20), null);

That gives an iterable list of mobs within 20 blocks. Not radius though.

Last seen on 03:09, 16. Apr 2024
Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Do I copy this and post it…
Thu, 07/02/2020 - 16:15

Do I copy this and post it into a command code block?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That is a java code that can…
Thu, 07/02/2020 - 17:27

That is a java code that can be put in a class. But it won't do anything without an iteration.

 

Now that custom snippets are back;

List<LivingEntity> mobs = entity.world.getEntitiesWithinAABB(LivingEntity.class, entity.getBoundingBox().grow(20), null);

 

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
use a World management code…
Thu, 07/02/2020 - 17:53

use a World management code block "Execute "command" at x y z"

in the command text field enter something like "/effect @e[r=16] minecraft:instant_damage 1 5", this gives all entities within radius 16 blocks 5x instant damage effect for 1 second 

Last seen on 03:09, 16. Apr 2024
Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is how I did it in 1.15…
Tue, 07/07/2020 - 14:36

This is how I did it in 1.15.2

/effect give @e[distance=..2] minecraft:instant_damage 1 1