[Solved]Help with block detection

Started by Seshua on

Topic category: Help with modding (Java Edition)

Last seen on 11:52, 23. Apr 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Solved]Help with block detection
Sun, 10/11/2020 - 09:52 (edited)

Mcreator version 2020.4

Mincraft/Forge version 1.15.2

 

Recently I figured out about the procedure templates, and I came across the "Check for a block in a 6x6x6 box" procedure. Which I was like cool, let me make a ore detection item. So I made a 'Diamond Ore Detector'. My issue is that its not exactly detecting blocks in the radius like it says, for example sometimes it will detect diamonds that are 1 y level below me and sometimes it won't. Another example, sometimes it will detect a diamond ore that is right in front of me if i'm facing say 'south' , and then I go up 1 y level and look at it facing south again , but it won't detect it. In the screenshot I added another IF statement that wraps around the original template code, which just detects that my item is in the off-hand slot. Other then that its all original. *Side note* If someone can help me understand why its not detecting the way I think it should, then great, but if someone could explain (if possible in mcreator) how to make it show some bounding boxes for a visual I can use while testing. That would be great as well. Anyways thanks for any/all replies!

Screenshot ↓

https://i.imgur.com/nN6EM6I.png

 

 

Edited by Seshua on Sun, 10/11/2020 - 09:52
Last seen on 13:50, 6. Apr 2024
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When you set the local…
Sun, 10/11/2020 - 07:59

When you set the local variables for coordX, coordY and coordZ, you must not set them to 0 but to -2.
The goal of this procedure is to check for every X and Y and Z of the cube of 5x5x5 for a diamond ore. if you set the coordX to 0, it will start at x = 0 y = coordY and z = coordZ and it will end at x = 5, y = coordY + 5 and z = coordZ + 5
It's pretty hard to explain expecially if you're not good at algorithms

Last seen on 11:52, 23. Apr 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Max094_Reikeb Thank you…
Sun, 10/11/2020 - 09:45

@Max094_Reikeb Thank you very much, Once I input the -2 in the initial variable setup for coordX, coordY and coordZ it worked flawlessly. After some testing around, I made a screenshot of a 10x10x10 radius, represented by the orange carpet, the red being the chunk border and the white and black blocks representing the height.

 

Screenshot ↓

https://i.imgur.com/vk1LqRs.png

Last seen on 11:52, 23. Apr 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ugh I can't edit a post,…
Sun, 10/11/2020 - 09:51

Ugh I can't edit a post, also just wanted to mention that I figured something else out. That is, since I was using a 5x5x5 area, the initial coords needed to be -2. i.e when i made the 10x10x10 radius the coords had to be set to -10, and the 'Repeats need to be double to 20.