Json block behaviors OmniRotatable: Difference between revisions

From Vintage Story Wiki
→‎Usage: adjust terms
(Move some of content into a new Usage section. Add a Used by blocks section.)
(→‎Usage: adjust terms)
Line 16: Line 16:


== Usage ==
== Usage ==
There are several meaningful ways to define a group of orientation variants for a block. Each orientation group type has different variant group requirements and different properties for the OmniRotatable behavior. Where possible, the examples below use [[Json:block:worldvariantgroups|world properties]] to assist in defining the variant states, but this is optional; the states may be directly listed instead.
There are several meaningful ways to define a group of orientation variants for a block. Each orientation type has different variant code requirements and different properties for the OmniRotatable behavior. Where possible, the examples below use [[Json:block:worldvariantgroups|world properties]] to assist in defining the variant states, but this is optional; the states may be directly listed instead.
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: rgba(0,0,0,0.2);">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: rgba(0,0,0,0.2);">Orientation group type</th>
     <th style="background-color: rgba(0,0,0,0.2);">Orientation type</th>
     <th style="background-color: rgba(0,0,0,0.2);">Required variant groups</th>
     <th style="background-color: rgba(0,0,0,0.2);">Required variant codes</th>
     <th style="background-color: rgba(0,0,0,0.2);">Example block</th>
     <th style="background-color: rgba(0,0,0,0.2);">Example block</th>
     <th style="background-color: rgba(0,0,0,0.2);">Example variant group definition</th>
     <th style="background-color: rgba(0,0,0,0.2);">Example variant definition</th>
     <th style="background-color: rgba(0,0,0,0.2);">Required behavior properties</th>
     <th style="background-color: rgba(0,0,0,0.2);">Required behavior properties</th>
   </tr>
   </tr>
   <tr>
   <tr>
     <td>Face 6 directions</td>
     <td>HV Vector</td>
     <td>
     <td>
* <code>rot</code> variant group with the states "north", "east", "south", "west", "up", and "down"
* <code>rot</code> variant code with the states "north", "east", "south", "west", "up", and "down"
     </td>
     </td>
     <td>slab</td>
     <td>slab</td>
Line 35: Line 35:
   </tr>
   </tr>
   <tr>
   <tr>
     <td>Face up/down</td>
     <td>Vertical</td>
     <td>
     <td>
* <code>rot</code> variant group with the states "up" and "down"
* <code>rot</code> variant code with the states "up" and "down"
     </td>
     </td>
     <td>none</td>
     <td>none</td>
Line 44: Line 44:
   </tr>
   </tr>
   <tr>
   <tr>
     <td>Face horizontally</td>
     <td>Horizontal</td>
     <td>
     <td>
* <code>rot</code> variant group with the states "north", "east", "south", and "west"
* <code>rot</code> variant code with the states "north", "east", "south", and "west"
     </td>
     </td>
     <td>none</td>
     <td>none</td>
Line 53: Line 53:
   </tr>
   </tr>
   <tr>
   <tr>
     <td>Face horizontally and flip vertically</td>
     <td>Horizontal Vertical</td>
     <td>
     <td>
* <code>rot</code> variant group with the states "north", "east", "south", and "west"
* <code>rot</code> variant code with the states "north", "east", "south", and "west"
* <code>v</code> variant group with the states "up" and "down"
* <code>v</code> variant code with the states "up" and "down"
     </td>
     </td>
     <td>none</td>
     <td>none</td>
Line 63: Line 63:
   </tr>
   </tr>
   <tr>
   <tr>
     <td>Face 6 directions and rotate along axis</td>
     <td>3 Axis</td>
     <td>
     <td>
* <code>rot</code> variant group with the states "north", "east", "south", and "west"
* <code>rot</code> variant code with the states "north", "east", "south", and "west"
* <code>v</code> variant group with the states "up", "down", "left", and "right"
* <code>v</code> variant code with the states "up", "down", "left", and "right"
     </td>
     </td>
     <td>trapdoor</td>
     <td>trapdoor</td>
Line 74: Line 74:
</table>
</table>


Additionally, the behavior adds a placement mode to items. The behavior shows the placement mode when the item is hovered over in the inventory or hotbar. The placement modes are auto, horizontal, and vertical. Auto is the default. The horizontal and vertical modes only work correctly for face 6 directions blocks.
Additionally, the behavior adds a placement mode to items. The behavior shows the placement mode when the item is hovered over in the inventory or hotbar. The placement modes are auto, horizontal, and vertical. Auto is the default. The horizontal and vertical modes only work correctly for the HV vector type.


The behavior changes the placement mode when it detects that the block was created through crafting, and the first item in the recipe was an orientable block. So to allow changing the placement mode, add a 1x1 recipe that takes the block as input and produces it as output. The placement mode changes in the following cycle: auto to horizontal, horizontal to vertical, and vertical to auto.
The behavior changes the placement mode when it detects that the block was created through crafting, and the first item in the recipe was an orientable block. So to allow changing the placement mode, add a 1x1 recipe that takes the block as input and produces it as output. The placement mode changes in the following cycle: auto to horizontal, horizontal to vertical, and vertical to auto.
Confirmedusers
343

edits