Modding:Block Json Properties: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
Line 165: Line 165:
   </tr>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_blockmaterial_info" data-tt-parent="p_blockmaterial" data-invisible="true"></div></td>
     <td scope="row">
     <td colspan="3">
  <div class="tt" data-tt-id="p_blockmaterial_soil" data-tt-parent="p_blockmaterial">Soil</div><br>
Currently only used for mining speed for tools.
  <div class="tt" data-tt-id="p_blockmaterial_gravel" data-tt-parent="p_blockmaterial">Gravel</div><br>
{{:json:block:material}}
  <div class="tt" data-tt-id="p_blockmaterial_sand" data-tt-parent="p_blockmaterial">Sand</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_wood" data-tt-parent="p_blockmaterial">Wood</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_leaves" data-tt-parent="p_blockmaterial">Leaves</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_stone" data-tt-parent="p_blockmaterial">Stone</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_liquid" data-tt-parent="p_blockmaterial">Liquid</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_snow" data-tt-parent="p_blockmaterial">Snow</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_ice" data-tt-parent="p_blockmaterial">Ice</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_metal" data-tt-parent="p_blockmaterial">Metal</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_mantle" data-tt-parent="p_blockmaterial">Mantle</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_plant" data-tt-parent="p_blockmaterial">Plant</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_glass" data-tt-parent="p_blockmaterial">Glass</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_ceramic" data-tt-parent="p_blockmaterial">Ceramic</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_cloth" data-tt-parent="p_blockmaterial">Cloth</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_lava" data-tt-parent="p_blockmaterial">Lava</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_brick" data-tt-parent="p_blockmaterial">Brick</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_fire" data-tt-parent="p_blockmaterial">Fire</div><br>
  <div class="tt" data-tt-id="p_blockmaterial_other" data-tt-parent="p_blockmaterial">Other</div>
</td>
     <td colspan="3" valign="top">
Materials are hardcoded and currently only used to determine mining speed with a specific tool.
</td>
</td>
   </tr>
   </tr>
Line 178: Line 197:
   </tr>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_matterstate_info" data-tt-parent="p_matterstate" data-invisible="true"></div></td>
     <td scope="row">
  <div class="tt" data-tt-id="p_matterstate_solid" data-tt-parent="p_matterstate">solid</div><br><br>
  <div class="tt" data-tt-id="p_matterstate_liquid" data-tt-parent="p_matterstate">liquid</div><br><br>
  <div class="tt" data-tt-id="p_matterstate_gas" data-tt-parent="p_matterstate">gas</div><br><br>
  <div class="tt" data-tt-id="p_matterstate_plasma" data-tt-parent="p_matterstate">plasma</div><br><br>
</td>
     <td colspan="3">
     <td colspan="3">
Used for special collision behavior and rendering. Currently used for:
Used for special collision behavior and rendering. Currently used for:
Line 630: Line 654:
----
----


'''Chance drop'''
'''Chance drops'''
 
Let's take a look at an example. This is the drop property of rock:
 
<syntaxhighlight lang="json">
drops: [
{
type: "item",
code: "stone-{rock}",
quantity: { avg: 2.5, var: 0.5 }
},
]
</syntaxhighlight>
 
This will drop 2-3 blocks.
 
'''''avg''''': Stands for the default drop quantity. If var is 0 or not specified it will always drop the given average.


quantity
'''''var''''': How much the drop rate can vary. Meaning the drop rate can be <code>avg - var</code> at minimum and <code>age + var</code> at maximum.


<table class="wikitable">
Futhermore you can also switch between different distribution modes using the '''''dist''''' property.
 
<table class="wikitable mw-collapsible mw-collapsed">
  <tr>
<th colspan="2">Overview - Distribution modes</th>
  </tr>
   <tr style="background-color: grey;">
   <tr style="background-color: grey;">
     <th style="background-color: grey;">Name</th>
     <th style="background-color: grey;">Name</th>
Line 680: Line 725:
   </tr>
   </tr>
</table>
</table>
   
<syntaxhighlight lang="json">
drops: [
{
type: "item",
code: "stone-{rock}",
quantity: { avg: 2.5, var: 0.5 }
},
]
</syntaxhighlight>
https://en.wikipedia.org/wiki/Gaussian_function#/media/File:Normal_Distribution_PDF.svg


