Modding:Block Json Properties: Difference between revisions

From Vintage Story Wiki
Line 991: Line 991:
     <td>-</td>
     <td>-</td>
     <td>In which creative inventory tabs the block should be visible in.</td>
     <td>In which creative inventory tabs the block should be visible in.</td>
    <td>all blocks</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,022: Line 1,023:
     <td>64</td>
     <td>64</td>
     <td>Determines the maximum amount you can stack the block in one slot.</td>
     <td>Determines the maximum amount you can stack the block in one slot.</td>
    <td>-</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,028: Line 1,030:
     <td>0.5</td>
     <td>0.5</td>
     <td>The damage the deals when hitting an entity.</td>
     <td>The damage the deals when hitting an entity.</td>
    <td>-</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,034: Line 1,037:
     <td>1.5</td>
     <td>1.5</td>
     <td>The maximum distance you can hit an entity.</td>
     <td>The maximum distance you can hit an entity.</td>
    <td>-</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,040: Line 1,044:
     <td>9999</td>
     <td>9999</td>
     <td>Determines on whether an object floats on liquids or not.</td>
     <td>Determines on whether an object floats on liquids or not.</td>
    <td>hay, planks, lava, water</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,045: Line 1,050:
     <td colspan="4">
     <td colspan="4">
Water has a density of 1000, meaning everything below or equal will float on water. The same goes for lava which has a density of 5000.
Water has a density of 1000, meaning everything below or equal will float on water. The same goes for lava which has a density of 5000.
Vintage story uses real world densities for each material (where 1000 = 1 g/cm^3). To give an idea of the current range of densities, gold has a density of 19300, iron's is 7870, and a feather is 20.
</td>
</td>
   </tr>
   </tr>
Line 1,052: Line 1,059:
     <td>false</td>
     <td>false</td>
     <td>If the block can select a liquid while holding it in hand.</td>
     <td>If the block can select a liquid while holding it in hand.</td>
    <td>bucket</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,063: Line 1,071:
     <td>key: string, value: decimal number</td>
     <td>key: string, value: decimal number</td>
     <td>-</td>
     <td>-</td>
     <td>The mining speed for each material.</td>
     <td>The mining speed for each material. Not to be confused with ''resistance'', which determines how long it takes to mine the block.</td>
    <td>-</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,070: Line 1,079:
     <td>0</td>
     <td>0</td>
     <td>Determines which blocks it can break. If the required miningtier is above the defined one there will be no drop from it.</td>
     <td>Determines which blocks it can break. If the required miningtier is above the defined one there will be no drop from it.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_attributes" data-tt-parent="root">attributes</div></td>
    <td>key: string, value: object</td>
     <td>-</td>
     <td>-</td>
    <td>Custom Attributes associated with this block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes" data-invisible="true"></div></td>
    <td colspan="4">
