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

How to set a ByteArrayTag and make Filled Map worked?

Discussion in 'Development' started by b1zey, Aug 5, 2019.

  1. b1zey

    b1zey Creeper

    Messages:
    1
    GitHub:
    b1zey
    I try to give player a filled map with image 127x127.
    My code:

    $data = file_get_contents("path/to/image.jpg");
    $data = unpack("C*", $data);
    $nbt->setByteArray("Colors", $data);
    $item->setNamedTag($nbt);
    $sender->getInventory()->addItem($item);

    But, i am getting error. Method setByteArray needs a string.
    I try to make array to string convert via implode. And i get "transparent" not-worked map and error in console:
    Unhandled MapInfoRequestPacket received from nick: RAE=

    What can i do to solve this error and making map worked?
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    I'm fairly certain that map image data should not be a jpeg.
     
    Muqsit 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.