Skip to content

Instantly share code, notes, and snippets.

@SimonMeskens
Last active November 9, 2019 00:45
Show Gist options
  • Save SimonMeskens/a42e1dfdeb9e56b54bdcd0e664738f2d to your computer and use it in GitHub Desktop.
Save SimonMeskens/a42e1dfdeb9e56b54bdcd0e664738f2d to your computer and use it in GitHub Desktop.
// Replace IE slags with the default Pyrotech one
mods.immersivetweaks.Slag.replaceSlag(<immersiveengineering:material:7>, <pyrotech:slag>);
// Add proper slags and bloom processing for all IE ingots
val metals = [
"Iron", "Gold", "Copper", "Aluminum", "Lead", "Silver", "Nickel",
"Constantan", "Electrum", "Steel", "Uranium"
] as String[];
for metal in metals {
var slag = itemUtils.getItem("pyrotech:generated_slag_" + metal.toLowerCase());
if (isNull(slag)) slag = <pyrotech:slag>;
mods.immersivetweaks.Slag.replaceSlagByInput(oreDict["ore" + metal], slag);
val bloom = <pyrotech:bloom>.withTag({BlockEntityTag: {recipeId: "pyrotech:bloom_from_ore" + metal.toLowerCase()}});
mods.immersivetweaks.MetalPress.addRecipe(
"bloom_" + metal.toLowerCase(),
oreDict["ingot" + metal].firstItem,
bloom, <ore:blockSteel>.firstItem,
2400, true, 1
);
}
// Allow Pyrotech tongs to place blooms onto conveyors
val tongs = <pyrotech:tongs_stone> | <pyrotech:tongs_stone_full> | <pyrotech:tongs_flint> | <pyrotech:tongs_flint_full> |
<pyrotech:tongs_bone> | <pyrotech:tongs_bone_full> | <pyrotech:tongs_iron> | <pyrotech:tongs_iron_full> |
<pyrotech:tongs_gold> | <pyrotech:tongs_gold_full> | <pyrotech:tongs_diamond> | <pyrotech:tongs_diamond_full> |
<pyrotech:tongs_obsidian> | <pyrotech:tongs_obsidian_full>;
tongs.addTooltip("Right click on anvil or conveyor to place bloom");
events.onPlayerInteractBlock(function(event as crafttweaker.event.PlayerInteractBlockEvent) {
if(event.player.world.remote) return;
if (!event.canceled & !isNull(event.player.currentItem)) {
val heldItem = event.player.currentItem as crafttweaker.item.IItemStack;
if (event.block.definition.id == "immersiveengineering:conveyor") {
var currentTong as string = "";
for material in [ "stone", "flint", "bone", "iron", "gold", "diamond", "obsidian" ] as string[] {
val tong = "pyrotech:tongs_" + material;
val tongFull = tong + "_full";
if (heldItem.definition.id == tongFull) {
currentTong = tong;
break;
}
}
if (currentTong != "" & heldItem.hasTag) {
val entity = <pyrotech:bloom>
.withTag(heldItem.tag)
.createEntityItem(event.world, event.x, event.y, event.z);
entity.motionX = 0;
entity.motionY = 0;
entity.motionZ = 0;
entity.posX = entity.posX + 0.5;
entity.posY = entity.posY + 0.2;
entity.posZ = entity.posZ + 0.5;
event.world.spawnEntity(entity);
val slot = crafttweaker.entity.IEntityEquipmentSlot.mainHand();
event.player.setItemToSlot(slot, itemUtils.getItem(currentTong).withDamage(heldItem.damage));
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment