{
  "format_version": "1.20.50",
  "minecraft:block": {
    "description": {
      "identifier": "rc:mechanical_belt",
      "menu_category": {
        "group": "itemGroup.name.create",
        "category": "none"
      },
      "states": {
        "rc:lado": [ 0, 1, 2, 3, 4, 5 ],
        "rc:direcao": [ "null", "x", "y", "z" ],
        "rc:speed": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ],
        "rc:sentido": [ "estatico", "horario", "antihorario" ],
        "rc:state": [ "full", "right", "left", "shafted" ]
      }
    },
    "components": {
      "minecraft:loot": "loot_tables/cu_azedo.json",
      "minecraft:transformation": {
        "rotation": [0, 0, 0]
      },
      "minecraft:selection_box": {
        "origin": [ -8, 2, -8],
        "size": [ 16, 12, 16 ]
    },
    "minecraft:collision_box": {
      "origin": [ -8, 2, -8],
      "size": [ 16, 12, 16 ]
    },
      "minecraft:material_instances": {
        "*": {
          "texture": "mechanical_belt",
          "render_method": "alpha_test"
        }
      },
      "minecraft:geometry": { 
         "identifier": "geometry.mechanical_belt",
         "bone_visibility": {
           "w_a": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a2": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a3": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a4": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a5": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a6": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a7": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a8": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a9": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a10": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a11": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a12": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a13": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a14": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a15": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "w_a16": "q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "leftcima": "q.block_state('rc:state') == 'full' || q.block_state('rc:state') == 'right' || q.block_state('rc:state') == 'shafted'",
           "rightcima": "q.block_state('rc:state') == 'full' || q.block_state('rc:state') == 'left' || q.block_state('rc:state') == 'shafted'",
           "leftmeio": "q.block_state('rc:state') == 'left'",
           "rightmeio": "q.block_state('rc:state') == 'right'"
         }
       },
       "minecraft:on_interact":{
         "event":"interacting"
       },
       "minecraft:queued_ticking": {
         "interval_range": [
           1,
           1
         ],
         "looping": true,
         "on_tick": {
           "event": "ticking"
         }
       },
      "minecraft:destructible_by_mining": {
        "seconds_to_destroy": 0.3
      }
    },
    "events": {
      "ticking":{
        "sequence":[
          {
        "run_command":{
          "command":[
            "scriptevent rc:mechanical_beltConnect"
          ]
        }
      },
      {
        "condition": "query.block_state('rc:lado') == 4 || query.block_state('rc:lado') == 5",
        "set_block_state": {
          "rc:direcao": "'x'"
                }
      },
      {
        "condition": "query.block_state('rc:lado') == 2 || query.block_state('rc:lado') == 3",
        "set_block_state": {
          "rc:direcao": "'z'"
                }
      }
    ]
      },
      "interacting": {
        "run_command":{
          "command":[
            "scriptevent rc:depot_click"
          ]
        }
      }
    },
    "permutations": [
      {
        "condition": "query.block_state('rc:lado') == 2 || query.block_state('rc:lado') == 3",
        "components": {    
          "minecraft:transformation": {
            "rotation": [0, 0, 0]
          }
        }
    },
    {
        "condition": "query.block_state('rc:lado') == 4 || query.block_state('rc:lado') == 5",
        "components": {    
          "minecraft:transformation": {
            "rotation": [0, 90, 0]
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'estatico' || query.block_state('rc:speed') == 0",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 1",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_1",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 2",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_2",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 3",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_3",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 4",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_4",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 5",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_5",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 6",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_6",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 7",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_7",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 8",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_8",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 9",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_9",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'antihorario' && query.block_state('rc:speed') == 10",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_a_10",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 1",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_1",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 2",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_2",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 3",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_3",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 4",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_4",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 5",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_5",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 6",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_6",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 7",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_7",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 8",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_8",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 9",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_9",
              "render_method": "alpha_test"
            }
          }
        }
    },
    {
        "condition": "query.block_state('rc:sentido') == 'horario' && query.block_state('rc:speed') == 10",
        "components": {    
          "minecraft:material_instances": {
            "*": {
              "texture": "mechanical_belt_h_10",
              "render_method": "alpha_test"
            }
          }
        }
    }
    ]
  }
}