mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-25 04:44:03 +00:00
Merge branch '3.5'
This commit is contained in:
commit
e1064a9e36
@ -211,12 +211,12 @@ class ParticleCommand extends VanillaCommand{
|
||||
}elseif(strpos($name, "blockcrack_") === 0){
|
||||
$d = explode("_", $name);
|
||||
if(count($d) === 2){
|
||||
return new TerrainParticle(BlockFactory::get($d[1] & 0xff, $d[1] >> 12));
|
||||
return new TerrainParticle(BlockFactory::get(((int) $d[1]) & 0xff, ((int) $d[1]) >> 12));
|
||||
}
|
||||
}elseif(strpos($name, "blockdust_") === 0){
|
||||
$d = explode("_", $name);
|
||||
if(count($d) >= 4){
|
||||
return new DustParticle($d[1] & 0xff, $d[2] & 0xff, $d[3] & 0xff, isset($d[4]) ? $d[4] & 0xff : 255);
|
||||
return new DustParticle(((int) $d[1]) & 0xff, ((int) $d[2]) & 0xff, ((int) $d[3]) & 0xff, isset($d[4]) ? ((int) $d[4]) & 0xff : 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
|
||||
* @param Entity $entity
|
||||
* @param int $cause
|
||||
* @param float $damage
|
||||
* @param float|float[] $modifiers
|
||||
* @param float[] $modifiers
|
||||
*/
|
||||
public function __construct(Entity $entity, int $cause, float $damage, array $modifiers = []){
|
||||
$this->entity = $entity;
|
||||
|
@ -27,6 +27,8 @@ declare(strict_types=1);
|
||||
namespace pocketmine\inventory;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\Player;
|
||||
|
||||
interface Inventory{
|
||||
@ -120,6 +122,15 @@ interface Inventory{
|
||||
*/
|
||||
public function setContents(array $items, bool $send = true) : void;
|
||||
|
||||
/**
|
||||
* Drops the contents of the inventory into the specified Level at the specified position and clears the inventory
|
||||
* contents.
|
||||
*
|
||||
* @param Level $level
|
||||
* @param Vector3 $position
|
||||
*/
|
||||
public function dropContents(Level $level, Vector3 $position) : void;
|
||||
|
||||
/**
|
||||
* @param Player|Player[] $target
|
||||
*/
|
||||
|
@ -173,16 +173,21 @@ class PlayerInventory extends BaseInventory{
|
||||
}
|
||||
|
||||
public function sendCreativeContents(){
|
||||
//TODO: this mess shouldn't be in here
|
||||
$holder = $this->getHolder();
|
||||
if(!($holder instanceof Player)){
|
||||
throw new \LogicException("Cannot send creative inventory contents to non-player inventory holder");
|
||||
}
|
||||
$pk = new InventoryContentPacket();
|
||||
$pk->windowId = ContainerIds::CREATIVE;
|
||||
|
||||
if(!$this->getHolder()->isSpectator()){ //fill it for all gamemodes except spectator
|
||||
if(!$holder->isSpectator()){ //fill it for all gamemodes except spectator
|
||||
foreach(Item::getCreativeItems() as $i => $item){
|
||||
$pk->items[$i] = clone $item;
|
||||
}
|
||||
}
|
||||
|
||||
$this->getHolder()->sendDataPacket($pk);
|
||||
$holder->sendDataPacket($pk);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $index
|
||||
* @param int $index
|
||||
*
|
||||
* @return Item|null
|
||||
*/
|
||||
|
@ -678,7 +678,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
public function unregisterChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ){
|
||||
if(isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)][$hash = $loader->getLoaderId()])){
|
||||
$index = Level::chunkHash($chunkX, $chunkZ);
|
||||
$hash = $loader->getLoaderId();
|
||||
if(isset($this->chunkLoaders[$index][$hash])){
|
||||
unset($this->chunkLoaders[$index][$hash]);
|
||||
unset($this->playerLoaders[$index][$hash]);
|
||||
if(count($this->chunkLoaders[$index]) === 0){
|
||||
@ -1306,9 +1308,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $x
|
||||
* @param $y
|
||||
* @param $z
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $z
|
||||
*
|
||||
* @return int bitmap, (id << 4) | data
|
||||
*/
|
||||
|
@ -75,8 +75,9 @@ abstract class BiomeSelector{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $x
|
||||
* @param $z
|
||||
* TODO: not sure on types here
|
||||
* @param int|float $x
|
||||
* @param int|float $z
|
||||
*
|
||||
* @return Biome
|
||||
*/
|
||||
|
@ -100,7 +100,7 @@ abstract class MetadataStore{
|
||||
* @param Plugin $owningPlugin
|
||||
*/
|
||||
public function invalidateAll(Plugin $owningPlugin){
|
||||
/** @var $values MetadataValue[] */
|
||||
/** @var MetadataValue[] $values */
|
||||
foreach($this->metadataMap as $values){
|
||||
if(isset($values[$owningPlugin])){
|
||||
$values[$owningPlugin]->invalidate();
|
||||
|
@ -265,7 +265,7 @@ class Config{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $k
|
||||
* @param string $k
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
@ -274,15 +274,15 @@ class Config{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $k
|
||||
* @param $v
|
||||
* @param string $k
|
||||
* @param mixed $v
|
||||
*/
|
||||
public function __set($k, $v){
|
||||
$this->set($k, $v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $k
|
||||
* @param string $k
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@ -291,15 +291,15 @@ class Config{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $k
|
||||
* @param string $k
|
||||
*/
|
||||
public function __unset($k){
|
||||
$this->remove($k);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setNested($key, $value){
|
||||
$vars = explode(".", $key);
|
||||
@ -325,7 +325,7 @@ class Config{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
@ -377,7 +377,7 @@ class Config{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $k
|
||||
* @param string $k
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return bool|mixed
|
||||
@ -409,7 +409,7 @@ class Config{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $k
|
||||
* @param string $k
|
||||
* @param bool $lowercase If set, searches Config in single-case / lowercase.
|
||||
*
|
||||
* @return bool
|
||||
@ -425,7 +425,7 @@ class Config{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $k
|
||||
* @param string $k
|
||||
*/
|
||||
public function remove($k){
|
||||
unset($this->config[$k]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user