//bridge-file-version: #3
{
	"format_version": "1.17.0",
	"minecraft:block": {
		"description": {
			"identifier": "strat:casting_basin_glass",
			"properties": {
				"strat:state": [
					0,
					1,
					2,
					3,
					4,
					5,
					6,
					7,
					8,
					9,
					10,
					11
				]
			}
		},
		"components": {
			"minecraft:destroy_time": 2,
			"minecraft:block_light_emission": 0,
			"minecraft:block_light_absorption": 0,
			"minecraft:map_color": "#202020",
			"minecraft:explosion_resistance": 5,
			"minecraft:geometry": "geometry.basin",
			"minecraft:material_instances": {
				"*": {
					"texture": "strat_casting basin",
					"render_method": "alpha_test"
				}
			},
			"minecraft:on_interact": {
				"event": "strat:interact"
			},
			"minecraft:loot": "loot_tables/casting_basin.json",
			"minecraft:on_placed": {
				"event": "strat:commands"
			},
			"tag:stone": {}
		},
		"events": {
			"strat:interact": {
				"sequence": [
					{
						"sequence": [
							{
								"condition": "query.block_property('strat:state') == 4",
								"spawn_loot": {
									"table": "loot_tables/clear_glass.json"
								},
								"set_block": {
									"block_type": "strat:casting_basin"
								}
							},
							{
								"condition": "query.block_property('strat:state') >= 0 && query.block_property('strat:state') < 3 && query.get_equipped_item_name('main_hand') == 'molten_glass_bucket'",
								"set_block_property": {
									"strat:state": "query.block_property('strat:state') + 1"
								},
								"decrement_stack": {},
								"run_command": {
									"command": [
										"playsound bucket.fill_lava @a ~~~",
										"gamerule sendcommandfeedback false",
										"give @s bucket",
										"gamerule sendcommandfeedback true"
									],
									"target": "player"
								}
							},
							{
								"condition": "query.block_property('strat:state') > 0 && query.block_property('strat:state') < 3 && query.get_equipped_item_name('main_hand') == 'bucket'",
								"set_block_property": {
									"strat:state": "query.block_property('strat:state') - 1"
								},
								"decrement_stack": {},
								"run_command": {
									"command": [
										"playsound bucket.empty_lava @a ~~~",
										"gamerule sendcommandfeedback false",
										"give @s strat:molten_glass_bucket",
										"gamerule sendcommandfeedback true"
									],
									"target": "player"
								}
							},
							{
								"condition": "query.block_property('strat:state') == 0 && query.get_equipped_item_name('main_hand') == 'bucket'",
								"decrement_stack": {},
								"run_command": {
									"command": [
										"playsound bucket.empty_lava @a ~~~",
										"gamerule sendcommandfeedback false",
										"give @s strat:molten_glass_bucket",
										"gamerule sendcommandfeedback true"
									],
									"target": "player"
								},
								"set_block": {
									"block_type": "strat:casting_basin"
								}
							}
						]
					}
				]
			},
			"strat:transform_glass": {
				"sequence": [
					{
						"set_block_property": {
							"strat:state": 4
						},
						"run_command": {
							"command": [
								"particle minecraft:basic_smoke_particle ~~+1~",
								"playsound bucket.fill_lava @a ~~~"
							]
						}
					}
				]
			}
		},
		"permutations": [
			{
				"condition": "query.block_property('strat:state') == 0",
				"components": {
					"minecraft:geometry": "geometry.basin3",
					"minecraft:material_instances": {
						"*": {
							"texture": "casting_basin_molten_glass",
							"render_method": "alpha_test"
						}
					},
					"minecraft:loot": "loot_tables/casting_basin.json"
				}
			},
			{
				"condition": "query.block_property('strat:state') == 1",
				"components": {
					"minecraft:geometry": "geometry.basin5",
					"minecraft:material_instances": {
						"*": {
							"texture": "casting_basin_molten_glass",
							"render_method": "alpha_test"
						}
					},
					"minecraft:loot": "loot_tables/casting_basin.json"
				}
			},
			{
				"condition": "query.block_property('strat:state') == 2",
				"components": {
					"minecraft:geometry": "geometry.basin7",
					"minecraft:material_instances": {
						"*": {
							"texture": "casting_basin_molten_glass",
							"render_method": "alpha_test"
						}
					},
					"minecraft:loot": "loot_tables/casting_basin.json"
				}
			},
			{
				"condition": "query.block_property('strat:state') == 3",
				"components": {
					"minecraft:geometry": "geometry.basin10",
					"minecraft:material_instances": {
						"*": {
							"texture": "casting_basin_molten_glass",
							"render_method": "alpha_test"
						}
					},
					"minecraft:loot": "loot_tables/casting_basin.json",
					"minecraft:ticking": {
						"range": [
							5,
							5
						],
						"on_tick": {
							"event": "strat:transform_glass"
						},
						"looping": false
					}
				}
			},
			{
				"condition": "query.block_property('strat:state') == 4",
				"components": {
					"minecraft:geometry": "geometry.basin11",
					"minecraft:material_instances": {
						"*": {
							"texture": "casting_basin_clear_glass",
							"render_method": "alpha_test"
						}
					},
					"minecraft:loot": "loot_tables/casting_basin_13.json"
				}
			}
		]
	}
}