Json block behaviors OmniAttachable
Purpose
This behavior turns the block into an attachment block that can be attached on any face. Additionally this behavior orients the attachment block to face the parent block.
Used by blocks
- crystal
- lantern
Usage
When the block is placed, the behavior will verify that the selected face on the parent block accepts the attachment. If the selected parent face rejects the attachment, then attachment block finds the first neighbor block that accepts the attachment. If all of the 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, one of the variant groups must contain all facing codes. By default that variant group uses the orientation
code, but a different code selected with the facingCode
property.
All of the states of the orientation group can be directly specified, or the abstract/verticalorientation
states can be added to the ones from the abstract/horizontalorientation
world property:
variantgroups: [
{ code:"orientation", loadFromPropertiesCombine: ["abstract/horizontalorientation", "abstract/verticalorientation"] }
],
When the block is broken, the "up" variant is dropped.
Properties
facingCode
: (variant code, default : "orientation")- The code of the variant group of the block that contains all of the facing codes.
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.
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 |