{
    "format_version": "1.16.100",
    "minecraft:block": {
        "description": {
			"properties": {
				"bd:block_rotation": [ 2, 3, 4, 5 ],
				"bd:up_down": ["up", "down"]
			},
            "identifier": "bd:huggy_wuggy_bd_statue_map"
        },
        "components": {
            "minecraft:creative_category": {
                "category": "construction"
            },
			"tag:metal": {},
			"minecraft:geometry": "geometry.huggy_wuggy_bd_statue2",
            "minecraft:destroy_time": 4.0,
            "minecraft:friction": 0.6,
            "minecraft:block_light_emission": 0.0,
            "minecraft:block_light_absorption": 0.0,
            "minecraft:entity_collision": {
                "origin": [-8, 0, -8],
                "size": [16, 16, 16]
            },
            "minecraft:pick_collision": {
                "origin": [-8, 0, -8],
                "size": [16, 16, 16]
            },
			"minecraft:ticking": {
			  "looping": true,
			  "range": [0, 0.1],
				"on_tick": {
					"event": "states",
					"target": "self"
				}
			},
			"minecraft:on_player_placing": {
				"event": "bd:rotation_it"
			},
			"minecraft:on_player_destroyed": {
				"event": "bd:on_break",
				"target": "self",
				"condition": "q.block_neighbor_has_any_tag(0,2,0,'metal')"
			},
            "minecraft:material_instances": {
                "*": {
                    "texture": "huggy_wuggy_bd_statue",
                    "render_method": "alpha_test",
					"face_dimming": false,
        			"ambient_occlusion": false
                }
            }
        },
		"events": {
			"bd:rotation_it": {
				"sequence": [{
                        "set_block_property": {
							"bd:block_rotation": "(query.cardinal_facing_2d)"
						}
                    },
					{
						"condition": "q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_property": {
							"bd:up_down": "'down'"
						}
					},
					{
						"condition": "q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_at_pos": {
							"block_type": "bd:huggy_wuggy_bd_air",
							"block_offset": [0, 1, 0]
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_at_pos": {
							"block_type": "bd:huggy_wuggy_bd_air",
							"block_offset": [0, 1, 0]
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_property": {
							"bd:up_down": "'up'"
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal') && query.block_property('bd:up_down') == 'down'",
						"die": {
							"target": "self"
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal') && query.block_property('bd:up_down') == 'down'",
						"set_block_at_pos": {
							"block_type": "minecraft:air",
							"block_offset": [0, -1, 0]
						}
					}
                ]
			},
			"states":{
				"sequence":[
					{
						"condition": "q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_property": {
							"bd:up_down": "'down'"
						}
					},
					{
						"condition": "q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_at_pos": {
							"block_type": "bd:huggy_wuggy_bd_air",
							"block_offset": [0, 1, 0]
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_at_pos": {
							"block_type": "bd:huggy_wuggy_bd_air",
							"block_offset": [0, 1, 0]
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal')",
						"set_block_property": {
							"bd:up_down": "'up'"
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal') && query.block_property('bd:up_down') == 'down'",
						"die": {
							"target": "self"
						}
					},
					{
						"condition": "!q.block_neighbor_has_any_tag(0,-2,0,'metal') && query.block_property('bd:up_down') == 'down'",
						"set_block_at_pos": {
							"block_type": "minecraft:air",
							"block_offset": [0, -1, 0]
						}
					}
				]
			},
			"bd:on_break": {
				"sequence": [{
                        "set_block_at_pos": {
							"block_type": "minecraft:air",
							"block_offset": [0, 1, 0]
						}
                    }, {
                        "set_block_at_pos": {
							"block_type": "minecraft:air",
							"block_offset": [0, 2, 0]
						}
                    }
                ]
			}
		},
		"permutations": [
			{
				"condition": "query.block_property('bd:block_rotation') == 2",
				"components": {
					"minecraft:rotation": [
						0,
						180,
						0
					]
				}
			},
			{
				"condition": "query.block_property('bd:block_rotation') == 3",
				"components": {
					"minecraft:rotation": [
						0,
						0,
						0
					]
				}
			},
			{
				"condition": "query.block_property('bd:block_rotation') == 4",
				"components": {
					"minecraft:rotation": [
						0,
						270,
						0
					]
				}
			},
			{
				"condition": "query.block_property('bd:block_rotation') == 5",
				"components": {
					"minecraft:rotation": [
						0,
						90,
						0
					]
				}
			},
			{
				"condition": "query.block_property('bd:up_down') == 'down'",
				"components": {
					"minecraft:geometry": "geometry.huggy_wuggy_bd_statue"
				}
			},
			{
				"condition": "query.block_property('bd:up_down') == 'up'",
				"components": {
					"minecraft:geometry": "geometry.huggy_wuggy_bd_statue2"
				}
			}
		]
    }
}