If the player damages Structure, attack it

Started by WELLOTHEHERO on

Topic category: Help with modding (Java Edition)

Last seen on 20:29, 20. Apr 2023
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If the player damages Structure, attack it

I have a mob I'm making, if the player damages the Structure where this mob is located, I want the mob to attack her, how can I do that?

Last seen on 04:19, 17. Apr 2024
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is no way to do this;…
Fri, 07/09/2021 - 15:21

There is no way to do this; MCreator does not provide a way for the game to detect which blocks are part of a custom structure.

Last seen on 15:05, 6. Oct 2023
Joined Jan 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could try to create…
Mon, 07/19/2021 - 11:48

You could try to create every block as new, and then use "on block destroyed" for every single block Would be  time consuming tho

If you created structure…
Mon, 08/16/2021 - 17:56

If you created structure with only custom blocks (from your mod), you can add command after breaking each, adding effect with range (range should be high enough to reach whole structure). Let's call the effect "structure_break" and give it range of 50 blocks:

effect give @e[distance=..50] your_mod_id:structure_break 3

Then, let's make additional procedure returning true if that effect is applied on mob you want to attack, and put that procedure as "trigger" for this mob to become aggressive ^^
I hope it helps!