----
----
Line 700: Line 732:
Of course you can also define multiple drops at once. '''Sapling''' can drop a sapling and a stick:
Of course you can also define multiple drops at once. '''Sapling''' can drop a sapling and a stick:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
drops: [
drops: [
{  
{  
Line 716: Line 748:


----
----
 
'''Last Drop'''
'''Last Drop'''


In order to add a special drop, which (if dropped) prevents all other drops, you can use the lastDrop property:
<syntaxhighlight lang="json">
dropsByType: {
dropsByType: {
"ore-quartz-*": [
"ore-quartz-*": [
Line 728: Line 763:
],
],
}
}
</syntaxhighlight>
Quartz ore will drop with a 20% chance clearquartz, if not it will drop the regular ore. If lastDrop wouldn't be true it could drop both at the same time.
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_particleproperties" data-tt-parent="root">ParticleProperties</div></td>
    <td>array of object</td>
    <td>-</td>
    <td>Particles that should spawn in regular intervals from this block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_liquidlevel" data-tt-parent="root">LiquidLevel</div></td>
    <td>0 ... 7</td>
    <td>0</td>
    <td>Value between 0...7 for Liquids to determine the height of the liquid.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_cropprops" data-tt-parent="root">CropProps</div></td>
    <td>object</td>
    <td>-</td>
    <td>Information about the block as a crop.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds" data-tt-parent="root">Sounds</div></td>
    <td>key: string, value: string</td>
    <td>-</td>
    <td>The sounds played for this block during step, break, build and walk.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds_walk" data-tt-parent="p_sounds">Walk</div></td>
    <td colspan="3">An entity walks over it.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds_inside" data-tt-parent="p_sounds">Inside</div></td>
    <td colspan="3">The player is inside the block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds_break" data-tt-parent="p_sounds">Break</div></td>
    <td colspan="3">Breaking the block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds_place" data-tt-parent="p_sounds">Place</div></td>
    <td colspan="3">Placing the block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds_hit" data-tt-parent="p_sounds">Hit</div></td>
    <td colspan="3">While mining the block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds_ambient" data-tt-parent="p_sounds">Ambient</div></td>
    <td colspan="3">Played from time to time if the player is close to it.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds_info" data-tt-parent="p_sounds" data-invisible="true"></div></td>
    <td colspan="3">
'''Anvil''':
<syntaxhighlight lang="json">
    sounds: {
        "place": "block/anvil",
        "break": "block/anvil"
    }
</syntaxhighlight>


'''Rails''':
<syntaxhighlight lang="json">
    sounds: {
        place": "block/planks",
        "walk": "walk/wood"
    }
</syntaxhighlight>


'''Water''':
<syntaxhighlight lang="json">
    sounds: {
        place: "block/water",
        inside: "walk/water",
        ambient: "environment/creek"
    },
</syntaxhighlight>
</td>
</td>
   </tr>
   </tr>
 
 
 
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Common</b></td>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Common</b></td>
   </tr>
   </tr>
    
   <tr>
    
    <td scope="row"><div class="tt" data-tt-id="p_creativeinventory" data-tt-parent="root">creativeinventory</div></td>
    <td>key: string, value: string[]</td>
    <td></td>
    <td>In which creative inventory tabs the block should be visible in.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_creativeinventory_info" data-tt-parent="p_creativeinventory" data-invisible="true"></div></td>
    <td colspan="3">
There are several tabs to you can add your stuff. Note that general should always be included, since it should contain everything.
 
*general
*terrain
*flora
*construction
*decorative
*items
 
'''Rock''' adds all of it's variantions to general, terrain and construction:
<syntaxhighlight lang="json">
creativeinventory: { "general": ["*"], "terrain": ["*"], "construction": ["*"] },
</syntaxhighlight>
 
'''<code>*</code>''' reprents the variants which will be added. You can specify multiple and separate them with a comma. It follows the same way as the '''byType''' property.
 
A '''Torch''' on the other hand only adds the variation '''<code>up</code>''':
<syntaxhighlight lang="json">
creativeinventory: { "general": ["*-up"], "decorative": ["*-up"] },
</syntaxhighlight>
</td>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_maxstacksize" data-tt-parent="root">maxstacksize</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_maxstacksize" data-tt-parent="root">maxstacksize</div></td>
     <td>number</td>
     <td>integer</td>
     <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>
   </tr>
   </tr>
   <tr>
    
    <td scope="row"><div class="tt" data-tt-id="p_creativeinventory" data-tt-parent="root">creativeinventory</div></td>
 
    <td>arrays</td>
 
    <td></td>
 
    <td>In which creative inventory tabs the block should be visible in.</td>
    
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Rendering</b></td>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Rendering</b></td>
Line 1,002: Line 1,140:
     <td></td>
     <td></td>
     <td></td>
     <td></td>
  </tr>
  <tr>
    <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Sound</b></td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_sounds" data-tt-parent="root">sounds</div></td>
    <td>key: string, value: string</td>
    <td></td>
    <td>The sounds to be played when a player interacts with this block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_place" data-tt-parent="p_sounds">place</div></td>
    <td></td>
    <td>player/build</td>
    <td>Sound to played when placing this block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_walk" data-tt-parent="p_sounds">walk</div></td>
    <td></td>
    <td>walk/default</td>
    <td>Sound to played when walking on this block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_break" data-tt-parent="p_sounds">break</div></td>
    <td></td>
    <td>player/destruct</td>
    <td>Sound to played when breaking this block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_hit" data-tt-parent="p_sounds">hit</div></td>
    <td></td>
    <td>-</td>
    <td>Currently unused.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_inside" data-tt-parent="p_sounds">inside</div></td>
    <td></td>
    <td>-</td>
    <td>Sound to played when moving inside block (only works for blocks that have no collisionbox, naturally).</td>
   </tr>
   </tr>
</table>
</table>
Confirmedusers, editor, Administrators
886

edits