mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Armor fix
This commit is contained in:
parent
1727e18e31
commit
402fc087ca
@ -1701,20 +1701,22 @@ class Player{
|
|||||||
"player" => $this,
|
"player" => $this,
|
||||||
"eid" => $this->eid
|
"eid" => $this->eid
|
||||||
);
|
);
|
||||||
|
$armor = array();
|
||||||
for($i = 0; $i < 4; ++$i){
|
for($i = 0; $i < 4; ++$i){
|
||||||
if($this->armor[$i] instanceof Item){
|
if(isset($this->armor[$i]) and ($this->armor[$i] instanceof Item)){
|
||||||
$data["slot$i"] = $this->armor[$i]->getID() !== AIR ? $this->armor[$i]->getID() - 256:0;
|
$data["slot$i"] = $this->armor[$i]->getID() !== AIR ? $this->armor[$i]->getID() - 256:0;
|
||||||
}else{
|
}else{
|
||||||
$this->armor[$i] = BlockAPI::getItem(AIR, 0, 0);
|
$this->armor[$i] = BlockAPI::getItem(AIR, 0, 0);
|
||||||
$data["slot$i"] = 0;
|
$data["slot$i"] = 0;
|
||||||
}
|
}
|
||||||
|
$armor[] = $this->armor[$i];
|
||||||
}
|
}
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
if($player === $this){
|
if($player === $this){
|
||||||
$this->dataPacket(MC_CONTAINER_SET_CONTENT, array(
|
$this->dataPacket(MC_CONTAINER_SET_CONTENT, array(
|
||||||
"windowid" => 0x78,
|
"windowid" => 0x78,
|
||||||
"count" => 4,
|
"count" => 4,
|
||||||
"slots" => $this->armor,
|
"slots" => $armor,
|
||||||
));
|
));
|
||||||
}else{
|
}else{
|
||||||
$player->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
$player->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user