Extra attributes added to a block. Those are final and cannot be modified. It's a good way to keep things organized and and modifiable. The '''oreblastingbomb''' for example has attributes, which define its radius and type. These can be used by behaviors and blockentities:
<syntaxhighlight lang="json">
    attributes: {
"blastRadius": 4,
"blastType": 0,
},
</syntaxhighlight>
</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,198: Line 1,190:
     <td>How much health it can restore.</td>
     <td>How much health it can restore.</td>
   </tr>
   </tr>
<tr>
    <td colspan="5" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Attributes</b></td>
  </tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_attributes_list" data-tt-parent="root">attributes</div></td>
    <td>-</td>
    <td>-</td>
    <td>Custom Attributes associated with this item.</td>
    <td>barrel, chest, pot, skep</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes_list" data-invisible="true"></div></td>
    <td colspan="4">
Attributes constitute a large number of custom properties that an block can have, many of which are specific to unique blocks that rely on a C# class for additional functionality. If you wish to add your own JSON attributes to an item generally you must also have a class to utilize them.
Values placed here are final and cannot be modified. For example, if you made a new type of block, say one that damages people when they get close you could define them here:
<syntaxhighlight lang="json">
    attributes: {
"touchDamage": 0.1,
"sneakAvoidTouchDamage": true,
},
</syntaxhighlight>
Here we have made two new attributes called "touchDamage" and "sneakAvoidTouchDamage" and have given them their own static values to be used in code. As is, these cannot do anything without the usage of C# code in a class. Regardless, we can see that this is a convenient way to create extra properties that can easily be used by other blocks that use the same class.
  </tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_contain" data-tt-parent="root">(Container Attributes)</div></td>
<td colspan="4">
Attributes that define additional container information.
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_render" data-tt-parent="root">(Rendering Attributes)</div></td>
<td colspan="4">
Attributes that define additional rendering information.
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_misc" data-tt-parent="root">(Misc Attributes)</div></td>
<td colspan="4">
Miscellaneous, unsorted attributes.
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_unstableplace" data-tt-parent="p_attributes_misc">allowUnstablePlacement</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If the block has the "unstable" behavior, this allows it to be generated in positions that it can fall from.</td>
    <td>sand, gravel</td>
  </tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_bradius" data-tt-parent="p_attributes_misc">blastRadius</div></td>
    <td>number</td>
    <td>-</td>
    <td>Used by bombs to determine the radius of the blast.</td>
    <td>oreblastingbomb</td>
  </tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_btype" data-tt-parent="p_attributes_misc">blastType</div></td>
    <td>number, 0, 1 or 2</td>
    <td>-</td>
    <td>Used by bombs to determine what type of blocks are broken.</td>
    <td>oreblastingbomb</td>
  </tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_btype_info" data-tt-parent="p_alist_btype" data-invisible="true"></div></td>
<td colspan="4">
''0 = Destroys ores, 1 = Destroys stone, 2 = Damages only entities.''
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_canchisel" data-tt-parent="p_attributes_misc">canChisel</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, allows the block to be chiseled.</td>
    <td>rock, all slabs</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_" data-tt-parent="p_attributes_misc">ATTRIBUTE</div></td>
    <td>-</td>
    <td>-</td>
    <td>If true, allows a block to move sideways when it falls.</td>
    <td>gravel</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_fromcbox" data-tt-parent="p_attributes_misc">chiselShapeFromCollisionBox</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, uses the collision box as the starting point for chiseling.</td>
    <td>most stairs, all slabs</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_convertfrom" data-tt-parent="p_attributes_misc">convertFrom</div></td>
    <td>block</td>
    <td>-</td>
    <td>If a block converts to another block, this is the block that can be converted.</td>
    <td>carcass</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_convertto" data-tt-parent="p_attributes_misc">convertTo</div></td>
    <td>block</td>
    <td>-</td>
    <td>If a block converts to another block, this is the block that it will turn into.</td>
    <td>carcass</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_delaysunlight" data-tt-parent="p_attributes_misc">delayGrowthBelowSunlight</div></td>
    <td>number</td>
    <td>-</td>
    <td>Used by the farmland block to delay growth when sunlight is below the given value.</td>
    <td>farmland</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_tooldrop" data-tt-parent="p_attributes_misc">drop</div></td>
    <td>-</td>
    <td>-</td>
    <td>Used by the toolMold block to determine what item it drops, not to be confused with the '''drops''' property.</td>
    <td>toolMold</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_drops" data-tt-parent="p_attributes_misc">drops</div></td>
    <td>-</td>
    <td>-</td>
    <td>Determines what drops from a block.</td>
    <td>all crops, ore-graded, skep</td>
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes" data-invisible="true"></div></td>
<td colspan="4">
A great example of variable drops is any crop, especially flax:
<syntaxhighlight lang="json">
dropsByType: {
  "*-9": [
    { type: "item", code: "seeds-flax", quantity: { avg: 1.05 }  },
    { type: "item", code: "grain-flax", quantity: { avg: 1.5, var: 0.5 }  },
    { type: "item", code: "flaxfibers", quantity: { avg: 2, var: 1 }  },
  ],
  "*": [
    { type: "item", code: "seeds-flax", quantity: { avg: 0.7 }  },
  ]
},
</syntaxhighlight>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_fencecon" data-tt-parent="p_attributes_misc">fenceConnect</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>Can be used to prevent a solid block from connecting to fences.</td>
    <td>-</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_growthblock" data-tt-parent="p_attributes_misc">growthBlockLayer</div></td>
    <td>-</td>
    <td>-</td>
    <td>Determines what layers of a block will grow grass, currently only uses "l1soilwithgrass", which grows grass on the first layer only.</td>
    <td>soil</td>
</tr>
   <tr>
   <tr>
     <td colspan="5" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Rendering</b></td>
     <td colspan="5" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Rendering</b></td>
   </tr>
   </tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_glightlevel" data-tt-parent="p_attributes_misc">growthLightLevel</div></td>
    <td>-</td>
    <td>-</td>
    <td>Used by the soil block to determine what light level is required for it to grow grass on.</td>
    <td>soil</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_gamehours" data-tt-parent="p_attributes_misc">inGameHours</div></td>
    <td>number</td>
    <td>-</td>
    <td>If a block converts to another block, this is the amount of time required for it to convert.</td>
    <td>carcass</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_injurerad" data-tt-parent="p_attributes_misc">injureRadius</div></td>
    <td>number</td>
    <td>-</td>
    <td>Used by bombs to determine the radius that it will cause injury to entities.</td>
    <td>oreblastingbomb</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_lossplevel" data-tt-parent="p_attributes_misc">lossPerLevel</div></td>
    <td>-</td>
    <td>-</td>
    <td>Used in combination with '''delayGrowthBelowSunlight''' to determine how much growth progression is lost per light level.</td>
    <td>farmland</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_mechpower" data-tt-parent="p_attributes_misc">mechanicalPower</div></td>
    <td>-</td>
    <td>-</td>
    <td>Used by the angled gear block to determine how to render gears in the different orientations.</td>
    <td>angledgears</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_downvariant" data-tt-parent="p_attributes_misc">noDownVariant</div></td>
    <td>-</td>
    <td>-</td>
    <td>When giving a block variants based off the orientation library, this can be used to prevent a "down" variant from being used.</td>
    <td>-</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_blockbelow" data-tt-parent="p_attributes_misc">placeBelowBlockCode</div></td>
    <td>block</td>
    <td>-</td>
    <td>Used by the '''BlockSoilDeposit''' class to place specific blocks beneath it during world generation.</td>
    <td>clay, peat</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_preventdecay" data-tt-parent="p_attributes_misc">preventsDecay</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, prevents nearby leaves from "decaying", IE disappearing.</td>
    <td>log, soil</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_rotateint" data-tt-parent="p_attributes_misc">rotatableInterval</div></td>
    <td>string</td>
    <td>-</td>
    <td>Gives some blocks additional rotation properties when placed. (currently "22.5degnot45deg" is the only option.</td>
    <td>chest</td>
</tr>
<tr>
    <td scope="row"><div class="tt" data-tt-id="p_alist_grasspread" data-tt-parent="p_attributes_misc">spreadGrass</div></td>
    <td>boolean</td>
    <td>-</td>
    <td>If true, can spread grass to other soil blocks.</td>
    <td>-</td>
</tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_textures" data-tt-parent="root">textures</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_textures" data-tt-parent="root">textures</div></td>
219

edits