Preventing players from placing or breaking blocks in a certain area

Started by Paulypus on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Preventing players from placing or breaking blocks in a certain area

I would like to, for the purpose of making a dungeon with things such as a maze and parkour, make the player unable to place or break blocks in an area while still allowing the player to interact with things such as chests. If anyone knows how to do this, the help is greatly appreciated.

Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could make a new,…
Mon, 12/05/2022 - 01:21

You could make a new, unbreakable block to build it out of to avoid the walls/puzzles from being broken (it could even be visually identical to a vanilla block if so desired). You could then make a 'on neighbor block update' procedure which sets the block back to air (though it would take a bit more work to return this block to the player's inventory if that's desired, albeit still probably possible).

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When they're in that certain…
Mon, 12/05/2022 - 04:19

When they're in that certain area change their gamemode to Adventure

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I may use the method of…
Fri, 12/09/2022 - 01:29

I may use the method of adding a new block, but for now I'm just going to leave it as-is and the player can cheat on the puzzles and such if they don't like fun

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have a solution.Create two…
Sun, 12/18/2022 - 17:09

I have a solution.
Create two procedures, with global triggers block broken or block placed
Then, add one custom block somewhere in the dungeon (this block has to get destroyed at the end if you want the dungeon to become editable)
For both procedures, have it check if the player who did it is in proximity to the dungeon block above. If yes, then cancel the global trigger.
You could replace proximity to a custom block with some other way of testing if the player is in the dungeon, but the general idea is global triggers and then canceling.

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Option 2 is mining fatigue…
Sun, 12/18/2022 - 17:10

Option 2 is mining fatigue plus the above solution to prevent placement of blocks

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi! I have a question, and I…
Thu, 12/22/2022 - 07:31

Hi! I have a question, and I can't dm so I had to put it here, really sorry abt that. But, on this post: https://mcreator.net/forum/62963/be-immune-lightning-player?page=1 you made a comment and said you were able to do this for different damage types. I was just wondering how you were able to figure this out? Like I tried changing it from DamageSource.LIGHTNING_BOLT to DamageSource.TRIDENT but that didn't work, so I was hoping you could lemme know please. Thanks, and sorry again for the irrelevant comment!