mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Bascially supprt armor for MCPE 0.6.1 & 0.7.0
This commit is contained in:
parent
bec37f62f8
commit
896eb736f0
3 changed files with 24 additions and 14 deletions
|
|
@ -42,12 +42,10 @@ class PlayerAPI{
|
|||
public function handle($data, $event){
|
||||
switch($event){
|
||||
case "player.death":
|
||||
if($data["player"]->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
if($data["player"]->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
$data["player"]->isWorkBench = false;
|
||||
$data["player"]->isStoneCutter = false;
|
||||
if($data["player"]->PROTOCOL < ProtocolInfo6::CURRENT_PROTOCOL_6){
|
||||
$data["player"]->isOre = [];
|
||||
}
|
||||
$data["player"]->isOre = [];
|
||||
}
|
||||
if(is_numeric($data["cause"])){
|
||||
$e = $this->server->api->entity->get($data["cause"]);
|
||||
|
|
|
|||
|
|
@ -3318,10 +3318,16 @@ class Player{
|
|||
}elseif($s->getID() !== AIR and $slot->getID() === AIR and ($sl = $this->hasItem($s->getID())) !== false){
|
||||
$this->armor[$i] = $this->getSlot($sl);
|
||||
$this->setSlot($sl, BlockAPI::getItem(AIR, 0, 0), false);
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12 && $this->PROTOCOL > ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$this->isOre[DIAMOND_HELMET] = true;
|
||||
}
|
||||
}elseif($s->getID() !== AIR && $slot->getID() !== AIR and ($slot->getID() !== $s->getID() or $slot->getMetadata() !== $s->getMetadata()) and ($sl = $this->hasItem($s->getID())) !== false){
|
||||
$item = $this->armor[$i];
|
||||
$this->armor[$i] = $this->getSlot($sl);
|
||||
$this->setSlot($sl, $item, false);
|
||||
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12 && $this->PROTOCOL > ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$this->isOre[DIAMOND_HELMET] = true;
|
||||
}
|
||||
}else{
|
||||
$packet->slots[$i] = 255;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1634,10 +1634,10 @@ class Entity extends Position
|
|||
$part->hurtAndBreak($v2, $this->player, helditem: false);
|
||||
if($part->count <= 0) $this->player->setArmor($slot, BlockAPI::getItem(0, 0, 0), send: false);
|
||||
}
|
||||
if($this->player->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_11 && $this->player->PROTOCOL > ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
if($this->player->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12 && $this->player->PROTOCOL > ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$pk = new HurtArmorPacket();
|
||||
$pk->health = $part->meta - $v2;
|
||||
//$this->player->dataPacket($pk); //MCPE 0.6.0
|
||||
$pk->health = $v2; //TODO: Verify the real attack health for it
|
||||
$this->player->entityQueueDataPacket($pk);
|
||||
}
|
||||
$this->player->sendArmor();
|
||||
}
|
||||
|
|
@ -1721,16 +1721,22 @@ class Entity extends Position
|
|||
$this->updateMetadata();
|
||||
$this->dead = true;
|
||||
if($this->player instanceof Player){
|
||||
if($this->player->PROTOCOL <= ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$pk = new EntityEventPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->event = EntityEventPacket::ENTITY_DEAD;
|
||||
$this->player->entityQueueDataPacket($pk);
|
||||
if($this->player->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||
$this->player->isWorkbench = false;
|
||||
$this->player->isStoneCutter = false;
|
||||
if($this->player->PROTOCOL < ProtocolInfo6::CURRENT_PROTOCOL_6){
|
||||
$this->player->isOre = [];
|
||||
if(!self::$keepInventory) {
|
||||
if ($this->player->PROTOCOL <= ProtocolInfo8::CURRENT_PROTOCOL_8) {
|
||||
$pk = new EntityEventPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->event = EntityEventPacket::ENTITY_DEAD;
|
||||
$this->player->entityQueueDataPacket($pk);
|
||||
} elseif (isset($this->player->isOre[DIAMOND_HELMET])) {
|
||||
$pk = new HurtArmorPacket();
|
||||
$pk->health = 900; //TODO Verify the real attack health for it
|
||||
$this->player->entityQueueDataPacket($pk);
|
||||
}
|
||||
}
|
||||
$this->player->isOre = [];
|
||||
}
|
||||
$pk = new MoveEntityPacket_PosRot();
|
||||
$pk->eid = $this->eid;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue