{
  "format_version": "1.21.80",
  "minecraft:block": {
    "description": {
      "identifier": "mnp_ci:palm_trapdoor",
      "menu_category": {
        "category": "none"
      },
      "traits": {
        "minecraft:placement_position": {
          "enabled_states": ["minecraft:vertical_half"]
        },
        "minecraft:placement_direction": {
          "enabled_states": ["minecraft:cardinal_direction"]
        }
      },
      "states": {
        "mnp_ci:trapdoor_open": [false, true]
      }
    },
    "permutations": [
      // Top Closed
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'north' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [0, 0, 180] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'south' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [180, 0, 0] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'east' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [180, -270, 0] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'west' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [180, 270, 0] }
        }
      },
      // Top Open
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'north' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [-270, 0, 0] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'south' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [270, 0, -180] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'east' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [0, 270, 90] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'west' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": {
            "rotation": [180, -270, -270]
          }
        }
      },
      // Bottom Closed
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'north' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [0, 0, 0] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'south' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [0, 180, 0] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'east' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [0, 270, 0] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'west' && !q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [0, -270, 0] }
        }
      },
      // Bottom Open
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'north' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [90, 0, 180] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'south' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [270, 0, 0] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'east' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [0, -270, 90] }
        }
      },
      {
        "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'west' && q.block_state('mnp_ci:trapdoor_open')",
        "components": {
          "minecraft:transformation": { "rotation": [180, 270, -270] }
        }
      }
    ],
    "components": {
      "minecraft:liquid_detection": {
        "detection_rules": [
          {
            "liquid_type": "water",
            "can_contain_liquid": true, // Waterloggable
            "on_liquid_touches": "no_reaction" // Water flows through the block like air
          }
        ]
      },
      "minecraft:collision_box": {
        "origin": [-8, 0, -8],
        "size": [16, 3, 16]
      },
      "minecraft:selection_box": {
        "origin": [-8, 0, -8],
        "size": [16, 3, 16]
      },
      "minecraft:geometry": "geometry.mnp_ci.trapdoor",
      "minecraft:material_instances": {
        "*": {
          "texture": "mnp_ci:palm_trapdoor",
          "render_method": "alpha_test"
        }
      },
      "minecraft:flammable": {
        "destroy_chance_modifier": 20,
        "catch_chance_modifier": 5
      },
      "minecraft:destructible_by_mining": {
        "seconds_to_destroy": 3,
        "item_specific_speeds": [
          {
            "destroy_speed": 1.5,
            "item": {
              "tags": "q.all_tags('minecraft:is_axe', 'minecraft:wooden_tier')"
            }
          },
          {
            "destroy_speed": 0.75,
            "item": {
              "tags": "q.all_tags('minecraft:is_axe', 'minecraft:stone_tier')"
            }
          },
          {
            "destroy_speed": 0.5,
            "item": {
              "tags": "q.all_tags('minecraft:is_axe', 'minecraft:iron_tier')"
            }
          },
          {
            "destroy_speed": 0.25,
            "item": {
              "tags": "q.all_tags('minecraft:is_axe', 'minecraft:golden_tier')"
            }
          },
          {
            "destroy_speed": 0.4,
            "item": {
              "tags": "q.all_tags('minecraft:is_axe', 'minecraft:diamond_tier')"
            }
          },
          {
            "destroy_speed": 0.35,
            "item": {
              "tags": "q.all_tags('minecraft:is_axe', 'minecraft:netherite_tier')"
            }
          }
        ]
      },
      "minecraft:loot": "loot_tables/mnp_ci/palm_tree/palm_trapdoor.json",
      "minecraft:tick": {
        "interval_range": [2, 2]
      },
      "minecraft:custom_components": ["mnp_ci:trapdoor_on_interact", "mnp_ci:trapdoor_on_tick"],
      "minecraft:map_color": "#bfbb94"
    }
  }
}
