forked from mirrors/kolyah35-minecraft-pe-0.6.1
lol
This commit is contained in:
parent
f1ff828027
commit
881c1188a1
12 changed files with 175 additions and 16 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <network/packet/ChatPacket.h>
|
||||
#include <network/packet/MovePlayerPacket.h>
|
||||
#include <network/packet/RemoveItemPacket.h>
|
||||
#include <network/packet/SetHealthPacket.h>
|
||||
#include <network/packet/TakeItemPacket.h>
|
||||
#include <world/entity/player/Inventory.h>
|
||||
|
||||
|
|
@ -133,6 +134,26 @@ public:
|
|||
|
||||
return inv;
|
||||
}
|
||||
|
||||
int getHp() {
|
||||
auto plr = getPlayer();
|
||||
if (plr == nullptr) return -1;
|
||||
|
||||
return plr->health;
|
||||
}
|
||||
|
||||
void setHp(int hp) {
|
||||
auto plr = getPlayer();
|
||||
if (plr == nullptr) return;
|
||||
|
||||
plr->health = hp;
|
||||
|
||||
auto mc = PluginsManager::get().getMinecraft();
|
||||
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||
|
||||
SetHealthPacket hpPacket(plr->health);
|
||||
ss->sendPrivate(hpPacket, m_source);
|
||||
}
|
||||
private:
|
||||
const RakNet::RakNetGUID m_source;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue