Skip to content

Commit

Permalink
Merge branch 'minor-next' of github.com:pmmp/PocketMine-MP into minor…
Browse files Browse the repository at this point in the history
…-next
  • Loading branch information
dktapps committed Nov 14, 2024
2 parents 2d9cee3 + 33a7b46 commit e0d270a
Show file tree
Hide file tree
Showing 14 changed files with 1,263 additions and 1,166 deletions.
1,261 changes: 648 additions & 613 deletions src/block/VanillaBlocks.php

Large diffs are not rendered by default.

263 changes: 0 additions & 263 deletions src/block/WoodLikeBlockIdHelper.php

This file was deleted.

48 changes: 48 additions & 0 deletions src/data/bedrock/GoatHornTypeIdMap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/

declare(strict_types=1);

namespace pocketmine\data\bedrock;

use pocketmine\item\GoatHornType;
use pocketmine\utils\SingletonTrait;

final class GoatHornTypeIdMap{
use SingletonTrait;
/** @phpstan-use IntSaveIdMapTrait<GoatHornType> */
use IntSaveIdMapTrait;

private function __construct(){
foreach(GoatHornType::cases() as $case){
$this->register(match($case){
GoatHornType::PONDER => GoatHornTypeIds::PONDER,
GoatHornType::SING => GoatHornTypeIds::SING,
GoatHornType::SEEK => GoatHornTypeIds::SEEK,
GoatHornType::FEEL => GoatHornTypeIds::FEEL,
GoatHornType::ADMIRE => GoatHornTypeIds::ADMIRE,
GoatHornType::CALL => GoatHornTypeIds::CALL,
GoatHornType::YEARN => GoatHornTypeIds::YEARN,
GoatHornType::DREAM => GoatHornTypeIds::DREAM
}, $case);
}
}
}
35 changes: 35 additions & 0 deletions src/data/bedrock/GoatHornTypeIds.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/

declare(strict_types=1);

namespace pocketmine\data\bedrock;

final class GoatHornTypeIds{
public const PONDER = 0;
public const SING = 1;
public const SEEK = 2;
public const FEEL = 3;
public const ADMIRE = 4;
public const CALL = 5;
public const YEARN = 6;
public const DREAM = 7;
}
10 changes: 10 additions & 0 deletions src/data/bedrock/item/ItemSerializerDeserializerRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
use pocketmine\block\VanillaBlocks as Blocks;
use pocketmine\data\bedrock\CompoundTypeIds;
use pocketmine\data\bedrock\DyeColorIdMap;
use pocketmine\data\bedrock\GoatHornTypeIdMap;
use pocketmine\data\bedrock\item\ItemTypeNames as Ids;
use pocketmine\data\bedrock\item\SavedItemData as Data;
use pocketmine\data\bedrock\MedicineTypeIdMap;
use pocketmine\data\bedrock\PotionTypeIdMap;
use pocketmine\data\bedrock\SuspiciousStewTypeIdMap;
use pocketmine\item\Banner;
use pocketmine\item\Dye;
use pocketmine\item\GoatHorn;
use pocketmine\item\Item;
use pocketmine\item\Medicine;
use pocketmine\item\Potion;
Expand Down Expand Up @@ -483,6 +485,14 @@ function(Banner $item, int $meta) : void{
},
fn(Banner $item) => DyeColorIdMap::getInstance()->toInvertedId($item->getColor())
);
$this->map1to1ItemWithMeta(
Ids::GOAT_HORN,
Items::GOAT_HORN(),
function(GoatHorn $item, int $meta) : void{
$item->setHornType(GoatHornTypeIdMap::getInstance()->fromId($meta) ?? throw new ItemTypeDeserializeException("Unknown goat horn type ID $meta"));
},
fn(GoatHorn $item) => GoatHornTypeIdMap::getInstance()->toId($item->getHornType())
);
$this->map1to1ItemWithMeta(
Ids::MEDICINE,
Items::MEDICINE(),
Expand Down
Loading

0 comments on commit e0d270a

Please sign in to comment.