If you want to build a Part, you will need a Part Builder!
Doesn't sound that hard, does it?

Импорт пакета

Link to импорт-пакета

It might be required for you to import the package if you encounter any issues, so better be safe than sorry and add the import.
import mods.contenttweaker.PartBuilder;

Retrieving such an object

Link to retrieving-such-an-object

You can retrieve a new, clear Builder using the MaterialSystem Package:

ZenScript
Copy
var pBuilder = mods.contenttweaker.MaterialSystem.getPartBuilder();

Set the Part's Properties

Link to set-the-parts-properties

You can set these Properties

ZenMethodПараметр
ZenMethod
setHasOverlay(hasOverlay)
Параметр
boolean hasOverlay
ZenMethod
setName(name)
Параметр
string name
ZenMethod
setPartType(partType)
Параметр
PartType partType
ZenMethod
setOreDictName(prefix)
Параметр
string prefix
ZenMethod
setAdditionalOreDictNames(prefixes)
Параметр
string... prefixes

All these Methods do 2 things: Firstly, they change the builder's Property, secondly they return the modified builder.
You can see in the example scripts below what this means.

Actually build the Material

Link to actually-build-the-material

Before you can build your material, you need to build it:

ZenScript
Copy
pBuilder.build();

This returns an Part Object.

ZenScript
Copy
var pBuilder = mods.contenttweaker.MaterialSystem.getPartBuilder();
pBuilder.setName("dense_gear");
pBuilder.setPartType(MaterialSystem.getPartType("item"));
var denseGearPart = pBuilder.build();

var denseIngotPart = mods.contenttweaker.MaterialSystem.getPartBuilder().setName("dense_ingot").setPartType(mods.contenttweaker.MaterialSystem.getPartType("item")).setOreDictName("superIngot").build();

Noteworthy information

Link to noteworthy-information

Localizing the MaterialParts

Link to localizing-the-materialparts

The items you create with your new part will generally be named contenttweaker.part.partname
If you want your item to include the material name, you will need to localize it, preferably in CoT's language files which can be found at Resources/contenttweaker/lang.
Instead of the material name you write %s, so naming the dense gears ans ingots created above would look like this:

Copy
contenttweaker.part.dense_gear=Dense %s Gear
contenttweaker.part.dense_ingot=Dense %s Ingot

Adding a texture

Link to adding-a-texture

The items you create with your new part will look a bit edgy to you.
If you want your part to have a specific icon you will need to add a partname.png file to Resources/contenttweaker/textures/items.
So, giving the dense gears a texture would require us to add a file called gear_dense.png to that folder.