Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Set a NPC's skin

Comments in 'Plugin Development' started by Legoboy0215, Jul 15, 2015.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    CrazedMiner likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I was using HTTPS, and your link linked me to HTTP and I have to login again :/
  3. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    ???? Sorry...
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No need to apologize. #blameshoghi
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    Please, how would I add this weird code/text in my npc plugin?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $human->setSkin($code, $slim);

    BTW this isn't called code. It is a binary blob or a hex string.

    If it is something like 0123456789abcdef, you have to hex2bin($code) instead.
    Last edited: Jul 15, 2015
  7. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    'blob'... lmao
  8. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    But then my 'blob' will be sooooo long!
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Then put the blob in a file in resources folder and getResource it. Resources are meant for placing large files that you want to represent in string literals.
    Legoboy0215 likes this.
  10. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    txt file or yaml? How? I am noob to configs..
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You can give it whatever file extensions. And getResource has nothing to do with file extensions. Actually, file extensions mean nothing to the PocketMine API.
    Legoboy0215 likes this.
  12. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    Then why is this file so weird?
    lol.skin

    Attached Files:

    • lol.txt
      File size:
      482 bytes
      Views:
      26
  13. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    ??? How do you getResource()?
    blah->blah->getResource?
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    $resource $Plugin->getResource($filename);
    $data stream_get_contents($resource);
    fclose($data);
    It is a binary blob. You should save it in the resources folder directly. No need to bin2hex. This file is in binary form.

    A good file extension for this file is .bin
  15. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    $plugin = ? lol sorry
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Your main plugin class. Usually $this.
  17. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    Ok.. I will try!
  18. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    It did not work. It spawned a Mr.Gray... My legoboy.skin file:
    My code:
    PHP:
            $nbt->Skin = new Compound("Skin", [
              
    "Data" => new String("Data"$senderSkin),
              
    "Slim" => new Byte("Slim"$IsSlim)
            ]);

    Attached Files:

  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What is $senderSkin? Also, how did you get this file that you dumped?
  20. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    I used the one from grabbag with the .skin file. I replaced the content with the one I got from the website. $senderSkin is the code you gave me. I just replaced the var with $this->getConfig()->get("skin-file");
    The config looks like this:
    Code:
    skin-file: "legoboy.skin"
    
    After everything is processed, I did fclose($resource);
    ???

Share This Page

Advertisement