#Multi block crystal growth

10 messages · Page 1 of 1 (latest)

quick owl
#
StartupEvents.registry("block", event => {
    event.create("gtceu:sapphire_seed_crystal")
        .displayName("Sapphire Seed Crystal")
        .property(BlockProperties.FACING)
        .placementState(context => context.set(BlockProperties.FACING, context.clickedFace))
        .soundType("amethyst")
        .resistance(6).hardness(5)
        .tagBlock("minecraft:mineable/pickaxe")
        .tagBlock("minecraft:needs_iron_tool")
        .tagBlock("forge:seed_crystals/sapphire")
        .requiresTool(true)
        .color(0, 0x3235e3)//Sapphire primary and secondary colours
        .color(1, 0x211455)
        .randomTick(tick => {
            const { block, level, random } = tick
            const pos = block.getPos()
            const Directions = Java.loadClass("net.minecraft.core.Direction");

            Directions.values().forEach(face => {
                let fac = block.properties.get("facing")
                if(fac.toString() != face) {
                    const offsetPos = pos.relative(face);
                    const adjacentBlockId = level.getBlock(offsetPos).id;
                    const chanceOfGrowth = 0.1;

                    const blockTypes = {
                        "minecraft:air": "gtceu:raw_sapphire_block",
                        "gtceu:raw_sapphire_block": "gtceu:sapphire_block",
                        "gtceu:sapphire_block": "gtceu:sapphire_seed_crystal"
                    };
                    const blockType = blockTypes[adjacentBlockId];
                    if (blockType && random.nextFloat() < chanceOfGrowth) {
                        if(blockType == "gtceu:sapphire_seed_crystal") {
                            level.setBlock(offsetPos, Block.id(blockType, {facing: fac}).blockState, 3)
                        } else {
                            level.setBlock(offsetPos, Block.getBlock(blockType).defaultBlockState(), 3)
                        }
                    }
                }
            })
        })
})
stone turret
#

Oh no

#

It spreads

#

This could be useful for regenerating ore veins

mystic lichen
#

What version(s) is this for? There's no version tag

paper canopy
#

it seems to be based on the "direction" it is placed

quick owl
#

Yeah, intentional

#

The original idea was to limit its growth, but I couldn't get blockstates working

paper canopy
#

i think i may have fixed it. testing now