Modding:Block Json Properties: Difference between revisions

From Vintage Story Wiki
Line 1,264: Line 1,264:
  </tr>
  </tr>
  <tr>
  <tr>
     <td scope="row"><div class="tt" data-tt-id="p_alist_" data-tt-parent="p_attributes_contain">closeSound</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_alist_csound" data-tt-parent="p_attributes_contain">closeSound</div></td>
     <td>Path to sound</td>
     <td>Path to sound</td>
     <td>-</td>
     <td>-</td>
Line 1,359: Line 1,359:
]
]
</syntaxhighlight>
</syntaxhighlight>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_contentitemcode" data-tt-parent="p_attributes_contain">contentItemCode</div></td>
    <td>Item</td>
    <td>-</td>
    <td>The id of an item stored in a container.</td>
    <td>-</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_contentitem2block" data-tt-parent="p_attributes_contain">contentItem2BlockCode</div></td>
    <td>Item</td>
    <td>-</td>
    <td>Items that are converted into blocks when store in this container.</td>
    <td>bowl</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_cookslots" data-tt-parent="p_attributes_contain">cookingContainerSlots</div></td>
    <td>Number</td>
    <td>-</td>
    <td>The number of slots a cooking container has.</td>
    <td>crucible, pot</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_defaulttype" data-tt-parent="p_attributes_contain">defaultTyped</div></td>
    <td>String</td>
    <td>-</td>
    <td>Since containers have a unique variant form called "types" this is used to determine what the default type is.</td>
    <td>chest, storagevessel</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_langcode" data-tt-parent="p_attributes_contain">dialogTitleLangCode</div></td>
    <td>String</td>
    <td>-</td>
    <td>Gives a container tooltip a "title" in the lang file (EG "Chest Contents").</td>
    <td>chest, storagevessel</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_casable" data-tt-parent="p_attributes_contain">displaycasable</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, allows a block to be placed in a display case.</td>
    <td>crystal-small</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_eatenblock" data-tt-parent="p_attributes_contain">eatenBlock</div></td>
    <td>Block Code</td>
    <td>-</td>
    <td>Used by meal blocks to determine what block to return to when the meal has been completely eaten.</td>
    <td>bowl</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_emptyblock" data-tt-parent="p_attributes_contain">eatenBlock</div></td>
    <td>Block Code</td>
    <td>-</td>
    <td>Used by meal container blocks to determine what block to return to when the meal has been emptied from it.</td>
    <td>pot</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_fillheight" data-tt-parent="p_attributes_contain">fillHeight</div></td>
    <td>Number</td>
    <td>-</td>
    <td>Determines how high to render molten metal in a tool mold.</td>
    <td>toolmold</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_fillquads" data-tt-parent="p_attributes_contain">fillQuadsByLevel</div></td>
    <td>Array of Coordinates</td>
    <td>-</td>
    <td>Can be used to specify quadrants to render within for tool molds that have higher levels (such as the helve hammer or anvil molds).</td>
    <td>toolmold</td>
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_quad_info" data-tt-parent="p_alist_fillquads" data-invisible="true"></div></td>
<td colspan="4">
We can look at how this is done with the Anvil mold:
<syntaxhighlight lang="json">
"fillHeight": 10,
"fillQuadsByLevel": [
  { x1: 2, z1: 3, x2: 13, z2: 13 },
  { x1: 2, z1: 3, x2: 13, z2: 13 },
  { x1: 2, z1: 3, x2: 13, z2: 13 },
  { x1: 4, z1: 6, x2: 11, z2: 10 },
  { x1: 4, z1: 6, x2: 11, z2: 10 },
  { x1: 4, z1: 6, x2: 11, z2: 10 },
  { x1: 4, z1: 6, x2: 11, z2: 10 },
  { x1: 4, z1: 5, x2: 14, z2: 11 },
  { x1: 1, z1: 5, x2: 15, z2: 11 },
  { x1: 1, z1: 5, x2: 15, z2: 11 },
],
</syntaxhighlight>
As we can see, the anvil mold has 10 layers rather than one, and because it has different shapes for each layer we can redefine the space to render the molten metal per level by using two corners defined by x and z coordinates within the block. In the end, this gives a cleaner looking poured metal effect (even though it may be difficult to see what's going on in the mold).
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_handlecook" data-tt-parent="p_attributes_contain">handleCookingContainerInteract</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, can be used to take food from a cooking container.</td>
    <td>crock, pot</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_handleliquid" data-tt-parent="p_attributes_contain">handleLiquidContainerInteract</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, can be used to hold liquids.</td>
    <td>crock, pot</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_infpprops" data-tt-parent="p_attributes_contain">inFirePitProps</div></td>
  <td>-</td>
  <td>-</td>
  <td>Gives an item additional rendering properties when placed in a fire pit.</td>
  <td>crucible, pot</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_fptrans" data-tt-parent="p_alist_infpprops">transform</div></td>
  <td>-</td>
  <td>-</td>
  <td>If the model type shows the item, it can be transformed using this property.</td>
  <td>crucible, pot</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_fpmodel" data-tt-parent="p_alist_infpprops">useFirepitModel</div></td>
  <td>-</td>
  <td>-</td>
  <td>Tell the firepit which model to use when this item is placed into it.</td>
  <td>crucible, pot</td>
</tr>
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_firepittrans_ex" data-tt-parent="p_alist_infpprops" data-invisible="true"></div></td>
<td colspan="4">
Here's an example of how the firepit transformation is used by the pot and crucible:
<syntaxhighlight lang="json">
inFirePitProps: {
  transform: {
    translation: { x: 0, y: 0.125, z: 0 }
  },
  useFirepitModel: "Wide"
}
</syntaxhighlight>
If you're familiar with the other transformation code, this is nothing unusual and works on the same principles by changing the scale, position and rotation of the model with respect to the origin of rotation.
At the moment <code>wide</code> is the only model used with container items. The other option <code>spit</code> is used with cooking meat directly on the firepit.
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_inputface" data-tt-parent="p_attributes_contain">input-face</div></td>
    <td>Side ID</td>
    <td>-</td>
    <td>Used to determine what faces of the block can be used as an input for a hopper (set to "null" since it does not have an input face).</td>
    <td>hopper</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_iclassname" data-tt-parent="p_attributes_contain">inventoryClassName</div></td>
    <td>String</td>
    <td>-</td>
    <td>Used to name an inventory during the loading of inventories in the world. Use "chest" for any generic containers.</td>
    <td>chest, storagevessel</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_flowrate" data-tt-parent="p_attributes_contain">item-flowrate</div></td>
    <td>Number</td>
    <td>-</td>
    <td>Used by the chute block to determine how many items move through it per second.</td>
    <td>chute</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_liquidcontainer" data-tt-parent="p_attributes_contain">liquidcontainer</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, allows the block to hold and take liquids.</td>
    <td>bucket</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_maxstackcontain" data-tt-parent="p_attributes_contain">maxContainerSlotStackSize</div></td>
    <td>Number</td>
    <td>-</td>
    <td>Limits the stacksize of items placed into the container.</td>
    <td>pot</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_maxtemp" data-tt-parent="p_attributes_contain">maxHeatableTemp</div></td>
    <td>Number</td>
    <td>-</td>
    <td>The highest temperature that the container can be heated.</td>
    <td>pot, crucible</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_mealblock" data-tt-parent="p_attributes_contain">mealBlockCode</div></td>
    <td>Block Code</td>
    <td>-</td>
    <td>Used by meal blocks to determine which variant is used when filled with a meal.</td>
    <td>bowl</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_mealcontainer" data-tt-parent="p_attributes_contain">mealContainer</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>Allows the block to function as a meal container (can pull from meal blocks like crocks).</td>
    <td>bowl</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_opensound" data-tt-parent="p_attributes_contain">openSound</div></td>
    <td>Path to Sound</td>
    <td>-</td>
    <td>Determines what sound is played when a container is opened. Generally used in tandem with '''closeSound'''.</td>
    <td>chest, storagevessel</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_outputface" data-tt-parent="p_attributes_contain">output-face</div></td>
    <td>Direction ID</td>
    <td>-</td>
    <td>Used by the chute block to determine which face of the block is used as an output for transferring items.</td>
    <td>chute</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_pandrops" data-tt-parent="p_attributes_contain">panningDrops</div></td>
    <td>-</td>
    <td>-</td>
    <td>If a block can be used for panning (using the BlockPan class), these are its potential drops.</td>
    <td>pan</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_panning_info" data-tt-parent="p_alist_pandrops" data-invisible="true"></div></td>
  <td colspan="4">
You can add all sorts of items using the following format:
    <syntaxhighlight lang="json">
{ type: "item", code: "nugget-nativecopper",  chance: { avg: 0.15, var: 0 }  },
    </syntaxhighlight>
</tr>
<tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_render" data-tt-parent="root">(Rendering Attributes)</div></td>
<td scope="row"><div class="tt" data-tt-id="p_attributes_render" data-tt-parent="root">(Rendering Attributes)</div></td>
Line 2,094: Line 2,332:
   </tr>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_zoffset" data-tt-parent="p_vertexflags">sOffset</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_zoffset" data-tt-parent="p_vertexflags">zOffset</div></td>
     <td>boolean</td>
     <td>boolean</td>
     <td>number</td>
     <td>number</td>
     <td>-</td>
     <td>-</td>
     <td>-</td>
     <td>Used to prevent rendering conflicts when blocks are drawn at a distance (IE z-fighting).</td>
   </tr>
   </tr>
</table>
</table>
219

edits