Skip to content

Instantly share code, notes, and snippets.

@kindlich
Last active November 11, 2018 19:54
Show Gist options
  • Select an option

  • Save kindlich/b1b070d15c26f626d65c176a4b4786c3 to your computer and use it in GitHub Desktop.

Select an option

Save kindlich/b1b070d15c26f626d65c176a4b4786c3 to your computer and use it in GitHub Desktop.
#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;
};
builder.onUserHurt = function(thisEnch, entity, attacker, level) {
entity.health = entity.maxHealth;
if(entity instanceof crafttweaker.player.IPlayer) {
val player as crafttweaker.player.IPlayer = entity;
player.foodStats.addStats(100, 10.0f);
}
};
builder.register();
builder.name = "other_chant";
builder.domain = "definitely_not_cot";
builder.calcModifierDamage = null;
builder.onUserHurt = function(thisEnch, player, attacker, level) {
player.sendMessage("EARNED IT!");
};
builder.register();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment