Skip to main content

Vehicle

Drivable vehicles with fuel, health, stamina combat, abilities, levels, skins and a garage.

Privatev0.1Entities & models
RequiresTypeWriter0.9.0-beta-177 (BTC build)BasicBTCMobsPacketEventsGUIoptionalBetterModeloptional

Built for the BornToCraft network. This extension is documented for reference and is not distributed.

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, AMPHIBIOUS and AIR, each with its own carrier.
  • Four visuals — display (item), vanilla (mob), bettermodel and btcmobs, 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​

  1. Install the BTCMobs and Basic extensions (both are declared dependencies), plus the GUI extension for the garage menu. See BTCMobs.
  2. Install PacketEvents. Without it, steering is disabled and the log says PacketEvents not found! WASD steering will be disabled.
  3. Optionally install BetterModel to use the bettermodel visual.
  4. Put the Vehicle JAR in plugins/Typewriter/extensions/ and restart the server.

Getting started​

  1. In the TypeWriter web panel, open a static page and add a Vehicle Storage artifact.
  2. Add one Vehicle Config entry and set storage to the artifact. Without it, vehicle data is neither loaded nor saved, and the log says Aucun stockage designe.
  3. Add a Vehicle Definition: choose movement (GROUND), a visual (display with a material such as MINECART), and tune stats, fuel (add an item to allowedFuels) and combat.
  4. 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.
  5. For a garage, add a Vehicle Garage Menu built with layoutPool, then trigger Open Vehicle Garage.
  6. Add Refill Vehicle Fuel and Repair Vehicle at a gas station or garage NPC. Publish and test.
No commands

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.

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 typeBehaviour
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_SPAWNSummons the active vehicle.
vehicle_button:VEHICLE_DESPAWNStores the mounted vehicle and closes the menu.
vehicle_button:VEHICLE_INFOPrints the active vehicle's level, fuel and health in chat.
vehicle_button:NAV_BACKGoes back to the previous menu.
vehicle_button:NAV_CLOSECloses 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​

PermissionGrants
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
Events7
Facts4
Artifacts1
Manifests4

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.

  • BTCMobs — provides the btcmobs visual.
  • GUI — renders the garage menu.