GregTechCEu Modern

GregTechCEu Modern

6M Downloads

KJS examples for adding machines, coils and multiblocks

lynxx131 opened this issue ยท 3 comments

commented

Cross-mod Integration

No response

Feature Description

I'm looking to use the KJS integration in this mod to add new machines, multiblocks and coil tiers but I am somewhat new to KJS having come from 1.12 previously and looking at the Java classes for the KJS integration is not enlightening me unfortunately as I've not really developed mods that use KJS.

Does anyone have an examples of doing the following with GTCEU in KJS on 1.19.2?

  • Add a simple machine
  • Add a new tier of coil
  • Add new multiblock

Thanks in advance

commented

will be moved to https://mikerooni.github.io/gtceu-modern-docs/Modpacks/KubeJS/Startup-Scripts/Custom-Coils/ at some point.

nice work! I'm looking for some example like this.
I'm trying to modify the preview block's BlockState, and i copied and modified KJS script from ATM9 (.shapeInfo(controller => MultiblockShapeInfo.builder()):

["where(char,net.minecraft.world.level.block.state.BlockState)"]('Q', Block.getBlock("mekanism:supercharged_coil").defaultBlockState().setValue(BlockProperties.FACING, Direction.EAST))
		["where(char,net.minecraft.world.level.block.state.BlockState)"]('q', Block.getBlock("mekanism:supercharged_coil").defaultBlockState().setValue(BlockProperties.FACING, Direction.WEST))
		["where(char,net.minecraft.world.level.block.state.BlockState)"]('R', Block.getBlock("mekanism:supercharged_coil").defaultBlockState().setValue(BlockProperties.FACING, Direction.SOUTH))
		["where(char,net.minecraft.world.level.block.state.BlockState)"]('r', Block.getBlock("mekanism:supercharged_coil").defaultBlockState().setValue(BlockProperties.FACING, Direction.NORTH))
		["where(char,net.minecraft.world.level.block.state.BlockState)"]('S', Block.getBlock("mekanism:supercharged_coil").defaultBlockState().setValue(BlockProperties.FACING, Direction.DOWN))
		["where(char,net.minecraft.world.level.block.state.BlockState)"]('s', Block.getBlock("mekanism:supercharged_coil").defaultBlockState().setValue(BlockProperties.FACING, Direction.UP))
		["where(char,net.minecraft.world.level.block.state.BlockState)"]('H', Block.getBlock('gtceu:uv_parallel_hatch').defaultBlockState().setValue(BlockProperties.FACING, Direction.SOUTH))

..And modified to this (I've changed the char inside the .aisle too):

		["where(char,net.minecraft.world.level.block.state.BlockState)"]('b', Block.getBlock('ae2:smooth_sky_stone_slab')
			.defaultBlockState().setValue(BlockProperties.SLAB_TYPE, SlabType.BOTTOM))
		["where(char,net.minecraft.world.level.block.state.BlockState)"]('p', Block.getBlock('ae2:smooth_sky_stone_slab')
			.defaultBlockState().setValue(BlockProperties.SLAB_TYPE, SlabType.TOP))

however it doesnt work (the whole list of JEI ingame mutliblock preview is missing).
So i'm using the latest usable script version:

		.where('b', Block.getBlock('ae2:smooth_sky_stone_slab'))
		.where('p', Block.getBlock('ae2:smooth_sky_stone_slab'))

And any idea about this Multiblock machine script should i know, or do you have any example like this? especially if I want to change multiply BlockState.
Edit: I hate code mark.