From f473f13585e1bc901bfeb05cd5a9bb35489595da Mon Sep 17 00:00:00 2001 From: "lapayo94@gmail.com" Date: Tue, 17 Jul 2012 12:02:03 +0000 Subject: Simple health regeneration system Prepared for food git-svn-id: http://mc-server.googlecode.com/svn/trunk@679 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'source/cClientHandle.cpp') diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 76aaf2724..5bbf0f512 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -339,11 +339,7 @@ void cClientHandle::Authenticate(void) m_Player->GetInventory().SendWholeInventory(this); // Send health - cPacket_UpdateHealth Health; - Health.m_Health = (short)m_Player->GetHealth(); - Health.m_Food = m_Player->GetFood(); - Health.m_Saturation = m_Player->GetFoodSaturation(); - Send(Health); + m_Player->SendHealth(); m_Player->Initialize(World); StreamChunks(); @@ -856,14 +852,7 @@ void cClientHandle::HandleBlockDig(cPacket_BlockDig * a_Packet) void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet) { - if(a_Packet->m_PosX == -1 - && a_Packet->m_PosY == 255 - && a_Packet->m_PosZ == -1) - { - //I donīt know whats the idea behind these packets O.o - return; - } - + if (!CheckBlockInteractionsRate()) { return; @@ -960,7 +949,7 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet) cItem Item; Item.m_ItemID = Equipped.m_ItemID; Item.m_ItemCount = 1; - if (m_Player->EatItem(Item.m_ItemID)) + if (ItemHandler->EatItem(m_Player, &Item)) { ItemHandler->OnFoodEaten(World, m_Player, &Item); m_Player->GetInventory().RemoveItem(Item); -- cgit v1.2.3