{
  "format_version": "1.16.100",
  "minecraft:block": {
    "description": {
      "identifier": "vl:is_cage",
	  "properties": {
				"oneside:direction": [2,3,4,5, 6],
				"block:press": [ false, true ]
	  		}
    },
    "components": {
	"minecraft:creative_category":{
		"category":"construction",
		"group": "itemGroup.name.construction"
	},
	"minecraft:block_light_absorption": 1,
	"minecraft:display_name": "Cage",
    "minecraft:destroy_time": 999,
	"minecraft:geometry": "geometry.is_cage_close",
	"minecraft:material_instances": {
      "*": {
   		"texture": "is_cage", // References texture defined in terrain_textures.json
    	"render_method": "alpha_test" // Options 'blend', 'opaque', 'alpha_test'
      }
	  },
	"minecraft:entity_collision": {
          "origin": [-8, 0, -8],
          "size": [16, 16, 16]
	},
	"minecraft:pick_collision": {
          "origin": [-8, 0, -8],
          "size": [16, 16, 16]
	},
	"minecraft:on_player_placing": {
      "event": "onPlace",
      "target": "self"
    },
    "minecraft:on_interact": {
        "event": "press_open"
	    }
    },
	"events":{		
		"onPlace":{
			"set_block_property": {
				"oneside:direction": "(query.cardinal_facing_2d)"
			}
		},
		"press_open":{
			"set_block_property": {
				"block:press": true
			},
			"run_command": {
			"command": ["playsound is_cage @a ~~~"]
			}
		},
		"press_close":{
			"set_block_property": {
				"block:press": false
			},
			"run_command": {
			"command": ["playsound is_cage @a ~~~"]
			}
		}
	},
	"permutations":[
		{
				"condition": "query.block_property('oneside:direction') == 2",
				"components": {
		  			"minecraft:rotation": [0,180,0]
				}
	  	},
		{
				"condition": "query.block_property('oneside:direction') == 3",
				"components": {
		  			"minecraft:rotation": [0,0,0]
				}
	  	},
		{
				"condition": "query.block_property('oneside:direction') == 4",
				"components": {
		  			"minecraft:rotation": [0,-90,0]
				}
	  	},
		{
				"condition": "query.block_property('oneside:direction') == 5",
				"components": {
		  			"minecraft:rotation": [0,90,0]
				}
	  	},
		{
				"condition": "query.block_property('block:press') == false",
                "components": {
                    "minecraft:on_interact": {
                        "event": "press_open"
                    },
                    "minecraft:material_instances": {
                        "*": {
                            "texture": "is_cage",
                            "render_method": "alpha_test"
                        }
                    },
                    "minecraft:geometry": "geometry.is_cage_close"
                }
	  	},
		{
				"condition": "query.block_property('block:press') == true",
                "components": {
                    "minecraft:on_interact": {
                        "event": "press_close"
                    },
                    "minecraft:material_instances": {
                        "*": {
                            "texture": "is_cage",
                            "render_method": "alpha_test"
                        }
                    },
                    "minecraft:geometry": "geometry.is_cage_open"
                }
	  	}
	]
  }
}
