### Custom Processing Logic with NyxProcessingLogic (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Demonstrates how to implement custom processing logic for machines using NyxProcessingLogic, supporting overclock types and automatic parameter application. It requires importing rhynia.nyx.api.process.NyxProcessingLogic and OverclockType. The example shows both basic and auto-configured logic implementations. ```kotlin import rhynia.nyx.api.process.NyxProcessingLogic import rhynia.nyx.api.process.OverclockType // Basic processing logic class MyMachine : NyxMTEBase { override fun createProcessingLogic(): ProcessingLogic = NyxProcessingLogic().apply { setMaxParallelSupplier { rMaxParallel } setOverclock(OverclockType.PerfectOC) } } // Auto-configured processing logic class AutoMachine : NyxMTEBase, ProcessInfo { override val rMaxParallel: Int get() = 256 override val rEuModifier: Float get() = 0.8f override val rTimeModifier: Float get() = 0.5f override val rOverclockType: OverclockType get() = OverclockType.PerfectOC override fun createProcessingLogic(): ProcessingLogic = NyxAutoProcessingLogic(this) // Auto-applies all ProcessInfo values } ``` -------------------------------- ### Create GregTech Recipes with Kotlin DSL Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Demonstrates how to use the `withRecipeMap` function to define GregTech recipes. It supports basic recipe creation, conditional recipes based on configuration, and iterative recipe generation for tiered components. Requires GregTech API and Nyx API imports. ```kotlin import rhynia.nyx.api.recipe.dsl.withRecipeMap import rhynia.nyx.api.enums.ref.Tier import gregtech.api.recipe.RecipeMaps // Basic recipe creation withRecipeMap(RecipeMaps.electrolyzerRecipes) { newRecipe { input { +Materials.Redstone.getDust(32) } output { +NyxMaterials.Restone.getDust(24) } durSec(4) // Duration in seconds (4 * 20 = 80 ticks) eut(Tier.LV) // EU/t from tier (30 EU/t) } } // Conditional recipe withRecipeMap(RecipeMaps.assemblerRecipes) { newRecipeIf(ConfigRecipe.RECIPE_EASY_WIRELESS) { itemInputs( Tier.IV.getEnergyHatch(1), Tier.IV.getCircuit(1), Tier.IV.getComponent(Tier.Component.Emitter, 1) ) fluidInputs(Tier.IV.getIngotSolder(1)) itemOutputs(Tier.IV.getEnergyWireless(1)) eut(Tier.IV) durSec(4) } } // Iterative recipe generation withRecipeMap(RecipeMaps.assemblerRecipes) { newRecipeIter(1..7) { level -> itemInputs(tier.getLaserTarget(level, 1)) itemOutputs(tier.getLaserEnergyWireless(level, 1)) eut(tier) durSec(4) } } ``` -------------------------------- ### Recipe Configuration Setting (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt A simple Kotlin configuration setting to enable easy wireless energy recipes. When set to true, it simplifies the crafting recipes for wireless hatches, allowing them to be made from regular hatches with tier-appropriate components. ```kotlin // Enable easy wireless energy recipes // When true, wireless hatches can be crafted from regular hatches // with simpler recipes using tier-appropriate components ConfigRecipe.RECIPE_EASY_WIRELESS = true ``` -------------------------------- ### Nyx Proxy: Universal Recipe Machine (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt The NyxProxy machine allows any GregTech machine's recipes to be executed by placing that machine in the controller slot. Parallel processing scales logarithmically with the stack size of the machine in the controller. ```kotlin // Place any GT machine in controller slot to use its recipes // Parallel calculation: amount^(log10(MAX_INT)/log10(64)) ≈ amount^3.98 // Example: Place 64x Electric Blast Furnace to get max parallels // Use screwdriver to cycle through available recipe maps class NyxProxy : NyxMTECubeBase { override fun getRecipeMap(): RecipeMap<*>? = pMode?.current override val rMaxParallel: get() = LogarithmicMapper[pControllerStackSize] // Logarithmic parallel mapping object LogarithmicMapper { operator fun get(i: Int): Int { // 1 -> 1, 64 -> Int.MAX_VALUE val factor = log10(Int.MAX_VALUE.toDouble()) / log10(64.0) return i.toDouble().pow(factor).toLong().coerceAtMost(Int.MAX_VALUE.toLong()).toInt() } } } ``` -------------------------------- ### Access GregTech Components using Tier Enum Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Illustrates how to use the `Tier` enum to access various GregTech components, including motors, pumps, circuits, hatches, and wireless hatches. It also shows how to retrieve tier-appropriate fluids like solder and access tier voltage values and groups. ```kotlin import rhynia.nyx.api.enums.ref.Tier // Get components by tier val motor = Tier.IV.getComponent(Tier.Component.ElectricMotor, 4) val pump = Tier.LuV.getComponent(Tier.Component.ElectricPump, 2) val emitter = Tier.UV.getComponent(Tier.Component.Emitter, 1) // Get circuits and wraps val circuit = Tier.ZPM.getCircuit(16) // 16x ZPM circuits val circuitWrap = Tier.UHV.getCircuitWrap(1) // 1x UHV circuit wrap // Get hatches val energyHatch = Tier.UV.getEnergyHatch(1) val dynamoHatch = Tier.LuV.getDynamoHatch(1) val energy4A = Tier.EV.getEnergyHatch4A(1) val energy16A = Tier.IV.getEnergyHatch16A(1) val energy64A = Tier.LuV.getEnergyHatch64A(1) // Get wireless hatches val wirelessEnergy = Tier.UHV.getEnergyWireless(1) val wirelessDynamo = Tier.UEV.getDynamoWireless(1) val wirelessLaser = Tier.UIV.getLaserEnergyWireless(3, 1) // Get solder fluid (tier-appropriate) val solder = Tier.IV.getSolder(1000) // 1000L appropriate solder val solderIngot = Tier.ZPM.getIngotSolder(4) // 4 ingots worth of solder // Voltage values val voltage = Tier.UV.voltage // 524288L val recipeVoltage = Tier.UV.voltageRecipe // VP[tier] // Tier groups for iteration Tier.G_ALL // All tiers: ULV through MAX Tier.G_COMMON // Common tiers: LV through UXV (excludes ULV, MAX) Tier.G_MEDIUM // Medium-high tiers: IV through UXV ``` -------------------------------- ### RecipeBuilder Element Handling and Timers Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Details the `RecipeBuilder` class and its `ElementCollector` for managing recipe inputs and outputs using Kotlin's unary plus operator. Includes methods for setting duration in ticks, seconds, minutes, or hours, and for setting EU/t values. ```kotlin @RecipeDsl class RecipeBuilder(private val backend: IRecipeMap) { val input = ElementCollector() val output = ElementCollector() // Duration helpers fun dur(value: Int) // Raw ticks fun durSec(value: Int) // Seconds (value * 20) fun durMin(value: Int) // Minutes (value * 1200) fun durHour(value: Int) // Hours (value * 72000) // EU/t setters fun eut(tier: Tier) // From tier enum fun eut(value: Long) // Direct value } // ElementCollector usage @RecipeDsl value class ElementCollector(private val objects: MutableList = mutableListOf()) { operator fun Any.unaryPlus() { objects.add(this) } fun item(): Array // All non-fluid items fun itemOnly(): Array // Only ItemStacks fun fluid(): Array // Only FluidStacks } ``` -------------------------------- ### Machine Configuration Settings (Java) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Defines static configuration parameters for machines in the Nyx mod, including MTE ID offset, and enable/disable flags for various machines like Copier, Proxy, Converter, and Injector. This Java code snippet illustrates how to set default values for these configurations. ```java // ConfigMachine.java settings public class ConfigMachine { // MTE ID offset for conflict resolution @Config.DefaultInt(17800) public static int MTE_ID_OFFSET; // Enable/disable individual machines @Config.DefaultBoolean(true) public static boolean MTE_COPIER; @Config.DefaultInt(100) public static int MTE_COPIER_TICK; // Tick rate for copier @Config.DefaultBoolean(true) public static boolean MTE_PROXY; @Config.DefaultBoolean(true) public static boolean MTE_CONVERTER; @Config.DefaultBoolean(true) public static boolean MTE_INJECTOR; } ``` -------------------------------- ### Define Custom GT5U Material with NyxMaterial (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Defines a custom material using the NyxMaterial class, enabling various item and fluid types with specified properties. It requires the rhynia.nyx.common.material.generation and gregtech.api.enums packages. The output includes generated items like dusts, ingots, plates, gems, and fluids (liquid, molten, gas, plasma), as well as their corresponding cells. ```kotlin import rhynia.nyx.common.material.generation.NyxMaterial import gregtech.api.enums.FluidState.* import gregtech.api.enums.TextureSet // Define a new material val MyMaterial = NyxMaterial( id = 100, // Unique ID (0-32767) internalName = "mymaterial", // Internal name (alphanumeric only) color = shortArrayOf(255, 128, 0, 255) // RGBA color ) { textureSet = TextureSet.SET_METALLIC protons = 50 mass = 120 // Add elemental tooltip (subscripted numbers) addElementalTooltip("Fe2O3") // Displays as Fe₂O₃ // Enable item types enableDusts() // dust, dustSmall, dustTiny enableIngots() // ingot, ingotHot, nugget enablePlates() // plate, plateDouble, etc. enableGems() // gem, gemChipped, etc. enableMisc() // stick, bolt, gear, etc. // Enable fluids with temperatures enableFluids( LIQUID to 300, // Liquid at 300K MOLTEN to 1800, // Molten at 1800K GAS to 400, // Gas at 400K PLASMA to 10000 // Plasma at 10000K ) } // Using the material val dust = MyMaterial.getDust(64) val ingot = MyMaterial.getIngot(32) val plate = MyMaterial.getPlate(16) val gem = MyMaterial.getGem(8) // Get fluids val liquid = MyMaterial.getFluid(1000) // 1000L liquid val molten = MyMaterial.getMolten(144) // 144L molten (1 ingot) val gas = MyMaterial.getGas(1000) // 1000L gas val plasma = MyMaterial.getPlasma(1000) // 1000L plasma // Get cells val liquidCell = MyMaterial.getCell(LIQUID, 1) val moltenCell = MyMaterial.getCell(MOLTEN, 1) // Check prefix validity val hasPlate = MyMaterial.isTypeValid(OrePrefixes.plate) // true ``` -------------------------------- ### FluidStack Utility Extensions (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Offers extension functions for FluidStack operations in Kotlin, such as comparing fluid IDs and setting the fluid amount. It requires the rhynia.nyx.api.util package. These utilities simplify common fluid manipulation tasks. ```kotlin import rhynia.nyx.api.util.* // ID comparison val sameFluid = fluidA idEqual fluidB // Compare by fluid ID val matchesFluid = fluidStack idEqual fluid // Set amount (modifies in place) val fluid = someFluid size 1000 // Returns same FluidStack with 1000L ``` -------------------------------- ### ItemStack Utility Extensions (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt Provides extension functions for manipulating ItemStacks in Kotlin, including setting stack size, copying with different amounts, and creating debug items. It requires the rhynia.nyx.api.util package. These functions allow for safe and unsafe manipulation of item quantities. ```kotlin import rhynia.nyx.api.util.* // Set stack size (modifies in place) val stack = someItem size 64 // Returns same stack with size 64 val stack2 = someItem size 1000L // Supports Long // Copy with new size val copy = originalStack.copyAmount(32) // Safe copy, capped at 64 val unsafeCopy = originalStack.copyAmountUnsafe(1000) // Unsafe, allows >64 val smartCopy = originalStack.copyAmountAnyway(128) // Uses unsafe if >64 // Debug item creation val debugStack = debugItem("Error message", "Additional info") ``` -------------------------------- ### Nyx Converter: OreDict Material Converter (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt The NyxConverter machine transforms items between different OreDict prefixes of the same material. Users place an item representing the target OreDict in the controller slot and then input items to be converted. ```kotlin // Example: Convert ingots to plates // 1. Place a copper plate in controller slot (sets target prefix to "plate") // 2. Input copper ingots // 3. Outputs copper plates based on material amount ratios class NyxConverter : NyxMTECubeBase { override fun checkProcessing(): CheckRecipeResult { val controllerStack = controllerSlot pOrePrefix = MaterialMapper.lookupOrePrefix(pControllerToken) ?: return pStop(true) // Calculate output based on material amounts // e.g., 1 ingot (144L) -> 1 plate (144L) val targetMaterialAmount = targetPrefix.mMaterialAmount val outputCount = totalAmount / targetMaterialAmount mOutputItems = outputData.flatMap { (material, count) -> material.getByOrePrefixUnsafe(targetPrefix, count) }.toTypedArray() return pStart(outputData.size * 20) } } ``` -------------------------------- ### Nyx Copier: Item and Fluid Duplicator (Kotlin) Source: https://context7.com/rhnu/gtnh-nyx/llms.txt The NyxCopier machine duplicates items or fluids. It can be switched between item and fluid modes using a screwdriver and outputs specified amounts to connected buses/hatches. The machine operates on a configurable tick rate. ```kotlin // Structure: 3x3x3 cube with SolidSteel casings // Place an item in controller slot to copy // Use screwdriver to switch between item/fluid mode // Set amount via GUI text field // The copier extends NyxMTECubeBase for structure class NyxCopier : NyxMTECubeBase { override val sCasingBlock: Pair get() = GregTechAPI.sBlockCasings2 to 0 override val sCasingHatch: Array> get() = arrayOf(OutputBus, OutputHatch) } // Configuration in config/Nyx/MACHINE.cfg: // MTE_COPIER=true // Enable/disable machine // MTE_COPIER_TICK=100 // Processing interval in ticks ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.