{
   "format_version":"1.16.100",
   "minecraft:block":{
      "description":{
         "identifier":"vatonage:cogwheel",
         "register_to_creative_menu":true,
         "properties":{
            "vatonage:signal":[
               0,
               1,
               2
            ],
            "vatonage:rotation":[
               0,
               1,
               2,
               3,
               4,
               5,
               6,
               7,
               8,
               9,
               10,
               11,
               12,
               13,
               14,
               15
            ]
         }
      },
      "components":{
         "minecraft:creative_category":{
            "category":"construction"
         },
         "minecraft:material_instances":{
            "*":{
               "texture":"cogwheel",
               "render_method":"alpha_test"
            }
         },
         "minecraft:pick_collision":{
            "origin":[
               -8,
               0,
               -8
            ],
            "size":[
               16,
               16,
               16
            ]
         },
         "minecraft:entity_collision":{
            "origin":[
               -8,
               0,
               -8
            ],
            "size":[
               16,
               16,
               16
            ]
         },
         "minecraft:destroy_time":0.1,
         "minecraft:block_light_absorption":0
      },
      "events":{
         "vatonage:powered":{
            "sequence":[
               {
                  "condition":"query.block_property('vatonage:rotation') != 15",
                  "set_block_property":{
                     "vatonage:rotation":"query.block_property('vatonage:rotation')+1"
                  }
               },
               {
                  "condition":"query.block_property('vatonage:rotation') == 15",
                  "set_block_property":{
                     "vatonage:rotation":0
                  }
               },
               {
                  "set_block_property":{
                     "vatonage:signal":1
                  }
               }
            ]
         },
         "vatonage:check_signal":{
            "sequence":[
               {
                  "condition":"q.block_neighbor_has_any_tag(0,0,1,'cogsignal')",
                  "trigger":{
                     "event":"vatonage:powered"
                  }
               },
               {
                  "condition":"q.block_neighbor_has_any_tag(0,0,-1,'cogsignal')",
                  "trigger":{
                     "event":"vatonage:powered"
                  }
               },
               {
                  "condition":"q.block_neighbor_has_any_tag(0,1,0,'cogsignal')",
                  "trigger":{
                     "event":"vatonage:powered"
                  }
               },
               {
                  "condition":"q.block_neighbor_has_any_tag(0,-1,0,'cogsignal')",
                  "trigger":{
                     "event":"vatonage:powered"
                  }
               },
               {
                  "condition":"q.block_neighbor_has_any_tag(1,0,0,'cogsignal')",
                  "trigger":{
                     "event":"vatonage:powered"
                  }
               },
               {
                  "condition":"q.block_neighbor_has_any_tag(-1,0,0,'cogsignal')",
                  "trigger":{
                     "event":"vatonage:powered"
                  }
               }
            ]
         },
         "vatonage:clear_signal":{
            "sequence":[
               {
                  "condition":"query.block_property('vatonage:signal') == 2",
                  "set_block_property":{
                     "vatonage:signal":0
                  }
               },
               {
                  "condition":"query.block_property('vatonage:signal') == 1",
                  "set_block_property":{
                     "vatonage:signal":2
                  }
               }
            ]
         }
      },
      "permutations":[
         {
            "condition":"query.block_property('vatonage:rotation') == 0",
            "components":{
               "minecraft:geometry":"geometry.cogwheel"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 1",
            "components":{
               "minecraft:geometry":"geometry.cogwheel1"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 2",
            "components":{
               "minecraft:geometry":"geometry.cogwheel2"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 3",
            "components":{
               "minecraft:geometry":"geometry.cogwheel3"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 4",
            "components":{
               "minecraft:geometry":"geometry.cogwheel4"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 5",
            "components":{
               "minecraft:geometry":"geometry.cogwheel5"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 6",
            "components":{
               "minecraft:geometry":"geometry.cogwheel6"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 7",
            "components":{
               "minecraft:geometry":"geometry.cogwheel7"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 8",
            "components":{
               "minecraft:geometry":"geometry.cogwheel8"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 9",
            "components":{
               "minecraft:geometry":"geometry.cogwheel9"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 10",
            "components":{
               "minecraft:geometry":"geometry.cogwheel10"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 11",
            "components":{
               "minecraft:geometry":"geometry.cogwheel11"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 12",
            "components":{
               "minecraft:geometry":"geometry.cogwheel12"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 13",
            "components":{
               "minecraft:geometry":"geometry.cogwheel13"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 14",
            "components":{
               "minecraft:geometry":"geometry.cogwheel14"
            }
         },
         {
            "condition":"query.block_property('vatonage:rotation') == 15",
            "components":{
               "minecraft:geometry":"geometry.cogwheel14"
            }
         },
         {
            "condition":"query.block_property('vatonage:signal') == 0",
            "components":{
               "minecraft:ticking":{
                  "looping":true,
                  "range":[
                     0.05,
                     0.05
                  ],
                  "on_tick":{
                     "event":"vatonage:check_signal",
                     "target":"self"
                  }
               }
            }
         },
         {
            "condition":"query.block_property('vatonage:signal') == 1",
            "components":{
               "tag:cogsignal":{
                  
               },
               "minecraft:ticking":{
                  "looping":true,
                  "range":[
                     0.1,
                     0.1
                  ],
                  "on_tick":{
                     "event":"vatonage:clear_signal",
                     "target":"self"
                  }
               }
            }
         },
         {
            "condition":"query.block_property('vatonage:signal') == 2",
            "components":{
               "minecraft:ticking":{
                  "looping":true,
                  "range":[
                     0.15,
                     0.15
                  ],
                  "on_tick":{
                     "event":"vatonage:clear_signal",
                     "target":"self"
                  }
               }
            }
         }
      ]
   }
}