{
	"format_version": "1.17.0",
	"minecraft:block": {
		"description": {
			"identifier": "furnicraft:banca_lima",
			"properties": {
				"estado:1": [
					1,
					2,
					3,
					4,
					5
				],
				"estado:2": [
					0,
					1
				],
				"estado:3": [
					0,
					1
				]
			}
		},
		"components": {
			"minecraft:geometry": "geometry.banca_new",
			"minecraft:block_light_filter": 0,
			"minecraft:map_color": "#00ff00",
			"minecraft:destroy_time": 0.5,
			"tag:bancas": {},
			"minecraft:ticking": {
				"looping": true,
				"range": [
					0,
					0
				],
				"on_tick": {
					"event": "furniture:check"
				}
			},
			"minecraft:part_visibility": {
				"rules": {
					"l": "query.block_property('estado:2') == 0",
					"r": "query.block_property('estado:3') == 0"
				}
			},
			"minecraft:material_instances": {
				"*": {
					"texture": "stone",
					"render_method": "alpha_test"
				}
			},
			"minecraft:pick_collision": {
				"origin": [
					-8,
					0,
					-8
				],
				"size": [
					16,
					12,
					16
				]
			},
			"minecraft:entity_collision": {
				"origin": [
					-8,
					0,
					-8
				],
				"size": [
					16,
					8,
					16
				]
			},
			"minecraft:flammable": {
				"flame_odds": 0,
				"burn_odds": 0
			},
			"minecraft:on_player_placing": {
				"event": "furniture:place"
			},
			"minecraft:on_placed": {
				"event": "sit"
			},
			"minecraft:creative_category": {
				"category": "items",
				"group": "itemGroup.name.furnicraft_bancas"
			},
			"minecraft:on_interact": {
				"event": "rider"
			}
		},
		"events": {
			"furniture:place": {
				"set_block_property": {
					"estado:1": "(query.cardinal_facing_2d)"
				}
			},
			"furniture:check": {
				"sequence": [
					{
						"condition": "query.block_neighbor_has_any_tag(-1, 0, 0, 'bancas') && query.block_property('estado:1') == 2",
						"set_block_property": {
							"estado:2": 1
						}
					},
					{
						"condition": "query.block_neighbor_has_any_tag(1, 0, 0, 'bancas') && query.block_property('estado:1') == 2",
						"set_block_property": {
							"estado:3": 1
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(-1, 0, 0, 'bancas') && query.block_property('estado:1') == 2",
						"set_block_property": {
							"estado:2": 0
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(1, 0, 0, 'bancas') && query.block_property('estado:1') == 2",
						"set_block_property": {
							"estado:3": 0
						}
					},
					{
						"condition": "query.block_neighbor_has_any_tag(1, 0, 0, 'bancas') && query.block_property('estado:1') == 3",
						"set_block_property": {
							"estado:2": 1
						}
					},
					{
						"condition": "query.block_neighbor_has_any_tag(-1, 0, 0, 'bancas') && query.block_property('estado:1') == 3",
						"set_block_property": {
							"estado:3": 1
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(1, 0, 0, 'bancas') && query.block_property('estado:1') == 3",
						"set_block_property": {
							"estado:2": 0
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(-1, 0, 0, 'bancas') && query.block_property('estado:1') == 3",
						"set_block_property": {
							"estado:3": 0
						}
					},
					{
						"condition": "query.block_neighbor_has_any_tag(0, 0, 1, 'bancas') && query.block_property('estado:1') == 4",
						"set_block_property": {
							"estado:2": 1
						}
					},
					{
						"condition": "query.block_neighbor_has_any_tag(0, 0, -1, 'bancas') && query.block_property('estado:1') == 4",
						"set_block_property": {
							"estado:3": 1
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(0, 0, 1, 'bancas') && query.block_property('estado:1') == 4",
						"set_block_property": {
							"estado:2": 0
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(0, 0, -1, 'bancas') && query.block_property('estado:1') == 4",
						"set_block_property": {
							"estado:3": 0
						}
					},
					{
						"condition": "query.block_neighbor_has_any_tag(0, 0, -1, 'bancas') && query.block_property('estado:1') == 5",
						"set_block_property": {
							"estado:2": 1
						}
					},
					{
						"condition": "query.block_neighbor_has_any_tag(0, 0, 1, 'bancas') && query.block_property('estado:1') == 5",
						"set_block_property": {
							"estado:3": 1
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(0, 0, -1, 'bancas') && query.block_property('estado:1') == 5",
						"set_block_property": {
							"estado:2": 0
						}
					},
					{
						"condition": "!query.block_neighbor_has_any_tag(0, 0, 1, 'bancas') && query.block_property('estado:1') == 5",
						"set_block_property": {
							"estado:3": 0
						}
					}
				]
			},
			"rider": {
				"sequence": [
					{
						"run_command": {
							"command": [
								"summon furnicraft:sentar activate ~ ~-1 ~",
								"execute @e[type=furnicraft:sentar,name=activate,c=1] ~~~ tp @s ~~~ facing @p"
							]
						},
						"trigger": {
							"event": "set_rider"
						}
					}
				]
			},
			"set_rider": {
				"run_command": {
					"command": [
						"ride @p start_riding @e[type=furnicraft:sentar,name=activate,c=1] teleport_rider"
					],
					"target": "other"
				}
			}
		},
		"permutations": [
			{
				"condition": "query.block_property('estado:1') == 2",
				"components": {
					"minecraft:block_light_emission": 0
				}
			},
			{
				"condition": "query.block_property('estado:1') == 3",
				"components": {
					"minecraft:rotation": [
						0,
						180,
						0
					]
				}
			},
			{
				"condition": "query.block_property('estado:1') == 4",
				"components": {
					"minecraft:rotation": [
						0,
						90,
						0
					]
				}
			},
			{
				"condition": "query.block_property('estado:1') == 5",
				"components": {
					"minecraft:rotation": [
						0,
						270,
						0
					]
				}
			}
		]
	}
}