{
    "format_version": "1.16.100",
    "minecraft:block": {
      "description": {
        "identifier": "loled:kitchen_cabinet",
        "properties": {
          "loled:face": [
            0,
            1,
            2,
            3
          ],
          "loled:active": [
            0,
            1,
            2
          ]
        }
      },
      "components": {
        "minecraft:material_instances": {
          "*": {
            "texture": "kitchen_cabinet_black",
            "render_method": "alpha_test"
          }
        },
        "minecraft:creative_category": {
          "group": "itemGroup.name.kitchen_cabinet_top",
          "category": "construction"
        },
        "minecraft:loot": "loot_tables/kitchen_cabinet/kitchen_cabinet.json",
        "minecraft:geometry": "geometry.kitchen_cabinet_close",
        "minecraft:destroy_time": 2,
        "minecraft:block_light_absorption": 0,
        "minecraft:unwalkable": true,
        "minecraft:entity_collision": {
          "origin": [
            -8,
            0,
            -3
          ],
          "size": [
            16,
            16,
            11
          ]
        },
        "minecraft:pick_collision": {
          "origin": [
            -8,
            0,
            -3
          ],
          "size": [
            16,
            16,
            11
          ]
        },
        "minecraft:on_placed": {
          "event": "loled:open"
        },
        "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') == 1",
          "components": {
            "minecraft:geometry": "geometry.kitchen_cabinet",
            "minecraft:block_light_absorption": 0,
            "minecraft:entity_collision": {
              "origin": [
                -8,
                0,
                0
              ],
              "size": [
                16,
                16,
                8
              ]
            },
            "minecraft:pick_collision": {
              "origin": [
                -8,
                0,
                0
              ],
              "size": [
                16,
                16,
                8
              ]
            },
            "minecraft:on_placed": {
              "event": "nothing"
            },
            "minecraft:on_interact": {
              "event": "nothing"
            },
            "minecraft:ticking": {
              "looping": true,
              "range": [
                5,
                5
              ],
              "on_tick": {
                "event": "loled:normal"
              }
            }
          }
        },
        {
          "condition": "query.block_property('loled:active') == 2",
          "components": {
            "minecraft:geometry": "geometry.kitchen_cabinet_close",
            "minecraft:block_light_absorption": 0,
            "minecraft:entity_collision": {
              "origin": [
                -8,
                0,
                -3
              ],
              "size": [
                16,
                16,
                11
              ]
            },
            "minecraft:pick_collision": {
              "origin": [
                -8,
                0,
                -3
              ],
              "size": [
                16,
                16,
                11
              ]
            },
            "minecraft:on_placed": {
              "event": "nothing"
            },
            "minecraft:on_interact": {
              "event": "loled:toggle"
            }
          }
        }
      ],
      "events": {
        "loled:face": {
          "set_block_property": {
            "loled:face": "query.cardinal_facing_2d-2"
          }
        },
        "loled:open": {
          "run_command": {
            "command": [
              "summon furniture:abrir_1",
              "summon loled:kitchen_cabinet",
              "summon loled:kitchen_cabinet ~1~~",
              "summon loled:kitchen_cabinet ~-1~~",
              "summon loled:kitchen_cabinet ~~~1",
              "summon loled:kitchen_cabinet ~~~-1"
            ]
          }
        },
        "loled:normal": {
          "set_block_property": {
            "loled:active": 2
          },
          "run_command": {
            "command": "playsound block.barrel.close @p ~~~ 1 1"
          }
        },
        "loled:toggle": {
          "set_block_property": {
            "loled:active": 1
          },
          "run_command": {
            "command": "playsound block.barrel.open @p ~~~ 1 1"
          }
        }
      }
    }
  }