Modding:Block Entity Behaviors

From Vintage Story Wiki
Revision as of 04:54, 27 July 2024 by Bluelightning32 (talk | contribs) (Better description of how to add a block entity behavior)

Using block Entity Behaviors

Block entity behaviors are an expanded type of behavior that block entities can utilize. At the moment, these are mostly used by mechanical power blocks. If you're looking for regular block behaviors (which are used differently) they can be found here.

The block entity behaviors are added to the entityBehaviors array of the block json file at the top level (same level as code). Some behaviors accept a properties dictionary. The properties dictionary is optional for the majority of behaviors that have no properties. If the block does not set the entityclass field, then adding any block entities will cause it to default to "generic", thus transforming the block type into a block entity. Example:

{
  code: "lightningrod",
  ...
  entityBehaviors: [
    {
      "name": "AttractsLightning",
      "properties": {
        "artificialElevation": 5,
        "elevationAttractivenessMultiplier": 2
      }
    }
  ],
  ...
}

Most block entity behavior classes can be viewed at the Vintage Story Github here for those looking to learn more about each.

All Block Entity Behaviors

Here is a table containing all classes used by blocks as of version 1.9.+

Class Name Example Blocks Description Github Link
Animatable brake, clutch - Animatable Block Entity Behavior Class
MPAngledGears angledgears - Angled Gears Block Entity Behavior Class
MPAxle axle - Axle Block Entity Behavior Class
MPBase - A generic mechanical power class that's used by most other behaviors. Otherwise this is not generally used in JSONS. Base Block Entity Behavior Class
MPBrake brake - Brake Block Entity Behavior Class
Combinable - - Combinable Entity Behavior Class
MPConsumer quern - Consumer Block Entity Behavior Class
MPToggle toggle - Block Toggle Entity Behavior Class
MPTransmission transmission - Transmission Block Entity Behavior Class
MPWindmillRotor windmillrotor - Windmill Block Entity Behavior Class
Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityEntity BehaviorsBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsCollectible BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository