[SOLVED] Reset attack target of entity/ Stop entity from targeting an entity

Started by RedWirePlatinum on

Topic category: Feature requests and ideas for MCreator

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED] Reset attack target of entity/ Stop entity from targeting an entity
Sat, 08/26/2023 - 03:33 (edited)

As I previously mentioned in another post, you are currently unable to set an attack target of an entity to nothing. Changing it to itself will actually try making it attack itself 
(Examples: Creepers will automatically ignite when the attack target is itself since it is TECHNICALLY close to its target.. which is itself. Ghasts and Skeletons will try shooting at itself but will not deal any damage)

Edited by RedWirePlatinum on Sat, 08/26/2023 - 03:33
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the meantime, this plugin…
Mon, 05/29/2023 - 19:25

In the meantime, this plugin has what you are looking for.

https://mcreator.net/plugin/95170/procedures-plus-forge-1165-1182-1192

First section has a block that changes an entities attack target to none. You need to pair it with the global trigger "Entity Sets its attack target"

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It also says that it works…
Thu, 06/08/2023 - 21:26

It also says that it works on a tick update, so this works. thank u

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So in the newest version of…
Fri, 07/07/2023 - 02:09

So in the newest version of Mcreator (mcreator version 2023.2, and minecraft version 1.20 I believe) this plugin does not work, for the "selected generator does not support _______ block line will be skipped" error. However if you use the block 

Set the attack target of (*event/target entity) to (Get nearest entity at x: (x) y: (y) z: (z) in square cube with size (0.1) of type (**Block display))

 

* You can change Event/target entity to whatever the F*** you want.

** You can change this drop down to be anything you want too, but making it something like a block display, which are very rarely going to be within 0.1 block of your entity, will ensure you don't get bugs (but what do I know?)

 

Doing these things will trick the game into making it a Null value almost every time which technically it doesn't want you to do that bc IDK but in this case we can just force it

P.S. If you didn't know null bascally stands for nothing

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've been trying forever to…
Fri, 07/07/2023 - 02:15

I've been trying forever to make a Bee smoker to make the bees not aggroed at you if you have angered them. NOTHING was working. Then I came to this little forum and it helped me come up with the code idea you see above, so I would like to thank all of the above members that wrote something (excluding myself) you ultimately lead to my idea.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
UPDATE:You don't need the…
Sat, 08/26/2023 - 03:33

UPDATE:
You don't need the procedures plus plugin (technically), you can just use a custom code snippet and paste this into it:

if (entity instanceof Mob _entity) _entity.setTarget(null);

this will set the attack target of the target entity to nothing. to make it the source entity, replace if (entity  with if sourceentity 

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry to bring this again…
Wed, 01/31/2024 - 21:30

Sorry to bring this again but i tried that code and didnt work for me
what am i doing wrong?
the if condition is working as intended but mobs are still able to see me from beyond. 
I tried to make a procedure that reduces mobs awareness of a player sneaking to 4 blocks.