How do I check for if a player is in a generated structure?

Started by Gun Man on Wed, 08/12/2020 - 22:46

Topic category: Help with MCreator software

Last seen on 11:32, 22. Oct 2020
Joined May 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do I check for if a player is in a generated structure?
Wed, 08/12/2020 - 22:46

How do I check for if a player is in a generated structure? I want to do this because i want to run certain procedures if a player is in a structure.

Vanilla Example: If a player enters a Stronghold, they get the advancement "Eye Spy"

Modded Example: If a player enters a pre-generated cabin, a music track plays.

Last seen on 08:28, 9. Oct 2020
Joined Jul 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You could make a custom…
Thu, 08/13/2020 - 06:53

You could make a custom entity (that does not have health, despawn, or move) that spawns in the center of the structure. In its tick update, make it check for player in radius, and if true, make it do what you want then despawn (only despawn it if you want something to happen only the first time you enter).

If you wanted something to happen to the player, not just a sound play, you may need to have the entity tick only despawn itself, not do anything else, and run a global player tick that tests for the entity then does what you want (besides despawning the entity).

Alternatively, make an invisible block in the doorways that triggers what you want, though this is not optimal.

Last seen on 11:32, 22. Oct 2020
Joined May 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How would I get the entity…
Sun, 08/30/2020 - 04:36

How would I get the entity to check for the player in a radius?

Last seen on 08:28, 9. Oct 2020
Joined Jul 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
There is a procedure for it,…
Thu, 09/24/2020 - 17:41

There is a procedure for it, though I'm afraid I can't remember which section it is in.