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

Invalid skin data size 40 bytes

Discussion in 'Development' started by Aenteritas, Sep 23, 2019.

  1. Aenteritas

    Aenteritas Silverfish

    Messages:
    22
    Error:
    upload_2019-9-23_2-32-5.png

    I downloaded this 64x64 skin: https://minecraft.novaskin.me/skin/1154583057/64x64
    Now it says that the skin data size is invalid. The Skin is in .png-Format.
    What to do?

    How i set the Skin:
    PHP:
    $nbt->setTag( new CompoundTag("Skin", [
        
    "Data" => new StringTag("Data"Server::getInstance()->getDataPath() . "/plugin_data/NPC/skin.png"),
        
    "Name" => new StringTag("Name""Standart_Custom")
    ]));
    My full function:
    PHP:
    public function addNPC(){
        
    $nbt = new CompoundTag;
        
    $path $this->getDataFolder() . "skin.png";
        
    $img = @\imagecreatefrompng($path);
        
    $byte "";
        for(
    $y 0$height imagesy($img); $y $height$y++){
            for(
    $x 0$width imagesx($img); $x $width$x++){
                
    $color imagecolorat($img$x$y);
                
    $byte .= pack("c", ($color >> 16) & 0xFF)
                    . 
    pack("c", ($color >> 8) & 0xFF)
                    . 
    pack("c"$color 0xFF)
                    . 
    pack("c"255 - (($color 0x7F000000) >> 23));
            }
        }

        
    $nbt->setTag( new ListTag("Pos", [
            new 
    DoubleTag("X""-26.6"),
            new 
    DoubleTag("Y""50"),
            new 
    DoubleTag("Z""4.49")
        ]));

        
    $nbt->setTag( new ListTag("Motion", [
            new 
    DoubleTag(""0),
            new 
    DoubleTag(""0),
            new 
    DoubleTag(""0)
        ]));

        
    $nbt->setTag( new ListTag("Rotation", [
            new 
    FloatTag("""275"), //230, 250
            
    new FloatTag("""0")
        ]));

        
    $nbt->setTag(new ShortTag("Health"20));

        
    $nbt->setTag( new CompoundTag("Skin", [
            
    "Data" => new StringTag("Data"$this->getDataFolder() . "skin.png"),
            
    "Name" => new StringTag("Name""Standart_Custom")
        ]));

        
    $level Server::getInstance()->getLevelByName("world");
        
    $human = new Human($level$nbt);
        
    $human->setNameTag("§bSkyBlock\n§r§lTIPPE MICH ZUM BEITRETEN!");
        
    $human->setNameTagVisible(false);
        
    $human->setScale(1.5);
        
    $human->spawnToAll();
    }
    PocketMine only allowes this sizes:
    Skin.php (PocketMine.php):
    PHP:
    public const ACCEPTED_SKIN_SIZES = [
       
    64 32 4,
       
    64 64 4,
       
    128 128 4
    ]; 



    I created my skin in BlockBench and it is 64 x 64...
     
    Last edited: Sep 23, 2019
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
  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.