MinecartTNT 5.46.0
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
public const BASE_EXPLOSION_POWER = 3.0Explosion power of a still cart (vanilla tnt_minecart minecraft:explode power).
FALL_EXPLOSION_DISTANCE
public const FALL_EXPLOSION_DISTANCE = 3.0Minimum fall distance that makes the cart explode when it lands.
FUSE_TICKS
public const FUSE_TICKS = 80Fuse when primed, in ticks (vanilla tnt_minecart fuse_length 4 seconds).
SPEED_SQUARED_THRESHOLD
public const SPEED_SQUARED_THRESHOLD = 0.01Minimum horizontal speed squared for a crash or a hit to set the cart off.
TAG_FUSE
public const TAG_FUSE = "Fuse"Properties
$fuse protected
protected int $fuseMethods
breakCart()
public function breakCart(bool $drops) : voidBroken 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()
public function explode() : voidexplodeWithSpeed()
public function explodeWithSpeed(float $speedSquared) : voidExplodes with the power given by the speed (squared, in blocks per tick) and removes the cart.
getCartDrops()
public function getCartDrops() : arraygetFuse()
public function getFuse() : intTicks left before the explosion, or -1 if the cart isn't primed.
getMinecartType()
public function getMinecartType() : \pocketmine\entity\vehicle\MinecartTypegetName()
public function getName() : stringgetNetworkTypeId()
public static function getNetworkTypeId() : stringhasExploded()
public function hasExploded() : boolinitEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidisPrimed()
public function isPrimed() : boolonActivatorRail() protected
protected function onActivatorRail(bool $powered) : voidonDamaged() protected
protected function onDamaged(\pocketmine\event\entity\EntityDamageEvent $source) : boolonHitGround() protected
protected function onHitGround() : ?floatonInteract()
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : boolprime()
public function prime(int $fuse = self::FUSE_TICKS) : voidPrimes the cart with the given fuse. Does nothing if it already is primed.
saveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagshouldSourceDestroy() protected
protected function shouldSourceDestroy(\pocketmine\event\entity\EntityDamageEvent $source) : boolsyncNetworkData() protected
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : voidtickMinecart() protected
protected function tickMinecart() : void