Want a world-shattering new look at the uses of a bow and arrow? How about a fun way to break both your friend's windows and their trust in you at the same time? If you answered yes to either, this datapack is for you!
With this datapack your arrows will smash through any windows they hit, shattering the glass and playing that wonderfully violent tinkling sound as they do so. There is a catch though: arrows can only break through glass panes. Glass blocks are just a bit too strong to be affected by your arrows.
How it works:
This datapack is actually quite simple. Every tick, the datapack will check all arrows to see what block they are currently "in," or in other words "flying through" or "passing". Because glass panes are not full blocks, the arrow can be detected as being "inside" of a glass pane before it makes contact with the glass. When such a scenario is detected, the datapack destroys the glass pane that the arrow is currently in. Thus, this datapack does not work on glass blocks, as the arrow can only make contact with the glass block, and never actually "enters" the block. This method of breaking glass with arrows can also lead to some funky behavior, such as arrows being able to break entire lines of glass if they are shot parallel to the direction of the panes instead of into the panes. Arrows also tend to slow down somewhat after breaking a glass pane. I like this behavior and have thus decided to not find a way to fix it.
This datapack goes well with my Fire Arrows Datapack, which will make burning arrows set fire to any block they land on!