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

Solved PlayerSkinPacket crashes client

Discussion in 'Plugin Help' started by Sergey Dertan, Aug 6, 2018.

  1. Sergey Dertan

    Sergey Dertan Silverfish

    Messages:
    18
    When I`m trying to set skin of my NPC client crashes, but NPC spawns correctly, so without changing skin everything is fine. I have no errors in console. P.S. Before updating to mc 1.5 from 1.4 everything was fine.
    How I create skin
    PHP:
    $bytes '';
                
    $l = (int) @getimagesize($img_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);
                
    $skin = new Skin('Standard_Custom'$bytes);
    How I send skin
    PHP:
    $pk = new PlayerSkinPacket();
            
    $pk->uuid $this->uuid;
            
    $pk->skin $this->skin;
            
    $target->sendDataPacket($pk);
     
  2. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    Have you checked the length of $bytes, and your values for alpha are valid?
     
  3. Sergey Dertan

    Sergey Dertan Silverfish

    Messages:
    18
    checked with Skin::isValid(). How should I check if alpha is valid?
     
  4. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
  5. Sergey Dertan

    Sergey Dertan Silverfish

    Messages:
    18
  6. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
  7. Sergey Dertan

    Sergey Dertan Silverfish

    Messages:
    18
  8. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    because of some bad code in the client. Before 1.5.0 release it worked fine.
     
    EdwardHamHam likes this.
  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.