Hey guys, i try to generate things on the ground and need the ground block from above. This is what i have now, but i can´t find out how to get the Y coordinate from the latest block. I´m too dumb to find the solution..xd
If code doesn't do what you expect, just "trace" the execution. You can use debug views and breakpoints, but I find it is easier to just add console print statements throughout the code. Print out enough stuff so you know that the method is being called, what position it is checking and what it is finding at that position.
It should be very, very obvious what is going wrong if you simply watch the execution.
The strange thing is that all works fine if i only test for one block type. Like: foundGround = block != Blocks.AIR ;
That is because you're using an OR operation (||) instead of an AND (&&). But probably the easiest way to understand the logic is to keep the OR and use the NOT operatior (!) on the result of the combined OR. Like this: