Modding:HorizontalOrientable behavior

From Vintage Story Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Purpose

The behavior selects an orientation variant of a block when the block is placed. Only 4 orientations are supported: north, east, south, and west, hence why it is called HorizontalOrientable.

Similar block behaviors:

WrenchOrientable
Allows the variant to be changed after the block is placed
OmniRotatable
Supports more orientation types. Using the rotateH: "true" property, it can support the horizontal orientation type, just like HorizontalOrientable. However, OmniRotatable requires the variant code to be named "rot" instead of HorizontalOrientable's variant code of "horizontalorientation" or "side". Also OmniRotatable allows changing the drop chance instead of the dropped block.

Used by blocks

  • agedwallpaperplanks
  • altar
  • bellows
  • bloomerybase
  • brake
  • cage
  • churn
  • clayoven
  • clutch
  • cokeovendoor
  • condenser
  • crank
  • creativerotor
  • helvehammerbase
  • jonas
  • labeledchest - the HorizontalOrientable behavior is redundant for this block. The BlockLabeledChest block class inherits from BlockGenericTypedContainer, which also handles rotation. The regular chest block only uses BlockGenericTypedContainer for its rotation.
  • metalpartpile
  • palisadestakes
  • palisadewall
  • pulverizerframe
  • resonator
  • skep
  • slantedroofing
  • slantedroofingcornerinner
  • slantedroofingcornerouter
  • statictranslocator
  • stationarybasket
  • stonecoffinsection
  • stove
  • trunk
  • verticalboiler
  • wagonwheels
  • windmillrotor
  • workbench

Usage

The block must have a variant code of "horizontalorientation" or "side". It is a mistake to add both variant codes to the block, but in this situation, the behavior will use the "horizontalorientation" code. The variant code must contain the 4 cardinal directions. They can be directly specified via the states field, but the cleaner way is to load them from the abstract/horizontalorientation world property:

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

One of the dropBlockFace or dropBlock properties must be used to specify which item is dropped when the block is broken.

Properties

dropBlockFace: (compassdirection, default: "north")
Specifies which variant is dropped when the block is broken. The value is used as a variant value for the orientation variant code.
dropBlock: (optional)
Specifies which block to drop. The value is a full item code. Only one of the dropBlock and dropBlockFace properties should be specified.
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.