Block that deals damage within a radius when redstone activated

Started by TheHylian on

Topic category: Help with Minecraft modding (Java Edition)

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
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?

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.

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?

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);

 

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 

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