Skip to content

Instantly share code, notes, and snippets.

@bonii-xx
Last active October 15, 2023 17:31
Show Gist options
  • Save bonii-xx/e46f9d9e81e29d796b1b to your computer and use it in GitHub Desktop.
Save bonii-xx/e46f9d9e81e29d796b1b to your computer and use it in GitHub Desktop.
Tinkers' Construct IMC
/* This first part adds Seared Stone as a material. Toolparts and tool graphics are created automatically by color */
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("Id", 50); // Unique material ID. Reseved IDs: 0-40 Tinker, 41-45 Iguana Tinker Tweaks, 100-200 ExtraTiC
tag.setString("Name", "Seared Stone"); // Unique material name
tag.setInteger("HarvestLevel", 3); // diamond level
tag.setInteger("Durability", 100);
tag.setInteger("MiningSpeed", 100);
tag.setInteger("Attack", 0); // optional
tag.setFloat("HandleModifier", 0.1f);
tag.setInteger("Reinforced", 0); // optional
tag.setFloat("Stonebound", 0); // optional, cannot be used if jagged
//tag.setFloat("Jagged", 0); // optional, cannot be used if stonebound
tag.setString("Style", EnumChatFormatting.RED.toString()); // optional, color of the material text
tag.setInteger("Color", 255 << 24 | 45 << 16 | 45 << 8 | 40); // argb
/* SINCE 1.8.2 - bow and arrow stats
* for bow and arrow stats, best compare to other materials to find good values
*/
// additional stats for bows
tag.setInteger("Bow_DrawSpeed", 100); // the higher the longer it takes to draw the bow
tag.setFloat("Bow_ProjectileSpeed", 1.0f); // the higher the faster the projectile goes
// additional stats for arrows
tag.setFloat("Projectile_Mass", 2.0f);
tag.setFloat("Projectile_Fragility", 0.9f); // This is a multiplier to the shafts break-chance
FMLInterModComms.sendMessage("TConstruct", "addMaterial", tag);
/* SINCE 1.8.3 - material mappings
* This maps an item to a material so it can be used for repairing etc. */
tag = new NBTTagCompound();
tag.setInteger("MaterialId", 50);
tag.setInteger("Value", 2); // 1 material ever 2 value. See PartMapping IMC
item = new NBTTagCompound();
(new ItemStack(TinkerTools.materials, 1, 2)).writeToNBT(item); // seared brick item
tag.setTag("Item", item);
FMLInterModComms.sendMessage("TConstruct", "addMaterialItem", tag);
/* This part adds mappigs, so that you can convert items to toolparts in the Part Builder.
Stone Parts are used as the baseline for what exists */
tag = new NBTTagCompound();
tag.setInteger("MaterialId", 50); // output material id
NBTTagCompound item = new NBTTagCompound();
(new ItemStack(TinkerSmeltery.smeltery, 1, 2)).writeToNBT(item); // seared brick block
tag.setTag("Item", item);
item = new NBTTagCompound();
(new ItemStack(TinkerTools.materials, 1, 2)).writeToNBT(item); // seared brick item
tag.setTag("Shard", item);
// 1 value = 1 shard. So 1 blocks like stone usually have value 2.
// Seared Brick is the shard, the block consists of 4 bricks, therefore value 4
tag.setInteger("Value", 4);
FMLInterModComms.sendMessage("TConstruct", "addPartBuilderMaterial", tag);
/* This part adds Smeltery casting. Give it a liquid, and which material to output. BAM toolpart casting.
Iron parts are used as the baseline for what exists.
Note that the Liquid has to exist. */
tag = new NBTTagCompound();
// liquid to use
tag.setString("FluidName", TinkerSmeltery.moltenStoneFluid.getName());
// or this way, it's equal
(new FluidStack(TinkerSmeltery.moltenStoneFluid, 1)).writeToNBT(tag); // this also works, amount doesn't matter
tag.setInteger("MaterialId", 50); // output material id
FMLInterModComms.sendMessage("TConstruct", "addPartCastingMaterial", tag);
// Smeltery stuff since 1.7.1
/* This part adds Smeltery melting. Give it an item, a block to render in the smeltery, the temperature required and the liquid to produce.
For reference: Iron has temperature 600, Stone has 800, Water has 20.
Melting duration is directly related to temperature required. */
tag = new NBTTagCompound();
// the item
item = new NBTTagCompound();
(new ItemStack(TinkerTools.materials, 1, 2)).writeToNBT(item); // seared brick item
tag.setTag("Item", item);
// the block to render
item = new NBTTagCompound();
(new ItemStack(TinkerSmeltery.smeltery, 1, 4)).writeToNBT(item); // seared stone block
tag.setTag("Block", item);
// liquid to produce. This time the amount DOES matter!
(new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.ingotLiquidValue/4)).writeToNBT(tag); // this also works
// the temperature required
tag.setInteger("Temperature", 850);
FMLInterModComms.sendMessage("TConstruct", "addSmelteryMelting", tag);
/* This part adds Smeltery fuel. Give it a fuel, how hot it is and how long it lasts.
The temperature determines WHAT it can melt (e.g. stone needs at least temperature 800) and how FAST it melts
The duration depends on how long one "portion" of fuel lasts.
For reference: Lava has a temperature of 1300 and a duration of 80
The duration has to be divided through 20 to get the seconds.
One "portion" is 15mb. */
tag = new NBTTagCompound();
// fuel liquid. Amount doesn't matter if you use the fluidstack variant
tag.setString("FluidName", FluidRegistry.WATER.getName());
// water is totally OP
tag.setInteger("Temperature", 9001);
// but also used up very quickly
tag.setInteger("Duration", 1); // this means 15 mb last 1 tick. Therefore 1 second of use drains 15*20 = 300mb water
FMLInterModComms.sendMessage("TConstruct", "addSmelteryFuel", tag);
/* SINCE 1.8.3
This allows you to register your custom IEnergyContainerItems as a valid item for adding the Redstone Flux Modifier to your tool
you can add any item you like, just make sure that the item implements IEnergyContainerItem interface from the cofh/api/energy api */
ItemStack battery = new ItemStack(ModItems.battery);
FMLInterModComms.sendMessage("TConstruct", "addFluxBattery", battery);
@DrZed
Copy link

DrZed commented Oct 7, 2016

@BatTheArcher Shameless self-advertising https://github.com/HxCKDMS/HxCTiC
=0 * Flutters away *

@ekul6547
Copy link

ekul6547 commented Oct 8, 2016

I used this method for my own material, but with NEI and in the inventory, everything is called material.[My material], instead of just [My material]
so for example, my main material is called ekulium, and all the tinker's stuff is called material.ekulium, like material.ekulium Pickaxe
any ideas on this? or is it just part of TConstruct's IMC handling?

@starlightsys
Copy link

This doesn't seem to work anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment