Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Phpcraft\AssetsManager Class Reference

Public Member Functions

 __construct (string $index_url)
 
 doesAssetExist (string $name)
 
 getAssetIndex ()
 
 downloadAllAssets ()
 
 downloadAsset (string $name)
 
 buildLegacyAssetsFolder ()
 

Static Public Member Functions

static latest ()
 
static fromMinecraftVersion (string $version)
 

Public Attributes

 $index_url
 

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\AssetsManager::__construct ( string  $index_url)
Parameters
string$index_urlThe URL to the asset index.

Member Function Documentation

◆ buildLegacyAssetsFolder()

Phpcraft\AssetsManager::buildLegacyAssetsFolder ( )

Builds the legacy assets folder for versions before 1.7.2.

Returns
void

◆ doesAssetExist()

Phpcraft\AssetsManager::doesAssetExist ( string  $name)
Parameters
string$name
Returns
bool

◆ downloadAllAssets()

Phpcraft\AssetsManager::downloadAllAssets ( )

Downloads all assets.

Returns
void

◆ downloadAsset()

Phpcraft\AssetsManager::downloadAsset ( string  $name)

Downloads an asset by name and returns the path to the downloaded file or null if the asset doesn't exist.

Parameters
string$name
Returns
string|null

◆ fromMinecraftVersion()

static Phpcraft\AssetsManager::fromMinecraftVersion ( string  $version)
static

Returns an AssetsManager using the given Minecraft version's asset index.

Parameters
string$versionThe Minecraft version you'd like to access the assets of.
Returns
AssetsManager
Exceptions
Exceptionif the version manifest for the given version couldn't be fetched.

◆ getAssetIndex()

Phpcraft\AssetsManager::getAssetIndex ( )

Returns the JSON-decoded content of the asset index of the version.

Returns
array

◆ latest()

static Phpcraft\AssetsManager::latest ( )
static

Returns an AssetsManager using the latest supported Minecraft version's asset index.

Returns
AssetsManager
Exceptions
Exceptionif the version manifest couldn't be fetched.

Member Data Documentation

◆ $index_url

Phpcraft\AssetsManager::$index_url