MaterialPartData
Link to materialpartdata
Material Part Data is data that can be added to a MaterialPart to give it some more properties.
Importing the package
Link to 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
Link to retrieving-such-an-object
You can get a MaterialPartData object by using the getData()
Method on a MaterialPart object.
Methods
Link to methods
All you can do with MaterialPartData is add more Data and retrieve stored data! You do that like so:
ZenScript CopyMPD.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
Name | Value | Required? |
---|---|---|
burn | An "Integer" (e.g. "100") | No |
Armor
Name | Value | Required? |
---|---|---|
durability | An "Integer" (e.g. "10") | No |
enchantability | An "Integer" (e.g. "10") | No |
reduction | Four "Integers" (e.g. "2, 5, 6, 2") Representing Footwear, Leggins, Chestplate, Headslot | No |
toughness | A "float" (e.g. "2.4") | No |
Block
Name | Value | Required? |
---|---|---|
hardness | An "Integer" (e.g. "3") | No |
resistance | An "Integer" (e.g. "15") | No |
harvestLevel | An "Integer" (e.g. "1") | No |
harvestTool | A "tool" (e.g. "pickaxe") | No |
Fluid
Name | Value | Required? |
---|---|---|
temperature | An "Integer" (e.g. "300") | No |
density | An "Integer" (e.g. "1000") | No |
luminosity | An "Integer" (e.g. "0") | No |
viscosity | An "Integer" (e.g. "100") | No |
vaporize | A "boolean" (e.g. "true") | No |
Ore
Name | Value | Required? |
---|---|---|
drops | An "itemList" (e.g. "minecraft:redstone,minecraft:gold_ingot") | No |
variants | A "Block List" (e.g. "minecraft:stone,minecraft:end_stone") | No |
hardness | An "Integer list" (e.g. "3,3") | No |
resistance | An "Integer list" (e.g. "15,15") | No |
harvestLevel | An "Integer list" (e.g. "1,1") | No |
harvestTool | A "toolList" (e.g. "pickaxe,pickaxe") | No |
Minecart
Name | Value | Required? |
---|---|---|
maxSpeed | A "float" (e.g. "1.0") | No |
drag | A "float" (e.g. "1.0") | No |
riddenDrag | A "float" (e.g. "1.0") | No |
Example
Link to example
ZenScript Copyimport 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));