### Conditional Logging in GroovyScript Source: https://context7.com/cleanroommc/groovyscript/llms.txt Implement conditional logging based on game state or mod availability. This example shows logging only when the JEI mod is loaded. ```groovy // Conditional logging if (mods.jei) { log.info('JEI is loaded') } ``` -------------------------------- ### Groovy Closure Syntax Source: https://github.com/cleanroommc/groovyscript/wiki/Lambdas-&-Closures Groovy Closures are similar to Java lambdas but use a different syntax. This example shows the basic structure. ```groovy { param1, param2 -> param1 + param2 } ``` -------------------------------- ### Botania Pure Daisy Conversions Source: https://context7.com/cleanroommc/groovyscript/llms.txt Set up Pure Daisy conversion recipes, defining the input block and the resulting output block, along with the conversion time. ```groovy mods.botania.pure_daisy.recipeBuilder() .input(ore('plankWood')) .output(blockstate('minecraft:clay')) .time(5) .register() ``` -------------------------------- ### Botania Rune Altar Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Configure Rune Altar recipes, including input items, mana cost, and the resulting output item. ```groovy mods.botania.rune_altar.recipeBuilder() .input(ore('gemEmerald'), item('minecraft:apple')) .output(item('minecraft:diamond')) .mana(500) .register() ``` -------------------------------- ### Thermal Expansion Fluid Transposer Fill Recipe Source: https://context7.com/cleanroommc/groovyscript/llms.txt Sets up a fill recipe for the Thermal Expansion Fluid Transposer, requiring an input item, fluid input, and energy consumption. ```groovy // Fluid Transposer - Fill mods.thermalexpansion.transposer_fill.recipeBuilder() .input(item('minecraft:clay')) .output(item('minecraft:diamond') * 2) .fluidInput(fluid('water') * 50) .energy(1000) .register() ``` -------------------------------- ### Botania Petal Apothecary Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Create or remove Botania Petal Apothecary recipes. Ensure correct input items and output flowers are specified. ```groovy mods.botania.apothecary.recipeBuilder() .input(ore('blockGold'), ore('ingotIron'), item('minecraft:apple')) .output(item('minecraft:golden_apple')) .register() ``` ```groovy mods.botania.apothecary.removeByOutput(item('botania:specialflower').withNbt(['type': 'puredaisy'])) ``` -------------------------------- ### Add Item Descriptions in JEI Source: https://context7.com/cleanroommc/groovyscript/llms.txt Illustrates adding custom descriptions to items in JEI, supporting both single-line and multi-line text. ```groovy // Add item descriptions mods.jei.description.add(item('minecraft:gold_ingot'), 'A shiny gold ingot') mods.jei.description.add(item('minecraft:clay'), ['Line 1', 'Line 2', 'Line 3']) ``` -------------------------------- ### Mekanism Chemical Infuser Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Create Mekanism Chemical Infuser recipes for gas-to-gas transformations, specifying input gas amounts and output gas. ```groovy mods.mekanism.chemical_infuser.recipeBuilder() .gasInput(gas('copper') * 10, gas('iron')) .gasOutput(gas('gold') * 15) .register() ``` -------------------------------- ### Thermal Expansion Induction Smelter Recipe Source: https://context7.com/cleanroommc/groovyscript/llms.txt Creates a recipe for the Thermal Expansion Induction Smelter, defining input items and the quantity of the output item. ```groovy // Induction Smelter mods.thermalexpansion.smelter.recipeBuilder() .input(item('minecraft:clay'), item('minecraft:diamond')) .output(item('minecraft:diamond') * 4) .register() ``` -------------------------------- ### In-World Crafting: Fluid to Item Conversion Source: https://context7.com/cleanroommc/groovyscript/llms.txt Creates a recipe for converting a fluid and item(s) into an item, with optional chances for fluid and item consumption. ```groovy // Fluid to item with conditions in_world_crafting.fluid_to_item.recipeBuilder() .fluidInput(fluid('water'), 0.22f) // 22% fluid consumption chance .input(item('minecraft:netherrack')) .input(item('minecraft:gold_ingot'), 0.1f) // 10% item consumption chance .output(item('minecraft:nether_star')) .register() ``` -------------------------------- ### Mekanism Crusher Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Add Mekanism Crusher recipes, specifying the input item and the resulting output item. ```groovy mods.mekanism.crusher.recipeBuilder() .input(item('minecraft:clay_ball')) .output(item('minecraft:gold_ingot')) .register() ``` -------------------------------- ### Thermal Expansion Compactor Recipe with Mode Source: https://context7.com/cleanroommc/groovyscript/llms.txt Defines a recipe for the Thermal Expansion Compactor, including input, output, and a specific operational mode. ```groovy // Compactor with mode mods.thermalexpansion.compactor.recipeBuilder() .input(item('minecraft:clay')) .output(item('minecraft:diamond') * 2) .mode(compactorMode('coin')) .register() ``` -------------------------------- ### Botania Custom Brew Creation Source: https://context7.com/cleanroommc/groovyscript/llms.txt Create custom Botania brews with specified effects, color, mana cost, and properties like incense and blood pendant. ```groovy mods.botania.brew.brewBuilder() .key('groovy_example_brew') .name('Groovy Brew') .color(0x00FFFF) .cost(100) .effect( new PotionEffect(potion('minecraft:strength'), 1800, 3), new PotionEffect(potion('minecraft:speed'), 1800, 2) ) .incense(true) .bloodPendant(true) .register() ``` -------------------------------- ### Botania Elven Trade Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Define Elven Trade recipes by specifying input items and the resulting output item. ```groovy mods.botania.elven_trade.recipeBuilder() .input(ore('ingotGold'), ore('ingotIron')) .output(item('botania:manaresource:7')) .register() ``` -------------------------------- ### Mekanism Electrolytic Separator Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Add Mekanism Electrolytic Separator recipes for converting fluids into gases, specifying fluid input, gas outputs, and energy requirements. ```groovy mods.mekanism.electrolytic_separator.recipeBuilder() .fluidInput(fluid('lava') * 10) .gasOutput(gas('cleanGold') * 5, gas('cleanCopper') * 3) .energy(3000) .register() ``` -------------------------------- ### Add and Remove Furnace Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Use the furnace API to add new smelting recipes with configurable experience or remove existing ones by input or output item. ```groovy furnace.recipeBuilder() .input(ore('ingotGold')) .output(item('minecraft:nether_star')) .exp(0.5) .register() ``` ```groovy furnace.add(item('minecraft:clay'), item('minecraft:diamond')) ``` ```groovy furnace.removeByInput(item('minecraft:clay:*')) ``` ```groovy furnace.removeByOutput(item('minecraft:brick')) ``` -------------------------------- ### Mekanism Enrichment Chamber Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Configure Mekanism Enrichment Chamber recipes with input and output items. ```groovy mods.mekanism.enrichment_chamber.recipeBuilder() .input(item('minecraft:clay_ball')) .output(item('minecraft:nether_star')) .register() ``` -------------------------------- ### Modify JEI Catalysts Source: https://context7.com/cleanroommc/groovyscript/llms.txt Demonstrates removing existing catalysts and adding new ones for specific JEI recipe categories, affecting the machines shown on recipe sides. ```groovy // Modify catalysts (machines shown on recipe sides) mods.jei.catalyst.remove('minecraft.smelting', item('minecraft:furnace')) mods.jei.catalyst.add('minecraft.smelting', item('minecraft:clay') * 8) ``` -------------------------------- ### Add Custom Items to JEI Source: https://context7.com/cleanroommc/groovyscript/llms.txt Shows how to add custom items to JEI, including items with specific NBT data for custom display names. ```groovy // Add custom items to JEI mods.jei.ingredient.add(item('minecraft:stone:1').withNbt([ display: [Name: 'Special Granite'] ])) ``` -------------------------------- ### Botania Mana Infusion Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Add Mana Infusion recipes, specifying input items, mana cost, and optional catalyst blocks. ```groovy mods.botania.mana_infusion.recipeBuilder() .input(ore('ingotGold')) .output(item('botania:manaresource', 1)) .mana(500) .catalyst(blockstate('botania:alchemycatalyst')) .register() ``` -------------------------------- ### Thermal Expansion Phytogenic Insolator Recipe Source: https://context7.com/cleanroommc/groovyscript/llms.txt Configures a recipe for the Phytogenic Insolator, used for tree growing, specifying inputs, outputs, water requirements, energy, and enabling the tree growth function. ```groovy // Phytogenic Insolator (tree growing) mods.thermalexpansion.insolator.recipeBuilder() .input(item('minecraft:clay'), item('minecraft:gold_ingot') * 2) .output(item('minecraft:clay'), item('minecraft:diamond')) .chance(5) .water(100) .tree() .energy(1000) .register() ``` -------------------------------- ### Basic GroovyScript Logging Source: https://context7.com/cleanroommc/groovyscript/llms.txt Use standard log levels like info, debug, warn, and error for general logging. The debug method supports variable interpolation. ```groovy // Basic logging log.info('Hello World!') log.debug('Debug info: {}', someVariable) log.warn('Warning message') log.error('Error occurred') ``` -------------------------------- ### In-World Crafting: Burning Conversion Source: https://context7.com/cleanroommc/groovyscript/llms.txt Creates a recipe where an item is converted into another item when exposed to fire, specifying the duration. ```groovy // Burning conversion (item in fire) in_world_crafting.burning.recipeBuilder() .input(item('minecraft:gold_ingot')) .output(item('minecraft:diamond')) .ticks(100) .register() ``` -------------------------------- ### In-World Crafting: Fluid to Block Conversion Source: https://context7.com/cleanroommc/groovyscript/llms.txt Defines a recipe where a fluid and an item are converted into a block. ```groovy // Fluid to block conversion in_world_crafting.fluid_to_block.recipeBuilder() .fluidInput(fluid('water')) .input(item('minecraft:clay_ball')) .output(block('minecraft:diamond_block')) .register() ``` -------------------------------- ### In-World Crafting: Piston Push Conversion Source: https://context7.com/cleanroommc/groovyscript/llms.txt Creates a recipe triggered by a piston pushing an item, specifying input, output, minimum harvest level, and maximum conversions per push. ```groovy // Piston push conversion in_world_crafting.piston_push.recipeBuilder() .input(item('minecraft:gold_ingot')) .output(item('minecraft:diamond')) .minHarvestLevel(2) .maxConversionsPerPush(3) .register() ``` -------------------------------- ### GroovyScript Run Configuration Source: https://context7.com/cleanroommc/groovyscript/llms.txt Configure GroovyScript behavior using the runConfig.json file. This file specifies pack details, script loading order, and packmode integration. ```json { "packName": "My Modpack", "packId": "mymodpack", "author": "Your Name", "version": "1.0.0", "debug": true, "loaders": { "preInit": ["classes/", "preInit/"], "init": ["init/"], "postInit": ["postInit/", "recipes/"] }, "packmode": { "values": ["normal", "hard", "expert"], "default": "normal", "integratePackmodeMod": false } } ``` -------------------------------- ### Mekanism Pressurized Reaction Chamber Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Configure Mekanism Pressurized Reaction Chamber recipes, which can involve fluid inputs, gas inputs, item inputs, and gas outputs. ```groovy mods.mekanism.pressurized_reaction_chamber.recipeBuilder() .fluidInput(fluid('water')) .gasInput(gas('water')) .input(item('minecraft:clay_ball')) .gasOutput(gas('ethene')) .register() ``` -------------------------------- ### Hide Items and Fluids from JEI Source: https://context7.com/cleanroommc/groovyscript/llms.txt Demonstrates how to hide specific items, item variants, or fluids from the Just Enough Items (JEI) interface. ```groovy // Hide items from JEI mods.jei.ingredient.hide(fluid('water')) mods.jei.ingredient.hide(item('minecraft:stone:1'), item('minecraft:stone:3')) mods.jei.ingredient.hide(item('minecraft:bed:*')) // Hide all bed variants ``` -------------------------------- ### Thermal Expansion Redstone Furnace Recipe Source: https://context7.com/cleanroommc/groovyscript/llms.txt Configures a recipe for the Thermal Expansion Redstone Furnace, including input, output quantity, and energy requirements. ```groovy // Redstone Furnace mods.thermalexpansion.furnace.recipeBuilder() .input(item('minecraft:diamond')) .output(item('minecraft:clay') * 2) .energy(1000) .register() ``` -------------------------------- ### Thermal Expansion Magma Crucible Recipe Source: https://context7.com/cleanroommc/groovyscript/llms.txt Adds a recipe for the Thermal Expansion Magma Crucible, specifying an input item and a fluid output with a specific volume. ```groovy // Magma Crucible mods.thermalexpansion.crucible.recipeBuilder() .input(item('minecraft:clay')) .fluidOutput(fluid('lava') * 25) .register() ``` -------------------------------- ### Printing to Game Console in GroovyScript Source: https://context7.com/cleanroommc/groovyscript/llms.txt Use the standard `println` function to output messages directly to the game console, primarily for debugging purposes. ```groovy // Print to game chat (debug) println('This appears in console') ``` -------------------------------- ### Mekanism Metallurgic Infuser Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Define Mekanism Metallurgic Infuser recipes, including input item, infusion type, infusion amount, and output item. ```groovy mods.mekanism.metallurgic_infuser.recipeBuilder() .input(item('minecraft:nether_star')) .infuse(infusionType('groovy_example')) .amount(50) .output(item('minecraft:clay')) .register() ``` -------------------------------- ### Listen to Forge Events with Groovy Closures Source: https://context7.com/cleanroommc/groovyscript/llms.txt Use eventManager.listen to subscribe to Forge events. Custom game behavior can be implemented using Groovy closures. Canceled events will not proceed. ```groovy import net.minecraftforge.event.entity.living.EnderTeleportEvent import net.minecraftforge.event.world.BlockEvent import net.minecraft.util.text.TextComponentString // Listen to block break events eventManager.listen(BlockEvent.BreakEvent) { event -> event.setCanceled(true) event.player.sendMessage(new TextComponentString( "${event.getState().getBlock().getLocalizedName()} was prevented from being broken" )) } // Modify ender teleport damage eventManager.listen(EnderTeleportEvent) { event -> event.setAttackDamage(19.5f) } // Register custom commands minecraft.command.registerCommand('groovy_test', { server, sender, args -> sender.sendMessage(new TextComponentString('Hello from GroovyScript!')) }) // Modify game rules minecraft.game_rule.add('doDaylightCycle', 'false') minecraft.game_rule.add([ 'mobGriefing': 'false', 'keepInventory': 'true' ]) ``` -------------------------------- ### In-World Crafting: Explosion Conversion Source: https://context7.com/cleanroommc/groovyscript/llms.txt Defines a recipe that converts an item into another upon an explosion, with a specified success chance. ```groovy // Explosion conversion in_world_crafting.explosion.recipeBuilder() .input(item('minecraft:diamond')) .output(item('minecraft:nether_star')) .chance(0.4f) // 40% success rate .register() ``` -------------------------------- ### GroovyScript Vanilla Crafting Recipes Source: https://context7.com/cleanroommc/groovyscript/llms.txt Add, remove, or modify shaped and shapeless crafting table recipes using the GroovyScript crafting API. Supports recipe registration, removal by output or name, and replacement. ```groovy // Shaped crafting recipe crafting.shapedBuilder() .output(item('minecraft:diamond_block')) .row('DDD') .row('DGD') .row('DDD') .key('D', item('minecraft:diamond')) .key('G', ore('ingotGold')) .register() ``` ```groovy // Shapeless crafting recipe crafting.shapelessBuilder() .output(item('minecraft:clay')) .input([ item('minecraft:cobblestone'), item('minecraft:nether_star'), ore('dustRedstone') ]) .register() ``` ```groovy // Remove recipes by output crafting.removeByOutput(item('minecraft:gold_ingot')) // Remove recipe by name crafting.remove('minecraft:mossy_stonebrick') ``` ```groovy // Replace a recipe crafting.replaceByOutput(item('minecraft:ender_eye'), crafting.shapelessBuilder() .output(item('minecraft:ender_eye')) .input(item('minecraft:ender_pearl'), item('minecraft:blaze_rod')) ) ``` -------------------------------- ### Thermal Expansion Pulverizer Recipe Source: https://context7.com/cleanroommc/groovyscript/llms.txt Defines a recipe for the Thermal Expansion Pulverizer, specifying input items, output items, and the chance for a secondary output. ```groovy // Pulverizer recipe mods.thermalexpansion.pulverizer.recipeBuilder() .input(item('minecraft:diamond')) .output(item('minecraft:clay'), item('minecraft:diamond')) .chance(1) // 1% secondary output chance .register() ``` -------------------------------- ### Modify JEI Category Order Source: https://context7.com/cleanroommc/groovyscript/llms.txt Sets a custom order for recipe categories displayed in JEI. ```groovy // Modify category order mods.jei.category.setOrder( 'minecraft:crafting', 'jei.information', 'minecraft:smelting' ) ``` -------------------------------- ### GroovyScript Bracket Handlers Source: https://context7.com/cleanroommc/groovyscript/llms.txt Use bracket handlers to reference Minecraft objects like items, fluids, blocks, and ore dictionary entries. Supports basic references, quantities, metadata, NBT data, and block states. ```groovy // Item references item('minecraft:diamond') // Basic item item('minecraft:iron_ingot', 5) // Item with metadata item('minecraft:diamond_sword').withNbt([ display: [Name: 'Excalibur'], ench: [[id: 16, lvl: 5]] ]) // Fluid references fluid('water') // Basic fluid fluid('lava') * 1000 // Fluid with amount (1000mb) // Ore dictionary references ore('ingotGold') // Ore dictionary entry ore('plankWood') // Block and blockstate references block('minecraft:stone') // Basic block blockstate('minecraft:stone:1') // Block with metadata blockstate('minecraft:log', 'variant=spruce') // Block with properties // Other object types potion('minecraft:strength') // Potion effect enchantment('minecraft:sharpness') // Enchantment entity('minecraft:zombie') // Entity type biome('minecraft:plains') // Biome resource('minecraft:textures/items/apple.png') // Resource location gas('hydrogen') // Mekanism gas infusionType('carbon') // Mekanism infusion type brew('allure') // Botania brew ``` -------------------------------- ### Structured GroovyScript Error Logging Source: https://context7.com/cleanroommc/groovyscript/llms.txt Utilize the GroovyLog builder for creating detailed, structured error messages. This pattern is useful for logging complex error conditions with contextual information. ```groovy // Structured error logging with builder GroovyLog.msg('Error removing recipe') .add('could not find recipe with output {}', output) .error() .post() ``` -------------------------------- ### Mekanism Custom Infusion Type Source: https://context7.com/cleanroommc/groovyscript/llms.txt Define custom Mekanism infusion types with a specified texture and add them to the infusion system. ```groovy mods.mekanism.infusion.addType('groovy_example', resource('groovyscriptdev:blocks/mekanism_infusion_texture')) mods.mekanism.infusion.add('groovy_example', 10, item('minecraft:ice')) ``` -------------------------------- ### GroovyScript Ingredient Transformations Source: https://context7.com/cleanroommc/groovyscript/llms.txt Transform item ingredients in recipes to modify consumption behavior, such as reusing containers, damaging tools, or custom transformations using closures. ```groovy // Reuse item (don't consume in crafting) item('minecraft:iron_pickaxe').reuse() // Transform into another item after crafting item('minecraft:bucket').transform(item('minecraft:water_bucket')) // Damage item instead of consuming item('minecraft:diamond_pickaxe').transformDamage(10) // Custom transformation with closure item('minecraft:tnt').transform({ stack -> item('minecraft:diamond') }) ``` ```groovy // Combine in shaped recipe crafting.shapedBuilder() .output(item('minecraft:nether_star')) .row('TXT') .row('X X') .row('!X!') .key('T', item('minecraft:tnt')) .key('X', item('minecraft:clay').reuse()) .key('!', item('minecraft:tnt').transform({ _ -> item('minecraft:diamond') })) .register() ``` -------------------------------- ### Modify Mob and Chest Loot Tables Source: https://context7.com/cleanroommc/groovyscript/llms.txt Customize loot tables using the LootTablesLoadedEvent. This allows for adding, removing, or replacing loot entries and pools. Ensure correct table and pool names are used. ```groovy import com.cleanroommc.groovyscript.event.LootTablesLoadedEvent import net.minecraft.world.storage.loot.LootContext event_manager.listen { LootTablesLoadedEvent event -> // Add entry to stronghold library chests event.loot.getTable('minecraft:chests/stronghold_library') .getPool('main') .addEntry( event.loot.entryBuilder() .name('minecraft:diamond_block') .item(item('minecraft:diamond_block')) .weight(1) .quality(1) .build() ) // Replace chicken drops entirely event.loot.getTable('minecraft:entities/chicken').removePool('main') event.loot.getTable('minecraft:entities/chicken').addPool( event.loot.poolBuilder() .name('main') .entry( event.loot.entryBuilder() .item(item('minecraft:diamond')) .function { ItemStack stack, Random random, LootContext context -> stack.setCount(10) return stack } .weight(1) .build() ) .condition { Random random, LootContext context -> random.nextFloat() < 0.05f } .rollsRange(1.0f, 3.0f) .build() ) // Zombie drops with smelt function event.loot.getTable('minecraft:entities/zombie').removePool('main') event.loot.getTable('minecraft:entities/zombie').addPool( event.loot.poolBuilder() .name('main') .entry( event.loot.entryBuilder() .item(item('minecraft:potato')) .weight(1) .smelt() // Auto-smelt the drop .build() ) .randomChance(1.0f) .killedByNonPlayer() .rollsRange(1.0f, 3.0f) .build() ) } ``` -------------------------------- ### Manipulate Ore Dictionary Entries Source: https://context7.com/cleanroommc/groovyscript/llms.txt Manage ore dictionary tags by adding or removing specific items, clearing all entries for a tag, or checking item membership. ```groovy ore_dict.add('ingotGold', item('minecraft:nether_star')) ``` ```groovy ore_dict.remove('netherStar', item('minecraft:nether_star')) ``` ```groovy ore_dict.clear('plankWood') ``` ```groovy if (ore('ingotIron').matches(item('minecraft:iron_ingot'))) { log.info('Iron ingot is in ingotIron ore dict') } ``` -------------------------------- ### Hide JEI Categories Source: https://context7.com/cleanroommc/groovyscript/llms.txt Hides specific recipe categories from the JEI interface, such as the fuel category. ```groovy // Hide categories mods.jei.category.hideCategory('minecraft:fuel') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.