1. Go to this page and download the library: Download tedo0627/inventoryui library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tedo0627 / inventoryui example snippets
InventoryUI::setup($this);
/** @var Player $player */
$player->setCurrentWindow(new CustomInventory($slot, $title, $length));
class SampleInventory extends CustomInventory {
public function __construct() {
parent::__construct(54, "Sample Inventory");
}
public function open(Player $player): void {
// Called when a player opens this inventory.
}
public function tick(int $tick): void {
// Called every tick when someone opens inventory.
}
public function click(Player $player, int $slot, Item $sourceItem, Item $targetItem): bool {
// It is called when a slot in the inventory is operated.
// If the return value is true, the operation is canceled.
return false;
}
public function close(Player $player): void {
// Called when the player closes the inventory.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.