Json block behaviors pillar

From Vintage Story Wiki
Revision as of 21:04, 15 October 2023 by Bluelightning32 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Purpose

The Pillar behavior selects an orientation variant of a block when the block is placed. The behavior is used for blocks like logs with only 3 orientations. The blocks have identical end caps on opposing sides of the block, and the remaining 4 sides are the same. So the only ways to orient those blocks is to change the axis that the end caps are on.

Used by blocks

  • carvedlog
  • debarkedlog
  • hay
  • log
  • lognarrow
  • planks
  • plaster
  • quartzpillar
  • stackedbamboo
  • woodenaxle

Usage

The block's last variant group must contain the states "ud", "ns" and "we". The variant group must be last, but code of the variant group does not matter.

	variantgroups: [
        ...
		{ code:"orientation", states: ["ud", "ns", "we"] },
	],

The Pillar behavior does not affect what drops when the block is broken. The drops field on the block should be used to select one specific orientation to drop, no matter which orientation was broken. Otherwise, if the block always drops its own orientation, the block items from the different orientations will not stack in the player inventory.

    drops: [
        { type: "block", code: "quartzpillar-ud", quantity: { avg: 1 }  }
    ],

Properties

invertedPlacement (bool, default: false)
When false, the placed blocks will be oriented so that the end cap points at the selected block face. This is useful so that the end caps of logs connect together. When true, if the selected block horizontal (up/down face), then the placed block will be of the "we" or "ns" orientation, and the "ud" orientation will be used if the face is horizontal. The axle block uses inverted placement, although the axle block class first searches for any neighbor block that accepts mechanical power, and if there is one, then the class points the axle to that neighbor instead.
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