Skip to content

Vehicle

Ferdinand Calo edited this page Jul 14, 2021 · 10 revisions
# Data Overview
DataType: VEHICLE
File Ending: .vehicle
Has Own Item: yes
Has TMT Model: yes

Config location: ./assets/<packid>/config/vehicles/<here>.vehicle
Model location: net.fexcraft.mod.addon.<packid>.models.vehicle.<here> OR CUSTOM

Vehicles are one of the core features of FVTM.
Back when FVTM (or it's precedessor FVM) was started, the aim was to be
able to create an unitary "Vehicle" data compound, which could get used
across various entity systems from various Mods. FVTM was not intended to
have own entities, but sadly things didn't work out that way.
The idea isn't given up on, eventually it will be possible in the future.

By creating a Vehicle in FVTM you make something which you will be able to
spawn ingame and drive (/swim/fly/float/drive on rails/etc) around ingame.
While currently there is a LAND and WATER entity system available
an AIR system is considered and a RAIL system under rewrite!

A Vehicle can be basic - spawn it, drive around, carry cargo, or advanced.
While you may know already from the Part wiki page about Functions,
Attributes and eventually Modifiers, there are also Vehicle Scripts.
With them you can give actual new features to a vehicle or change/override
it's behaviour outside of that is available in FVTM by default.

Some examples are at FVP!


Here the overview of the Fields in a vehicle json config file:

  • RegistryName - the registryname, should be packid:vehicle_id

  • Addon - the addon the vehicle is in, e.g. fvtm:fvp

  • Name - optional name field

  • Description - can be either a string (supports line breaks \n) or string array

  • VehicleType - e.g. LAND, WATER, AIR, RAIL, default is LAND, see VehicleType.class

  • Texture - optional, one NamedResourceLocation - the vehicle's texture

  • Textures - optional array of NamedResourceLocations - the vehicle's textures

  • Category, Categories - optional, either a string with entries separated via comma
    or an json array with each entry string, currently used for Attributes as target filter.

  • PrimaryColor - optional, deprecated (use Colors instead), default primary RGB color

  • SecondaryColor - optional, deprecated (use Colors instead), default secondary RGB color

  • Colors - optional, json object with defined custom RGB color channels, this allows for as many
    color channels in a vehicle as wanted, primary and secondary will exists regardless (hardcoded)
    example: "Colors":{ "trimary": "#cdcdcd", "interior_tint": "#efcdab" }

  • RequiredParts - optional, (category) list of required parts for the vehicle to spawn

  • MaxKeys - optional, max amount of key items that can be spawned for this vehicle, default 5

  • KeyType - optional, specific Key (Material) registry name to be spawned, default gep:key

  • Attributes - the vehicle's default Attributes

  • WheelPositions - the vehicle's default wheel positions (WheelSlot),
    unless you are for sure using parts for this vehicle specifying the default positions
    you should specify them in the vehicle's config here

  • LegacyData - LegacyData compound, required for the default entity system

  • Trailer - (boolean) set to true if this is a TRAILER

  • Wagon - (boolean) alternative duplicate of Trailer

  • Model - the Model, check the wiki page on how to define it\

  • FrontConnector - optional, front connector of the vehicle, to be able to be
    coupled to another vehicle (usually used for rail vehicles only currently)
    can be added either as object (e.g. { "x": 0, "y": 0, "z": 0 } or array (e.g [ 0, 0, 0 ])
    this value can be added via installable parts instead, see Part - Connector Installation Handler

  • RearConnector - optional, rearconnector of the vehicle, to be able to be
    coupled to another vehicle (e.g. for attaching trailers to it, or for rail vehicles)
    can be added either as object (e.g. { "x": 0, "y": 0, "z": 0 } or array (e.g [ 0, 0, 0 ])
    this value can be added via installable parts instead, see Part - Connector Installation Handler

  • PreInstalled - optional, object with parts (categories) listed and the to-be-installed part
    into them once the vehicle is created, example:

    "PreInstalled":{
        "hood": "mypack:car_hood",
        "engine": "gep:diesel_engine",
        "something": "somepack:part_id"
    }

    Note: this will attempt to install the part, so if the part wouldn't install in normal
    circumstances (e.g. not marked as compatible with the vehicle) it will not install here either.

  • LiftingPoints - object, added in FVTM 3.5.45, replacement for the "constructor" attributes
    here you define the points on which the constructor center lift will 'lift' the vehicle up ingame,
    (please note this is only neccessary for LAND vehicles, rail and other vehicles work differently),
    example contents:

    • "left_front": [ 32, 2.5, 24, "left_rear" ],
    • "right_rear0": [ -202, -18, -24, "right_rear1", 2 ],

    The json entry's key will become the ID of the lifting point, the value is expected to be an array;

    • first 3 values are the position (model space / fmt marker), required
    • 4th value is the counter piece id, optional
    • 5th value is the offset, useful when using multiple lifting points on the same side
      and a lifinting point is "deeper" into the vehicle than the outmost one, optional
  • Overlay - string (id of the Steering Overlay) or object (data) to create a custom Overlay (WIP)

  • PartSlots - same content/format as "slots" array in Part - Slot Provider Function, allows to add part slots to a vehicle


This datatype creates an own Item, as such you will need to create a ItemModel JSON and supply a texture,
this is a vanilla/forge process, as such customisation and other is not matter of FVTM.
The expected path for the model will be /assets/<packid>/models/item/<vehicleid>.json
The usual path for the texture is /assets/<packid>/textures/items/<vehicleid>.png
For more info how the JSON should look, either take a look at GEP or vanilla minecraft.


This datatype OVERRIDES (unless changed in config) the default Item Rendering, as such the
vanilla JSON model may not get displayed, but instead a 3D representation if this Vehicle's Model will be.

Clone this wiki locally