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

Started by Gun Man on

Topic category: Help with MCreator software

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I check for if a player is in a generated structure?

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.

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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?

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you find out what…
Mon, 05/17/2021 - 18:42

Can you find out what procedure it is? I am looking for a way to detect this and if you are right, that would help a lot. Thank you.

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
   I came up with a solution…
Mon, 05/17/2021 - 22:24

 

 I came up with a solution. I use it often in my random structures. Make invisible entity. With this method you have to set the entity tick high when placing in your structures. Lower it back to normal before testing your structure. Use this method with caution. I will make a small tutorial that is more in depth. I made a flea entity. This method is very flexible and easy to understand.

 

 This procedure will fire off a sound when the player is 5 blocks away and de-spawn 1 tick later. I added random chance for flexibility. You can use this method to fire off anything you want. Command block, spawn entity etc.

 

      https://i.ibb.co/xq2nd1b/2021-05-17-17-41-2.png

 

Chewy