Send players their health on log in
Health is already being saved to disk with their NBT file, so this just involves sending it to them when they log in.
This commit is contained in:
parent
6942786b32
commit
facf8ce2c6
@ -89,7 +89,7 @@ namespace TrueCraft.Client
|
|||||||
SocketPool = new SocketAsyncEventArgsPool(100, 200, 65536);
|
SocketPool = new SocketAsyncEventArgsPool(100, 200, 65536);
|
||||||
connected = 0;
|
connected = 0;
|
||||||
cancel = new CancellationTokenSource();
|
cancel = new CancellationTokenSource();
|
||||||
Health = 15;
|
Health = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterPacketHandler(byte packetId, PacketHandler handler)
|
public void RegisterPacketHandler(byte packetId, PacketHandler handler)
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<Commandlineparameters>localhost SirCmpwn</Commandlineparameters>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -10,6 +10,11 @@ namespace TrueCraft.Core.Networking.Packets
|
|||||||
{
|
{
|
||||||
public byte ID { get { return 0x08; } }
|
public byte ID { get { return 0x08; } }
|
||||||
|
|
||||||
|
public UpdateHealthPacket(short health)
|
||||||
|
{
|
||||||
|
Health = health;
|
||||||
|
}
|
||||||
|
|
||||||
public short Health;
|
public short Health;
|
||||||
|
|
||||||
public void ReadPacket(IMinecraftStream stream)
|
public void ReadPacket(IMinecraftStream stream)
|
||||||
|
@ -61,6 +61,7 @@ namespace TrueCraft.Handlers
|
|||||||
remoteClient.QueuePacket(new LoginResponsePacket(client.Entity.EntityID, 0, Dimension.Overworld));
|
remoteClient.QueuePacket(new LoginResponsePacket(client.Entity.EntityID, 0, Dimension.Overworld));
|
||||||
remoteClient.UpdateChunks();
|
remoteClient.UpdateChunks();
|
||||||
remoteClient.QueuePacket(new WindowItemsPacket(0, remoteClient.Inventory.GetSlots()));
|
remoteClient.QueuePacket(new WindowItemsPacket(0, remoteClient.Inventory.GetSlots()));
|
||||||
|
remoteClient.QueuePacket(new UpdateHealthPacket((remoteClient.Entity as PlayerEntity).Health));
|
||||||
remoteClient.QueuePacket(new SpawnPositionPacket((int)remoteClient.Entity.Position.X,
|
remoteClient.QueuePacket(new SpawnPositionPacket((int)remoteClient.Entity.Position.X,
|
||||||
(int)remoteClient.Entity.Position.Y, (int)remoteClient.Entity.Position.Z));
|
(int)remoteClient.Entity.Position.Y, (int)remoteClient.Entity.Position.Z));
|
||||||
remoteClient.QueuePacket(new SetPlayerPositionPacket(remoteClient.Entity.Position.X,
|
remoteClient.QueuePacket(new SetPlayerPositionPacket(remoteClient.Entity.Position.X,
|
||||||
|
Reference in New Issue
Block a user