Only perform the procedure on player-placed blocks

Started by EntityRedShadow on

Topic category: Help with modding (Java Edition)

Last seen on 12:56, 5. Jul 2024
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only perform the procedure on player-placed blocks

I would like to know how to save the  data of blocks the player placed so that when I execute a procedure, I can delete those blocks that the player has placed. For example, if the player built a house then I execute a procedure that deletes blocks, I want the procedure to only delete the blocks that the player placed themselves which in this case is the house... So the house is deleted basically...

Last seen on 19:05, 4. Jul 2024
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hmm that is a valid problem…
Thu, 07/04/2024 - 17:17

hmm that is a valid problem but that is a bit tricky.

you could have a huge list of data that stores the position of every single block the player placed and gets updated when the player places a block, but that would take too much energy.

i think you can use one of these workarounds:

  1. only destroy artificial-type blocks like planks, cobblestone, bricks, and not grass, dirt, logs, stone, etc.. (this is what vanilla minecraft uses for endermen picking up blocks)
  2. or! i think there is like some way that vanilla minecraft detects if logs are naturally generated or player placed. you could do some research on the minecraft wiki about how that works. if this fails then just do the other solution
Last seen on 12:56, 5. Jul 2024
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh we have the same solution…
Fri, 07/05/2024 - 10:12

Oh we have the same solution in number 1... I used text to save the coordinates of each block placed by the player and used a plugin to call an index of that text variable... Still, thank you for answering!