Bad hack, TODO REMOVE, workarounds client bug by sending inventory contents specifically for creative players <-- this commit is full of sadness

This commit is contained in:
Shoghi Cervantes 2015-09-14 20:25:46 +02:00
parent 885fc07e5c
commit 24f8de2cc3
2 changed files with 11 additions and 4 deletions

View File

@ -1706,6 +1706,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$pk = new StartGamePacket();
$pk->seed = -1;
$pk->dimension = 0;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;

View File

@ -383,10 +383,17 @@ class PlayerInventory extends BaseInventory{
}
$pk = new ContainerSetContentPacket();
$pk;
$pk->slots = [];
for($i = 0; $i < $this->getSize(); ++$i){ //Do not send armor by error here
$pk->slots[$i] = $this->getItem($i);
$holder = $this->getHolder();
if($holder instanceof Player and $holder->isCreative()){
//TODO: Remove this workaround because of broken client
foreach(Item::getCreativeItems() as $i => $item){
$pk->slots[$i] = Item::getCreativeItem($i);
}
}else{
for($i = 0; $i < $this->getSize(); ++$i){ //Do not send armor by error here
$pk->slots[$i] = $this->getItem($i);
}
}
foreach($target as $player){
@ -416,7 +423,6 @@ class PlayerInventory extends BaseInventory{
}
$pk = new ContainerSetSlotPacket();
$pk;
$pk->slot = $index;
$pk->item = clone $this->getItem($index);