{
  "format_version": "1.21.40",
  "minecraft:entity": {
    "description": {
      "identifier": "projectile:bullet_rifle",
      "is_spawnable": false,
      "is_summonable": true,
      "is_experimental": true,
      "runtime_identifier": "minecraft:arrow"
    },
    "components": {
      "minecraft:timer": {
        "time": 0.75,
        "time_down_event": {
          "event": "despawn"
        }
      },
      "minecraft:type_family": {
        "family": [ "pet", "projectile", "despawnhit" ]
      },
      "minecraft:collision_box": {
        "width": 0.25,
        "height": 0.25
      },
      "minecraft:projectile": {
        "on_hit": {
          "definition_event": {
            "affect_projectile": true,
            "event_trigger": {
              "event": "on:hit",
              "target": "self"
            }
          },
          "impact_damage": {
            "damage": 0,
            "knockback": false,
            "semi_random_diff_damage": false
          },
          "stick_in_ground": {
            "shake_time": 0.35
          }
        },
        "hit_sound": "magic.hit",
        "power": 0.015,
        "gravity": 0.005,
        "inertia": 1,
        "anchor": 2,
        "should_bounce": true,
        "angle_offset": 0,
        "offset": [
          0.0,
          -0.2,
          0.1
        ]
      },
      "minecraft:physics": {
        "has_collision": true,
        "has_gravity": true
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:conditional_bandwidth_optimization": {
        "default_values": {
          "max_optimized_distance": 30.0,
          "max_dropped_ticks": 5,
          "use_motion_prediction_hints": true
        }
      }
    },
    "events": {
      "disappear": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "despawn"
                ]
            }
          }
          ]
      },
      "despawn": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "despawn"
                ]
            }
          }
          ]
      },
      "explodeWater": {
        "queue_command": {
          "command": [
            "execute as @s[tag=clear] run damage @e[r=5] 50 entity_explosion",
            "particle torpedo:impact"
            ]
        },
        "add": {
          "component_groups": [
            "explodeWater"
            ]
        }
      },
      "on:hit": {
        "sequence": [
          {
            "queue_command": {
              "command": [
                "execute as @s[tag=!filler] run scriptevent apply:projectile"
              ]
            }
          },
          {
            "queue_command": {
              "command": [
                "tag @s add filler"
              ]
            }
          }
        ]
      },
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "queue_command": {
              "command": [
                "tag @s add iframes",
                "scoreboard players operation @s petID = @e[c=1,type=!projectile:bullet_rifle] petID",
                "scoreboard players operation @s projectileOutput = @e[c=1,type=!projectile:bullet_rifle] projectileOutput"
                ]
            }
          },
          {
            "queue_command": {
              "command": [
                "scoreboard players set @s stunTime 2",
                "scoreboard players set @s hitboxRange 2"
                ]
            }
          }
        ]
      }
    },
    "component_groups": {
      "explodeWater": {
        "minecraft:explode": {
          "power": 0,
          "fuse_length": 0.05,
          "max_resistance": 2.2,
          "breaks_blocks": true,
          "causes_fire": false,
          "destroy_affected_by_griefing": true,
          "fire_affected_by_griefing": false,
          "fuse_lit": true
        }
      },
      "exploding": {
        "minecraft:explode": {
          "power": 0,
          "fuse_length": 0.05,
          "max_resistance": 4.2,
          "breaks_blocks": false,
          "causes_fire": false,
          "destroy_affected_by_griefing": true,
          "fire_affected_by_griefing": false,
          "fuse_lit": true
        }
      },
      "despawn": {
        "minecraft:instant_despawn": {}
      }
    }
  }
}