Modding:HorizontalOrientable behavior: Difference between revisions
No edit summary |
VinterNacht (talk | contribs) (→Usage) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Purpose == | == Purpose == | ||
The [[Modding:Json_Block_Behaviors|behavior]] selects an [[Modding:Block_Orientation|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: | ||
* | ; [[Json_block_behaviors_WrenchOrientable|WrenchOrientable]] : Allows the variant to be changed after the block is placed | ||
* | ; [[Json_block_behaviors_OmniRotatable|OmniRotatable]] : Supports more orientation types. Using the <code>rotateH: "true"</code> 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 <code>BlockLabeledChest</code> block class inherits from <code>BlockGenericTypedContainer</code>, which also handles rotation. The regular chest block only uses <code>BlockGenericTypedContainer</code> 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 <code>states</code> field, but the cleaner way is to load them from the <code>abstract/horizontalorientation</code> [[Json:block:worldvariantgroups|world property]]: | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
variantgroups: [ | variantgroups: [ | ||
Line 15: | Line 50: | ||
], | ], | ||
</syntaxhighlight> | </syntaxhighlight> | ||
One of the <code>dropBlockFace</code> or <code>drop</code> properties must be used to specify which item is dropped when the block is broken. | |||
== Properties == | == Properties == | ||
<code>dropBlockFace</code>: | ; <code>dropBlockFace</code>: (compassdirection, default: "north") | ||
<code> | : Specifies which variant is dropped when the block is broken. The value is used as a variant value for the orientation variant code. | ||
; <code>drop</code>: (optional) | |||
: Specifies which block or item to drop. The value is a full item code. | |||
{{Navbox/modding|Vintage Story}} | Only one of the <code>drop</code> and <code>dropBlockFace</code> properties should be specified. This can be implemented using the following format. <syntaxhighlight lang="json"> | ||
"behaviors": [ | |||
{"name": "HorizontalOrientable", | |||
"properties": { | |||
"drop": { "type": "item", "code": "game:firewood"} | |||
} | |||
} | |||
], | |||
</syntaxhighlight>{{Navbox/modding|Vintage Story}} |
Latest revision as of 22:52, 26 July 2024
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 fromBlockGenericTypedContainer
, which also handles rotation. The regular chest block only usesBlockGenericTypedContainer
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 drop
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.
drop
: (optional)- Specifies which block or item to drop. The value is a full item code.
Only one of the drop
and dropBlockFace
properties should be specified. This can be implemented using the following format.
"behaviors": [
{"name": "HorizontalOrientable",
"properties": {
"drop": { "type": "item", "code": "game:firewood"}
}
}
],
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 | Item • Entity • Entity Behaviors • Block • Block Behaviors • Block Classes • Block Entities • Block Entity Behaviors • Collectible Behaviors • World properties |
Workflows & Infrastructure | Modding Efficiency Tips • Mod-engine compatibility • Mod Extensibility • VS Engine |
Additional Resources | Community Resources • Modding API Updates • Programming Languages • List of server commands • List of client commands • Client startup parameters • Server startup parameters Example Mods • API Docs • GitHub Repository |