Skip to content

Commit 0b76a95

Browse files
authored
Merge pull request michaljaz#53 from KaffinPX/patch-1
add dropping item 'Q'
2 parents c133ca1 + af6505e commit 0b76a95

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/scripts/EventHandler.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class EventHandler {
1515
KeyA: 'left',
1616
Space: 'jump',
1717
ShiftLeft: 'sneak',
18-
KeyR: 'sprint'
18+
KeyR: 'sprint',
19+
KeyQ: 'drop'
1920
}
2021
this.keys = {}
2122
this.gameState = null
@@ -43,6 +44,9 @@ class EventHandler {
4344
focus = i - 1
4445
}
4546
}
47+
if (z.code === 'KeyQ') {
48+
this.game.socket.emit('drop')
49+
}
4650
if (z.code === 'Escape' && this.gameState === 'inventory') {
4751
this.setState('menu')
4852
}

src/scripts/proxy/Proxy.worker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ addEventListener('message', function (e) {
142142
case 'rotate':
143143
bot.look(data[0][0], data[0][1])
144144
break
145+
case 'drop':
146+
bot.tossStack(bot.heldItem)
147+
break
145148
case 'dig':
146149
block = bot.blockAt(vec3(data[0][0], data[0][1] - 16, data[0][2]))
147150
if (block !== null) {

0 commit comments

Comments
 (0)