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

Solved Skin validation?

Discussion in 'Development' started by Rim, Sep 17, 2019.

  1. Rim

    Rim Spider Jockey

    Messages:
    28
    GitHub:
    boomyourbang
    Fixing up a KitPvP plugin and the server seems not to be able to read the file for a skin that I provided. I am using file_get_contents() with a .dat file for the skin. The server has reached the file path but something about it must be wrong. I am using this to spawn a Human entity and upon its creation the server crashes with this:

    Code:
    [20:13:39] [Server thread/DEBUG]: #0 src/pocketmine/entity/Human(125): pocketmine\entity\Skin->validate()
    
    [20:13:39] [Server thread/DEBUG]: #1 src/pocketmine/entity/Human(105): pocketmine\entity\Human::deserializeSkinNBT(object pocketmine\nbt\tag\CompoundTag)
    
    [20:13:39] [Server thread/DEBUG]: #2 plugins/PvPFest/src/PvPFest/arena/envoys/entities/Envoy(33): pocketmine\entity\Human->__construct(object pocketmine\level\Level, object pocketmine\nbt\tag\CompoundTag)
    
    [20:13:39] [Server thread/DEBUG]: #3 plugins/PvPFest/src/PvPFest/arena/envoys/DropPoint(47): PvPFest\arena\envoys\entities\Envoy->__construct(object pocketmine\level\Level, object pocketmine\nbt\tag\CompoundTag, object PvPFest\arena\envoys\DropPoint)
    
    [20:13:39] [Server thread/DEBUG]: #4 plugins/PvPFest/src/PvPFest/arena/envoys/Envoys(44): PvPFest\arena\envoys\DropPoint->dropEnvoy()
    
    [20:13:39] [Server thread/DEBUG]: #5 plugins/PvPFest/src/PvPFest/arena/Arena(35): PvPFest\arena\envoys\Envoys->tick()
    
    [20:13:39] [Server thread/DEBUG]: #6 plugins/PvPFest/src/PvPFest/MainTask(28): PvPFest\arena\Arena->tick()
    
    [20:13:39] [Server thread/DEBUG]: #7 src/pocketmine/scheduler/TaskHandler(159): PvPFest\MainTask->onRun(integer 3360)
    
    [20:13:39] [Server thread/DEBUG]: #8 src/pocketmine/scheduler/TaskScheduler(199): pocketmine\scheduler\TaskHandler->run(integer 3360)
    
    [20:13:39] [Server thread/DEBUG]: #9 src/pocketmine/plugin/PluginManager(681): pocketmine\scheduler\TaskScheduler->mainThreadHeartbeat(integer 3360)
    
    [20:13:39] [Server thread/DEBUG]: #10 src/pocketmine/Server(2569): pocketmine\plugin\PluginManager->tickSchedulers(integer 3360)
    
    [20:13:39] [Server thread/DEBUG]: #11 src/pocketmine/Server(2345): pocketmine\Server->tick()
    
    [20:13:39] [Server thread/DEBUG]: #12 src/pocketmine/Server(2205): pocketmine\Server->tickProcessor()
    
    [20:13:39] [Server thread/DEBUG]: #13 src/pocketmine/Server(1784): pocketmine\Server->start()
    
    [20:13:39] [Server thread/DEBUG]: #14 src/pocketmine/PocketMine(275): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[15] /home/gs-41582/, string[23] /home/gs-41582/plugins/)
    
    [20:13:39] [Server thread/DEBUG]: #15 src/pocketmine/PocketMine(299): pocketmine\server()
    
    [20:13:39] [Server thread/DEBUG]: #16 (1): require(string[94] phar:///pro/bin/mcpe/pocketmine-stable-1.12.0/PocketMine-MP.phar/src/pocketmine/)
    
    [20:13:39] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump
    
    [20:13:39] [Server thread/EMERGENCY]: Please upload the "/home/gs-41582/crashdumps/Tue_Sep_17-20.13.39-UTC_2019.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.
    
    [20:13:39] [Server thread/INFO]: Disabling MBcore v1
    
    [20:13:39] [Server thread/INFO]: [MBcore] Saved ranks/coins
    
    [20:13:39] [Server thread/INFO]: Disabling MBpvpfest v1
    
    Any help I can get with Skin->validate() and Human::deserializeSkinNBT()? I'm pretty sure the issue is here is with the file I'm using, but I've seen it done before. Do I need to use a .png instead?
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Saving the raw skin data should work just fine. May we see the parts of your code that save and load skins?
     
  3. Rim

    Rim Spider Jockey

    Messages:
    28
    GitHub:
    boomyourbang
    It's directly from a file in the plugin's directory. Envoy extends Human

    I hope this isn't a facepalm - this is my first time experimenting with this part of PM.

    Code:
    $entity = new Envoy($this->getPosition()->getLevel(), new CompoundTag(" ", [
        new ListTag("Pos", [
            new DoubleTag("", $x),
            new DoubleTag("", $y),
            new DoubleTag("", $z)
        ]),
        new ListTag("Motion", [
            new DoubleTag("", 0),
            new DoubleTag("", 0),
            new DoubleTag("", 0)
        ]),
        new ListTag("Rotation", [
            new FloatTag("", 0),
            new FloatTag("", 0),
        ]),
        new ShortTag("Health", 30),
        new CompoundTag("Skin", [
            new StringTag("Data", file_get_contents(KitPvP::getInstance()->getDataFolder() . "skins/holding_chest.dat")),
            new StringTag("Name", "Standard_Custom")
        ]),
    ]), $this);
    
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    What is the content of that file (holding_chest.dat)? (how did you create it)

    Why are you using NBT directly instead of PMMP's entity methods?
     
  5. Rim

    Rim Spider Jockey

    Messages:
    28
    GitHub:
    boomyourbang
    holding_chest.dat was a 128 x 128 .png file which I converted.

    Don't know - I'm not fully familiar with messing with entities yet, I'm doing it the way I know how. If there is a better way I could look into that. The spawning of this entity is in a task. Do you need to see the Envoy class file or the entirety of the file I posted a snippet of above (DropPoint class), to get a better idea of how I'm doing this?
     
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    How was it converted? There probably was an error in that conversion process.

    If your Entity extends PocketMine's Entity class (or Human, because it also has a skin and such) then you are offered various methods for manipulating it.
     
  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.