Server
TConJSEvents.materialDefinition(handler: (event: MaterialDefinitionEventJS) => void)
TConJSEvents.materialDefinition((event) => {
event.addMaterialData(
"tconstruct",
"cobalt",
(definition) => {
definition
.craftable(false)
.hidden(false)
.sortOrder(10)
.tier(3);
},
(stats) => {
stats
.binding()
.maille()
.head(800, 2.25, 6.5, "minecraft:diamond")
.handle(0.05, 0.0, 0.05, 0.05)
.grip(0.05, 0.05, 2.25)
.limb(0.05, 0.05, 800, 0.05)
.platingHelmet(2.0, 330, 1.0, 0.05)
.platingChestplate(7.0, 480, 1.0, 0.05)
.platingLeggings(5.0, 450, 1.0, 0.05)
.platingBoots(2.0, 390, 1.0, 0.05)
.platingShield(540, 1.0, 0.05);
},
(traits) => {
traits
.add("tconstruct:lightweight", 1)
.perStat("tconstruct:armor", "tconstruct:melee_protection", 1);
},
(smltingRecipe) => {
smltingRecipe
.fluid("#forge:molten_cobalt")
.amount(90)
.temperature(950)
}
);
});
| Method | Description |
|---|
addMaterialData(
namespace: string,
materialName: string,
definition: (definition: MaterialDefinitionBuilder) => void,
stats: (stats: MaterialStatsBuilder) => void,
traits: (traits: MaterialTraitsBuilder) => void,
smeltingRecipe: (smeltingRecipe: MaterialSmeltingRecipeBuilder) => void
)
| Add material data |
addMaterialData(
namespace: string,
materialName: string,
definition: (definition: MaterialDefinitionBuilder) => void,
stats: (stats: MaterialStatsBuilder) => void,
traits: (traits: MaterialTraitsBuilder) => void,
smeltingRecipe: (smeltingRecipe: MaterialSmeltingRecipeBuilder) => void
)
addMaterialData(
materialName: string,
definition: (definition: MaterialDefinitionBuilder) => void,
stats: (stats: MaterialStatsBuilder) => void,
traits: (traits: MaterialTraitsBuilder) => void,
smeltingRecipe: (smeltingRecipe: MaterialSmeltingRecipeBuilder) => void
)
namespace: string - Material namespace (default namespace is kubejs)materialName: string - Material namedefinition: (definition: MaterialDefinitionBuilder) => void - Material definition builderstats: (stats: MaterialStatsBuilder) => void - Material stats buildertraits: (traits: MaterialTraitsBuilder) => void - Material traits buildersmeltingRecipe: (smeltingRecipe: MaterialSmeltingRecipeBuilder) => void - Material smelting recipe builder
MaterialDefinitionBuilder
| Method | Description |
|---|
craftable(
craftable: boolean
)
| If true, this material can be crafted at the Part Builder |
hidden(
hidden: boolean
)
| If true, this material will not be shown in the book or material item |
sortOrder(
sortOrder: int
)
| The material's sort order in the book, usually ordered as follows: | Group | Sort Order | Description |
|---|
| General | 0 | Has both attack and harvest traits | | Harvest | 1 | Has harvest traits, but no attack traits | | Attack | 2 | Has attack traits, but no harvest traits | | Special | 3 | Has special traits | | Ranged | 4 | Has ranged attack traits | | Compatible | 5 | Used only when adding common metals | | Nether | +10 | Nether materials, added to the previous value | | End | +15 | End materials, added to the previous value | | Binding | 20 | Materials that can only be made into a binding or bowstring | | Crafting | 25 | Materials that can only be used for crafting |
|
| The material tier, usually ordered as follows: | Tier | Book | Vanilla Material Reference | Crafting Method |
|---|
| 0 | Materials and You | Wood | Similar to tier 1, mainly used to place materials at the front of the list. Usually should not be used for other materials, only for new material types | | 1 | Materials and You | Cobblestone, Copper | Only needs to be crafted at the Part Builder | | 2 | Puny Smelting | Iron | Requires smelting and casting to craft | | 2 (Nether) | Puny Smelting | None | Used for making Nether or End building materials | | 3 | Mighty Smelting | Diamond | Materials that need to be made through alloying | | 3 (Nether) | Mighty Smelting | None | Nether or End materials that require smelting and casting to craft | | 4 (Blazing Blood) | Fantastic Foundry | Netherite | Materials that require extremely high temperatures to craft | | 4 (Expedition) | None | None | Materials obtainable in the mid-to-late game, mainly referring to End materials | | 4 (Soul Forging) | None | None | Materials that require a Soul Forge to craft Not yet implemented in Tinkers' Construct | | 5 | None | Netherite+ | The highest tier of materials, usually requiring multiple crafting methods and having unique traits Not yet implemented in Tinkers' Construct |
|
MaterialStatsBuilder
| Type | Method | Description |
|---|
| Melee/Harvest Tools | head(
durability: int,
meleeAttack: float,
miningSpeed: float,
miningTier: string
)
| Weapon and tool heads, such as pickaxe heads, small axe heads, small blade heads, pan heads, hammer heads, broad axe heads, and wide blades |
handle(
durability: int,
meleeDamage: float,
meleeSpeed: float,
miningSpeed: float,
)
| Handles, such as tool handles and tough handles |
| Bindings, such as binding knots, discs, and large plates |
| Ranged Tools | limb(
accuracy: float,
drawSpeed: float,
durability: int,
veocity: float
)
| Bow limb |
grip(
accuracy: float,
durability: float,百分比
meleeDamage: float
)
| Bow grip |
| Bowstring |
| Armor | platingHelmet(
armor: float,
durability: int,
toughness: float,
knockbackResistance: float
)
| Plating helmet |
platingChestplate(
armor: float,
durability: int,
toughness: float,
knockbackResistance: float
)
| Plating chestplate |
platingLeggings(
armor: float,
durability: int,
toughness: float,
knockbackResistance: float
)
| Plating leggings |
platingBoots(
armor: float,
durability: int,
toughness: float,
knockbackResistance: float
)
| Plating boots |
platingShield(
armor: float,
durability: int,
toughness: float,
knockbackResistance: float
)
| Plating shield |
| Chainmail base |
| Repair kit, used to restore durability when crafted with other tools |
skull(
durability: int,
armor: int,
)
| Skull |
| Method | Description |
|---|
fullArmor(
armor: float,
durability: int,
toughness: float,
knockbackResistance: float
)
| Sets the attributes for the full armor set and automatically applies them to the helmet, chestplate, leggings, boots, and shield |
part(
partId: string,
data: map<string, object>
)
| Sets attribute data for a part |
MaterialTraitsBuilder
| Method | Description |
|---|
add(
name: string,
level: int
)
| Add a material trait |
addAll(
traits: map<string, int>
)
| Add multiple material traits |
perStat(
partId: string,
traitName: String,
level: int
)
| Add a material trait for the specified part |
perStatAll(
partId: string,
traits: map<string, int>
)
| Add multiple material traits for the specified part |
MaterialSmeltingRecipeBuilder
| Method | Description |
|---|
| Sets the ID of the smelting fluid; if the prefix is #, it is treated as a fluid tag |
| Sets the amount of the smelting fluid, in millibuckets |
temperature(
temperature: int
)
| Sets the temperature of the smelting fluid, in degrees Celsius |