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

Solved Apply custom picture to Map (Item)?

Discussion in 'Plugin Help' started by NIIP99, Apr 3, 2017.

  1. NIIP99

    NIIP99 Silverfish

    Messages:
    22
    GitHub:
    niip99
    Hi,
    I've seen a lot of these recently.
    [​IMG]
    ↑ Btw, this is created by @dktapps

    And I've tried to look for API in pmmp. and I found nothing to do this.. :/
    I really have no clue how to achieve that, does anybody can help me with this?

    Any API or Packet can be sent to Client? Or maybe client request Map Image from Server? Idk... i have no idea..

    Thanks in advance
     
    InspectorGadget likes this.
  2. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    Wrong section.

    This is done by converting image data into an unsigned char (byte) array. The picture size must be exactly 127x127 because that's how many pixels a map has. To do this, get a filled map, then set a 'Color' property to its named tag like this:
    PHP:
    $namedTag = clone $filledMap->getNamedTag();

    $namedTag->Colors = new ByteArrayTag("Colors"/*unsigned char array here*/);
    $filledMap->setNamedTag($namedTag);
     
    NIIP99 likes this.
  3. NIIP99

    NIIP99 Silverfish

    Messages:
    22
    GitHub:
    niip99
    Oh... I just thought this is part of Plugin Help :p My mistake

    Oh okay, thanks! Now I get it :O
    "Color" namedTag is the one responsible for the data :D

    One more question, is pmmp ready with string -> ByteArray conversion API? Or I have to google a way to do the conversion?
     
    InspectorGadget likes this.
  4. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    Just read this thread, I created it when I was testing image maps: https://forums.pmmp.io/threads/solved-convert-image-data-into-byte-array.1534/#post-16944
     
    Jack Noordhuis likes this.
  5. NIIP99

    NIIP99 Silverfish

    Messages:
    22
    GitHub:
    niip99
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
  7. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    Where'd you get that from?
     
  8. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    I think it works for GIF, JPEG/JPG and PNG.
     
  9. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    hello, what is $filledMap ?
     
  10. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    It's filled map item :D read variable name it's not named "filledMap" for fun :D
     
  11. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    Sorry I'm not english i don't know What is "filledMap" :)
     
  12. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Then it's hard to explain.
    Use Google translator maybe you understand it then..
     
    Mystic30 and SkySeven like 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.