Phpcraft
Public Member Functions | Public Attributes | List of all members
Phpcraft\World\Chunk Class Reference

Public Member Functions

 __construct (int $x=null, int $z=null)
 
 getSectionsBitMask ()
 
 getSectionAt (int $y)
 
 getSection (int $index)
 
 setSection (int $index, ChunkSection $section)
 
 flagChanged ()
 
 copy (int $x, int $z)
 
 set (int $x, int $y, int $z, ?BlockState $blockState=null)
 
 getIndexes (int $x, int $y, int $z)
 
 read (Connection $con)
 
 write (Connection $con)
 
 getHeightmap ()
 

Public Attributes

 $x
 
 $z
 
 $name
 
 $world
 

Detailed Description

Since
0.4.3
0.5 Moved from Phpcraft to Phpcraft\World namespace

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\World\Chunk::__construct ( int  $x = null,
int  $z = null 
)

Member Function Documentation

◆ copy()

Phpcraft\World\Chunk::copy ( int  $x,
int  $z 
)

◆ flagChanged()

Phpcraft\World\Chunk::flagChanged ( )

Flags the chunk as changed, e.g. for the server to re-send to clients.

Returns
void

◆ getHeightmap()

Phpcraft\World\Chunk::getHeightmap ( )

◆ getIndexes()

Phpcraft\World\Chunk::getIndexes ( int  $x,
int  $y,
int  $z 
)

◆ getSection()

Phpcraft\World\Chunk::getSection ( int  $index)

◆ getSectionAt()

Phpcraft\World\Chunk::getSectionAt ( int  $y)

◆ getSectionsBitMask()

Phpcraft\World\Chunk::getSectionsBitMask ( )

◆ read()

Phpcraft\World\Chunk::read ( Connection  $con)

Reads the chunk data after the X, Z, "Is New Chunk" and "Ignore Old Data" fields from the given Connection.

Parameters
Connection$con
Returns
void
Exceptions
IOException

◆ set()

Phpcraft\World\Chunk::set ( int  $x,
int  $y,
int  $z,
?BlockState  $blockState = null 
)

Sets the block state at the given position.

Parameters
int$xAbsolute X position of the block within the world.
int$y
int$zAbsolute Z position of the block within the world.
BlockState | null$blockState

◆ setSection()

Phpcraft\World\Chunk::setSection ( int  $index,
ChunkSection  $section 
)

◆ write()

Phpcraft\World\Chunk::write ( Connection  $con)

Writes the chunk data after the X, Z, "Is New Chunk" and "Ignore Old Data" fields to the given Connection.

Parameters
Connection$con
Returns
void

Member Data Documentation

◆ $name

string null Phpcraft\World\Chunk::$name

◆ $world

World null Phpcraft\World\Chunk::$world

◆ $x

int null Phpcraft\World\Chunk::$x

◆ $z

int null Phpcraft\World\Chunk::$z