Modding:Item Json Properties: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
Line 23: Line 23:
     <td>string</td>
     <td>string</td>
     <td>required</td>
     <td>required</td>
     <td>A unique identifier for the block.</td>
     <td>A unique identifier for the item.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 40: Line 40:
     <td>boolean</td>
     <td>boolean</td>
     <td>true</td>
     <td>true</td>
     <td>If the block will be loaded or not. Can be used to temporarily remove the block.</td>
     <td>If the item will be loaded or not. Can be used to temporarily remove the item.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 46: Line 46:
     <td>array of object</td>
     <td>array of object</td>
     <td>-</td>
     <td>-</td>
     <td>Allows you define multiple variants of the same block.</td>
     <td>Allows you define multiple variants of the same item.</td>
   </tr>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_variantgroups_info" data-tt-parent="p_variantgroups" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_variantgroups_info" data-tt-parent="p_variantgroups" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
The variantgroups property allows you to define multiple variants of this block. All of them will have their unique pattern, which will be added to the block code.
The variantgroups property allows you to define multiple variants of this item. All of them will have their unique pattern, which will be added to the item code.


An easy example would be a bowl, which can either be raw or burned:
An easy example would be a bowl, which can either be raw or burned:
Line 60: Line 60:
</syntaxhighlight>
</syntaxhighlight>


Meaning there will be two blocks <code>bowl-raw</code> and <code>bowl-burned</code>.
Meaning there will be two variants <code>bowl-raw</code> and <code>bowl-burned</code>.


----
----
Line 77: Line 77:
----
----


