{
	"format_version": "1.20.80",
	"minecraft:block": {
		"description": {
			"identifier": "v360:end_fence_gate",
			"menu_category": {
				"category": "construction",
				"group": "itemGroup.name.fenceGate"
			},
			"traits": {
				"minecraft:placement_direction": {
					"enabled_states": [
						"minecraft:cardinal_direction"
					]
				}
			},
			"states": {
				"v360:open": [
					false,
					true
				],
				"v360:in_wall_bit": [
					false,
					true
				],
				"v360:invisible": [
					false,
					true
				],
				"v360:direction": [
					false,
					true
				]
			}
		},
		"permutations": [
			{
				"condition": "query.block_state('minecraft:cardinal_direction') == 'north'",
				"components": {
					"minecraft:transformation": {
						"rotation": [
							0,
							-90,
							0
						]
					}
				}
			},
			{
				"condition": "query.block_state('minecraft:cardinal_direction') == 'south'",
				"components": {
					"minecraft:transformation": {
						"rotation": [
							0,
							180,
							0
						]
					}
				}
			},
			{
				"condition": "query.block_state('minecraft:cardinal_direction') == 'east'",
				"components": {
					"minecraft:transformation": {
						"rotation": [
							0,
							-180,
							0
						]
					}
				}
			},
			{
				"condition": "query.block_state('minecraft:cardinal_direction') == 'west'",
				"components": {
					"minecraft:transformation": {
						"rotation": [
							0,
							-180,
							0
						]
					}
				}
			},
			{
				"condition": "q.block_state('v360:direction')",
				"components": {
					"minecraft:transformation": {
						"rotation": [
							0,
							-90,
							0
						]
					}
				}
			},
			{
				"condition": "q.block_state('v360:open')",
				"components": {
					"minecraft:collision_box": false
				}
			},
			{
				"condition": "!q.block_state('v360:invisible')",
				"components": {
					"minecraft:custom_components": [
						"v360:end_fence_gate"
					]
				}
			},
			{
				"condition": "q.block_state('v360:invisible') && !q.block_state('v360:open')",
				"components": {
					"minecraft:selection_box": false,
					"minecraft:collision_box": {
						"origin": [
							-2,
							0,
							-8
						],
						"size": [
							4,
							8,
							16
						]
					},
					"minecraft:geometry": {
						"identifier": "geometry.fence_gate",
						"bone_visibility": {
							"fence_gate_closed": false,
							"fence_gate_open": false,
							"fence_gate_open_inverted": false,
							"post": false,
							"fence_gate_closed_wall": false,
							"fence_gate_open_wall": false,
							"fence_gate_open_inverted_wall": false,
							"post_wall": false
						}
					}
				}
			},
			{
				"condition": "q.block_state('v360:invisible') && q.block_state('v360:open')",
				"components": {
					"minecraft:selection_box": false,
					"minecraft:collision_box": false,
					"minecraft:geometry": {
						"identifier": "geometry.fence_gate",
						"bone_visibility": {
							"fence_gate_closed": false,
							"fence_gate_open": false,
							"fence_gate_open_inverted": false,
							"post": false,
							"fence_gate_closed_wall": false,
							"fence_gate_open_wall": false,
							"fence_gate_open_inverted_wall": false,
							"post_wall": false
						}
					}
				}
			}
		],
		"components": {
			"minecraft:geometry": {
				"identifier": "geometry.fence_gate",
				"bone_visibility": {
					"fence_gate_closed": "!q.block_state('v360:open') && !q.block_state('v360:in_wall_bit')",
					"fence_gate_open": "q.block_state('v360:open') && ((q.block_state('minecraft:cardinal_direction') == 'south' && q.block_state('v360:direction')) || q.block_state('minecraft:cardinal_direction') == 'west') && !q.block_state('v360:in_wall_bit')",
					"fence_gate_open_inverted": "q.block_state('v360:open') && (q.block_state('minecraft:cardinal_direction') == 'north' || q.block_state('minecraft:cardinal_direction') == 'east') && !q.block_state('v360:in_wall_bit')",
					"post": "!q.block_state('v360:in_wall_bit')",
					"fence_gate_closed_wall": "!q.block_state('v360:open') && q.block_state('v360:in_wall_bit')",
					"fence_gate_open_wall": "q.block_state('v360:open') && ((q.block_state('minecraft:cardinal_direction') == 'south' && q.block_state('v360:direction')) || q.block_state('minecraft:cardinal_direction') == 'west') && q.block_state('v360:in_wall_bit')",
					"fence_gate_open_inverted_wall": "q.block_state('v360:open') && (q.block_state('minecraft:cardinal_direction') == 'north' || q.block_state('minecraft:cardinal_direction') == 'east') && q.block_state('v360:in_wall_bit')",
					"post_wall": "q.block_state('v360:in_wall_bit')"
				}
			},
			"minecraft:collision_box": {
				"origin": [
					-2,
					0,
					-8
				],
				"size": [
					4,
					16,
					16
				]
			},
			"minecraft:selection_box": {
				"origin": [
					-2,
					0,
					-8
				],
				"size": [
					4,
					16,
					16
				]
			},
			"minecraft:flammable": {
				"catch_chance_modifier": 5,
				"destroy_chance_modifier": 20
			},
			"minecraft:tick": {
				"interval_range": [
					3,
					3
				]
			},
			"minecraft:destructible_by_mining": {
				"seconds_to_destroy": 3
			},
			"minecraft:material_instances": {
				"*": {
					"texture": "end_planks",
					"render_method": "alpha_test"
				}
			},
			"tag:fence_gate": {},
			"tag:v360:wood": {}
		}
	}
}