Entity that detects when entities are nearby

Started by Withie The Cryptid on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity that detects when entities are nearby

I'm trying to make an entity that disguises itself as a block until certain entities come within a certain radius. I've managed to make this kinda sorta work with Collision, but this just makes it so you need to be right up next to it for the mob to really detect you, when I want it to detect and attack you from about 10 blocks away. I've tried the whole 'detect within a cube' blocks and they work, that's not the issue I'm having though. The real issue is figuring out how to trigger it. I've tried doing a global 'Entity finds target' trigger as well, but that doesn't work either. I could be doing something wrong though.

 

Any ideas?

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
on player tick/loaded entity…
Sun, 01/07/2024 - 23:36

on player tick/loaded entity tick search for a entity within 3 blocks, and if that player has [insert your way to tell disguises from normal player] (id use a potion effect called hidden) so if the player has the hidden potion effect they are a block (however you managed that) and then remove that effect from the target making them visible