Skip to content

Instantly share code, notes, and snippets.

@eutro
Last active June 16, 2020 20:58
Show Gist options
  • Save eutro/d52fdeb423b046031ef7ad0c7f4b0818 to your computer and use it in GitHub Desktop.
Save eutro/d52fdeb423b046031ef7ad0c7f4b0818 to your computer and use it in GitHub Desktop.
Extra S'mores
#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.IItemFoodEaten;
import crafttweaker.potions.IPotion;
var smingots as string[] = [
"eightsmore",
"sixteensmore",
"thirtytwosmore",
"sixtyfoursmore"
] as string[];
function getItemFoodEaten(duration as int) as IItemFoodEaten {
return function(stack, world, player) {
var potions = [ // These can't resolve when the script is run, so resolve them within the function.
<potion:minecraft:absorption>,
<potion:minecraft:speed>,
<potion:minecraft:haste>
] as IPotion[];
for potion in potions {
player.addPotionEffect(potion.makePotionEffect(duration, 1));
}
} as IItemFoodEaten;
}
var heal = 44;
var saturation = 8.6 as float;
var potionDuration = 1200;
for smingot in smingots {
heal = (heal * 2) + 4;
saturation = (saturation * 2) + 1;
potionDuration = potionDuration * 2;
var foodRep = VanillaFactory.createItemFood(smingot, heal);
foodRep.saturation = saturation;
foodRep.onItemFoodEaten = getItemFoodEaten(potionDuration);
foodRep.register();
}
import crafttweaker.item.IItemStack;
var smingots as IItemStack[] = [
<nuclearcraft:foursmore>,
<contenttweaker:eightsmore>,
<contenttweaker:sixteensmore>,
<contenttweaker:thirtytwosmore>,
<contenttweaker:sixtyfoursmore>
] as IItemStack[];
var i = 1;
while i < smingots.length {
var inSmingot = smingots[i - 1];
var outSmingot = smingots[i];
recipes.addShaped(outSmingot.definition.id.replaceAll(":", "_"), outSmingot,
[[inSmingot, <nuclearcraft:milk_chocolate>],
[<nuclearcraft:marshmallow>, inSmingot]]
);
i += 1;
}
item.contenttweaker.eightsmore.name=EightS'more OctoS'mingot
item.contenttweaker.sixteensmore.name=SixteenS'more HexadecaS'mingot
item.contenttweaker.thirtytwosmore.name=Half-stack-o'-S'more TriacontadyoS'mingot
item.contenttweaker.sixtyfoursmore.name=Stack-o'-S'more HexecontatettaraS'mingot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment