Jigsaw

This page will go over Basics in Jigsaw

Tutorial Video

Astrash's written tutorial

This is a tutorial based on Astrash written tutorial in discord.

Jigsaw pieces are basically objects with jigsaw connectors plus some other stuff. A jigsaw piece is just a config file, with an object attached to it - multiple pieces could share the same object (if that's what you want to do)

Pieces can be created with /iris jigsaw create <name> <pack> <object>, this is where you place your connectors. When you use that command, a copy of that specified object will spawn in the world, with that copy, right click block faces to add connectors, and shift right click to remove.

Once finished you can use /iris jigsaw save to save that jigsaw piece, and a config file will be automatically generated with your connectors.

Connectors are stored as json objects, and have some key properties. For now the only important parts you have to worry about are "pools", "position" and "direction".

INSERT CODE EXAMPLE HERE

{
    "targetName": "*",
    "innerConnector": false,
    "name": "",
    "pools": ["
        stronghold/paths"
    ],
    "position": {
        "x": -3,
        "y": -5,
        "z": 0
    },
    "direction": "WEST_NEGATIVE_X"
}

Once you create a piece, there will be a folder called jigsaw-pieces in your pack folder, which will be automatically set up with the essentials for a piece, the only thing you really need to change is the "pools" option, which is where you tell Iris what you want that connector to attach to

Now try creating a test object the way any object would be made, maybe something like square like so

Just for the sake of learning, try make 3 pieces like so

The next step after you have your pieces is to create a Jigsaw structure, here is an example of the stronghold structure. Ensure you make a folder called jigsaw-structures and create a new json file titled after your structure. This could be called anything you want. Copy the config here and fill out the piece with the one you have already made

{
 "maxDepth": 3,
    "pieces": [
        "name of the piece you created"
    ]
}

The piece you put in the structure is essentially your starting piece, where the jigsaw system will expand outwards from. You should only have one jigsaw structure file per structure (note you could also provide several starting pieces). Once this is made, try out /iris jigsaw place <name of jigsaw structure file> - if you did everything correctly, you should have a single piece spawn in the world.

The next step is defining a Jigsaw pool. A jigsaw pool is basically a group of jigsaw pieces, defined in a file.

First of all, create a folder called jigsaw-pools, then similary to the structure setup, make a json file named whatever you'd like (for example i use path for my group of path pieces in the stronghold)

Within that file you just created, simply list out pieces you've created like so

{
    "pieces": [
    "piece-1",
    "piece-2",
    "piece-3 and so on"
    ]
}

Continuing on with pools, when Iris picks a connector to continue the structure, it will take a look at that connector's configured "pools" option, and see what pieces it can place next. So in order for a connector to place stuff, you will need to define pools (as outlined above) to that list for each connector

As an example, when iris looks at this connector, it will look at "pools", see the "stronghold/paths" pool, and pick a jigsaw piece from that list to connect to. Once it picks a piece from that list of pools, it will check 1. if it has a valid connector, and 2. if that piece will collide with any other piece. If check #2 fails, then Iris will try place another piece from the pool. If none of those pieces can be placed, then Iris will simply not place anything at the connector.

{
    "targetName": "*",
    "innerConnector": false,
    "rotateConnector": false
    "name": "",
    "pools": [
        "stronghold/paths"
    ],
    position": {
        "x": -3,
        "y": -5,
        "z": 0
    },
    "direction": "WEST_NEGATIVE_X"
}

Also another thing to note - if a piece is set up with a connector inside its bounding box, then you will most likely need to set innerConnector to true, since it will check for collision with its self in addition to other pieces

Here is an example of multiple pools, note that:

  • the green pool also has a piece in it that connects to a purple pool

  • the purple L pieces are free to rotate on all axes ("rotateConnector": true) whereas all other pieces only rotate on the Y axis

If you have any further questions or get stuck and want to get some help, please ask on Discord.

Last updated