SwitchCraftCC / sc-peripherals

Custom peripherals for the SwitchCraft server
MIT License
10 stars 9 forks source link

feat: allow prints to determine whether they light up depending on state #36

Closed MineRobber9000 closed 8 months ago

MineRobber9000 commented 1 year ago

Adds the getStateLighting and setStateLighting functions to the printer peripheral, allowing to toggle the print's light level based on whether the print is on or off.

Also adds lightWhenOff and lightWhenOn to the 3dj format as read by the print3d program (cf. collideWhenOff/collideWhenOn).

I'm not too attached to the getStateLighting/setStateLighting name, that's just the best I could come up with when I was writing the implementation.

MineRobber9000 commented 1 year ago

Example model with state lighting:

{
    "label": "pmaL enotsdeR",
    "tooltip": "A... reverse redstone lamp? Made by MineRobber___T",
    "lightWhenOff": false,
    "lightWhenOn": true,
    "redstoneLevel": 15,
    "lightLevel": 15,
    "shapesOff": [
        {
            "bounds": [0,0,0,16,16,16],
            "texture": "minecraft:block/redstone_lamp"
        }
    ],
    "shapesOn": [
        {
            "bounds": [0,0,0,16,16,16],
            "texture": "minecraft:block/redstone_lamp_on"
        }
    ]
}
Lemmmy commented 8 months ago

Thanks! And sorry for getting to this so late. I think that the nullability of data makes the code a lot messier than it could be, but I'll try to resolve that outside of this PR.