mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-18 15:05:56 +00:00
Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/13488997706
This commit is contained in:
commit
19425e35ea
@ -154,7 +154,7 @@ class BlockBreakInfo{
|
||||
|
||||
$efficiency = $item->getMiningEfficiency(($this->toolType & $item->getBlockToolType()) !== 0);
|
||||
if($efficiency <= 0){
|
||||
throw new \InvalidArgumentException(get_class($item) . " has invalid mining efficiency: expected >= 0, got $efficiency");
|
||||
throw new \InvalidArgumentException(get_class($item) . " must have a positive mining efficiency, but got $efficiency");
|
||||
}
|
||||
|
||||
$base /= $efficiency;
|
||||
|
@ -131,7 +131,8 @@ final class BlockStateDeserializerHelper{
|
||||
//TODO: check if these need any special treatment to get the appropriate data to both halves of the door
|
||||
return $block
|
||||
->setTop($in->readBool(BlockStateNames::UPPER_BLOCK_BIT))
|
||||
->setFacing($in->readCardinalHorizontalFacing())
|
||||
//a door facing "east" is actually facing north - thanks mojang
|
||||
->setFacing(Facing::rotateY($in->readCardinalHorizontalFacing(), clockwise: false))
|
||||
->setHingeRight($in->readBool(BlockStateNames::DOOR_HINGE_BIT))
|
||||
->setOpen($in->readBool(BlockStateNames::OPEN_BIT));
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ final class BlockStateSerializerHelper{
|
||||
public static function encodeDoor(Door $block, Writer $out) : Writer{
|
||||
return $out
|
||||
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
|
||||
->writeCardinalHorizontalFacing($block->getFacing())
|
||||
//a door facing north is encoded as "east"
|
||||
->writeCardinalHorizontalFacing(Facing::rotateY($block->getFacing(), clockwise: true))
|
||||
->writeBool(BlockStateNames::DOOR_HINGE_BIT, $block->isHingeRight())
|
||||
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine\resourcepacks;
|
||||
use pocketmine\utils\Config;
|
||||
use pocketmine\utils\Filesystem;
|
||||
use pocketmine\utils\Utils;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use function array_keys;
|
||||
use function copy;
|
||||
@ -103,9 +104,14 @@ class ResourcePackManager{
|
||||
try{
|
||||
$newPack = $this->loadPackFromPath(Path::join($this->path, $pack));
|
||||
|
||||
$this->resourcePacks[] = $newPack;
|
||||
$index = strtolower($newPack->getPackId());
|
||||
if(!Uuid::isValid($index)){
|
||||
//TODO: we should use Uuid in ResourcePack interface directly but that would break BC
|
||||
//for now we need to validate this here to make sure it doesn't cause crashes later on
|
||||
throw new ResourcePackException("Invalid UUID ($index)");
|
||||
}
|
||||
$this->uuidList[$index] = $newPack;
|
||||
$this->resourcePacks[] = $newPack;
|
||||
|
||||
$keyPath = Path::join($this->path, $pack . ".key");
|
||||
if(file_exists($keyPath)){
|
||||
@ -190,6 +196,11 @@ class ResourcePackManager{
|
||||
$resourcePacks = [];
|
||||
foreach($resourceStack as $pack){
|
||||
$uuid = strtolower($pack->getPackId());
|
||||
if(!Uuid::isValid($uuid)){
|
||||
//TODO: we should use Uuid in ResourcePack interface directly but that would break BC
|
||||
//for now we need to validate this here to make sure it doesn't cause crashes later on
|
||||
throw new \InvalidArgumentException("Invalid resource pack UUID ($uuid)");
|
||||
}
|
||||
if(isset($uuidList[$uuid])){
|
||||
throw new \InvalidArgumentException("Cannot load two resource pack with the same UUID ($uuid)");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user