mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 10:31:51 +00:00
Don't use Config for builtin JSON resources
it doesn't make sense to use a config in these cases, and also it just hides problems when the files are missing.
This commit is contained in:
parent
cc97f76ec9
commit
9f7f62e9e5
@ -29,7 +29,6 @@ use pocketmine\network\mcpe\protocol\BatchPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\CraftingDataPacket;
|
use pocketmine\network\mcpe\protocol\CraftingDataPacket;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\timings\Timings;
|
use pocketmine\timings\Timings;
|
||||||
use pocketmine\utils\Config;
|
|
||||||
|
|
||||||
class CraftingManager{
|
class CraftingManager{
|
||||||
/** @var ShapedRecipe[][] */
|
/** @var ShapedRecipe[][] */
|
||||||
@ -47,9 +46,9 @@ class CraftingManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function init() : void{
|
public function init() : void{
|
||||||
$recipes = new Config(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "recipes.json", Config::JSON, []);
|
$recipes = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "recipes.json"), true);
|
||||||
|
|
||||||
foreach($recipes->getAll() as $recipe){
|
foreach($recipes as $recipe){
|
||||||
switch($recipe["type"]){
|
switch($recipe["type"]){
|
||||||
case 0:
|
case 0:
|
||||||
$this->registerRecipe(new ShapelessRecipe(
|
$this->registerRecipe(new ShapelessRecipe(
|
||||||
|
@ -43,7 +43,6 @@ use pocketmine\nbt\tag\ShortTag;
|
|||||||
use pocketmine\nbt\tag\StringTag;
|
use pocketmine\nbt\tag\StringTag;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\utils\Binary;
|
use pocketmine\utils\Binary;
|
||||||
use pocketmine\utils\Config;
|
|
||||||
|
|
||||||
class Item implements ItemIds, \JsonSerializable{
|
class Item implements ItemIds, \JsonSerializable{
|
||||||
public const TAG_ENCH = "ench";
|
public const TAG_ENCH = "ench";
|
||||||
@ -119,9 +118,9 @@ class Item implements ItemIds, \JsonSerializable{
|
|||||||
public static function initCreativeItems(){
|
public static function initCreativeItems(){
|
||||||
self::clearCreativeItems();
|
self::clearCreativeItems();
|
||||||
|
|
||||||
$creativeItems = new Config(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "creativeitems.json", Config::JSON, []);
|
$creativeItems = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "creativeitems.json"), true);
|
||||||
|
|
||||||
foreach($creativeItems->getAll() as $data){
|
foreach($creativeItems as $data){
|
||||||
$item = Item::jsonDeserialize($data);
|
$item = Item::jsonDeserialize($data);
|
||||||
if($item->getName() === "Unknown"){
|
if($item->getName() === "Unknown"){
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user