Skip to content

Instantly share code, notes, and snippets.

#loader contenttweaker
//Doesnt do anything, I don't know how to use use actions, so I couldn't test this.
//Syntax is fine though ^^
var item1 = mods.contenttweaker.VanillaFactory.createItem("my_item_1");
item1.itemUseAction = "DRINK";
item1.onItemUseFinish = function(item, world, user) {
return <item:minecraft:bedrock> * item.amount;
import mods.compatskills.TraitCreator;
static attackingPlayers as string[string] = {};
val myTrait = TraitCreator.createTrait("moreDamage", 4, 3, "reskillable:attack", 5, "reskillable:attack|3");
myTrait.onAttackMob = function(event as crafttweaker.event.EntityLivingHurtEvent) {
if(!event.entity.world.remote)
if(!didAlreadyAttack(event.damageSource.trueSource.displayName, event.entity.world.time)){
#loader contenttweaker
import mods.contenttweaker.Player;
var bluemint_hatchet_basic = mods.contenttweaker.VanillaFactory.createItem("bluemint_hatchet_basic");
bluemint_hatchet_basic.maxDamage = 60;
bluemint_hatchet_basic.toolClass = "shovel";
bluemint_hatchet_basic.itemDestroyedBlock = function(stack, world, blockstate, blockpos, entity) {
if(!world.remote){
import crafttweaker.item.IItemStack;
import crafttweaker.item.IIngredient;
import crafttweaker.recipes.IRecipeFunction;
import crafttweaker.data.IData;
val recipes as IData[IIngredient[]] = {
//[Brush, dyeIngredient] : [repairValue, maxDyeCount]
//[Brush, dyeIngredient] : repairValue
[<minecraft:iron_pickaxe>, <ore:dyeRed>] : [10, 3],
import crafttweaker.item.IItemStack;
var removeItems as IItemStack[] = [
<appliedenergistics2:material:40>,
<appliedenergistics2:quartz_glass>,
<betterwithaddons:decomat:3>,
<betterwithmods:aesthetic:8>,
<ceramics:unfired_clay>,
<charcoalblock:charcoal_block>,
<minecraft:bed:*>,
import crafttweaker.data.IData;
import crafttweaker.item.IIngredient;
var backpack = <improvedbackpacks:backpack>;
var ironBackpacksIngredient as IIngredient =
<ironbackpacks:backpack>.withTag({packInfo: {upgrade: [], type: "ironbackpacks:basic", spec: "NONE"}}) |
<ironbackpacks:backpack>.withTag({packInfo: {upgrade: [], type: "ironbackpacks:iron", spec: "STORAGE"}}) |
<ironbackpacks:backpack>.withTag({packInfo: {upgrade: [], type: "ironbackpacks:gold", spec: "STORAGE"}}) |
<ironbackpacks:backpack>.withTag({packInfo: {upgrade: [], type: "ironbackpacks:diamond", spec: "STORAGE"}});
#loader contenttweaker
//Note: Works fine when during CraftTweaker runtime as well!
val builder = mods.contenttweaker.enchantments.EnchantmentBuilder.create("kindlich_chant");
builder.applicableSlots = [mainHand, offhand, feet, legs, chest, head];
builder.setTypeAll();
builder.setRarityVeryRare();
builder.calcModifierDamage = function(thisEnch, level, damageSource){
return level;
};
import crafttweaker.event.PlayerDeathDropsEvent;
import crafttweaker.event.PlayerFillBucketEvent;
import crafttweaker.event.PlayerOpenContainerEvent;
import crafttweaker.event.EntityLivingUseItemEvent.Finish;
import crafttweaker.event.EntityLivingFallEvent;
import crafttweaker.world.IBlockPos;
events.onPlayerDeathDrops(function(event as PlayerDeathDropsEvent) {
print("Items:");
import crafttweaker.item.IIngredient;
import crafttweaker.recipes.IRecipeFunction;
val oreDict = <ore:myUniqueOreDict>;
//Simply So that I have an oreDict
oreDict.add(<minecraft:iron_ingot>, <minecraft:gold_ingot>, <minecraft:redstone>, <minecraft:grass>);
val recipeFunctionSingleItems as IRecipeFunction = function(out, ins, cInfo){
#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.PartType;
import mods.contenttweaker.MaterialSystem;
import mods.contenttweaker.Commands;
var egg = VanillaFactory.createItem("charmander_spawn_egg");
egg.maxStackSize = 64;
egg.itemRightClick = function(stack, world, player, hand) {
if (stack.tag has "entity") {