Detecting Entering a Custom Structure

Started by Adamimoka on Mon, 05/17/2021 - 19:39

Topic category: Help with modding (Java Edition)

Last seen on 00:19, 25. Jul 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Detecting Entering a Custom Structure
Mon, 05/17/2021 - 19:39

I am creating a mod that adds a new structure and I want to run a procedure to give an achievement once the player enters the structure. Other posts recommended creating invisible armor stands (or something along those lines) and if you get close to the armor stand it gives you the achievement. I don't really like this solution because with commands it can be messed up, there has to be a way to just detect if they are in the structure because in un-modded Minecraft they already have this (ex: you get an achievement for entering the Stronghold)

Last seen on 20:26, 25. Jul 2021
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
put invisible and…
Tue, 05/18/2021 - 18:11

put invisible and replaceable blocks all inside the structure that when you touch them, they detect you (and make it so you can't break them

Last seen on 00:19, 25. Jul 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Did you even read my post? …
Tue, 06/01/2021 - 21:25

Did you even read my post?
"Other posts recommended creating invisible armor stands (or something along those lines) and if you get close to the armor stand it gives you the achievement. I don't really like this solution."

Last seen on 05:44, 9. Jun 2021
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hi! I actually think that…
Tue, 06/01/2021 - 22:54

Hi! I actually think that Pepper's suggestion would be better, specifically because it doesn't rely on commands or advancements. Of course, you could mess it up with commands if you're really determined, like using commands to delete the invisible blocks, but there's always going to be some way to mess it up, and that's kind of something you have to accept with coding. However, those ways of messing it up don't have to be accessible to someone who's just playing normally. For example, if the only way of messing it up would be to delete the invisible blocks with commands, people don't just walk around delete blocks with commands in a normal playthrough.

I'd suggest creating an invisible block as Pepper says, and when a player comes into contact with it you have it run a procedure to do whatever it is you're wanting, and at the end of the procedure, you have it delete itself so that way it doesn't repeat it's function again (unless you want it to be able to be used multiple times, i.e. if the block is used to transport you to another dimension or something similar).

Last seen on 05:44, 9. Jun 2021
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I just realized that if you…
Tue, 06/01/2021 - 22:59

I just realized that if you're trying to make it so it detects when a player enters the structure from anywhere, not from a designated entryway, the invisible block method becomes less appealing. If that's what you're trying to do, then sorry for wasting your time, haha. I'd still consider the invisible block method, but I understand not wanting to use it.

Last seen on 05:44, 9. Jun 2021
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
The base game uses "Cave Air…
Tue, 06/01/2021 - 23:02

The base game uses "Cave Air" for generating caves, so maybe you could just add in "structure air?" I don't know, I honestly don't know how to approach that problem, I'm just brainstorming ideas.