Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Phpcraft\Packet\MapData\MapDataPacket Class Reference
Inheritance diagram for Phpcraft\Packet\MapData\MapDataPacket:
Inheritance graph
[legend]
Collaboration diagram for Phpcraft\Packet\MapData\MapDataPacket:
Collaboration graph
[legend]

Public Member Functions

 send (Connection $con)
 
 __toString ()
 

Static Public Member Functions

static read (Connection $con)
 
static getColorId (array $rgb)
 

Public Attributes

 $mapId = 0
 
 $scale = 0
 
 $markers = []
 
 $x = 0
 
 $z = 0
 
 $width = 0
 
 $height = 0
 
 $contents = []
 

Static Public Attributes

static $color_ids
 
static $color_id_map_from_legacy
 
static $color_id_map_to_legacy
 

Detailed Description

The packet sent to clients to update a map's contents and/or its markers.

Member Function Documentation

◆ __toString()

Phpcraft\Packet\MapData\MapDataPacket::__toString ( )

Reimplemented from Phpcraft\Packet\Packet.

◆ getColorId()

static Phpcraft\Packet\MapData\MapDataPacket::getColorId ( array  $rgb)
static

Gets the color ID closest to the given RGB array (3 integers).

Parameters
array{int,int,int}$rgb
Returns
int

◆ read()

static Phpcraft\Packet\MapData\MapDataPacket::read ( Connection  $con)
static

Initialises the packet class by reading its payload from the given Connection.

Parameters
Connection$con
Returns
MapDataPacket
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

◆ send()

Phpcraft\Packet\MapData\MapDataPacket::send ( Connection  $con)

Adds the packet's ID and payload to the Connection's write buffer and sends it over the wire if the connection has a stream. Note that in some cases this will produce multiple Minecraft packets, therefore you should only use this on connections without a stream if you know what you're doing.

Parameters
Connection$con
Returns
void
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

Member Data Documentation

◆ $color_id_map_from_legacy

array< int, int > Phpcraft\Packet\MapData\MapDataPacket::$color_id_map_from_legacy
static

◆ $color_id_map_to_legacy

array< int, int > Phpcraft\Packet\MapData\MapDataPacket::$color_id_map_to_legacy
static

◆ $color_ids

array< int, array{int, int, int}> Phpcraft\Packet\MapData\MapDataPacket::$color_ids
static

◆ $contents

array< int > Phpcraft\Packet\MapData\MapDataPacket::$contents = []

The contents of the map. This should have $width * $height elements.

See also
MapDataPacket::getColorId

◆ $height

int Phpcraft\Packet\MapData\MapDataPacket::$height = 0

The height of the updated area.

◆ $mapId

int Phpcraft\Packet\MapData\MapDataPacket::$mapId = 0

The map ID. See https://minecraft.gamepedia.com/Map#Item_data for the NBT data the map needs.

◆ $markers

array< MapMarker > Phpcraft\Packet\MapData\MapDataPacket::$markers = []

A MapMarkers array of markers on the map.

◆ $scale

int Phpcraft\Packet\MapData\MapDataPacket::$scale = 0

The scale of the map from a from 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel). This is only shown when hovering over the map item, and doesn't effect rendering of the map when held.

◆ $width

int Phpcraft\Packet\MapData\MapDataPacket::$width = 0

The width of the updated area.

◆ $x

int Phpcraft\Packet\MapData\MapDataPacket::$x = 0

The x coordinate on the map at which the content update starts.

◆ $z

int Phpcraft\Packet\MapData\MapDataPacket::$z = 0

The z coordinate on the map at which the content update starts.