MaterialPartData

Material Part Data is data that can be added to a MaterialPart to give it some more properties.

Importing the package

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.MaterialPartData;

Retrieving such an object

You can get a MaterialPartData object by using the getData() Method on a MaterialPart object.

Methods

All you can do with MaterialPartData is add more Data and retrieve stored data! You do that like so:

MPD.addDataValue(String name, String value);
MPD.getIntValue(String name, int defaultValue);
MPD.getStringValue(String name, String defaultValue);

Now, what to put in as name or value?
Well, that depends on the parttype of the tool you are using.
Below you will find a list for CoT’s basic Part Types:

Items
NameValueRequired?
burnAn "Integer" (e.g. "100")No
Armor
NameValueRequired?
durabilityAn "Integer" (e.g. "10")No
enchantabilityAn "Integer" (e.g. "10")No
reductionFour "Integers" (e.g. "2, 5, 6, 2")
Representing Footwear, Leggins, Chestplate, Headslot
No
toughnessA "float" (e.g. "2.4")No
Block
NameValueRequired?
hardnessAn "Integer" (e.g. "3")No
resistanceAn "Integer" (e.g. "15")No
harvestLevelAn "Integer" (e.g. "1")No
harvestToolA "tool" (e.g. "pickaxe")No
Fluid
NameValueRequired?
temperatureAn "Integer" (e.g. "300")No
densityAn "Integer" (e.g. "1000")No
luminosityAn "Integer" (e.g. "0")No
viscosityAn "Integer" (e.g. "100")No
vaporizeA "boolean" (e.g. "true")No
Ore
NameValueRequired?
dropsAn "itemList" (e.g. "minecraft:redstone,minecraft:gold_ingot")No
variantsA "Block List" (e.g. "minecraft:stone,minecraft:end_stone")No
hardnessAn "Integer list" (e.g. "3,3")No
resistanceAn "Integer list" (e.g. "15,15")No
harvestLevelAn "Integer list" (e.g. "1,1")No
harvestToolA "toolList" (e.g. "pickaxe,pickaxe")No
Minecart
NameValueRequired?
maxSpeedA "float" (e.g. "1.0")No
dragA "float" (e.g. "1.0")No
riddenDragA "float" (e.g. "1.0")No

Example

import mods.contenttweaker.MaterialSystem;

val oreData = MaterialSystem.getMaterialBuilder().setName("Lawrencium").setColor(15426660).build().registerPart("ore").getData();
oreData.addDataValue("drops", "minecraft:redstone,minecraft:gold_ingot");
oreData.addDataValue("variants", "minecraft:stone,minecraft:end_stone");
oreData.addDataValue("hardness", "3,3");
oreData.addDataValue("resistance", "15,15");
oreData.addDataValue("harvestLevel", "1,1");
oreData.addDataValue("harvestTool", "pickaxe,shovel");

oreData.addDataValue("test", 1);
print(oreData.getIntValue("test", -1));