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

[1.5] Spawning a Human NPC

Comments in 'Plugin Development' started by Samueljh1, Apr 24, 2015.

  1. Kiosek
    Offline

    Kiosek New Member

    Joined:
    Jun 17, 2014
    Posts:
    34
    Minecraft User:
    Cecil107
    Pls phar
  2. Kiosek
    Offline

    Kiosek New Member

    Joined:
    Jun 17, 2014
    Posts:
    34
    Minecraft User:
    Cecil107
    Pls phar
    :D
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    How do you specify the rgb?
    If they are inrs,
    PHP:
    function toRGB($r$g$b){
      return 
    ord($r) . ord($g) . ord($b) . "\x00";
    }
    Last edited by a moderator: Apr 25, 2015
    Falk likes this.
  4. shoghicp
    Offline

    shoghicp Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    433
    Plugins:
    14
    Minecraft User:
    shoghicp
    You can also use the normal Human->setSkin() call, and it'll be saved later as NBT
    Last edited by a moderator: Apr 26, 2015
    LDX, MobileCrafter and PEMapModder like this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Can you please tell us about the skin's ordering format?
  6. TheLucyClub
    Offline

    TheLucyClub Banned

    Joined:
    Jan 31, 2015
    Posts:
    53
    Minecraft User:
    iCreepyKid
    I would like to know too.
    No. People will not just give a plugin. You should learn more about PHP and make your own. (Plus its for his skywars plugin which he would never give me :p)
  7. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    Nop, i get this: (from red [255,0,0])

    PHP:

    504848
    \x00

    Use:

    PHP:
    dechex();
  8. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    It should be chr instead of ord
    PEMapModder likes this.
  9. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    @PEMapModder OMG I GOT IT WORKING!!!!! MY SYSTEM WORKED AND I CAN CONVERT ANY IMAGE INTO THE RGBMAP!!!!! USE THIS LINK!!!

    (THE SKIN IS AA12'S ! LET ME KNOW IF YOU WANT A DIFFERENT SKIN AND ILL CHANGE IT FOR YOU!)

    USE MY API SCRIPT HERE: (you can't upload a skin yet - but as i said i will)

    http://samueljh1.net/samcraft/img.php
    PEMapModder likes this.
  10. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
  11. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    function convPNG($pnglink = "img.png"){
    $im = imagecreatefrompng($pnglink);
    $rgb = imagecolorat($im, 10, 15);
    $r = ($rgb >> 16) & 0xFF;
    $g = ($rgb >> 8) & 0xFF;
    $b = $rgb & 0xFF;
    return toRGB($r, $g, $b);
    }

    function toRGB($r, $g, $b){
    return chr($r) . chr($g) . chr($b) . "\x00";
    }

    ??
  12. Rendum
    Offline

    Rendum New Member

    Joined:
    Mar 9, 2015
    Posts:
    3
    Minecraft User:
    Rendum
    mobs are added ?!
  13. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    PHP:
    <?php

    $url 
    $_GET["url"];

    if(
    $url == null){ echo "No URL specified (?url=), so default skin loaded (AA12) <p>"$url "http://samcraft.samueljh1.net/char.png";}

    $image imagecreatefrompng($url);

    if(
    $image != null){

        
    $width imagesx($image);
        
    $height imagesy($image);
        
    $colors = array();
      
        for (
    $y 0$y $height$y++) {

            
    $y_array = array();

            for (
    $x 0$x $width$x++) {

                
    $rgb imagecolorat($image$x$y);
                
    $r = ($rgb >> 16) & 0xFF;
                
    $g = ($rgb >> 8) & 0xFF;

                
    $b $rgb 0xFF;

                
    $x_array = array($r$g$b) ;
                
    $y_array[] = $x_array ;

            }

        
    $colors[] = $y_array ;

        }

        foreach(
    $colors as $width){

            foreach(
    $width as $height){

                echo 
    "\\x" dechex($height[0]) . "\\x" dechex($height[1]) . "\\x" dechex($height[2]) . "\\x00";

            }

        }
      
        echo 
    "<p><img src=$url>";

    }

    else{
      
        echo 
    "<p>Failed to Load Image.";
      
    }

    ?>

    Basically, that :p, but you gotta foreach everything because it returns a 3d array
    thebigsmileXD likes this.
  14. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    They were added ages ago lol
  15. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
  16. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    ironically, sharing a copyrighted Steve skin in public is illegal even if its in png form or hex form because its a property of Mojang.
    PEMapModder likes this.
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Not every server has GD though.
  18. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    just use this script as a PHP web script.
  19. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    That means a lot of stuff is illegal, including on this site :p
  20. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
    Lol i am

Share This Page

Advertisement