{
    "format_version": "1.20.50",
    "minecraft:block": {
        "description": {
            "identifier": "rc:mechanical_piston_arm",
            "menu_category": {
                "category": "none",
                "group": "itemGroup.name.create",
                "is_hidden_in_commands": true
            },
            "states": {
                "rc:is_pole": [false, true]
            },
            "traits": {
                "minecraft:placement_position": {
                    "enabled_states": ["minecraft:block_face"]
                  }
            }
        },
        "components": {
            "minecraft:loot": "loot_tables/pole.json",
            "minecraft:material_instances": {
                "*": {
                    "render_method": "alpha_test",
                    "texture": "piston_top"
                },
                "piston_side": {
                    "render_method": "alpha_test",
                    "texture": "piston_side"
                },
                "piston_top": {
                    "render_method": "alpha_test",
                    "texture": "piston_top_normal"
                },
                "pole_end": {
                    "render_method": "alpha_test",
                    "texture": "pole_end"
                }
            },
            "minecraft:geometry":{
                "identifier": "geometry.piston_top_pole",
                "bone_visibility": {
                    "top": "!q.block_state('rc:is_pole')",
                    "pole": "q.block_state('rc:is_pole')"
                }
            },
            "minecraft:transformation": {
                "rotation": [0, 0, 0]
            },
            "minecraft:destructible_by_explosion": false,
            "minecraft:destructible_by_mining": true,
            "minecraft:collision_box": true,
            "minecraft:selection_box": true,
            "minecraft:map_color": "#FFFFFF",
            "minecraft:queued_ticking": {
                "looping": true,
                "interval_range": [0, 0],
                "on_tick": {
                    "event": "update"
                }
            }
        },
        "events": {
            "update": {
              "sequence": [
                {
                    "condition": "q.block_state('minecraft:block_face') == 'north'",
                    "set_block_state":{
                        "rc:is_pole": "q.block_neighbor_has_any_tag(0,0,-1,'piston_pole:north')"
                    }
                },
                {
                    "condition": "q.block_state('minecraft:block_face') == 'south'",
                    "set_block_state":{
                        "rc:is_pole": "q.block_neighbor_has_any_tag(0,0,1,'piston_pole:south')"
                    }
                },
                {
                    "condition": "q.block_state('minecraft:block_face') == 'west'",
                    "set_block_state":{
                        "rc:is_pole": "q.block_neighbor_has_any_tag(-1,0,0,'piston_pole:west')"
                    }
                },
                {
                    "condition": "q.block_state('minecraft:block_face') == 'east'",
                    "set_block_state":{
                        "rc:is_pole": "q.block_neighbor_has_any_tag(1,0,0,'piston_pole:east')"
                    }
                },
                {
                    "condition": "q.block_state('minecraft:block_face') == 'up'",
                    "set_block_state":{
                        "rc:is_pole": "q.block_neighbor_has_any_tag(0,1,0,'piston_pole:up')"
                    }
                },
                {
                    "condition": "q.block_state('minecraft:block_face') == 'down'",
                    "set_block_state":{
                        "rc:is_pole": "q.block_neighbor_has_any_tag(0,-1,0,'piston_pole:down')"
                    }
                }
              ]
            }
        },
        "permutations": [
            {
                "condition": "q.block_state('minecraft:block_face') == 'north'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [90, 180, 0]
                    },
                    "tag:piston_pole:north":{}
                }
            },
            {
                "condition": "q.block_state('minecraft:block_face') == 'south'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [90, 0, 0]
                    },
                    "tag:piston_pole:south":{}
                }
            },
            {
                "condition": "q.block_state('minecraft:block_face') == 'west'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [90, 270, 0]
                    },
                    "tag:piston_pole:west":{}
                }
            },
            {
                "condition": "q.block_state('minecraft:block_face') == 'east'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [90, 90, 0]
                    },
                    "tag:piston_pole:east":{}
                }
            },
            {
                "condition": "q.block_state('minecraft:block_face') == 'down'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [180, 0, 0]
                    },
                    "tag:piston_pole:down":{}
                }
            },
            {
                "condition": "q.block_state('minecraft:block_face') == 'up'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [0, 0, 0]
                    },
                    "tag:piston_pole:up":{}
                }
            }
        ]
    }
}