mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 06:55:29 +00:00
Creative inventory update with unknown item filter
This commit is contained in:
parent
ae1501884b
commit
9d16f145dd
@ -1567,10 +1567,10 @@ class Server{
|
|||||||
|
|
||||||
InventoryType::init();
|
InventoryType::init();
|
||||||
Block::init();
|
Block::init();
|
||||||
|
Enchantment::init();
|
||||||
Item::init();
|
Item::init();
|
||||||
Biome::init();
|
Biome::init();
|
||||||
Effect::init();
|
Effect::init();
|
||||||
Enchantment::init();
|
|
||||||
Attribute::init();
|
Attribute::init();
|
||||||
$this->craftingManager = new CraftingManager();
|
$this->craftingManager = new CraftingManager();
|
||||||
|
|
||||||
|
@ -227,8 +227,15 @@ class Item implements ItemIds{
|
|||||||
|
|
||||||
$creativeItems = new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/creativeitems.json", Config::JSON, []);
|
$creativeItems = new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/creativeitems.json", Config::JSON, []);
|
||||||
|
|
||||||
foreach($creativeItems->getAll() as $item){
|
foreach($creativeItems->getAll() as $data){
|
||||||
self::addCreativeItem(Item::get($item["ID"], $item["Damage"]));
|
$item = Item::get($data["id"], $data["damage"]);
|
||||||
|
if($item->getName() === "Unknown"){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(isset($data["nbt"])){
|
||||||
|
$item->setNamedTag(NBT::parseJson(json_encode($data["nbt"])));
|
||||||
|
}
|
||||||
|
self::addCreativeItem($item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +248,7 @@ class Item implements ItemIds{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function addCreativeItem(Item $item){
|
public static function addCreativeItem(Item $item){
|
||||||
Item::$creative[] = Item::get($item->getId(), $item->getDamage());
|
Item::$creative[] = clone $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function removeCreativeItem(Item $item){
|
public static function removeCreativeItem(Item $item){
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user