{
    "format_version": "1.16.100",
    "minecraft:block": {
      "description": {
        "identifier": "loled:light_switch",
        "properties": {
          "loled:face": [
            0,
            1,
            2,
            3
          ],
          "loled:active": [
            false,
            true
          ]
        }
      },
      "components": {
        "minecraft:material_instances": {
          "*": {
            "texture": "light_switch",
            "render_method": "alpha_test"
          }
        },
        "minecraft:pick_collision": {
          "origin": [
            -3,
            4,
            6
          ],
          "size": [
            6,
            8,
            2
          ]
        },
        "minecraft:creative_category": {
          "group": "itemGroup.name.light",
          "category": "construction"
        },
        "minecraft:loot": "loot_tables/decorations/light_switch.json",
        "minecraft:geometry": "geometry.light_switch",
        "minecraft:destroy_time": 2,
        "minecraft:block_light_absorption": 2,
        "minecraft:unwalkable": true,
        "minecraft:entity_collision": {
          "origin": [
            -3,
            4,
            6
          ],
          "size": [
            6,
            8,
            2
          ]
        },
        "minecraft:friction": 0.6,
        "minecraft:map_color": "#00ff00",
        "minecraft:flammable": {
          "flame_odds": 0,
          "burn_odds": 0
        },
        "minecraft:on_interact": {
          "event": "loled:toggle"
        },
        "minecraft:on_player_placing": {
          "event": "loled:face"
        }
      },
      "permutations": [
        {
          "condition": "query.block_property('loled:face') == 0",
          "components": {
            "minecraft:rotation": [
              0,
              180,
              0
            ]
          }
        },
        {
          "condition": "query.block_property('loled:face') == 1",
          "components": {
            "minecraft:rotation": [
              0,
              0,
              0
            ]
          }
        },
        {
          "condition": "query.block_property('loled:face') == 2",
          "components": {
            "minecraft:rotation": [
              0,
              270,
              0
            ]
          }
        },
        {
          "condition": "query.block_property('loled:face') == 3",
          "components": {
            "minecraft:rotation": [
              0,
              90,
              0
            ]
          }
        },
        {
          "condition": "!query.block_property('loled:active')",
          "components": {
            "minecraft:geometry": "geometry.light_switch_off",
            "minecraft:on_interact": {
              "event": "loled:toggle1"
            },
            "minecraft:block_light_absorption": 2,
            "minecraft:material_instances": {
              "*": {
                "texture": "light_switch",
                "render_method": "alpha_test"
              }
            }
          }
        }
      ],
      "events": {
        "loled:face": {
          "set_block_property": {
            "loled:face": "query.cardinal_facing_2d-2"
          }
        },
        "loled:toggle": {
          "set_block_property": {
            "loled:active": "query.block_property('loled:active') ? false : true"
          },
          "run_command": {
            "command": [
              "fill ~-5~0~-5 ~5~5~5 loled:light_off replace loled:light_on",
              "playsound light_switch @p ~~~"
            ]
          }
        },
        "loled:toggle1": {
          "set_block_property": {
            "loled:active": "query.block_property('loled:active') ? false : true"
          },
          "run_command": {
            "command": [
              "fill ~-5~0~-5 ~5~5~5 loled:light_on replace loled:light_off",
              "playsound light_switch @p ~~~"
            ]
          }
        }
      }
    }
  }