0

I have been using a readable CSV file and a bit of code to generate a fort, but then not a single one of my beds, doors or ladders appeared. Only the back half of my beds actually appeared. For a test I used setBlock() to make a bed but again only the back half appeared. How do I make Python realise I want to make it cover 2 blocks?

closed as off-topic by techraf, Milliways, Steve Robillard, Jacobm001 Oct 25 '17 at 15:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – techraf, Milliways, Steve Robillard, Jacobm001
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I realize this is a really old topic. However, with all respect to techraf, Milliways, Steve Robillard, and Jacobmoo1, this question deals with an API for a version of minecraft ONLY avaiable on the Raspberry Pi. – Thorin Schmidt May 10 '18 at 13:05
4

Just as in vanilla Minecraft, you need to set two blocks to be a bed for this to work.

The vanilla commands would be:

/setblock 0 64 0 bed 0
/setblock 0 64 1 bed 8

(for a bed facing north)

You should do something similar in your Minecraft Pi Python code:

mc.setBlock(x, y, z, 26, 0)
mc.setBlock(x, y, z + 1, 26, 8)

Remember the API for setBlock is setBlock(x,y,z,id,[data]). The explanation for the data code is available at the Gamepedia wiki:

0x0 Head facing South

0x1 Head facing West

0x2 Head facing North

0x3 Head facing East

0x4 (bit flag) When 0, the bed is empty. When 1, the bed is occupied

0x8 (bit flag) When 0, the foot of the bed.

When 1, the head of the bed

The door operates similarly, but with block ID 64 instead, and you'll need to modify the y (up/down axis, with positive being up) instead of the z (north/south axis, with positive being south).

  • I am puzzled, I tried setting two bed blocks next to each other but the result was two back ends of a bed stuck together (if I mines one the other disappeared as well, just like if you placed and mined it with your characters hand) how do I get around this? setBlocks() ? Or is there a way of telling Minecraft to join them? – user75085 Oct 22 '17 at 8:25
  • @user75085 Did you set use the exact example I gave, including the 0 and 8? That is how you tell the game that one half is the bottom end and one is the top end. – Aurora0001 Oct 22 '17 at 8:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.