Modding:Json Block Behaviors: Difference between revisions

From Vintage Story Wiki
m
(Created page with "{| class="wikitable" |- ! Behavior Name !! Additional Properties !! Detail link |- | HorizontalAttachable || handleDrops (bool, default: true) || Json_block_behaviors_horizo...")
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== 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.
<syntaxhighlight lang="json">
  behaviors: [{name: "behavior1", properties: {myProperty1: "myValue1", myProperty2: "myValue2"}},{name: "behavior2"}],
</syntaxhighlight>
== All Block Behaviors ==
Here is a table containing all properties of the base game as of 1.9.
{| class="wikitable"
{| class="wikitable"
|-
|-
! Behavior Name !! Additional Properties !! Detail link
! Behavior Name !! Additional Properties !! Example Blocks !! Detail link
|-
|-
| HorizontalAttachable || handleDrops (bool, default: true) || [[Json_block_behaviors_horizontalattachable|Horizontal Attachable]]
| BreakIfFloating || none || rock || [[Json_block_behaviors_BreakIfFloating| Break if Floating]]
|-
|-
| HorizontalOrientable || dropBlockFace (Compass Direction, default: "North") <br> dropBlock (block name) || [[Json_block_behaviors_horizontalorientable|Horizontal Orientable]]
| CanIgnite || none || torch || [[Json_block_behaviors_CanIgnite|Can Ignite]]
|-
|-
| NWOrientable || none || [[Json_block_behaviors_NWOrientable|North/West Orientable]]
| CollectFrom || none || henbox || [[Json_block_behaviors_CollectFromThis|Collect From]]
|-
|-
| Pillar || none || [[Json_block_behaviors_pillar|Pillar]]
| Container || none || barrel, chest || [[Json_block_behaviors_Container|Container]]
|-
|-
| Slab || none || [[Json_block_behaviors_slab|Slab]]
| ExchangeOnInteract || exchangeStates (string array of block states) <br> sounds (path from sounds folder) || trapdoor || [[Json_block_behaviors_ExchangeOnInteract|Exchange On Interact]]
|-
|-
| HorizontalUpDownOrientable || none || [[Json_block_behaviors_HorizontalUpDownOrientable| Horizontal Up/Down Orientable]]
| 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]]
|-
|-
| FiniteSpreadingLiquid || liquidCollisionSound (path from sounds folder) <br> sourceReplacementCode (block code) <br> flowingReplacementCode (block code) <br> collidesWith (other liquid) <br> spreadDelay (int, default: 150) || [[Json_block_behaviors_FiniteSpreadingLiquid| Finite Spreading Liquid]]
| Harvestable || none || bigberrybush, smallberrybush ||[[Json_block_behaviors_Harvestable|Harvestable]]
|-
|-
| OmniAttachable || facingPos (int, default: 1)|| [[Json_block_behaviors_OmniAttachable|Omni-Attachable]]
| HorizontalAttachable || handleDrops (bool, default: true) || painting, shelf, toolrack ||[[Json_block_behaviors_horizontalattachable|Horizontal Attachable]]
|-
|-
| Unplaceable || none || [[Json_block_behaviors_Unplaceable|Unplaceable]]
| HorizontalOrientable || dropBlockFace (Compass Direction, default: "North") <br> dropBlock (block name) || bloomerybase, chest, skep || [[Json_block_behaviors_horizontalorientable|Horizontal Orientable]]
|-
|-
| Unstable || attachedToFaces (default: down) || [[Json_block_behaviors_Unstable|Unstable]]
| HorizontalUpDownOrientable || none || - || [[Json_block_behaviors_HorizontalUpDownOrientable| Horizontal Up/Down Orientable]]
|-
|-
| Harvestable || none || [[Json_block_behaviors_Harvestable|Harvestable]]
| Ignitable || none || charcoalpit || [[Json_block_behaviors_ignitable|Ignitable]]
|-
|-
| NoParticles || none || [[Json_block_behaviors_NoParticles|No Particles]]
| Ladder || dropBlockFace (face direction, Default: north)|| ladder || [[Json_block_behaviors_Ladder|Ladder]]
|-
|-
| Container || none || [[Json_block_behaviors_Container|Container]]
| Lockable|| none || chest, displaycase, door, trapdoor|| [[Json_block_behaviors_Lockable|Lockable]]
|-
|-
| Ignitable || none || [[Json_block_behaviors_ignitable|Ignitable]]
| NoParticles || none || - || [[Json_block_behaviors_NoParticles|No Particles]]
|-
|-
| UnstableFalling || none || [[Json_block_behaviors_Unstable_Falling| Unstable Falling]]
| NWOrientable || none || chimney, mannequin, path || [[Json_block_behaviors_NWOrientable|North/West Orientable]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| OmniAttachable || facingPos (int, default: 1)|| lantern || [[Json_block_behaviors_OmniAttachable|Omni-Attachable]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| OmniRotatable || rotateSides (bool, default: false) <br> facing (string) || all slabs || [[Json_block_behaviors_OmniRotatable|Omni-Rotatable]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| Pillar || none || axle, log || [[Json_block_behaviors_pillar|Pillar]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| PushEventOnBlockBroken || string EventName || - ||[[Json_block_behaviors_PushEventOnBlockBroken|Push Event on Block Broken]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| RightClickPickup || none || bucket, toolmold ||  [[Json_block_behaviors_RightClickPickup|Right Click Pickup]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| Slab || none || plankslab, cobbleslab (all slabs) || [[Json_block_behaviors_slab|Slab]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| SneakPlacing || none || crock ||[[Json_block_behaviors_SneakPlacing|Sneak Placing]]
|-
|-
| Example || Example || [[Json_block_behaviors_
| Unplaceable || none || pan || [[Json_block_behaviors_Unplaceable|Unplaceable]]
|-
| Unstable || attachedToFaces (default: down) || all crops || [[Json_block_behaviors_Unstable|Unstable]]
|-
| UnstableFalling || none || anvil, gravel, sand || [[Json_block_behaviors_UnstableFalling| Unstable Falling]]
|}
|}
{{Navbox/modding|Vintage Story}}
Confirmedusers, Bureaucrats, editor, Administrators
1,522

edits