Jump to content

Recommended Posts

Posted

I've been poking around the Scraps mod from 1.19 to see if I could fix the recipes that don't work, and I'm starting to give myself a headache. 

In blocktypes/wood/bookshelf/clutter in 1.20, we have

{
    code: "clutteredbookshelf",
    class: "BlockClutterBookshelf",
    entityClass: "Generic",
    entityBehaviors: [ { name: "ClutterBookshelf" } ],
    behaviors: [ { name: "Reparable" } ],
    attributes: {
        shapeBasePath: "block/clutter",
        canChisel: false,
        reparability: 6,
        woodbackPanelShapePath: "bookshelves/bookshelf-backpanel",
        variantGroups: {
            "half": {
                colSelBoxes: [{ x1: 0, y1: 0, z1: 0, x2: 1, y2: 1, z2: 0.5 }],
                guiTf: { rotation: { x: -22.6, y: 150 }, origin: { x: 0.6, y: 0.7, z: 0.5 }, scale: 1 },
                fpTf: { translation: { y: -0.15, z: 0.5 }, rotation: { y: -134 }, scale: 1.3 },
                tpTf: { translation: { x: -1.8, y: -1.8, z: -1.86 }, scale: 0.3 },
                types: [
                    { code: "bookshelves/bookshelf-case" },
                    { code: "bookshelves/bookshelf-case2" },
                    { code: "bookshelves/bookshelf-cobweb1" },
                    { code: "bookshelves/bookshelf-cobweb2" },
                    { code: "bookshelves/bookshelf-empty" },
                    { code: "bookshelves/bookshelf-full" },
                    { code: "bookshelves/bookshelf-noshelf" },
                    { code: "bookshelves/bookshelf-ruined-empty1" },
                    ...
                   ]
              },
              "half-front": {
                colSelBoxes: [{ x1: 0, y1: 0, z1: 0.5, x2: 1, y2: 1, z2: 1 }],
                guiTf: { rotation: { x: -22.6, y: 150 }, origin: { x: 0.6, y: 0.7, z: 0.5 }, scale: 1 },
                fpTf: { translation: { y: -0.15, z: 0.5 }, rotation: { y: -134 }, scale: 1.3 },
                tpTf: { translation: { x: -1.8, y: -1.8, z: -1.86 }, scale: 0.3 },
                types: [
                    { code: "bookshelves/bookshelf-alchemy01front"},
                    { code: "bookshelves/bookshelf-alchemy02front"},
                    { code: "bookshelves/bookshelf-alchemy03front"},
                    { code: "bookshelves/bookshelf-food01front"},
                    { code: "bookshelves/bookshelf-food02front"},
                    { code: "bookshelves/bookshelf-reagents01front"},
                    { code: "bookshelves/bookshelf-reagents02front"},
                    { code: "bookshelves/bookshelf-reagents03front"},
                    { code: "bookshelves/bookshelf-reagents04front"},
                    { code: "bookshelves/bookshelf-reagents05front"},
                    { code: "bookshelves/bookshelf-reagents06front"},
                ]
		},
        ...

And so forth. 

We have a code clutteredbookshelf that covers all the bookshelf clutter. It has variantgroups half, half-front, full, and so on. Each of these have a series of types, and each of the types have a code again.

And what is the types tag? My attempts to sift through the wiki haven't been very useful because the json examples all seem to use a variantgroup called "type" Moreover, tags of the form "thingByType" actually appear to refer to the variantgroup and not the type tag.

If I wanted to, say, put "bookshelf-ruined-empty1" in a grid recipe, what would it look like? clutteredbookshelf-half-? How is the type represented?

Posted (edited)

You can use these in recipes like this (generally for any clutter):

 

{
  "ingredientPattern": "B",
  "ingredients": {
	"B": { "type": "block", "code": "game:clutteredbookshelf", "attributes": { "type": "bookshelves/bookshelf-ruined-empty1", "variant": "half" } }
  },
  "width": 1,
  "height": 1,
  "output": { "type": "block", "code": "my-amazing-block" }
}

 

Hope that helps 🙂

Edited by xXx_Ape_xXx
  • Like 1
Posted

Thanks!

Generalizing what you said, it looks like type appears as an attribute. In other places, variants appear as a suffix on the code, e.g. storagevessel-earthen, correct? So would 

{ "type": "block", "code": "game:clutteredbookshelf-half", "attributes": { "type": "bookshelves/bookshelf-ruined-empty1" } }

be an alternate way of representing the same data, or am I still missing something?

Hmm. That matches what's in the 1.19 recipe. The bookshelf clutter has moved to a different place in the directory tree, and I thought maybe they were being represented differently. I'm not really sure why the bookshelf clutter recipes in this mod are not working.

A different recipe calling for a saw is not working either, but I can't see anything wrong with the way the saw show up in these recipes either.

The chisel recipes returning metal bits are working fine. 🤷‍♀️

Posted

No, that will not work, as the "half" variant is not defined in the root tree of the clutteredbookshelf, but is assigned via attributes using "variant": "half"

 

Clutter use an attribute driven generation of its variations, while most regular blocks/items use "variantGroups" to define various variations of the block/item.

Even tho "variantsGroups" is used in the file, it is nested inside the "attributes": tree, and not in the root, and can not be called like we would do with regular blocks.

These attributes are then parsed by C# code to make all the variations.

I know it's confusing, it took me a long time to get a somewhat grip of what it all does too.

Posted (edited)

So if I wanted a recipe to accept all half bookshelf clutter regardless of type, would it look like:

{ "type": "block", "code": "game:clutteredbookshelf", "attributes": { "variant": "half" } }
Edited by Echo Weaver
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.