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

No errors but it doesn't work...

Discussion in 'Development' started by MonkleeGamer, Jan 27, 2018.

  1. MonkleeGamer

    MonkleeGamer Spider

    Messages:
    8
    GitHub:
    monkleegamer
    PHP:
                        $player->getLevel()->setBlock(new Vector3($player->getX(), $player->getY(), $player->getZ()), Block::get(Block::CHEST), truetrue);
                                    
    $nbt = new CompoundTag("", [
                                    new 
    ListTag("Items", []),
                                    new 
    StringTag("id"Tile::CHEST),
                                    new 
    IntTag("x"$player->getX()),
                                    new 
    IntTag("y"$player->getY()),
                                    new 
    IntTag("z"$player->getZ())
                                    ]);
                                    
    $player->sendMessage(TF::RED "Checkpoint 1");
                                    
    $nbt->Items->setTagType(NBT::TAG_Compound);
                                    
    $nbt->CustomName = new StringTag("CustomName"$player->getNameTag());
                                    
    $player->sendMessage(TF::RED "Checkpoint 2");
                                    
    $tile Tile::createTile("Chest"$player->getLevel($player->getX() >> 4$player->getZ() >> 4), $nbt);
                                    
    $player->sendMessage(TF::RED "Checkpoint 3");
                                    
    $inv $tile->getInventory();
                                    
    $inv->clearAll();
                                    
    $player->sendMessage("checkpoint 4");
                                    
    $inv->setItem(0Item::get(108)->setCustomName("§eOnePerson"));
                                    
    $inv->setItem(1Item::get(208)->setCustomName("§dTwoPersons"));
                                    
    $inv->setItem(2Item::get(307)->setCustomName("§aThreePeoples"));
                                    
    $inv->setItem(3Item::get(402)->setCustomName("§cFourHotdogs"));
                                    
    $inv->setItem(4Item::get(501)->setCustomName("§bFiveHumans"));
                                    
    $player->sendMessage("checkpoint 5");
                                    
    $player->addWindow($inv);
                                    
    $player->sendMessage("checkpoint 6");
    I'm still trying to make a chest spawn with items in it when I tap another chest on the ground. I have that code and the checkpoints would help me fix the errors because I could find out where they were. But when i tap the chest on the ground the second chest spawns but neither of the chest have any items in and all the checkpoints go off and there's no errors in console. Am I missing something?
     

    Attached Files:

  2. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    sendBlocks()
     
    MonkleeGamer likes this.
  3. MonkleeGamer

    MonkleeGamer Spider

    Messages:
    8
    GitHub:
    monkleegamer
    Thanks I'll test it :D
     
  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.