How to check for a block around a starting point and delete it if it meets my criteria?

Started by Nicoconut on

Topic category: Help with modding (Java Edition)

Last seen on 22:38, 15. Jun 2020
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to check for a block around a starting point and delete it if it meets my criteria?
Sun, 06/07/2020 - 05:02 (edited)

Hey guys.

 

I'm sorry if this is a somewhat redundant topic. I am very much a noob in MCCraft, although I have moderate experience with coding. I wanted to try my hand at making one of those tree chopper mods(you break one tree block and all others fall along with it). I was thinking of making a nested loop of checks: first you break a block. if it is a wood block, check on a 3x3x3 cube if there is another wood block around. If true, break said block(s) and iterate around them as well to see if there's another wooden block nearby. And so on until the program can't find a wooden block. I don't know if it's the best way of going about it, but it's my current plan. I've looked around, both in the 6x6x6 template and in some other forum posts, but i'm having trouble. So far this is what I've got, it is triggered by breaking a block with the axe.

This was SUPPOSED to check for the usual 6x6x6 cube for other wood materials, but I don't think it works at all. I get the "I think that was wood" message(related to the block that was broken with the axe), but not the "Found more wood around" one. Here's a piece of how the console looks after the block is broken:

[Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:60 OffX is -3.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:61 OffY is -3.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:62 OffZ is -3.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:65 OffX is -2.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:68 OffY is -2.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is -2.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is -1.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 0.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 1.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 2.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 3.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:68 OffY is -1.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 4.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 5.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 6.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 7.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 8.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 9.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:68 OffY is 0.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 10.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 11.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 12.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 13.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 14.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 15.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:68 OffY is 1.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 16.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 17.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 18.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 19.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 20.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 21.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:68 OffY is 2.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 22.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 23.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 24.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 25.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 26.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 27.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:68 OffY is 3.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 28.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 29.0 
32:30.52 [Server thread/INFO] [STDOUT/]: [net.mcreator.lumberjacker.procedures.MainProcedure:executeProcedure:71 OffZ is 30.0 

I'll attach the procedure as well. I think the calculations aren't right. How could I fix this? Or do you guys have any better ideas of how tree choppers work? Any help is greatly appreciated!

 

EDIT: Ah, I can't figure out how to make an attachment :B sorry

Edited by Nicoconut on Sun, 06/07/2020 - 05:02
Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't think that's how you…
Sun, 06/07/2020 - 07:20

I don't think that's how you work with for loops

Last seen on 22:38, 15. Jun 2020
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could you please ellaborate?…
Sun, 06/07/2020 - 15:21

Could you please ellaborate? I took the base from this post: mcreator.net/tracker/issue/48704

It's not very far from the template in MCreator either