SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Back to NxLabs

NxLabs / Vintage Story

Piles!

PBy Pursec

A modding library for adding coal-style piles simply and easily

Piles!

Description

<h4 style="text-align: center;">This a modding library/tool for adding custom piles in the style of coal and charcoal from Vanilla entirely through external content mods.&nbsp;</h4> <hr /> <h3 style="text-align: center;"><br /><span style="text-decoration: line-through;">By default piles for Rot, Salt, and All types of vanilla Grain and included.&nbsp;<br /></span><strong><span style="color: #d35400;">These piles have now been extracted out to their own mod.<br />Check out: <a href="https://mods.vintagestory.at/granary"><span style="color: #3598db;">Granary</span></a></span></strong><span style="text-decoration: line-through;"><br /></span></h3> <hr /> <p style="text-align: center;">This library adds the following relevant classes:<strong>&nbsp;<code><span style="color: #e67e23;">BlockPile</span>, <span style="color: #e67e23;">BlockEntityPile</span>, &amp; <span style="color: #e67e23;">BehaviorPileItem</span></code></strong><br /><br />To add your own pile with this mod installed it is as follows:</p> <hr /> <ol> <li>Create a new content mod with a blocktype file for each of the piles you wish to create (if they are variant piles such as grain, you only need 1 with variant groups)</li> <li>Each of these blocktypes assign them the <strong><em>class</em></strong> <span style="color: #e74c3c;"><em>BlockPile</em></span> and <strong><em>entityclass</em></strong> <em><span style="color: #e74c3c;">BlockEntityPile</span></em></li> <li>(<span style="color: #2fcc71;"><strong>Optional</strong></span>) add an attributes section to the block type to specify parameters of that pile. Any not-specified attribute will be given a default value. If the attributes array is not presnt at all, all values will be default.<br /><br />The attributes are as follows:<br /><em><br /><span style="color: #34495e;"><code>"attributes":<br />{<br />&nbsp; &nbsp;"addItemLabel" : "String" or "LangKey",<br />&nbsp; &nbsp;"removeItemLabel": "String" or "LangKey",<br />&nbsp; &nbsp;"defaultAddQuantity": Integer (default: 2),<br />&nbsp; &nbsp;"defaultTakeQuantity": Integer (default: 2),<br />&nbsp; &nbsp;"bulkTakeQuantity": Integer (default: 4),<br />&nbsp; &nbsp;"maxStackSize": Integer (default: 16),<br />&nbsp; &nbsp;"interactSoundPath" : "domain:pathToSound",<br />&nbsp; &nbsp;"allowUnstablePlacement": true/false (default: false)<br />}</code></span></em></li> <li>&nbsp;Assign a texture to the blockPile you created just as you would a vanilla block. <ol> <li>The piles support assignment by face if desired (such as defining a different texture for "up"/the top face and a seperate texture for the sides. If wanting the same texture for all sides use the vanilla <strong><em><span style="color: #e67e23;">"all"</span></em></strong> key for the textures field</li> </ol> </li> <li>Create a patch adding/appending<span style="color: #e74c3c;"><em> BehaviorPileItem</em></span> to the item you wish to pileable, with a properties array pointing to the corresponding code of the newly created blocktype. <ol> <li>If using variants such as for example "grain" they may be defined as "grain-flax" or generically "grain-{type}", in which case you can specify the code of the pile blocktype created as "grainPile-{type}" and make sure that the blocktype for "grainPile" as the corresponding variantgroups array to have different piles per type of grain with only one blocktype file.</li> <li>For specifying those variant textures simply point the texture-path to the location and use the variant group {type} as you would with normal variant texturing<br /><br />The source code and example implementation from the default piles can be found at: <a href="https://github.com/Pursec/PilesPilesPiles" target="_blank" rel="noopener">https://github.com/Pursec/PilesPilesPiles</a><br /><br /><hr /></li> </ol> </li> </ol> <pre class="language-csharp"><code>Example of a patch file for grain supporting variantgroups:

[
    {
        "file": "game:itemtypes/food/grain",
         "op": "add",
         "path": "/behaviors",
         "value": [
                          {
                              "name": "BehaviorPileItem",
                              "properties": { "pileBlockCode": "gespiles:grainPile-{type}"}
                          }
                      ]
   }
]

<hr /> <pre class="language-csharp"><code>Example of grainPile.json

{
  "code": "grainPile",
  "class": "BlockPile",
  "entityClass": "BlockEntityPile",
  "variantgroups": [
    {
      "code": "type",
      "states": [ "spelt", "rice", "flax", "rye", "amaranth", "sunflower" ]
    }
  ],
  "creativeinventory": {
    "general": [ "" ],
    "decorative": [ "" ]
  },
  "behaviors": [
    { "name": "UnstableFalling" }
  ],
  "attributes": {
    "addItemLabel": "Add Grain",
    "removeItemLabel": "Remove Grain",
    "allowUnstablePlacement": true
  },
  "blockmaterial": "Soil",
  "lightAbsorption": 0,
  "sidesolid": { "all": false },
  "sideopaque": { "all": false },
  "textures": {
    "all": { "base": "game:block/food/grain/{type}" }
  },
  "replaceable": 100,
  "resistance": 2,
  "collisionbox": {
    "x1": 0,
    "y1": 0,
    "x2": 1,
    "y2": 0,
    "z2": 1
  },
  "selectionbox": {
    "x1": 0,
    "y1": 0,
    "x2": 1,
    "y2": 0,
    "z2": 1
  },
  "drops": [],
  "materialDensity": 600
}

<h3><br /><br />If you wish to support me do so at:<br /><a title="Ko-fi" href="https://ko-fi.com/honkiestofgeese" target="_blank" rel="noopener">Ko-fi</a><br /><a title="Patreon" href="https://patreon.com/user?u=54887552&amp;utm_medium=clipboard_copy&amp;utm_source=copyLink&amp;utm_campaign=creatorshare_creator&amp;utm_content=join_link" target="_blank" rel="noopener">Patreon</a></h3>

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.