fix always display reconnect and better last packets display (time)
This commit is contained in:
parent
09cd2c3f64
commit
518d6ad866
6 changed files with 23 additions and 10 deletions
|
|
@ -86,7 +86,7 @@
|
|||
"mojangson": "^2.0.4",
|
||||
"net-browserify": "github:zardoy/prismarinejs-net-browserify",
|
||||
"node-gzip": "^1.1.2",
|
||||
"mcraft-fun-mineflayer": "^0.1.8",
|
||||
"mcraft-fun-mineflayer": "^0.1.10",
|
||||
"peerjs": "^1.5.0",
|
||||
"pixelarticons": "^1.8.1",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
|
|
|
|||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
|
|
@ -135,8 +135,8 @@ importers:
|
|||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
mcraft-fun-mineflayer:
|
||||
specifier: ^0.1.8
|
||||
version: 0.1.8(encoding@0.1.13)(mineflayer@https://codeload.github.com/zardoy/mineflayer/tar.gz/748163e536abe94f3dc8ada7a542bcd689bbbf49(encoding@0.1.13))
|
||||
specifier: ^0.1.10
|
||||
version: 0.1.10(encoding@0.1.13)(mineflayer@https://codeload.github.com/zardoy/mineflayer/tar.gz/748163e536abe94f3dc8ada7a542bcd689bbbf49(encoding@0.1.13))
|
||||
minecraft-data:
|
||||
specifier: 3.83.1
|
||||
version: 3.83.1
|
||||
|
|
@ -6690,9 +6690,9 @@ packages:
|
|||
resolution: {integrity: sha512-j2D1RNYtB5Z9gFu9MVjyDBbiALI0mWZ3xW/A3PPefVAHm3HJ2T1vH+1XBov1spBGPl7u+Zo7mRXza3X0egbeOg==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
|
||||
mcraft-fun-mineflayer@0.1.8:
|
||||
resolution: {integrity: sha512-jyJTihNHfeToBPwVs3QMKBlVcaCABJ25YN2eoIBQEVTRVFzaXh13XRpElphLzTMj1Q5XFYqufHtMoR4tsb08qQ==}
|
||||
version: 0.1.8
|
||||
mcraft-fun-mineflayer@0.1.10:
|
||||
resolution: {integrity: sha512-KHzPts82I39nTDZlGwqJo1JXLwaIUHphBbmGWv7oYztUrq3iPiJDEIFgst0ROO/apjtHjzbCM9eb19qWw1JM3Q==}
|
||||
version: 0.1.10
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
peerDependencies:
|
||||
'@roamhq/wrtc': '*'
|
||||
|
|
@ -17579,7 +17579,7 @@ snapshots:
|
|||
maxrects-packer: 2.7.3
|
||||
zod: 3.24.1
|
||||
|
||||
mcraft-fun-mineflayer@0.1.8(encoding@0.1.13)(mineflayer@https://codeload.github.com/zardoy/mineflayer/tar.gz/748163e536abe94f3dc8ada7a542bcd689bbbf49(encoding@0.1.13)):
|
||||
mcraft-fun-mineflayer@0.1.10(encoding@0.1.13)(mineflayer@https://codeload.github.com/zardoy/mineflayer/tar.gz/748163e536abe94f3dc8ada7a542bcd689bbbf49(encoding@0.1.13)):
|
||||
dependencies:
|
||||
'@zardoy/flying-squid': 0.0.49(encoding@0.1.13)
|
||||
exit-hook: 2.2.1
|
||||
|
|
|
|||
|
|
@ -362,8 +362,8 @@ export async function connect (connectOptions: ConnectOptions) {
|
|||
miscUiState.hasErrors = true
|
||||
if (miscUiState.gameLoaded) return
|
||||
|
||||
appStatusState.showReconnect = true
|
||||
setLoadingScreenStatus(`Error encountered. ${err}`, true)
|
||||
appStatusState.showReconnect = true
|
||||
onPossibleErrorDisconnect()
|
||||
destroyAll()
|
||||
}
|
||||
|
|
@ -712,8 +712,8 @@ export async function connect (connectOptions: ConnectOptions) {
|
|||
bot.on('kicked', (kickReason) => {
|
||||
console.log('You were kicked!', kickReason)
|
||||
const { formatted: kickReasonFormatted, plain: kickReasonString } = parseFormattedMessagePacket(kickReason)
|
||||
appStatusState.showReconnect = true
|
||||
setLoadingScreenStatus(`The Minecraft server kicked you. Kick reason: ${kickReasonString}`, true, undefined, undefined, kickReasonFormatted)
|
||||
appStatusState.showReconnect = true
|
||||
destroyAll()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ declare module 'mineflayer' {
|
|||
export const getLastAutoCapturedPackets = () => circularBuffer?.size
|
||||
export const downloadAutoCapturedPackets = () => {
|
||||
const logger = new PacketsLogger({ minecraftVersion: lastConnectVersion })
|
||||
logger.relativeTime = false
|
||||
logger.formattedTime = true
|
||||
for (const packet of circularBuffer?.getLastElements() ?? []) {
|
||||
logger.log(packet.isFromServer, { name: packet.name, state: packet.state, time: packet.timestamp }, packet.params)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,10 @@ const mainPacketsReplayer = async (client: ServerClient, packets: ParsedReplayPa
|
|||
}
|
||||
|
||||
if (packet.isFromServer) {
|
||||
if (packet.params === null) {
|
||||
console.warn('packet.params is null', packet)
|
||||
continue
|
||||
}
|
||||
playServerPacket(packet.name, packet.params)
|
||||
await new Promise(resolve => {
|
||||
setTimeout(resolve, packet.diff * packetsReplayState.speed + ADDITIONAL_DELAY * (packetsReplayState.customButtons.packetsSenderDelay.state ? 1 : 0))
|
||||
|
|
@ -216,6 +220,7 @@ const mainPacketsReplayer = async (client: ServerClient, packets: ParsedReplayPa
|
|||
setTimeout(resolve, 1000)
|
||||
})] : [])
|
||||
])
|
||||
clientsPacketsWaiter.stopWaiting()
|
||||
clientPackets = []
|
||||
}
|
||||
}
|
||||
|
|
@ -236,6 +241,7 @@ interface PacketsWaiterOptions {
|
|||
interface PacketsWaiter {
|
||||
addPacket(name: string, params: any): void
|
||||
waitForPackets(packets: string[]): Promise<void>
|
||||
stopWaiting(): void
|
||||
}
|
||||
|
||||
const createPacketsWaiter = (options: PacketsWaiterOptions = {}): PacketsWaiter => {
|
||||
|
|
@ -296,6 +302,11 @@ const createPacketsWaiter = (options: PacketsWaiterOptions = {}): PacketsWaiter
|
|||
isWaiting = false
|
||||
packetHandler = null
|
||||
}
|
||||
},
|
||||
stopWaiting () {
|
||||
isWaiting = false
|
||||
packetHandler = null
|
||||
queuedPackets.length = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ const Inner = ({ hidden, customServersList }: { hidden?: boolean, customServersL
|
|||
worldNameRightGrayed: additional?.textNameRightGrayed ?? '',
|
||||
iconSrc: additional?.icon,
|
||||
offline: additional?.offline,
|
||||
group: 'Custom Servers'
|
||||
group: 'Your Servers'
|
||||
}
|
||||
})}
|
||||
initialProxies={{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue