Skip to content

MinecartTNT 5.46.0 ​

class · pocketmine\entity\vehicle\MinecartTNT · source

Extends AbstractMinecart
Implements Explosive

Minecart with TNT (vanilla minecraft:tnt_minecart). It is primed (4 second fuse) by a powered activator rail, or by a player using flint and steel or a fire charge on it; fire, lava, explosions and survival hits while it moves prime it with a short random fuse instead of breaking it. It explodes at once when hit by a burning arrow, when it crashes into a block at speed, or when it lands after falling 3 blocks or more. The explosion grows with the speed of the cart: power 3 (Bedrock) plus up to 1.5 x the speed in blocks per tick (vanilla formula).

Constants ​

BASE_EXPLOSION_POWER ​

php
public const BASE_EXPLOSION_POWER = 3.0

Explosion power of a still cart (vanilla tnt_minecart minecraft:explode power).

FALL_EXPLOSION_DISTANCE ​

php
public const FALL_EXPLOSION_DISTANCE = 3.0

Minimum fall distance that makes the cart explode when it lands.

FUSE_TICKS ​

php
public const FUSE_TICKS = 80

Fuse when primed, in ticks (vanilla tnt_minecart fuse_length 4 seconds).

SPEED_SQUARED_THRESHOLD ​

php
public const SPEED_SQUARED_THRESHOLD = 0.01

Minimum horizontal speed squared for a crash or a hit to set the cart off.

TAG_FUSE ​

php
public const TAG_FUSE = "Fuse"

Properties ​

$fuse protected ​

php
protected int $fuse

Methods ​

breakCart() ​

php
public function breakCart(bool $drops) : void

Broken by a survival hit while moving fast, or by fire or an explosion, the cart is primed with a short random fuse instead (vanilla MinecartTNT.destroy()).

explode() ​

php
public function explode() : void

explodeWithSpeed() ​

php
public function explodeWithSpeed(float $speedSquared) : void

Explodes with the power given by the speed (squared, in blocks per tick) and removes the cart.

getCartDrops() ​

php
public function getCartDrops() : array

getFuse() ​

php
public function getFuse() : int

Ticks left before the explosion, or -1 if the cart isn't primed.

getMinecartType() ​

php
public function getMinecartType() : \pocketmine\entity\vehicle\MinecartType

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

hasExploded() ​

php
public function hasExploded() : bool

initEntity() protected ​

php
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : void

isPrimed() ​

php
public function isPrimed() : bool

onActivatorRail() protected ​

php
protected function onActivatorRail(bool $powered) : void

onDamaged() protected ​

php
protected function onDamaged(\pocketmine\event\entity\EntityDamageEvent $source) : bool

onHitGround() protected ​

php
protected function onHitGround() : ?float

onInteract() ​

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

prime() ​

php
public function prime(int $fuse = self::FUSE_TICKS) : void

Primes the cart with the given fuse. Does nothing if it already is primed.

saveNBT() ​

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

shouldSourceDestroy() protected ​

php
protected function shouldSourceDestroy(\pocketmine\event\entity\EntityDamageEvent $source) : bool

syncNetworkData() protected ​

php
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void

tickMinecart() protected ​

php
protected function tickMinecart() : void

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