from mcpi.minecraft import Minecraft
mc = Minecraft.create()
import time
pos = mc.player.getTilePos()
x = pos.x
y = pos.y
z = pos.z
stone = 98
lava = 10
mc.postToChat("The floor is lava!")
mc.setBlocks(x-2,y-2,z-2,x+2,y-1,z+2,stone)
mc.setBlocks(x-1,y-1,z-1,x+1,y-1,z+1,lava)
time.sleep(3)
pos = mc.player.getTilePos()
blockType = mc.getBlock(pos.x,pos.y,pos.z)
ans = str(bool(blockType == lava))
mc.postToChat(ans)
The code means that the position starts in the player. The build makes a cube underneath the player and inside it there is lava. It also warns the player that the floor will be in lava. The blocks are stone and inside the square is filled with lava. The player should get out of the lava in three seconds.
mc.player.getTilePos(): where the player is the location.
mc.post To Chat(text): what is said to the minecraft chat.
mc.setBlocks(x1, y1, z1, x2, y2, z2, block_id): set that block on the exact coords.
mc.getBlock(x, y, z): what block the player is placed.