1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

ShapedRecipe error, help me

Discussion in 'Development' started by seetch, Nov 27, 2016.

  1. seetch

    seetch Spider

    Messages:
    7
    GitHub:
    seetch
    What is Error?

    [20:08:54] [Server thread/CRITICAL]: Exception: "Symbol does not appear in the shape: X" (EXCEPTION) in "/src/pocketmine/inventory/ShapedRecipe" at line 99
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    please read readme
    please kindly post your code so we can help you
    we cant help you on your plugin error if we cant even see what gone wrong ex show code
     
  3. seetch

    seetch Spider

    Messages:
    7
    GitHub:
    seetch
    PHP:
    //зелье опыта из стекла
            
    $this->getServer()->getCraftingManager()->registerRecipe((new ShapedRecipe(Item::get(38401),
                
    "XX",
                
    "XX"
            
    ))->setIngredient("X"Item::get(2001)));

            
    //Изумрудный шлем
            
    $item["Изумрудный шлем"] = Item::get(31001);
            
    $item["Изумрудный шлем"]->setCustomName("§r§aИзумрудный шлем");
            
    $item["Изумрудный шлем"]->addEnchantment(Enchantment::getEnchantment(0)->setLevel(2));
            
    $this->getServer()->getCraftingManager()->registerRecipe((new BigShapedRecipe($item["Изумрудный шлем"],
                
    "XXX",
                
    "XYX",
                
    "YYY"
                
    ))->setIngredient("X"Item::get(38801)));
     
  4. asyven

    asyven Spider

    Messages:
    14
    mb for Y need Item::get(Item::AIR) ?
     
  5. seetch

    seetch Spider

    Messages:
    7
    GitHub:
    seetch
    no :(
     
  6. seetch

    seetch Spider

    Messages:
    7
    GitHub:
    seetch
    problem up
     
  7. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    fixed you mean?
     
  8. seetch

    seetch Spider

    Messages:
    7
    GitHub:
    seetch
    dont... :(
     
  9. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    well i cant help since you only show very small part of the code and i dont even know what is line what
     
  10. Aydar

    Aydar Creeper

    Messages:
    5
    PHP:
    <?php

     
    namespace Crafts;

     use 
    pocketmine\plugin\PluginBase;
     use 
    pocketmine\inventory\ShapedRecipe;
     use 
    pocketmine\inventory\BigShapedRecipe;
     use 
    pocketmine\item\Item;

     class 
    Main extends PluginBase {

    public function 
    registerRecipes(){
        
    $this->getServer()->getCraftingManager()->registerRecipe((new BigShapedRecipe(Item::get(5701)->setCustomName("§r§bАлмазно§7-§fяЖелезный§7 блок"),
          
    "XXX",
          
    "XYX",
          
    "XXX"
        
    ))->setIngredient("X"Item::get(26408))->setIngredient("Y"Item::get(Item::IRON_INGOT01)));
    }
    }
    Same error
     
    Last edited by a moderator: Dec 4, 2016
  11. gurun

    gurun MiNET

    Messages:
    20
    GitHub:
    niclasolofsson
    Yeah, i guess it's the same error, since it's the same faulty code. Where are you guys getting this. It doesn't correspond to anything that PM can interpret as "valid" code.
    But the code for this is badly written also in PocketMine. That method you are calling probably shouldn't exist, because $shape is private, you can't set it, hence you can't ever really call setIngredient(). Use addIngredient() with x/y instead.
     
    robske_110 (Tim) and dktapps like this.
  12. Aydar

    Aydar Creeper

    Messages:
    5
    Thank you. I'am replace setIngredient to addIngredient. Error fixed, but in the crafting table not have this craft. What I'm doing wrong?
     
  13. gurun

    gurun MiNET

    Messages:
    20
    GitHub:
    niclasolofsson
    You have to make sure it is also sent to the player. It should be sent when a player joins, but it all depends on when you adding the recipe. There is a method in server for sending it, but I'm not sure you can access that from a plugin. Guess you have to experiment with it.

    Server::sendRecipeList(Player $p)
     
  14. Aydar

    Aydar Creeper

    Messages:
    5
    Code:
    <?php
    namespace Items;
    use pocketmine\command\CommandSender;
    use pocketmine\command\Command;
    use pocketmine\event\Listener;
    use pocketmine\plugin\PluginBase;
    use pocketmine\inventory\ShapedRecipe;
    use pocketmine\inventory\BigShapedRecipe;
    use pocketmine\Server;
    use pocketmine\item\enchantment\Enchantment;
    use pocketmine\item\Item;
    use pocketmine\Player;
    use pocketmine\event\server\DataPacketReceiveEvent;
    use pocketmine\utils\TextFormat as C;
    use pocketmine\command\ConsoleCommandSender;
    
    
    class EmeraldItems extends PluginBase implements Listener{
        
        
        protected $thirstManager;
    
       public function onEnable(){
            $this->reloadConfig();
            $this->getServer()->getPluginManager()->registerEvents($this, $this);
            // $this->getServer()->getScheduler()->scheduleRepeatingTask(new ThirstTask($this), 10);
            $this->registerRecipes();
                }
       public function registerRecipes(){
    $item = Item::get(310, 0, 1);
    $item->setCustomName("§8Obsidian Helmet");
    $item->addEnchantment(Enchantment::getEnchantment(0)->setLevel(10));
        $this->getServer()->getCraftingManager()->registerRecipe((new BigShapedRecipe($item,
          "XXX",
          "XYX",
          "YYY"
        ))->addIngredient("X", Item::get(Item::OBSIDIAN, 0, 5))->addIngredient("Y", Item::get(Item::AIR, 0, 2)));
    $item = Item::get(311, 0, 1);
    $item->setCustomName("§8Obsidian Chestplate");
    $item->addEnchantment(Enchantment::getEnchantment(0)->setLevel(10));
        $this->getServer()->getCraftingManager()->registerRecipe((new BigShapedRecipe($item,
          "XYX",
          "XXX",
          "XXX"
        ))->addIngredient("X", Item::get(Item::OBSIDIAN, 0, 7))->addIngredient("Y", Item::get(Item::AIR, 0, 2)));
    $item = Item::get(312, 0, 1);
    $item->setCustomName("§8Obsidian Leggings");
    $item->addEnchantment(Enchantment::getEnchantment(0)->setLevel(10));
        $this->getServer()->getCraftingManager()->registerRecipe((new BigShapedRecipe($item,
          "XXX",
          "XYX",
          "XYX"
        ))->addIngredient("X", Item::get(Item::OBSIDIAN, 0, 5))->addIngredient("Y", Item::get(Item::AIR, 0, 2)));
    $item = Item::get(313, 0, 1);
    $item->setCustomName("§8Obsidian Boots");
    $item->addEnchantment(Enchantment::getEnchantment(0)->setLevel(10));
        $this->getServer()->getCraftingManager()->registerRecipe((new BigShapedRecipe($item,
          "YYY",
          "XYX",
          "XYX"
        ))->addIngredient("X", Item::get(Item::OBSIDIAN, 0, 5))->addIngredient("Y", Item::get(Item::AIR, 0, 2)));
    $item = Item::get(276, 0, 1);
    $item->setCustomName("§8Obsidian Sword");
    $item->addEnchantment(Enchantment::getEnchantment(9)->setLevel(5));
        $this->getServer()->getCraftingManager()->registerRecipe((new BigShapedRecipe($item,
          "GXG",
          "GXG",
          "GYG"
        ))->addIngredient("X", Item::get(Item::OBSIDIAN, 0, 5))->addIngredient("G", Item::get(Item::AIR, 0, 5))->addIngredient("Y", Item::get(Item:: STICK, 0, 2)));
            }
    }
    2016-12-04 [19:12:34] [Server thread/CRITICAL]: TypeError: "Argument 3 passed to pocketmine\inventory\ShapedRecipe::addIngredient() must be an instance of pocketmine\item\Item, none given, called in phar:///home/gs12648/plugins/Items.phar/src/SIvanov/EmeraldItems.php on line 37" (EXCEPTION) in "/src/pocketmine/inventory/ShapedRecipe" at line 85
     
  15. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    The error message already tells you the problem?
     
  16. Aydar

    Aydar Creeper

    Messages:
    5
    Yes, but I don't know how fix it.
     
  17. Aydar

    Aydar Creeper

    Messages:
    5
    Yes, but I don't know how fix it.
     
  18. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    You forgot Item $item in the paranthesis on the registerrecipe function
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.