mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
Merge branch '3.5' into master-rollback
This commit is contained in:
commit
c9f9f551f4
@ -44,6 +44,7 @@ use pocketmine\plugin\Plugin;
|
|||||||
use function array_merge;
|
use function array_merge;
|
||||||
use function assert;
|
use function assert;
|
||||||
use function dechex;
|
use function dechex;
|
||||||
|
use function get_class;
|
||||||
use const PHP_INT_MAX;
|
use const PHP_INT_MAX;
|
||||||
|
|
||||||
class Block extends Position implements BlockIds, Metadatable{
|
class Block extends Position implements BlockIds, Metadatable{
|
||||||
@ -324,6 +325,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
* @param Item $item
|
* @param Item $item
|
||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
|
* @throws \InvalidArgumentException if the item efficiency is not a positive number
|
||||||
*/
|
*/
|
||||||
public function getBreakTime(Item $item) : float{
|
public function getBreakTime(Item $item) : float{
|
||||||
$base = $this->getHardness();
|
$base = $this->getHardness();
|
||||||
@ -335,7 +337,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
|
|
||||||
$efficiency = $item->getMiningEfficiency($this);
|
$efficiency = $item->getMiningEfficiency($this);
|
||||||
if($efficiency <= 0){
|
if($efficiency <= 0){
|
||||||
throw new \RuntimeException("Item efficiency is invalid");
|
throw new \InvalidArgumentException(get_class($item) . " has invalid mining efficiency: expected >= 0, got $efficiency");
|
||||||
}
|
}
|
||||||
|
|
||||||
$base /= $efficiency;
|
$base /= $efficiency;
|
||||||
|
@ -89,7 +89,7 @@ class SplashPotion extends Throwable{
|
|||||||
if(!$this->willLinger()){
|
if(!$this->willLinger()){
|
||||||
foreach($this->level->getNearbyEntities($this->boundingBox->expandedCopy(4.125, 2.125, 4.125), $this) as $entity){
|
foreach($this->level->getNearbyEntities($this->boundingBox->expandedCopy(4.125, 2.125, 4.125), $this) as $entity){
|
||||||
if($entity instanceof Living and $entity->isAlive()){
|
if($entity instanceof Living and $entity->isAlive()){
|
||||||
$distanceSquared = $entity->distanceSquared($this);
|
$distanceSquared = $entity->add(0, $entity->getEyeHeight(), 0)->distanceSquared($this);
|
||||||
if($distanceSquared > 16){ //4 blocks
|
if($distanceSquared > 16){ //4 blocks
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the players being used in a specific chunk
|
* @deprecated WARNING: This function has a misleading name. Contrary to what the name might imply, this function
|
||||||
|
* DOES NOT return players who are IN a chunk, rather, it returns players who can SEE the chunk.
|
||||||
|
*
|
||||||
|
* Returns a list of players who have the target chunk within their view distance.
|
||||||
*
|
*
|
||||||
* @param int $chunkX
|
* @param int $chunkX
|
||||||
* @param int $chunkZ
|
* @param int $chunkZ
|
||||||
@ -678,8 +681,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WARNING: Do not use this, it's only for internal use.
|
* @internal
|
||||||
* Changes to this function won't be recorded on the version.
|
|
||||||
*
|
*
|
||||||
* @param Player ...$targets If empty, will send to all players in the level.
|
* @param Player ...$targets If empty, will send to all players in the level.
|
||||||
*/
|
*/
|
||||||
@ -699,8 +701,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WARNING: Do not use this, it's only for internal use.
|
* @internal
|
||||||
* Changes to this function won't be recorded on the version.
|
|
||||||
*
|
*
|
||||||
* @param int $currentTick
|
* @param int $currentTick
|
||||||
*
|
*
|
||||||
@ -2262,8 +2263,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
||||||
if($oldChunk !== null and $oldChunk !== $chunk){
|
if($oldChunk !== null and $oldChunk !== $chunk){
|
||||||
if($deleteEntitiesAndTiles){
|
if($deleteEntitiesAndTiles){
|
||||||
$players = $this->getChunkPlayers($chunkX, $chunkZ);
|
foreach($oldChunk->getEntities() as $player){
|
||||||
foreach($players as $player){
|
if(!($player instanceof Player)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$chunk->addEntity($player);
|
$chunk->addEntity($player);
|
||||||
$oldChunk->removeEntity($player);
|
$oldChunk->removeEntity($player);
|
||||||
$player->chunk = $chunk;
|
$player->chunk = $chunk;
|
||||||
@ -2618,6 +2621,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$loader->onChunkLoaded($chunk);
|
$loader->onChunkLoaded($chunk);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
$this->server->getLogger()->debug("Newly loaded chunk $x $z has no loaders registered, will be unloaded at next available opportunity");
|
||||||
$this->unloadChunkRequest($x, $z);
|
$this->unloadChunkRequest($x, $z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,9 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $isTexturePacksRequired = true;
|
public $isTexturePacksRequired = true;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
public $gameRules = []; //TODO: implement this
|
public $gameRules = [ //TODO: implement this
|
||||||
|
"naturalregeneration" => [1, false] //Hack for client side regeneration
|
||||||
|
];
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $hasBonusChestEnabled = false;
|
public $hasBonusChestEnabled = false;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user