Skip to content
Drackion edited this page Oct 21, 2023 · 52 revisions

Startup Scripts

Element Creation

GTCEuStartupEvents.registry('gtceu:element', event => {
   event.create('test_element', 27, 177, -1, null, 'test', false);
})

Custom Icon Sets

GTCEuStartupEvents.registry('gtceu:material_icon_set', event => {
   event.create('test').parent(GTMaterialIconSet.SHINY)
})

Kubejs Items:
kubejs\assets\gtceu\textures\item\material_sets\test\
kubejs\assets\gtceu\models\item\material_sets\test\
Kubejs Blocks/Frames:
kubejs\assets\gtceu\textures\block\material_sets\test\

Material Creation

GTCEuStartupEvents.registry('gtceu:material', event => {
   event.create("test")
        .ingot(1)
        .element(GTElements.get("test_element"))
        .color(0x2176ff).iconSet(GTMaterialIconSet.METALLIC)
        .flags(GTMaterialFlags.GENERATE_PLATE, GTMaterialFlags.GENERATE_ROD, GTMaterialFlags.GENERATE_FRAME)

   event.create('andesite_alloy')
        .ingot(1)
        .components('1x andesite', '1x iron')
        .color(0x99B09F).iconSet(GTMaterialIconSet.DULL)
        .flags(GTMaterialFlags.GENERATE_PLATE, GTMaterialFlags.GENERATE_GEAR, GTMaterialFlags.GENERATE_SMALL_GEAR)

   GTMaterials.Iron.addFlags(GTMaterialFlags.GENERATE_FRAME) //Adds flags to pre-existing GT materials
})

Material Flags

  • GENERATE_BOLT_SCREW
  • GENERATE_DENSE
  • GENERATE_FINE_WIRE
  • GENERATE_FOIL
  • GENERATE_FRAME
  • GENERATE_GEAR
  • GENERATE_LENS
  • GENERATE_LONG_ROD
  • GENERATE_PLATE
  • GENERATE_RING
  • GENERATE_ROD
  • GENERATE_ROTOR
  • GENERATE_ROUND
  • GENERATE_SMALL_GEAR
  • GENERATE_SPRING
  • GENERATE_SPRING_SMALL

Icon Sets

  • BRIGHT
  • CERTUS
  • DIAMOND
  • DULL
  • EMERALD
  • FINE
  • FLINT
  • FLUID
  • GAS
  • GEM_HORIZONTAL
  • GEM_VERTICAL
  • GLASS
  • LAPIS
  • LIGNITE
  • MAGNETIC
  • METALLIC
  • NETHERSTAR
  • OPAL
  • QUARTZ
  • ROUGH
  • RUBY
  • SAND
  • SHINY
  • WOOD
  • Custom Icon Sets

Adding To Pre-Existing Materials

const $PropertyKey = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey')
const $OreProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty')
const $FluidPipeProperties = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidPipeProperties')
const $WireProperties = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties')
const $ToolStats = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.ToolProperty')

GTCEuStarupEvents.registry('gtceu:material', event => {
    GTMaterials.HighOctaneGasoline.setProperty($PropertyKey.ORE, new $OreProperty(3, 4, true)) 
    //OreProperty(Primary Output Multiplier, Byproduct Multiplier, Is Emissive)
    GTMaterials.HighOctaneGasoline.setProperty($PropertyKey.FLUID_PIPE, new $FluidPipeProperties(6942000, 4500, true, true, true, true, 4))
    //FluidPipeProperties(Max Fluid Temp, Fluid Throughput, Gas Proof, Acid Proof, Cryo Proof, Plasma Proof, Channels)
    GTMaterials.Wood.setProperty($PropertyKey.WIRE, new $WireProperties(GTValues.V[GTValues.ULV], 69, 0, true))
    //WireProperties(Voltage, Amperage, Eu Loss, Is Superconductor)
})

Recipe Type Creation

GTCEuStartupEvents.registry('gtceu:recipe_type', event => {
    event.create('test_recipe_type')
        .category('test') //Used in the GTlib / LDlib ui editor
        .setEUIO('in')
        .setMaxIOSize(3, 4, 4, 3) //Max Item Inputs, Max Item Outputs, Max Fluid Inputs, Max Fluid Outputs
        .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY)
		.setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, FillDirection.LEFT_TO_RIGHT)
	    .setSound(GTSoundEntries.COOLING);

    if (GTCEu.isCreateLoaded()) {
        event.create('test_kinetic_recipe_type')
            .category('kinetic')
            .setMaxIOSize(3, 1, 2, 1) 
            .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY)
            .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
            .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, FillDirection.LEFT_TO_RIGHT)
            .setSound(GTSoundEntries.FIRE)
            .setMaxTooltip(5) // if you may add a rpm condition, it will help adjust JEI layout
    }
})

Machine & Multiblock Creation

