We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 821cdd1 commit 03d8c53Copy full SHA for 03d8c53
lookAt_Bot/index.js
@@ -0,0 +1,19 @@
1
+const mineflayer = require('mineflayer')
2
+
3
+const bot = mineflayer.createBot({
4
+ host: 'localhost',
5
+ port: 37269,
6
+ username: 'lookAt_Bot'
7
+})
8
9
+function lookAtNearestPlayer () {
10
+ const playerFilter = (entity) => entity.type === 'player'
11
+ const playerEntity = bot.nearestEntity(playerFilter)
12
13
+ if (!playerEntity) return
14
15
+ const pos = playerEntity.position.offset(0, playerEntity.height, 0)
16
+ bot.lookAt(pos)
17
+}
18
19
+bot.on('physicTick', lookAtNearestPlayer)
0 commit comments