File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,14 @@ export const packetHandler =
210
210
. catch ( handleError ( addMessage , respawnError ) )
211
211
} else if ( packet . id === packetIds . CLIENTBOUND_UPDATE_HEALTH ( version ) ) {
212
212
const newHealth = packet . data . readFloatBE ( 0 )
213
- if ( healthRef . current != null && healthRef . current > newHealth ) {
213
+ // If you connect to a server when dead, you simply see your health as zero.
214
+ if ( healthRef . current === null && newHealth <= 0 ) {
215
+ addMessage ( deathRespawnMessage )
216
+ const clientStatusId = packetIds . SERVERBOUND_CLIENT_STATUS ( version ) ?? 0
217
+ connection // Client Status
218
+ . writePacket ( clientStatusId , writeVarInt ( 0 ) )
219
+ . catch ( handleError ( addMessage , respawnError ) )
220
+ } else if ( healthRef . current !== null && newHealth < healthRef . current ) {
214
221
const info = healthMessage
215
222
. replace ( '%prev' , healthRef . current . toString ( ) )
216
223
. replace ( '%new' , newHealth . toString ( ) )
You can’t perform that action at this time.
0 commit comments