mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-27 21:59:52 +00:00
parent
ffcdf49912
commit
37bc1273ee
@ -1279,7 +1279,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
if($diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
if($diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
||||||
if($this->inAirTicks < 100){
|
if($this->inAirTicks < 100){
|
||||||
$this->setMotion(new Vector3(0, $expectedVelocity, 0));
|
$this->setMotion(new Vector3(0, $expectedVelocity, 0));
|
||||||
}elseif($this->kick("Flying is not enabled on this server"))
|
}elseif($this->kick("Flying is not enabled on this server")){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,9 @@ abstract class BaseInventory implements Inventory{
|
|||||||
$this->clear($i);
|
$this->clear($i);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->setItem($i, $items[$i]);
|
if (!$this->setItem($i, $items[$i])){
|
||||||
|
$this->clear($i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
|||||||
public function __construct(Chest $left, Chest $right){
|
public function __construct(Chest $left, Chest $right){
|
||||||
$this->left = $left->getRealInventory();
|
$this->left = $left->getRealInventory();
|
||||||
$this->right = $right->getRealInventory();
|
$this->right = $right->getRealInventory();
|
||||||
BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST));
|
$items = array_merge($this->left->getContents(), $this->right->getContents());
|
||||||
|
BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST), $items);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInventory(){
|
public function getInventory(){
|
||||||
@ -77,13 +78,19 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
|||||||
$items = array_slice($items, 0, $this->size, true);
|
$items = array_slice($items, 0, $this->size, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::setContents($items);
|
|
||||||
|
|
||||||
$leftItems = array_slice($items, 0, $this->left->getSize(), true);
|
for($i = 0; $i < $this->size; ++$i){
|
||||||
$this->left->setContents($leftItems);
|
if(!isset($items[$i])){
|
||||||
if(count($items) > $this->left->getSize()){
|
if ($i < $this->left->size){
|
||||||
$rightItems = array_slice($items, $this->left->getSize() - 1, $this->right->getSize(), true);
|
if(isset($this->left->slots[$i])){
|
||||||
$this->right->setContents($rightItems);
|
$this->clear($i);
|
||||||
|
}
|
||||||
|
}elseif(isset($this->right->slots[$i - $this->left->size])){
|
||||||
|
$this->clear($i);
|
||||||
|
}
|
||||||
|
}elseif(!$this->setItem($i, $items[$i])){
|
||||||
|
$this->clear($i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user