Skip to main content

TConJSEvents.materialDefinition

MangoJellyPuddingOriginal7/28/26Less than 1 minute

Server
TConJSEvents.materialDefinition(handler: (event: MaterialDefinitionEventJS) => void)

Basic Syntax

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)
    }
  );
});

Event Methods

MethodDescription
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

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
)
Parameters
  • namespace: string - Material namespace (default namespace is kubejs)
  • materialName: string - Material name
  • definition: (definition: MaterialDefinitionBuilder) => void - Material definition builder
  • stats: (stats: MaterialStatsBuilder) => void - Material stats builder
  • traits: (traits: MaterialTraitsBuilder) => void - Material traits builder
  • smeltingRecipe: (smeltingRecipe: MaterialSmeltingRecipeBuilder) => void - Material smelting recipe builder
MaterialDefinitionBuilder
MethodDescription
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:
GroupSort OrderDescription
General0Has both attack and harvest traits
Harvest1Has harvest traits, but no attack traits
Attack2Has attack traits, but no harvest traits
Special3Has special traits
Ranged4Has ranged attack traits
Compatible5Used only when adding common metals
Nether+10Nether materials, added to the previous value
End+15End materials, added to the previous value
Binding20Materials that can only be made into a binding or bowstring
Crafting25Materials that can only be used for crafting
tier(
  tier: int
)
The material tier, usually ordered as follows:
TierBookVanilla Material ReferenceCrafting Method
0 Materials and YouWoodSimilar 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 YouCobblestone, CopperOnly needs to be crafted at the Part Builder
2 Puny SmeltingIronRequires smelting and casting to craft
2 (Nether) Puny SmeltingNoneUsed for making Nether or End building materials
3 Mighty SmeltingDiamondMaterials that need to be made through alloying
3 (Nether) Mighty SmeltingNoneNether or End materials that require smelting and casting to craft
4 (Blazing Blood) Fantastic FoundryNetheriteMaterials that require extremely high temperatures to craft
4 (Expedition)NoneNoneMaterials obtainable in the mid-to-late game, mainly referring to End materials
4 (Soul Forging)NoneNoneMaterials that require a Soul Forge to craft
Not yet implemented in Tinkers' Construct
5NoneNetherite+The highest tier of materials, usually requiring multiple crafting methods and having unique traits
Not yet implemented in Tinkers' Construct
MaterialStatsBuilder

Tinkers' Construct 3 Vanilla Parts

TypeMethodDescription
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
binding()
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()
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
maille()
Chainmail base
repairKit()
Repair kit, used to restore durability when crafted with other tools
skull(
  durability: int,
  armor: int,
)
Skull

Other Methods

MethodDescription
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
MethodDescription
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
MethodDescription
fluid(
  fluidId: string
)
Sets the ID of the smelting fluid; if the prefix is #, it is treated as a fluid tag
amount(
  amount: int
)
Sets the amount of the smelting fluid, in millibuckets
temperature(
  temperature: int
)
Sets the temperature of the smelting fluid, in degrees Celsius