Modding:Json Block Behaviors: Difference between revisions

From Vintage Story Wiki
(→‎All Block Behaviors: Add block behaviors from vsessentialsmod.)
(→‎All Block Behaviors: Update the survival behaviors up to HorizontalAttachable)
Line 9: Line 9:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Behavior Name !! Additional Properties !! Example Blocks !! Detail link
! Behavior Name !! Additional Properties !! Used by Blocks !! Detail link
|-
|-
| BlockEntityInteract || none || door || [[Json_block_behaviors_BlockEntityInteract| Block Entity Interact]]
| BlockEntityInteract || none || door || [[Json_block_behaviors_BlockEntityInteract| Block Entity Interact]]
|-
|-
| BreakIfFloating || none || rock || [[Json_block_behaviors_BreakIfFloating| Break if Floating]]
| BreakIfFloating || none || termitemound, crackedrock, meteorite, ore, ore, ore, rock, rottenlog || [[Json_block_behaviors_BreakIfFloating| Break if Floating]]
|-
| BreakSnowFirst || none || tallgrass, stonepath || [[Json_block_behaviors_BreakSnowFirst| Break Snow First]]
|-
| CanAttach || sides || drystonefence, woodenfence, roughhewnfence || [[Json_block_behaviors_CanAttach|Can Attach]]
|-
|-
| CanIgnite || none || torch || [[Json_block_behaviors_CanIgnite|Can Ignite]]
| CanIgnite || none || torch || [[Json_block_behaviors_CanIgnite|Can Ignite]]
Line 19: Line 23:
| CollectFrom || none || henbox || [[Json_block_behaviors_CollectFromThis|Collect From]]
| CollectFrom || none || henbox || [[Json_block_behaviors_CollectFromThis|Collect From]]
|-
|-
| Container || none || barrel, chest || [[Json_block_behaviors_Container|Container]]
| Container || none || storagevessel, stove, hopper, quern, crate, labeledchest, trunk, chest, firepit, stationarybasket || [[Json_block_behaviors_Container|Container]]
|-
|-
| Decor || sides, sidedVariants, nwOrientable, drawIfCulled, alternateZOffset, notFullFace, removable, thickness || linen, mediumcarpet, rushmat, smallcarpet, wallpaper, wool, hotspringbacteriasmooth, hotspringbacteria, attachingplant, overlay, overlay, oxidation, transition, fallenleaves, caveart
| Decor || sides, sidedVariants, nwOrientable, drawIfCulled, alternateZOffset, notFullFace, removable, thickness || linen, mediumcarpet, rushmat, smallcarpet, wallpaper, wool, hotspringbacteriasmooth, hotspringbacteria, attachingplant, overlay, overlay, oxidation, transition, fallenleaves, caveart
  || [[Json_block_behaviors_Decor|Decor]]
  || [[Json_block_behaviors_Decor|Decor]]
|-
|-
| ExchangeOnInteract || exchangeStates (string array of block states) <br> sounds (path from sounds folder) || trapdoor || [[Json_block_behaviors_ExchangeOnInteract|Exchange On Interact]]
| Door || none || door || [[Json_block_behaviors_Door|Door]]
|-
| DropNotSnowCovered || none || fern, flower || [[Json_block_behaviors_DropNotSnowCovered|Drop not Snow Covered]]
|-
| ExchangeOnInteract || exchangeStates (string array of block states) <br> sounds (path from sounds folder) <br> actionLangCode (language key from the lang file) || trapdoor || [[Json_block_behaviors_ExchangeOnInteract|Exchange On Interact]]
|-
| FiniteSpreadingLiquid || liquidCollisionSound (path from sounds folder) <br> sourceReplacementCode (block code) <br> flowingReplacementCode (block code) <br> collidesWith (other liquid) <br> spreadDelay (int, default: 150) || boilingwater, water, lava, saltwater || [[Json_block_behaviors_FiniteSpreadingLiquid| Finite Spreading Liquid]]
|-
|-
| FiniteSpreadingLiquid || liquidCollisionSound (path from sounds folder) <br> sourceReplacementCode (block code) <br> flowingReplacementCode (block code) <br> collidesWith (other liquid) <br> spreadDelay (int, default: 150) || water, lava || [[Json_block_behaviors_FiniteSpreadingLiquid| Finite Spreading Liquid]]
| Harvestable || harvestTime (float, seconds) <br> harvestedStack (BlockDropItemStack) <br> harvestingSound (path from sounds folder) <br> harvestedBlockCode (block code) || bigberrybush, saguarocactus, smallberrybush, log-resin ||[[Json_block_behaviors_Harvestable|Harvestable]]
|-
|-
| Harvestable || none || bigberrybush, smallberrybush ||[[Json_block_behaviors_Harvestable|Harvestable]]
| HeatSource || heatStrength (float) || boilingwater, lava, forge, firepit, pitkiln, coalpile, ember, fire || [[Json_block_behaviors_HeatSource|Heat Source]]
|-
|-
| HorizontalAttachable || handleDrops (bool, default: true) || painting, shelf, toolrack ||[[Json_block_behaviors_horizontalattachable|Horizontal Attachable]]
| HorizontalAttachable || handleDrops (bool, default: true) || tapestry, torchholder, mushroom, canvas, moldrack, painting, shelf, toolrack || [[Json_block_behaviors_horizontalattachable|Horizontal Attachable]]
|-
|-
| HorizontalOrientable || dropBlockFace (Compass Direction, default: "North") <br> dropBlock (block name) || bloomerybase, chest, skep || [[Json_block_behaviors_horizontalorientable|Horizontal Orientable]]
| HorizontalOrientable || dropBlockFace (Compass Direction, default: "North") <br> dropBlock (block name) || bloomerybase, chest, skep, slopetestobj, texturerotationtest || [[Json_block_behaviors_horizontalorientable|Horizontal Orientable]]
|-
|-
| HorizontalUpDownOrientable || none || - || [[Json_block_behaviors_HorizontalUpDownOrientable| Horizontal Up/Down Orientable]]
| HorizontalUpDownOrientable || none || - || [[Json_block_behaviors_HorizontalUpDownOrientable| Horizontal Up/Down Orientable]]

