I have tried many times placing a door but all that seems to appear is the bottom half. How do I get the top half?
My python code is:
mc.setBlocks (10,11,16,10,10,16,64)
I have tried many times placing a door but all that seems to appear is the bottom half. How do I get the top half?
My python code is:
mc.setBlocks (10,11,16,10,10,16,64)
You'll need to do it in two commands:
mc.setBlock(x, y, z, 64, 0)
mc.setBlock(x, y+1, z, 64, 8)
So, using your numbers, you would need:
mc.setBlock(10, 10, 16, 64, 0)
mc.setBlock(10, 11, 16, 64, 8)
Also, note that the sub-type for the blocks don't work if you use the named block types. So, for example, this won't work:
mc.setBlock(x, y, z, block.DOOR_WOOD, 0)
mc.setBlock(x, y+1, z, block.DOOR_WOOD, 8) #The 8 will be ignored
Although it's not documented anywhere, I assume that there are 8 states for the bottom of the door (0 - 7) corresponding to 4 directions closed and 4 directions opened. Then add 8 to the get the same direction for the top half of the door (8 - 15).
You can do something similar for other two part objects like beds.
The reason that the "8" will be ignored is that technically the setBlock() function takes a block id as the fourth argument (not a block). So if your fourth argument was block.DOOR_WOOD.id then the "8" will work.
As it is, by supplying the block type (rather than just its "id") means that Python takes the other attributes from the block and uses them as arguments - thus always using the default "0" for the "data" argument.
HTH. (NB: This /really/ confused me at first).
mc.setBlock(pos.x, pos.y, pos.z, 64, 1) mc.setBlock(pos.x, pos.y+1, pos.z, 64, 9)
mc.setBlock(pos.x + 1, pos.y, pos.z, 64, 6) mc.setBlock(pos.x + 1, pos.y+1, pos.z, 64, 13)