Json block behaviors CanAttach: Difference between revisions

From Vintage Story Wiki
(Created page with "== Purpose == Placing this behavior on a parent block causes it to accept attachments on more sides. The parent block's default behavior is used for sides that are not overridden. == Used by blocks == * drystonefence * woodenfence * roughhewnfence Fences use it to allow attachments on their top and bottom faces, which would otherwise be rejected because those faces are not solid. == Properties == ; <code>s...")
 
 
Line 1: Line 1:
== Purpose ==
== Purpose ==


Placing this [[Modding:Json_Block_Behaviors|behavior]] on a parent block causes it to accept [[Modding:Block_Attachment|attachments]] on more sides. The parent block's default behavior is used for sides that are not overridden.
This [[Modding:Json_Block_Behaviors|behavior]] can be added to parent blocks. It overrides the parent block's <code>CanAttachBlockAt</code> to accept [[Modding:Block_Attachment|attachments]] on the faces listed in the <code>sides</code> property. Unlisted sides use the parent block's default behavior.


== Used by blocks ==
== Used by blocks ==

Latest revision as of 04:18, 14 October 2023

Purpose

This behavior can be added to parent blocks. It overrides the parent block's CanAttachBlockAt to accept attachments on the faces listed in the sides property. Unlisted sides use the parent block's default behavior.

Used by blocks

  • drystonefence
  • woodenfence
  • roughhewnfence

Fences use it to allow attachments on their top and bottom faces, which would otherwise be rejected because those faces are not solid.

Properties

sides: (array of block face codes)
The faces that the parent block should accept an attachment on. This array should be a subset of [ "north", "east", "south", "west", "up", "down" ]. Faces that are not listed use the parent block's default behavior.
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