Skip to content

Commit b6e8b0e

Browse files
committed
Merge branch 'next' into release
2 parents 2075234 + c596ef2 commit b6e8b0e

4 files changed

Lines changed: 60 additions & 30 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"mc-assets": "^0.2.72",
158158
"minecraft-inventory-gui": "github:zardoy/minecraft-inventory-gui#next",
159159
"mineflayer": "github:zardoy/mineflayer#gen-the-master",
160-
"mineflayer-mouse": "^0.1.25",
160+
"mineflayer-mouse": "^0.1.26",
161161
"npm-run-all": "^4.1.5",
162162
"os-browserify": "^0.3.0",
163163
"path-browserify": "^1.0.1",
@@ -238,5 +238,5 @@
238238
"ignorePatchFailures": false,
239239
"allowUnusedPatches": false
240240
},
241-
"packageManager": "pnpm@10.8.0+sha512.0e82714d1b5b43c74610193cb20734897c1d00de89d0e18420aebc5977fa13d780a9cb05734624e81ebd81cc876cd464794850641c48b9544326b5622ca29971"
241+
"packageManager": "pnpm@10.32.1"
242242
}

pnpm-lock.yaml

Lines changed: 42 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -649,32 +649,34 @@ export async function connect (connectOptions: ConnectOptions) {
649649
bot._client.emit('connect')
650650
} else {
651651
const setupConnectHandlers = () => {
652-
Socket.prototype['handleStringMessage'] = function (message: string) {
652+
bot._client.socket['handleStringMessage'] = function (message: string) {
653653
if (message.startsWith('proxy-message') || message.startsWith('proxy-command:')) { // for future
654654
return false
655655
}
656656
if (message.startsWith('proxy-shutdown:')) {
657+
console.log('Got current connection proxy shutdown message', message)
657658
lastKnownKickReason = message.slice('proxy-shutdown:'.length)
658659
return false
659660
}
660661
return true
661662
}
663+
const closeUnknownReason = () => {
664+
if (!bot || ended) return
665+
bot.emit('end', lastKnownKickReason ?? 'WebSocket connection closed with unknown reason')
666+
}
667+
662668
bot._client.socket.on('connect', () => {
663669
console.log('Proxy WebSocket connection established')
664670
//@ts-expect-error
665671
bot._client.socket._ws.addEventListener('close', () => {
666672
console.log('WebSocket connection closed')
667673
setTimeout(() => {
668-
if (bot) {
669-
bot.emit('end', 'WebSocket connection closed with unknown reason')
670-
}
674+
closeUnknownReason()
671675
}, 1000)
672676
})
673677
bot._client.socket.on('close', () => {
674678
setTimeout(() => {
675-
if (bot) {
676-
bot.emit('end', 'WebSocket connection closed with unknown reason')
677-
}
679+
closeUnknownReason()
678680
})
679681
})
680682
})

src/react/CreateWorld.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const gameModes = ['survival', 'creative'/* , 'adventure', 'spectator' */]
1818
export const creatingWorldState = proxy({
1919
title: '',
2020
type: worldTypes[0],
21-
gameMode: gameModes[0],
21+
gameMode: 'creative',
2222
version: '',
2323
plugins: [] as string[]
2424
})
@@ -69,10 +69,12 @@ const CreateWorldBase = ({ cancelClick, createClick, customizeClick, versions, d
6969
{/* <Button onClick={() => customizeClick()} disabled>
7070
Customize
7171
</Button> */}
72-
<Button onClick={() => {
73-
const index = gameModes.indexOf(gameMode)
74-
creatingWorldState.gameMode = gameModes[index === gameModes.length - 1 ? 0 : index + 1]
75-
}}
72+
<Button
73+
onClick={() => {
74+
const index = gameModes.indexOf(gameMode)
75+
creatingWorldState.gameMode = gameModes[index === gameModes.length - 1 ? 0 : index + 1]
76+
}}
77+
disabled
7678
>
7779
Game Mode: {gameMode}
7880
</Button>

0 commit comments

Comments
 (0)