RegionLoader
in package
Table of Contents
- COMPRESSION_GZIP = 1
- COMPRESSION_ZLIB = 2
- FIRST_SECTOR = 2
- MAX_SECTOR_LENGTH = 255 << 12
- REGION_HEADER_LENGTH = 8192
- $COMPRESSION_LEVEL : int
- $lastUsed : int
- $filePath : string
- $filePointer : resource
- $garbageTable : RegionGarbageMap
- $locationTable : array<string|int, RegionLocationTableEntry>|array<string|int, null>
- $nextSector : int
- __destruct() : mixed
- calculateChunkCount() : int
- chunkExists() : bool
- close() : void
- Closes the file
- createNew() : self
- generateSectorMap() : string
- getFilePath() : string
- getProportionUnusedSpace() : float
- Returns a float between 0 and 1 indicating what fraction of the file is currently unused space.
- loadExisting() : self
- readChunk() : string|null
- removeChunk() : void
- writeChunk() : void
- createBlank() : void
- getChunkCoords() : void
- getChunkOffset() : int
- isChunkGenerated() : bool
- loadLocationTable() : void
- writeLocationIndex() : void
- __construct() : mixed
- bumpNextFreeSector() : void
- checkLocationTableValidity() : void
- disposeGarbageArea() : void
Constants
COMPRESSION_GZIP
public
mixed
COMPRESSION_GZIP
= 1
COMPRESSION_ZLIB
public
mixed
COMPRESSION_ZLIB
= 2
FIRST_SECTOR
public
mixed
FIRST_SECTOR
= 2
MAX_SECTOR_LENGTH
private
mixed
MAX_SECTOR_LENGTH
= 255 << 12
REGION_HEADER_LENGTH
private
mixed
REGION_HEADER_LENGTH
= 8192
Properties
$COMPRESSION_LEVEL
public
static int
$COMPRESSION_LEVEL
= 7
$lastUsed
public
int
$lastUsed
= 0
$filePath
protected
string
$filePath
$filePointer
protected
resource
$filePointer
$garbageTable
protected
RegionGarbageMap
$garbageTable
$locationTable
protected
array<string|int, RegionLocationTableEntry>|array<string|int, null>
$locationTable
= []
$nextSector
protected
int
$nextSector
= self::FIRST_SECTOR
Methods
__destruct()
public
__destruct() : mixed
Return values
mixed —calculateChunkCount()
public
calculateChunkCount() : int
Return values
int —chunkExists()
public
chunkExists(int $x, int $z) : bool
Parameters
- $x : int
- $z : int
Tags
Return values
bool —close()
Closes the file
public
close() : void
Return values
void —createNew()
public
static createNew(string $filePath) : self
Parameters
- $filePath : string
Return values
self —generateSectorMap()
public
generateSectorMap(string $usedChar, string $freeChar) : string
Parameters
- $usedChar : string
- $freeChar : string
Return values
string —getFilePath()
public
getFilePath() : string
Return values
string —getProportionUnusedSpace()
Returns a float between 0 and 1 indicating what fraction of the file is currently unused space.
public
getProportionUnusedSpace() : float
Return values
float —loadExisting()
public
static loadExisting(string $filePath) : self
Parameters
- $filePath : string
Tags
Return values
self —readChunk()
public
readChunk(int $x, int $z) : string|null
Parameters
- $x : int
- $z : int
Tags
Return values
string|null —removeChunk()
public
removeChunk(int $x, int $z) : void
Parameters
- $x : int
- $z : int
Tags
Return values
void —writeChunk()
public
writeChunk(int $x, int $z, string $chunkData) : void
Parameters
- $x : int
- $z : int
- $chunkData : string
Tags
Return values
void —createBlank()
protected
createBlank() : void
Return values
void —getChunkCoords()
protected
static getChunkCoords(int $offset, int &$x, int &$z) : void
Parameters
- $offset : int
- $x : int
-
reference parameter
- $z : int
-
reference parameter
Return values
void —getChunkOffset()
protected
static getChunkOffset(int $x, int $z) : int
Parameters
- $x : int
- $z : int
Tags
Return values
int —isChunkGenerated()
protected
isChunkGenerated(int $index) : bool
Parameters
- $index : int
Return values
bool —loadLocationTable()
protected
loadLocationTable() : void
Tags
Return values
void —writeLocationIndex()
protected
writeLocationIndex(int $index) : void
Parameters
- $index : int
Return values
void —__construct()
private
__construct(string $filePath) : mixed
Parameters
- $filePath : string
Tags
Return values
mixed —bumpNextFreeSector()
private
bumpNextFreeSector(RegionLocationTableEntry $entry) : void
Parameters
- $entry : RegionLocationTableEntry
Return values
void —checkLocationTableValidity()
private
checkLocationTableValidity() : void
Tags
Return values
void —disposeGarbageArea()
private
disposeGarbageArea(RegionLocationTableEntry $oldLocation) : void
Parameters
- $oldLocation : RegionLocationTableEntry