{
    "format_version": "1.20.50",
    "minecraft:block": {
        "description": {
            "identifier": "rc:creative_motor",
            "menu_category": {
                "category": "items",
                "group": "itemGroup.name.create",
                "is_hidden_in_commands": false
            },
            "states": {
                "rc:speed": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
                "rc:direcao": [ "null", "x", "y", "z" ],
                "rc:sentido": [ "estatico", "horario", "antihorario" ]
            },
            "traits": {
                "minecraft:placement_direction": {
                    "enabled_states": ["minecraft:facing_direction"], 
                    "y_rotation_offset": 0
                  }
            }
        },
        "components": {
            "minecraft:material_instances": {
                "*": {
                    "render_method": "alpha_test",
                    "texture": "creative_casing"
                },
                "creative_motor": {
                    "render_method": "alpha_test",
                    "texture": "creative_motor"
                },
                "creative_casing": {
                    "render_method": "alpha_test",
                    "texture": "creative_casing"
                },
                "flap_display_front": {
                    "render_method": "alpha_test",
                    "texture": "flap_display_front"
                },
                "axis": {
                    "render_method": "alpha_test",
                    "texture": "axis"
                },
                "shaft_h": {
                    "render_method": "alpha_test",
                    "texture": "shaft"
                }
            },
            "minecraft:geometry":{
                "identifier": "geometry.creative_motor",
                "bone_visibility": {
                    "shaft_h": "q.block_state('rc:sentido') == 'estatico' || (q.block_state('rc:sentido') == 'horario' && (q.block_state('minecraft:facing_direction') == 'north' || q.block_state('minecraft:facing_direction') == 'west')) || (q.block_state('rc:sentido') == 'antihorario' && (q.block_state('minecraft:facing_direction') == 'south' || q.block_state('minecraft:facing_direction') == 'east')) || (q.block_state('rc:sentido') == 'horario' && (q.block_state('minecraft:facing_direction') == 'up' || q.block_state('minecraft:facing_direction') == 'down'))",
                    "shaft_a": "(q.block_state('rc:sentido') == 'antihorario' && (q.block_state('minecraft:facing_direction') == 'north' || q.block_state('minecraft:facing_direction') == 'west')) || (q.block_state('rc:sentido') == 'horario' && (q.block_state('minecraft:facing_direction') == 'south' || q.block_state('minecraft:facing_direction') == 'east')) || (q.block_state('rc:sentido') == 'antihorario' && (q.block_state('minecraft:facing_direction') == 'up' || q.block_state('minecraft:facing_direction') == 'down'))"
                }
            },
            "minecraft:collision_box": {
                "origin": [-7, 0, -8],
                "size": [14, 14, 16]
            },
            "minecraft:selection_box": {
                "origin": [-7, 0, -8],
                "size": [14, 14, 16]
            },
            "minecraft:map_color": "#FFFFFF",
            "minecraft:on_interact": {
                "event": "interact"
            },
            "minecraft:on_placed": {
                "event": "placed"
            }
        },
        "events": {
            "placed": {
                "sequence": [
                    {
                        "condition": "(q.block_state('minecraft:facing_direction') == 'north' || q.block_state('minecraft:facing_direction') == 'south')",
                        "set_block_state":{
                            "rc:direcao": "'z'"
                        }
                    },
                    {
                        "condition": "(q.block_state('minecraft:facing_direction') == 'down' || q.block_state('minecraft:facing_direction') == 'up')",
                        "set_block_state":{
                            "rc:direcao": "'y'"
                        }
                    },
                    {
                        "condition": "(q.block_state('minecraft:facing_direction') == 'west' || q.block_state('minecraft:facing_direction') == 'east')",
                        "set_block_state":{
                            "rc:direcao": "'x'"
                        }
                    }
                ]
            }
        },
        "permutations": [
            {
                "condition": "q.block_state('minecraft:facing_direction') == 'north'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [0, 0, 0]
                    }
                }
            },
            {
                "condition": "q.block_state('minecraft:facing_direction') == 'south'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [0, 180, 0]
                    }
                }
            },
            {
                "condition": "q.block_state('minecraft:facing_direction') == 'west'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [0, 90, 0]
                    }
                }
            },
            {
                "condition": "q.block_state('minecraft:facing_direction') == 'east'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [0, 270, 0]
                    }
                }
            },
            {
                "condition": "q.block_state('minecraft:facing_direction') == 'down'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [90, 0, 0]
                    }
                }
            },
            {
                "condition": "q.block_state('minecraft:facing_direction') == 'up'",
                "components": {
                    "minecraft:transformation": {
                        "rotation": [90, 0, 180]
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 1",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_1"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_1"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 2",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_2"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_2"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 3",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_3"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_3"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 4",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_4"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_4"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 5",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_5"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_5"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 6",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_6"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_6"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 7",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_7"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_7"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 8",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_8"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_8"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 9",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_9"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_9"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 10",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_10"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_10"
                        }
                    }
                }
            },
            {
                "condition": "q.block_state('rc:speed') == 11",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "creative_motor": {
                            "render_method": "alpha_test",
                            "texture": "creative_motor"
                        },
                        "creative_casing": {
                            "render_method": "alpha_test",
                            "texture": "creative_casing"
                        },
                        "flap_display_front": {
                            "render_method": "alpha_test",
                            "texture": "flap_display_front"
                        },
                        "axis": {
                            "render_method": "alpha_test",
                            "texture": "axis"
                        },
                        "shaft_h": {
                            "render_method": "alpha_test",
                            "texture": "shaft_h_11"
                        },
                        "shaft_a": {
                            "render_method": "alpha_test",
                            "texture": "shaft_a_11"
                        }
                    }
                }
            }            
        ]
    }
}