GTCEuStartupEvents.registry('gtceu:machine', event => {
//steam
    event.create('test_simple_steam_machine', 'steam', true) //(ID, type, Has High Pressure Varient)
        .recipeType('test_recipe_type')
//electric
    event.create('test_electric', 'simple', GTValues.LV, GTValues.MV, GTValues.HV, GTValues.EV, GTValues.IV) //(ID, Type, Voltage Teirs)
        .recipeType('test_recipe_type')
        .tankScalingFunction(tier => tier * 3200)
//multi
     event.create('test_simple_multiblock', 'multiblock')
            .rotationState(RotationState.NON_Y_AXIS)
            .recipeTypes('test_recipe_type') // or .recipeTypes( ) if you want to have the multi to have more than one recipe types
            .appearanceBlock(GTBlocks.CASING_STAINLESS_CLEAN)
            .pattern(definition => FactoryBlockPattern.start()
                .aisle("BBB", "XXX", "XXX")
                .aisle("BBB", "X#X", "XMX")
                .aisle("BBB", "XSX", "XXX")
                .where('S', Predicates.controller(Predicates.blocks(definition.get())))
                .where('B', Predicates.blocks("minecraft:stone"))
                .where('X', Predicates.blocks(GTBlocks.CASING_STAINLESS_CLEAN.get()).setMinGlobalLimited(5)
                    .or(Predicates.autoAbilities(definition.getRecipeTypes())))
                .where('M', Predicates.abilities(PartAbility.MUFFLER).setExactLimit(1))
                .where('#', Predicates.air())
                .build())
            .workableCasingRenderer("gtceu:block/casings/solid/machine_casing_clean_stainless_steel",
                "gtceu:block/multiblock/implosion_compressor", false)
//Kinetic
    if (GTCEU.isCreateLoaded()) {
	    event.create('test_simple_kinetic_machine', 'kinetic', GTValues.LV, GTValues.MV, GTValues.HV, GTValues.EV, GTValues.IV)
            .recipeType('test_kinetic_recipe_type', true, true)
		    .tankScalingFunction(tier => tier * 3200)

        event.create('test_kinetic_multiblock', 'multiblock')
            .rotationState(RotationState.NON_Y_AXIS)
            .recipeTypes('test_kinetic_recipe_type')
            .appearanceBlock(GTBlocks.CASING_STAINLESS_CLEAN)
            .pattern(definition => FactoryBlockPattern.start()
			.aisle("XXX", "XXX", "XXX")
            .aisle("XXX", "X#X", "XXX")
            .aisle("XXX", "XSX", "XXX")
            .where('S', Predicates.controller(Predicates.blocks(definition.get())))
            .where('X', Predicates.blocks(GTBlocks.CASING_STAINLESS_CLEAN.get()).setMinGlobalLimited(14)
                .or(Predicates.autoAbilities(definition.getRecipeTypes()))
                .or(Predicates.abilities(PartAbility.INPUT_KINETIC).setExactLimit(1)))
            .where('#', Predicates.air())
            .build())
            .workableCasingRenderer("gtceu:block/casings/solid/machine_casing_clean_stainless_steel",
                    "gtceu:block/multiblock/implosion_compressor", false);
    }

})

Coil Creation

StartupEvents.registry('block', event => {
    event.create('infinity_coil_block', 'gtceu:coil')
        .temperature(100)
        .level(0)
        .energyDiscount(1) //the default is 1
        .tier(10)
        .coilMaterial(GTMaterials.get('infinity'))
        .texture('kubejs:block/example_block')
        .tagBlock('forge:mineable/wrench')
        .hardness(5)
        .requiresTool(true)
        .material('metal')
})

Custom Ore "Stone" Types

GTCEuStartupEvents.registry('gtceu:tag_prefix', event => {
   event.create('bedrock', 'ore')
        .stateSupplier(() => Blocks.BEDROCK.defaultBlockState())
        .material(Material.STONE)
        .color(MaterialColor.STONE)
        .sound(SoundType.STONE)
        .unificationEnabled(true)
        .materialIconType(GTMaterialIconType.ore)
        .generationCondition(ItemGenerationCondition.hasOreProperty);
})

Server Scripts

Recipe Additions

ServerEvents.recipes(event => {
    event.recipes.gtceu.alloy_smelter('recipe_id')             
        .itemInputs('gtceu:wire_single.copper', 'gtceu:wire_single.nickel')
        .itemOutputs('2x gtceu:wire_single.cupronickel')
        .duration(120)
        .EUt(16)

	    event.recipes.test_kinetic_recipe_type(mod_id:recipe_id) //'gtceu:test'
		    .itemInputs('minecraft:dirt')
		    .itemOutputs('minecraft:diamond')
    		.duration(100)
	    	.EUt(24)
		    .rpm(8);
})

Additional values

  • .inputFluids(Fluid.of('minecraft:water', 1000))
  • .outputFluids(Fluid.of('minecraft:water', 144))
  • .inputStress(32)
  • .rpm(8)
  • .chancedOutput(Item.of('minecraft:dirt', 1), 5000, 500) //('item_id', count, primary chance, addition chance per overclock) 5000 = 50%
  • .circuit(1) //adds a circuit to the recipe with the configuration of 1