Next, add the code into your project as shown.
Here we have another infinite/forever loop with the getPos function inside it, allowing us to constantly know where the player is.
We also see a new function for Minecraft called “getBlock”. Like the “setBlock” function, the “setBlock” function takes 3 parameters, these are used to give Minecraft a location to get the block from.
When this function is done, it returns the id of the block at that position. Here we save it into a variable called “groundBlock”. With this code, we will always know the type of block the player is currently standing on!