//bridge-file-version: #31
{
	"format_version": "1.18.0",
	"minecraft:block": {
		"description": {
			"identifier": "strat:smeltery_controller_270_21",
			"properties": {
				"strat:state": [
					0,
					1,
					2,
					3,
					4,
					5,
					6,
					7
				]
			}
		},
		"components": {
			"minecraft:destroy_time": 2,
			"minecraft:explosion_resistance": 10,
			"minecraft:material_instances": {
				"*": {
					"texture": "smeltery_controller_on_270",
					"render_method": "alpha_test"
				}
			},
			"minecraft:geometry": "geometry.block",
			"minecraft:loot": "loot_tables/smeltery_controller.json",
			"tag:stone": {},
			"minecraft:crafting_table": {
				"custom_description": "Smeltery",
				"grid_size": 3,
				"crafting_tags": [
					"smeltery"
				]
			},
			"minecraft:block_light_emission": 1,
			"minecraft:on_player_destroyed": {
				"event": "strat:remove_liquid"
			}
		},
		"events": {
			"strat:activate": {
				"sequence": [
					{
						"condition": "query.get_equipped_item_name('main_hand') == 'lava_bucket'",
						"set_block_property": {
							"strat:state": 1
						},
						"decrement_stack": {},
						"run_command": {
							"command": [
								"gamerule sendcommandfeedback false",
								"playsound bucket.fill_lava @a ~~~",
								"give @p bucket",
								"gamerule sendcommandfeedback true",
								"fill ~-1~~ ~-3~~+2 strat:smeltery_lava 0"
							]
						}
					},
					{
						"condition": "query.get_equipped_item_name('main_hand') != 'lava_bucket'",
						"run_command": {
							"command": [
								"title @s actionbar Fuel: Empty"
							],
							"target": "player"
						}
					}
				]
			},
			"strat:deactivate": {
				"sequence": [
					{
						"condition": "query.block_property('strat:state') == 1",
						"set_block_property": {
							"strat:state": 0
						},
						"run_command": {
							"command": [
								"fill ~-1~~ ~-3~~+2 air 0 replace strat:smeltery_lava"
							]
						}
					}
				]
			},
			"strat:remove_liquid": {
				"run_command": {
					"command": [
						"fill ~-1~~ ~-3~~+2 air 0 replace strat:smeltery_lava"
					]
				}
			}
		},
		"permutations": [
			{
				"condition": "query.block_property('strat:state') == 0",
				"components": {
					"minecraft:on_interact": {
						"event": "strat:activate"
					}
				}
			},
			{
				"condition": "query.block_property('strat:state') == 1",
				"components": {
					"minecraft:crafting_table": {
						"custom_description": "Smeltery",
						"grid_size": 3,
						"crafting_tags": [
							"smeltery"
						]
					},
					"minecraft:ticking": {
						"looping": false,
						"range": [
							180,
							180
						],
						"on_tick": {
							"event": "strat:deactivate"
						}
					}
				}
			}
		]
	}
}