Skip to content

Commit c09dbfa

Browse files
committed
Fix example
1 parent 7f5160d commit c09dbfa

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/basic/example.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
logger.setLevel(logging.DEBUG)
2828

2929
# Set the following values:
30-
USERNAME = ''
30+
USERNAME = 'spockbot'
3131
PASSWORD = ''
3232
SERVER = 'localhost'
3333

@@ -37,6 +37,8 @@
3737
'username': USERNAME,
3838
'password': PASSWORD,
3939
},
40+
# xxx
41+
'auth': {'online_mode': bool(PASSWORD)},
4042
}
4143

4244
# Load the plugins.

examples/basic/example_plugin.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,11 @@ def periodic_event_handler(self):
100100

101101
# Place a block in front of the player
102102
self.interact.place_block(self.clientinfo.position
103-
+ Vector3(-1, -1, 0))
103+
+ Vector3(-1, 0, -1))
104104

105105
# Read a block under the player
106-
block_pos = self.clientinfo.position
107-
block_id, meta = self.world.get_block(block_pos.x,
108-
block_pos.y,
109-
block_pos.z)
106+
block_pos = self.clientinfo.position.floor()
107+
block_id, meta = self.world.get_block(*block_pos)
110108
block_at = blocks.get_block(block_id, meta)
111109
self.chat.chat('Found block %s at %s' % (block_at.display_name,
112110
block_pos))

0 commit comments

Comments
 (0)