Vehicle
Overview
Vehicle lets players own, summon and drive custom vehicles: cars, boats, flying mounts. You define a vehicle type once (its look, speed, health, fuel, combat and progression) and each player owns instances of it, with their own level, fuel, health, shield and skin, saved in an artifact. A player summons a vehicle from the garage menu or an action, rides it with the movement keys, and stores it back.
The vehicle is made of two parts. An invisible carrier entity carries the physics and the passenger. A visual is attached to it: a displayed item, a vanilla mob, a BetterModel model or a BTCMobs mob. You can therefore use a simple item for a cheap vehicle or an animated model for a flagship one.
Driving, fuel, damage, abilities and levelling are all exposed to TypeWriter: they fire events, expose facts, and abilities run any list of TypeWriter actions. It runs on the BTC build of TypeWriter and requires BTC Core features.
Features
- Four movement types —
GROUND,WATER,AMPHIBIOUSandAIR, each with its own carrier. - Four visuals —
display(item),vanilla(mob),bettermodelandbtcmobs, with the model resolved per player. - Fuel — a tank, a consumption rate per second, accepted fuel items, and a refuel action.
- Health and shield — hits are absorbed by the shield first; at 0 health the vehicle is destroyed and must be repaired.
- Levels and stats — a configurable XP curve and a stat bonus per level.
- Combat — left-click attack with range, cooldown and stamina cost, a charge on the held jump key, and optional collision damage.
- Abilities — activatable abilities with cooldown and stamina cost that run any TypeWriter actions.
- Garage menu — a paginated menu of the player's vehicles, built on a GUI layout.
- Ownership limit — a base limit raised by permission.
- Events and facts — collision, fuel empty, level up, attack, charge hit, destroyed and stamina depleted.
Installation
- Install the BTCMobs and Basic extensions (both are declared dependencies), plus the GUI extension for the garage menu. See BTCMobs.
- Install PacketEvents. Without it, steering is disabled and the log says
PacketEvents not found! WASD steering will be disabled. - Optionally install BetterModel to use the
bettermodelvisual. - Put the Vehicle JAR in
plugins/Typewriter/extensions/and restart the server.
Getting started
- In the TypeWriter web panel, open a static page and add a Vehicle Storage artifact.
- Add one Vehicle Config entry and set
storageto the artifact. Without it, vehicle data is neither loaded nor saved, and the log saysAucun stockage designe. - Add a Vehicle Definition: choose
movement(GROUND), avisual(displaywith a material such asMINECART), and tunestats,fuel(add an item toallowedFuels) andcombat. - Add a Spawn Vehicle action referencing the definition and trigger it from a command, an NPC or an event. The first call gives the player a new vehicle of this type, filled with fuel and health, and mounts them on it.
- For a garage, add a Vehicle Garage Menu built with
layoutPool, then trigger Open Vehicle Garage. - Add Refill Vehicle Fuel and Repair Vehicle at a gas station or garage NPC. Publish and test.
Vehicle registers no command of its own. Summon, store and repair through actions, the garage menu or TypeWriter command entries.
How it works
The carrier depends on movement: GROUND uses an armor stand moved by the server, WATER and AMPHIBIOUS use a boat, which the client simulates itself, and AIR uses a happy ghast. For boats the server does not drive: it validates every tick and moves the vehicle back when it exceeds maxSpeed, when the tank is empty, or (for GROUND) when it enters a liquid.
Steering uses the player input packets: forward, backward, left, right, jump and sneak. Dismounting stores the vehicle (it is despawned and the data saved).
A vehicle instance has a level, XP, health, shield, fuel and skin. Stats are multiplied by 1 + statBonusPerLevel * (level - 1) (not gravity). The XP needed to leave a level is baseXp * level ^ xpGrowth. At maxLevel XP stops.
Menus
Vehicle Garage Menu is built like any GUI menu: a layoutPool, a mainLayoutId, optional views and a baseMenuId to inherit a shared chassis. Place items with these button types (the buttonType of an item):
| Button type | Behaviour |
|---|---|
vehicle_button:VEHICLE_SLOT#<n> | Shows the player's n-th vehicle (sorted by instance id); a click summons it. Empty if the player owns fewer. |
vehicle_button:VEHICLE_SPAWN | Summons the active vehicle. |
vehicle_button:VEHICLE_DESPAWN | Stores the mounted vehicle and closes the menu. |
vehicle_button:VEHICLE_INFO | Prints the active vehicle's level, fuel and health in chat. |
vehicle_button:NAV_BACK | Goes back to the previous menu. |
vehicle_button:NAV_CLOSE | Closes the menu. |
vehicleDisplay sets how a vehicle slot looks: an item, a nameFormat and lore, with the tokens %name%, %level%, %max_level%, %fuel%, %max_fuel%, %health%, %max_health% and %shield%. An item you place for a button keeps its own name and lore if the page defines them.
Permissions
| Permission | Grants |
|---|---|
typewriter.vehicle.limit.<n> | Raises the ownership limit by <n> when a Vehicle Ownership Limit entry reads it (the highest value counts). |
No other permission is defined by the extension.
Placeholders
Two facts can be read as placeholders through TypeWriter: Vehicle Ownership Limit and Vehicles Owned Count, each returning a number. The extension registers no placeholder of its own.
Entries
25 entries, generated from the extension source.
Actions9
- Activate Vehicle AbilityActivate Vehicle Ability
- Add Vehicle XPAdd Vehicle XP
- Open Vehicle GarageOpen Vehicle Garage
- Refill Vehicle FuelRefill Vehicle Fuel
- Repair VehicleRepair Vehicle
- Set Vehicle SkinSet Vehicle Skin
- Spawn VehicleSpawn Vehicle
- Vehicle AttackVehicle Attack
- Vehicle ChargeVehicle Charge
Events7
- On Vehicle AttackOn Vehicle Attack
- On Vehicle Charge HitOn Vehicle Charge Hit
- On Vehicle CollisionOn Vehicle Collision
- On Vehicle DestroyedOn Vehicle Destroyed
- On Vehicle Fuel EmptyOn Vehicle Fuel Empty
- On Vehicle Level UpOn Vehicle Level Up
- On Vehicle Stamina DepleteOn Vehicle Stamina Deplete
Facts4
- Vehicle Charge Meter FactVehicle Charge Meter
- Vehicle LimitVehicle Ownership Limit
- Vehicle Owned CountVehicles Owned Count
- Vehicle Stamina FactVehicle Stamina
Artifacts1
- Vehicle StorageVehicle Storage Artifact
Manifests4
- Vehicle AbilityVehicle Ability
- Vehicle ConfigVehicle Global Configuration
- Vehicle DefinitionVehicle Definition
- Vehicle Garage MenuVehicle Garage Menu
Troubleshooting
Nothing is saved after a restart. vehicle_config has no storage, or it points to a missing artifact. The log reports Aucun stockage designe dans 'vehicle_config'. Set the artifact in storage.
The vehicle does not move with WASD. PacketEvents is missing, so steering is disabled. Install it and restart.
The vehicle snaps back or will not move. The server rolls back when the vehicle moves faster than stats.maxSpeed (blocks per tick), when fuel is 0 (and fires On Vehicle Fuel Empty), or for GROUND when it enters water or lava. Raise maxSpeed, refuel, or switch to AMPHIBIOUS.
Ce vehicule n'est pas disponible pour le moment. The visual could not be created: a model id that does not exist in BetterModel, an unknown BTCMobs mobId, or a display material that is not an item. Check the log for non spawne or visuel.
Spawning refuses with the limit message. The player already owns baseOwnershipLimit vehicles (1 by default). The limit includes permissions only if you created a Vehicle Ownership Limit entry; otherwise only baseOwnershipLimit applies.
This vehicle is destroyed — repair it before summoning it again. Health reached 0. Run Repair Vehicle: it consumes repair.amount of repair.item and restores healthPerRepair health on the active vehicle.
An ability does nothing. It must be listed in abilities of the vehicle definition and the player must be driving, have enough stamina and be off cooldown; each failure sends a message from vehicle_config.