Json block behaviors Decor

From Vintage Story Wiki

Purpose

This behavior allows the decor block to be attached to a parent block in the decor layer. Additionally this behavior may orient the decor block to face the parent block.

Used by blocks

  • linen
  • mediumcarpet
  • rushmat
  • smallcarpet
  • wallpaper
  • wool
  • hotspringbacteriasmooth
  • hotspringbacteria
  • attachingplant
  • overlay
  • oxidation
  • transition
  • fallenleaves
  • caveart (note that it is not possible to obtain caveart block in ones inventory without the `/giveblock` command. Typically caveart is directly placed as a decor by items that have the art pigment behavior).

Usage

During a block placement, the behavior first verifies that the selected face is in the sides list. Next, it selects an oriented variant of the block depending on which surface the player attempts to place the decor on. The orientation group depends on the sidedVariants and nwOrientable properties.

Next, the behavior verifies that the parent block accepts attachments (or else the decor placement is rejected). If the parent block accepts the decor, then the decor is placed on the parent block on that black face in the decor layer.

If the parent block is a block entity that implements IAcceptsDecor (the exact search order is complicated), then IAcceptsDecor.SetDecor is called on it instead of placing the decor block normally. Currently only the chiselled block entity implements IAcceptsDecor. Instead of storing the block in the decor layer, the chiselled block sets the texture of the block face to the corresponding texture from the decor block.

Note that the decor layer is distinct from the solid and fluid layers. For example, it is not possible to put both a stone and a ladder in the same position. However, a carpet and ladder can be visually in the same position, because the carpet is a decor.

Unlike stones or ladders, decors are stored with the parent block's position, not the adjacent position that the decor occupies. During tessellation, the decor is offset by one block in the direction of its attached face normal.

Decors can be broken either by breaking them directly or by breaking the parent block. In either case, if the decor is not intended to be removable, the drops property should be set on the block.

Properties

sides (list of facing codes, default: none)
The faces that the decor can potentially be placed on. In order for the decor to be placed, the selected face must be in this list, and the parent block must accept attachments.
sidedVariants (bool, default: false)
If true, then the behavior selects a variant of the block with the last code part set to the face that the block is attached to (for example "up").
nwOrientable (bool, default: false)
If true, then the behavior selects a variant of the block with the last code part set to either "we" or "ns". Note that this property can still be used by decor blocks that also attach to the vertical faces (for example mediumcarpet).
drawIfCulled (bool, default: false)
If true, then this sets DecorFlags.DrawIfCulled on the decor block type. This flag causes the decor block to get tessellated, even if the attached face of the parent block is culled (such as when the face is covered by another block). The API documentation recommends setting this flag when the decor sticks out past the block boundary.
alternateZOffset (bool, default: false)
If true, then this sets DecorFlags.AlternateZOffset on the decor block type. This flag causes the decor block to be slightly inset and offset on alternating blocks when it is rendered. This should be set for decor that stick out past the block boundary.
notFullFace (bool, default: false)
If true, then this sets DecorFlags.NotFullFace on the decor block type. This flag is currently ignored.
removable (bool, default: false)
If true, then this sets DecorFlags.Removable on the decor block type. This flag is currently ignored.
thickness (float, default: 0.03125)
The thickness of the decor block. This is used for drawing the decor block's selection box (black edge outline when the player is pointing at the decor block). Note that this property has no effect on collision tests, because decor blocks are ignored in collision tests.
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