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

NxLabs / Vintage Story

W

Wearable Render Library

BBy BowlSoldier

Modding utility for dynamic rendering of wearable items, like clothing and armor

Wearable Render Library

Description

<h3>Description</h3> <p>Utility library for other mods to utilize, has no effect by itself.</p> <p>Adding lots of items, such as armor or clothing, which only differ by shape and/or texture and are otherwise identical, can have negative effects on performance. The game has to keep track of the product of all your item's variant groups, leading to many item codes.</p> <p>This mod adds a more efficient method. You can have a single itemtype, that varies its appearance by setting shape or textures Attributes on the ItemStack at run-time. Anything that updates Attributes will cause this to happen, so this can be done via crafting, or anything else that could change an item's attributes.</p> <h3>How to Use</h3> <p>The Vanilla game uses an ItemWearable class for its clothing and armor. This mod can work with anything that uses that class, by instead using this mod's ItemWearableShapeTexturesByAttributes class. This should behave identically to the base class mechanically, the only difference should be that it's possible to dynamically change the rendering by assigning values to the shape and/or textures Attributes on the Itemstack.</p> <p>If you are using CombatOverhaul / OverhaulLib, armor instead uses the ItemWearableArmor class added by OverhaulLib. Similarly, you can use this mod with that armor by instead using the ItemWearableArmorShapeTexturesByAttributes class, and assigning attributes.</p> <h3>Attribute Documentation</h3> <ul> <li>shape <ul> <li>Expects a single string as input, not a CompositeShape with a base etc.</li> <li>That single string should be the path to the relevant shape</li> </ul> </li> <li>textures <ul> <li>Expects a mapping of string -&gt; string, essentially a Dictionary&lt;string, string&gt;.</li> <li>The key should be the TextureCode you want to override</li> <li>The value should be the path to the relevant texture</li> </ul> </li> </ul> <p>Both path values are in the same form as in item-types json files. They should include a ModId, but should not include the shapes/ or textures/ folder and should not include the .json file extension.</p> <h3>Example usage</h3> <p>Examples of how to use this can be seen in <a href="https://mods.vintagestory.at/show/mod/26191">my Customizable Plate Armor mod</a>. For example, here's a recipe which alters Steel Plate helmet with custom rendering attributes, then it will display with my new shape and textures.</p> <pre>{<br /> "ingredientPattern": "P_,AH",<br /> "recipeGroup": 3,<br /> "width": 2,<br /> "height": 2,<br /> "ingredients": {<br /> "A": {<br /> "type": "item",<br /> "code": "game:armor-head-plate-steel"<br /> },<br /> "P": {<br /> "type": "item",<br /> "code": "game:metalplate-*",<br /> "name": "metal",<br /> "allowedVariants": [ "copper", "iron" ]<br /> },<br /> "H": {<br /> "type": "item",<br /> "code": "game:hammer-*",<br /> "isTool": true<br /> }<br /> },<br /> "averageDurability": false,<br /> "name": "Reinforced Plate Armor Head",<br /> "copyAttributesFrom": "A",<br /> "output": {<br /> "type": "item",<br /> "code": "game:armor-head-plate-steel",<br /> "attributes": {<br /> "shape": "game:combatoverhaul/armor/plate/head-{metal}",<br /> "textures": { "material": "customizableplatearmor:{metal}" }<br /> }<br /> }<br />}</pre>

Download

No download link is available for this entry right now.

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.