MapData 5.46.0
The pixels and settings of one map. Pixels are kept as 4 bytes per pixel (R, G, B, A), row by row, like the "colors" array of vanilla Bedrock map data and like the pixels of ClientboundMapItemDataPacket.
Saved with the vanilla Bedrock map data tags (mapId, parentMapId, dimension, fullyExplored, mapLocked, scale, unlimitedTracking, height, width, xCenter, zCenter, colors; Minecraft Wiki "Map item format"), plus the name of the PocketMine world it shows.
Constants
MAX_SCALE
public const MAX_SCALE = 4SIZE
public const SIZE = 128Methods
__construct()
public function __construct(int $id, string $worldName, int $centerX, int $centerZ, int $scale = 0, bool $locked = false, int $parentMapId = -1, ?string $pixels = null)alignCenter()
public static function alignCenter(int $x, int $z, int $scale) : arrayReturns the map centre for a new map made at the given position. Scale 0 maps are centred on the player (as in Bedrock); bigger maps snap to the vanilla grid, where (0, 0) is in the top-left square of the map at that scale.
fromNbt()
public static function fromNbt(\pocketmine\nbt\tag\CompoundTag $tag) : selfgetCenterX()
public function getCenterX() : intgetCenterZ()
public function getCenterZ() : intgetId()
public function getId() : intgetParentMapId()
public function getParentMapId() : intReturns the ID of the map this one was made from (zooming out or locking), or -1
getPixel()
public function getPixel(int $x, int $y) : intReturns the colour (0xRRGGBB) of a pixel, or -1 if it was never drawn (transparent).
getPixelArea()
public function getPixelArea(int $x, int $y, int $width, int $height) : stringReturns the pixels of an area: 4 bytes per pixel (R, G, B, A), row by row.
getPixels()
public function getPixels() : stringReturns all pixels: 4 bytes per pixel (R, G, B, A), row by row.
getScale()
public function getScale() : intgetWorldName()
public function getWorldName() : stringhasChanged()
public function hasChanged() : boolisLocked()
public function isLocked() : boolsetChanged()
public function setChanged(bool $changed) : voidsetLocked()
public function setLocked(bool $locked) : voidsetPixel()
public function setPixel(int $x, int $y, int $color) : boolSets an opaque pixel to the given 0xRRGGBB colour. Returns whether it changed.
takeDirtyArea()
public function takeDirtyArea() : ?arrayReturns the area changed since the last call as [x, y, width, height] and forgets it, or null if nothing changed.
toNbt()
public function toNbt() : \pocketmine\nbt\tag\CompoundTag