{
  "format_version": "1.16.100",
  "minecraft:block": {
    "description": {
      "identifier": "darkgato:placed_table_chandelier",
      "register_to_creative_menu": false,
      "properties": {
        "block:rotation": [ 2, 3, 4, 5 ],
        "block:fire": [ 1, 2 ]
      }
    },
    "components": {
      "minecraft:material_instances": {
        "chandelier": {
          "texture": "gold_block",
          "render_method": "opaque"
        },
        "candles": {
          "texture": "candle",
          "render_method": "opaque"
        }
      },
      "minecraft:geometry": "geometry.table_chandelier",
      "minecraft:loot": "loot_tables/blocks/table_chandelier.json",
      "minecraft:destroy_time": 0,
      "minecraft:map_color": "#C9C112",
      "minecraft:explosion_resistance": 0,
      "minecraft:block_light_absorption": 0,
      "minecraft:block_light_emission": 0,
      "minecraft:on_player_placing": {
        "event": "update_rotation"
      },
      "minecraft:on_interact": {
        "event": "candles_lit"
      },
      "minecraft:pick_collision": {
        "origin": [ -7, 0, -3 ],
        "size": [ 14, 15, 6 ]
      },
      "minecraft:entity_collision": {
        "origin": [ -7, 0, -2 ],
        "size": [ 14, 14, 4 ]
      }
    },
    "permutations": [
      {
        "condition": "query.block_property('block:rotation') == 2",
        "components": {
          "minecraft:rotation": [ 0, 0, 0 ]
        }
      },
      {
        "condition": "query.block_property('block:rotation') == 3",
        "components": {
          "minecraft:rotation": [ 0, -180, 0 ]
        }
      },
      {
        "condition": "query.block_property('block:rotation') == 4",
        "components": {
          "minecraft:rotation": [ 0, 90, 0 ]
        }
      },
      {
        "condition": "query.block_property('block:rotation') == 5",
        "components": {
          "minecraft:rotation": [ 0, -90, 0 ]
        }
      },
      {
        "condition": "query.block_property('block:fire') == 2",
        "components": {
          "minecraft:material_instances": {
            "chandelier": {
              "texture": "gold_block",
              "render_method": "opaque"
            },
            "candles": {
              "texture": "candle_lit",
              "render_method": "opaque",
              "ambient_occlusion": false,
              "face_dimming": false
            }
          },
          "minecraft:ticking": {
            "looping": true,
            "range": [ 5, 6 ],
            "on_tick": {
              "event": "fire_particles"
            }
          },
          "minecraft:block_light_emission": 0.8
        }
      }
    ],
    "events": {
      "update_rotation": {
        "set_block_property": {
          "block:rotation": "query.cardinal_facing_2d"
        }
      },
      "fire_particles": {
        "sequence": [
          {
            "condition": "query.block_property('block:rotation') == 4 || query.block_property('block:rotation') == 5",
            "run_command": {
              "command": [
                "function table_chandelier_particles_1"
              ]
            }
          },
          {
            "condition": "query.block_property('block:rotation') == 2 || query.block_property('block:rotation') == 3",
            "run_command": {
              "command": [
                "function table_chandelier_particles_2"
              ]
            }
          }
        ]
      },
      "candles_lit": {
        "sequence": [
          {
            "condition": "query.block_property('block:rotation') == 4 && query.block_property('block:fire') == 1 && query.get_equipped_item_name == 'flint_and_steel'",
            "run_command": {
              "command": [
                "function table_chandelier_particles_1"
              ]
            }
          },
          {
            "condition": "query.block_property('block:rotation') == 5 && query.block_property('block:fire') == 1 && query.get_equipped_item_name == 'flint_and_steel'",
            "run_command": {
              "command": [
                "function table_chandelier_particles_1"
              ]
            }
          },
          {
            "condition": "query.block_property('block:rotation') == 2 && query.block_property('block:fire') == 1 && query.get_equipped_item_name == 'flint_and_steel'",
            "run_command": {
              "command": [
                "function table_chandelier_particles_2"
              ]
            }
          },
          {
            "condition": "query.block_property('block:rotation') == 3 && query.block_property('block:fire') == 1 && query.get_equipped_item_name == 'flint_and_steel'",
            "run_command": {
              "command": [
                "function table_chandelier_particles_2"
              ]
            }
          },
          {
            "condition": "query.block_property('block:fire') == 1 && query.get_equipped_item_name == 'flint_and_steel'",
            "set_block_property": {
              "block:fire": 2
            },
            "run_command": {
              "command": [
                "playsound fire.ignite @a[r=8]"
              ]
            },
            "damage": {
              "type": "durability",
              "target": "item",
              "amount": 1
            }
          },
          {
            "condition": "query.block_property('block:fire') == 2 && query.get_equipped_item_name == 'potion'",
            "set_block_property": {
              "block:fire": 1
            },
            "run_command": {
              "command": [
                "playsound bucket.empty_water @a[r=8]",
                "particle minecraft:water_evaporation_bucket_emitter ~-0.5 ~ ~-0.5"
              ]
            },
            "spawn_loot": {
              "table": "loot_tables/blocks/glass_bottle.json"
            },
            "decrement_stack": {}
          }
        ]
      }
    }
  }
}