Merge branch 'stable' into minor-next

This commit is contained in:
Dylan K. Taylor 2023-11-17 12:04:10 +00:00
commit 519784460f
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
6 changed files with 20 additions and 8 deletions

View File

@ -8,7 +8,7 @@ jobs:
support: support:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: dessant/support-requests@v3 - uses: dessant/support-requests@v4
with: with:
github-token: ${{ github.token }} github-token: ${{ github.token }}
support-label: "Support request" support-label: "Support request"

@ -1 +1 @@
Subproject commit 39885cf24826773bc3a0e8134e04a2032e97f477 Subproject commit 9c7ea425ac36941fe7f9718aecb97b3375221228

View File

@ -1357,7 +1357,14 @@ class Server{
/** /**
* @internal * @internal
* Broadcasts a list of packets in a batch to a list of players * Promises to compress the given batch buffer using the selected compressor, optionally on a separate thread.
*
* If the buffer is smaller than the batch-threshold (usually 256), the buffer will be compressed at level 0 if supported
* by the compressor. This means that the payload will be wrapped with the appropriate header and footer, but not
* actually compressed.
*
* If the buffer is larger than the async-compression-threshold (usually 10,000), the buffer may be compressed in
* a separate thread (if available).
* *
* @param bool|null $sync Compression on the main thread (true) or workers (false). Default is automatic (null). * @param bool|null $sync Compression on the main thread (true) or workers (false). Default is automatic (null).
*/ */

View File

@ -27,6 +27,7 @@ use pocketmine\item\Item;
use pocketmine\item\VanillaItems; use pocketmine\item\VanillaItems;
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\network\mcpe\convert\TypeConverter; use pocketmine\network\mcpe\convert\TypeConverter;
use pocketmine\world\World; use pocketmine\world\World;
@ -52,13 +53,17 @@ class ItemFrame extends Spawnable{
if(($itemTag = $nbt->getCompoundTag(self::TAG_ITEM)) !== null){ if(($itemTag = $nbt->getCompoundTag(self::TAG_ITEM)) !== null){
$this->item = Item::nbtDeserialize($itemTag); $this->item = Item::nbtDeserialize($itemTag);
} }
$this->itemRotation = $nbt->getByte(self::TAG_ITEM_ROTATION, $this->itemRotation); if($nbt->getTag(self::TAG_ITEM_ROTATION) instanceof FloatTag){
$this->itemRotation = (int) ($nbt->getFloat(self::TAG_ITEM_ROTATION, $this->itemRotation * 45) / 45);
} else {
$this->itemRotation = $nbt->getByte(self::TAG_ITEM_ROTATION, $this->itemRotation);
}
$this->itemDropChance = $nbt->getFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance); $this->itemDropChance = $nbt->getFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance);
} }
protected function writeSaveData(CompoundTag $nbt) : void{ protected function writeSaveData(CompoundTag $nbt) : void{
$nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance); $nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance);
$nbt->setByte(self::TAG_ITEM_ROTATION, $this->itemRotation); $nbt->setFloat(self::TAG_ITEM_ROTATION, $this->itemRotation * 45);
if(!$this->item->isNull()){ if(!$this->item->isNull()){
$nbt->setTag(self::TAG_ITEM, $this->item->nbtSerialize()); $nbt->setTag(self::TAG_ITEM, $this->item->nbtSerialize());
} }
@ -98,7 +103,7 @@ class ItemFrame extends Spawnable{
protected function addAdditionalSpawnData(CompoundTag $nbt) : void{ protected function addAdditionalSpawnData(CompoundTag $nbt) : void{
$nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance); $nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance);
$nbt->setByte(self::TAG_ITEM_ROTATION, $this->itemRotation); $nbt->setFloat(self::TAG_ITEM_ROTATION, $this->itemRotation * 45);
if(!$this->item->isNull()){ if(!$this->item->isNull()){
$nbt->setTag(self::TAG_ITEM, TypeConverter::getInstance()->getItemTranslator()->toNetworkNbt($this->item)); $nbt->setTag(self::TAG_ITEM, TypeConverter::getInstance()->getItemTranslator()->toNetworkNbt($this->item));
} }

View File

@ -28,7 +28,7 @@ namespace pocketmine\utils;
* __callStatic(). * __callStatic().
* *
* Classes using this trait need to include \@method tags in their class docblock for every enum member. * Classes using this trait need to include \@method tags in their class docblock for every enum member.
* Alternatively, just put \@generate-registry-docblock in the docblock and run tools/generate-registry-annotations.php * Alternatively, just put \@generate-registry-docblock in the docblock and run build/generate-registry-annotations.php
* *
* @deprecated Use native PHP 8.1 enums instead. Use {@link LegacyEnumShimTrait} if you need to provide backwards * @deprecated Use native PHP 8.1 enums instead. Use {@link LegacyEnumShimTrait} if you need to provide backwards
* compatible EnumTrait-like API for migrated enums. * compatible EnumTrait-like API for migrated enums.

View File

@ -33,7 +33,7 @@ use function preg_match;
* These faux constants are exposed in static class methods, which are handled using __callStatic(). * These faux constants are exposed in static class methods, which are handled using __callStatic().
* *
* Classes using this trait need to include \@method tags in their class docblock for every faux constant. * Classes using this trait need to include \@method tags in their class docblock for every faux constant.
* Alternatively, just put \@generate-registry-docblock in the docblock and run tools/generate-registry-annotations.php * Alternatively, just put \@generate-registry-docblock in the docblock and run build/generate-registry-annotations.php
*/ */
trait RegistryTrait{ trait RegistryTrait{
/** /**