Skip to content

How To Use

benbenlaw edited this page Jan 27, 2026 · 15 revisions

The best way to add custom keys is to use KubeJS to create the custom key items

If you are creating rooms you want to add a door shape on the north side (if you are inside) this will make sure the rotation is applied correctly

In your startup scripts

StartupEvents.registry('item', event => {
    //Create a custom key item like this
    event.create("test_key", 'roomopolis_key')
        //String location of the template you want to spawn example file is found here data/roomopolis/structures/tiny_room.nbt
        .templateId("roomopolis:tiny_room")
        //The structure is always placed a block behind the block you click on as the player, the height adjustment allows you to adjust the height postion the template is spawned
        .heightAdjustment(1)
        //keyBlock is optional and not needed, if a block is defined here keys will only work on that block
        .keyBlock("minecraft:iron_block")
        //Is the key consumed when used (optional), if not present keys wont be used
        .consumeKey(false)
        //frontAdjustment is optional and not needed, if a number is defined here the structure will be placed that many blocks in front of the block you click on as the player negative values work. example will place the structure 12 block in front of the player (10 from modifier and 2 from the roomopolis default placements)
        .frontAdjustment(10)
         //remove door prents the placement removing a 2x1 door shape
        .removeDoor(false)
        //When true the key can only be used on the side of the block clicked on, when false the key can be used on any side of the block, this is option and defaults to true if not present
        .sideOnlyPlacement(false)
         //When true keys can only be used on the top of a block, defaults to false must set sideOnlyPlacement to false for it to work
         .topOnlyPlacement(true)
         //When true the player will require those blocks in there inventory to use the key, optional and defaults to false if not present
        .blocksRequired(true)
         //When true the template will be placed ignoring all strucutre checks and replacing all blocks in the area, options and defaults to false, false is normal checking and preventing if blocks are in the way
        .overrideExistingBlocks(false)
        //Create a custom door space, each direction the area will be cleared
        .doorLeft(1)
        .doorRight(2)
        .doorUp(4)
        .doorDown(2)
//Structures placed inside water when valid are automatically waterlogged by vanilla minecraft, using .replaceWaterLoggedBlocks(true) will paste the block without being waterlogged
        .replaceWaterLoggedBlocks(true/false)

})

Clone this wiki locally