Json block behaviors Unstable: Difference between revisions

From Vintage Story Wiki
(Created page with "== Purpose == Block can only be placed on a solid block and destroyed once the ground is removed. Used for: * Ore blasting bomb * Small carpet * Path * Turnip * Spelt * Soybe...")
 
No edit summary
Line 1: Line 1:
== Purpose ==
== Purpose ==
This [[Modding:Json_Block_Behaviors|behavior]] turns the block into an [[Modding:Block_Attachment|attachment block]] that can be attached to any face listed in the <code>attachedToFaces</code> property. If the parent block is later changed such that it rejects the attachment, instead of immediately breaking the attachment block, it searches for another neighbor to attach to instead. The block is broken if none of the neighbors accept the attachment.


Block can only be placed on a solid block and destroyed once the ground is removed. Used for:
== Used by blocks ==
* Ore blasting bomb
* bunchocandles
* Small carpet
* crop
* Path
* deadcrop
* Turnip
* firepit
* Spelt
* oreblastingbomb
* Soybean
* silvertorchcactus
* Rye
* verticalboiler
* Rice
* wildbeehive
* Parsnip
* woodenpath
* Onion
* woodenrails
* Flax
* Carrot


== Properties ==
== Properties ==
<code> attachedToFaces (default: down) </code> The faces that this block can be attached to.  
; <code>attachedToFaces</code>&colon; (array of face codes, default &colon; ["down"])
: The code of the variant group of the block that contains all of the facing codes.
; <code>attachmentAreas</code>&colon; (facing code -> RotatableCube)
: The attachment area (part of the parent block that should be solid) for each face that the block can attach to. This field is optional. If a face is missing, then a null attachment area will be given to the parent block. Most parent blocks ignore the attachment area when deciding whether to accept an attachment.


{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}

Revision as of 09:12, 14 October 2023

Purpose

This behavior turns the block into an attachment block that can be attached to any face listed in the attachedToFaces property. If the parent block is later changed such that it rejects the attachment, instead of immediately breaking the attachment block, it searches for another neighbor to attach to instead. The block is broken if none of the neighbors accept the attachment.

Used by blocks

  • bunchocandles
  • crop
  • deadcrop
  • firepit
  • oreblastingbomb
  • silvertorchcactus
  • verticalboiler
  • wildbeehive
  • woodenpath
  • woodenrails

Properties

attachedToFaces: (array of face codes, default : ["down"])
The code of the variant group of the block that contains all of the facing codes.
attachmentAreas: (facing code -> RotatableCube)
The attachment area (part of the parent block that should be solid) for each face that the block can attach to. This field is optional. If a face is missing, then a null attachment area will be given to the parent block. Most parent blocks ignore the attachment area when deciding whether to accept an attachment.
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