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

Questions with nbt and help

Discussion in 'Development' started by Ayush, Jun 14, 2021.

  1. Ayush

    Ayush Witch

    Messages:
    62
    It works thank you but when I craft it goes back and ingredients also get back to my inventory
     
  2. Mcbeany

    Mcbeany Spider Jockey

    Messages:
    33
    GitHub:
    mcbeany
    that wasn't wrong
    the problem is your crafting recipe i think
     
  3. Ayush

    Ayush Witch

    Messages:
    62
    Then why it doesnt work also ?
     
  4. Ayush

    Ayush Witch

    Messages:
    62
    Wait I'll give u my code
     
  5. Ayush

    Ayush Witch

    Messages:
    62
    PHP:
        public function onEnable(){
          
          
    $dm Item::get(Item::SKULL31);
          
    $nbt $dm->getNamedTag() ?? new CompoundTag("MinionInformation",[
        new 
    CompoundTag("MinionType",[
            new 
    IntTag("ActionType"0),
            new 
    IntTag("TargetID"56)
            ]
          )]
        );
          
    $dm->setNamedTag($nbt);

          
    $lpr = new ShapedRecipe(["AAA","ABA","AAA"],["A"=>Item::get(264010),"B"=>Item::get(Item::WOODEN_PICKAXE)],[$dm]);
          
    Server::getInstance()->getCraftingManager()->registerRecipe($lpr);
         }
        
      public function 
    onCraft(CraftItemEvent $event){

            
    $event->getLogger()->info(TF::YELLOW "[Debug]" TF::LIGHT_PURPLE "CraftItemEvent Confirmed, crafted item: " $event->getOutputs());
        }
        
        public function 
    onJoin(PlayerJoinEvent $event){
            
            
    $this->getServer()->sendRecipeList($event->getPlayer());
            
        }
     
  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.