Class ClothingItemCreator
Provides convenient static methods for creating custom clothing items. Use CreateBuilder() for flexible configuration or CloneFrom(string) for variants.
[Obsolete("Use S1API.Items.Clothing.ClothingItemCreator instead")]
public static class ClothingItemCreator
- Inheritance
-
ClothingItemCreator
- Inherited Members
Methods
CloneFrom(ClothingItemDefinition)
Creates a new clothing item by cloning an existing one. Returns a builder pre-configured with all properties of the source item.
public static ClothingItemDefinitionBuilder CloneFrom(ClothingItemDefinition source)
Parameters
sourceClothingItemDefinitionThe clothing item definition to clone.
Returns
- ClothingItemDefinitionBuilder
A builder pre-configured with the source item's properties.
Examples
var existingCap = ItemManager.GetItemDefinition("cap") as ClothingItemDefinition;
var variant = ClothingItemCreator.CloneFrom(existingCap)
.WithBasicInfo("variant_cap", "Cap Variant", "A variant of the cap")
.Build();
CloneFrom(string)
Creates a new clothing item by cloning an existing one by ID. Returns a builder pre-configured with all properties of the source item. You can then override specific properties before calling Build().
public static ClothingItemDefinitionBuilder CloneFrom(string sourceItemId)
Parameters
sourceItemIdstringThe ID of the clothing item to clone.
Returns
- ClothingItemDefinitionBuilder
A builder pre-configured with the source item's properties.
Examples
// Clone the base game cap and customize it
var customCap = ClothingItemCreator.CloneFrom("cap")
.WithBasicInfo("stay_silly_cap", "Stay Silly Cap", "A silly custom cap")
.WithClothingAsset("BigWillyMod/Accessories/StaySillyCap")
.WithColorable(false)
.Build();
CreateBuilder()
Creates a new builder for composing a clothing item definition with full flexibility. Use fluent methods to configure the item, then call Build() to register it.
public static ClothingItemDefinitionBuilder CreateBuilder()
Returns
- ClothingItemDefinitionBuilder
A new ClothingItemDefinitionBuilder instance for fluent configuration.
Examples
var hat = ClothingItemCreator.CreateBuilder()
.WithBasicInfo("my_hat", "Custom Hat", "A fancy custom hat")
.WithSlot(ClothingSlot.Head)
.WithApplicationType(ClothingApplicationType.Accessory)
.WithClothingAsset("MyMod/Accessories/CustomHat")
.WithDefaultColor(ClothingColor.Black)
.Build();