Skip to content

ContainerMinecart 5.46.0 ​

abstract class · pocketmine\entity\vehicle\ContainerMinecart · source

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.0

Players 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 $inventory

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Location $location, ?\pocketmine\nbt\tag\CompoundTag $nbt = null)

entityBaseTick() protected ​

php
protected function entityBaseTick(int $tickDiff = 1) : bool

getDetectorRailComparatorOutput() ​

php
public function getDetectorRailComparatorOutput() : int

getInventory() ​

php
public function getInventory() : \pocketmine\inventory\MinecartInventory

Returns the inventory, filling it from its loot table first if it has one.

getInventorySize() ​

php
abstract public function getInventorySize() : int

Number of slots of the inventory.

getRealInventory() ​

php
public function getRealInventory() : \pocketmine\inventory\MinecartInventory

Returns the inventory without filling it from the loot table.

getSlowdownFactor() protected ​

php
protected function getSlowdownFactor(bool $inWater) : float

Vanilla 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) : void

onContentsChanged() protected ​

php
protected function onContentsChanged() : void

onDeath() protected ​

php
protected function onDeath() : void

onDispose() protected ​

php
protected function onDispose() : void

onInteract() ​

php
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : bool

saveNBT() ​

php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.