Additionally it is possible to refer to external lists that are found in the worldproperties folder, such as <code>block/rock</code>, which contains all states of all rock types. This used for <code>gravel</code>, <code>sand</code> and <code>rock</code>. It's a good way to keep everything organized:
Additionally it is possible to refer to external lists (used for blocks) that are found in the worldproperties folder, such as <code>block/rock</code>, which contains all states of all rock types. This used for <code>gravel</code>, <code>sand</code> and <code>rock</code>. It's a good way to keep everything organized:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
variantgroups: [
variantgroups: [
Line 121: Line 121:
     <td>key: string; value: object</td>
     <td>key: string; value: object</td>
     <td>-</td>
     <td>-</td>
     <td>You can create properties for certain variants of the block.</td>
     <td>You can create properties for certain variants of the item.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 145: Line 145:
</syntaxhighlight>
</syntaxhighlight>


The char '''<code>*</code>''' stands for anything. In this case it ignores the code of the block.
The char '''<code>*</code>''' stands for anything. In this case it ignores the code of the item.


Furthermore this opens up even more possbilities for more advanced selectors like this one for doors:
Furthermore this opens up even more possbilities for more advanced selectors like this one for doors:
Line 180: Line 180:
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Specific</b></td>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Specific</b></td>
   </tr>
   </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_class" data-tt-parent="root">Class</div></td>
    <td>string</td>
    <td>&quot;item&quot;</td>
    <td>The item class can add special functionalities for the item.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_class_info" data-tt-parent="p_class" data-invisible="true"></div></td>
    <td colspan="3">
It can be used to open guis or adding other extra functionality to the item. A complete tutorial of how to add your own class to the game can be found [[Advanced Items|here]].
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_durability" data-tt-parent="root">Durability</div></td>
    <td>integer</td>
    <td>0</td>
    <td>How many uses does this item has when being used. Item disappears at durability 0.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_damagedby" data-tt-parent="root">DamagedBy</div></td>
    <td>array of string</td>
    <td>-</td>
    <td>From which damage sources does the item takes durability damage.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_damagedby_blockbreaking" data-tt-parent="p_damagedby">BlockBreaking</div></td>
    <td></td>
    <td>0</td>
    <td>Mining a block.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_damagedby_attacking" data-tt-parent="p_damagedby">Attacking</div></td>
    <td></td>
    <td>1</td>
    <td>Hitting an entity.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_damagedby_fire" data-tt-parent="p_damagedby">Fire</div></td>
    <td></td>
    <td>2</td>
    <td>Currently not used.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool" data-tt-parent="root">Tool</div></td>
    <td>string</td>
    <td>-</td>
    <td>If set, this item will be classified as given tool.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_knife" data-tt-parent="p_tool">Knife</div></td>
    <td></td>
    <td>0</td>
    <td>USed to break grass.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_pickaxe" data-tt-parent="p_tool">Pickaxe</div></td>
    <td></td>
    <td>1</td>
    <td>Can mine rock and other stone materials</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_axe" data-tt-parent="p_tool">Axe</div></td>
    <td></td>
    <td>2</td>
    <td>Useful for chopping trees.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_sword" data-tt-parent="p_tool">Sword</div></td>
    <td></td>
    <td>3</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_shovel" data-tt-parent="p_tool">Shovel</div></td>
    <td></td>
    <td>4</td>
    <td>Mines dirt, sand and gravel really fast.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_hammer" data-tt-parent="p_tool">Hammer</div></td>
    <td></td>
    <td>5</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_mallet" data-tt-parent="p_tool">Mallet</div></td>
    <td></td>
    <td>6</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_spear" data-tt-parent="p_tool">Spear</div></td>
    <td></td>
    <td>7</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_bow" data-tt-parent="p_tool">Bow</div></td>
    <td></td>
    <td>8</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_sickle" data-tt-parent="p_tool">Sickle</div></td>
    <td></td>
    <td>9</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_hoe" data-tt-parent="p_tool">Hoe</div></td>
    <td></td>
    <td>10</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tool_saw" data-tt-parent="p_tool">Saw</div></td>
    <td></td>
    <td>11</td>
    <td>No special abilities yet.</td>
  </tr>
  <tr>
    <td colspan="4" 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>
  </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>
    <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>
  </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 deals when hitting an entity.</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.</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>
  </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="3">
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.
</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="3">
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 material.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_miningspeed" data-tt-parent="root">MiningTier</div></td>
    <td>integer</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>
  </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>Custom Attributes that's always assiociated with this item.</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="3">
Extra attributes added to a item or block. Those are final and cannot be modified. It's a good way to keep things oragnized 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": { type: "Int", value: 4 },
        "blastType": { type: "Int", value: 0 },
    },
</syntaxhighlight>
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_combustibleprops" data-tt-parent="root">CombustibleProps</div></td>
    <td>object</td>
    <td>-</td>
    <td>Information about the items burnable states.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_burntemperature" data-tt-parent="p_combustibleprops">BurnTemperature</div></td>
    <td>integer</td>
    <td>-</td>
    <td>The temperature at which it burns.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_burnduration" data-tt-parent="p_combustibleprops">BurnDuration</div></td>
    <td>decimal number</td>
    <td>-</td>
    <td>For how long it burns.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_heatresistance" data-tt-parent="p_combustibleprops">HeatResistance</div></td>
    <td>integer</td>
    <td>500</td>
    <td>How many degrees celsius it can resists before it ignites.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_meltingpoint" data-tt-parent="p_combustibleprops">MeltingPoint</div></td>
    <td>integer</td>
    <td>-</td>
    <td>How many degrees celsius it takes to smelt/transform this into another. Only used when put in a stove and Melted is set.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_meltingduration" data-tt-parent="p_combustibleprops">MeltingDuration</div></td>
    <td>decimal number</td>
    <td>-</td>
    <td>For how many seconds the temperature has to be above the melting point until the item is smelted.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_smokelevel" data-tt-parent="p_combustibleprops">SmokeLevel</div></td>
    <td>decimal number</td>
    <td>1</td>
    <td>How much smoke this item produces when being used as fuel.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_smeltedratio" data-tt-parent="p_combustibleprops">SmeltedRatio</div></td>
    <td>integer</td>
    <td>1</td>
    <td>How many ores are required to produce one output stack.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_liquidlevel" data-tt-parent="p_combustibleprops">SmeltedStack</div></td>
    <td>object</td>
    <td>-</td>
    <td>If set, the block/item is smeltable in a furnace and this is the resulting itemstack once the MeltingPoint has been reached for the supplied duration.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_requirescontainer" data-tt-parent="p_combustibleprops">RequiresContainer</div></td>
    <td>boolean</td>
    <td>true</td>
    <td>If set, the block/item is smeltable in a furnace and this is the resulting itemstack once the MeltingPoint has been reached for the supplied duration.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_combustibleprops_info" data-tt-parent="p_combustibleprops" data-invisible="true"></div></td>
    <td colspan="3">
This property can be used to define a burning material. '''Plank''' for example can get on fire:
<syntaxhighlight lang="json">
    combustibleProps: {
        burnTemperature: 800,
        burnDuration: 12,
    },
</syntaxhighlight>
 
Futhermore it can be used to define smelting processes. An example would be an '''ingotmold''' which turns into an ingotmold-burned:
<syntaxhighlight lang="json">
    combustiblePropsByType: {
        "ingotmold-raw": {
            meltingPoint: 600,
            meltingDuration: 30,
            smeltedRatio: 1,
            smeltedStack: { type: "block", code: "ingotmold-burned" },
            requiresContainer: false
        }
    },
</syntaxhighlight>
</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_nutritionprops" data-tt-parent="root">NutritionProps</div></td>
    <td>object</td>
    <td>-</td>
    <td>Information about the items nutrients.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_nutritionprops_foodcategory" data-tt-parent="p_nutritionprops">FoodCategory</div></td>
    <td>string</td>
    <td>-</td>
    <td>Defines the type of food. It can be '''''fruit''''', '''''vegetable''''', '''''protein''''', '''''grain''''' and '''''dairy'''''.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_nutritionprops_saturation" data-tt-parent="p_nutritionprops">Saturation</div></td>
    <td>decimal number</td>
    <td>0</td>
    <td>How much saturation it can restore.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_nutritionprops_health" data-tt-parent="p_nutritionprops">Health</div></td>
    <td>decimal number</td>
    <td>0</td>
    <td>How much health it can restore.</td>
  </tr>
  <tr>
    <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Rendering</b></td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_textures" data-tt-parent="root">Textures</div></td>
    <td>string</td>
    <td>required</td>
    <td>The texture definitions for the item held in hand or dropped on the ground.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_shape" data-tt-parent="root">Shape</div></td>
    <td>object</td>
    <td>-</td>
    <td>The items shape. Empty for automatic shape based on the texture.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_guitransform" data-tt-parent="root">GuiTransform</div></td>
    <td>object</td>
    <td>item default</td>
    <td>Used for scaling, rotation or offseting the item when rendered in guis.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_fphandtransform" data-tt-parent="root">FpHandTransform</div></td>
    <td>object</td>
    <td>item default</td>
    <td>Used for scaling, rotation or offseting the item when rendered in the first person mode hand.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_tphandtransform" data-tt-parent="root">TpHandTransform</div></td>
    <td>object</td>
    <td>item default</td>
    <td>Used for scaling, rotation or offseting the item when rendered in the third person mode hand.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_groundtransform" data-tt-parent="root">GroundTransform</div></td>
    <td>object</td>
    <td>item default</td>
    <td>Used for scaling, rotation or offseting the rendered as a dropped item on the ground.</td>
  </tr>
  </table>
  </table>
Confirmedusers, editor, Administrators
886

edits