mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 10:31:51 +00:00
Merge master into api3/network
This commit is contained in:
commit
202bac28fc
@ -404,7 +404,24 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
* @param float $value
|
* @param float $value
|
||||||
*/
|
*/
|
||||||
public function setScale(float $value){
|
public function setScale(float $value){
|
||||||
|
$multiplier = $value / $this->getScale();
|
||||||
|
|
||||||
|
$this->width *= $multiplier;
|
||||||
|
$this->height *= $multiplier;
|
||||||
|
$halfWidth = $this->width / 2;
|
||||||
|
|
||||||
|
$this->boundingBox->setBounds(
|
||||||
|
$this->x - $halfWidth,
|
||||||
|
$this->y,
|
||||||
|
$this->z - $halfWidth,
|
||||||
|
$this->x + $halfWidth,
|
||||||
|
$this->y + $this->height,
|
||||||
|
$this->z + $halfWidth
|
||||||
|
);
|
||||||
|
|
||||||
$this->setDataProperty(self::DATA_SCALE, self::DATA_TYPE_FLOAT, $value);
|
$this->setDataProperty(self::DATA_SCALE, self::DATA_TYPE_FLOAT, $value);
|
||||||
|
$this->setDataProperty(self::DATA_BOUNDING_BOX_WIDTH, self::DATA_TYPE_FLOAT, $this->width);
|
||||||
|
$this->setDataProperty(self::DATA_BOUNDING_BOX_HEIGHT, self::DATA_TYPE_FLOAT, $this->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSneaking(){
|
public function isSneaking(){
|
||||||
|
@ -46,12 +46,22 @@ class Item implements ItemIds, \JsonSerializable{
|
|||||||
private static $cachedParser = null;
|
private static $cachedParser = null;
|
||||||
|
|
||||||
private static function parseCompoundTag(string $tag) : CompoundTag{
|
private static function parseCompoundTag(string $tag) : CompoundTag{
|
||||||
|
if(strlen($tag) === 0){
|
||||||
|
throw new \InvalidArgumentException("No NBT data found in supplied string");
|
||||||
|
}
|
||||||
|
|
||||||
if(self::$cachedParser === null){
|
if(self::$cachedParser === null){
|
||||||
self::$cachedParser = new NBT(NBT::LITTLE_ENDIAN);
|
self::$cachedParser = new NBT(NBT::LITTLE_ENDIAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$cachedParser->read($tag);
|
self::$cachedParser->read($tag);
|
||||||
return self::$cachedParser->getData();
|
$data = self::$cachedParser->getData();
|
||||||
|
|
||||||
|
if(!($data instanceof CompoundTag)){
|
||||||
|
throw new \InvalidArgumentException("Invalid item NBT string given, it could not be deserialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function writeCompoundTag(CompoundTag $tag) : string{
|
private static function writeCompoundTag(CompoundTag $tag) : string{
|
||||||
|
@ -307,7 +307,7 @@ class Chunk{
|
|||||||
* @param int $level 0-15
|
* @param int $level 0-15
|
||||||
*/
|
*/
|
||||||
public function setBlockSkyLight(int $x, int $y, int $z, int $level){
|
public function setBlockSkyLight(int $x, int $y, int $z, int $level){
|
||||||
if($this->getSubChunk($y >> 4)->setBlockSkyLight($x, $y & 0x0f, $z, $level)){
|
if($this->getSubChunk($y >> 4, true)->setBlockSkyLight($x, $y & 0x0f, $z, $level)){
|
||||||
$this->hasChanged = true;
|
$this->hasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,7 +334,7 @@ class Chunk{
|
|||||||
* @param int $level 0-15
|
* @param int $level 0-15
|
||||||
*/
|
*/
|
||||||
public function setBlockLight(int $x, int $y, int $z, int $level){
|
public function setBlockLight(int $x, int $y, int $z, int $level){
|
||||||
if($this->getSubChunk($y >> 4)->setBlockLight($x, $y & 0x0f, $z, $level)){
|
if($this->getSubChunk($y >> 4, true)->setBlockLight($x, $y & 0x0f, $z, $level)){
|
||||||
$this->hasChanged = true;
|
$this->hasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,11 @@ class SubChunk{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function isEmpty() : bool{
|
public function isEmpty() : bool{
|
||||||
assert(strlen($this->ids) === 4096, "Wrong length of ID array, expecting 4096 bytes, got " . strlen($this->ids));
|
return (
|
||||||
return substr_count($this->ids, "\x00") === 4096;
|
substr_count($this->ids, "\x00") === 4096 and
|
||||||
|
substr_count($this->skyLight, "\xff") === 2048 and
|
||||||
|
substr_count($this->blockLight, "\x00") === 2048
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockId(int $x, int $y, int $z) : int{
|
public function getBlockId(int $x, int $y, int $z) : int{
|
||||||
|
@ -111,4 +111,12 @@ class CompoundTag extends NamedTag implements \ArrayAccess{
|
|||||||
}
|
}
|
||||||
return $str . "}";
|
return $str . "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __clone(){
|
||||||
|
foreach($this as $key => $tag){
|
||||||
|
if($tag instanceof Tag){
|
||||||
|
$this->{$key} = clone $tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -220,4 +220,12 @@ class ListTag extends NamedTag implements \ArrayAccess, \Countable{
|
|||||||
}
|
}
|
||||||
return $str . "}";
|
return $str . "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __clone(){
|
||||||
|
foreach($this as $key => $tag){
|
||||||
|
if($tag instanceof Tag){
|
||||||
|
$this->{$key} = clone $tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ auto-updater:
|
|||||||
|
|
||||||
timings:
|
timings:
|
||||||
#Choose the host to use for viewing your timings results.
|
#Choose the host to use for viewing your timings results.
|
||||||
host: mcpetimings.com
|
host: timings.pmmp.io
|
||||||
|
|
||||||
console:
|
console:
|
||||||
#Choose whether to enable server stats reporting on the console title.
|
#Choose whether to enable server stats reporting on the console title.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user