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

Books

Discussion in 'Development' started by MalakasPlayzMCPE, Jun 30, 2020.

  1. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Hey folks!
    It's been a while since my last post in here.

    Anyways, I'm trying to make a book for showing my clan's welcoming message. The problem is I have no clue of how to make books as well as if it is possible to force-open it. I've done my own research but I found posts from a year ago or so, therefore I would like to know if there is still no conceivable way of doing that.

    Every reply is appreciated, thank you for your time reading this post!
     
  2. Willoxey

    Willoxey Spider Jockey

    Messages:
    33
    Idk if this will help you. But you can make easily UI forms with FormAPI. Use setContent to set the things that you want them to show.
     
  3. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Thank you for your reply Willoxey! I am aware of forms being an option, but I wanted to avoid using them. In my opinion, forms are overused in servers and I was thinking of making a difference by using books, since there will be quite a lot of pages in the book.

    I would make use of books either way, but it would be even fancier (for me at least) if I could forcefully send book pages to the player's screen.
     
  4. Seeker

    Seeker Spider Jockey

    Messages:
    45
    GitHub:
    seeker-devs
    That is not what the OP asked about. There are 2 classes for 'Text' books, Writable book and Written book. A writable book allows modification of the text, while a Written book does not accept any text after the provided text. (todo: correct my post, kinda busy rn, i did not define writable book correctly) A Written book has all of the functions of a Writable book.Here's a short and EZ example:
    PHP:
    //import ItemFactory (like use pocketmine\item\ItemFactory), Written book and ItemIds.
     
    $pageId 0//First page owo
            
    $pageText "Hello. This is a written book. I asked in a forum before i try to read and understand PocketMine's source code!";
      
    //thanks to xenialdan too ^-^     
      
    $item ItemFactory::get(ItemIds::WRITTEN_BOOK);
      
    $item->setPageText($pageId,$pageText);
    //easier one
    $bookyboi ItemFactory::get(ItemIds::WRITTEN_BOOK);
    $bookyboi->setPageText(0"hi man");
    I am not very knowledgeable about this. Please forgive me if I misguide you. No one was helping you so I decided to help a bit... but eh... :3
    Irrelevant: my phpstorm evalution license expired today nonono
     
    Last edited: Jul 14, 2020
  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.