{
    "format_version": "1.16.100",
    "minecraft:block": {
        "description": {
            "identifier": "loled:kitchen_cabinet_down_yellow",
            "properties": {
                "loled:face": [ 0, 1, 2, 3 ],
                "loled:active": [ 0, 1, 2 ]
            }
        },
        "components": {
            "minecraft:material_instances": {
                "*": {
                    "texture": "kitchen_cabinet_down_yellow",
                    "render_method": "opaque"
                }
            },
            "minecraft:pick_collision": {
                "origin": [ -8, 0, -8 ],
                "size": [ 16, 16, 16 ]
            },
			"minecraft:creative_category": {
              "group": "itemGroup.name.kitchen_cabinets",
              "category": "construction"
            },
            "minecraft:loot": "loot_tables/kitchen_cabinet_down/kitchen_cabinet_down_yellow.json",
            "minecraft:geometry": "geometry.kitchen_cabinet_down_close",
            "minecraft:destroy_time": 2.0,
			"minecraft:block_light_absorption": 0.0,
			"minecraft:entity_collision":{
			"origin":[ -8.0, 0.0, -8.0 ],
			"size":[ 16, 16, 16 ]
			},
			"minecraft:on_player_placing": {
                "event": "loled:place"
            },
            "minecraft:on_placed": {
                 "event": "loled:abrir"
            },
            "minecraft:on_interact": { 
			     "event": "loled:toggle" 
			},
            "minecraft:friction": 0.6,
            "minecraft:map_color": "#00ff00",
            "minecraft:flammable": {
                "flame_odds": 0,
                "burn_odds": 0
            }
        },
        "events": {

      "loled:place": {
            "set_block_property": {
              "loled:face": "math.clamp(query.cardinal_player_facing - 2.0, 0.0, 3.0)"
            }
          },
      "loled:abrir": {
            "run_command": {
              "command": "summon furniture:abrir"
            }
        },
      "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"
			}
        }
    },
        "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, -90, 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_down",
			        "minecraft:block_light_absorption": 0.0,
					"minecraft:entity_collision":{
			            "origin":[ -8.0, 0.0, -6.0 ],
			            "size":[ 16, 16, 14 ]
			        },
					"minecraft:pick_collision":{
			            "origin":[ -8, 0, -6 ],
			            "size":[ 16, 16, 14 ]
			        },
                    "minecraft:on_placed": {
                        "event": "nothing"
                    },
		            "minecraft:on_interact": { 
			            "event": "nothing" 
			        },
                    "minecraft:ticking": {
                        "looping": true,
                        "range": [ 5, 5 ],
                        "on_tick": {
                        "event": "loled:normal"
                        }
                    },
                    "minecraft:material_instances": {
                        "*": {
                            "texture": "kitchen_cabinet_down_yellow",
                            "render_method": "opaque"
					    }
				    }
				}
            },
            {
                "condition": "query.block_property('loled:active') == 2",
                "components": {
                    "minecraft:geometry": "geometry.kitchen_cabinet_down_close",
			        "minecraft:block_light_absorption": 0.0,
					"minecraft:entity_collision":{
			            "origin":[ -8.0, 0.0, -8.0 ],
			            "size":[ 16, 16, 16 ]
			        },
					"minecraft:pick_collision":{
			            "origin":[ -8, 0, -8 ],
			            "size":[ 16, 16, 16 ]
			        },
                    "minecraft:on_placed": {
                        "event": "nothing"
                    },
		            "minecraft:on_interact": { 
			            "event": "loled:toggle" 
			        },
                    "minecraft:material_instances": {
                        "*": {
                            "texture": "kitchen_cabinet_down_yellow",
                            "render_method": "opaque"
					    }
				    }
				}
            }
        ]
    }
}