Json block behaviors horizontalattachable

From Vintage Story Wiki

Purpose

This behavior turns the block into an attachment block that can only be attached horizontally. Additionally this behavior orients the attachment block to face the parent block.

Used by blocks

  • tapestry
  • torchholder
  • mushroom
  • canvas
  • moldrack
  • painting
  • shelf
  • toolrack

Usage

When the block is placed, the behavior will verify that the horizontal selected face on the parent block accepts the attachment. If the selected parent face is not horizontal, or it rejects the attachment, then attachment block finds the first horizontal neighbor block that accepts the attachment. If all of the horizontal neighbors reject the attachment, then placing the attachment block is rejected.

If the parent block changes such that it no longer accepts the attachment, then the attachment block is broken.

If the block passes the attachment checks, then it is oriented to the parent. In order to do so, the last variant group (the code does not matter) must contain the horizontal facing codes. They may be specified directly through the states field, but the cleaner way is to load them from the abstract/horizontalorientation world property:

	variantgroups: [
		{ code:"side", loadFromProperties: "abstract/horizontalorientation" }
	],

When the block is broken, and the handleDrops property is true, then the behavior will pick a specific block to drop. The dropBlockFace property can be given to specify the dropped block as an oriented variant of the attachment block. Or the dropBlock property can be given to specify the entire block code.

Properties

handleDrops: (bool, default: true)
Whether this block behavior should override which block is dropped when the block is broken.
dropBlockFace: (horizontal facing code)
The orientation of the dropped block. More precisely, this is a value replaces the value of the last variant group of the broken block.
dropBlock: (block code)
The dropped block as an entire block code.
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.
attachmentArea: (Cuboidi)
The property exists, but it does not work. It sets the "up" face of the attachmentAreas, and the "up face is unused by HorizontalAttachable.
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