Modding:Item Json Properties: Difference between revisions

From Vintage Story Wiki
Line 368: Line 368:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="5" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Common</b></td>
     <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_creativeinventory" data-tt-parent="root">creativeinventory</div></td>
    <td>key: string, value: string[]</td>
    <td>-</td>
    <td>In which creative inventory tabs the item should be visible in.</td>
    <td>Any Item</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="4">
There are several to which you can add content from your mod. Note that general should always be included, since it should contain everything.
 
*general
*terrain
*flora
*construction
*decorative
*items
 
'''Rock''' adds all of it's variations to general, terrain and construction:
<syntaxhighlight lang="json">
creativeinventory: { "general": ["*"], "terrain": ["*"], "construction": ["*"] },
</syntaxhighlight>
 
'''<code>*</code>''' represents 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.
 
However, sometimes you may only want to show a single variant of your block or item (such as one that has multiple directional variants). In this case, you can set a specific variant to show up, once again using similar syntax to the variant code.
 
For example, a '''Torch''' only adds the variation '''<code>up</code>''', since the block uses a class to determine which direction it will be placed in regardless of the variant used:
<syntaxhighlight lang="json">
creativeinventory: { "general": ["*-up"], "decorative": ["*-up"] },
</syntaxhighlight>
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_maxstacksize" data-tt-parent="root">maxstacksize</div></td>
    <td>integer</td>
    <td>64</td>
    <td>Determines the maximum amount you can stack the item in one slot.</td>
    <td> hide, nugget</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_attackpower" data-tt-parent="root">attackpower</div></td>
    <td>decimal number</td>
    <td>0.5</td>
    <td>The damage the item deals when hitting an entity.</td>
    <td>sword, spear</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_attackrange" data-tt-parent="root">attackrange</div></td>
    <td>decimal number</td>
    <td>1.5</td>
    <td>The maximum distance you can hit an entity with the item.</td>
    <td>sword, spear</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_materialdensity" data-tt-parent="root">materialdensity</div></td>
    <td>integer</td>
    <td>9999</td>
    <td>Determines on whether an object floats on liquids or not.</td>
    <td>ingot</td>
   </tr>
   </tr>
  <tr>
<tr>
     <td scope="row"><div class="tt" data-tt-id="p_materialdensity_info" data-tt-parent="p_materialdensity" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_attributes_list" data-tt-parent="root">attributes</div></td>
    <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.
 
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>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_liquidselectable" data-tt-parent="root">liquidselectable</div></td>
    <td>boolean</td>
    <td>false</td>
    <td>If the item can select a liquid while holding it in hand.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_liquidselectable_info" data-tt-parent="p_liquidselectable" data-invisible="true"></div></td>
    <td colspan="4">
Used for buckets in order to fill it with water and to place waterlily on top of water.
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_miningspeed" data-tt-parent="root">miningspeed</div></td>
    <td>key: string, value: decimal number</td>
    <td>-</td>
    <td>The mining speed for each block material.</td>
    <td>pickaxe, shovel</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_miningspeed_info" data-tt-parent="p_miningspeed" data-invisible="true"></div></td>
    <td colspan="4">
Materials types are hard-coded into blocks, and include the following types:
 
''soil, gravel, sand, wood, leaves, stone, liquid, snow, ice, metal, mantle, plant, glass, ceramic, cloth, lava, brick, fire, other''
 
An item is not limited to a single material that it can mine, so if you wanted to make a tool (such as a mattock) that could mine many materials you could do the following:
 
<syntaxhighlight lang="json">
miningspeed: {
          "dirt": 5,
          "gravel": 4,
          "ice": 7,
          "metal": 3,
          "sand": 4,
          "snow": 3,
          "stone": 6,
        }
</syntaxhighlight>
</td>
  </tr>
    <td scope="row"><div class="tt" data-tt-id="p_miningtier" data-tt-parent="root">miningtier</div></td>
    <td>integer</td>
    <td>0</td>
    <td>Determines which tier of blocks the item can break. If the block tier is above the one defined here nothing will be dropped from it when broken. Also determines the damage tier of a weapon, which is contested against armor tiers.</td>
    <td>pickaxe, sword</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>key: string, value: object</td>
     <td>-</td>
     <td>-</td>
Line 495: Line 378:
   </tr>
   </tr>
   <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 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">
     <td colspan="4">
Attributes constitute a large number of custom properties that an item can have, many of which are specific to unique items that rely on classes for their functionality. If you wish to utilize your own custom attributes generally you must have an accompanying class with the item.
Attributes constitute a large number of custom properties that an item can have, many of which are specific to unique items 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 weapon, say a mace that had additional weapon properties (used in an ItemMace class) you could define them here:
Values placed here are final and cannot be modified. For example, if you made a new type of weapon, say a mace that had additional weapon properties you could define them here:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Line 509: Line 392:


Here we have made two new attributes called "armorDamage" and "stunChance" 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 be manipulated using variant combinations if desired.  
Here we have made two new attributes called "armorDamage" and "stunChance" 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 be manipulated using variant combinations if desired.  
  </tr>
  <tr>
  <td scope="row"><div class="tt" data-tt-id="p_attributes_list" data-tt-parent="p_attributes">Attribute List</div></td>
    <td colspan="4">
