ddevault / Craft.Net

(Unmaintained, see TrueCraft) Minecraft server, client, and etc for .NET
MIT License
228 stars 64 forks source link

How to send the respawn packet? #147

Closed ghost closed 11 years ago

ghost commented 11 years ago

I want to know how to send the respawn packet.

I tried this: client.SendPacket(new RespawnPacket());

but an error occurs and get disconnected automatically.

Please give me the solution. Thank You :)

ddevault commented 11 years ago

The default values for an IPacket struct are rarely the correct ones. Use the other constructor:

RespawnPacket(Dimension dimension, Difficulty difficulty, GameMode gameMode, short worldHeight, string levelType)

Does this work for you?

ddevault commented 11 years ago

Updated: Instead, register with MinecraftClient.PlayerDied and call MinecraftClient.Respawn.