GregTechCEu / GregTech-Modern

GregTech CE Unofficial for modern versions
GNU Lesser General Public License v3.0
290 stars 171 forks source link

[Bug] Unable to add ore veins to Ad Astra's Moon #621

Closed DancingSnow0517 closed 11 months ago

DancingSnow0517 commented 11 months ago

GregTech CEu Version

1.0.17-build_323

Recipe Viewer Installed

JEI

Environment

SP

Cross-Mod Interaction

Yes

Expected Behavior

The ore vein add by KubeJS scripts should spawn on the moon.

Actual Behavior

No vein ore find on ad_astra moon

Steps to Reproduce

  1. Installed mods: gtceu-forge-1.20.1-1.0.17-build_323.jar ad_astra-forge-1.20.1-1.15.5.jar jei-1.20.1-forge-15.2.0.27.jar kubejs-forge-2001.6.4-build.107.jar

  2. Added the Startup scripts tag_prefixs.js:

    GTCEuStartupEvents.registry('gtceu:tag_prefix', event => {
    event.create('moon_stone', 'ore')
        .langValue('Moon %s Ore')
        .materialIconType(GTMaterialIconType.ore)
        .unificationEnabled(true)
        .generationCondition(ItemGenerationCondition.hasOreProperty)
        .stateSupplier(() => Block.getBlock('ad_astra:moon_stone').defaultBlockState())
    })

world_gen_layers.js

GTCEuStartupEvents.registry('gtceu:world_gen_layer', event => {
    event.create('t_moon')
        .target(['ad_astra:moon_stone', 'minecraft:soul_soil'])
})
  1. Added the Server scripts gt_ore_veins.js

    GTCEuServerEvents.oreVeins(event => {
    const $DikeBlockDefinition = Java.loadClass('com.gregtechceu.gtceu.api.data.worldgen.generator.DikeVeinGenerator$DikeBlockDefinition')
    const $IndicatorPlacement = Java.loadClass('com.gregtechceu.gtceu.api.data.worldgen.generator.indicators.SurfaceIndicatorGenerator$IndicatorPlacement')
    
    event.add('test_moon_vein', builder => {
        builder.clusterSize(16)
            .weight(40)
            .density(4)
            .discardChanceOnAirExposure(0.0)
            .addSpawnDimension('ad_astra:moon')
            .addSpawnBiome('#ad_astra:has_structure/lunarian_village_biomes')
            .layer(GTWorldGenLayers.getByName('t_moon'))
            .heightRange({
                height: {
                    type: 'uniform',
                    min_inclusive: {
                        absolute: -50
                    },
                    max_inclusive: {
                        absolute: 10
                    }
                }
            })
            .generator(builder.generatorBuilder('gtceu:dike')
                .withBlock(new $DikeBlockDefinition['(com.gregtechceu.gtceu.api.data.chemical.material.Material,int,int,int)'](GTMaterials.Galena, 3, -50, 20))
                .withBlock(new $DikeBlockDefinition['(com.gregtechceu.gtceu.api.data.chemical.material.Material,int,int,int)'](GTMaterials.Lead, 1, -50, 20))
                .withBlock(new $DikeBlockDefinition['(com.gregtechceu.gtceu.api.data.chemical.material.Material,int,int,int)'](GTMaterials.Silver, 1, -50, 20))
                .minYLevel(-50)
                .maxYLevel(10)
                .parent()
                .surfaceIndicatorGenerator(indicator => indicator
                    .surfaceRock(GTMaterials.Galena)
                    .placement($IndicatorPlacement.ABOVE)
                )
            )
    })
    })
  2. Restart Minecraft Client
  3. Create a new World and run command execute in as_astra:moon run tp 0 120 0
  4. Give myself Prospector, doesn't find any custom ore vein.

Additional Information

No response

screret commented 11 months ago

you didn't set valid dimensions for the world gen layer.

DancingSnow0517 commented 11 months ago

Modifying scripts world_gen_layers.js

GTCEuStartupEvents.registry('gtceu:world_gen_layer', event => {
    event.create('t_moon')
        .target(['ad_astra:moon_stone', 'minecraft:soul_soil'])
        .dimensions(['ad_astra:moon'])
})

Still not working......

DancingSnow0517 commented 11 months ago

Use addDimension methon doesn't work too...

GTCEuStartupEvents.registry('gtceu:world_gen_layer', event => {
    event.create('t_moon')
        .target(['ad_astra:moon_stone', 'minecraft:soul_soil'])
        .addDimension('ad_astra:moon')
})
Arborsm commented 11 months ago

https://github.com/Arborsm/Arbor-s-GTceu-Modern-Pack/blob/main/kubejs/server_scripts/gregtech/ores.js works, might help you, and the tagprefix registry on kjs has some issues, recommend to make a mod for it.

DancingSnow0517 commented 11 months ago

I write simple mod to registry tagprefix, and then, it works!!! Thanks

DancingSnow0517 commented 11 months ago

https://github.com/Arborsm/Arbor-s-GTceu-Modern-Pack/blob/main/kubejs/server_scripts/gregtech/ores.js works, might help you, and the tagprefix registry on kjs has some issues, recommend to make a mod for it.

I have some problem in write mod, my mod build script like your ModPack-Core, but can't runClient in Dev environment.

May I ask if it's convenient to add a specific contact information? Thanks