ContainerMinecart 5.46.0
Extends AbstractMinecart
A minecart with an inventory (chest or hopper). Like container blocks, it can hold a loot table ("LootTable" and "LootTableSeed", e.g. the chest minecarts of mineshafts) which fills it the first time it is opened, emptied by a hopper or broken. Its contents are dropped when it is destroyed.
Constants
MAX_VIEW_DISTANCE
php
public const MAX_VIEW_DISTANCE = 8.0Players farther than this from the cart get its window closed.
TAG_CHEST_ITEMS
php
public const TAG_CHEST_ITEMS = "ChestItems"TAG_ITEMS
php
public const TAG_ITEMS = "Items"Properties
$inventory protected
php
protected \pocketmine\inventory\MinecartInventory $inventoryMethods
__construct()
php
public function __construct(\pocketmine\entity\Location $location, ?\pocketmine\nbt\tag\CompoundTag $nbt = null)entityBaseTick() protected
php
protected function entityBaseTick(int $tickDiff = 1) : boolgetDetectorRailComparatorOutput()
php
public function getDetectorRailComparatorOutput() : intgetInventory()
php
public function getInventory() : \pocketmine\inventory\MinecartInventoryReturns the inventory, filling it from its loot table first if it has one.
getInventorySize()
php
abstract public function getInventorySize() : intNumber of slots of the inventory.
getRealInventory()
php
public function getRealInventory() : \pocketmine\inventory\MinecartInventoryReturns the inventory without filling it from the loot table.
getSlowdownFactor() protected
php
protected function getSlowdownFactor(bool $inWater) : floatVanilla AbstractMinecartContainer.applyNaturalSlowdown(): carts keep 98% of their speed, +0.1% per comparator level of emptiness (an empty cart rolls the furthest).
initEntity() protected
php
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidonContentsChanged() protected
php
protected function onContentsChanged() : voidonDeath() protected
php
protected function onDeath() : voidonDispose() protected
php
protected function onDispose() : voidonInteract()
php
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : boolsaveNBT()
php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag