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

Skin Problem

Discussion in 'Plugin Help' started by Muhammed0232, Jul 5, 2020.

  1. Muhammed0232

    Muhammed0232 Spider Jockey

    Messages:
    38
    GitHub:
    Muhammed0232
    PHP:
     $bytes = static::getTextureFromFile(Core::getInstance()->getDataFolder()."skins_herobrine.png");
            
    $this->setSkin(new Skin($this->skin->getSkinId(), $bytes));
            
    $this->sendSkin();


     public static function 
    getTextureFromFile(string $path): string {
            
    $img = @imagecreatefrompng($path);
            
    $bytes '';
            
    $l = (int) @getimagesize($path)[1];
            for(
    $y 0$y $l$y++){
                for(
    $x 0$x 64$x++){
                    
    $rgba = @imagecolorat($img$x$y);
                    
    $a = ((~((int)($rgba >> 24))) << 1) & 0xff;
                    
    $r = ($rgba >> 16) & 0xff;
                    
    $g = ($rgba >> 8) & 0xff;
                    
    $b $rgba 0xff;
                    
    $bytes .= chr($r) . chr($g) . chr($b) . chr($a);
                }
            }
            @
    imagedestroy($img);
            return 
    $bytes;
        }
    Code:
    InvalidStateException: "HerobrineBoss must have a valid skin set" (EXCEPTION) in "src/pocketmine/entity/Human" at line 121
     
    Class is human entity and skins_herobrine.png in have how to fix?
     
  2. UnEnanoMas

    UnEnanoMas Spider Jockey

    Messages:
    36
    GitHub:
    UnEnanoMas
  3. Muhammed0232

    Muhammed0232 Spider Jockey

    Messages:
    38
    GitHub:
    Muhammed0232
  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.