If the player damages Structure, attack it

Started by WELLOTHEHERO on

Topic category: Help with Minecraft modding (Java Edition)

Active 2 years ago
Joined Oct 2020
Points:
685

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 15
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?

Active 3 months ago
Joined May 2018
Points:
1125

User statistics:

  • Modifications: 8
  • Forum topics: 36
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 366
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.

Active 1 month ago
Joined Jan 2019
Points:
890

User statistics:

  • Modifications: 6
  • Forum topics: 12
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 203
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

Active 10 months ago
Joined Dec 2020
Points:
1157

User statistics:

  • Modifications: 2
  • Forum topics: 28
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 819
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!