Revision as of 21:37, 10 October 2023

Adding behaviors to your block

Block behaviors are an array of objects with properties attached to your block. Below is an example of two behaviors, one with properties and one without properties.

  behaviors: [{name: "behavior1", properties: {myProperty1: "myValue1", myProperty2: "myValue2"}},{name: "behavior2"}],

All Block Behaviors

Here is a table containing all properties of the base game as of 1.9.

Behavior Name Additional Properties Used by Blocks Detail link
BlockEntityInteract none door Block Entity Interact
BreakIfFloating none termitemound, crackedrock, meteorite, ore, ore, ore, rock, rottenlog Break if Floating
BreakSnowFirst none tallgrass, stonepath Break Snow First
CanAttach sides drystonefence, woodenfence, roughhewnfence Can Attach
CanIgnite none torch Can Ignite
CollectFrom none henbox Collect From
Container none storagevessel, stove, hopper, quern, crate, labeledchest, trunk, chest, firepit, stationarybasket Container
Decor sides, sidedVariants, nwOrientable, drawIfCulled, alternateZOffset, notFullFace, removable, thickness linen, mediumcarpet, rushmat, smallcarpet, wallpaper, wool, hotspringbacteriasmooth, hotspringbacteria, attachingplant, overlay, overlay, oxidation, transition, fallenleaves, caveart Decor
Door none door Door
DropNotSnowCovered none fern, flower Drop not Snow Covered
ExchangeOnInteract exchangeStates (string array of block states)
sounds (path from sounds folder)
actionLangCode (language key from the lang file)
trapdoor Exchange On Interact
FiniteSpreadingLiquid liquidCollisionSound (path from sounds folder)
sourceReplacementCode (block code)
flowingReplacementCode (block code)
collidesWith (other liquid)
spreadDelay (int, default: 150)
boilingwater, water, lava, saltwater Finite Spreading Liquid
Harvestable harvestTime (float, seconds)
harvestedStack (BlockDropItemStack)
harvestingSound (path from sounds folder)
harvestedBlockCode (block code)
bigberrybush, saguarocactus, smallberrybush, log-resin Harvestable
HeatSource heatStrength (float) boilingwater, lava, forge, firepit, pitkiln, coalpile, ember, fire Heat Source
HorizontalAttachable handleDrops (bool, default: true) tapestry, torchholder, mushroom, canvas, moldrack, painting, shelf, toolrack Horizontal Attachable
HorizontalOrientable dropBlockFace (Compass Direction, default: "North")
dropBlock (block name)
bloomerybase, chest, skep, slopetestobj, texturerotationtest Horizontal Orientable
HorizontalUpDownOrientable none - Horizontal Up/Down Orientable
Ignitable none charcoalpit Ignitable
Ladder dropBlockFace (face direction, Default: north) ladder Ladder
Lockable none chest, displaycase, door, trapdoor Lockable
Multiblock sizex, sizey, sizez, type, cposition jonas, riftward, verticalboiler, banner, trunk, painting Multiblock
NoParticles none - No Particles
NWOrientable none chimney, mannequin, path North/West Orientable
OmniAttachable facingPos (int, default: 1) lantern Omni-Attachable
OmniRotatable rotateSides (bool, default: false)
facing (string)
all slabs Omni-Rotatable
Pillar none axle, log Pillar
PushEventOnBlockBroken string EventName - Push Event on Block Broken
RightClickPickup none bucket, toolmold Right Click Pickup
RopeTieable none roughhewnfence, woodenfence Rope Tieable
Slab none plankslab, cobbleslab (all slabs) Slab
SneakPlacing none crock Sneak Placing
Unplaceable none pan Unplaceable
Unstable attachedToFaces (default: down) all crops Unstable
UnstableFalling none anvil, gravel, sand Unstable Falling
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 ItemEntityBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity 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