A complete list of existing properties are contained here:</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 662: Line 540:
</syntaxhighlight>
</syntaxhighlight>


Here we can see that the pigment will be named "Tyrian Purple", and is made with the three RGB values we found from a wikipedia entry.  
Here we can see that the pigment will be named "Tyrian Purple", and is made with the three RGB values (found from a Wikipedia article in this case).
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_reinforcestr" data-tt-parent="p_attributes_list">reinforcementStrength</div></td>
  <td>number</td>
  <td>-</td>
  <td>Allows an item to be used by the plumb and square tool to reinforce a block. A higher value indicates more times a block must be broken before it's removed.


Example: Igneous stones = 50, Iron Ingot = 400</td>
  <td>stone, ingot</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_sentity" data-tt-parent="p_attributes_list">spearEntityCode</div></td>
  <td>Entity</td>
  <td>-</td>
  <td>Assigns an spear entity to be made when a spear is thrown.</td>
  <td>spear</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_worktemp" data-tt-parent="p_attributes_list">workableTemperature</div></td>
  <td>number</td>
  <td>-</td>
  <td>The temperature required for an item (an ingot) to be worked on an anvil. A value of 0 means it can be worked cold without heating.</td>
  <td>ingot</td>
</tr>
</tr>
  <tr>
    <td colspan="5" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Common</b></td>
  </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 item should be visible in.</td>
    <td>Any Item</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="4">
There are several to which you can add content from your mod. Note that general should always be included, since it should contain everything.
*general
*terrain
*flora
*construction
*decorative
*items
'''Rock''' adds all of it's variations to general, terrain and construction:
<syntaxhighlight lang="json">
creativeinventory: { "general": ["*"], "terrain": ["*"], "construction": ["*"] },
</syntaxhighlight>
'''<code>*</code>''' represents 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.
However, sometimes you may only want to show a single variant of your block or item (such as one that has multiple directional variants). In this case, you can set a specific variant to show up, once again using similar syntax to the variant code.
For example, a '''Torch''' only adds the variation '''<code>up</code>''', since the block uses a class to determine which direction it will be placed in regardless of the variant used:
<syntaxhighlight lang="json">
creativeinventory: { "general": ["*-up"], "decorative": ["*-up"] },
</syntaxhighlight>
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_maxstacksize" data-tt-parent="root">maxstacksize</div></td>
    <td>integer</td>
    <td>64</td>
    <td>Determines the maximum amount you can stack the item in one slot.</td>
    <td> hide, nugget</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_attackpower" data-tt-parent="root">attackpower</div></td>
    <td>decimal number</td>
    <td>0.5</td>
    <td>The damage the item deals when hitting an entity.</td>
    <td>sword, spear</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_attackrange" data-tt-parent="root">attackrange</div></td>
    <td>decimal number</td>
    <td>1.5</td>
    <td>The maximum distance you can hit an entity with the item.</td>
    <td>sword, spear</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_materialdensity" data-tt-parent="root">materialdensity</div></td>
    <td>integer</td>
    <td>9999</td>
    <td>Determines on whether an object floats on liquids or not.</td>
    <td>ingot</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_materialdensity_info" data-tt-parent="p_materialdensity" data-invisible="true"></div></td>
    <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.
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>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_liquidselectable" data-tt-parent="root">liquidselectable</div></td>
    <td>boolean</td>
    <td>false</td>
    <td>If the item can select a liquid while holding it in hand.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_liquidselectable_info" data-tt-parent="p_liquidselectable" data-invisible="true"></div></td>
    <td colspan="4">
Used for buckets in order to fill it with water and to place waterlily on top of water.
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_miningspeed" data-tt-parent="root">miningspeed</div></td>
    <td>key: string, value: decimal number</td>
    <td>-</td>
    <td>The mining speed for each block material.</td>
    <td>pickaxe, shovel</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_miningspeed_info" data-tt-parent="p_miningspeed" data-invisible="true"></div></td>
    <td colspan="4">
Materials types are hard-coded into blocks, and include the following types:
''soil, gravel, sand, wood, leaves, stone, liquid, snow, ice, metal, mantle, plant, glass, ceramic, cloth, lava, brick, fire, other''
An item is not limited to a single material that it can mine, so if you wanted to make a tool (such as a mattock) that could mine many materials you could do the following:
<syntaxhighlight lang="json">
miningspeed: {
          "dirt": 5,
          "gravel": 4,
          "ice": 7,
          "metal": 3,
          "sand": 4,
          "snow": 3,
          "stone": 6,
        }
</syntaxhighlight>
</td>
  </tr>
    <td scope="row"><div class="tt" data-tt-id="p_miningtier" data-tt-parent="root">miningtier</div></td>
    <td>integer</td>
    <td>0</td>
    <td>Determines which tier of blocks the item can break. If the block tier is above the one defined here nothing will be dropped from it when broken. Also determines the damage tier of a weapon, which is contested against armor tiers.</td>
    <td>pickaxe, sword</td>
  </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_combustibleprops" data-tt-parent="root">combustibleprops</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_combustibleprops" data-tt-parent="root">combustibleprops</div></td>
219

edits