Last active
January 14, 2019 13:51
-
-
Save kindlich/a5000a60e4d4d4b53b4af419a7e13e81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val craftingItem = <immersiveengineering:tool>.transformNew(function(item){ | |
if(!item.hasTag){ | |
return item.withTag({Damage: 1}); | |
} | |
val tag = item.tag; | |
if(!(tag has "Damage")){ | |
return item.withTag(tag + {Damage: 1}); | |
} | |
val newDamage = tag.Damage.asInt() + 1; | |
if(damage > 250) { | |
//Tool breaks, so returns nothing | |
return null; | |
} | |
return item.updateTag(tag + {Damage: newDamage}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment