Skip to content
MrPurple6411 edited this page Jul 27, 2020 · 1 revision

How can I edit an item's size?

To edit an item's size, you need to call CraftDataHandler.SetItemSize(), a method sitting in the SMLHelper.V2.Handlers namespace

Overloads

There are two overloads for this method

CraftDataHandler.SetItemSize([TechType] techType, [Vector2int] size);
CraftDataHandler.SetItemSize([TechType] techType, [int] x, [int] y);

Parameters

  • [TechType] techType is the item for which you want to modify the size. This can be both an existing and a custom item.

Example: TechType.CreepvineSeedCluster

  • [Vector2int] size is the desired size of the item. This value contains an [int] x value which refers to width and an [int] y value which refers to height. You can also use the [int] x and [int] y values outside of the Vector2int, using the other overload

Example: new Vector2int(1, 1)

  • [int] x is the desired width of the item

Example: 1

  • [int] y is the desired height of the item

Example: 1

Usage

Using this knowledge, if we wanted to add make the Creepvine Seed Cluster take less space in the inventory, we could do this:

CraftDataHandler.SetItemSize(TechType.CreepvineSeedCluster, 1, 1);

or, this:

CraftDataHandler.SetItemSize(TechType.CreepvineSeedCluster, new Vector2int(1, 1));

Congratulations! You have successfully changed an item's size!

(By the way, there is a mod called Custom Item Sizes made by AlexejheroYTB which allows you to change the size of an item from the config.json file. You can check it out here)

Please note that some pages are under construction and the links to them will be enabled as they are completed

Home
Quick Start Guide

[Adding]

[Editing]

[General Utilities]

[Language]

Clone this wiki locally