mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Send creative inventory for all gamemodes, fixed recipe book
This commit is contained in:
@ -1303,9 +1303,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->inventory->sendContents($this);
|
$this->inventory->sendContents($this);
|
||||||
$this->inventory->sendContents($this->getViewers());
|
$this->inventory->sendContents($this->getViewers());
|
||||||
$this->inventory->sendHeldItem($this->hasSpawned);
|
$this->inventory->sendHeldItem($this->hasSpawned);
|
||||||
if($this->isCreative()){
|
|
||||||
$this->inventory->sendCreativeContents();
|
$this->inventory->sendCreativeContents();
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1937,9 +1936,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
$this->sendCommandData();
|
$this->sendCommandData();
|
||||||
|
|
||||||
if($this->isCreative()){
|
$this->inventory->sendCreativeContents();
|
||||||
$this->inventory->sendCreativeContents();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->server->addOnlinePlayer($this);
|
$this->server->addOnlinePlayer($this);
|
||||||
$this->server->onPlayerCompleteLoginSequence($this);
|
$this->server->onPlayerCompleteLoginSequence($this);
|
||||||
|
@ -509,7 +509,8 @@ class PlayerInventory extends BaseInventory{
|
|||||||
public function sendCreativeContents(){
|
public function sendCreativeContents(){
|
||||||
$pk = new InventoryContentPacket();
|
$pk = new InventoryContentPacket();
|
||||||
$pk->windowId = ContainerIds::CREATIVE;
|
$pk->windowId = ContainerIds::CREATIVE;
|
||||||
if($this->getHolder()->getGamemode() === Player::CREATIVE){
|
|
||||||
|
if(!$this->getHolder()->isSpectator()){ //fill it for all gamemodes except spectator
|
||||||
foreach(Item::getCreativeItems() as $i => $item){
|
foreach(Item::getCreativeItems() as $i => $item){
|
||||||
$pk->items[$i] = clone $item;
|
$pk->items[$i] = clone $item;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user